//Copyright(C) 2006 DeNA Co,,Ltd. All rights reserved.

function isIE() {
	if (navigator.appName.toLowerCase().indexOf('microsoft') > -1) {
		return true;
	}
	return false;
}

function useIEunescape() {
	if (navigator.appName.toLowerCase().indexOf('microsoft') > -1) {
		return true;
	} else {
		if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
			return true;
		}
	}
	return false; // NN 4.x, NN 6.x, NN7.x(J)
}

function useIEunescapeLike() {
	// returns true if the browser must use unescape_likeIE(), false otherwise.
	if (navigator.userAgent.toLowerCase().indexOf('safari') > -1) {
		return true;
	}
	return false;
}

// unescape %uHHHH to string samely as IE's unescape();
//   for browsers that cannot use their own unescape().
function unescape_likeIE(value) {
	var t = value.split('%u');
	if (t.length > 1) {
		var s = [ ];
		for (var i = 1; i < t.length; i++) {
			s[i] = String.fromCharCode(parseInt(t[i], 16));
		}
		value = s.join('');
		return value;
	}
}

function setCookie(p_name, p_value, p_expires, p_path, p_domain, p_secure) {
	var v_text = "";
	v_text = p_name + "=" + p_value;
	if (p_expires) { v_text = v_text + "; expires=" + p_expires.toGMTString(); }
	if (p_path) { v_text = v_text + "; path=" + p_path; }
	if (p_domain) { v_text = v_text + "; domain=" + p_domain; }
	if (p_secure) { v_text = v_text + ";" + p_secure; }
	document.cookie = v_text;
}

function getValueFromCookie(key) {
	var cookies = document.cookie;
	var cValue = '';
	var index   = cookies.indexOf(key);
	if (index > -1) {
		if (cookies.indexOf(';',index) > 0) {
			cValue =  cookies.substring(
			cookies.indexOf('=',index) + 1, cookies.indexOf(';',index));
		} else {
			cValue =  cookies.substring(
			cookies.indexOf('=',index) + 1, cookies.length);
		}
	}
	return cValue;
}

function toEscape(encodeStr) {
	var retStr = '';
	for (var i=0; i<encodeStr.length; i++) {
		var c = encodeStr.charAt(i);
		if (c == '+') {
			retStr += '%20';
		} else {
			retStr += c;
		}
	}
	return retStr;
}

function getNickName() {
	var encodeStr = getValueFromCookie('A_NICKNAME');
	if (getValueFromCookie('A_USERSTATUS').length > 0 || getValueFromCookie('P_USERSTATUS').length > 0) {
		if (useIEunescapeLike()) {
			// for browsers that cannot use their own unescape()
			return unescape_likeIE(encodeStr.substring(encodeStr.indexOf('%u'), encodeStr.length));
		}
		if (useIEunescape()) {
			return unescape(encodeStr.substring(encodeStr.indexOf('%u'), encodeStr.length));
		} else {
			return unescape(toEscape(encodeStr.substring(0,encodeStr.indexOf('%u')))); 
		}
	} else {
		return '';
	}
}

function isLogin() {
	if (getValueFromCookie('A_USERSTATUS').length > 0 || getValueFromCookie('P_USERSTATUS').length > 0) {
		return true;
	} else {
		return false;
	}
}

function showNickName(vstr,mstr) {
	var name = getNickName();
	if (name.length > 0) {
		//for member
		document.write(mstr.replace('__NICKNAME__',name));
	} else {
		//for visitor
		document.write(vstr);
	}
	return;
}

function showLogin() {
	if (isLogin()) {
		document.write("<a href=/dap/sv/Logout?>???O?A?E?g</a>");
	} else {
		document.write("<a href=/dap/sv/Login?>???O?C??</a>");
	}
	return; 
}

function jump_aURL(f){
	param = f.options[f.selectedIndex].value;
	if (param != "") {
		location = "%prop.http.server.path_BID%" + param;
	}
}

function jump_rURL(f){
	param = f.options[f.selectedIndex].value;
	if (param != "") {
		location = param;
	}
}

function checkAll(checkBox){
	checkBox.checked=true;
	for (var i = 0 ; i < checkBox.length ; i++) {
		checkBox[i].checked=true;
	}
}

function uncheckAll(checkBox){
  checkBox.checked=false;
  for (var i = 0 ; i < checkBox.length ; i++) {
    checkBox[i].checked=false;
  }
}

function isMember() {
	var encodeStr = getValueFromCookie('A_NICKNAME');
	if (encodeStr.length > 0) {
		return true;
	} else {
		return false;
	}
	return false;
}

function setTextMember (textMember, textNotMember) {
	if (isMember()) {
		document.write(textMember);
	} else {
		document.write(textNotMember);
	}
}

function jump(){
	n     = document.gNAVI.MENU.selectedIndex;
	jpURL = document.gNAVI.MENU.options[n].value;
	if(jpURL != ""){
		location.href = jpURL;
	}
}

function focus(obj){
	obj.focus();
}

//icon page
function subWin1(){
  window.open("/information/icon.html","window1","width=470,height=210,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=0,resizable=1");
}

//passport_sign
function subwin2(){
  window.open("/information/passport_sign.html","sign","width=450,height=390,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no");
 }

//secret_question
function subwin3(){
  window.open("/information/secret_question.html","secretquestion","width=450,height=300,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no");
 }


var iTopap;
function infoTopap(){
iTopap = window.open('/information/#airport','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iTopap.focus();
}

var iHepburn;
function infoHepburn(){
iHepburn = window.open('/information/hepburn_list.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iHepburn.focus();
}

var iEticket;
function infoEticket(){
iEticket = window.open('/information/reception_eTicket.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iEticket.focus();
}

var iHandUp;
function infoHandUp(){
iHandUp = window.open('/information/reception_handup.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iHandUp.focus();
}

var iVisa;
function infoVisa(){
iVisa = window.open('/information/visa/','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iVisa.focus();
}

var iMilage;
function infoMilage(){
iMilage = window.open('/information/milage.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iMilage.focus();
}

var iKiyaku;
function infoKiyaku(){
iKiyaku = window.open('/information/kiyaku.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iKiyaku.focus();
}

// 初めての方へ
var iFirst;
function infoFirst(){
iFirst = window.open('/slink/information/first.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iFirst.focus();
}

//　ここからheader・footerで使っていたpopup
// よくある質問
var iFaq;
function infoFaq(){
	iFaq = window.open('/slink/information/faq/','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iFaq.focus();
}

// サイトマップ
var iSitemap;
function infoSitemap(){
	iSitemap = window.open('/slink/information/sitemap.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iSitemap.focus();
}

// 個人情報について
var iPrivacy;
function infoPrivacy(){
	iPrivacy = window.open('/slink/information/privacy1.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iPrivacy.focus();
}

// 会社案内
var iCompany;
function infoCompany(){
	iCompany = window.open('/slink/information/company.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iCompany.focus();
}

// 旅行業約款条件書
var iYakkan;
function infoYakkan(){
	iYakkan = window.open('/slink/information/yakkan/index.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iYakkan.focus();
}

// 旅行業約款条件書
var iYakkan2;
function infoYakkan2(){
	iYakkan = window.open('/slink/information/yakkan/index.html#6','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iYakkan.focus();
}

// 情報ページインデックス
var iTop;
function infoTop(){
	iTop = window.open('/slink/information/index.html','info','resizable=1,toolbar=1,scrollbars=1,left=30,top=30,width=640,height=600');
	iTop.focus();
}



