// JavaScript Document


var css = new Css();
// ブラウザごとに違うCSSをセット
css.setBrowserDir('/css/browser/');
css.importByBrowser();




/*----------------------------------------------------------------------------------*/
//[本番環境]
var f_acclog = true;
var DOMAIN = 'imagewave.co.jp';
var HOSTNAME = 'www';
var ROOT = location.protocol + '//' + HOSTNAME+'.'+DOMAIN+'/';
var TEST_DIR_NAME = 'test/';


//[テスト環境]
var LOCAL_ROOT = 'http://local.imagewave.co.jp/';
/*----------------------------------------------------------------------------------*/

//テスト環境なら設定をテスト環境に上書き
if(isLocal()){
	
	ROOT = LOCAL_ROOT;
	
}else{
	
	if(isTest()){
		ROOT = ROOT.replace(ROOT, ROOT + TEST_DIR_NAME);
	}
}

function isTest(){
	if(location.href.indexOf(ROOT + TEST_DIR_NAME) >= 0){
		return true;
	}else{
		return false;
	}
}



var d=document,ROOT;






function isLocal(){
	if(location.href.indexOf('http://localhost/') >= 0 || location.href.indexOf('http://192.168.0') >= 0 || location.href.indexOf('http://192.168.1') >= 0 ||  location.href.indexOf('http://local.') >=0){
		return true;
	}else{
		return false;
	}
}



function acclog(){
	if(f_acclog!=true){
		return;
	}
	//ローカル環境ではreturn;
	if(isLocal()){
		return;
	}
	
	dN=new Date;
	Mins=dN.getMinutes();
	Secs=dN.getSeconds();
	URL=document.referrer;
	cls=getFileName();

	if(URL==""){URL="Unknown";}


	var accHost = (("https:" == document.location.protocol) ? "https://ss1.coressl.jp/www.imagewave.co.jp/" : "http://www.imagewave.co.jp/");

	document.write("<img src=");
	document.write(accHost + "/cgi-bin/acclog/set.cgi?");
	document.write(cls);
	document.write(","+document.location.href+","+URL+",");
	document.write(Mins+Secs);
	document.write(">");
}


function getFileName(){
	var lc=document.location.href;
	var dlength=DOMAIN.length;
	
	if(lc.indexOf(DOMAIN)){
		var tmp=lc.indexOf(DOMAIN,0)+dlength;
		var tmp=lc.substring(tmp);

		return(tmp);
	}
}




function print_name(){
	
	document.open();
	document.write('馬場　誠');
	document.close();
	}

function printTel(){
	document.open();
	document.write('03-54');
	document.write('77-1');
	document.write('0');
	document.write('09');
	document.close();
}

function getCurrentFile(){
	var lc=d.location.href;
	var dlength=DMIN.length;
	
	if(lc.indexOf(DMIN)){
		var tmp=lc.indexOf(DMIN,0)+dlength;
		var tmp=lc.substring(tmp);
		if(tmp.substring(tmp.length-1)=="/"){
			tmp+="root";
		}
		return(tmp);
	}
}


