// JavaScript Document
	function Validate(){
	var retVal =  true; 
	if ((document.form2.first_name.value==null)||(document.form2.first_name.value=="")){
		alert("Enter valid name");
		document.form2.first_name.focus();
		retVal =  false;
		return false;
	}else if (isProper(document.form2.first_name.value) == false) {
        alert("Enter valid name");
        document.form2.first_name.focus();
		retVal =  false;
        return false;
    }
	if ((document.form2.last_name.value==null)||(document.form2.last_name.value=="")){
		alert("Enter valid last name");
		document.form2.last_name.focus();
		retVal =  false;
		return false;
	}else if (isProper(document.form2.last_name.value) == false) {
        alert("Enter valid last name");
        document.form2.last_name.focus();
		retVal =  false;
        return false;
    }

	var phone = document.form2.phone.value;
	var phone2 = document.form2.phone2.value;
	var phone3 = document.form2.phone3.value;
	if((phone.length > 1 && phone.length < 3 )){
		alert('Enter valid Phone number');
		document.form2.phone.focus();
		retVal =  false;
		return false;
	}
	if((phone2.length > 1 && phone2.length < 3 )){
		alert('Enter valid Phone number');
		document.form2.phone2.focus();
		retVal =  false;
		return false;
	}
	if((phone3.length > 1 && phone3.length < 4 )){
		alert('Enter valid Phone number');
		document.form2.phone3.focus();
		retVal =  false;
		return false;
	}
	if((phone.length < 3) || (phone2.length < 3) || (phone3.length < 4)){
		alert('Enter valid Phone number');
		document.form2.phone.focus();
		retVal =  false;
		return false;
	}
	if ((document.form2.email.value==null)||(document.form2.email.value=="")){
		alert("Enter valid E-Mail");
		document.form2.email.focus();
		retVal =  false;
		return false;
	}
	if (echeck(document.form2.email.value)==false){
		document.form2.email.focus();
		retVal =  false;
		return false; 
	} 
	var email = document.form2.email.value;
	var email2 = document.form2.email2.value;
	if(email != email2){
		alert('Email are not matching');
		document.form2.email2.focus();
		retVal =  false;
		return false; 
	}
	if ((document.form2.email2.value==null)||(document.form2.email2.value=="")){
		alert("Invalid E-Mail");
		document.form2.email2.focus();
		retVal =  false;
		return false;
	}
	if (echeck(document.form2.email2.value)==false){
		document.form2.email2.focus();
		retVal =  false;
		return false; 
	}
 	
	/*if ((document.form2.address.value==null)||(document.form2.address.value=="")){
		alert("Enter Street Address");
		document.form2.address.focus();
		retVal =  false;
		return false;
	}
	if ((document.form2.city.value==null)||(document.form2.city.value=="")){
		alert("Enter City");
		document.form2.city.focus();
		retVal =  false;
		return false;
	}
	if ((document.form2.state.value==null)||(document.form2.state.value=="")){
		alert("Enter State");
		document.form2.state.focus();
		retVal =  false;
		return false;
	}
	if ((document.form2.zip.value==null)||(document.form2.zip.value=="")){
		alert("Enter Zip");
		document.form2.zip.focus();
		retVal =  false;
		return false;
	}*/

	document.quickcontactform1.action="http://phillipsinjurylawyers.com/blog/thankyou.php";
	document.quickcontactform1.submit();
	
	return retVal;
	//alert('End of the function');
	}


