function trim(string) {
   var tmpchar, i, j, result;

   i = 0;
   tmpchar = string.charAt(i);
   while (tmpchar == ' ') {
      i ++;
      tmpchar = string.charAt(i);
   }

   j = string.length - 1;
   tmpchar = string.charAt(j);
   while (tmpchar == ' ') {
      j --;
      tmpchar = string.charAt (j);
   }
   if ( i <= j)
      result = string.substring(i,j+1);
   else
      result = "";
   return result;
}

function checkpass1(str1,lenShort,lenLong)
{
	for (var i=0; i<str1.value.length;i++) {
                if (((str1.value.charAt(i)>='0')&&(str1.value.charAt(i)<='9'))||((str1.value.charAt(i)>='A')&&(str1.value.charAt(i)<='Z'))||((str1.value.charAt(i)>='a')&&(str1.value.charAt(i)<='z'))||(str1.value.charAt(i)=='_')) {
					document.getElementById("pass2alert").innerHTML="<font color=blue>OK！</font>";
                } else{
				document.getElementById("pass2alert").innerHTML="<font color=red>密碼含有非法字符！只能是數字、字母 'a-z , A-Z' 及 '_' 為有效字符。</font>";
                        //alert("密碼含有非法字符！只能是數字、字母 'a-z , A-Z' 及 '_' 為有效字符。");
						str1.value = "";
                       // str1.focus();
                        
                        return false;
                }
        }
	 if (str1.value.length <lenShort && str1.value.length!='') {
               document.getElementById("pass2alert").innerHTML="<font color=red>密碼應大於等於"+lenShort+"位！</font>";
			   // alert("密碼應大於等於"+len+"位！");
				str1.value = "";
                //str1.focus();
      return false;
   }
   if (str1.value.length >lenLong && str1.value.length!='') {
               document.getElementById("pass2alert").innerHTML="<font color=red>密碼應小於等於"+lenLong+"位！</font>";
			   // alert("密碼應大於等於"+len+"位！");
				str1.value = "";
                //str1.focus();
      return false;
   }
   if(str1.value.length >lenShort&&str1.value.length<=lenLong){
   		document.getElementById("pass2alert").innerHTML="<font color=blue>OK！</font>";
   }else{
	                  document.getElementById("pass2alert").innerHTML="<font color=#FF0000>*必要欄位</font>";
			   // alert("密碼應大於等於"+len+"位！");
                //str1.focus();
      		return false;
	   }
}
function checkpass2(str1,str2)
{
	
		 if (str1.value == str2.value && str1.value.length!='') {
			  document.getElementById("pass2alert").innerHTML="<font color=blue>OK！</font>";
                return true;
        }
		else if(str1.value != str2.value && str1.value.length!='')
		{
                document.getElementById("pass2alert").innerHTML="<font color=red>兩次密碼輸入不一致！請重新輸入！</font>";
				//alert("兩次密碼輸入不一致！請重新輸入！"); 
				str1.value = "";
                str2.value = "";
             //   str1.focus();
               
                return false;
        }else if(str1.value.length=='')
			{
               document.getElementById("pass2alert").innerHTML="<font color=#FF0000>*必要欄位</font>";
			   // alert("密碼應大於等於"+len+"位！");
                //str1.focus();
      		return false;
   		}		
		
        return true
}

//====================================================================================================================================
//by fkj  2008-12-15
function cleck_name_ee(string) {  //真實姓名
        var s,i,j;
        s="'\"<>";
        for (i=0; i<string.value.length; i++) {
           for(j=0;j<s.length;j++){
                if (string.value.charAt(i) == s.charAt(j))
                {
						document.getElementById("namealert").innerHTML="<font color=red>不能包含 ' < > 和 \"。</font>";
						string.value = "";						
						//alert(fieldname+"不能包含 ' < > 和 \"");
                        return false;
                 }else{
					document.getElementById("namealert").innerHTML="<font color=blue>OK！</font>";	
				}
          }
        }
   		if(string.value.length !=''){
   			document.getElementById("namealert").innerHTML="<font color=blue>OK！</font>";
   		}else{
			document.getElementById("namealert").innerHTML="<font color=#FF0000>*必要欄位</font>";
      		return false;
	   }		
		
        return true;
}

