//#####################################
//XMLRequest関連
//#####################################
function loadData(funcname,url){
		httpObj = createXMLHttpRequest(funcname);
		if (httpObj){
			var fName
			if(!opt.isTest){
				fName = url;
			}else{
				fName = "curl.cgi?sURL="+escape(opt.baseURL+url);
			}
			httpObj.open("GET",fName,true);
			httpObj.send(null);
		}
}

function createXMLHttpRequest(cbFunc){
	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 = cbFunc;
	return XMLhttpObject;
}

//#####################################
//多用する関数
//#####################################
function setWidth(){
    if ( window.innerWidth ) { return window.innerWidth; }   
    else if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }   
    else if ( document.body ) {     	return document.body.clientWidth; }   
    return null;   
}

function setHeight(){
    if ( window.innerHeight ) { return window.innerHeight; }   
    else if ( document.documentElement && document.documentElement.clientHeight != 0 ) { return document.documentElement.clientHeight; }   
    else if ( document.body ) { return document.body.clientHeight; }   
    return null;   
}

//####################################################################################
//　クッキーファイル書き込み
//       1999 Presented By KaZuhiro FuRuhata
//       This script is free!!
//####################################################################################

//-------------------------------------------------------------------------------
//　一時的にCookieを使用するための関数
//　成功した時はtrue,失敗した時はfalseを返す
//-------------------------------------------------------------------------------
function tempCookie(theName__,theValue__)
{
	if ((theName__ != null) && (theValue__ != null))
	{
		document.cookie = theName__ + "="+theValue__;
		return true;
	}
	return false;
}

//　Cookieにデータを保存する
//　成功した時はtrue,失敗した時はfalseを返す
function setCookie(theName__,theValue__,theDay__)
{
	if ((theName__ != null) && (theValue__ != null))
	{
		var expDay__ = "Wed, 01 Jan 2020 18:56:35 GMT";	//　指定されない場合とりあえず2020年
		if (theDay__ != null)
		{
			theDay__ = eval(theDay__);	//　文字列の場合でも数値にする（念のため）
			var setDay = new Date();
			setDay.setTime(setDay.getTime()+(theDay__*1000*60*60*24));
			expDay__ = setDay.toGMTString();
		}
		document.cookie = theName__ + "="+escape(theValue__)+";expires="+expDay__;
		return true;
	}
	return false;
}

//-------------------------------------------------------------------------------
//　Cookieのデータを削除する（即座にファイルから消える訳じゃありません）
//　常にtrueを返す
//-------------------------------------------------------------------------------
function deleteCookie(theName__)
{
	document.cookie = theName__ + "=;expires=Thu,01-Jan-70 00:00:01 GMT";
	return true;
}

//-------------------------------------------------------------------------------
//　Cookieから指定されたデータを抜きだす
//　成功した時はnull以外,失敗した時はfalseを返す
//-------------------------------------------------------------------------------
function getCookie(theName__)
{
	theName__ += "=";	//　=を追加して検索の手抜きをする
	theCookie__ = document.cookie+";";	//　検索時最終項目で-1になるのを防ぐ
	start__ = theCookie__.indexOf(theName__);	//　指定された名前を検索する
	if (start__ != -1)
	{
		end__ = theCookie__.indexOf(";",start__);
		return unescape(theCookie__.substring(start__+theName__.length,end__));
	}
	return false;
}

