function myeki(url,target) {
	window.name='ekitan';
	window.open(url,target, 'SCROLLBARS=1,RESIZABLE=1,WIDTH=320,HEIGHT=330');
}
function copyright(year,corp) {
	theYear = 2011; //クライアントに左右されないようにする、年１のメンテ要
	theCorp = "駅探";
        privacy = "<table width='100%'><tr><td align='right'><a href='http://ekitan.com/help/privacy.shtml' target='_blank'>個人情報保護方針</a></td></tr></table>";
	if (typeof(corp) == "undefined") {
		theCorp = "駅探";
	} else {
		theCorp = corp;
	}	

	if ((typeof(year) == "undefined")||(year.length==0)) {
		document.write(privacy+"Copyright(C)2011 "+theCorp+", All Rights Reserved");
		return 0;
	}
	if (year == theYear) {
		document.write(privacy+"Copyright(C)"+year+" "+theCorp+", All Rights Reserved");
		return 0;
	} 
	if (year < theYear) {
		document.write(privacy+"Copyright(C)"+year+"-"+theYear+" "+theCorp+", All Rights Reserved");
		return 0;
	}
	if (year > theYear) {
		document.write(privacy+"Copyright(C)2011 "+theCorp+", All Rights Reserved");
		return 0;
	}
	return -1;
}
function Link(form, sel) {
	adrs = sel.options[sel.selectedIndex].value;
	if (adrs != "-" ) parent.location.href=adrs;
}
//乗り換え案内リンク用 20011016
function setSF()
{
	item_no = document.Norikae.SF_select.selectedIndex;
	stcode  = document.Norikae.SF_select.options[item_no].value;
  if (item_no != 0) {
	document.Norikae.SF.value = (stcode.split("-",4))[1];
	document.Norikae.SFDF.value = (stcode.split("-",4))[1];
	document.Norikae.SFCODE.value = (stcode.split("-",4))[0];
	//document.Norikae.SF.value = stcode;
  }
}
function setST()
{
	item_no = document.Norikae.ST_select.selectedIndex;
	stcode  = document.Norikae.ST_select.options[item_no].value;
  if (item_no != 0) {
	document.Norikae.ST.value = (stcode.split("-",4))[1];
	document.Norikae.STDF.value = (stcode.split("-",4))[1];
	document.Norikae.STCODE.value = (stcode.split("-",4))[0];
	//document.Norikae.ST.value = stcode;
  }
}

function checkinput()
{
	if(document.Norikae.ST.value == "" && document.Norikae.SF.value == ""){
		alert("乗車/下車駅を入力してください。");
		document.Norikae.SF.focus();
		return false;
	}else if(document.Norikae.SF.value == ""){
		alert("乗車駅を入力してください。");
		document.Norikae.SF.focus();
		return false;
	}else if(document.Norikae.ST.value == ""){
		alert("下車駅を入力してください。");
		document.Norikae.ST.focus();
		return false;
	}else {
	
	if(document.Norikae.ST.value != document.Norikae.STDF.value) {
		document.Norikae.STDF.value = "";
		document.Norikae.STCODE.value = "";
	}
	
	if(document.Norikae.SF.value != document.Norikae.SFDF.value) {
		document.Norikae.SFDF.value = "";
		document.Norikae.SFCODE.value = "";
	}
		return true;
	}
}

//駅候補リスト取得用 20020228
function getStationList(fieldName) {
	browserName=navigator.appName;
	cookieData = document.cookie + ";";
	cookieName = "";
	start = 0;
	
//ブラウザに依存しないように変更20040827
	isUTF = (unescape("%u99C5") == "駅");
//	alert(isUTF);
	if (isUTF) {//UTFエスケープのブラウザなら
		//stationList2がUTF-IE
		browserName = "Microsoft Internet Explorer";
	} else {
		//stationList2がUTF以外はSJIS-NS
		browserName == "Netscape"
	}

//Safari処理 cookie処理はIEと同様
/*
	if ( navigator.userAgent.indexOf("Safari") > 0) {
		browserName = "Microsoft Internet Explorer";
	}
*/

	if (browserName == "Netscape") {
		cookieName = "stationList=";
	}
	if (browserName == "Microsoft Internet Explorer") {
		cookieName = "stationList2=";
	}

	start = cookieData.indexOf(cookieName);

	stName = new Array(10);
	stCode = new Array(10);
	stPrio = new Array(10);

	if (start != -1) {
		//split cookie data 
		end = cookieData.indexOf(";", start);
		stList = cookieData.substring( start+ cookieName.length, end);
		stDim = stList.split("|",10);
		stNum = stDim.length-1;
		for (i=0;i<stNum;++i) {
			stPrio[i] = (stDim[i].split("-",4))[2];
			stCode[i] = (stDim[i].split("-",4))[0];
			if (browserName == "Netscape") {
				stName[i] = unescape((stDim[i].split("-",4))[1]);
			}
			if (browserName == "Microsoft Internet Explorer") {
				stName[i] = unescape(((stDim[i].split("-",4))[1]).replace(/\\/g,"%"));
			}
		}
		//sort station list 
		for (i=0;i<stNum;i++) {
			for (j=0;j<stNum-1;j++) {
				if (stPrio[j] < stPrio[j+1]) {
					tmp = stPrio[j+1];stPrio[j+1] = stPrio[j];stPrio[j] = tmp; 
					tmp = stCode[j+1];stCode[j+1] = stCode[j];stCode[j] = tmp; 
					tmp = stName[j+1];stName[j+1] = stName[j];stName[j] = tmp; 
				}
			}
		}
		//write station list 
		document.writeln("<select name=\""+fieldName+"_select\" onchange=\"set"+fieldName+"()\">");
		document.writeln('<option selected>駅一覧</option>');
		for (i=0;i<stNum;++i) {
			if (stName[i].length > 4) {
				document.writeln("<option value="+stCode[i]+"-"+stName[i]+">"+stName[i].substring(0,4)+"..</option>");
			} else {
				document.writeln("<option value="+stCode[i]+"-"+stName[i]+">"+stName[i]+"</option>");
			}
		}
		document.writeln("</select>");
	}
}

//

