//**********************email address validation***********

			function emailCheck (emailStr) {
			/* The following pattern is used to check if the entered e-mail address
			   fits the user@domain format.  It also is used to separate the username
			   from the domain. */
			var emailPat=/^(.+)@(.+)$/
			/* The following string represents the pattern for matching all special
			   characters.  We don't want to allow special characters in the address. 
			   These characters include ( ) < > @ , ; : \ " . [ ]    */
			var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
			/* The following string represents the range of characters allowed in a 
			   username or domainname.  It really states which chars aren't allowed. */
			var validChars="\[^\\s" + specialChars + "\]"
			/* The following pattern represents the range of characters allowed as
			   the first character in a valid username or domain.  I just made it
			   the same as above, but if you want to add a different constraint,
			   you would change it here. */
			var firstChars=validChars
			/* The following pattern applies if the "user" is a quoted string (in
			   which case, there are no rules about which characters are allowed
			   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
			   is a legal e-mail address. */
			var quotedUser="(\"[^\"]*\")"
			/* The following pattern applies for domains that are IP addresses,
			   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
			   e-mail address. NOTE: The square brackets are required. */
			var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
			/* The following string represents at atom (basically a series of
			   non-special characters.) */
			var atom="(" + firstChars + validChars + "*" + ")"
			/* The following string represents one word in the typical username.
			   For example, in john.doe@somewhere.com, john and doe are words.
			   Basically, a word is either an atom or quoted string. */
			var word="(" + atom + "|" + quotedUser + ")"
			// The following pattern describes the structure of the user
			var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
			/* The following pattern describes the structure of a normal symbolic
			   domain, as opposed to ipDomainPat, shown above. */
			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


			/* Finally, let's start trying to figure out if the supplied address is
			   valid. */

			/* Begin with the course pattern to simply break up user@domain into
			   different pieces that are easy to analyze. */
			var matchArray=emailStr.match(emailPat)
			if (matchArray==null) {
			  /* Too many/few @'s or something; basically, this address doesn't
				 even fit the general mould of a valid e-mail address. */
				//alert("Email address seems incorrect (check @ and .'s)")
				return false
			}
			var user=matchArray[1]
			var domain=matchArray[2]

			// See if "user" is valid 
			if (user.match(userPat)==null) {
				// user is not valid
				//alert("The username doesn't seem to be valid.")
				return false
			}
			/* if the e-mail address is at an IP address (as opposed to a symbolic
			   host name) make sure the IP address is valid. */
			var IPArray=domain.match(ipDomainPat)
			if (IPArray!=null) {
				// this is an IP address
				  for (var i=1;i<=4;i++) {
					if (IPArray[i]>255) {
						//alert("Destination IP address is invalid!")
					return false
					}
				}
				return true
			}

			// Domain is symbolic name
			var domainArray=domain.match(domainPat)
			if (domainArray==null) {
				//alert("The domain name doesn't seem to be valid.")
				return false
			}
			/* domain name seems valid, but now make sure that it ends in a
			   three-letter word (like com, edu, gov) or a two-letter word,
			   representing country (uk, nl).
			   If there's a country code at the end of the address, the full domain
			   must include a hostname and category (e.g. host.co.uk or host.pub.nl).
			   If it ends in a .com or something, make sure there's a hostname.*/

			/* Now we need to break up the domain to get a count of how many atoms
			   it consists of. */
			var atomPat=new RegExp(atom,"g")
			var domArr=domain.match(atomPat)
			var len=domArr.length
			if (domArr[domArr.length-1].length<2 || 
				domArr[domArr.length-1].length>3) {
			   // the address must end in a two letter or three letter word.
			   //alert("The address must end in a three-letter domain, or two letter country.")
			   return false
			}

			/* If it ends in a country code, we want to make sure there are at
			   least 2 atoms preceding it (representing host and category (i.e.
			   com, gov, etc.)) */
			if (domArr[domArr.length-1].length==2 && len<2) {
			   var errStr="This address ends in two characters, which is a country"
			   errStr+=" code.  Country codes must be preceded by "
			   errStr+="a hostname and category (like com, co, pub, pu, etc.)"
			   //alert(errStr)
			   return false
			}

			/* If it just ends in .com, .gov, etc., make sure there's a host name.
			   This case can never actually happen because earlier checks take
			   care of this implicitly, but we'll do it anyway. */
			if (domArr[domArr.length-1].length==3 && len<2) {
			   var errStr="This address is missing a hostname!"
			   //alert(errStr)
			   return false
			}
			// If we've gotten this far, everything's valid!
			return true;
			}



