function trim1(inputString)
{
    if (typeof inputString != "string")
    {
        return inputString;
    }
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ")
    { // Check for spaces at the beginning of the string
        retValue = retValue.substring(1, retValue.length);
        ch = retValue.substring(0, 1);
    }
    ch = retValue.substring(retValue.length-1, retValue.length);
    while (ch == " ")
    { // Check for spaces at the end of the string
        retValue = retValue.substring(0, retValue.length-1);
        ch = retValue.substring(retValue.length-1, retValue.length);
    }
    //while (retValue.indexOf(" ") != -1) { // Note that there are two 
 //spaces in the string - look for multiple spaces within the string
    //retValue = retVal
//}
return retValue;
}

var vld_Email =  
/^(([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,5}|[0-9]{1,3})(\]?))?$/;
 
function temp()
{
}
function isAlphaNumeric(val)
{
	var reg = new RegExp("^[a-zA-Z0-9]*$");
	return reg.test(val);
}

	function validate()
    {   
		var chk=true;		
		if(trim1(document.form1.title.value)=="")
        {
            alert("Please select title")
            document.form1.title.focus();
            return false;
        }
		else if(trim1(document.form1.firstName.value)=="")
        {
            alert("Please enter first name")
            document.form1.firstName.focus();
     		return false;
		}
  		else if(trim1(document.form1.lastName.value)=="")
        {
            alert("Please enter last name")
            document.form1.lastName.focus();
     		return false;
		}	
		else if(trim1(document.form1.profession.value)=="")
        {
            alert("Please select Profession")
            document.form1.profession.focus();
     		return false;
		}
		else if(trim1(document.form1.email.value)=="")
        {
            alert("Please enter email")
            document.form1.email.focus();
     		return false;
		}
		else if(eval(vld_Email).test(document.form1.email.value)==false)
	    {
              alert("Please enter a Valid Email Address");
		      document.form1.email.focus();
              return (false);
		}
		else if(trim1(document.form1.country.value)=="")
        {
            alert("Please enter country")
            document.form1.country.focus();
            return false;
        }
	/*	else if(trim1(document.form1.language.value)=="")
        {
            alert("Please select language")
            document.form1.language.focus();
            return false;
        }*/
		/*else
        {
			   document.form1.submit();
		}*/
    }