// JavaScript Document


function validateGiveaway()
{
	
	var fname  				= document.frmGiveaway.fname.value;
//	var lname  				= document.frmGiveaway.lname.value;
//	var title  				= document.frmGiveaway.title.value;
	var company  			= document.frmGiveaway.company.value;
//	var address  			= document.frmGiveaway.address.value;
//	var city  				= document.frmGiveaway.city.value;
//	var state  				= document.frmGiveaway.state.value;
//	var zip 				= document.frmGiveaway.zip.value;
	var phone 				= document.frmGiveaway.phone.value;
//	var fax 				= document.frmGiveaway.fax.value;
	var email 				= document.frmGiveaway.email.value;
//	var tyofind 			= document.frmGiveaway.tyofind.value;
//	var confirm_email		= document.frmGiveaway.confirm_email.value;
//	var learn_about  		= document.frmGiveaway.learn_about.value;
	
//	 alert("i am here");
	var nameRegxp = /^([a-zA-Z\s\']+)$/;
	var companyRegxp = /^([a-zA-Z0-9-:,.&amp;()\s]+)$/;
	var cityRegxp = /^([a-zA-Z\s\.]+)$/;
	var emailRegxp = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
	var phoneRegxp = /^([0-9]+)$/;
	var zipRegxp = /^([0-9]+)$/;
	
	//alert("i am here");
	if( fname == "" ) {
		alert("Please enter first name.");	
		document.frmGiveaway.fname.focus();
		return false;
	}
	if ( fname.match(nameRegxp) == null ) {        
		alert("Please enter valid first name.");	
		document.frmGiveaway.fname.focus();
		return false;
	}
/*	if( lname == "" ) {
		alert("Please enter last name.");	
		document.frmGiveaway.lname.focus();
		return false;
	}
	if ( lname.match(nameRegxp) == null ) {       
		alert("Please enter valid last name.");	
		document.frmGiveaway.lname.focus();
		return false;
	}
	if( title == "" ) {
		alert("Please enter title.");	
		document.frmGiveaway.title.focus();
		return false;
	}*/
	if( company == "" ) {
		alert("Please enter company.");	
		document.frmGiveaway.company.focus();
		return false;
	}
	if ( company.match(companyRegxp) == null ) {        
		alert("Please enter valid company.");	
		document.frmGiveaway.company.focus();
		return false;
	}
/*	if( address == "" ) {
		alert("Please enter address.");	
		document.frmGiveaway.address.focus();
		return false;
	}
	if( city == "" ) {
		alert("Please enter city.");	
		document.frmGiveaway.city.focus();
		return false;
	}
	if ( city.match(cityRegxp) == null ) {        
		alert("Please enter valid city.");	
		document.frmGiveaway.city.focus();
		return false;
	}
	if( state == "" ) {
		alert("Please select state.");	
		document.frmGiveaway.state.focus();
		return false;
	}
	if( zip == "" ) {
		alert("Please enter zip.");	
		document.frmGiveaway.zip.focus();
		return false;
	}
	if ( zip.match(zipRegxp) == null ) {       
		alert("Please enter valid zip.");	
		document.frmGiveaway.zip.focus();
		return false;
	}
	if ( zip.length == 1 || zip.length == 2 || zip.length == 3 || zip.length == 4 || zip.length == 6 || zip.length == 7 || zip.length == 8 ) {       
		alert("Zip code should be of 5 digits or 9 digits only.");	
		document.frmGiveaway.zip.focus();
		return false;
	}*/
	if( phone == "" ) {
		alert("Please enter phone.");	
		document.frmGiveaway.phone.focus();
		return false;
	}
	if ( phone.match(phoneRegxp) == null ) {       
		alert("Please enter valid phone.");	
		document.frmGiveaway.phone.focus();
		return false;
	}
	if ( phone.length < 10 ) {       
		alert("Please enter valid phone number of 10 digits.");	
		document.frmGiveaway.phone.focus();
		return false;
	}
/*	if( fax == "" ) {
		alert("Please enter Fax.");	
		document.frmGiveaway.fax.focus();
		return false;
	}
	if ( fax.match(phoneRegxp) == null ) {       
		alert("Please enter valid Fax.");	
		document.frmGiveaway.fax.focus();
		return false;
	}
	if ( fax.length < 10 ) {       
		alert("Please enter valid fax number of 10 digits.");	
		document.frmGiveaway.fax.focus();
		return false;
	}*/
	if( email == "" ) {
		alert("Please enter email address.");	
		document.frmGiveaway.email.focus();
		return false;
	}
	if ( email.match(emailRegxp) == null ) {        
		alert("Please enter valid email address.");	
		document.frmGiveaway.email.focus();
		return false;
	}
/*	if( tyofind == "" ) {
		alert("Please enter Type of Industry.");	
		document.frmGiveaway.tyofind.focus();
		return false;
	}
	if( confirm_email == "" ) {
		alert("Please enter confirm email address.");	
		document.frmGiveaway.confirm_email.focus();
		return false;
	}
	if ( confirm_email.match(emailRegxp) == null ) {        
		alert("Please enter valid confirm email address.");	
		document.frmGiveaway.confirm_email.focus();
		return false;
	}
	if( email != confirm_email) {
		alert("Email and confirm email does not match.");	
		document.frmGiveaway.confirm_email.focus();
		return false;
	}
	if( learn_about == "" ) {
		alert("Please enter how did you first learn about our Rebuilding America Together program.");	
		document.frmGiveaway.learn_about.focus();
		return false;
	}*/
		
	return true;
		
  }
