

  //	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //	@		Description			: This function validates the required fields.
  //  @   Pages Affected  : accregister
  //  @		Function Name		: validate(option)
  //	@		Input Parameters: option=1->NonSecurepath,2->Securepath
  //	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  function validate(option){
  var element;
  element = new Array('FIRSTNAME','LASTNAME','STREET','CITY','PHONE','EMAIL','FIRSTNAMES','LASTNAMES','STREETS','CITYS','PHONES','EMAILS','PASSWORD1','PASSWORD2');
    
  var index,retval;
  var regExpression;
  
  //### Storing the value of State Field
  if (document.frmNewuser.COUNTRY.options[document.frmNewuser.COUNTRY.selectedIndex].value == "UNITED STATES" )
  {
  document.frmNewuser.STATE.value = document.frmNewuser.STATE.options[document.frmNewuser.STATE.selectedIndex].value
  }

// ### Validating address type
	if (document.frmNewuser.RESI.options[document.frmNewuser.RESI.selectedIndex].value == 0)
	{
		alert(getMessage("iAddressType"));
		document.frmNewuser.RESI.focus();
		return false;
	}
  
  // ### Making sure Mandatory fields are not null.
  for(index=0;index <= element.length-1;index++)
		if(eval("document.frmNewuser." + element[index] + ".value") == "")
		{
			alert(getMessage("iMandatory"));
			eval("document.frmNewuser." + element[index] + ".focus();");
			eval("document.frmNewuser." + element[index] + ".select();");
			return;
		}
	
    
    	
	 	// ### Validating email.
	ret_val = IsEmail(document.frmNewuser.EMAIL.value);
	if (ret_val == 1){
		document.frmNewuser.EMAIL.focus();
		document.frmNewuser.EMAIL.select();
		return;
	}
	
	
	// ### Validating First name
	if(document.frmNewuser.FIRSTNAME.value.charAt(0)==" "){	
			alert(getMessage("iValidText"));
			document.frmNewuser.FIRSTNAME.focus();
			document.frmNewuser.FIRSTNAME.select();
			return;
	}
	

	// ### Validating Last name
	if(document.frmNewuser.LASTNAME.value.charAt(0)==" "){
			alert(getMessage("iValidText"));	
			document.frmNewuser.LASTNAME.focus();
			document.frmNewuser.LASTNAME.select();
			return;
	}
	
	

	// ### Validating City
	if(document.frmNewuser.CITY.value.charAt(0)==" "){	
			alert(getMessage("iValidText"));
			document.frmNewuser.CITY.focus();
			document.frmNewuser.CITY.select();
			return;
	}
	
	// ### Validating State/ Province
	if(document.frmNewuser.STATE.value != "" && document.frmNewuser.STATE.value.charAt(0)==" "){	
			alert(getMessage("iValidText"));
			document.frmNewuser.STATE.focus();
			document.frmNewuser.STATE.select();
			return;
	}	
	

	// ### Validating Phone
	retval=IsTelephone(document.frmNewuser.PHONE.value)
	if(retval == 1)
	{
		alert(getMessage("iValidPhoneNo"));
		document.frmNewuser.PHONE.focus();
		document.frmNewuser.PHONE.select();
		return false;
	}
	
	
	// ### Validating Fax
	if (document.frmNewuser.FAX.value != "")
	{
	ret_faxval=IsTelephone(document.frmNewuser.FAX.value)
	if(ret_faxval == 1)
	{
		alert(getMessage("iValidFaxNo"));
		document.frmNewuser.FAX.focus();
		document.frmNewuser.FAX.select();
		return false;
	}
	}
	
	
	
	// ### Validating Street address
	if(document.frmNewuser.STREET.value.length > 255){
		alert(getMessage("iStAddrGT255"));
		document.frmNewuser.STREET.focus();
		return false;
	}
	if(document.frmNewuser.STREET.value.charAt(0)==" "){
			alert(getMessage("iStAddrStartSpace"));
			document.frmNewuser.STREET.focus();
			return false;
		}			
		else
		{
			document.frmNewuser.STREET.value = StreetVal(document.frmNewuser.STREET.value);
	}
	
	    if (document.frmNewuser.COUNTRYS.options[document.frmNewuser.COUNTRYS.selectedIndex].value == "UNITED STATES" )
        {
            document.frmNewuser.STATES.value = document.frmNewuser.STATES.options[document.frmNewuser.STATES.selectedIndex].value
        }
	    // ### Validating email B
		ret_val = IsEmail(document.frmNewuser.EMAILS.value);
		if (ret_val == 1){
			document.frmNewuser.EMAILS.focus();
			document.frmNewuser.EMAILS.select();
			return;
	    }
	    // ### Validating First name B
		if(document.frmNewuser.FIRSTNAMES.value.charAt(0)==" "){	
				alert(getMessage("iValidText"));
				document.frmNewuser.FIRSTNAMES.focus();
				document.frmNewuser.FIRSTNAMES.select();
				return;
	    }
	    // ### Validating Last name B
		if(document.frmNewuser.LASTNAMES.value.charAt(0)==" "){
				alert(getMessage("iValidText"));	
				document.frmNewuser.LASTNAMES.focus();
				document.frmNewuser.LASTNAMES.select();
				return;
	    }
	    // ### Validating CityB
		if(document.frmNewuser.CITYS.value.charAt(0)==" "){	
				alert(getMessage("iValidText"));
				document.frmNewuser.CITYS.focus();
				document.frmNewuser.CITYS.select();
				return;
	    }
	    // ### Validating StateB/ Province
		if(document.frmNewuser.STATES.value != "" && document.frmNewuser.STATES.value.charAt(0)==" "){	
				alert(getMessage("iValidText"));
				document.frmNewuser.STATES.focus();
				document.frmNewuser.STATES.select();
				return;
	    }
	    // ### Validating Phone B
		retval=IsTelephone(document.frmNewuser.PHONES.value)
		if(retval == 1)
		{
			alert(getMessage("iValidPhoneNo"));
			document.frmNewuser.PHONES.focus();
			document.frmNewuser.PHONES.select();
			return false;
	    }
	    // ### Validating Fax B
		if (document.frmNewuser.FAXS.value != "")
		{
		    ret_faxval=IsTelephone(document.frmNewuser.FAXS.value)
		    if(ret_faxval == 1)
		    {
			    alert(getMessage("iValidFaxNo"));
			    document.frmNewuser.FAXS.focus();
			    document.frmNewuser.FAXS.select();
			    return false;
		    }
	    }
	    
	    // ### Validating address type B
		if (document.frmNewuser.RESIS.options[document.frmNewuser.RESIS.selectedIndex].value == 0)
		{
			alert(getMessage("iAddressType"));
			document.frmNewuser.RESIS.focus();
			return false;
	    }
	    
	    // ### Validating Street address B
		if(document.frmNewuser.STREETS.value.length > 255){
			alert(getMessage("iStAddrGT255"));
			document.frmNewuser.STREETS.focus();
			return false;
	    }
	    if(document.frmNewuser.STREETS.value.charAt(0)==" "){
		    alert(getMessage("iStAddrStartSpace"));
		    document.frmNewuser.STREETS.focus();
		    return false;
	    }			
	    else
	    {
		    document.frmNewuser.STREETS.value = StreetVal(document.frmNewuser.STREETS.value);
	    }	
	
	
	// ### Validating Zipcode
	if(zip_validate("frmNewuser") == false) return false
    
    // ### Validating login name
	if(document.frmNewuser.LOGINNAME.value != ""){
		if(document.frmNewuser.LOGINNAME.value.length < 4){
			alert(getMessage("iLogin4Char"));
			document.frmNewuser.LOGINNAME.focus();
			document.frmNewuser.LOGINNAME.select();
			return;
		}
		if(document.frmNewuser.LOGINNAME.value.indexOf(" ") > -1){
			alert(getMessage("iLoginNoSpace"));
			document.frmNewuser.LOGINNAME.focus();
			document.frmNewuser.LOGINNAME.select();
			return;
		}
		if(document.frmNewuser.LOGINNAME.value.toLowerCase() == "guest"){
			alert(getMessage("iLoginName") + " " + document.frmNewuser.LOGINNAME.value + ".");
			document.frmNewuser.LOGINNAME.focus();
			document.frmNewuser.LOGINNAME.select();
			return;
		}
		regExpression = /^[0-9A-Za-z#:;,\/_><-]*$/ ;
		if(!regExpression.test(document.frmNewuser.LOGINNAME.value)){
			alert(getMessage("iInvalidLoginId"));
			document.frmNewuser.LOGINNAME.focus();
			document.frmNewuser.LOGINNAME.select();
			return false;
		}
	}
	
	if(document.frmNewuser.PASSWORD1.value.length < 4){
		alert(getMessage("iPass4Char"));
		document.frmNewuser.PASSWORD1.focus();
		document.frmNewuser.PASSWORD1.select();
		return;
	}
	if(document.frmNewuser.PASSWORD1.value != document.frmNewuser.PASSWORD2.value){
		alert(getMessage("iPassCPassSame"));
		document.frmNewuser.PASSWORD2.focus();
		document.frmNewuser.PASSWORD2.select();
		return;
	}
	if(document.frmNewuser.PASSWORD1.value.indexOf(" ") > -1){
		alert(getMessage("iPassNoSpace"));
		document.frmNewuser.PASSWORD1.focus();
		document.frmNewuser.PASSWORD1.select();
		return;
	}
	
// Validating custom tracking fields
	if((document.frmHiddenvalues.allcheckbox.value != "") || (document.frmHiddenvalues.allselbox.value != ""))
	{
		if(validate_mandatory()==0)
			return;
	}
	if(option==2)
	{
		
		document.frmNewuser.action = sSecurePath + "accregister.asp?msg="+sMessage;
	}
	else
	{
		
		document.frmNewuser.action = sNonSecurePath + "accregister.asp?msg="+sMessage;
	}

	document.frmNewuser.submit();
}

