// JavaScript Document
<!--
function DateBuilder()
{	dayx=document.form1.day.value
	monthx=document.form1.month.value
	yearx=document.form1.year.value
	document.form1.EstCompDate.value=""+yearx+"-"+monthx+"-"+dayx+" 00:00:00"
}

function NotesBuilder2()
{	abc=document.form1.NotesY.value
	xyz=document.form1.NotesX.value
	credits=document.form1.credit.value
	document.form1.Notes.value=""+abc+"   "+xyz+"  "+credits+"  "
}

function validate()
{	if   (document.form1.FirstName.value <=0)
	{	alert("Please go back and enter your first name.\nWe are unable to provide quotes without one.")
	}
	else if  (document.form1.HomeTel.value+document.form1.WorkTel.value+document.form1.Mobile.value <=0)
	{	alert("Please go back and enter a contact telephone number.\nWe are unable to provide quotes without it.")
	}
	else if (document.form1.LoanRequired.value <=0)
	{	alert("Please go back and enter a your required loan amount.\nWe are unable to provide quotes without it.")
	}
	else
	{
	document.form1.submit()
	}
}


function numbersonly(myfield, e, dec)
{	var key;
	var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
	return true;
	keychar = String.fromCharCode(key);
	// control keys
	if ((key==null) || (key==0) || (key==8) ||	(key==9) || (key==13) || (key==27) )
	return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
	return true;
	// decimal point jump
	else if (dec && (keychar == "."))
	{	PPriceVal.form1.elements[dec].focus();
	LoanRequired.form1.elements[dec].focus();
	return false;
	}
	else
	return false;
}

function echeck(str)
{	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   document.form1.email.value=""
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   document.form1.email.value=""
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
    	document.form1.email.value=""
	    return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
    	document.form1.email.value=""
	    return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    	document.form1.email.value=""
	    return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
    	document.form1.email.value=""
	    return false
	 }
	 if (str.indexOf(" ")!=-1){
	    document.form1.email.value=""
	    return false
	 }
	 return true					
}

function ValidateEmail()
{	var emailID=document.form1.email
	if (echeck(emailID.value)==false)
	{	emailID.value=""
		emailID.focus()
		return false
	}
	return true
}
//-->
