	var invalidaddress=new Array()
	invalidaddress[0]="hotmail"
	invalidaddress[1]="rocketmail"
	invalidaddress[2]="yahoo"
	invalidaddress[3]="zdnetmail"
	invalidaddress[4]="rediffmail"
	invalidaddress[5]="indiatimes"
	invalidaddress[6]="gmail"
	invalidaddress[7]="lycos"
	//extend or shorten this list if neccessary

	var testresults
		function checkemail(){
			var invalidcheck=0;
			var str=document.frmdownload.txtEmail.value
			var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(str)){
			var tempstring=str.split("@")
			tempstring=tempstring[1].split(".")
			for (i=0;i<invalidaddress.length;i++){
			if (tempstring[0]==invalidaddress[i])
			invalidcheck=1
		}
		if (invalidcheck!=1)
			testresults=true
		else{
			alert("Please input a more official email address!")
			testresults=false
		}
		}
		else{
			alert("Please input a valid email address!")
			testresults=false
		}
	return (testresults)
	}
	
	function isnull(str)	
	{
		str = rtrim(ltrim(str))
		if ( (str.length = 0) || ( str == ""))
			return true;
		else			
			return false;
	}

	function ltrim(field_name)
	{
		pos = field_name.indexOf(" ")
		while (pos == 0) 
		{ 
			field_name = field_name.substring(1)
			pos = field_name.indexOf(" ")
		}
		return field_name
	}

	function  rtrim(field_name)
	{
	    len = field_name.length
	    blank = field_name.charAt(len-1)
	    while (blank == " " )
	    {
	      field_name = field_name.substring(0,len-1)
	      len=field_name.length
	      blank = field_name.charAt(len-1)
	    }
	    return field_name    
	}

	function IsValidEmailSyntax ( sEmail )
	{	 
		return ( sEmail.search( /\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,5}/ ) != -1); 
	}
	function validation(theForm)
	{	
	
		if ( isnull(theForm.txtUserName.value))	
		{
			alert ('Enter a User name');
			theForm.txtUserName.focus();
			return false;
		}


		if ( isnull(theForm.txtPassword.value))	
		{
			alert ('Enter a Password');
			theForm.txtPassword.focus();
			return false;
		}
		
		if ( isnull(theForm.txtRePassword.value))	
		{
			alert ('Enter a Confirm password');
			theForm.txtRePassword.focus();
			return false;
		}
		
		
		if (theForm.txtRePassword.value != theForm.txtPassword.value)
		{
			alert ('Password and Confirm password should be same');
			theForm.txtRePassword.focus();
			return false;
		}
		

		if ( isnull(theForm.txtFirstName.value))	
		{
			alert ('Enter a First name');
			theForm.txtFirstName.focus();
			return false;
		}
		if ( isnull(theForm.txtLastName.value))	
		{
			alert ('Enter a Last name');
			theForm.txtLastName.focus();
			return false;
		}
		
		if ( isnull(theForm.txtTitle.value))	
		{
			alert ('Enter Job title');
			theForm.txtTitle.focus();
			return false;
		}
		
		if ( isnull(theForm.txtCompanyName.value))	
		{
			alert ('Enter a Company name');
			theForm.txtCompanyName.focus();
			return false;
		}
		if ( isnull(theForm.txtAddress1.value))	
		{
			alert ('Enter a Company address');
			theForm.txtAddress1.focus();
			return false;
		}
		if ( isnull(theForm.txtCity.value))	
		{
			alert ('Enter a City');
			theForm.txtCity.focus();
			return false;
		}
		
		if ( isnull(theForm.txtState.value))	
		{
			alert ('Enter a State');
			theForm.txtState.focus();
			return false;
		}
		if ( isnull(theForm.txtZipCode.value))	
		{
			alert ('Enter a Zip code');
			theForm.txtZipCode.focus();
			return false;
		}
		if ( isnull(theForm.SelCountry.value))	
		{
			alert ('Select a Country');
			theForm.SelCountry.focus();
			return false;
		}
		
		if ( isnull(theForm.txtPhone.value))	
		{
			alert ('Enter a Phone #');
			theForm.txtPhone.focus();
			return false;
		}
		if ( isnull(theForm.txtEmail.value))	
		{
			alert ('Enter a vaild E-mail address');
			theForm.txtEmail.focus();
			return false;
		}
		if (IsValidEmailSyntax(theForm.txtEmail.value)== false)
		{
			alert ('Enter a vaild E-mail address');
			theForm.txtEmail.focus();
			return false;
		}		
	
		if (document.layers||document.getElementById||document.all)
			return checkemail()
		else
		return true;
	}


	function validationLogin()
	{			



		if ( isnull(frmLogin.txtLUserName.value))	
		{
			alert ('Enter a User name');
			frmLogin.txtLUserName.focus();
			return false;
		}


		if ( isnull(frmLogin.txtLPassword.value))	
		{
			alert ('Enter a Password');
			frmLogin.txtLPassword.focus();
			return false;
		}

		frmLogin.submit();
	}