
function checkEmail(emailAdd)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAdd.value))
	{
		return (true)
	}
	else
		alert("Invalid EMAIL! Please re-enter.\n e.g.info@taarak.com")
	return (false)
}

function load()
{
	document.frmenquiry.Name.focus();
}

function Validate()
{
//(Object, MaxLen);
	/*function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}*/

var alphaExp = /^[a-zA-Z]+$/;
	var expname = /[^\w|\s|\!|\=|\&|\$|\'|\?|\.|\/|\_|\)|\(|\[|\]|\:|\-]+/;
	var expphonefax=/[^0-9|\s|\+|\-]+/;	
	var alphaExp = /^[a-zA-Z]+$/;
	var msg = '0 1 2 3..(\",%,;,~,@,#,%,^,*,{}\)';
	var urlexp = /^(http:\/\/www.){1}([\w]+)(.[\w]+){1,2}$/;
	var siteurl = 'http://www.taarak.com'
	//checking for the value of the Name	
	var nam = document.frmenquiry.Name.value.replace(/ /g,"");
	
	if (nam == "")
	{
		alert(" FULL NAME can not be blank");
		document.frmenquiry.Name.select();
		return false;
	}
	if(nam!="")
	{
		if(alphaExp.test(nam)==false)
		{
			alert('Special characters/numbers like '+ msg +' are not allowed in FULL NAME');
			document.frmenquiry.Name.select();
			return false;
		}
	}
	
	//designation
	var designation =document.frmenquiry.Designation.value.replace(/ /g,"");
	
	if (designation == "")
	{
		alert("DESIGNATION can not be blank");
		document.frmenquiry.Designation.select();
		return false;
	}
	if(designation!="")
	{
		if(alphaExp.test(designation)==false)
		{
			alert('Special characters like '+ msg +' are not allowed in DESIGNATION');
			document.frmenquiry.Designation.select();
			return false;
		}
	}
	
	//company
	var company =document.frmenquiry.Company.value.replace(/ /g,"");
	
	if (company == "")
	{
		alert("COMPANY NAME can not be blank");
		document.frmenquiry.Company.select();
		return false;
	}
	if(company!="")
	{
		if(expname.test(company)==true)
		{
			alert('Special characters like '+ msg +' are not allowed in COMPANY NAME');
			document.frmenquiry.Company.select();
			return false;
		}
	}
	
	//telephone :country code
	var ccode=document.frmenquiry.ccode.value.replace(/ /g,"");
	if (ccode == "")
	{
		alert("Country code cannot be blank");
		document.frmenquiry.ccode.select();
		return false;
	}
	else
	{
		if(expphonefax.test(ccode)==true)
		{
		alert(" Invalid country code entered\n The allowed characters are 0 to 9,+,- and spaces")
		document.frmenquiry.ccode.select();
		return false;	
		}
	}
	//area code
var acode=document.frmenquiry.acode.value.replace(/ /g,"");
	if (acode == "")
	{
		alert("Area code cannot be blank");
		document.frmenquiry.acode.select();
		return false;
	}
	else
	{
		if(expphonefax.test(acode)==true)
		{
		alert(" Invalid area code entered\n The allowed characters are 0 to 9,+,- and spaces")
		document.frmenquiry.acode.select();
		return false;	
		}
	}

//phone
	var phone=document.frmenquiry.Telephone.value.replace(/ /g,"");		
	if (phone=="")
	{
		alert("TELEPHONE can not be blank");
		document.frmenquiry.Telephone.select();
		return false;
	}
	else
	{
		if(expphonefax.test(phone)==true)
		{
		alert(" Invalid TELEPHONE entered\n The allowed characters are 0 to 9,+,- and spaces")
		document.frmenquiry.Telephone.select();
		return false;	
		}
	}
	//mobile
	var mobile=document.frmenquiry.mobile.value.replace(/ /g,"");		
	if (mobile=="")
	{
		alert("Mobile number can not be blank");
		document.frmenquiry.mobile.select();
		return false;
	}
	else
	{
		if(expphonefax.test(mobile)==true)
		{
		alert(" Invalid mobile number entered\n The allowed characters are 0 to 9,+,- and spaces")
		document.frmenquiry.mobile.select();
		return false;	
		}
	}

	//city
	var city=document.frmenquiry.City.value.replace(/ /g,"")
	
	if(city!="")
	{
		if(expname.test(city)==true)
		{
			alert('Special characters like '+ msg + ' are not allowed in LOCATION');
			document.frmenquiry.City.select();
			return false;
		}
	}
	
	
	//employee strength
	var employee=document.frmenquiry.EmployeeStrength.value.replace(/ /g,"");
	if(employee!="")
	{
		if(expname.test(employee)==true)
		{
			alert('Special characters like '+ msg + ' are not allowed in EMPLOYEE StrENGTH');
			document.frmenquiry.EmployeeStrength.select();
			return false;
		}
	}
	
	//fax
	var fax = document.frmenquiry.Fax.value
	if (fax!= "")
	{
		if(expphonefax.test(fax)==true)
		{
			alert("Invalid FAX entered\n The allowed characters are 0 to 9,+,- and spaces")
			document.frmenquiry.Fax.select();
			return false;	
		}
	}
	
	///
	//email
	var emailAdd = document.frmenquiry.Email.value.replace(/ /g,"");
	
	if (emailAdd == "")
	{
		alert("EMAIL can not be blank");
		document.frmenquiry.Email.select();
		return false;
	}
	if (!checkEmail(document.frmenquiry.Email))
	{
		document.frmenquiry.Email.select();
		return false;
	}
	 
	//nature of business
	var nature=document.frmenquiry.Nature.value.replace(/ /g,"");
	if(nature!="")
	{
		if(expname.test(nature)==true)
		{
			alert('Special characters like '+ msg + ' are not allowed in NATURE OF BUSINESS');
			document.frmenquiry.Nature.select();
			return false;
		}
	}
	var url=document.frmenquiry.Website.value.replace(/ /g,"");
	if (url!=="")
	{
		if (urlexp.test(url)==false)	
		{
			alert ('Invalid WEBSITE ! Please re-enter.\n e.g.'+ siteurl ); 
			document.frmenquiry.Website.select(); 
			return false;
		}
	}
	//query
	var query = document.frmenquiry.Query.value.replace(/ /g,"");
	
	if (query == "")
	{
		alert("QUERY can not be blank");
		document.frmenquiry.Query.select();
		return false;
	}
	if (query!== "")
	{
	  if (query.length > 200)
			{
				alert("QUERY can be only 200 characters long");
				document.frmenquiry.Query.select();
				return false;
			}
	}
	//number of computer
	var number=document.frmenquiry.Number.value.replace(/ /g,"");
	if(number!="")
	{
		if(expname.test(number)==true)
		{
			alert('Special characters like '+ msg + ' are not allowed in NUMBER OF COMPUTERS');
			document.frmenquiry.Number.select();
			return false;
		}
	}
	
	
}
function checkCharLength(strObj,strName,maxlen)
{
	strTestObj = "document.frmenquiry."+strObj 
	if (eval(strTestObj+".value.length")>maxlen)
	{
	  eval(strTestObj+".value="+strTestObj+".value.substring(0,"+maxlen+")");
	  alert(strName+" can only be "+ maxlen +" characters long");
	}
}	
function imposeMaxLength()
{
	var txtarea=document.frmenquiry.Query.value;
	if(txtarea.length >=200)
		{
		alert("Query cannot be more than 200 charaters");
		
document.frmenquiry.Query.select();
//return (txtarea.length-1);
	return false;
	
	} 

  ///return (Object.value.length <= MaxLen);
}

//-->