// End of the function validate(option)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description		  	: Validation for Telephone fields  
//  @                       ( Allowed values are +,-,(,),# and from 0 to 9 )
//  @		Function Name		  : IsTelephone(value)								
//	@		Input Parameters	: Value to be tested							
//	@		Return Value		  : 0 - Success											
//	@											  1 - Failure											
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function IsTelephone(value)
{
var sPhone = /^(((\d*)[\s#+\-\(\)]*(\d+))+)$/
   
  if (!(sPhone.test(value)))
		return 1;
  else
		return 0;	
}
//End of the function IsTelephone(Value)



//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Validation for EMail				@
//  	@		Function Name		: IsEmail()						@
//	@		Input Parameters	: Value to be tested					@
//	@		Return Value		: 0 - Success						@
//	@							  1 - Failure				@
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function IsEmail(strEmail)
{
var intReturn =1;
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]'"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=strEmail.match(emailPat)
	if (matchArray==null) {
		alert(getMessage("iValidEmail"));
		return intReturn;
	}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    alert(getMessage("iValidEmail"));
    return intReturn;
}
	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(getMessage("iValidEmail"));
			return intReturn;
			}
		}
		intReturn=0;
		return intReturn;
	}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert(getMessage("iValidEmail"));
    return intReturn;
}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>4) {
	alert(getMessage("iValidEmail"));
	return intReturn;
	}
