<!--//

function close_win(){
var nvua = navigator.userAgent;
if(nvua.indexOf('MSIE') >= 0){
if(nvua.indexOf('MSIE 5.0') == -1) {
top.opener = '';
}
}
else if(nvua.indexOf('Gecko') >= 0){
top.name = 'CLOSE_WINDOW';
wid = window.open('','CLOSE_WINDOW');
}
top.close();
}

function changeImg(iName,img){
	document.images[iName].src=img;
}

function _JumpURLnewWin(url,sizeX,sizeY) 
{
  if (url != ''){
    win=window.open(url,"a","scrollbars=1,resizable=yes,width=" + sizeX + ",height=" + sizeY);
  }
}
function _TargetWinOpen(url,sizeX,sizeY,target) 
{
  if (url != ''){
    win=window.open(url,target,"scrollbars=1,resizable=yes,width=" + sizeX + ",height=" + sizeY);
  }
}
function SelectJumpURL(obj) 
{
  url = obj.options[obj.selectedIndex].value;
  if (url != '')
  {
    window.location = url;
  }
}
function mOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)){
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	} 
} 
function mOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	} 
} 


//showLayer
function showLay(idName){ 
	if(document.getElementById){//NN6,Mozilla,IE5用
		document.getElementById(idName).style.visibility = 'visible';
	}else if(document.all){//IE4用
		document.all(idName).style.visibility = 'visible';
	}else if(document.layers){//NN4用
		document.layers[idName].visibility = 'show';
	}
}

//hideLayer
function hideLay(idName){ 
	if(document.getElementById){//NN6,Mozilla,IE5用
		document.getElementById(idName).style.visibility = 'hidden';
	}else if(document.all){//IE4用
		document.all(idName).style.visibility = 'hidden';
	}else if(document.layers){//NN4用
		document.layers[idName].visibility = 'hide';
	}
}

// 画像のonLoad
var url = new Array(


"/common/footerNvg01_on.gif",
"/common/footerNvg02_on.gif",
"/common/footerNvg03_on.gif"

);

var theImages = new Array;
function preLoad(){
	for(var i = 0; i < url.length; i++){
		theImages[i] = new Image;
		theImages[i].src = url[i];
	}
}

function disp(url){

window.open(url, "window_name", "width=545,height=650,scrollbars=yes");

} 

// スムーススクロール
function SmoothScroll(targetID){
  if( !document.getElementById ) {return true;}
  var step=10;  //初速度
  var max=400;  //最高速度
  var accel=4;  //加速度
  var interval=30;  //加速インターバル
  var current_y = document.body.scrollTop  || document.documentElement.scrollTop;
  var element=document.getElementById(targetID);
  if (!element){return true;}
  var target_y = 0;
  for (i = element;i.offsetParent;i=i.offsetParent ){
    target_y += i.offsetTop;
  }
  var count=0;
  if ( current_y > target_y ){ step = -(step); accel = -(accel);}
  var timerid = setInterval( function(){
    if (step<max) step += (count*accel);
    if ( Math.abs(current_y-target_y) < Math.abs(step) ){
      window.scrollTo((document.body.scrollTop  || document.documentElement.scrollTop),target_y);
      clearInterval(timerid);
      return false;
    }else{
      window.scrollBy(0,step);
      current_y += step;
      count++;
    }
  },interval);
  return false;
}


function area_map(stNUM,areacd){
	if(document.area_box.area_name01.value == stNUM){
		Duplicate();
	}else if(document.area_box.area_name02.value == stNUM){
		Duplicate();
	}else if(document.area_box.area_name03.value == stNUM){
		Duplicate();
	}else{
	
		if(document.area_box.area_name01.value == ""){
			document.area_box.area_name01.value = stNUM;
			document.area_box.area_cd01.value = areacd;
		}else if(document.area_box.area_name02.value == ""){
			document.area_box.area_name02.value = stNUM;
			document.area_box.area_cd02.value = areacd;
		}else if(document.area_box.area_name03.value == ""){
			document.area_box.area_name03.value = stNUM;
			document.area_box.area_cd03.value = areacd;
		}else{
			Overflow();
		}
	}
}

