/*預載圖片*/
img0=new Image();
img0.src="/images/home/top_button_up.gif";
img1=new Image();
img1.src="/images/home/top_button_ov.gif";
img2=new Image();
img2.src="/images/home/refer_background.gif";
img3=new Image();
img3.src="/images/home/list_ov.gif";
img4=new Image();
img4.src="/images/home/list_up.gif";
img5=new Image();
img5.src="/images/home/refer_button_ov.gif";
img6=new Image();
img6.src="/images/home/refer_button_up.gif";
img7=new Image();
img7.src="/images/home/list_title.gif";
img8=new Image();
img8.src="/images/home/career_page.jpg";
img9=new Image();
img9.src="/images/home/adv_page.gif";
img10=new Image();
img10.src="/images/home/top_logo.png";
img11=new Image();
img11.src="/images/home/open_list.jpg";



/*資訊區塊變化*/
function menuchang(x){
	var xobj = document.all(x+"_x");
	var yobj = document.all(x+"_y");
	var move_x = document.all("move_x");
	var media_x = document.all("media_x");
	var biggie_x = document.all("biggie_x");
	var move_y = document.all("move_y");
	var media_y = document.all("media_y");
	var biggie_y = document.all("biggie_y");	
	if(xobj && yobj){
		move_x.className = "info_rup";
		media_x.className = "info_rup";
		biggie_x.className = "info_rup";
		xobj.className = "info_rov";
		move_y.style.display = "none";
		media_y.style.display = "none";
		biggie_y.style.display = "none";
		yobj.style.display = "block";
		};
	}

/*門市查詢按鈕*/
function referover(x){
	var stbutton = document.all("refer_button");
	if(x!=0){
		stbutton.src="/images/home/refer_button_ov.gif";
		}else{
		stbutton.src="/images/home/refer_button_up.gif";
		};
	}
	

/*左清單變化*/
function listchang(x,y){
	var xlist = document.all("list_"+x);
	if(y==1){
		xlist.className="list_ov";
		}else{
		xlist.className="list_up";
	};
	}



function topmenu(x,y){
	xbp=document.all('menu'+x);
		if(y==0){
			if(xbp.className!='bok'){xbp.className='bup'}
		}else{
			if(xbp.className!='bok'){xbp.className='bov'}
		};
	}





/*回到首頁*/
function gohome(){
	window.location.href="/";
	}

/*檢查登入帳密*/
function checkloginform(){
	var er=0;
	var loginform=document.all("loginform");
	var login_id=document.all("login_id");
	var login_pw=document.all("login_pw");
	var atxt="請注意以下問題：\n\n"
	if(login_id.value==""){er=er+1;atxt=atxt+er+". 登入帳號不可以空白！\n\n";};
	if(login_pw.value==""){er=er+1;atxt=atxt+er+". 登入密碼不可以空白！\n\n";};
	if(er>0){
			alert(atxt);
			return false;
		}else{
			loginform.submit();
			return true;
		};
	}

/*檢查更新帳密*/
function setchecklogin(){
	var er=0;
	var setlogin=document.all("setlogin");
	var login_id=document.all("login_id");
	var login_pw=document.all("login_pw");
	var relogin_pw=document.all("relogin_pw");
	var atxt="請注意以下問題：\n\n"
	if(login_id.value==""){er=er+1;atxt=atxt+er+". 登入帳號不可以空白！\n\n";};
	if(login_pw.value==""){er=er+1;atxt=atxt+er+". 登入密碼不可以空白！\n\n";};
	if(login_pw.value!=relogin_pw.value){er=er+1;atxt=atxt+er+". 登入密碼與確認密碼不一致！\n\n";};
	if(er>0){
			alert(atxt);
			return false;
		}else{
			setlogin.submit();
			return true;
		};
	}

/*確認登出意願*/
function loginoutxxx(){
	if(confirm("您確定要登出嗎")){document.forms.loginout.submit();};
	}

/*切換頁面*/
function replacepage(x){
	window.location.replace(x);
	}


