// JavaScript Document
<!--//--><![CDATA[//><!--
// <!-- 2142562665
// This script is (C) Copyright 2004 Jim Tucek
// Leave these comments alone!  For more info, visit
// www.jracademy.com/~jtucek/email/ 

function goSubmit(id){
  goForth = false;
  document.getElementById("hiddenEditType").value = id;
  switch(id){
    case "editButton_edit":
      document.forms[0].submit();
      break;
    case "editButton_delete":  
      goForth = confirm("DELETE WARNING: Are you sure?");
      if(goForth) document.forms[0].submit();
      break;
  }    
}

function editThisUser(){
  var id = document.getElementById("editUser").value;
  window.location="registration.php?userid="+id;   
}

function fling(cliff,sand,horse) {
cliff += ' ';
var head = cliff.length;
var box = 0;
var bed = '';
for(var conception = 0; conception < head; conception++) {
box = 0;
while(cliff.charCodeAt(conception) != 32) {
box = box * 10;
box = box + cliff.charCodeAt(conception)-48;
conception++;
}
bed += String.fromCharCode(tread(box,sand,horse));
}
parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+bed;
}

function swear(decision,goodbye,structure) {
decision += ' ';
var expert = decision.length;
var extraterrestrial = 0;
for(var fire = 0; fire < expert; fire++) {
extraterrestrial = 0;
while(decision.charCodeAt(fire) != 32) {
extraterrestrial = extraterrestrial * 10;
extraterrestrial = extraterrestrial + decision.charCodeAt(fire)-48;
fire++;
}
//document.write('&');
//document.write('#');
//document.write(tread(extraterrestrial,goodbye,structure));
document.write(String.fromCharCode(tread(extraterrestrial,goodbye,structure)));
}
}

function tread(hero,labyrinth,bow) {
if (bow % 2 == 0) {
lottery = 1;
for(var maximum = 1; maximum <= bow/2; maximum++) {
way = (hero*hero) % labyrinth;
lottery = (way*lottery) % labyrinth;
}
} else {
lottery = hero;
for(var minimum = 1; minimum <= bow/2; minimum++) {
way = (hero*hero) % labyrinth;
lottery = (way*lottery) % labyrinth;
}
}
return lottery;
}
// -->

<!-- Clicking on this link uses javascript to decrypt the email address -->
//<a href='javascript:fling("2313 7205 2172 3721 5408 1535 3357 7205 4434 3721 7205 5804 3357 6074 101 7589 4528 4434 6074 4434 3357 1060 7539 3721 3326",8023,5227)'>Click to email me</a>

<!-- Alternativly, you can have the script display the text of your email address -->
<!-- which is less secure, but it's better than nothing and looks better -->
//Email me at <a href='javascript:fling("2313 7205 2172 3721 5408 1535 3357 7205 4434 3721 7205 5804 3357 6074 101 7589 4528 4434 6074 4434 3357 1060 7539 3721 3326",8023,5227)' onMouseOver="self.status=''; return true;" onMouseOut="self.status=' '; return true;"><script type='text/javascript'>swear("2313 7205 2172 3721 5408 1535 3357 7205 4434 3721 7205 5804 3357 6074 101 7589 4528 4434 6074 4434 3357 1060 7539 3721 3326",8023,5227)</script></a>  (A tad bit less secure, but looks better.  So, the question is whether you're shallow or not. ;)


startList = function() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("nav");

     for (i=0; i<navRoot.childNodes.length; i++) {
       node2 = navRoot.childNodes[i]; 
         if (node2.nodeName=="LI") {
           node2.onmouseover=function() {
             this.className+=" dover";
           }
           node2.onmouseout=function() {
             this.className=this.className.replace(" dover", "");
           }
        }
        for (k=0; k<navRoot.childNodes[i].lastChild.childNodes.length; k++) {  
          node = navRoot.childNodes[i].lastChild.childNodes[k]; 
          if (node.nodeName=="LI") {
            node.onmouseover=function() {
              this.className+=" rover";            
            }
            node.onmouseout=function() {
              this.className=this.className.replace(" rover", "");
            }
          }        
        }
     }

    menuRoot = document.getElementById("menuNode");
    if(menuRoot!=null){
    if((menuRoot.lastChild.childNodes.length>1)&&(menuRoot)){
      for (i=0; i<menuRoot.lastChild.childNodes[2].childNodes.length; i++) {  
        node3 = menuRoot.lastChild.childNodes[2].childNodes[i]; 
        if (node3.nodeName=="LI") {
          node3.onmouseover=function() {
            this.className+=" clover";            
          }
          node3.onmouseout=function() {
            this.className=this.className.replace(" clover", "");
          }
        }        
      }
    }
    }
    
    listRoot = document.getElementById("listNode");
    //alert(listRoot.childNodes[1].childNodes[1].childNodes[0].nodeName);
    //alert(listRoot.childNodes[1].childNodes.length);
    if(listRoot!=null){
    //if((listRoot.firstChild.length>1)&&(listRoot)){
      for (i=0; i<listRoot.childNodes.length; i++) {  
        for (j=0; j<listRoot.childNodes[i].childNodes.length; j++) { 
          node7 = listRoot.childNodes[i].childNodes[j].childNodes[0]; 
          if (node7.nodeName=="UL") {
            //alert(listRoot.childNodes[i].childNodes[j].childNodes[0].nodeName);
            node7.onmouseover=function() {
              this.className+=" lhover";            
            }
            node7.onmouseout=function() {
              this.className=this.className.replace(" lhover", "");
            }
          }
        }          
      }
    //}
    }               
  }
}