var len=domArr.length	
if (len<2) {
   var errStr = getMessage("iValidEmail");
   alert(errStr)
   return intReturn;
}
intReturn=0;
return intReturn;
}
//	End of the function IsEmail(strEmail)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is to validate the mandatory fields. For all the
//	@		                  custom tracking fields, name has been given as cust1, cust2 and so on...
//	@		                  And the mandatory fields number (only 1 ,2 like that) stored in a 
//  @                     hidden field(mandatoryfields)Get that number and concatenate it 
//	@		                  with string "cust", validating mandatory fields will be easy.
//  @   Pages Affected  : accregister
//  @		Function Name		: validate_mandatory()									
//	@		Input Parameters: null
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function validate_mandatory()
{
	var t_Count, t_Store,t_Val;
	var chk_arr = new Array(), sel_arr = new Array();

	t_Store = 1;
	chk_arr = document.frmHiddenvalues.allcheckbox.value.split(",");
	sel_arr = document.frmHiddenvalues.allselbox.value.split(",");
	// ### Checking, is there any mandatory select box..
	if(sel_arr[0] !="")	{
		for(t_Count=0;t_Count<sel_arr.length;t_Count++)	{
			if(eval("document.frmNewuser.custsel" + sel_arr[t_Count] + ".options[document.frmNewuser.custsel" + sel_arr[t_Count] + ".selectedIndex].value") == "novalue"){
					eval("document.frmNewuser.custsel" + sel_arr[t_Count] + ".focus()");
					t_Store = 0;
					break;
			}
		}
	}
	if(t_Store == 0){
		alert(getMessage("iEnterCustSurvDet"));
		return(t_Store);
	}

	// ### Checking, is there any mandatory check box..
	if(chk_arr[0] !="")	{
		for(t_Count=0;t_Count<chk_arr.length;t_Count++)	{
			t_Store = 0;
			var checkBox = eval("document.frmNewuser.custcheck" + chk_arr[t_Count]);
			if(eval("checkBox.length"))		{
				for(t_Val=0;t_Val<eval("checkBox.length");t_Val++)	{
					if(eval("checkBox[" + t_Val + "]"  +".checked"))
						t_Store = 1;
				}
				if(t_Store==0)	{
					eval("checkBox[0].focus()");
					break;
				}
			}
			else	{
				if(eval("checkBox.checked"))
					t_Store = 1;
				if(t_Store==0)	{
					eval("checkBox.focus()");
					break;					
				}
			}
		}
	}
	if(t_Store == 0)
		alert(getMessage("iEnterCustSurvDet"));
	return(t_Store);
}

