var IP_php_url = "data/common/cgi/env/ip_env.php";
var OS_cgi_url = "data/common/cgi/env/os_env.cgi";

var ip_data = new Array();
var os_data = new Array();
var get_mode= 0;

ip_now_time  = new Date();
IP_php_url = IP_php_url + "?" + ip_now_time.toString();
OS_cgi_url = OS_cgi_url + "?" + ip_now_time.toString();

loadFile(IP_php_url);

function loadFile(LDfile)
{
	IPDATA_httpObj = createXMLHttpRequestforIP(getIPDATA);
	if (IPDATA_httpObj)
	{
		IPDATA_httpObj.open("GET",LDfile,true);
		IPDATA_httpObj.send(null);
	}	
}

function getIPDATA()
{
		if ((IPDATA_httpObj.readyState == 4) && (IPDATA_httpObj.status == 200))
		{
			get_moto_data = IPDATA_httpObj.responseText;
			
			if (get_mode == 0)
			{
				get_mode = 1;
				
				index_count_old = 0;
				for (hoge = 0; hoge < 6; hoge++)
				{
					index_count_new = get_moto_data.indexOf("___NEXT_DATA___",index_count_old);
					ip_data[hoge] = get_moto_data.substring(index_count_old,index_count_new);
					index_count_old = index_count_new + 15;
				}
				document.infoform.REMOTE_ADDR.value = ip_data[0];
				document.infoform.REMOTE_HOST.value = ip_data[1];
				document.infoform.HTTP_HOST.value = ip_data[2];
				document.infoform.HTTP_ACCEPT.value = ip_data[3];
				document.infoform.HTTP_USER_AGENT.value = ip_data[4];
				document.infoform.HTTP_REFERER.value = ip_data[5];
				document.infoform.GetUserAgent.value = GetUserAgent();//ブラウザを表す文字列
				document.infoform.GetAppCodeName.value = GetAppCodeName();//ブラウザの開発コード
				document.infoform.GetAppVersion.value = GetAppVersion();//ブラウザのバージョン
				document.infoform.GetAppMinorVersion.value = GetAppMinorVersion();//ブラウザのマイナーバージョン
				document.infoform.GetAppName.value = GetAppName();//ブラウザ種類
				document.infoform.GetMimeTypes.value = GetMimeTypes();//サポートするMIMEタイプ
				document.infoform.GetBrowserLanguage.value = GetBrowserLanguage();//ブラウザの言語環境
				document.infoform.GetLanguage.value = GetLanguage();//ブラウザの言語環境(language)
				document.infoform.GetCookieEnabled.value = GetCookieEnabled();//クッキーの利用可否
				document.infoform.GetTaintEnabled.value = GetTaintEnabled();//データの暗号化可否
				document.infoform.GetJavaEnabled.value = GetJavaEnabled();//Javaの利用可否
				document.infoform.GetPlugins.value = GetPlugins();//プラグイン
				document.infoform.GetOnLine.value = GetOnLine();//オンライン状態
				document.infoform.GetReferrer.value = GetReferrer();//どこから来たか
				document.infoform.GetPlatform.value = GetPlatform();//プラットフォーム
				document.infoform.GetSystemLanguage.value = GetSystemLanguage();//パソコンの言語環境
				document.infoform.GetUserLanguage.value = GetUserLanguage();//ユーザーの言語環境
				document.infoform.GetScreenSize.value = GetScreenSize();//モニタサイズ
				document.infoform.GetScreenColor.value = GetScreenColor();//モニタ表示色
				document.infoform.GetCpuClass.value = GetCpuClass();//パソコンのCPU情報
				
				loadFile(OS_cgi_url);
				
			}else
			{
				index_count_old = 0;
				for (hoge = 0; hoge < 2; hoge++)
				{
					index_count_new = get_moto_data.indexOf("___NEXT_DATA___",index_count_old);
					os_data[hoge] = get_moto_data.substring(index_count_old,index_count_new);
					index_count_old = index_count_new + 15;
				}
				
				document.infoform.GetBROWSERcgi.value = os_data[0];//
				document.infoform.GetOScgi.value = os_data[1];//
				
			}
		}
}

function createXMLHttpRequestforIP(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;
}