//window.onload=startList;
var element;
var nuName;
var oldName="sub1";
function classToggle(element) {
  nuName = (document.getElementById(element).className=='DisplayNone')?'DisplayBlock':'DisplayBlock';
  document.getElementById(oldName).className = 'DisplayNone';
  document.getElementById(element).className = nuName;
  oldName=element;
}
function classClear() {
  for (i = 1; i <= c; i++) {
    var clearDisplay = "sub"+i;
    if(clearDisplay) {
      document.getElementById(clearDisplay).className = 'DisplayNone';
    }
  }
}
//--><!]]>
// F. Permadi 2005.
// (C) F. Permadi
// Print DOM tree
////////////////////////////////////////////
// This function traverses the DOM tree of an element and prints the tree.  
// This function called recursively until the DOM tree is fully traversed.
// 
// Parameters:
// - targetDocument is where the tree will be printed into
// - currentElement is the element that we want to print
// - depth is the depth of the current element 
//   (it should be 1 for the initial element)
////////////////////////////////////////////
function traverseDOMTree(targetDocument, currentElement, depth)
{
  if (currentElement)
  {
    var j;
    var tagName=currentElement.tagName;
    // Prints the node tagName, such as <A>, <IMG>, etc
    if (tagName)
      targetDocument.writeln("&lt;"+currentElement.tagName+"&gt;");
    else
      targetDocument.writeln("[unknown tag]");

    // Traverse the tree
    var i=0;
    var currentElementChild=currentElement.childNodes[i];
    while (currentElementChild)
    {
      // Formatting code (indent the tree so it looks nice on the screen)
      targetDocument.write("<BR>\n");
      for (j=0; j<depth; j++)
      {
        // &#166 is just a vertical line
        targetDocument.write("&nbsp;&nbsp;&#166");
      }								
      targetDocument.writeln("<BR>");
      for (j=0; j<depth; j++)
      {
        targetDocument.write("&nbsp;&nbsp;&#166");
      }					
      if (tagName)
        targetDocument.write("--");

      // Recursively traverse the tree structure of the child node
      traverseDOMTree(targetDocument, currentElementChild, depth+1);
      i++;
      currentElementChild=currentElement.childNodes[i];
    }
    // The remaining code is mostly for formatting the tree
    targetDocument.writeln("<BR>");
    for (j=0; j<depth-1; j++)
    {
      targetDocument.write("&nbsp;&nbsp;&#166");
    }			
    targetDocument.writeln("&nbsp;&nbsp;");
    if (tagName)
      targetDocument.writeln("&lt;/"+tagName+"&gt;");
  }
}

////////////////////////////////////////////
// This function accepts a DOM element as parameter and prints
// out the DOM tree structure of the element.
////////////////////////////////////////////
function printDOMTree(domElement, destinationWindow)
{
  // Use destination window to print the tree.  If destinationWIndow is
  //   not specified, create a new window and print the tree into that window
  var outputWindow=destinationWindow;
  if (!outputWindow)
    outputWindow=window.open();

  // make a valid html page
  outputWindow.document.open("text/html", "replace");
  outputWindow.document.write("<HTML><HEAD><TITLE>DOM</TITLE></HEAD><BODY>\n");
  outputWindow.document.write("<CODE>\n");
  traverseDOMTree(outputWindow.document, domElement, 1);
  outputWindow.document.write("</CODE>\n");
  outputWindow.document.write("</BODY></HTML>\n");
  
  // Here we must close the document object, otherwise Mozilla browsers 
  //   might keep showing "loading in progress" state.
  outputWindow.document.close();
}