function cleck_idc_ee(string) {  //身份證字號, 身分證字號 驗證
if(!checkidc(string.value.toUpperCase()))
{
	document.getElementById("idcalert").innerHTML="<font color=red>您的身份證字號不合法</font>";
	string.value='';
	return false;
}
if(string.value.length !=''){
	document.getElementById("idcalert").innerHTML="<font color=blue>OK！</font>";
}else{
	document.getElementById("idcalert").innerHTML="<font color=#FF0000>*必要欄位</font>";
	return false;
}		

return true;
}

function cleck_area_ee(str){   //聯絡電話區號
        rep=new String(str.value);
        pattern=/^[0-9]+$/;

        if (rep.length==0 || (rep.match(pattern) && rep.length<=40))
		{
			document.getElementById("areaalert").innerHTML="<font color=blue>OK！</font>";
		}else {
						document.getElementById("areaalert").innerHTML="<font color=red>電話區號含有非法字符！只能是數字。</font>";
						str.value = "";						
						//alert(fieldname+"不能包含 ' < > 和 \"");
                        return false;
        }
   		if(str.value.length !=''){
   			document.getElementById("areaalert").innerHTML="<font color=blue>OK！</font>";
   		}else{
			document.getElementById("areaalert").innerHTML="<font color=#FF0000>*必要欄位</font>";
      		return false;
	   }		
        return true;		
}

function cleck_phone_ee(str){   //聯絡電話
        rep=new String(str.value);
        pattern=/^[0-9]+$/;

        if (rep.length==0 || (rep.match(pattern) && rep.length<=40))
		{
			document.getElementById("areaalert").innerHTML="<font color=blue>OK！</font>";
		}else {
						document.getElementById("areaalert").innerHTML="<font color=red>聯絡電話含有非法字符！只能是數字。</font>";
						str.value = "";						
						//alert(fieldname+"不能包含 ' < > 和 \"");
                        return false;
        }
   		if(str.value.length !=''){
   			document.getElementById("areaalert").innerHTML="<font color=blue>OK！</font>";
   		}else{
			document.getElementById("areaalert").innerHTML="<font color=#FF0000>*必要欄位</font>";
      		return false;
	   }		
        return true;		
}

function cleck_mobile_ee(str){   //行動電話
        rep=new String(str.value);
        pattern=/^[0-9]+$/;

        if (rep.length==0 || (rep.match(pattern) && rep.length<=40))
		{
			document.getElementById("mobileaalert").innerHTML="<font color=blue>OK！</font>";
		}else {
						document.getElementById("mobileaalert").innerHTML="<font color=red>行動電話含有非法字符！只能是數字。</font>";
						str.value = "";						
						//alert(fieldname+"不能包含 ' < > 和 \"");
                        return false;
        }
   		if(str.value.length !=''){
   			document.getElementById("mobileaalert").innerHTML="<font color=blue>OK！</font>";
   		}else{
			document.getElementById("mobileaalert").innerHTML="<font color=#FF0000>*必要欄位</font>";
      		return false;
	   }		
        return true;		
}

//------------------------------------------------------------------------------------------------------------------------------------

function validpassword(str1,str2,len)
{
        if (str1.value.length <len) {
                alert("密碼應大於等於"+len+"位！");
                str1.focus();
      return false;
   }
        for (var i=0; i<str1.value.length;i++) {
                if (((str1.value.charAt(i)>='0')&&(str1.value.charAt(i)<='9'))||((str1.value.charAt(i)>='A')&&(str1.value.charAt(i)<='Z'))||((str1.value.charAt(i)>='a')&&(str1.value.charAt(i)<='z'))||(str1.value.charAt(i)=='_')) {
                } else{
                        alert("密碼含有非法字符！只能是數字、字母 'a-z , A-Z' 及 '_' 為有效字符。");
                        str1.focus();
                        str1.value = "";
                        return false;
                }
        }
        if (str2.value.length <len) {
                alert("密碼應大於等於"+len+"位！");
                str2.focus();
      return false;
   }
        for (var i=0; i<str2.value.length;i++) {
                if (((str2.value.charAt(i)>='0')&&(str2.value.charAt(i)<='9'))||((str2.value.charAt(i)>='A')&&(str2.value.charAt(i)<='Z'))||((str2.value.charAt(i)>='a')&&(str2.value.charAt(i)<='z'))||(str2.value.charAt(i)=='_')) {
                } else{
                        alert("密碼含有非法字符！只能是數字、字母 'a-z , A-Z' 及 '_' 為有效字符。");
                        str2.focus();
                        str2.value = "";
                        return false;
                }
        }
        if (str1.value == str2.value) {
                return true;
        } else {
                alert("兩次密碼輸入不一致！請重新輸入！");
                str1.focus();
                str1.value = "";
                str2.value = "";
                return false;
        }
        return true
}

