var cookieName = "ohtani-jimuki.com";
var wD = "＜＠＠＠＞";
var pubCookieDomain = "www.ohtani-jimuki.com";
var pubCookiePath   = "/";
var pubExpTime      = 30*60*1000;
var pubImagePath	= '/images/';
var pubIndexHtml	= '/index.html';
var pubCgiPath		= '/cgi-bin/info/ojiinfo.cgi';


function msend() {
	var s1='mai';
	var s2='lto:';
	var s3='in';
	var s4='@';
	var s5='ohtani-';
	var s6='jimuki.com';
	var s7='';
	var ss=s1+s2+s3+s4+s5+s6+s7;
	location.href = ss;
}

function langChange(hash1) {
	var hash2 = {'airportName':'A000','footerMenuSitemap':'A100','sitemaptitle':'A100','shonaiflightinfoTitle':'W012','flightsituationTitle':'W010','flighttitle2a':'F900','rakurakuTop':'C000','gallerytop':'G000','infocontinue':'I000','siteNameJP':'W999','flighttop':'W000','flighttitle3a':'W010','flightinfoanatel':'W011','liveweathera0':'CA00','liveweathera1':'CA01','liveweathera2':'CA02','liveweathera3':'CA03','liveweathera4':'CA04','tsuruoka0':'CA99','tsuruoka1':'CA03','tsuruoka2':'CA04','analink1':'W021','analink2':'W022','analink3':'W023','analink4':'W023','analink5':'W023','analink9':'W999','accesstop':'W030','accessairport':'W031','accessparking':'W032','accessbus':'W033','accesstaxi':'W034','accesscar':'W035','newsListTop':'W040'};
	for (var key in hash2) {
		if (document.getElementById(key) != undefined) {
			if (hash1[hash2[key]] != undefined) {
				document.getElementById(key).innerHTML = hash1[hash2[key]];
			}
		}
	}

}

function divLangDisplay() {
	var w = '650px';
	var wLang = getCookie(cookieName);
	var IDON,IDOFF;
	if (wLang == '' || wLang == 'jp') {
		IDON  = new Array('submenu','special1','special2','category','footerMenu1','footerMenu2','banner','newsList','rakurakuJPx','bodyRightRakuraku');
		IDOFF = new Array();
	} else {
		IDON  = new Array('submenu','newsList','bodyRightRakuraku','footerMenu1');
		IDOFF = new Array('special1','special2','category','banner','footerMenu2','rakurakuJPx');
		if (document.getElementById('bodyRightRakuraku') != undefined) {document.getElementById('bodyRightRakuraku').style.width = w;}
	}
	for (var i in IDON) {
		if (document.getElementById(IDON[i]) != undefined) {document.getElementById(IDON[i]).style.display = 'block';}
	}
	for (var i in IDOFF) {
		if (document.getElementById(IDOFF[i]) != undefined) {document.getElementById(IDOFF[i]).style.display = 'none';}
	}
	document.getElementById('body').style.display = 'block';
}



function windowOpen(url,ww,hh){
	window.open(url,'_blank',' status=no, toolbar=no, location=no, menubar=no, scrollbars=no, resizable=no, height='+hh+', width='+ww);
}

function winOpen(url,ww,hh) {
	window.open(url , "" , "width=900,height=700,resizable=yes,menubar=yes,toolbar=yes,scrollbars=yes");
}

function getLang() {
	var wLang = getCookie(cookieName);
	return(wLang);
}

function setLang(pLang) {
	setCookie(cookieName,pLang,'',pubCookieDomain,pubCookiePath);
}

function changeFirst(pPage) {
	var wLang = getLang();
	changeDisp(pPage,wLang);
}

