function trim(text)
{

	while(text.value.charAt(0)==' ')
	text.value=text.value.substring(1,text.value.length);
	while(text.value.charAt(text.value.length-1)==' ')
		text.value=text.value.substring(0,text.value.length-1);
}

function ValidateAll()
{
	
/* Title Validation Starts Here */
	if(this.document.getElementById("salutation")!=null){
		title = this.document.getElementById("salutation").value;
		if(title ==""){
			alert("Select Title");
			this.document.getElementById("salutation").focus();
			return false;
		}
	}
	else{}	
	/* Title Validation Ends Here */	

	/* First Name Validation Starts Here */	
	if(this.document.getElementById("first_name")!=null){
	trim(this.document.getElementById("first_name"));
		if(this.document.getElementById("first_name").value ==""){
			alert("Enter First Name"); 
			this.document.getElementById("first_name").focus(); 
			return false; 
		}
		else{}
	}
	else{} 
	/* First Name Validation Ends Here */	

	/* Last Name Validation Starts Here */	
    if(this.document.getElementById("last_name")!=null){ 
    trim(this.document.getElementById("last_name"));
		if(this.document.getElementById("last_name").value ==""){	
			alert("Enter Last Name");
			this.document.getElementById("last_name").focus();
			return false;
		}
		else{}
	}
	else{}
	/* Last Name Validation Ends Here */

	/* Email address Validation Starts Here*/
	if(this.document.getElementById("email")!=null){ 
		emailvalue= this.document.getElementById("email").value;
		if(this.document.getElementById("email").value!= ""){ 
			em =/^([a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])$/; 			
			if(!(emailvalue.match(em))){ 
				alert("Invalid Email address"); 
				this.document.getElementById("email").focus(); 
				return false; 
			}
		}			
		else{
			alert("Enter Email address");
			this.document.getElementById("email").focus();
			return false;
		}
	}
	else{}
	/* Email address Validation Ends Here*/
	
	
	/* Country Validation Starts Here - */
	if(this.document.getElementById("00N20000000h4oY")!=null){
		leadcoun = this.document.getElementById("00N20000000h4oY").value;		
		if(leadcoun ==""){
			alert("Select Country");
			this.document.getElementById("00N20000000h4oY").focus();
			return false;
		}	
	}
	else{}
	/* Country Validation Ends Here */
	/* Company Name Validation Starts Here */
	if(this.document.getElementById("company")!=null){
	 trim(this.document.getElementById("company"));

		comp= this.document.getElementById("company").value;
		if(this.document.getElementById("company").value !=""){
			cmp = /^[a-zA-Z_\s]+$/;
			if(!(comp.match(cmp))){
				alert("Invalid Company Name");		
				this.document.getElementById("company").focus();
				return false;		
			}
		}
		else{
			alert("Enter Company Name");
			this.document.getElementById("company").focus();
			return false;
		}
	}
	else{}
	/* Company Name Validation Ends Here */
	
/* Job Role Validation Starts Here */
	if(this.document.getElementById("00N20000000h9TQ")!=null){
	trim(this.document.getElementById("00N20000000h9TQ"));
		jrole = this.document.getElementById("00N20000000h9TQ").value;
		if(jrole ==""){
			alert("Enter Job Role");
			this.document.getElementById("00N20000000h9TQ").focus();
			return false;
		}
	}
	else{}		
	/* Job Role Validation Ends Here */
	
	/* Industry Sector Validation Starts Here */
	if(this.document.getElementById("industry")!=null){
		indus = this.document.getElementById("industry").value;
		if(indus ==""){
			alert("Select Industry Sector");
			this.document.getElementById("industry").focus();
			return false;
		}
	}
	else{}	
	/* Industry Sector Validation Ends Here */	
	
return true;
	
}
