function select_career()
{
	var career=document.formshenqing.career.value;
	if (career=='保險業')
	{
		var msg = prompt('請填上公司名稱 和 牌照 / 員工編號  e.g. ABC Company [123456]','');
		while (msg == '' || msg == null || msg.length>80)
		{
			alert('必須填上正確資料.');
			msg = prompt('公司名稱和 牌照員工編號','');
		}
		alert(msg);
		document.formshenqing.career_msg.value = msg;
	}else{
		document.formshenqing.career_msg.value = '';
	}
	//alert (a);
	//alert (msg);
	return;
}

function doit()
{
	if(window.event.keyCode==13)
	{
		window.event.keyCode=9;
	}
}

function kname()  //對英文名字的判斷
{
	var a=document.formshenqing.ename.value;
	if(a=="")
	{
		alert("請填寫英文名字!"); 
		document.formshenqing.ename.focus();		
		return false;
	}
	else
    { 
       var b=document.formshenqing.ename.value;
       document.formshenqing.creditname.value=b;
	} 
}

function custmove1()
{
   if(window.event.keyCode==13)
   {
      document.formshenqing.ename.focus();
   }
}

function custmove2()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.longname1.focus();
   }
}

function custmove3()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.email.focus();
   }
}

function custmove4()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.passw.focus();
   }
}

function custmove5()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.passw2.focus();
   }
}


function addrmove1()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.stree1.focus();
   }
}
function addrmove2()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.stree2.focus();
   }
}

function addrmove3()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.streenumb.focus();
   }
}
function addrmove4()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.daxia.focus();
   }
}
function addrmove5()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.addr1_No.focus();
   }
}
function addrmove6()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.addr1_name.focus();
   }
}
function addrmove7()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.addr2_No.focus();
   }
}
function addrmove8()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.addr2_name.focus();
   }
}
function addrmove9()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.addr3_No.focus();
   }
}
function addrmove10()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.addr3_name.focus();
   }
}
function addrmove11()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.gphone.focus();
   }
}
function addrmove12()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.fax.focus();
   }
}
function addrmove13()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.fund.focus();
   }
}


function typemove1()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.minfund.focus();
   }
}

function typemove2()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.perfund.focus();
   }
}

function typemove3()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.creditnum1.focus();
   }
}

function typemove4()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.creditdata1.focus();
   }
}
function typemove5()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.creditdata2.focus();
   }
}
function typemove6()
{
if(window.event.keyCode==13)
   {
      document.formshenqing.dd.focus();
   }
}

function handler1()  
{
    var email=document.formshenqing.email.value;
	var emaillen=email.length;
	if ((email=="")||(email.indexOf("@")==-1)||(email.indexOf("@")==0 )||(email.indexOf("@")==emaillen-1))
	{
		  alert("請正確填寫您的E-mail地址!"); 
		document.formshenqing.email.focus();
		return false;
	}
}

function handler2()  
{	
	var gphone=document.formshenqing.gphone.value;
	if ((gphone=="" )||( gphone.indexOf(" ")==0 )||( isNaN(gphone)))
	{
		  alert("請正確填寫電話號碼!"); 
		document.formshenqing.gphone.focus();
		return false;
	}
}

function pw()  
{
	var passw1=document.formshenqing.passw.value;
	var passw2=document.formshenqing.passw2.value;
	if ((passw1=="")||(passw1!=passw2))
	{
		alert("密碼不能為空且兩次密碼要相等！");
        document.formshenqing.passw.focus();
		document.formshenqing.passw.select();
		return false;
	}
}