// Code for contact us form
	function Contact_Validate(){
	var retVal =  true; 

	if ((document.form1.first_name.value==null)||(document.form1.first_name.value=="")){
		alert("Enter valid first name");
		document.form1.first_name.focus();
		retVal =  false;
		return false;
	}else if (isProper(document.form1.first_name.value) == false) {
        alert("Enter valid first name");
        document.form1.first_name.focus();
		retVal =  false;
        return false;
    }
	if ((document.form1.last_name.value==null)||(document.form1.last_name.value=="")){
		alert("Enter valid last name");
		document.form1.last_name.focus();
		retVal =  false;
		return false;
	}else if (isProper(document.form1.last_name.value) == false) {
        alert("Enter valid last name");
        document.form1.last_name.focus();
		retVal =  false;
        return false;
    }
	var phone = document.form1.homephone.value;
	var phone2 = document.form1.homephone2.value;
	var phone3 = document.form1.homephone3.value;
	if((phone.length > 0) || (phone.length > 0) || (phone.length > 0)) {
		if((phone.length > 1 && phone.length < 3 )){
			alert('Enter valid home phone number');
			document.form1.homephone.focus();
			retVal =  false;
			return false;
		}
		if((phone2.length > 1 && phone2.length < 3 ) || (phone2.length == 0)){
			alert('Enter valid home phone number');
			document.form1.homephone2.focus();
			retVal =  false;
			return false;
		}
		if((phone3.length > 1 && phone3.length < 4 ) || (phone3.length == 0)){
			alert('Enter valid home phone number');
			document.form1.homephone3.focus();
			retVal =  false;
			return false;
		}
		if((phone.length < 3) || (phone2.length < 3) || (phone3.length < 4)){
			alert('Enter valid home phone number');
			document.form1.homephone.focus();
			retVal =  false;
			return false;
		}
	}
	var workphone = document.form1.workphone.value;
	var workphone2 = document.form1.workphone2.value;
	var workphone3 = document.form1.workphone3.value;
	if((workphone.length > 0) || (workphone2.length > 0) || (workphone3.length > 0)){
		if((workphone.length > 1 && workphone.length < 3 )){
			alert('Enter valid workphone number');
			document.form1.workphone.focus();
			retVal =  false;
			return false;
		}
		if((workphone2.length > 1 && workphone2.length < 3 )){
			alert('Enter valid workphone number');
			document.form1.workphone2.focus();
			retVal =  false;
			return false;
		}
		if((workphone3.length > 1 && workphone3.length < 4 )){
			alert('Enter valid workphone number');
			document.form1.workphone3.focus();
			retVal =  false;
			return false;
		}
		if((workphone.length < 3) || (workphone2.length < 3) || (workphone3.length < 4)){
			alert('Enter valid workphone number');
			document.form1.workphone.focus();
			retVal =  false;
			return false;
		}
	}
	var cellphone = document.form1.cellphone.value;
	var cellphone2 = document.form1.cellphone2.value;
	var cellphone3 = document.form1.cellphone3.value;
	if((cellphone.length > 0) || (cellphone2.length > 0) || (cellphone3.length > 0)){
		if((workphone.length > 1 && workphone.length < 3 )){
			alert('Enter valid cell phone number');
			document.form1.cellphone.focus();
			retVal =  false;
			return false;
		}
		if((cellphone2.length > 1 && cellphone2.length < 3 )){
			alert('Enter valid cell phone number');
			document.form1.cellphone2.focus();
			retVal =  false;
			return false;
		}
		if((cellphone3.length > 1 && cellphone3.length < 4 )){
			alert('Enter valid cell phone number');
			document.form1.cellphone3.focus();
			retVal =  false;
			return false;
		}
		if((cellphone.length < 3) || (cellphone2.length < 3) || (cellphone3.length < 4)){
			alert('Enter valid cell phone number');
			document.form1.cellphone.focus();
			retVal =  false;
			return false;
		}
	}
	
	if ((document.form1.email.value==null)||(document.form1.email.value=="")){
		alert("Enter valid E-Mail");
		document.form1.email.focus();
		retVal =  false;
		return false;
	}
	if (echeck(document.form1.email.value)==false){
		document.form1.email.focus();
		retVal =  false;
		return false; 
	} 
	var email = document.form1.email.value;
	var email2 = document.form1.email2.value;
	if(email != email2){
		alert('Emails are not matching');
		document.form1.email2.focus();
		retVal =  false;
		return false; 
	}
	if ((document.form1.email2.value==null)||(document.form1.email2.value=="")){
		alert("Invalid E-Mail");
		document.form1.email2.focus();
		retVal =  false;
		return false;
	}
	if (echeck(document.form1.email2.value)==false){
		document.form1.email2.focus();
		retVal =  false;
		return false; 
	} 
	/*if ((document.form1.address.value==null)||(document.form1.address.value=="")){
		alert("Enter Street Address");
		document.form1.address.focus();
		retVal =  false;
		return false;
	}
	if ((document.form1.city.value==null)||(document.form1.city.value=="")){
		alert("Enter City");
		document.form1.city.focus();
		retVal =  false;
		return false;
	}
	if ((document.form1.state.value==null)||(document.form1.state.value=="")){
		alert("Enter State");
		document.form2.state.focus();
		retVal =  false;
		return false;
	}
	if ((document.form1.zip.value==null)||(document.form1.zip.value=="")){
		alert("Enter Zip");
		document.form2.zip.focus();
		retVal =  false;
		return false;
	}*/
	return retVal;
	//alert('End of the function');
	}


function isProper(string) {

   if (!string) return false;
   var iChars = "*|,\":<>[]{}`\';()@&$#%1234567890";

   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
} 




	function deleteBlanks(entry)
	{
		var len = entry.length ;
		var foundBlank = 1;
		while(foundBlank == 1 && len > 0) 
		{
			var indx = entry.indexOf(" ");
			if(indx == -1) 
				foundBlank = 0 ;
			else
				entry = entry.substring(0,indx) + entry.substring(indx+1,len);
			len = entry.length;
		}
		return entry;
	}

	var bugchars = '!#$^&*()+|}{[]?><~%:;/,=`"\'';
	function CharsInBag(s)
	{   var i;
	var lchar="";
		// Search through string's characters one by one.
		// If character is not in bag.
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character isn't whitespace.
			var c = s.charAt(i);
			if(i>0)lchar=s.charAt(i-1)
			if (bugchars.indexOf(c) != -1 || (lchar=="." && c==".")) return false;
		}
		return true;
	}
	
	function isInteger(s)
	{   var i;
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character is not a number.
			var c = s.charAt(i);
			if ((c >= "0") && (c <= "9") && (c != ".")) return false;
		}
		// All characters are numbers.
		return true;
	}
	function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var lastdot=str.lastIndexOf(dot)
		var lastval = parseInt(lstr) - parseInt(lastdot);

		if (lastval >5){
		   alert("Invalid E-Mail")
		   return false;
		}
		if (lastval <3){
		   alert("Invalid E-Mail")
		   return false;
		}

		if (str.indexOf(at)==-1){
		   alert("Invalid E-Mail")
		   return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-Mail")
		   return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr || str.substring(lastdot+1)==""){
		    alert("Invalid E-Mail")
		    return false
		}
		 
		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-Mail")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-Mail")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-Mail")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-Mail")
		    return false
		 }
		if(CharsInBag(str)==false){
		    alert("Invalid E-Mail")
		    return false
		 }
	   /*var arrEmail=str.split("@")
		 var ldot=arrEmail[1].indexOf(".")
		 if(isInteger(arrEmail[1].substring(ldot+1))==false){
		    alert("Invalid E-mail ID2")
		    return false
		 }*/
 		 return true					
	}
	function ismaxlength(obj){
	/*var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""*/
	var mlength=250; 
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
	}