function validemail(string) {
        var ok=false;
        for (var i=1; i<string.value.length-3;i++) {
                if (string.value.charAt(i) =='@'){
                        ok = true;break;
                }
        }
        for (var j=0; j<string.value.length; j++) {
                if ((((string.value.charAt(j)>='0')&&(string.value.charAt(j)<='9'))||((string.value.charAt(j)>='A')&&(string.value.charAt(j)<='Z'))||((string.value.charAt(j)>='a')&&(string.value.charAt(j)<='z'))||(string.value.charAt(j)=='_')||(string.value.charAt(j)=='@')||(string.value.charAt(j)=='-')||(string.value.charAt(j)=='.'))) {
                } else {
                        ok = false;break;

                }
        }
        if (ok) {
                return true;
        } else {
                alert("非法電子郵件地址！");
           string.focus();
           return false;
        }
}

function validstring(fieldname,string) {
        var s,i,j;
        s="'!#&*\"()<>";
        for (i=0; i<string.value.length; i++) {
           for(j=0;j<s.length;j++){
                if (string.value.charAt(i) == s.charAt(j))
                {
                        alert(fieldname+"不能包含 ! ' # & * ( ) < > 和 \"");
                         string.focus();
                         return false;
                 }
          }
        }
        return true;
}

function validstring1(fieldname,string) {
        var s,i,j;
        s="'\"<>";
        for (i=0; i<string.value.length; i++) {
           for(j=0;j<s.length;j++){
                if (string.value.charAt(i) == s.charAt(j))
                {
                        alert(fieldname+"不能包含 ' < > 和 \"");
                         string.focus();
                         return false;
                 }
          }
        }
        return true;
}

function validdate(fieldname,Year,Month,Day) {
        var d,temp,s = "";
        d = new Date(Year.value,Month.value-1,Day.value);
        temp = d.getYear();
        if ( temp < 100) s +="19";
        if ( temp < 10) s +="0";
        s += temp + "-";
        s += (d.getMonth() + 1) + "-";
        s += d.getDate();
        if (s == Year.value+"-"+Month.value+"-"+Day.value) {
              return true;
        } else {
              alert(fieldname+"格式不正確！");
              Day.focus();
              return false;
        }
}

function notNull(fieldname,string)
{
   string.value=trim(string.value);
   if (string.value == "") {
      alert("請輸入"+fieldname+"！");
      string.focus();
      return false;
  }else{
   return true;
  }
}

function notShort(fieldname,string,len)
{
        if (string.value.length == len) {
                return true;
        } else {
                alert(fieldname+"應為"+len+"位！");
                string.focus();
           return false;
        }
}

function notLong(fieldname,string,len)
{
        if (string.value.length <= len) {
                return true;
        } else {
                alert(fieldname+"最多只能輸入"+len+"個英文字母或漢字！");
                string.focus();
           return false;
        }
}
function tooshort(fieldname,string,len)
{
        if (string.value.length >= len) {
                return true;
        } else {
                alert(fieldname+"請輸入至少"+len+"個英文字母或漢字！");
                string.focus();
           return false;
        }
}
function notSelect(fieldname,string)
{
   if (string.options[0].selected) {
      alert("請選擇"+fieldname+"！");
      return false;
   }
   else
   return true;
}

