	var mailExp= /^[\w\-\.\+]+\@[0-9a-zA-Z\.\-]+\.[0-9A-Za-z]{2,4}$/;
	var alpExp= /^[a-zA-Z]+$/;
	var phExp = /^[0-9 \[\]\-\.\+\(\)]+$/;

	
	function trim(str) {
		return str.replace(/^\s+|\s+$/g, '');
	}
	
	function contactValidate() { 

		var fullName = document.getElementById('last_name');
		var email = document.getElementById('emailAddress0');
		var phone = document.getElementById('phone_mobile');
		var tcall = document.getElementById('location');
		var appDesc = document.getElementById('description');
		var contactValidDiv = document.getElementById('contactValidDiv');
		
		if((fullName.value == 'Full Name') && (email.value == 'Email') && (phone.value == 'Phone Number') && (tcall.value == 'Time to call') && (appDesc.value == 'How can we help?')) {
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Fill all the fields'; 
			return false;

		} 
		if(fullName.value == "Full Name")
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter Full Name';
			//alert('Please Enter Full Name');
			fullName.focus();
			return false;
			
		}
		if(email.value == "Email")
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter E-mail';
			//alert('Please Enter E-mail');
			email.focus();
			return false;
		}
		else if(!email.value.match(mailExp))
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please enter valid E-mail';
			//alert('Please enter valid E-mail');
			email.select();
			return false;
		}
	    if (phone.value == "Phone Number") 
		{ 
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter phone number';
			//alert('Please Enter phone number');
			phone.focus();
			return false;
		}
		else if(!phone.value.match(phExp))
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please enter valid phone number';
			//alert('Please enter valid E-mail');
			phone.select();
			return false;
		}
		/*
		if (tcall.value == "Company Name") 
		{ 
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter time of call';
			//alert('Please Enter time of call');
			tcall.focus();
			return false;
		}
		*/
		else if(tcall.value.match(alpExp))
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please enter valid time of call';
			//alert('Please enter valid E-mail');
			tcall.select();
			return false;
		}
		if (appDesc.value == "How can we help?") 
		{ 
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter content';
			//alert('Please Enter content');
			appDesc.focus();
			return false;
		}
		
		return true;
}


//New form validation function on 05-07-2011
//------------------------------------------
function validateLead(){
    //alert('hi');
    var frm = document.getElementById('quote');

     $("#errorDiv").hide();
    var validated = true;
    var errorMsg = "";
    
    if($.trim($("#last_name").attr("value")).length == 0 || $.trim($("#last_name").attr("value")) == 'Full Name'){
        validated = false;
        errorMsg += "Please enter Name<br />";
        
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#last_name").focus();
        return false;
    }
  
    var emailPattern = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;       
    //var emailPattern = /^[a-z]{1,}[a-z0-9\._-]*@[a-z]{1,}[a-z0-9\._-]*.[a-z]{2,4}$/i;
    var email = $.trim($("#emailAddress0").attr("value"));
    
    if(email.length == 0 || email == 'Email'){
        validated = false;
        errorMsg += "Please enter Email<br />";
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#emailAddress0").focus();
        return false;
    }else if(!emailPattern.test(email)){
        validated = false;
        errorMsg += "Please enter valid Email<br />";
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#emailAddress0").focus();
        return false;
    }
    
    var phonePattern = /^[0-9\s\(\)\+-]{10,}$/;
    var phone = $.trim($("#phone_mobile").attr("value"));
    
    if(phone.length == 0 || phone == 'Phone Number'){
        validated = false;
        errorMsg += "Please enter Phone Number<br />";
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#phone_mobile").focus();
        return false;
    }else if(!phonePattern.test(phone)){
        validated = false;
        errorMsg += "Please enter valid Phone Number<br />";
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#phone_mobile").focus();
        return false;
    }
    
    if($.trim($("#description").attr("value")).length == 0 || $.trim($("#description").attr("value")) == 'How can we help?'){
        validated = false;
        errorMsg += "Please enter Description<br />";    
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#description").focus();
        return false;
    }    

   if($.trim($("#captcha").attr("value")).length == 0 ){
        validated = false;
        errorMsg += "Please enter the Confirm Value<br />";    
        $("#errorDiv").html(errorMsg).fadeIn("slow");
        $("#captcha").focus();
        return false;
    }     
    
    /*if(!validated){
        $("#errorDiv").html(errorMsg);
        return false;    
    }*/
    
    frm.submit();
    return true;    
}


//New function added on 05-07-2011
$(function() {

	//Overlay texts for form
	overLayTitleText('last_name', 'inputborder', 'inputNoData');
	overLayTitleText('emailAddress0', 'inputborder', 'inputNoData');
	overLayTitleText('phone_mobile', 'inputborder', 'inputNoData');
	overLayTitleText('description', 'inputborder', 'inputNoData');
	
}); 