// End of the function validate_mandatory()

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function is to validate the zip code. 
//  @   Pages Affected  : accregister									
//  @		Function Name		: zip_validate(form)									
//	@		Input Parameters: formname = name of the form
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function zip_validate(formname){
	
	sForm = eval("document." + formname);
	// ### Validating Zipcode	
		if(sForm.COUNTRY.options[sForm.COUNTRYS.selectedIndex].value == "null"){
			alert(getMessage("iSelectCountry"));
			sForm.COUNTRY.focus();
			return false;
		}
		if((sForm.COUNTRY.options[sForm.COUNTRY.selectedIndex].value == "USA")||(sForm.COUNTRY.options[sForm.COUNTRY.selectedIndex].value.toLowerCase() == "united states")){
			retval=IsNumeric(sForm.ZIPCODE.value)
			if((retval == 1)||(sForm.ZIPCODE.value.length > 5)){
				alert(getMessage("iValidZipCode"));
				sForm.ZIPCODE.focus();
				sForm.ZIPCODE.select();
				return false;
			}
			if((sForm.STATE.value.length > 2) || (sForm.STATE.value == "") || (sForm.STATE.value.indexOf(" ")>-1)){
				alert(getMessage("iValidStateCode"));
				sForm.STATE.focus();
				//sForm.STATE.select();
				return false;
			}
		}
		
		
		// ### Validating Zipcode B	
				if(sForm.COUNTRYS.options[sForm.COUNTRYS.selectedIndex].value == "null"){
					alert(getMessage("iSelectCountry"));
					sForm.COUNTRYS.focus();
					return false;
				}
				if((sForm.COUNTRYS.options[sForm.COUNTRYS.selectedIndex].value == "USA")||(sForm.COUNTRYS.options[sForm.COUNTRYS.selectedIndex].value.toLowerCase() == "united states")){
					retval=IsNumeric(sForm.ZIPCODES.value)
					if((retval == 1)||(sForm.ZIPCODES.value.length > 5)){
						alert(getMessage("iValidZipCode"));
						sForm.ZIPCODES.focus();
						sForm.ZIPCODES.select();
						return false;
					}
					if((sForm.STATES.value.length > 2) || (sForm.STATES.value == "") || (sForm.STATES.value.indexOf(" ")>-1)){
						alert(getMessage("iValidStateCode"));
						sForm.STATES.focus();
						//sForm.STATES.select();
						return false;
					}
		        }
		      	
	return true;
}
// End of the function zip_validate(formname)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function IsNumeric checks whether the entered value is a 
//	@											numeric and greater than Zero
//  @		Function Name		: IsNumeric(value)									
//	@		Input Parameters: value to be tested
//	@		Return Value		: 0 - Success	  1 - Failure			
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function IsNumeric(value)
{
	var validate=/(^\d+$)/
	if ((validate.test(value)) && (value > 0))
		return 0; 
	else
		return 1; 
}
// End of the function IsNumeric(value)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function is to validate the alphanumeric characters and  string.  
//  	@   		Pages Affected  			: accregister, contactaddress,manageaddress							
//  	@		Function Name			: isAlphanumeric(str,cSpace)
//	@		Input Parameters			: formname = name of the form
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function isAlphanumeric(str,cSpace){
     var sSpacepat = /^(((\w+)[\s,\-*\.]*)+)$/
     var sPat = /^(((\w+)[*,\-\.]*)+)$/
     if (cSpace=="1"){
		if(!(sSpacepat.test(str)))
		   {
			 alert(getMessage("iValidText"));
			 return false;
	       }	
		}
	 else
	 {
		if(!(sPat.test(str)))  
			{
				alert(getMessage("iValidText"));
				return false;
	        }
	 }
     return true;
}
// End of the function isAlphanumeric(str,cSpace)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function is to validate the street address if tags are entered 
//  @   Pages Affected  : accregister							
//  @		Function Name		: StreetVal(strval)
//	@		Input Parameters: strval = street field
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//Function for street address field which should accept tags like<xml> as normal text