function notCheck(fieldname,string)
{
   if (!(string[0].checked ||string[1].checked)) {
      alert("請選擇"+fieldname+"！");
      return false;
                    }
   else
      return true;
}
function notChecksex(fieldname,string)
{
   if (!(string[0].checked ||string[1].checked)) {
      alert("請選擇"+fieldname+"！");
      return false;
                    }
   else
      return true;
}
function notChecktree(fieldname,string)
{
   if (!(string[0].checked ||string[1].checked || string[2].checked)) {
      alert("請選擇"+fieldname+"！");
      return false;
                    }
   else
      return true;
}
function notCheck_ysfw(fieldname,string)
{
   if (!(string[0].checked ||string[1].checked||string[2].checked||string[3].checked||string[4].checked||string[5].checked)) {
      alert("請選擇"+fieldname+"！");
      return false;
                    }
   else
      return true;
}
function notErrorLink(fieldname,string)
{

//************************
  return true;
//************************

   var sublink=".auctions.yahoo.co.jp/jp/";
   var tmpchar, i;

   i = 0;
   tmpchar = string.value.charAt(i);
   while ((tmpchar != '.')&&(i < string.value.length - 1)) {
      i ++;
      tmpchar = string.value.charAt(i);
   }
   if (sublink != string.value.substring(i, sublink.length+i)){
       alert(fieldname+"輸入錯誤！");
       return false;
   }else
       return true;
}

function check_int(strnote,str){
        rep=new String(str.value);
        pattern=/^[\.0-9]+$/;

        if (rep.length==0 || (rep.match(pattern) && parseFloat(str.value)>=0 && rep.length<=40)) return true;
        else {
                alert(strnote+"輸入錯誤！");
                str.focus();
                return false;
        }
}
//回饋金驗證（1.不能超過現有的  2.單次使用+折價券總和 不能超過服務費） by ekey 2008.11.27
function check_dgf(coins,dgf,str,coupon)
{
	if(parseFloat(str.value)>parseFloat(coins))
	{
       alert("回饋金超額輸入！");
	   str.value='';
		str.focus();
		return false;
	}
	else
	{
		if(Math.ceil(parseFloat(coupon)+parseFloat(str.value))>parseFloat(dgf))
		{
		   alert("回饋金加折價券的總和不可以超過服務費哦！");
		   str.value='';
			str.focus();
			return false;
		}
		/*else
		{
			if(trim(str.value)=="")
			{
			return true;
			}
			else
			{
			document.order.dgf_tw.value=Math.ceil(parseFloat(dgf)-parseFloat(str.value));
			return true;
			}
		}*/
	}
	
}
function check_phone(strnote,str){
        rep=new String(str.value);
        pattern=/^[0-9]+$/;

        if (rep.length==0 || (rep.match(pattern) && rep.length<=40)) return true;
        else {
                alert(strnote+"輸入錯誤！");
                str.focus();
                return false;
        }
}

//20110818 檢查市話為數字 by Stanley
function check_phone2(strnote,str){
        rep=new String(str.value);
        pattern=/^[0-9]+$/;
		if(req.length > 0)
			if (rep.match(pattern)) 
				return true;
			else 
			{
				alert(strnote+"輸入錯誤！");
				str.focus();
				return false;
			}
		return true;	
		
}
//===============================================================================
//步驟調用. by fkj 
function acct_db(strnote,str){
    str.value="iftb";
    document.order.submit();
    return true;	
}
function acct_db1(strnote,str){
	strnote.value='1';
    str.value="step3";
    document.order.submit();
    return true;	
}
function acct_db2(){
	with (document.order) {
		act.value="info";
    	spym.value="tt";
	}
    document.order.submit();
    return true;	
}

function tnext1(){
//返回
   with (document.order2) {
      act.value="info";
    }
    document.order2.submit();
    return;
}

function tnext2(){
//加入追踪清單
   with (document.order3) {
      act.value="step3";
	  service.value="1";
    }
    document.order3.submit();
    return;
}	

function tnext3(){
//加入代標B區
   with (document.order3) {
      act.value="step3";
	  service.value="2";
    }
    document.order3.submit();
    return;
}
function tnext100(){
//加入代標B區前 需驗證手機號碼
   with (document.order3) {
      act.value="step100";
	  service.value="2";
    }
    document.order3.submit();
    return;
}
function tnext4(){
//加入代標B區
   with (document.order2) {
        act.value="step2";
    	spym.value="tt";
    }
    document.order2.submit();
    return;
}

