	var noAccess = GetCookie("noAccess")
	if ((noAccess!=null) && (noAccess=='true')) 
	{
      document.location = "/kids/";
	}

	var loginSessionCookie=GetCookie("loginSession");

	
	var allParams;

	var userInfo;
    function doThisFirst()
	{
		
		
		if (allParams!=null)
		{
			fillParams(allParams);
	 	}
		
		if (userInfo!=null)
		{
			fillParams(userInfo);
			userInfo='';
		}		
	}
	
	
	
	function fillParams(zFillStr) 
	{
	  var param=zFillStr.split('!');
	  var a1;
	  var a0;
	  for (i=0; i<param.length; i++) 
	  {			
		var answer=param[i].split(':');
		
		var foundit=false;
		var index=0;
		
		answer[0]=answer[0].toLowerCase();
		a1=answer[0]+'|1';
		a0=answer[0]+'|0';
		
		for (j=0; j<document.userinfo.elements.length; j++) 
		{
			
			if (document.userinfo.elements[j].name.toLowerCase()==answer[0] ||
			document.userinfo.elements[j].name.toLowerCase()==a1 || document.userinfo.elements[j].name.toLowerCase()==a0
			)
			{
				foundit=true;
				index=j;
				j=document.userinfo.elements.length+1;
			}	
		}		

		

		if (foundit) 
		{		
			var thiselement = document.userinfo.elements[index];
			var inputType = thiselement.type;

			if (inputType=='text')
			{
				if (answer[1]=='null')
					thiselement.value = '';
				else
					thiselement.value = answer[1];
			}
			else if (inputType=='checkbox') 
			{
				if ((answer[1]=='true') || (answer[1]=='on')) 
				{ 
					thiselement.checked=true; 
				}
			} 
			else if (inputType=='select-one') 
			{

				//thiselement.value=answer[1];
				for (k=0; k<thiselement.length; k++)
				{
				  if (thiselement[k].value==answer[1]) 
				  { 
					thiselement[k].selected=true;
				  }
				}
				
			} 
			else if (inputType=='password') 
			{
				thiselement.value=answer[1];
			} 
			else if (inputType=='radio') 
			{
				if (thiselement.value==answer[1]) 
				{ 
					thiselement.checked=true; 
				}

				thiselement = document.userinfo.elements[index+1];
				if (thiselement.value==answer[1]) 
				{ 
					thiselement.checked=true; 
				}
				
			} 
			else if (thiselement.length>1) 
			{
				for (j=0; j<thiselement.length; j++) 
				{
					if (thiselement[j].value==answer[1]) 
					{ 
						thiselement[j].checked=true; 
					}
				}
			}
		}

		
	  }
    }


	function processForm() 
	{
	  if (loginSessionCookie==null) 
	  {
		if (isBlank(document.userinfo.rmlogin.value)) 
		{
			alert('User Name cannot be blank!');
			document.userinfo.rmlogin.focus();
			return false;
		}

		if (!isAscii(document.userinfo.rmlogin.value))
		{
			alert('User Name contains invalid character(s)!');
			document.userinfo.rmlogin.focus();
			return false;
		}		


		// added by Tak 5/2/02 check for single quote values.
		// rmlogin doesn't allow single quote values.
		var login = checkSingleQuote(document.userinfo.rmlogin.value);
		if (login != document.userinfo.rmlogin.value)
		{
			alert('User Name cannot contain single quote character(s)!');
			document.userinfo.rmlogin.focus();
			return false;		
		}
		
		
		if (isBlank(document.userinfo.rmpassword.value))
		{
			alert('Password cannot be blank!');
			document.userinfo.rmpassword.focus();
			return false;
		}

		if (document.userinfo.rmpassword.value!=document.userinfo.rmpasswordconfirm.value) 
		{
			alert('The passwords you entered do not match!');
			document.userinfo.rmpassword.focus();
			return false;
		}
	  }

	  	  
		if (isBlank(document.userinfo.rmfirstname.value)) 
		{
			alert('First Name cannot be blank!');
			document.userinfo.rmfirstname.focus();
			return false;
		}
		
		
		if (isBlank(document.userinfo.rmlastname.value)) 
		{
			alert('Last Name cannot be blank!');
			document.userinfo.rmlastname.focus();
			return false;
		}


		if (isBlank(document.userinfo.rmemail.value)) 
		{
			alert('E-mail Address cannot be blank!');
			document.userinfo.rmemail.focus();
			return false;
		}

		if (!isValidEmail(document.userinfo.rmemail.value)) 
		{
			alert('E-mail Address is not in a valid format!');
			document.userinfo.rmemail.focus();
			return false;
		}

		if (!isAscii(document.userinfo.rmemail.value))
		{
			alert('E-mail Address contains invalid character(s)!');
			document.userinfo.rmemail.focus();
			return false;
		}
		

//		var dob = document.userinfo.dobMonth.value + "/" + document.userinfo.dobDay.value + "/" + document.userinfo.dobYear.value;

		var mIndex = document.userinfo.dobMonth.selectedIndex;
		var dIndex = document.userinfo.dobDay.selectedIndex;
		var yIndex = document.userinfo.dobYear.selectedIndex;
		var dob = document.userinfo.dobMonth[mIndex].value + "/" 
				+ document.userinfo.dobDay[dIndex].value + "/" 
				+ document.userinfo.dobYear[yIndex].value;

		if (dateValid(dob)) 
		{
			document.userinfo.rmdob.value=dob;
		} 
		else 
		{
			alert('Date of Birth is not a valid date!');
			document.userinfo.dobMonth.focus();
			return false;
		}

		// if the user is under the age of 13, kick them out
		today = new Date();
		birth = new Date();
		birth.setMonth(document.userinfo.dobMonth[mIndex].value-1);
		birth.setDate(document.userinfo.dobDay[dIndex].value);
		birth.setYear(document.userinfo.dobYear[yIndex].value);			

		age = today.getFullYear() - birth.getFullYear();		

		testBirth = new Date();
		testBirth.setMonth(document.userinfo.dobMonth[mIndex].value-1);
		testBirth.setDate(document.userinfo.dobDay[dIndex].value);
		testDay = today.getTime() - testBirth.getTime();
		testDay = Math.floor(testDay / (1000*60*60*24));			

		if (testDay<0) { age = age - 1; }						

		if (age<13) {
			SetCookie("noAccess", "true", null, "/");
			document.location = "/kids/";
			return false;
		}

		if (isBlank(document.userinfo.rmaddress1.value)) 
		{
			alert('Address 1 cannot be blank!');
			document.userinfo.rmaddress1.focus();
			return false;
		}

		if (isBlank(document.userinfo.rmcity.value)) 
		{
			alert('City cannot be blank!');
			document.userinfo.rmcity.focus();
			return false;
		}


		var sIndex = document.userinfo.rmstate.selectedIndex;
		if (document.userinfo.rmstate[sIndex].value=="XX") 
		{
			alert('Select a State!');
			document.userinfo.rmstate.focus();
			return false;
		}

		
		if (isBlank(document.userinfo.rmzip.value)) 
		{
			alert('Zip/Postal code cannot be blank!');
			document.userinfo.rmcity.focus();
			return false;
		}


		var cIndex = document.userinfo.rmcountry.selectedIndex;
		if (document.userinfo.rmcountry[cIndex].value=="XX") 
		{
			alert('Select a Country!');
			document.userinfo.rmcountry.focus();
			return false;
		}

		
		for (j=0; j<document.userinfo.elements.length; j++) 
		{
			var thiselement = document.userinfo.elements[j];

			if (thiselement.type=='checkbox') 
			{
 				if(thiselement.name != 'rmcellemail')
				{
					if (!thiselement.checked) 
					{
						if (document.userinfo.uncheckedboxes.value=='') 
						{
							document.userinfo.uncheckedboxes.value = thiselement.name;
						} 
						else 
						{
							document.userinfo.uncheckedboxes.value += '!' + thiselement.name;
						}
					}
				}			
			}
		}		
		document.userinfo.submit();
    }

	