function changeDisp(pPage,pLang) { 
	var imgPath = pubImagePath;
	var wLang = pLang;
	if (wLang == '') {wLang = '0';}
	document.getElementById('menu').src = imgPath + 'menu_contents' + wLang + '.gif';
	document.getElementById('top').src = imgPath + 'top' + wLang + '.gif';
	if (pPage == 'index') {
		document.getElementById('title_location').src = imgPath + 'title_location' + wLang + '.gif';
		document.getElementById('title_news').src = imgPath + 'title_news' + wLang + '.gif';
		document.getElementById('title_goods').src = imgPath + 'title_goods' + wLang + '.gif';
	} else if (pPage == 'contents') {
		document.getElementById('award').src = imgPath + 'title_academy' + wLang + '.gif';
		var wStyle = document.getElementById('st').value;
		if (wStyle == 'newsdetail') {
			document.getElementById('subtitle').src = imgPath + 'title_news' + wLang + '.gif';
		} else if (wStyle == 'spotdetail') {
			document.getElementById('subtitle').src = imgPath + 'title_location' + wLang + '.gif';
		} else if (wStyle == 'story') {
			document.getElementById('subtitle').src = imgPath + 'title_story' + wLang + '.gif';
		} else if (wStyle == 'goodsdetail') {
			document.getElementById('subtitle').src = imgPath + 'title_goods' + wLang + '.gif';
		} else if (wStyle == 'contact') {
			document.getElementById('subtitle').src = imgPath + 'title_contact' + wLang + '.gif';
		}
	}
}

function changeLang(pLang,pUrl,pQuery,pCgi) {
	var wLang = checkLang(pLang);
	setLang(wLang);
	var wCgi = pubCgiPath;

	if (pUrl == 'index') {
		document.location.href = pubIndexHtml;
	} else if (pUrl == 'contents') {
		//document.location.href = wCgi + '?st=' + document.getElementById('st').value;
		document.location.href = wCgi + '?' + pQuery;
	} else if (pUrl == '') {
		document.location.href = pubIndexHtml;
	} else {
		document.location.href = pUrl;
	}
}

function checkLang(pLang) {
//  Lang  JA:0 EN:1 CH:2 TW:3 KR:4 FR:5
//	var wLangMax = 5;
	var wLang = pLang;
	if (wLang == '') {wLang = getLang();}
	if (wLang == '') {wLang = 'jp';}
//	if (wLang < 0 || wLang > wLangMax) {wLang = 0;}
	return(wLang);
}



function getCookie(pKey){
    var wCookie = document.cookie+';';
    var wCookieS = wCookie.indexOf(pKey,0);
    if(wCookieS != -1){
        wCookie = wCookie.substring(wCookieS,wCookie.length);
        wStart = wCookie.indexOf('=',0);
        wEnd = wCookie.indexOf(';',wStart);
        return(unescape(wCookie.substring(wStart+1,wEnd)));
    }
    return('');
}

function setCookie(pKey,pVal,pExp,pDomain,pPath) {
    var wExpDate = new Date();
    var wCookieExpire = '';
    var wNewCookie = '';
    wNewCookie = pKey + '=' + escape(pVal) + ';';

	//ドメイン内どこでもCookieを読めるようにdomain=とpath=を指定する
	if (pDomain != "" && pDomain != "NaN") {
		wNewCookie += "domain=" + pDomain + ";";
	}
	if (pPath != "" && pPath != "NaN") {
		wNewCookie += "path=" + pPath + ";";
	}

	if (pExp != '' && pExp != "NaN") {
		wCookieExpire = pExp;
	} else {
		//wCookieExpire = 1000*60*60*24*365*10;    // 有効期間( msec = 1000x秒x分x時間x日x年 )
		wCookieExpire = 1000*60*60;    // 有効期間( msec = 1000x秒x分x時間x日x年 )
	}
    wExpDate.setTime(wExpDate.getTime() + wCookieExpire); 
	wNewCookie += 'expires=' + wExpDate.toGMTString() + ';';

    document.cookie = wNewCookie;

}

function delCookie(key){
    var wExpDate = new Date();
    wExpDate.setYear(wExpDate.getYear()-1);
    var wNewCookie = pKey + '=;' + 'expires=' + wExpDate.toGMTString() + ';';

    document.cookie = wNewCookie;
}