function next1(){
   with (document.order3) {
      act.value="step4";
    }
    document.order3.submit();
    return;
}	
function next2(){
   with (document.order3) {
      act.value="info";
    }
    document.order3.submit();
    return;
}
function next3(){
   with (document.order3) {
      act.value="step8";
    }
    document.order3.submit();
    return;
}
function next4(){
   with (document.order3) {
        act.value="step3";
    	spym.value="tt";
    }
    document.order3.submit();
    return;
}
function ebaynext(){
   with (document.order4) {
      act.value="ebaybidder";
    }
    document.order4.submit();
    return;
}
function gnext1(){
	if(validform_order_step3(document.order4))
    {
	   with (document.order4) {
		  act.value="submit";
		}
		document.order4.submit();
		return true;
	}
	else
	{
    return false;
	}
	
}	
function gnext2(){
   with (document.order4) {
      act.value="step3";
    }
    document.order4.submit();
    return;
}
function gnext3(){
   with (document.order4) {
        act.value="step4";
    	spym.value="tt";
    }
    document.order4.submit();
    return;
}

function jnext1(){
   with (document.order8) {
      act.value="step4";
    }
    document.order8.submit();
    return;
}

function jnext2(){
   with (document.order8) {
      act.value="info";
    }
    document.order8.submit();
    return;
}

function jnext3(){
   with (document.order8) {
        act.value="step8";
    	spym.value="tt";
    }
    document.order8.submit();
    return;
}


function checkpays()
{
	 //alert("hello"+document.order.ifbuy.value);
 if(document.order.ifbuy.value=="")
 { 
   return true; 
 }
 else
 {
      if(parseFloat(document.order.maxpay_jp.value*1)>=parseFloat(document.order.ifbuy.value*1))
	  
	   {
			if(confirm("您目前的出價等於(或大於)直接購買價！要直購商品請按下'確認'\n如不需直購請選擇'取消'並修改您的出價金額使其小於直購價避免變成直接購買！"))
			{
				document.order.maxpay_jp.value=document.order.ifbuy.value;
			  setRadio("ykj","2");//確定要直購，改用立即出標方式投標！
			  return true;
			}
			else
			{
			document.order.maxpay_jp.value="";
			document.order.maxpay_jp.focus();
			return false;
			}
	   }
	   
 }
}

//改變radio選擇
function setRadio(name,sRadioValue)
{       
	var oRadio = document.getElementsByName(name); 
	for(var i=0;i<oRadio.length;i++) 
	{
			 if(oRadio[i].value==sRadioValue) 
			 { 
			 oRadio[i].checked=true; 
			 break; 
			 }
	}
}

   // 超價直購說明  點擊才秀出
    $("a#showhelp").click(function(){
        $("div#box1").slideToggle("fast");
        });
	$("a#hidehelp").click(function(){
		$("div#box1").hide("fast");
		});		   
   // 出價增額說明  點擊才秀出  =end
    $("a#showhelp2").click(function(){
        $("div#box2").slideToggle("fast");
        });
	$("a#hidehelp2").click(function(){
		$("div#box2").hide("fast");
		});
//-------------------------------------------------------------------------------

function validform_forget(myform)
{
    if(notNull("會員名稱",myform.user)&&validstring1("會員名稱",myform.user)&&notNull("電子郵件",myform.email)&&validstring("電子郵件",myform.email)&&validemail(myform.email)&&notNull("電話區號",myform.area)&&check_phone("電話區號",myform.area)&&notNull("聯絡電話",myform.phone)&&check_phone("聯絡電話",myform.phone))
      return true;
    return false;
}
function check_intro(user,intro)
{
   if (trim(user.value) == trim(intro.value)) 
   {
      alert("介紹人不可以填自己哦，如果沒有，請不要填寫！");
	  intro.value="";
	  intro.focus();
      return false;
   }
  else
  {
   return true;
  }
}
function validform_reg_step1(myform)
{
    if(notNull("帳號",myform.email)&&validstring("電子郵件",myform.email)&&validemail(myform.email)&&notNull("密碼",myform.pass1)&&notNull("確認密碼",myform.pass2)&&validpassword(myform.pass1,myform.pass2,4)&&notNull("真實姓名",myform.name)&&validstring1("真實姓名",myform.name)&&tooshort("真實姓名",myform.name,2)&&notNull("身分證字號",myform.idc)&&notNull("性別",myform.sex)&&notNull("出生日期－年",myform.year)&&notNull("出生日期－月",myform.month)&&notNull("出生日期－日",myform.day)&&check_phone("電話區號",myform.area)&&check_phone("聯絡電話",myform.phone)&&notNull("行動電話",myform.mobile)&&check_phone("行動電話",myform.mobile)&&check_intro(myform.email,myform.intro))
	
      return true;
    return false;
}
function notCheckv4(fieldname,string)
{
   if (!(string[0].checked ||string[1].checked||string[2].checked||string[3].checked)) {
      alert("請選擇"+fieldname+"！");
      return false;
                    }
   else
      return true;
}
function buytrack_check(myform)
{
	if(notCheckv4("國別",myform.cc)&&notNull("商品名稱",myform.object)&&notNull("商品網址",myform.w_link)&&notNull("留言主旨",myform.title)&&notSelect("留言分類",myform.type)&&notNull("留言內容",myform.msg))
      return true;
    return false;
}
function validform_reg_step2(myform)
{
    if(validstring1("銀行名稱",myform.bank)&&validstring1("分行名稱",myform.subbranch)&&validstring1("銀行帳號",myform.account)&&validstring1("銀行戶名",myform.depositor))
      return true;
    return false;
}

