﻿var txt;
function txtDisplay(chkUSER,txtNAME2,rblMAN,rblWOMAN,txtTELEPHONE12,txtCELLPHONE12,txtADD_ID2,txtADDRESS2){

if (document.getElementById(chkUSER).checked==true){
document.getElementById(txtNAME2).style.backgroundColor="#d9d9d9"
//document.getElementById(rblSex2).style.backgroundColor="#d9d9d9"
document.getElementById(txtTELEPHONE12).style.backgroundColor="#d9d9d9"
document.getElementById(txtCELLPHONE12).style.backgroundColor="#d9d9d9"
document.getElementById(txtADD_ID2).style.backgroundColor="#d9d9d9"
document.getElementById(txtADDRESS2).style.backgroundColor="#d9d9d9"

document.getElementById(txtNAME2).disabled=true
document.getElementById(rblMAN).disabled=true
document.getElementById(rblWOMAN).disabled=true
document.getElementById(txtTELEPHONE12).disabled=true
document.getElementById(txtCELLPHONE12).disabled=true
document.getElementById(txtADD_ID2).disabled=true
document.getElementById(txtADDRESS2).disabled=true

document.getElementById(txtNAME2).value=document.getElementById("txtNAME").value
document.getElementById(txtADDRESS2).value=document.getElementById("txtADDRESS1").value
document.getElementById(txtTELEPHONE12).value=document.getElementById("txtTELEPHONE1").value
document.getElementById(txtCELLPHONE12).value=document.getElementById("txtCELLPHONE1").value
document.getElementById(txtADD_ID2).value=document.getElementById("ddlZIP_CODE").value

if (document.getElementById("rblSex_0").checked==true){
document.getElementById("rblMAN").checked=true;
}
if (document.getElementById("rblSex_1").checked==true){
document.getElementById("rblWOMAN").checked=true;
}
 }else{
 document.getElementById(txtNAME2).style.backgroundColor=""
//document.getElementById(rblSex2).style.backgroundColor=""
document.getElementById(txtTELEPHONE12).style.backgroundColor=""
document.getElementById(txtCELLPHONE12).style.backgroundColor=""
document.getElementById(txtADD_ID2).style.backgroundColor=""
document.getElementById(txtADDRESS2).style.backgroundColor=""

document.getElementById(txtNAME2).disabled=false
document.getElementById(rblMAN).disabled=false
document.getElementById(rblWOMAN).disabled=false
document.getElementById(txtTELEPHONE12).disabled=false
document.getElementById(txtCELLPHONE12).disabled=false
document.getElementById(txtADD_ID2).disabled=false
document.getElementById(txtADDRESS2).disabled=false

 }
}

