function SearchMe(e){
	if(e.keyCode == 13){
		if(document.frmsearch.txtsearch.value==""){
			alert("Enter Search Value");
			return false;
		}
		return true;
	}
}

function isEmpty(strval) {
    if (strval == "" || strval == null || !isNaN(strval) || strval.charAt(0) == ' ')
    {
    return false;
    }
	else
	return true;
  }

//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = strEmail;
   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
     return false;
    } 
    return true; 
}

function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function frmContactUsValidate()  {
	var err="";	
	if(!isEmpty(document.eContactusForm.fullname.value))
		err+="Full Name\n";		
	if(!isEmpty(document.eContactusForm.address1.value))
		err+="Address 1\n";	
	if(!isEmpty(document.eContactusForm.citystate.value))
		err+="City, State\n";
	if(LTrim(document.eContactusForm.zip.value)=="")
		err+="Zip\n";
	if(!isEmpty(document.eContactusForm.emailaddress.value))
		err+="Email Address\n";
	else if(!isValidEmail(document.eContactusForm.emailaddress.value))
		err+="Invalid Email Address!\n";
	if(!isEmpty(document.eContactusForm.comments.value) || document.eContactusForm.comments.value=="(please type in your comments):")
		err+="Comments\n";	
		
	if(err!="") {
		alert("Following field(s) are required!\n----------------------------\n"+err);
		return false;
	}
	return true;
}