/*預覽畫面*/
function viewstart(){
	var viewbu = document.getElementById("viewbutton");
	var editordiv = document.getElementById("editordiv");
	var viewdiv = document.getElementById("viewdiv");
	var editorbox = document.getElementById("editorbox");
	if(viewbu.checked==true){
		viewdiv.innerHTML=editorbox.value;
		editordiv.style.display="none";
		viewdiv.style.display="block";
		}else{
		editordiv.style.display="block";
		viewdiv.style.display="none";
		};
	}

/*廣告管理換頁*/
function advgo(x,y,z){
	if(y == 1){if(confirm("您確定勾選好要上架的項目了嗎？")){document.forms[0].submit();};};
	if(y == 2){if(confirm("您確定要新增廣告嗎？")){window.location.replace("adv_edit.asp?t="+x+"&y=2")};};
	if(y == 3){window.location.replace("adv_edit.asp?t="+x+"&d="+z+"&y=3");};
	if(y == 4){if(confirm("您確定要刪除這個廣告嗎？\n\n※注意！刪除後無法還原！")){window.location.replace("adv_edit.asp?t="+x+"&d="+z+"&y=4")};};
	if(y == 5){window.location.replace("adv_list.asp?t="+x+"&p="+z);};
	}



/*最新動態*/
function newsgo(x,y,z){
	news_form = document.forms("news_list")
	if(y < 5){news_form.y.value = y; news_form.submit();}
	if(y == 5){news_form.y.value = y; news_form.d.value = z; news_form.submit();}
	if(y == 6){window.location.replace("news_list.asp?t="+x+"&p="+z);}
	}


/*說明會*/
function jumpwin(ww){
	var act_jump = document.getElementById("act_jump");
	var jumpimg = document.getElementById("jumpimg");
	var act_poc = document.getElementById("act_poc");
	if(ww == "0"){
		jumpimg.src = "/images/home/spac.gif";
		act_jump.style.display = "none";
		act_poc.style.display = "block";
		}else{
		jumpimg.src = ww;
		act_jump.style.display = "block";
		act_poc.style.display = "none";
		}
	}

function sendthisform(){
	var errx = "";
	var signform = document.forms("signform");
	if(signform.member_id.value == ""){errx = errx + "*會員帳號尚未填寫！\n\n"};
	if(signform.member_pw.value == ""){errx = errx + "*會員密碼尚未填寫！\n\n"};
	if(errx != ""){
		alert("因為發生以下錯誤：\n\n"+errx+"所以無法傳送報名表！請確認！\n");
		}else{
		signform.submit();
		}
	}
	
function actgo(y,z){
	if(y == 4){
		window.location.replace("act_list.asp?t=1&p="+z);
	}else{
		var actform = document.forms("act_list");
		actform.y.value = y;
		actform.d.value = z;
		actform.submit();
	};
	}

function replay(){
	window.location.reload();
	}


function sggo(y,z){
	var ggform = document.forms("act_list");
	var ssgg = document.forms("ss_gg");
	if(y == 1){
		ggform.submit();
		};
	if(y == 2){
		var edit = "act_edit.asp?y=3&d="+z
		window.location.href=edit;
		};
	if(y == 3){
		ssgg.signer.value = z;
		ssgg.submit();
		setTimeout("replay()",500);
		};
	if(y == 4){
		ggform.g.value = 4;
		ggform.p.value = z;
		ggform.submit();
		};
	if(y == 5){
		ggform.g.value = 2;
		ggform.p.value = z;
		ggform.submit();
		};
	}
	
function storeimg(x,y){
	for(i=1;i<=4;i++){
		document.getElementById("imgchg_"+i).className="b";
		document.getElementById("imgchb_"+i).style.display="none";
		};
	document.getElementById("imgchg_"+x).className="a";
	document.getElementById("imgchb_"+x).style.display="block";
	}
	
	