function checktxt(){
	if (document.getElementById("txtNAME_u").value==''){
	    txt=document.getElementById("txtNAME_u");
		alert('請輸入姓名');
		txt.focus();       
		return false;
		}
		
    	if (document.getElementById("rblM_u").checked==false&&document.getElementById("rblF_u").checked==false){
	    txt=document.getElementById("rblM_u");
		alert('請選擇性別');
		txt.focus();       
		return false;
		}
		
   if (document.getElementById("txtUSER_ID_u").value==''){
	    txt=document.getElementById("txtUSER_ID_u");
		alert('請輸入E-MAIL');
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById("txtUSER_ID_u").value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById("txtUSER_ID_u");
                alert("請輸入正確的E-MAIL"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
	
	} 
	
	if (document.getElementById("txtPASSWORD_u").value!=''||document.getElementById("txtPASSWORD_r_u").value!=''){
	  if (document.getElementById("txtPASSWORD_u").value==''){
	txt=document.getElementById("txtPASSWORD_u");
	alert('請輸入密碼');
	txt.focus();       
	return false;
	}		
	
	if (document.getElementById("txtPASSWORD_r_u").value==''){
	    txt=document.getElementById("txtPASSWORD_r_u");
		alert('請輸入確認密碼');
		txt.focus();       
		return false;
		}
	
	
	if (document.getElementById("txtPASSWORD_u").value!=document.getElementById("txtPASSWORD_r_u").value){
	    txt=document.getElementById("txtPASSWORD_u");
		alert('密碼與確認密碼不符');
		txt.focus();       
		return false;
		}
	}
  
     if (document.getElementById("txtBIRTHDAY_u").value==''){
	    txt=document.getElementById("txtBIRTHDAY_u");
		alert('請選擇生日');
		txt.focus();       
		return false;
		}
			
		
			 if (document.getElementById("ddlANTECEDENT_u").value=='0'){
	    txt=document.getElementById("ddlANTECEDENT_u");
		alert('請選擇學歷');
		txt.focus();       
		return false;
		}
		
		
		if (document.getElementById("rblCONNUBIALITY_False_u").checked==false&&document.getElementById("rblCONNUBIALITY_True_u").checked==false){
	    txt=document.getElementById("rblCONNUBIALITY_False_u");
		alert('請選擇婚姻狀態');
		txt.focus();       
		return false;
		}
		
			if (document.getElementById("ddlTELEPHONE1_u").value=='請選擇'){
	    txt=document.getElementById("ddlTELEPHONE1_u");
		alert('請輸入聯絡電話(區碼)');
		txt.focus();       
		return false;
		}
		
			if (document.getElementById("txtTELEPHONE1_u").value==''){
	    txt=document.getElementById("txtTELEPHONE1_u");
		alert('請輸入聯絡電話');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById("txtTELEPHONE2_u").value==''){
			txt=document.getElementById("txtTELEPHONE2_u");
			alert('請輸入手機');
			txt.focus();       
			return false;
		}else{
		   if (document.getElementById("txtTELEPHONE2_u").value.charAt(0)!='0'){
		    alert('請輸入正確手機格式');
		    return false;
		  }
		  if (document.getElementById("txtTELEPHONE2_u").value.charAt(1)!='9'){
		    alert('請輸入正確手機格式');
		    return false;
		  }
		  if (document.getElementById("txtTELEPHONE2_u").value.length!=10){
		    alert('請輸入正確手機格式');
		    return false;
		  }
		}			
		
	/*		if (document.getElementById("ddlCITY_COD_u").value=='請選擇'){
	    txt=document.getElementById("ddlCITY_COD_u");
		alert('請選擇通訊地址縣市');
		txt.focus();       
		return false;
		}				
	
		if (document.getElementById("hidAREA_COD_u").value=='請選擇'||document.getElementById("hidAREA_COD_u").value==''){
	    txt=document.getElementById("hidAREA_COD_u");
		alert('請選擇通訊地址地區');
		txt.focus();       
		return false;
		}				
		*/
		if (document.getElementById("txtADDRESS").value==''){
	    txt=document.getElementById("txtADDRESS");
		alert('請選擇通訊地址');
		txt.focus();       
		return false;
		}
	
	
}

function Cartcheck(){
flg=confirm('確認無誤送出?');
//if (flg=true){
//location.href='member.aspx?id=7';
//}
return flg;
}

function checkDT(txtUSER_ID,txtDEPARTMENT_dt){
	if (document.getElementById(txtUSER_ID).value==''){
		alert('請輸入E-mail');
		txt=document.getElementById(txtUSER_ID);
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
		}
		if (document.getElementById(txtDEPARTMENT_dt).value==''){
		alert('請輸入啟用碼');
		txt=document.getElementById(txtDEPARTMENT_dt);
		txt.focus();       
		return false;
		}
}

function checkrs(txtUSER_ID_rs,txtp){
if (document.getElementById(txtUSER_ID_rs).value==''){
		alert('請輸入E-mail');
		txt=document.getElementById(txtUSER_ID_rs);
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID_rs).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID_rs);
                alert("請輸入正確的E-mail"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
		}
		
				if (document.getElementById(txtp).value==''){
		alert('請輸入驗證');
		txt=document.getElementById(txtp);
		txt.focus();       
		return false;
		}
}

