// JavaScript Document

function login(){
var obj = document.login_form;
// Check ID and PASSWORD
	var url = "login_check.php?id="+ obj.id.value +"&pwd=" +obj.password.value;
	//alert(url);
	new Ajax(url, {
		method: 'get',
    onComplete: function(){
          if(this.response.text=="2"){
         	alert("密碼錯誤...");
         }else if(this.response.text=="1"){
         	alert("沒有您的帳號...");
         }else{
         	$('_member').innerHTML = this.response.text;
         	//location.reload(true);
         }           
    }		
	}).request();
}

function logout(x){
		var url = "logout.php?mid="+x;
		new Ajax(url, {
			method: 'get',
			update: $('_member')
		}).request();
			alert("登出成功!!");
//location.reload(true);
}

function se_city(){
var se_kind=document.getElementById('se_kind').value;
		var url = "_se_select.php?kind="+ se_kind;
		new Ajax(url, {
			method: 'get',
			update: $('_city')
		}).request();
}

function se_school(){
var se_city=document.getElementById('city').value;
		var url = "_sc_select.php?city="+ se_city;
		new Ajax(url, {
			method: 'get',
			update: $('_school')
		}).request();
}

function redirect1(x){
		var url = "_city_select.php?i="+ x;
		new Ajax(url, {
			method: 'get',
			update: $('_area_select')
		}).request();
}

window.addEvent('domready', function(){
			/* Tips 3 */
			var Tips3 = new Tips($$('.Tips3'), {
				showDelay: 400,
				hideDelay: 400,
				fixed: true
			});
});

function openData(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10){
target_house = "../book.php?city=" + x7 +"&storeid=" + x4 + "&building_name=" + x1 + "&objectid=" + x3 + "&address_name=" + x2 + "&receive=" + x5 + "&receivetel=" + x6 + "&receiveemail=" + x8 + "&kindoid="+x9;
_tar_name = x3 + x1;
self.GB_showCenter(x10, target_house,550,500);
}

function openHtml(fname,x1,x2){
// fname : function file name
// x1 : param , x2: title name
if (x2 == "") { x2 = "功能";}
target_house = "../"+fname+"?"+x1;
self.GB_showCenter(x2, target_house,535,513);
}

function openwindow_b(ob,st){
	//dcsMultiTrack('DCS.dcsuri','/index.php','DCSext.fn','高畫質影音');
  window.open("http://www.etwarm.com.tw/360/vcr_b.php?objectid="+ob+"&storeid="+st+"",'Window_b','toolbar=no,width=720,height=710,directories=no,status=no,scrollbars=no,resizable=no,menubar=no');
}

function openwindow_s(ob,st){
	//dcsMultiTrack('DCS.dcsuri','/index.php','DCSext.fn','一般畫質影音');
  window.open("http://www.etwarm.com.tw/360/vcr_s.php?objectid="+ob+"&storeid="+st+"",'Window_s','toolbar=no,width=430,height=510,directories=no,status=no,scrollbars=no,resizable=no,menubar=no');
}

function openwindow_360(ob,st){
 window.open("http://360.etwarm.com.tw/360/360.asp?n="+ob+"a&s="+st+"",'Window_360','toolbar=no,width=720,height=620,directories=no,status=no,scrollbars=no,resizable=no,menubar=no');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval("self.location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function submitform(){
with(document.sp_sel){  

		if(se_kind.value == ""){
			alert("請選擇類別...");
		  return false;
    }
    
		if(city.value == ""){
			alert("請選擇縣市...");
		  return false;
    }
    
		if(school.value == ""){
			alert("請選擇學校...");
		  return false;
    }     
	}
document.sp_sel.submit();
}