function StreetVal(strval)
{
var cLt = /</g;
var cGt = />/g;

strval = strval.replace(cLt,"&lt;");
sAdd = strval.replace(cGt,"&gt;");

return sAdd
}
// End of the function StreetVal(strval)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function is to list the cities for the entered zipcode.
//  @   Pages Affected  : accregister							
//  @		Function Name		: ListCity(strval)
//	@		Input Parameters: City = city field
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function ListCity(sStateVal)
{
if (document.frmNewuser.selCity.options[document.frmNewuser.selCity.selectedIndex].value == 0)
	{
	//If the user selects no city ,it alerts to select the  city
	alert(getMessage("iSelectCity"));
	return false;
	}
else
	{
	//City selected will be populated in the text field
	document.frmNewuser.CITY.value = document.frmNewuser.selCity.options[document.frmNewuser.selCity.selectedIndex].value
	document.frmNewuser.STATE.value=sStateVal;
	}
}

function ListCityS(sStateVal)
{
if (document.frmNewuser.selCityS.options[document.frmNewuser.selCityS.selectedIndex].value == 0)
	{
	//If the user selects no city ,it alerts to select the  city
	alert(getMessage("iSelectCity"));
	return false;
	}
else
	{
	//City selected will be populated in the text field
	document.frmNewuser.CITYS.value = document.frmNewuser.selCityS.options[document.frmNewuser.selCityS.selectedIndex].value
	document.frmNewuser.STATES.value=sStateVal;
	}
}
// End of the function ListCity()

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called to reload the states based on the Country Selection
//  @       Pages Affected      : accRegister.asp
//  @		Function Name		: ReloadStates()									
//	@		Input Parameters    : Selected country							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function ReloadStates()
{
  if (document.frmNewuser.elements["COUNTRYS"].options != null)
  {
    var browserType;
	var sdc, sd, sdc2, sd2;
	
    if (document.layers) {browserType = "nn4";}
    if (document.all) {browserType = "ie";}
    if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko";}

    if (browserType == "gecko" ){
       sdc  = eval('document.getElementById(\'statedivcaption\')');
       sd   = eval('document.getElementById(\'statediv\')');
       sdc2 = eval('document.getElementById(\'statedivcaption2\')');
       sd2  = eval('document.getElementById(\'statediv2\')');}
    else if (browserType == "ie"){
       sdc  = eval('document.all[\'statedivcaption\']');
       sd   = eval('document.all[\'statediv\']');
       sdc2 = eval('document.all[\'statedivcaption2\']');
       sd2  = eval('document.all[\'statediv2\']');}
    else{
	   sdc  = eval('document.layers[\'`statediv\']');
       sd   = eval('document.layers[\'`statedivcaption\']');
       sdc2 = eval('document.layers[\'`statedivcaption2\']');
       sd2  = eval('document.layers[\'`statediv2\']');}

    if(document.frmNewuser.COUNTRYS.options[document.frmNewuser.COUNTRYS.selectedIndex].value == "UNITED STATES" )
    {
	  sdc.style.visibility = "visible";
      sd.style.visibility = "visible";
      sdc2.style.visibility = "hidden";
      sd2.style.visibility = "hidden";
    }
    else
    {
	  sdc.style.visibility = "hidden";
      sd.style.visibility = "hidden";
      sdc2.style.visibility = "visible";
      sd2.style.visibility = "visible";
    }
  }
}
// End of the function ReloadStates()