function checksubmitdata()
{
	var ename=document.formshenqing.ename.value;
	if ((ename=="" )||(ename.indexOf(" ")==0))
	{
		alert("請填寫您的姓名！");
		document.formshenqing.ename.focus();
		return false;
	}
	var zname=document.formshenqing.zname.value;
	if ((zname=="")||(zname.indexOf(" ")==0))
	{
		alert("請填寫您的姓名！");
		document.formshenqing.zname.focus();
		return false;
	}
	var longname=document.formshenqing.longname1.value;
	if (longname=="")
	{
		alert("請填寫您的登錄名稱！");
		document.formshenqing.longname1.focus();
		return false;
	}
    var email=document.formshenqing.email.value;
	var emaillen=email.length;
	if ((email=="")||(email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(emaillen-1)))
	{
		alert("請正確填寫您的E-mail地址!"); 
		document.formshenqing.email.focus();
		return false;
	}
	var passw=document.formshenqing.passw.value;
	if ((passw=="")||(passw.indexOf(" ")==0)||(passw.length<6))
	{
		alert("請填寫您的密碼\n要求密碼大于等于六位數！");
		document.formshenqing.passw.focus();
		return false;
	}
	var passw2=document.formshenqing.passw2.value;
	if (passw!=passw2)
	{
		alert("請確認兩次密碼是否相符！");
		document.formshenqing.passw2.focus();
		return false;
	}
	var career=document.formshenqing.career.value;
	if (career == ''){
		alert("請選擇行業");
		document.formshenqing.career.focus();
		return false;
	}
	//地址資訊
	var za=document.formshenqing.type[0].checked;
	var ea=document.formshenqing.type[1].checked;
	if(za==true)
	{
		var zarea=document.formshenqing.zarea.value;
		if(zarea=="")
		{
			alert("請選擇地區"); 
			document.formshenqing.zarea.focus();
			return false;
		}
		var zstree=document.formshenqing.zstree.value;
		if(zstree=="")
		{
			alert("請選擇或填寫街道"); 
			document.formshenqing.zstree.focus();
			return false;
		}
	}
	if(ea==true)
	{
		var earea=document.formshenqing.earea.value;
		if(earea=="")
		{
			alert("Please select Area"); 
			document.formshenqing.earea.focus();
			return false;
		}
		var estree=document.formshenqing.estree.value;
		if(estree=="")
		{
			alert("Please select or full street"); 
			document.formshenqing.estree.focus();
			return false;
		}
	}
	var gphone=document.formshenqing.gphone.value;
	if ((gphone=="")||(gphone.indexOf(" ")==0)||(isNaN(gphone)))
	{
		alert("請填寫電話號碼!"); 
		document.formshenqing.gphone.focus();
		return false;
	}
	var fax=document.formshenqing.fax.value;
	if ((fax=="")||(fax.indexOf(" ")==0)||(isNaN(fax)))
	{
		alert("請填寫傳真號碼!"); 
		document.formshenqing.fax.focus();
		return false;
	}
	//資金資訊
	var fundIndex=document.formshenqing.fund.selectedIndex;
	var fund=parseFloat(document.formshenqing.fund.options[fundIndex].text.substring(5,12));
	if (fundIndex==0)
	{
		alert("首次預付金額未選！");
		document.formshenqing.fund.focus();
		return false;
	}
	var minfundIndex=document.formshenqing.minfund.selectedIndex;
	var minfund=parseFloat(document.formshenqing.minfund.options[minfundIndex].text.substring(5,12));
	if (minfundIndex==0)
	{
        alert("提示增值線未選！");
		document.formshenqing.minfund.focus();
		return false;
	}
	var perfundIndex=document.formshenqing.perfund.selectedIndex;
	var perfund=parseFloat(document.formshenqing.perfund.options[perfundIndex].text.substring(5,12));
	if (perfundIndex==0)
	{
        alert("每次增值額未選！");
		document.formshenqing.perfund.focus();
		return false;
	}
	//支付方式
	var creditnum1=document.formshenqing.creditnum1.value;
	if ((creditnum1=="")||(creditnum1.indexOf(" ")==0)||(creditnum1.length!=4))
	{
		alert("請填寫信用卡號!"); 
		document.formshenqing.creditnum1.focus();		
		return false;
	}
	var creditnum2=document.formshenqing.creditnum2.value;
	if ((creditnum2=="")||(creditnum2.indexOf(" ")==0)||(creditnum2.length!=4))
	{
		alert("請正確填寫信用卡號!"); 
		document.formshenqing.creditnum2.focus();
		return false;
	}
	var creditnum3=document.formshenqing.creditnum3.value;
	if ((creditnum3=="")||(creditnum3.indexOf(" ")==0)||(creditnum3.length!=4))
	{
		alert("請正確填寫信用卡號!");
		document.formshenqing.creditnum3.focus();
		return false;
	}
	var creditnum4=document.formshenqing.creditnum4.value;
	if ((creditnum4=="")||(creditnum4.indexOf(" ")==0)||(creditnum4.length!=4))
	{
		alert("請正確填寫信用卡號!");
		document.formshenqing.creditnum4.focus();
		return false;
	}
	var creditname=document.formshenqing.creditname.value;
	if ((creditname=="")||(creditname.indexOf(" ")==0)||(ename!=creditname))
	{
		alert("持卡人名應於您的姓名相符！");
		document.formshenqing.creditname.focus();
		return false;
	}
	var creditdata1Index=document.formshenqing.creditdata1.selectedIndex;
	var creditdata1=parseFloat(document.formshenqing.creditdata1.options[creditdata1Index].text);
	var creditdata2Index=document.formshenqing.creditdata2.selectedIndex;
	var creditdata2=parseFloat(document.formshenqing.creditdata2.options[creditdata2Index].text);
	var creditdata=creditdata1+"/"+creditdata2;
	var now=new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	month = ""+month;
	if (month.length==1){
		month="0"+month;
	}
	var nowday=year+"/"+month;
	if (creditdata<nowday)
	{
		alert("信用卡有效期已過!");
		return false;
	}
	document.formshenqing.action="indapply1st.php";
	document.formshenqing.submit();
	return true;
}