function validform_reg_submit(myform)
{
    if(notNull("會員名稱",myform.user)&&validstring1("會員名稱",myform.user))
      return true;
    return false;
}

function validform_alter(myform)
{
    if((((myform.pass1.value.length==0)&&(myform.pass2.value.length==0))||(validpassword(myform.pass1,myform.pass2,4)))&&notNull("電子郵件",myform.email)&&validstring("電子郵件",myform.email)&&validemail(myform.email)&&notNull("送貨地址",myform.address)&&validstring1("送貨地址",myform.address)&&check_int("郵政區號",myform.postcode)&&notNull("電話區號",myform.area)&&check_phone("電話區號",myform.area)&&notNull("聯絡電話",myform.phone)&&check_phone("聯絡電話",myform.phone)&&notNull("行動電話",myform.mobile)&&check_phone("行動電話",myform.mobile))
      return true;
    return false;
}
function validform_aboutme(myform)
{
    if(notNull("真實姓名",myform.name)&&validstring1("真實姓名",myform.name)&&notNull("身分證字號",myform.idc)&&notChecksex("性別",myform.sex)&&notSelect("出生日期－年",myform.year)&&notSelect("出生日期－月",myform.month)&&notSelect("出生日期－日",myform.day)&&notNull("郵政區號",myform.postcode)&&notNull("電子郵件",myform.email)&&validstring("電子郵件",myform.email)&&validemail(myform.email)&&notNull("電話區號",myform.area)&&check_phone("電話區號",myform.area)&&notNull("聯絡電話",myform.phone)&&check_phone("聯絡電話",myform.phone))
      return true;
    return false;
}
function validform_updatepass(myform)
{
	if(notNull("舊密碼",myform.pass_j)&&notNull("新密碼",myform.pass1)&&notNull("新密碼",myform.pass2)&&notequ(myform.pass_j,myform.pass1)&&(((myform.pass1.value.length==0)&&(myform.pass2.value.length==0))||(validpassword(myform.pass1,myform.pass2,4))))
      return true;
    return false;
}
function notequ(vstr1,vstr2)
{
	if(vstr1.value!=vstr2.value)return true;
	else
	{
		alert('新舊密碼不可以相等！');
		return false;
	}
	
}
function validform_check(myform)
{
    if(notNull("舊密碼",myform.pass_j)&&(((myform.pass1.value.length==0)&&(myform.pass2.value.length==0))||(validpassword(myform.pass1,myform.pass2,4)))&&notNull("電子郵件",myform.email)&&validstring("電子郵件",myform.email)&&validemail(myform.email)&&notChecksex("性別",myform.sex)&&notSelect("出生日期－年",myform.year)&&notSelect("出生日期－月",myform.month)&&notSelect("出生日期－日",myform.day)&&notNull("身分證字號",myform.idc)&&notNull("送貨地址",myform.address)&&validstring1("送貨地址",myform.address)&&check_int("郵政區號",myform.postcode)&&notNull("電話區號",myform.area)&&check_phone("電話區號",myform.area)&&notNull("聯絡電話",myform.phone)&&check_phone("聯絡電話",myform.phone)&&notNull("行動電話",myform.mobile)&&check_phone("行動電話",myform.mobile))
      return true;
    return false;
}
function check_pay000(payjp,wpayjp)
{
	  if(parseFloat(payjp.value)>=parseFloat(wpayjp.value)) return true;
      else{
        alert("您的底價必須比現在出價更高！");
        payjp.focus();
        return false;
      }
}
function check_pay00(payjp,wpayjp,bidnum)
{
	//alert(payjp.value);
	   if(parseFloat(bidnum.value)==0)
	  {
			if(parseFloat(payjp.value)<parseFloat(wpayjp.value))
			{
				alert("您的出價不可以低於目前出價！");
				return false;
			}
			else
			{
			return true;
			}
	  }
	  else
	  {
		   //根據目前出價 判斷增額；客人不可以出價小於（目前出價＋增額）
			if(parseFloat(wpayjp.value)<=999)
			{
			 ze=10;
			}else if(parseFloat(wpayjp.value)>=1000&&parseFloat(wpayjp.value)<=4999)
			{
			 ze=100;
			}else if(parseFloat(wpayjp.value)>=5000&&parseFloat(wpayjp.value)<=9999)
			{
			 ze=250;
			}else if(parseFloat(wpayjp.value)>=10000&&parseFloat(wpayjp.value)<=49999)
			{
			 ze=500;
			}else if(parseFloat(wpayjp.value)>=50000)
			{
			 ze=1000;
			}else
			{
			 ze=0;
			}
			//直接告知會員最低應投多少金額  2008.10.24 Ben Add
			var minbid	= parseFloat(Math.ceil(wpayjp.value*1+ze*1));
			minbid = "您的出價少於一個\"出價增額\", 無法出價成功！\n\n您最低應出價" + minbid + "日幣以上";
			
		   if(parseFloat(payjp.value*1)>=parseFloat(Math.ceil(wpayjp.value*1+ze*1))) 
		   {
			   return true; 
		   }
           else{
                alert(minbid);
                payjp.focus();
                return false;
                }
	  }
	 
}function check_pay1(payjp,zep,wpayjp)
{
	  if(parseFloat(payjp.value)>=parseFloat(wpayjp.value*1+zep.value*1)) return true;
      else{
        alert("您的出價過低，當前至少要出"+parseFloat(wpayjp.value*1+zep.value*1)+"！");
        payjp.focus();
        return false;
      }
}
function validform_order(myform)
{
    if(notNull("商品簡述",myform.zwpm)&&notNull("最高底價",myform.maxpay_jp)&&check_pay1(myform.maxpay_jp,myform.ze,myform.now_price))
      return true;
    return false;
}

