document.cookie='CFID=82341';
document.cookie='CFTOKEN=11733707';

var status = getArgument("status");
var statusMessage = getArgument("statusMessage");

function plusUnescape(str) { // the unescape function won't convert plus signs
  str = '' + str; // to spaces; like you see in search strings
  while (true) {
    var i = str.indexOf('+');
    if (i == -1) break;
    str = str.substring(0,i) + ' ' + str.substring(i+1,str.length);
  }
  return unescape(str);
}

function getArgument (theKey) {
  var args = new Array ();
  var argstring = unescape(location.href);
  var iQuestion = argstring.indexOf("?");
  if (iQuestion > 0) {
    argstring = argstring.substring(iQuestion, argstring.length);
  }
  if (argstring.charAt(0) != '?') return false; // no arguments
  argstring = argstring.substring(1, argstring.length);
  var argarray = argstring.split('&');
  for (var i=0; i < argarray.length; i++) {
    var singlearg = argarray[i].split('=');
    if (singlearg.length != 2) { continue; }// not a valid argument
    var argsKey = plusUnescape(singlearg[0]);
    var argsValue = plusUnescape(singlearg[1]);
    args [argsKey] = argsValue;
  }
  return args[('' + theKey)]
}

function _CF_onError(form_object, input_object, object_value, error_message){ 
	alert(error_message);
	return false; 
}

function _CF_hasValue(obj, obj_type){
    if (obj_type == "TEXT") {
      if (obj.value.length == 0) {
          return false;
      } else {
          return true;
	  }
    } 
	else if (obj_type == "SELECT") {
      for (i=0; i < obj.length; i++) {
       if (obj.options[i].selected) {
        return true;
       } else {
      	return false;
		}
      }
    }
}

function  _CF_checkemailform(_CF_this){
    if  (!_CF_hasValue(_CF_this.email, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.email, _CF_this.email.value, "You must enter an email address to register!")) {
        return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.FirstName, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.FirstName, _CF_this.FirstName.value, "You must enter a first name to register!")) {
         return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.LastName, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.LastName, _CF_this.LastName.value, "You must enter a last name to register!")) {
        return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.Address1, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.Address1, _CF_this.Address1.value, "You must enter your address to register!")) {
        return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.City, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.City, _CF_this.City.value, "You must enter your city to register!")) {
        return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.zip, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.zip, _CF_this.zip.value, "You must enter your zip code to register!")) {
        return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.returnState, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.returnState, _CF_this.returnState.value, "You must enter your state to register!")) {
        return false;
      }
    }

    if  (!_CF_hasValue(_CF_this.Phone, "TEXT" )) {
      if  (!_CF_onError(_CF_this, _CF_this.Phone, _CF_this.Phone.value, "You must enter a phone number to register!")) {
        return false;
      }
    }

     if  (!_CF_hasValue(_CF_this.Age, "TEXT" )) { 
      if  (!_CF_onError(_CF_this, _CF_this.Age, _CF_this.Age.value, "You must enter an age to register!")) { 
        return false; 
      } 
    } 

    return true;
}


function checkEmail(form) {
  var field = form.email;
  var str = field.value;
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
    return true;
  }
  alert("Your e-mail address is invalid. Please Re-enter the address."); 
  field.focus();
  field.select();
  return false;
}
