/***********************************************
* Contractible Headers script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated Mar 23rd, 2004.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(classname){
var ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
var ccollect=new Array()
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined"){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate



// WebTrends SmartSource Data Collector
// © 1996-2004 NetIQ Corporation.  All rights reserved. 
// $DateTime: 2004/05/03 13:43:43 $

function dcsMultiTrack(){
	for (var i=0;i<arguments.length;i++){
		if (arguments[i].indexOf('WT.')==0){
				WT[arguments[i].substring(3)]=arguments[i+1];
				i++;
		}
		if (arguments[i].indexOf('DCS.')==0){
				DCS[arguments[i].substring(4)]=arguments[i+1];
				i++;
		}
		if (arguments[i].indexOf('DCSext.')==0){
				DCSext[arguments[i].substring(7)]=arguments[i+1];
				i++;
		}
	}
	var dCurrent=new Date();
	DCS.dcsdat=dCurrent.getTime();
	dcsTag();
}


function openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

 function validForm(form) {
	if (form.ABR.value.length== 0 ) {
	alert("Please Select a State.");
    form.ABR.focus();
    return false;
	}
    return true;
}

 function validZip(form1) {
 var ZIPLENGTH = 5;
 
 if (form1.fZipCode.value.length==0)
	{
		alert("Please enter a zip code.");
   		form1.fZipCode.focus();
   		return false;
	} else if
	(form1.fZipCode.value.length<ZIPLENGTH )
    {
		alert("Please enter a valid zip code.");
   		form1.fZipCode.focus();
   		return false;
	}
	return true;
}

function openCookie() {
	window.open("http://mortgages.interest.com/content/popup/index.asp","Index","toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=no,resizable=no,width=310,height=360")
	self.focus();
}

function openFlashCookie() {
	window.open("http://mortgages.interest.com/content/popup/index.asp","Flash","toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=no,resizable=no,width=310,height=360")
	self.focus();
}
function openTransCookie() {
	window.open("http://mortgages.interest.com/2005/content/MapSearch/transition.asp","Index","toolbar=yes,location=yes,directories=0,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=775,height=600")
	self.focus();
}

function openStateSearch() {
	window.open("http://mortgages.interest.com/content/popup/state_redirect.asp","StateSearch","location=0,directories=0,status=0,menubar=no,status=no,scrollbars=no,resizable=no,width=720,height=300")
	self.focus();
}

function openCalculator() {
	window.open("http://mortgages.interest.com/content/popup/calc_redirect.asp","Calculator","toolbar=no,location=0,directories=0,status=0,menubar=no,status=no,scrollbars=no,resizable=no,width=720,height=300")
	self.focus();
}

function openHelp(helpMe) {
	window.open("http://mortgages.interest.com/help.asp?topic=" + helpMe,"HelpWindow","toolbar=no,location=0,directories=0,status=0,menubar=no,scrollbars=no,resizable=no,width=400,height=150")
}