//********************************* end of email validation
// ------------------------Function for email a page----------------------------
function goSubmit(pFlag)
{
		var toEmailId = document.frmEmailFriend.toEmail.value;
		if(toEmailId==""  || toEmailId==" ")
		{
			alert("Enter an Email address");
			document.frmEmailFriend.toEmail.focus();
		}
		else
		{
			if(emailCheck(toEmailId)==false)
			{
				alert("Enter a valid Email address");
				document.frmEmailFriend.toEmail.value = "" ;
				document.frmEmailFriend.toEmail.focus();
			}
			else
			{
				var formedURL = "/GBPServiceMgr2.dyn?CntryCd=ZA&LangCd=en&WebSiteID=GBPZA&ReqsType=Pull&ServiceName=EntryForm&regInput="+pFlag+"^"+document.frmEmailFriend.toEmail.value;
				document.frmEmailFriend.toEmail.value = "" ;
				location.href = formedURL ;
			}
		}
}
function displayMsg()
{
	var queryString = location.href;
	var querySplit = queryString.split("?");
	var queryTest = "";
	if(querySplit.length>1)
	{
		var qSplitX = querySplit[1].split("&");
		if (querySplit[1].indexOf('keyId=sent')>=0)
		{
			var qSplitY = "display";
		}
		else
		{
			var qSplitY = "";
		}
		if(qSplitY.length>1)
		{
			if(qSplitY=='display')
			{
				document.getElementById("sentText").style.display = "block";
			}
			else
			{
				document.getElementById("sentText").style.display = "none";
			}
		}
		else
		{
			document.getElementById("sentText").style.display = "none";
		}
		if(qSplitX.length>1)
		{
		var qSplit = qSplitX[1].split("opt")
		if(qSplit.length>1)
		{
			if(qSplit[1]=="=2B_C")
			{
				document.frmEmailFriend.pdf[0].checked = true;
			}
			else if(qSplit[1]=="=2B_S")
			{
				document.frmEmailFriend.pdf[1].checked = true;
			}
			else if(qSplit[1]=="=2B_G")
			{
				document.frmEmailFriend.pdf[2].checked = true;
			}
			else if(qSplit[1]=="=2B_All")
			{
				document.frmEmailFriend.pdf[3].checked = true;
			}
			else if(qSplit[1]=="=2C_C")
			{
				document.frmEmailFriend.pdf[0].checked = true;
			}
			else if(qSplit[1]=="=2C_E")
			{
				document.frmEmailFriend.pdf[1].checked = true;
			}
			else if(qSplit[1]=="=2C_All")
			{
				document.frmEmailFriend.pdf[2].checked = true;
			}
			else if(qSplit[1]=="=8_C")
			{
				document.frmEmailFriend.pdf[0].checked = true;
				document.frmEmailFriend.downloadOptions[0].selected = true;
			}
			else if(qSplit[1]=="=8_V")
			{
				document.frmEmailFriend.pdf[1].checked = true;
				document.frmEmailFriend.downloadOptions[1].selected = true;
			}
			else if(qSplit[1]=="=8_M")
			{
				document.frmEmailFriend.pdf[2].checked = true;
				document.frmEmailFriend.downloadOptions[2].selected = true;
			}
			else if(qSplit[1]=="=4_PE")
			{
				document.frmEmailFriend.pdf[0].checked = true;
			}
			else if(qSplit[1]=="=4_DI")
			{
				document.frmEmailFriend.pdf[1].checked = true;
			}
			else if(qSplit[1]=="=2D_B")
			{
				document.frmEmailFriend.pdf[0].checked = true;
				document.frmEmailFriend.downloadOptions[0].selected = true;
			}
			else if(qSplit[1]=="=2D_C")
			{
				document.frmEmailFriend.pdf[1].checked = true;
				document.frmEmailFriend.downloadOptions[1].selected = true;
			}
			else if(qSplit[1]=="=2D_S")
			{
				document.frmEmailFriend.pdf[2].checked = true;
				document.frmEmailFriend.downloadOptions[2].selected = true;
			}
			else if(qSplit[1]=="=2D_All")
			{
				document.frmEmailFriend.pdf[3].checked = true;
			}
			else if(qSplit[1]=="=N_All")
			{
				document.frmEmailFriend.emailSeries[0].checked = true;
			}
			else if(qSplit[1]=="=F_All")
			{
				document.frmEmailFriend.emailSeries[1].checked = true;
			}
			else if(qSplit[1]=="=C_250_TF")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[0].checked = true;
				displayModels("ALL")
				document.frmEmailFriend.nSeriesEmail.selectedIndex = 0;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[0].checked = true ;
				document.frmEmailFriend.nSeriesList.selectedIndex = 0 ;
			}
			else if(qSplit[1]=="=NPR_300_F")
			{

				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[0].checked = true;
				displayModels("ALL")
				document.frmEmailFriend.nSeriesEmail.selectedIndex = 1;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[0].checked = true ;
				document.frmEmailFriend.nSeriesList.selectedIndex = 1 ;

			}
		else if(qSplit[1]=="=NPR_400_SWB_F")
			{

				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[0].checked = true;
				displayModels("ALL")
				document.frmEmailFriend.nSeriesEmail.selectedIndex = 2;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[0].checked = true ;
				document.frmEmailFriend.nSeriesList.selectedIndex = 2 ;

			}
		else if(qSplit[1]=="=NPR_400_F")
			{

				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[0].checked = true;
				displayModels("ALL")
				document.frmEmailFriend.nSeriesEmail.selectedIndex = 3;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[0].checked = true ;
				document.frmEmailFriend.nSeriesList.selectedIndex = 3 ;

			}
		else if(qSplit[1]=="=NQR_500_TF")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[0].checked = true;
				displayModels("ALL")
				document.frmEmailFriend.nSeriesEmail.selectedIndex = 4;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[0].checked = true ;
				document.frmEmailFriend.nSeriesList.selectedIndex = 4 ;
			}
		else if(qSplit[1]=="=FRR_500_F")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 0;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 0 ;
			}
		else if(qSplit[1]=="=FSR_700_F")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 1;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 1 ;
			}
		else if(qSplit[1]=="=FTR_800_F")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 2;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 2 ;
			}
		else if(qSplit[1]=="=FTR_800_T")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 3;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 3 ;
			}
		else if(qSplit[1]=="=FTR_800_FT")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 4;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 4 ;
			}
		else if(qSplit[1]=="=FTM_1200_FT")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 5;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 5 ;
			}
		else if(qSplit[1]=="=FVR_900_FT")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 6;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 6 ;
			}
		else if(qSplit[1]=="=GVR_2300_TT")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 7;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 7 ;
			}
		else if(qSplit[1]=="=FVZ_1400_FT")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 8;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 8 ;
			}
		else if(qSplit[1]=="=FVZ_1600_C")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 9;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 9 ;
			}
		else if(qSplit[1]=="=FSS_550_F")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 10;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 10 ;
			}
		else if(qSplit[1]=="=FTS_750_F")
			{
				//email section pre selection
				document.frmEmailFriend.emailSeries[2].checked = true;
				document.frmEmailFriend.groupemail[1].checked = true;
				displayModels("ALL")
				displayEmail("F")
				displayList("F")
				document.frmEmailFriend.fSeriesEmail.selectedIndex = 11;

				// download section pre selection
				document.frmEmailFriend.seriesGroup[1].checked = true ;
				document.frmEmailFriend.fSeriesList.selectedIndex = 11 ;
			}



		//	document.getElementById("sentText").style.display = "block";

		}
		}
		
	}
	else
	{
		document.getElementById("sentText").style.display = "none";
	}


}
function removeMsg()
{
	document.getElementById("sentText").style.display = "none";
}



// ------------------------Function for email a page----------------------------


//----------------------------other key validations----------------------------

		//---------- function for validation (allows only alphabets)-------------
		function isAlpha(evtKey,obj){
			var keyCode = evtKey.keyCode; 
			if(obj.value.length==0 && keyCode==32)
				return false;
			if((keyCode>64 && keyCode<91)||(keyCode>96 && keyCode<123) || keyCode == 32)
				return true;
			else
				return false;
		}

		//---------- function for validation (Not allowing the space in the first)-------------
		function isSpace(evtKey,obj){
			var keyCode = evtKey.keyCode; 
			if(obj.value.length==0 && keyCode==32)
				return false;
			else
				return true;
		}

		//---------- function for validation (allows only Numbers)-------------
		function isNumber(evtKey,obj){
			var keyCode = evtKey.keyCode;
			if(obj.value.length==0 && keyCode==32)
				return false;
			if(keyCode>47 && keyCode<58)
				return true;
			else
				return false;
		}
//----------------------------other key validations----------------------------