function validform_order_track(myform)
{
    if(notNull("商品簡述",myform.zwpm)&&notNull("最高底價",myform.maxpay_jp)&&check_int("最高底價",myform.maxpay_jp))
      return true;
    return false;
}


function validform_order1(myform)
{	
    if(acct_db1(myform.service,myform.act)){
	 return true;
	}else{
	 return false;
	}	
}
function validform_order_step3(myform)
{   
	if(myform.getype[0].checked)
	{
    if(notNull("電話號碼",myform.mobile)&&notNull("收件人",myform.name)&&notNull("送貨地址",myform.address)&&notChecktree("取貨方式",myform.getype))
      return true;
      return false;
	}
	else
	{
	   if(notChecktree("取貨方式",myform.getype))
      return true;
      return false;
	}
}

function validform_order_cc(myform)
{
	if(myform.link.value.indexOf("myday")!=-1)
	{
		alert("網址輸入錯誤！\n\n請填寫投標網頁上的準確地址！\n\n如果您是透過MyDay首頁搜尋商品,\n\n請直接點選上方工具列「我要投標」按鈕！");
		return false;
	}
}

function validform_maxpay_jp(myform)
{
    if(notNull("最高底價",myform.maxpay_jp)&&check_int("最高底價",myform.maxpay_jp)&&check_pay(myform.maxpay_jp))
      return true;
    return false;
}

