﻿function createHttpRequest(){
	if(window.ActiveXObject){
		try {
			return new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (e2) {
				return null;
			}
		 }
	} else if(window.XMLHttpRequest){
		return new XMLHttpRequest() ;
	} else {
		return null;
	}
}
function requestFile(data,method,fileName,async){
	var httpoj = createHttpRequest();
	httpoj.open( method , fileName , async );
	httpoj.setRequestHeader('Pragma', 'no-cache');
	httpoj.setRequestHeader('Cache-Control', 'no-cache');
	httpoj.setRequestHeader('If-Modified-Since', 'Thu, 01 Jun 1970 00:00:00 GMT');
	httpoj.onreadystatechange = function(){
		if (httpoj.readyState==4){
			on_loaded(httpoj);
		}
	}
	httpoj.send(data);
}

function on_loaded(oj){
	res  = oj.responseText;
	document.getElementById("souba_box").innerHTML =res;
	setTimeout("requestFile( '' , 'GET', '/cron/renew.txt' , true )",120000);
}

function textChart(tId,refcd,fla){

/*
	if(fla%2){
		document.getElementById(tId).style.backgroundColor="#e3e1d2";
	}else{
		document.getElementById(tId).style.backgroundColor="#eee000";
	}
*/
	document.getElementById(tId).style.backgroundColor="#e3e1d2";

	if(refcd==''||refcd=='2DJX01'||refcd=='3TSE21'){
		document.getElementById('chartimg').src="http://www.sunward-t.co.jp/images/index/no_available.gif";
	}else{
		document.getElementById('chartimg').src="http://202.239.37.75/sw/chart_img.php?size=C&refcd="+refcd+"&dlvm=00&type=1&color=2";
	}
}

function textChart2(tId){
//	alert(document.getElementById(tId).style.backgroundColor);
		document.getElementById(tId).style.backgroundColor="";
}

