﻿	
	function cbo_art_type_onchange()
	{
		alert(document.frm.cbo_art_type.selectedIndex);
	}

	
	/* xu ly lay gia tri 2 combo box 最寄駅 */
	function cbo_art_railway_id_change()
	{		
		document.frm.cbo_art_station_id.options.length = 0;
		var railway_id = document.frm.cbo_art_railway_id.options[document.frm.cbo_art_railway_id.selectedIndex].value;		
		var sta_index = 0;
		for(var i=0;i<document.frm.cbo_station_tmp.options.length;i++)
		{
			var sta_value = document.frm.cbo_station_tmp.options[i].value;
			var rw_id = sta_value.substring(0,sta_value.indexOf("-"));
			if(rw_id == railway_id)
			{
				var tmp      = sta_value.substring(sta_value.indexOf("-")+1,sta_value.length);
				var sta_id   = tmp.substring(0,tmp.indexOf("-"));
				var sta_name = tmp.substring(tmp.indexOf("-")+1,tmp.length);
				var new_option = new Option(sta_name,sta_id);
				document.frm.cbo_art_station_id.options[sta_index] = new_option;
				sta_index++;
			}			
		}
		document.frm.cbo_art_station_id.options[sta_index] = new Option("-","");		
	}
	function btn_pri_school_click(SID)
	{
		if(document.frm.cbo_art_city.options[document.frm.cbo_art_city.selectedIndex].text=="--"){
	      alert("所在地を選んでください。");
		  return false;
	   }
		
	    document.frm.hd_city_name.value=document.frm.cbo_art_city.options[document.frm.cbo_art_city.selectedIndex].text;
	   document.frm.action = "../school/pri_school.php?"+SID;
	   document.frm.submit();			
	}
	function btn_high_school_click(SID)
	{
		if(document.frm.cbo_art_city.options[document.frm.cbo_art_city.selectedIndex].text=="--"){
	      alert("所在地を選んでください。");
		  return false;
	   }
		
	    document.frm.hd_city_name.value=document.frm.cbo_art_city.options[document.frm.cbo_art_city.selectedIndex].text;
	   document.frm.action = "../school/high_school.php?"+SID;
	   document.frm.submit();			
	}
	
	function btn_submit_click(SID)
	{  			
		document.frm.EVENT.value = "UPDATE";			
		document.frm.action = "../edit/article_edit.php?"+SID;
		document.frm.submit();
	}			

	function btn_del_image_click(_file_name,_img_num)
	{
		document.frm.hd_file_del.value = _file_name;
		document.frm.hd_img_num.value  = _img_num;
		document.frm.EVENT.value = "DEL_FILE";
		document.frm.submit();
	}
	function logout(SID)
	{
		if(!confirm(str_mes_logout))
		{
			return ;
		}
		document.frm.EVENT.value = "LOGOUT";
		document.frm.action = "article_edit.php?"+SID;
		document.frm.submit();
	}
	
	function img_art_image_on_change(obj,image_id){
		if(image_id == "file_image1"){
			document.frm.file_image1.src = obj.value;
		}
		else if(image_id == "file_image2"){
			document.frm.file_image2.src = obj.value;
		}
		else if(image_id == "file_image3"){
			document.frm.file_image3.src = obj.value;
		}
		else if(image_id == "file_image4"){
			document.frm.file_image4.src = obj.value;
		}
		else if(image_id == "file_image5"){
			document.frm.file_image5.src = obj.value;
		}
		else{
			document.frm.file_image6.src = obj.value;
		}				
	}