function Duplicate(){
//	alert("クリックした駅は既に選択済みです。");
}
function Overflow(){
	flag = confirm("これ以上選択できません。エリア選択を解除しますか？");
	if(flag){
		document.area_box.area_name01.value = "";
		document.area_box.area_cd01.value = "";
		document.area_box.area_name02.value = "";
		document.area_box.area_cd02.value = "";
		document.area_box.area_name03.value = "";
		document.area_box.area_cd03.value = "";
	}
}
// smartRollover
function GoBack(){
	if(document.area_box.area_name03.value != ""){
		document.area_box.area_name03.value = "";
		document.area_box.area_cd03.value = "";
	}else if(document.area_box.area_name02.value != ""){
		document.area_box.area_name02.value = "";
		document.area_box.area_cd02.value = "";
	}else if(document.area_box.area_name01.value != ""){
		document.area_box.area_name01.value = "";
		document.area_box.area_cd01.value = "";
	}
}


// smartRollover

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_rll."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_rll.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_rll."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

function LineMap(StName,LiStdat){
	for(i = 0; i < 10; i++){
		if(document.line_box['station' + i].value == StName){
			if(document.line_box['st_stock' + i].value == LiStdat){
				Duplicate();
				break;
			}
		}
		if(document.line_box['station' + i].value == ""){
			StDat = LiStdat.split("_");
			for(y = 0; y < StDat.length; y++){
				if(document.getElementById(StDat[y]).checked == false){
					document.getElementById(StDat[y]).checked = true;
				}
			}
			document.line_box['station' + i].value = StName;
			document.line_box['st_stock' + i].value = LiStdat;
			break;
		}
		if(i == 9){
			if(document.line_box.elements[i].value != ""){
				alert("10個以上は選択できません。");
			}
		}
	}
	var item = $('LineMap');
	Element.scrollTo(item);
}

function ClearAll(){
	flag = confirm("全てリセットします。よろしいですか？");
	if(flag){
		for(i = 0; i < 10; i++){
			StDat = document.line_box['st_stock' + i].value.split("_");
			for(y = 0; y < StDat.length; y++){
				if(document.getElementById(StDat[y]).checked == true){
					document.getElementById(StDat[y]).checked = false;
				}
			}
			document.line_box['station' + i].value = "";
			document.line_box['st_stock' + i].value = "";
		}
	}
}

function ClearOne(){
	for(i = 9; i >= 0; i--){
		if(document.line_box.elements[i].value != ""){
			StDat = document.line_box['st_stock' + i].value.split("_");
			for(y = 0; y < StDat.length; y++){
				if(document.getElementById(StDat[y]).checked == true){
					document.getElementById(StDat[y]).checked = false;
				}
			}
			document.line_box['station' + i].value = "";
			document.line_box['st_stock' + i].value = "";
			break;
		}
	}
}

function RequestArea(plc,acd){
	if(acd == ''){
		var isMSIE = /*@cc_on!@*/false;
		if(isMSIE){
			$(plc).outerHTML = '<select name="' + plc + '" id="' + plc + '"><option value="">指定なし</option></select>';
		
		}else{
			$(plc).innerHTML = '<option value="">指定なし</option>';
		}
	}else{
		new Ajax.Request("ajax_detail.php",{
			method: "get",
			parameters: "area_cd="+acd,
			onSuccess: function(httpObj){
				if(httpObj.responseText != ''){
					var isMSIE = /*@cc_on!@*/false;
					if(isMSIE){
						$(plc).outerHTML = '<select name="' + plc + '" id="' + plc + '">' + httpObj.responseText + '</select>';
					
					}else{
						$(plc).innerHTML = httpObj.responseText;
					}
				
				}
			},
			onFailure:function(httpObj){
				alert("接続できませんでした。");
			}
		});
	}

}

function RequestStation(plc,scd){
	if(scd == ''){
		var isMSIE = /*@cc_on!@*/false;
		if(isMSIE){
			$(plc).outerHTML = '<select name="' + plc + '" id="' + plc + '"><option value="">指定なし</option></select>';
		
		}else{
			$(plc).innerHTML = '<option value="">指定なし</option>';
		}
	}else{
		new Ajax.Request("ajax_detail.php",{
			method: "get",
			parameters: "line_cd="+scd,
			onSuccess: function(httpObj){
				if(httpObj.responseText != ''){
					var isMSIE = /*@cc_on!@*/false;
					if(isMSIE){
						$(plc).outerHTML = '<select name="' + plc + '" id="' + plc + '">' + httpObj.responseText + '</select>';
					
					}else{
						$(plc).innerHTML = httpObj.responseText;
					}
				
				}
			},
			onFailure:function(httpObj){
				alert("接続できませんでした。");
			}
		});
	}

}

function formConfirm(type) {
	if (type == "comfirm") {
		rtn = confirm("送信します。\nよろしいですか？");
	}
	if (rtn) {
		return true;
		}else{
		return false;
	}
}



//-->