// The quickJump function allows a dropdown choice to open a link...
// source :: some corporate website... 

function quickJump(frmName,selName) {
  var vChoice, vSelection;
  vChoice = document.forms[frmName].elements[selName].selectedIndex; 
  vSelection = document.forms[frmName].elements[selName].options[vChoice].value;
  location=vSelection;
  // window.open(Selection,"_blank");
}

// The colorRows function adds the .rowTint style to every other tr.
// source :: http://bitesizestandards.com/bites/automatic-coloured-rows

function colorRows() {
  var myTR = document.getElementsByTagName('tr');
    for (var i=0;i<myTR.length;i++) {
      if (i%2) {
        myTR[i].className = 'rowTint';
    }
  }
}

// Pre-Qualification Calculator
// source :: the previous vendor, probably copied from another site as well :)

function doMath(number)
{
  return Math.floor( number * Math.pow(10,2) )/Math.pow(10,2);
}

function calculate()
{
  	var mi 	= document.calc.IR.value / 1200;
  	var base 	= 1;
  	var mbase = 1 + mi;
  
  	for ( i = 0; i < document.calc.YR.value * 12; i++ )
  	{
    	base = base * mbase
 	}
  
  	document.calc.PI.value = doMath(document.calc.LA.value * mi / ( 1 - (1/base)))
  	document.calc.MT.value = doMath(document.calc.AT.value / 12)
  	document.calc.MI.value = doMath(document.calc.AI.value / 12)
  	var dasum = document.calc.LA.value * mi / ( 1 - (1/base)) +
	document.calc.AT.value / 12 + 
	document.calc.AI.value / 12;
  	document.calc.MP.value = doMath(dasum);
}

// Loan Calculator
// source :: the previous vendor, probably copied from another site as well :)

function doMath(number)
{
  return Math.floor( number * Math.pow(10,2) )/Math.pow(10,2);
}

function calculate()
{
  	var mi 	= document.calc.IR.value / 1200;
  	var base 	= 1;
  	var mbase = 1 + mi;
  
  	for ( i = 0; i < document.calc.YR.value * 12; i++ )
  	{
    	base = base * mbase
 	}
  
  	document.calc.PI.value = doMath(document.calc.LA.value * mi / ( 1 - (1/base)))
  	document.calc.MT.value = doMath(document.calc.AT.value / 12)
  	document.calc.MI.value = doMath(document.calc.AI.value / 12)
  	var dasum = document.calc.LA.value * mi / ( 1 - (1/base)) +
	document.calc.AT.value / 12 + 
	document.calc.AI.value / 12;
  	document.calc.MP.value = doMath(dasum);
}