function calculate1() { 
var GMIPB = parseNumber(document.prequalify.GMIPB.value); 
var GMICB = parseNumber(document.prequalify.GMICB.value); 
var GMIO = parseNumber(document.prequalify.GMIO.value); 
document.prequalify.TGMI.value = commify(GMIPB + GMICB + GMIO); 
} 

function calculate2() { 
var AP = parseNumber(document.prequalify.AP.value); 
var SL = parseNumber(document.prequalify.SL.value); 
var CC = parseNumber(document.prequalify.CC.value); 
var DSC = parseNumber(document.prequalify.DSC.value); 
var NRL = parseNumber(document.prequalify.NRL.value); 
var CSA = parseNumber(document.prequalify.CSA.value); 
document.prequalify.TML.value = AP + SL + CC + DSC + NRL + CSA; 
} 

function calculate3() { 
var TGMI = parseNumber(document.prequalify.TGMI.value); 
var TML = parseNumber(document.prequalify.TML.value); 
document.prequalify.prequalify_amount.value = Math.round(Math.min(TGMI * .28,(TGMI * .36) - TML)*100)/100; } function parseNumber(value) { value = new String(value); value = value.replace(/[^0-9\\.]/g,""); if(value.length == 0) { return 0; } return parseFloat(value); } function commify(value) { value = new String(value); value = reverse(value); value = value.replace(/(\\d\\d\\d)/,"$1,"); value = value.replace(/,$/,""); return reverse(value); } function reverse(value) { value = new String(value); var i; var reversed = new String(); 
for(i = value.length-1; i >= 0; i--) { 
  reversed = reversed.concat(value.charAt(i)); 
} 
return reversed; 
}

function calculateA() { 
var price = parseNumber(document.Mortgage.salesPrice.value); 
var downpmt = parseNumber(document.Mortgage.downPayment.value); 
var rate = parseNumber(document.Mortgage.annualInterestRate.value); 
var years = parseNumber(document.Mortgage.numberOfYears.value); 
var loanamt = price - downpmt; 
var nopmts = years*12; 
var morate = rate/1200; 
var mopmt = Math.round((loanamt*(morate/(1-Math.pow((1+morate), -nopmts))))*100)/100; 
document.Mortgage.loanAmount.value = commify(loanamt); 
document.Mortgage.numberOfPayments.value = commify(nopmts); 
document.Mortgage.monthlyPrincipleAndInterestPayment.value = commify(mopmt); 
} 

function calculateB() { 
var PI = parseNumber(document.Mortgage.monthlyPrincipleAndInterestPayment.value); 
var SP = parseNumber(document.Mortgage.salesPrice.value); 
var LA = parseNumber(document.Mortgage.loanAmount.value); 
var MHIR = parseNumber(document.Mortgage.estimatedAnnualHomeownersInsuranceRate.value)/12; 
var MPTR = parseNumber(document.Mortgage.estimatedAnnualPropertyTaxRate.value)/12; 
var MHAF = parseNumber(document.Mortgage.estimatedMonthlyHomeownersAssociationFees.value)/12; 
var LTV = Math.round(100*LA/SP)/100; 
var J = 0; 
if((LTV <= .97) && (LTV >= .9501)) { 
J = Math.round(LA * .9 / 12)/100; 
} else if((LTV <= .95) && (LTV >= .9001)) { 
J = Math.round(LA * .78 / 12)/100; 
} else if((LTV <= .9) && (LTV >= .8501)) { 
J = Math.round(LA * .52 / 12)/100; 
} else if((LTV <= .85) && (LTV >= .8001)) { 
J = Math.round(LA * .32 / 12)/100; 
} 
document.Mortgage.totalEstimatedMonthlyPayment.value = commify(PI + J + MHAF + MHIR + MPTR ); 
} 

function parseNumber(value) { 
value = new String(value); 
value = value.replace(/[^0-9\\.]/g,""); 
if(value.length == 0) { 
return 0; 
} 
return parseFloat(value); 
} function commify(value) { 
value = new String(value); 
value = reverse(value); 
value = value.replace(/(\\d\\d\\d)/,"$1,"); 
value = value.replace(/,$/,""); 
return reverse(value); 
} 

function reverse(value) { 
value = new String(value); 
var i; 
var reversed = new String(); 
for(i = value.length-1; i >= 0; i--) { 
reversed = reversed.concat(value.charAt(i)); 
} 
return reversed; 
} 

//-->

