// JavaScript Document


function check_customer()
{
if (document.customer_infor.upload_customer_email.value.replace(/ /g,'')=='')
{alert ('Problem: \n\nPlease Enter you Email');
document.customer_infor.upload_customer_email.focus();
return false;}


if (document.customer_infor.quote_id.value.replace(/ /g,'')=='')
{alert ('Problem: \n\nPlease Enter you Quote ID');
document.customer_infor.quote_id.focus();
return false;}
return check_email_quote_id()


}

function check_upload_file()
{
if(document.getElementById('tt').value.replace(/ /g,'')=='')
{alert ('Problem: \n\nPlease BROWSE to select your zip or rar file then press Upload File to send');
return false;}

var hj=(document.getElementById('tt').value).toLowerCase();
if(hj.lastIndexOf('.zip')==-1 && hj.lastIndexOf('.rar')==-1||document.getElementById('tt').value.length==4)
{alert ('Problem: \n\nThe File type is wrong.\n\nPlease BROWSE to select your zip or rar file then press Upload File to send.\n\nIf you like, you can attach your PCB files into your email, and send the Gerber file email to PCB@PCBfabrication.com.');
return false;}
document.getElementById('upload_infor').innerHTML='<img src=PCB-fabrication-Images/wait.gif border=0><font color=blue>File uploading,Please Wait......</font>';

}









function check_email_quote_id()

{var myReg = /^[-_A-Za-z0-9.*']+@([-_A-Za-z0-9-]+\.)+[A-Za-z0-9]{2,3}$/; 
if(!myReg.test(document.getElementById('upload_customer_email').value))  
{alert('Problem: \n\nPlease Enter a Correct Email address');
document.getElementById('upload_customer_email').focus();
return false;}

return check_quote_id()
}


function check_quote_id()

{
quote_id_value=document.customer_infor.quote_id.value.replace(/ /g,'');
s=quote_id_value.indexOf('-(');
t=quote_id_value.indexOf(')');
if (s==-1||t==-1)	
{alert("Problem: \n\nPlease Enter a Correct Quote ID.");
document.customer_infor.quote_id.focus();
return false;}

if(quote_id_value.substring(s+2,t).length==0)
{alert("Problem: \n\nPlease Enter a Correct Quote ID.");
document.customer_infor.quote_id.focus();
return false;}

document.getElementById('sendmail_jg_show').innerHTML='<font color=blue>The information Sending Now......</font>';
	
}




function check_if_upload(ok)
{
if(document.upload_file.upload_file_jg.value=='true')
if (document.customer_infor.send_email_jg.value=='')
{
if (window.attachEvent)
event.returnValue='Sorry, You Have not send your information to us.';
else if(window.addEventListener)
{ok.preventDefault();
ok.returnValue='Sorry, You Have not send your information to us. ';}


}

}

