function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

	var whitespace = " \t\n\r"

	function stripCharsInBag (s, bag) {
		var i
	   var returnString = ""
	   for (i = 0; i < s.length; i++) {
			var c = s.charAt(i)
			if (bag.indexOf(c) == -1) 
				returnString += c
		}
	   return returnString
	}

	function isEmpty(s) {
	    return ((s == null) || (s.length == 0))
	}


	function stripWhitespace (s) {
		return stripCharsInBag (s, whitespace)
	}

	function checkString (theField) {
		var s1 = ""
	   if (theField == null) {
			return false
		}
	   s1 = stripWhitespace(theField.value)
	   if (isWhitespace(s1)) {
			return false
		}
	   else {
			return true
		}
	}

	function isCreditCard(st) {
		if (st.length > 19)
			return false
		sum = 0; mul = 1; l = st.length
		for (x = 0; x < l; x++) {
			digit = st.substring(l-x-1,l-x)
			tproduct = parseInt(digit ,10)*mul
			if (tproduct >= 10) 
				sum += (tproduct % 10) + 1
			else 
				sum += tproduct
			if (mul == 1) 
				mul++
			else 
				mul--
		}
		if ((sum % 10) == 0) 
			return true
		else 
			return false
	}


	function isWhitespace (s) {
		
		var i
		if (isEmpty(s)) 
			return true	
		for (i = 0; i < s.length; i++) {   
			var c = s.charAt(i)
			if (whitespace.indexOf(c) == -1) 
				return false
	   }
	   return true
	}


   function validateForm(frm) {
     var valid = false
      var m = 'Your submission failed for the following reasons :'
      for (i=0;i<frm.length;i++) {

         var tempobj=frm.elements[i]

			valid = checkString(tempobj)

			if (valid == false) {

				if (tempobj.name == 'name') 
					alert('You must enter your name as it appears on your credit card')					
				else if (tempobj.name == 'email')
					alert('You must enter your email address: We wont share your email with other members. Your email will always remain protected and we will never give out your infomation. This is where your username/password will be sent and will start your free trial access.')
				else if (tempobj.name == 'city')
					alert('You must enter the city in which you live')
				else if (tempobj.name == 'password')
					alert('You must enter a password')
				else
					valid = true
				if (valid == false) {
					tempobj.value=''
					tempobj.focus()
					return false
				}
			
			}

			if (valid == false)
				return false

      }

      return true
   }