function ReloadStatesB()
{
  if (document.frmNewuser.elements["COUNTRYB"].options != null)
  {
    var browserType;
	var sdc, sd, sdc2, sd2;
	
    if (document.layers) {browserType = "nn4";}
    if (document.all) {browserType = "ie";}
    if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko";}

    if (browserType == "gecko" ){
       sdc  = eval('document.getElementById(\'statebdivcaption\')');
       sd   = eval('document.getElementById(\'statebdiv\')');
       sdc2 = eval('document.getElementById(\'statebdivcaption2\')');
       sd2  = eval('document.getElementById(\'statebdiv2\')');}
    else if (browserType == "ie"){
       sdc  = eval('document.all[\'statebdivcaption\']');
       sd   = eval('document.all[\'statebdiv\']');
       sdc2 = eval('document.all[\'statebdivcaption2\']');
       sd2  = eval('document.all[\'statebdiv2\']');}
    else{
	   sdc  = eval('document.layers[\'`statebdiv\']');
       sd   = eval('document.layers[\'`statebdivcaption\']');
       sdc2 = eval('document.layers[\'`statebdivcaption2\']');
       sd2  = eval('document.layers[\'`statebdiv2\']');}

    if(document.frmNewuser.COUNTRYB.options[document.frmNewuser.COUNTRYB.selectedIndex].value == "UNITED STATES" )
    {
	  sdc.style.visibility = "visible";
      sd.style.visibility = "visible";
      sdc2.style.visibility = "hidden";
      sd2.style.visibility = "hidden";
    }
    else
    {
	  sdc.style.visibility = "hidden";
      sd.style.visibility = "hidden";
      sdc2.style.visibility = "visible";
      sd2.style.visibility = "visible";
    }
  }
}
// End of the function ReloadStatesB()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function calls the ReloadStates() after the form has been reset
//  @       Pages Affected      : ManageAddress.asp
//  @		Function Name		: ResetFormAndState()									
//	@		Input Parameters    : None						
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function ResetFormAndState()
{
   document.frmNewuser.reset()
   ReloadStates()
   ReloadStatesB()
}


