var dolphintabs={
	subcontainers:[], last_accessed_tab:null,

	revealsubmenu:function(curtabref){
	this.hideallsubs()
	if (this.last_accessed_tab!=null)
		this.last_accessed_tab.className=""
	if (curtabref.getAttribute("rel")) //If there's a sub menu defined for this tab item, show it
	document.getElementById(curtabref.getAttribute("rel")).style.display="block"
	curtabref.className="current"
	this.last_accessed_tab=curtabref
	},

	hideallsubs:function(){
	for (var i=0; i<this.subcontainers.length; i++)
		document.getElementById(this.subcontainers[i]).style.display="none"
	},


	init:function(menuId, selectedIndex){
	var tabItems=document.getElementById(menuId).getElementsByTagName("a")
		for (var i=0; i<tabItems.length; i++){
			if (tabItems[i].getAttribute("rel"))
				this.subcontainers[this.subcontainers.length]=tabItems[i].getAttribute("rel") //store id of submenu div of tab menu item
			if (i==selectedIndex){ //if this tab item should be selected by default
				tabItems[i].className="current"
				this.revealsubmenu(tabItems[i])
			}
		tabItems[i].onmouseover=function(){
		dolphintabs.revealsubmenu(this)
		}
		} //END FOR LOOP
	}

}

//this part is used for the calculator 
function jumpBox(list){
   location.href = list.options[list.selectedIndex].value
	}

function computeForm(form){
	var i = form.interest.value;
    if (i > 1.0) {
        i = i / 100.0;
        form.interest.value = i;
	}
     i /= 12;
    var j = form.minpayperc.value;
    if (j > 1.0) {
        j = j / 100.0;
        j = j * 1;
	}
   	var prin = eval(form.principal.value);
   	var pmt = 0;
   	var prinPort = 0;
   	var intPort = 0;
   	var count = 0;
    accruedInt = 0;
    while(prin > 0) {
         if(eval(prin * j) < eval(form.minpaydol.value)) {pmt = eval(form.minpaydol.value); } else { pmt = eval(j * prin); }
                    intPort = eval(i * prin);
                    prinPort = eval(pmt - intPort);
                    prin = eval(prin - prinPort);
                    accruedInt = eval(accruedInt + intPort);
                    count = count + 1
                    if(count > 600) { break; } else { continue;}
                    }
   	form.ccInt.value = "$" +parseInt(accruedInt,10);
   	form.nPer.value = count;         
   	form.years.value = count / 12;
	}
function clearForm(form){
    form.principal.value = "";
    form.interest.value = "";
    form.minpaydol.value = "";
    form.minpayperc.value = "";
    form.ccInt.value = "";
    form.nPer.value = "";
    form.years.value = "";
	}

