//
// 指定されたIDのサービス情報の補足情報表示する
function showhide(id){
	if(document.getElementById){
		if(document.getElementById(id).style.display == "none") {
			document.getElementById(id).style.display = "block";
			document.getElementById(id + "img").src = "images/common_img/btn_change_01.gif";
		} else {
			document.getElementById(id).style.display = "none";
			document.getElementById(id + "img").src = "images/common_img/btn_change_00.gif";
		}
	}
}


function showSaSubInfo(id, saContentsId) {
	if(document.getElementById(id).innerHTML != null && document.getElementById(id).innerHTML.length > 0) {
		showhide(id);
	} else {
		searchSaSubInfo(id, "contentsId=" + saContentsId);
	}
}

function showServiceHandbookSaSubInfo(id, productId) {
	if(document.getElementById(id).innerHTML != null && document.getElementById(id).innerHTML.length > 0) {
		showhide(id);
	} else {
		searchSaSubInfo(id, "productId=" + productId);
	}
}

function searchSaSubInfo(id, param){
	httpObj = createXMLHttpRequestSaSub(id);
	if (httpObj) {
		httpObj.open("GET","saSubFiles.do?" + param, true);
		httpObj.send(null);
	}
}

function dispSaSubInfo(httpObj, id){
	if (httpObj.readyState == 4) {
		if(httpObj.status == 200){
			form = document.specSearchForm;
			if(httpObj.responseText != null && httpObj.responseText.length > 0) {
				document.getElementById(id).innerHTML = httpObj.responseText;
				showhide(id);
			}	
		}
	}
}

function createXMLHttpRequestSaSub(id)
{
	var XMLhttpObject = null;
	try{
		XMLhttpObject = new XMLHttpRequest();
	}catch(e){
		try{
			XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				return null;
			}
		}
	}
	if (XMLhttpObject) {
		XMLhttpObject.onreadystatechange = function() {
			dispSaSubInfo(XMLhttpObject, id);
		}
	}
	return XMLhttpObject;
}