function checkJoin(txtUSER_ID,txtPASSWORD,txtp_join){
	if (document.getElementById(txtUSER_ID).value==''){
		alert('請輸入E-mail');
		txt=document.getElementById(txtUSER_ID);
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
		}
		if (document.getElementById(txtPASSWORD).value==''){
		alert('請輸入密碼');
		txt=document.getElementById(txtPASSWORD);
		txt.focus();       
		return false;
		}
			if (document.getElementById(txtp_join).value==''){
		alert('請輸入驗證');
		txt=document.getElementById(txtp_join);
		txt.focus();       
		return false;
		}
}

function checkCarttxt(txtNAME,ddlZIP_CODE,txtADDRESS1,txtTELEPHONE1,txtCELLPHONE1,txtNAME2,txtTELEPHONE12,txtCELLPHONE12,rblMAN,rblWOMAN,ddlZIP_CODE2,txtADDRESS2,chkUSER){

 		if (document.getElementById(txtNAME).value==''){
		alert('請輸入性名');
		txt=document.getElementById(txtNAME);
		txt.focus();       
		return false;
		}
	/*			if (document.getElementById(ddlZIP_CODE).value=='郵遞區號'){
		alert('請選擇郵遞區號');
		txt=document.getElementById(ddlZIP_CODE);
		txt.focus();   
		return false;
		}*/
				if (document.getElementById(txtADDRESS1).value==''){
		alert('請輸入地址');
		txt=document.getElementById(txtADDRESS1);
		txt.focus();   
		return false;
		}	
	
		if (document.getElementById(txtCELLPHONE1).value==''){
		alert('請輸入手機');
		txt=document.getElementById(txtCELLPHONE1);
		txt.focus();   
		return false;
		}
 	if (document.getElementById(txtTELEPHONE1).value==''){
		alert('請輸入市話');
		txt=document.getElementById(txtTELEPHONE1);
		txt.focus();   
		return false;
		}
 
	if (document.getElementById(chkUSER).checked==false){
		
			if (document.getElementById(txtNAME2).value==''){
		alert('請輸入性名');
		txt=document.getElementById(txtNAME2);
		txt.focus();   
		return false;
		}
		
		if (document.getElementById(rblMAN).checked==false&&document.getElementById(rblWOMAN).checked==false){
		alert('請選擇性別');
		txt=document.getElementById(rblMAN);
		txt.focus();   
		return false;
		}
		
	/*			if (document.getElementById(ddlZIP_CODE2).value=='郵遞區號'){
		alert('請選擇郵遞區號');
		txt=document.getElementById(ddlZIP_CODE2);
		txt.focus();   
		return false;
		}*/
				if (document.getElementById(txtADDRESS2).value==''){
		alert('請輸入地址');
		txt=document.getElementById(txtADDRESS2);
		txt.focus();   
		return false;
		}	
			if (document.getElementById(txtCELLPHONE12).value==''){
		alert('請輸入手機');
		txt=document.getElementById(txtCELLPHONE12);
		txt.focus();   
		return false;
		}
		if (document.getElementById(txtTELEPHONE12).value==''){
		alert('請輸入市話');
		txt=document.getElementById(txtTELEPHONE12);
		txt.focus();   
		return false;
		}
	
	}				
   
   
   //發票
   if (document.getElementById("rblINVOICE_TYPE_3").checked==true){
     if (document.getElementById("txtINVOICE_T").value==''){
		alert('請輸入三聯式發票抬頭');
		txt=document.getElementById("txtINVOICE_T");
		txt.focus();   
		return false;
		}
		
		 if (document.getElementById("txtINVOICE_G").value==''){
		alert('請輸入統一編號');
		txt=document.getElementById("txtINVOICE_G");
		txt.focus();   
		return false;
		}
   }  
}

function r_imgcheck(id){
document.getElementById(id).outerHTML='<img style="cursor:hand" id='+id+' onclick="r_imgcheck(this.id);" src=imgcheck.aspx>';
}