function validform_remit(myform)
{
    if(notNull("匯款金額(PS:我們以銀行記錄為準哦)",myform.hk)&&check_int("匯款金額",myform.hk)&&notNull("匯款帳號後5碼，方便我們盡快替您入帳",myform.acc)&&notShort("匯款帳號",myform.acc,5))
      return true;
    return false;
}
//臺灣身份證驗證 by ekey 
function checkidc(msg){
	var m=new Array();
	if(msg.length!=10){
		return false;
	}
	var error;
	for(i=0;i<=9;i++)
		m[i+1]=msg.substr(i,1);

	switch(m[1]){
		case "A":	m[1]=1  ;	break;
		case "B":	m[1]=10 ;	break;
		case "C":	m[1]=19 ;	break;
		case "D":	m[1]=28 ;	break;
		case "E":	m[1]=37 ;	break;
		case "F":	m[1]=46 ;	break;
		case "G":	m[1]=55 ;	break;
		case "H":	m[1]=64 ;	break;			
		case "I":	m[1]=39 ;	break;
		case "J":	m[1]=73 ;	break;
		case "K":	m[1]=82 ;	break;
		case "L":	m[1]=2  ;	break;
		case "M":	m[1]=11 ;	break;
		case "N":	m[1]=20 ;	break;
		case "O":	m[1]=48 ;	break;
		case "P":	m[1]=29 ;	break;	
		case "Q":	m[1]=38 ;	break;
		case "R":	m[1]=47 ;	break;
		case "S":	m[1]=56 ;	break;
		case "T":	m[1]=65 ;	break;
		case "U":	m[1]=74 ;	break;
		case "V":	m[1]=83 ;	break;
		case "W":	m[1]=21 ;	break;
		case "X":	m[1]=3  ;	break;
		case "Y":	m[1]=12 ;	break;
		case "Z":	m[1]=30 ;	break;					
		default :   error=0 ;
	}
	if(m[2]>2 || m[2]<1)
		error=0;
	if(error==0){
		return false;
	}
	var sum=m[1]+m[2]*8+m[3]*7+m[4]*6+m[5]*5+m[6]*4+m[7]*3+m[8]*2+parseInt(m[9])+parseInt(m[10]);
		if(sum%10==0){
			return true;
		}
		else{
			return false;
		}
}
function firstlettererr(id){  
var fl=id.substr(0,1);
var T="ABCDEFGHJKLMNPQRSTUVWXYZ"; //**//    
var smp=id.substr(0,1)    
if (T.indexOf(smp) == -1) { return false; } else { return true; }    
}    

function checkid(id) {    
	
if(id.length==10){
	           return true; 
	 } else { 
	 	      return false; 
	 	
}    
}    

function chfastid(id) {    
var c = id.charAt(0);    
if(c<"A" || c> "Z")    
{ return false; } else { return true; }    
}    

function ch12fastid(id) {    
var c = id.charAt(1);    
if(c!="1" && c!="2")    
{ return false; } else { return true; }    
}    

function idmanber(id) { //=====//    
var bmp;    
var d="0123456789";    
var bab=id.length-1;    
for (var i=1;i<=bab;i++){    
bmp=id.substr(i,1)    
if (d.indexOf(bmp) == -1) { return false; }    
}    
if(id != "0")    
{ return true; } else    
{ return false; }    
}    
function idchackok(id) { ////    
var alph = new Array("A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","X","Y","W","Z","I","O");    
var num = new Array("10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35");    
var n=0;    
for(i=0;i<alph.length;i++)    
if(id.charAt(0)==alph[i])    
n=i;    
var tot1 = parseFloat(num[n].charAt(0)) + (parseFloat(num[n].charAt(1)) * 9);    
var tot2 = 0;    
for(i=1;i<id.length-1;i++)    
tot2 = tot2 + parseFloat(id.charAt(i))*(9-i);    
var tot3 = parseFloat(id.charAt(9));    
var tot4 = tot1 + tot2 + tot3;    
if((tot4 % 10)!=0)    
{ return false; } else { return true; }    
}  

function idCheck(id){  
	var res=true;  
if(id==""){
	res= false;
}

else if(checkid(id) == false){   
res= false;    
}    

if(chfastid(id) == false){    
res= false;    
}    

if(ch12fastid(id) == false){    
res= false;    
}    

if(firstlettererr(id) == false){    
res= false;    
}    

if(idmanber(id) == false){    
res= false;    
}    

if(idchackok(id) == false){  
res= false;    
}    
return res;
}    
//