function spgo(x,y,z){
	var spfo = document.forms("act_list");
	if(y == 1 || y == 2){spfo.y.value = y;spfo.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){spfo.y.value = y;spfo.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/store_edit.asp?y="+y+"&d="+z+"&z="+x};
	if(y == 6){window.location.replace("/admin/store_list.asp?y=0&d=0&z="+x+"&p="+z)};
	}
	
function faq(x,y){
	var ans = document.getElementById("answer_"+x);
	if(ans.style.display == "none"){
		ans.style.display = "block";
		}else{
		ans.style.display = "none";
		}
	}
	
	
function faqgo(y,z){	
	var faqform = document.forms("act_list");
	if(y == 1 || y == 2){faqform.y.value = y;faqform.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){faqform.y.value = y;faqform.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/faq.asp?y="+y+"&d="+z};
	if(y == 6){window.location.replace("/admin/faq.asp?y=0&p="+z)};
	}	
	
function jobgo(y,z){	
	var jobform = document.forms("act_list");
	if(y == 1 || y == 2){jobform.y.value = y;jobform.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){jobform.y.value = y;jobform.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/job.asp?y="+y+"&d="+z};
	if(y == 6){window.location.replace("/admin/job.asp?y=0&p="+z)};
	}		
	
function costinto(cc){
	var co1 = document.getElementById("job_cost1");
	var co2 = document.getElementById("job_cost2");
	if(cc == "1"){co2.value=""};
	if(cc == "2"){co1.checked = false};
	}
	
function checkjob(){
	var jobform = document.forms("jobform");
	if(jobform.job_name.value == ""){
		alert("請務必填寫職務名稱！");
		}else{
		jobform.submit();
		}
	}

function dnkgo(y,z){	
	var dnkform = document.forms("act_list");
	if(y == 1 || y == 2){dnkform.y.value = y;dnkform.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){dnkform.y.value = y;dnkform.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/drink.asp?y="+y+"&d="+z};
	if(y == 6){window.location.replace("/admin/drink.asp?y=0&p="+z)};
	}	

function dnk_time(x){
	var sdtime = new Array(4)
	sdtime[0] = document.all("sh");
	sdtime[1] = document.all("sn");
	sdtime[2] = document.all("dh");
	sdtime[3] = document.all("dn");
	if(x == 0){for(i=0;i<=3;i++){sdtime[i].disabled = true;}}
	if(x == 1){for(i=0;i<=3;i++){sdtime[i].disabled = false;}}
	}

function checkdrink(){
	var dnkform = document.forms("dnkform");
	if(dnkform.dnk_name.value == ""){
		alert("請務必填寫商品名稱！");
		}else{
		dnkform.submit();
		}
	}

function logincheck(){
	var loginform = document.forms("loginform");
	var erx = "";
	var rep=/[A-Za-z0-9]/;
	if(loginform.member_id.value == ""){
		erx = erx +"- 你的帳號尚未填寫！\n\n";
		}else{
		if(loginform.member_id.value.indexOf("@") <= 0 || loginform.member_id.value.indexOf(",") >=0 || loginform.member_id.value.indexOf(".") <= 0 ){erx = erx +"- 你的帳號格式有錯誤！\n\n";};
		}
	if(loginform.member_pw.value == ""){
			erx = erx +"- 你的密碼尚未填寫！\n\n";
		}else{
			var j = 0;
			for(i=0;i<=loginform.member_pw.value.length-1;i++){if(!rep.test(loginform.member_pw.value.charAt(i))){j+=1};}
			if(j > 0){erx = erx +"- 你的密碼格式有錯誤a！\n\n";}
		}
	if(erx != ""){
		alert("本會員系統發現以下錯誤：\n\n"+erx);
		}else{
		loginform.submit();
		}
	}

function modifyform(){
	var memberform = document.forms("memberform");
	var erx = "";
	var rep=/[A-Za-z0-9]/;
	if(memberform.email_1.value == "" || memberform.email_2.value == ""){erx = erx + "- 請務必完整填寫電子信箱！\n\n"};
	if(memberform.password.value != ""){
		if(memberform.password.value != memberform.repassword.value){
			erx = erx + "- 會員密碼與密碼確認結果不一致！\n\n";
		}else{
			var j = 0;
			for(i=0;i<=memberform.password.value.length-1;i++){if(!rep.test(memberform.password.value.charAt(i))){j+=1};}
			if(j > 0){erx = erx + "- 會員密碼請使用英文字母或數字！\n\n"};
		}
	}else{
		erx = erx + "- 請務必完整填寫會員密碼！\n\n"
	}
	if(memberform.newMember){
		if(memberform.member_name.value == ""){erx = erx + "- 請務必填寫您的中文完整姓名！\n\n"}
		}
	if(memberform.mobile.value == ""){erx = erx + "- 請務必填寫您的行動電話！\n\n"}
	if(memberform.telephone.value == "" || memberform.tele_zip.value == ""){erx = erx + "- 請務必完整填寫您的聯絡電話！\n\n"}
	if(erx != ""){
		alert("本會員系統發現以下錯誤：\n\n"+erx+"\n\n請重新確認，謝謝");
		}else{
		memberform.submit();
		}
	}


function chkquest1(x,y,z){
	var j = 0;
	var ask = document.forms("memberform");
	for(i=y;i<=z;i++){if(ask.elements[i].checked == true){j+=1}};
	if(j>3){alert("本複選題至多僅可選三項答案！");ask.elements[x].checked = false};
	}


function chkq(x,y){
	var j = 0;
	var ask = document.forms("memberform");
	for(i=x;i<=y;i++){if(ask.elements[i].checked == true){j+=1}};
	if(j>0){return false}else{return true};
	}


function askformchk(){
	var ask = document.forms("memberform");
	var erx = ""
	if(chkq(0,5)){erx = erx + "- 第1題尚未作答\n\n"};
	if(chkq(6,10)){erx = erx + "- 第2題尚未作答\n\n"};
	if(chkq(11,15)){erx = erx + "- 第3題尚未作答\n\n"};
	if(chkq(16,20)){erx = erx + "- 第4題尚未作答\n\n"};
	if(chkq(21,25)){erx = erx + "- 第5題尚未作答\n\n"};
	if(chkq(26,30)){erx = erx + "- 第6題尚未作答\n\n"};
	if(chkq(31,35)){erx = erx + "- 第7題尚未作答\n\n"};
	if(chkq(36,40)){erx = erx + "- 第8題尚未作答\n\n"};
	if(chkq(41,45)){erx = erx + "- 第9題尚未作答"};
	if(erx == ""){ask.submit();}else{alert(erx);};	
	}

function chkmailform(){
	var mbox = document.forms("mailform");
	var erx = ""
	if(mbox.elements[0].value == ""){erx = erx + "- 信件主旨尚未填寫\n\n"};
	if(mbox.elements[1].value == ""){erx = erx + "- 建議內容尚未填寫\n\n"};
	if(erx == ""){mbox.submit();}else{alert(erx);};	
	}

function memgo(y,z){
	var memform = document.forms("act_list");
	var memberform = document.forms("memberform");
	if(y == 1 || y == 2){memform.y.value = y;memform.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){memform.y.value = y;memform.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/member.asp?y="+y+"&d="+z};
	if(y == 6){memform.y.value = "0";memform.p.value = z;memform.submit();};
	if(y >= 7 && y <= 11){memberform.y.value = y;memberform.submit();};

	}

function gotonewstyp(x,y){
	window.location.replace("news_list.asp?t="+y+"&n="+x);	
	}

function opengo(y,z){
	var openform = document.forms("act_list");
	if(y == 1 || y == 2 || y == 7){openform.y.value = y;openform.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){openform.y.value = y;openform.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/open.asp?y="+y+"&d="+z};
	if(y == 6){openform.y.value = "0";openform.p.value = z;openform.submit();};
	}

function opppgo(x,y,z){
	var opppform = document.forms("act_list");
	if(y == 1 || y == 2){opppform.y.value = y;opppform.d.value = x;opppform.submit();};
	if(y == 3){if(confirm("你確定要刪除嗎？")){opppform.y.value = y;opppform.d.value = x;opppform.submit();}};
	if(y == 4 || y == 5){window.location.href="/admin/open_pic.asp?y="+y+"&d="+x+"&dd="+z};
	if(y == 6){opppform.y.value = "0";opppform.p.value = z;opppform.d.value = x;opppform.submit();};	
	}

function countgo(x){
	window.location.replace("count.asp?n="+x);
	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}






