//別ウィンドウリンク
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
	if (anchor.getAttribute("href") &&
		((anchor.getAttribute("rel") == "external nofollow") || (anchor.getAttribute("rel") == "nofollow external") || (anchor.getAttribute("rel") == "external")))
		anchor.target = "_blank";
	}
}
window.onload = externalLinks;

//路線選択タブ用 n1:対象No,n2:最大タブ数,n3:対象タブID,n4:対象ボタンID,n5:対象エリア,n6:対象路線
function js_changeTab(n1,n2,n3,n4,n5,n6){
	//$(tabName).className = "noshow";
	targetId1 = "train_tab1_"+n5+"_"+n6;	
	targetId2 = "train_tab2_"+n5+"_"+n6;	
	targetId3 = "train_tab3_"+n5+"_"+n6;	
	list1 = document.getElementById(targetId1).getElementsByTagName('a');
	list2 = document.getElementById(targetId2).getElementsByTagName('a');
	list3 = document.getElementById(targetId3).getElementsByTagName('a');
	for(i=0;i<list1.length;i++){
		list1[i].className = "noshow";
	}
	for(i=0;i<list2.length;i++){
		list2[i].className = "noshow";
	}
	for(i=0;i<list3.length;i++){
		list3[i].className = "noshow";
	}
	
	tab = document.getElementById(n3).getElementsByTagName('div');
	for(var i=0; i<tab.length; i++) {
    	tab[i].className = "noshow";
	}

	tabName = n3 + "_"+ n1;
	$(tabName).className = "show";
	listName = n4;
	$(listName).className = "show";
	
}
function js_submit(n1){
	$(n1).submit();
	return false;
	}

//GIRLページ　写真切り替え n1:ターゲットID n2:写真ＵＲＬ
function changePhoto(n1,n2){
	$(n1).src = n2;
}


//IE6 CSS:HOVERちらつき対策
if (typeof document.documentElement.style.maxHeight  == "undefined") {
	try {
	 document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}
}

//文字数制限：t1 = 文字数上限 t2 = this
function js_text_limit(t1,t2){
	input_text = $(t2).value;	
	text_length = input_text.length;
	if(text_length > t1){
		input_text = input_text.substr(0,t1);	
	}
	$(t2).value = input_text;
	
	return;
	
}

//文字数カウント：t1 =  表示先インプットタグID t2 = this
function js_text_count(t1,t2){
	input_text = $(t2).value;	
	text_length = input_text.length;
	$(t1).value = text_length;
	
	return;
	
}
//メールフォーム用チェック＆送信
function js_send_mail(s1){
		formData = $(s1).getElementsByTagName('input');
		for(i in formData){
			if(formData[i].disabled == true){
				formData[i].name = null;	
			}	
		}
		shopName = document.getElementById('shop_name').value;
		shopTel = document.getElementById('shop_tel').value;
		shopMail = document.getElementById('shop_mail').value;
		shopAgree = document.getElementById('agree_chk').value;
		var alert_msg = "";
		if(!shopName){
			alert_msg += "店名を入力して下さい\r\n";
		}
		if(!shopTel){
			alert_msg += "電話番号を入力して下さい\r\n";
		}
		if(!shopMail){
			alert_msg += "メールアドレスを入力して下さい\r\n";
		}
		if(shopAgree != "ok"){
			alert_msg += "規約への同意が必要です\r\n";
		}
		if(alert_msg){
			alert(alert_msg);
		}else{
			$(s1).submit();
		}
}

//フォーム可否：t1 = ターゲットフォーム t2 = 個数
function js_form_readoff(t1,t2){
	for(i=1;i<=t2;i++){
		targetForm = t1+i;
		if($(targetForm).disabled == true){
			$(targetForm).disabled = false;
			
		}
	
	}
	return;
	
}

//フォーム可否：t1 = ターゲットフォーム t2 = 個数
function js_form_readon(t1,t2){
	for(i=1;i<=t2;i++){
		targetForm = t1+i;
	
		if($(targetForm).disabled == false){
			$(targetForm).disabled = true;	
		}
	}
	return;
	
}
function js_bg_change(t1,t2){
	t1.style.background = t2;
	return;
}

//写真読込（スマートフォン用）p1～p5：写真URL
function getPhoto(p0,p1,p2,p3,p4,p5){
	girlPhoto[0] = new Image();	
	girlPhoto[1] = new Image();	
	girlPhoto[2] = new Image();	
	girlPhoto[3] = new Image();	
	girlPhoto[4] = new Image();	
	girlPhoto[5] = new Image();	
	girlPhoto[0].src = p0;
	girlPhoto[1].src = p1;
	girlPhoto[2].src = p2;
	girlPhoto[3].src = p3;
	girlPhoto[4].src = p4;
	girlPhoto[5].src = p5;
}

//GIRLページ　写真切り替え(スマートフォン用) n1:ターゲットID n2:写真番号
function changePhotoS(n1,n2){
	$(n1).src = girlPhoto[n2].src;
	
}




