function validateemailtrial()
{
	var strEmail= document.forms[0].email.value;

	if (strEmail=="") {
		alert("Please Enter Your E-Mail Address ");
		document.forms[0].email.focus(); 
		return false; 
	} else {
		if (EmailCheck(strEmail)==false) {
			document.forms[0].email.focus();
			return false;
		} else {
			document.forms[0].submit();
			return true;
		}
 	}
}

function validatetzlookup()
{
	var strEmail= document.forms[0].tzluserid.value;

	if (strEmail=="") {
		alert("Please Enter Your E-Mail Address ");
		document.forms[0].tzluserid.focus(); 
		return false; 
	} else {
		if (EmailCheck(strEmail)==false) {
			document.forms[0].tzluserid.focus();
			return false;
		} else {
			document.forms[0].submit();
			return true;
		}
 	}
}

function activatetzllookup()
{
	var strEmail= document.forms[0].email.value;
	var code= document.forms[0].activationcode.value;

	if (strEmail=="") {
		alert("Please enter your email address ");
		document.forms[0].email.focus(); 
		return false; 
	} else if (EmailCheck(strEmail)==false) {
		document.forms[0].email.focus();
		return false;
	} else if (code=="") {
		alert("Please enter the activation code ");
		document.forms[0].activationcode.focus(); 
		return false; 
	} else {
		document.forms[0].submit();
		return true;
 	}
}


//email validation
function EmailCheck(str) 
{
	 var at="@"
	 var dot="."
	 var lat=str.indexOf(at)
	 var lstr=str.length
	 var ldot=str.indexOf(dot)

	 if (str.indexOf(at)==-1){
		 alert("Email without '@' not a valid E-mail ID");
		 return false
	 }

	 if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		 alert("Invalid E-mail ID, Email cannot start with '@'")
		 return false
	 }
	 if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		 alert("Email without 'dot' or starting with 'dot' is not a valid E-mail ID");
		 return false
	 }

	 if (str.indexOf(at,(lat+1))!=-1){
		 alert("Invalid E-mail ID")
		 return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		 alert("Invalid E-mail ID")
		 return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		 alert("Invalid E-mail ID")
		 return false
	 }

	 if (str.indexOf(" ")!=-1){
		 alert("Invalid E-mail ID")
		 return false
	 }

	 if ((lstr-ldot)==1){
		 alert("Email ending with 'dot' is not a valid E-mail ID");
		 return false
	 }
	 return true
}