function echecksubmitdata()
{
	var ename=document.formshenqing.ename.value;
	if ((ename=="" )||(ename.indexOf(" ")==0))
	{
		alert("請填寫您的姓名！");
		document.formshenqing.ename.focus();
		return false;
	}
	var zname=document.formshenqing.zname.value;
	if ((zname=="")||(zname.indexOf(" ")==0))
	{
		alert("請填寫您的姓名！");
		document.formshenqing.zname.focus();
		return false;
	}
	var longname=document.formshenqing.longname1.value;
	if (longname=="")
	{
		alert("請填寫您的登錄名稱！");
		document.formshenqing.longname1.focus();
		return false;
	}
    var email=document.formshenqing.email.value;
	var emaillen=email.length;
	if ((email=="")||(email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(emaillen-1)))
	{
		alert("請正確填寫您的E-mail地址!"); 
		document.formshenqing.email.focus();
		return false;
	}
	var passw=document.formshenqing.passw.value;
	if ((passw=="")||(passw.indexOf(" ")==0)||(passw.length<6))
	{
		alert("請填寫您的密碼\n要求密碼大于等于六位數！");
		document.formshenqing.passw.focus();
		return false;
	}
	var passw2=document.formshenqing.passw2.value;
	if (passw!=passw2)
	{
		alert("請確認兩次密碼是否相符！");
		document.formshenqing.passw2.focus();
		return false;
	}
	var career=document.formshenqing.career.value;
	if (career == ''){
		alert("請選擇行業");
		document.formshenqing.career.focus();
		return false;
	}
	//地址資訊
	var za=document.formshenqing.type[0].checked;
	var ea=document.formshenqing.type[1].checked;
	if(za==true)
	{
		var zarea=document.formshenqing.zarea.value;
		if(zarea=="")
		{
			alert("請選擇地區"); 
			document.formshenqing.zarea.focus();
			return false;
		}
		var zstree=document.formshenqing.zstree.value;
		if(zstree=="")
		{
			alert("請選擇或填寫街道"); 
			document.formshenqing.zstree.focus();
			return false;
		}
	}
	if(ea==true)
	{
		var earea=document.formshenqing.earea.value;
		if(earea=="")
		{
			alert("Please select Area"); 
			document.formshenqing.earea.focus();
			return false;
		}
		var estree=document.formshenqing.estree.value;
		if(estree=="")
		{
			alert("Please select or full street"); 
			document.formshenqing.estree.focus();
			return false;
		}
	}
	var gphone=document.formshenqing.gphone.value;
	if ((gphone=="")||(gphone.indexOf(" ")==0)||(isNaN(gphone)))
	{
		alert("請填寫電話號碼!"); 
		document.formshenqing.gphone.focus();
		return false;
	}
	var fax=document.formshenqing.fax.value;
	if ((fax=="")||(fax.indexOf(" ")==0)||(isNaN(fax)))
	{
		alert("請填寫傳真號碼!"); 
		document.formshenqing.fax.focus();
		return false;
	}
	//資金資訊
	var fundIndex=document.formshenqing.fund.selectedIndex;
	var fund=parseFloat(document.formshenqing.fund.options[fundIndex].text.substring(5,12));
	if (fundIndex==0)
	{
		alert("首次預付金額未選！");
		document.formshenqing.fund.focus();
		return false;
	}
	var minfundIndex=document.formshenqing.minfund.selectedIndex;
	var minfund=parseFloat(document.formshenqing.minfund.options[minfundIndex].text.substring(5,12));
	if (minfundIndex==0)
	{
        alert("提示增值線未選！");
		document.formshenqing.minfund.focus();
		return false;
	}
	var perfundIndex=document.formshenqing.perfund.selectedIndex;
	var perfund=parseFloat(document.formshenqing.perfund.options[perfundIndex].text.substring(5,12));
	if (perfundIndex==0)
	{
        alert("每次增值額未選！");
		document.formshenqing.perfund.focus();
		return false;
	}
	//支付方式
	var creditnum1=document.formshenqing.creditnum1.value;
	if ((creditnum1=="")||(creditnum1.indexOf(" ")==0)||(creditnum1.length!=4))
	{
		alert("請填寫信用卡號!"); 
		document.formshenqing.creditnum1.focus();		
		return false;
	}
	var creditnum2=document.formshenqing.creditnum2.value;
	if ((creditnum2=="")||(creditnum2.indexOf(" ")==0)||(creditnum2.length!=4))
	{
		alert("請正確填寫信用卡號!"); 
		document.formshenqing.creditnum2.focus();
		return false;
	}
	var creditnum3=document.formshenqing.creditnum3.value;
	if ((creditnum3=="")||(creditnum3.indexOf(" ")==0)||(creditnum3.length!=4))
	{
		alert("請正確填寫信用卡號!");
		document.formshenqing.creditnum3.focus();
		return false;
	}
	var creditnum4=document.formshenqing.creditnum4.value;
	if ((creditnum4=="")||(creditnum4.indexOf(" ")==0)||(creditnum4.length!=4))
	{
		alert("請正確填寫信用卡號!");
		document.formshenqing.creditnum4.focus();
		return false;
	}
	var creditname=document.formshenqing.creditname.value;
	if ((creditname=="")||(creditname.indexOf(" ")==0)||(ename!=creditname))
	{
		alert("持卡人名應於您的姓名相符！");
		document.formshenqing.creditname.focus();
		return false;
	}
	var creditdata1Index=document.formshenqing.creditdata1.selectedIndex;
	var creditdata1=parseFloat(document.formshenqing.creditdata1.options[creditdata1Index].text);
	var creditdata2Index=document.formshenqing.creditdata2.selectedIndex;
	var creditdata2=parseFloat(document.formshenqing.creditdata2.options[creditdata2Index].text);
	var creditdata=creditdata1+"/"+creditdata2;
	var now=new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	month = ""+month;
	if (month.length==1){
		month="0"+month;
	}
	var nowday=year+"/"+month;
	if (creditdata<nowday)
	{
		alert("信用卡有效期已過!");
		return false;
	}
	document.formshenqing.action="eindapply1st.php";
	document.formshenqing.submit();
	return true;
}

//好的操作
function movefocus1()
{
	var creditnum1=document.formshenqing.creditnum1.value;
	if (creditnum1.length==4)
	{
		document.formshenqing.creditnum2.focus();
	}
}

function movefocus2()
{
	var creditnum2=document.formshenqing.creditnum2.value;
	if (creditnum2.length==4)
	{
		document.formshenqing.creditnum3.focus();
	}
}

function movefocus3()
{
	var creditnum3=document.formshenqing.creditnum3.value;
	if (creditnum3.length==4)
	{
		document.formshenqing.creditnum4.focus();
	}
}
function movefocus4()
{
	var creditnum4=document.formshenqing.creditnum4.value;
	if (creditnum4.length==4)
	{
		document.formshenqing.creditname.focus();
	}
}
