	//function to validate the fields are empty  or not
	function val() {

        if(document.form1.txtFname.value==""){
				alert("Enter the First Name");
				document.form1.txtFname.focus();
    	        document.form1.txtFname.value="";
				return false;
		}
          if(document.form1.txtFname.value.search(/^[a-zA-Z]+$/))
           	{
            		alert("Name should have characters only");
            		document.form1.txtFname.focus();
			        document.form1.txtFname.value="";
                    return false;
           	}


        if(document.form1.txtLname.value==""){
				alert("Enter the Last Name");
				document.form1.txtLname.focus();
    	        document.form1.txtLname.value="";
				return false;
		}
         if (document.form1.txtLname.value.search(/^[a-zA-Z]+$/)){

           	{
            		alert("Last Name should have characters only");
            		document.form1.txtLname.focus();
			        document.form1.txtLname.value="";
                    return false;
           	}
        }
        if(document.form1.carinterest.value=="")
        {
        alert("Select Favourite Car Field");
            		document.form1.carinterest.focus();
			        document.form1.carinterest.value="";
                    return false;
        }
         if(document.form1.txtStreet.value==""){
				alert("Enter the Street");
				document.form1.txtStreet.focus();
    	        document.form1.txtStreet.value="";
				return false;
		}
         //if (document.form1.txtStreet.value!=""){
        // if(!document.form1.txtStreet.value.match(/^[.a-zA-Z0-9]+([.a-z A-Z0-9])*$+ /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\?|\||\\|\!|\$|\./g/))

//if ((String.find("document.form1.txtStreet.value", '<') != -1) or (String.find("document.form1.txtStreet.value", '<') != -1) ){	
  //          		alert("Street should have characters and numbers only");
    //        		document.form1.txtStreet.focus();
	//		        document.form1.txtStreet.value="";
          //          return false;
           //	}




         if (!document.form1.txtStreet.value.search(/^[<>]+$/)){	
            		alert("Street should have characters and numbers only");
            		document.form1.txtStreet.focus();
			        document.form1.txtStreet.value="";
                    return false;
           	}
        

	
 	


        if(document.form1.txtCity.value=="" || (document.form1.txtCity.value=="City")){
				alert("Enter the City");
				document.form1.txtCity.focus();
			    document.form1.txtCity.value="";
				return false;
		}
		if (document.form1.txtCity.value!=""){
		if(!document.form1.txtCity.value.match(/^[.a-zA-Z]+([.a-z A-Z])*$/))         
           	{
            		alert("City should have characters only");
            		document.form1.txtCity.focus();
			        document.form1.txtCity.value="";
                    return false;
           	}
        }
     	if(document.form1.txtState.value=="" || (document.form1.txtState.value=="State")){
				alert("Enter the State");
				document.form1.txtState.focus();
			    document.form1.txtState.value="";
				return false;
		}
		if (document.form1.txtState.value!=""){
		if(!document.form1.txtState.value.match(/^[.a-zA-Z]+([.a-z A-Z])*$/))
           	{
            		alert("State should have characters only");
            		document.form1.txtState.focus();
			        document.form1.txtState.value="";
                    return false;
           	}
        }

		if(document.form1.txtZip.value=="" || (document.form1.txtZip.value=="Zip Code")){
				alert("Enter the Zip");
				document.form1.txtZip.focus();
			    document.form1.txtZip.value="";
				return false;
		}
		if (document.form1.txtZip.value!=""){
           if(!(/^[0-9]+$/.test(document.form1.txtZip.value)))
           	{
            		alert("Zip code can contain numbers only");
            		document.form1.txtZip.focus();
			    document.form1.txtZip.value="";
                    return false;
           	}
        }

      if(document.form1.txtHomePhone.value==""){
				alert("Enter the HomePhone");
				document.form1.txtHomePhone.focus();
    	        document.form1.txtHomePhone.value="";
				return false;
		}

	if(document.form1.txtHomePhone.value.search(/^[0-9]+$/)){
			alert("Please enter Numbers Only");
			document.form1.txtHomePhone.focus();
			document.form1.txtHomePhone.value="";
			return false;
			}

	
	/* if(document.form1.txtHomePhone.value!=""){
           if(!(/^[0-9]+$/.test(document.form1.txtHomePhone.value)))
           	{
            		alert("Enter numbers only");
            		document.form1.txtHomePhone.focus();
			    document.form1.txtHomePhone.value="";
                    return false;
           	}
        }*/



      if(document.form1.txtEmail.value==""){
				alert("Enter the Email");
				document.form1.txtEmail.focus();
    	        document.form1.txtEmail.value="";
				return false;
		}
if(document.form1.txtEmail.value.search(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/))
{
alert("Enter Valid Email Id");
document.form1.txtEmail.value="";
document.form1.txtEmail.focus();
return false;
}
   

       if(document.form1.txtConfirmEmail.value==""){
				alert("Enter the Confirmation Email");
				document.form1.txtConfirmEmail.focus();
    	        document.form1.txtConfirmEmail.value="";
				return false;
		}
   
 if(document.form1.txtConfirmEmail.value.search(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/))
{
alert("Enter Valid Confirm Email Id");
document.form1.txtConfirmEmail.value="";
document.form1.txtConfirmEmail.focus();
return false;
}

        if(document.form1.txtEmail.value!=document.form1.txtConfirmEmail.value){
                alert("Email and Confirm Email should be same");
				document.form1.txtConfirmEmail.focus();
			    document.form1.txtConfirmEmail.value="";
			    return false
        }

      if(document.form1.txtDOB.value==""){
				alert("Enter the Date Of Birth");
				document.form1.txtDOB.focus();
    	        document.form1.txtDOB.value="";
				return false;
		}
	
	/*if(document.form1.txtDOB.value.search(/^[0-9]+$/)){
			alert("Please enter valid Date of birth");
			document.form1.txtDOB.focus();
			document.form1.txtDOB.value="";
			return false;
			}*/

	/*var dt=document.form1.txtDOB;

	if (isDate(dt.value)==false){
		dt.focus();
		return false;
	}*/


	


        if(document.form1.txtEmployer.value==""){
				alert("Enter the Current Employer");
				document.form1.txtEmployer.focus();
    	        document.form1.txtEmployer.value="";
				return false;
		}

    if(document.form1.txtSdate.value=="" || (document.form1.txtSdate.value=="Date for test drive")){
				alert("Enter the Start date");
				document.form1.txtSdate.focus();
    	        document.form1.txtSdate.value="";
				return false;
		}



      if(document.form1.txtIncome.value==""){
				alert("Enter the Income");
				document.form1.txtIncome.focus();
    	        document.form1.txtIncome.value="";
				return false;
		}
      if (document.form1.txtIncome.value!=""){
           if(!(/^([0-9])+$/.test(document.form1.txtIncome.value)))
           	{
            		alert("Income can contain numbers only");
            		document.form1.txtIncome.focus();
			        document.form1.txtIncome.value="";
                    return false;
           	}
        }


	
 	}









// Declaring valid date character, minimum year and maximum year
/*var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this;
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strMonth=dtStr.substring(0,pos1);
	var strDay=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy");
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month");
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day");
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date");
		return false;
	}
return true;
}
*/




 
