function GetBrowserSize(stringvalue, textboxvalue)
	{
	
		var NS4, NS6, IE4, IE5, IE6, ver4, IE4plus, textboxsize;
	
		NS4 = (document.layers) ? true : false;
		IE4 = ((document.all)&&(navigator.appVersion.indexOf('MSIE 4.')!=-1)) ? true : false;
		IE5 = ((document.all)&&(navigator.appVersion.indexOf('MSIE 5.')!=-1)) ? true : false;
		NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
		textboxsize = parseInt(textboxvalue);
		if (NS4 || NS6)
		{
			textboxsize = textboxsize * 1
		}
		document.write(stringvalue + ' size=' + textboxsize + '>');
	}
	
	function SubmitLoginForm()
	{
		document.all("tblError").style.visibility = "visible";
		// document.all("frmlogin").submit();
	}
	
	function ValidateEmailID()
	{
		var retValue;
		var EmailAddress = document.all("SubscriberEmail").value;
		retValue = Emailtest(EmailAddress);
		
		if(retValue == 1)
		{
			// Invalid emailid
			alert("Invalid Email Id");
			document.all("SubscriberEmail").focus;
		}
		else
		{
			// Submit form.
			document.frmSubscribe.action = "SendEmail.asp";
			document.frmSubscribe.submit();
		}
	}
	
		
function Emailtest(EmailAddress)
{		
	var winOpen = 0;
		
	//To use the methods of the string object, we first assign it to a string object
	Email = new String();
	Email = EmailAddress;
			
	//Check if the length of the email is greater than zero.
	IsLengthValid = IsLengthofEmailValid(Email);
					
	//Check for invalid characters in the email address field.
	IsValidChar = IsEmailCharValid(Email);
			
	//This function checks for the position of the "." character in the email address
	IsDotPosnValid = IsPosnOfCharacterValid(Email, ".");
					
	//This function checks the last position of the "." character in the email address
	IsDotLastPosnValid = IsLastPosnOfCharacterValid(Email, ".");
					
	//This function checks for the position of the "@" character in the email address
	IsAtPosnValid = IsPosnOfCharacterValid(Email, "@");
					
	//This function checks for the last position of the "@" character in the email address
	IsAtLastPosnValid = IsLastPosnOfCharacterValid(Email, "@");
			
	//Now check if there were errors with the Email address
	if ((IsLengthValid == 1) || (IsValidChar == 1) || (IsDotPosnValid == 1) || (IsDotLastPosnValid == 1) || (IsAtPosnValid == 1) || (IsAtLastPosnValid == 1))
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

//This function checks for the position of the "." and the "@" characters.
//These characters cannot be the first or the last in the email address
function IsPosnOfCharacterValid(Email, CheckChar)
{
	var ValidEmail = 0;
	
	//First find the position of the "." character in the email address
	var PosnofChar = Email.indexOf(CheckChar);
	var LenofEmail = Email.length;
			
	//The character being checked "." or "@" are both compulsory in an email address and hence cannot be absent. 
	//Secondly, it cannot be the first character or the last character.
	if ((PosnofChar == -1) || (PosnofChar <= 0) || (PosnofChar == (LenofEmail - 1)) || ((Email.indexOf(".")) - (Email.indexOf("@")) == 1) || ((Email.indexOf(".")) - (Email.indexOf("@")) == 1))
	{
		ValidEmail = 1;
	}
	else
	{
		ValidEmail = 0;
	}
	return ValidEmail;
}

//This function checks for the last occurence of the dot and @ characters.
function IsLastPosnOfCharacterValid(Email, CheckChar)
{
	var ValidEmail = 0;
		
	//First find the last position of the "." character in the email address
	var LastPosnofChar = Email.lastIndexOf(CheckChar);
	var LenofEmail = Email.length;
			
	//Now check the position of the last dot or the "@" character
	if (CheckChar == ".")
	{
		//There cannot be more than 4 characters after the last dot character in the email address field
		if ((((LenofEmail-1)- LastPosnofChar) < 2) || (((LenofEmail-1)- LastPosnofChar) > 3 ))
		{ 
			ValidEmail = 1; 
		}
		else
		{
			ValidEmail = 0;
		}
	}
	else
	{
		//There can not be two "@@" in an email address
		if (Email.search("@@") != -1)
		{ 
			ValidEmail = 1; 
		}
		else
		{
			ValidEmail = 0;
		}

		
	}
	return ValidEmail;
}

//This function checks if the email address has any invalid characters. If any invalid characters are found, an error is flagged.
function IsEmailCharValid(Email)
{
	var ValidEmail = 0;
	
	//listing all the characters that can be invalid in an email address
	var InValidEmailChars = ',+*)(!#$%^&[]{}|\/?><\' ';
	
	for (var i = 0 ; i < InValidEmailChars.length ; i++)
	{	
		InvalidChar=0;
		//If any of the invalid characters are found, update the appropriate flag
		if (Email.indexOf(InValidEmailChars.charAt(i)) >= 0 )
		{	
			InvalidChar = InvalidChar + 1;
			break;
		}
	}	
	if (InvalidChar >= 1)
	{ 
		   ValidEmail = 1; 
	}
	else
	{
		ValidEmail = 0;
	}
	
	return ValidEmail;
}

//This function checks for the length of the email address field, if it is zero, an error is flagged
function IsLengthofEmailValid(Email)
{

	var EmailLength = Email.length;
	if (EmailLength <= 0)
	{
		 ValidEmail = 1; 
	}
	else
	{
		ValidEmail = 0;
	}
	return ValidEmail;
}

