if(document.location.host != "www.shigagin.com") include('/common/js/testserver.js');
include('/common/js/styleswitcher.js');
include('/common/js/rollover.js');
include('/common/js/togglelayer.js');
include('/common/js/addalert_stio.js');
include('/common/js/direct.js');
include('/common/js/selecturl.js');


function windowOpen(theURL,winName,features, protocol){
	if(theURL.indexOf("/") == 0){
		if(!protocol) protocol = "http";
		theURL = protocol + "://" + document.location.host + theURL;
	}
	window.open(theURL,winName,features);
}	

function addEvent(eventTarget, eventName, func){
	if(eventTarget.addEventListener){
		eventTarget.addEventListener(eventName, func, false);
	} else if(window.attachEvent){
		eventTarget.attachEvent('on'+eventName, function(){func.apply(eventTarget);});
	}
}

function onLoadEvent(){
//	addAlert();
//	smartRollover();
//	togglelayer.init();
//	tinyScrolling.init();
	if(navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Mac") != -1){
		selectURL();
	}
}

function include(astrFile){
	if(navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Mac") != -1){
		document.write("<script type='text/javascript' src='" + astrFile + "'></script>");
	} else{
		var script = document.createElement('script');
		script.src = astrFile;
		script.type = 'text/javascript';
		script.defer = true;
		document.getElementsByTagName('head').item(0).appendChild(script);
	}

//var xhr=null;
//if (window.XMLHttpRequest)xhr=new XMLHttpRequest();
//else if(window.ActiveXObject)
// try {xhr=new ActiveXObject("Msxml2.XMLHTTP");}
//    catch(e){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
//xhr.open("GET",astrFile,false);xhr.send("");eval(xhr.responseText);
}

function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}

function registCookie(key, val,  tmp) {
    tmp = key + "=" + escape(val) + "; ";
    // tmp += "path=" + location.pathname + "; ";
    tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
    document.cookie = tmp;
}

function clearCookie(key) {
    document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}

function openorgan(url, organ) {
	// replaceは店舗検索SJISエラー対策
	var mes = "'ここから先の情報は\n'" + organ + "'によるものです。'";
	if( confirm(mes.replace(/'/g,"")) == true ) {
		organwin = window.open(url,"organ","location=yes,menubar=yes,scrollbars=yes,toolbar=yes,status=yes,resizable=yes");
	}
}

