/* 透明度の指定 */
function setOpacity(theElement, theOpacity) {
	if (theOpacity >= 1) {
		if (typeof(theElement.style.opacity) != "undefined") {
			theElement.style.opacity = "1";
		} else if (typeof(theElement.style.filter) != "undefined") {
			theElement.style.filter = "";
		}
	} else {
		if (typeof(theElement.style.opacity) != "undefined") {
			theElement.style.opacity = theOpacity;
		} else if (typeof(theElement.style.filter) != "undefined") {
			theElement.style.filter = "Alpha(opacity=" + theOpacity * 100 + ")";
		}
	}
}


/* 各種イベントの追加 */
function addEvent(theElement, eventHandler, theFunction) {
	if (window.addEventListener) {
		theElement.addEventListener(eventHandler, theFunction, false);
	} else if (window.attachEvent) {
		theElement.attachEvent("on" + eventHandler, theFunction);
	}
}


/* ウィンドウの表示領域の幅を取得 */
function getWindowWidth() {
	if (typeof(innerWidth) != "undefined") {
		return innerWidth;
	} else {
		return document.documentElement.clientWidth;
	}
}


/* ウィンドウの表示領域の高さを取得 */
function getWindowHeight() {
	if (typeof(innerHeight) != "undefined") {
		return innerHeight;
	} else {
		return document.documentElement.clientHeight;
	}
}


/* XMLHttpRequestでデータを取得 */
function getResponse(theURL, theRequest, dataType, theFunction) {
	/* XMLHttpRequestオブジェクトを生成 */
	if(window.ActiveXObject){	//IE
		try {
			var theObject = new ActiveXObject("Msxml2.XMLHTTP");	//MSXML2以降
		} catch (e) {
			try {
				var theObject = new ActiveXObject("Microsoft.XMLHTTP");	//旧MSXML
			} catch (e2) {
				return;
			}
		}
	} else if(window.XMLHttpRequest){	//IE以外のXMLHttpRequestオブジェクト実装ブラウザ
		var theObject = new XMLHttpRequest();
	} else {
		return;
	}

	theObject.open("GET", theURL, true);	//アクセス先を設定
	theObject.onreadystatechange = function() {
		if (theObject.readyState == 4 && theObject.status == 200) {	//データを受け取ったときの処理
			if (dataType == "text") {
				theFunction(theObject.responseText);
			} else if (dataType == "xml") {
				theFunction(theObject.responseXML);
			}
		} else if (theObject.readyState == 4) {
			alert(theObject.status);
		}
	}
	theObject.send(theRequest);	
}
