/* Browser check */
IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);
IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);

// preload rollovers
var aNavigation = new Array();
aNavigation = ["", "helping-you", "getting-started", "tools-resources", "home", "talk-to-us"];
for (i = 0; i <= 5; i++) { 
	eval("menu"+i+"on = new Image();"); eval("menu"+i+"off = new Image();");
	if (sSelectedButton == aNavigation[i]) {
		eval("menu"+(i)+"on.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-r.gif\";");
		eval("menu"+(i)+"off.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-r.gif\";");
	} else {
		eval("menu"+(i)+"on.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-r.gif\";");
		eval("menu"+(i)+"off.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-0.gif\";");
	}
}

// General Site Functions
function imgOn(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "on.src");
  }
}
 
function imgOff(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "off.src");
  }
}

// image swapper
function changeImages() 
{
  if (document.getElementById) {
    for (var i = 0; i < changeImages.arguments.length; i += 2) { 
  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 
	}
  }
}

// Get an ID 
function getThis(sId)
{
	var oObject;
	oObject = false;
	
	if (IS_DOM) {
		if (parent.document.getElementById(sId)) {
			oObject = parent.document.getElementById(sId);
		}
	}
	
	return oObject;
}

function centeredPopUp(sURL, iWidth, iHeight)
{
	var iLeft = (screen.width - iWidth) / 2;
	var iTop = (screen.height - iHeight) / 2;
	window.open(sURL, '', 'width=' + iWidth + ', height=' + iHeight + ', top=' + iTop + ', left=' + iLeft);
}

function centeredPopUpWindow(mypage, myname, w, h, scroll)
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function changeStyle(oElement, sPropertyName, sNewValue)
{
	if (oElement != false) {
		// get element style attribute
		oStyle = oElement.style;
		// apply new style value to provided property
		eval("oStyle." + sPropertyName + " = '" + sNewValue + "'");
	}
}

/* featured product focus area */
function changeDisplayState(iItem)
{
	sBoxPrefix = "faq";
	sLinkPrefix = "faqSwap";
	sBoxId = sBoxPrefix + iItem;
	sLinkId = sLinkPrefix + iItem;
	
	if (document.getElementById) {
		for (i = 1; i < 28; i++) {
			sEachBoxId = sBoxPrefix + i;
			sEachLinkId = sLinkPrefix + i;
			oBox = getThis(sEachBoxId);
			changeStyle(oBox, "display", "none");
			
			oLink = getThis(sEachLinkId);
			oLink.className = "";
		}
		oBox = getThis(sBoxId);
		oLink = getThis(sLinkId);
		changeStyle(oBox, "display", "block");
		oLink.className = "selected";
	}
}
function in_array(myValue,myArray)
{
    function equals(a,b)
    {
        return (a === b);
    }

    for (var i in myArray)
    {
        if (equals(myArray[i],myValue))
            return true;
    }

    return false;
}
function validateState(thisState)
{
	var noStateArray = {0:"KS",1:"ND",2:"WI",3:"WV"};
	if (in_array(thisState,noStateArray)) {
		alert("Sorry, DMB Financial's debt settlement services are not available in your state.  Thank you for visiting our web site."); document.frmOnlineAnalysis.State.selectedIndex = 0;
		document.frmOnlineAnalysis.State.selectedIndex = 0;
	}
}

function window_open(filename)
	{window.open ( filename, 'newwindow', config='height=200,width=600, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
	return;
	}