function chkFrm2Validation() {
				
		var fullName = document.getElementById('fullName');
		var email = document.getElementById('email');
		var phone = document.getElementById('phone');
		//var tcall = document.getElementById('location');
		var appDesc = document.getElementById('appDesc');
		var companyName = document.getElementById('companyName');
		var budget = document.getElementById('budget');
		var contactValidDiv = document.getElementById('contact2ValidDiv');
		
		if(fullName.value == "Full Name" || fullName.value == "")
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter Full Name';
			//alert('Please Enter Full Name');
			fullName.focus();
			return false;
			
		}
		if(email.value == "Email" || email.value == "")
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter E-mail';
			//alert('Please Enter E-mail');
			email.focus();
			return false;
		}
		else if(!email.value.match(mailExp))
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please enter valid E-mail';
			//alert('Please enter valid E-mail');
			email.select();
			return false;
		}
	    if (phone.value == "Phone Number" || phone.value == "") 
		{ 
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter phone number';
			//alert('Please Enter phone number');
			phone.focus();
			return false;
		}
		else if(!phone.value.match(phExp))
		{
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please enter valid phone number';
			//alert('Please enter valid E-mail');
			phone.select();
			return false;
		}
		
		if (appDesc.value == "How can we help?" || appDesc.value == "") 
		{ 
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter project information';
			//alert('Please Enter content');
			appDesc.focus();
			return false;
		}
		
		if (budget.value == "") 
		{ 
			contactValidDiv.style.display = '';
			contactValidDiv.innerHTML = 'Please Enter approximate budget';
			//alert('Please Enter content');
			budget.focus();
			return false;
		}
		
		return true;

}

function loadContent(el,id){
	$("#contentUL li").removeClass("active").removeClass('normal').addClass("normal");
	$(el).addClass("active");

	//Hide divs
	$(".cnt3div").hide();
	$("#content"+id).fadeIn("slow");
}


function overLayTitleText(id, defaultClass, noDataClass){
	var El = document.getElementById(id);
	
	if(trim(El.value) == ""){
		El.value = El.getAttribute('title');
		El.className = noDataClass;
	}
	
	function handleFocus(){
		var El = (window.event)?window.event.srcElement:this;
		if(trim(El.value) == El.getAttribute('title')){
			El.value = "";
			El.className = defaultClass;
		}
	}
	
	function handleBlur(){
		var El = (window.event)?window.event.srcElement:this;
		if(trim(El.value) == ""){
			El.value = El.getAttribute('title');
			El.className = noDataClass;
		}
	}
	
	
	if(El.addEventListener){
		El.addEventListener("focus", handleFocus, false);
		El.addEventListener("blur", handleBlur, false);
	}
	if(El.attachEvent){
		El.attachEvent("onfocus", handleFocus);
		El.attachEvent("onblur", handleBlur);
	}
}

function blogValidateFirstForm(formId, errDiv){
    var frm = document.getElementById(formId);
    document.getElementById(errDiv).innerHTML = "";
    document.getElementById(errDiv).style.display = "none";
    
    if(trim(frm.last_name.value).length == 0){
        document.getElementById(errDiv).innerHTML = "Please Enter Fullname";
        document.getElementById(errDiv).style.display = "block";
        frm.last_name.focus();
        return false;
    }
    
    if(trim(frm.emailAddress0.value).length == 0)
	{
		document.getElementById(errDiv).innerHTML = "Please Enter Email";
        document.getElementById(errDiv).style.display = "block";
        frm.emailAddress0.focus();
        return false;
	}
	
	if(!frm.emailAddress0.value.match(mailExp))
	{
		document.getElementById(errDiv).innerHTML = "Please Enter a valid Email";
        document.getElementById(errDiv).style.display = "block";
        frm.emailAddress0.focus();
        return false;
	}
	
	if(trim(frm.phone_mobile.value).length == 0)
	{
		document.getElementById(errDiv).innerHTML = "Please Enter Phone number";
        document.getElementById(errDiv).style.display = "block";
        frm.phone_mobile.focus();
        return false;
	}
	
	if(!frm.phone_mobile.value.match(phExp))
	{
		document.getElementById(errDiv).innerHTML = "Please Enter a valid Phone number";
        document.getElementById(errDiv).style.display = "block";
        frm.phone_mobile.focus();
        return false;
	}
	
    if(trim(frm.description.value).length == 0){
        document.getElementById(errDiv).innerHTML = "Please Enter How can we help";
        document.getElementById(errDiv).style.display = "block";
        frm.description.focus();
        return false;
    }
    return true;
}

