// SET THE STATUS BAR MESSAGE
defaultStatus="LowerMyBills.com  -  More for you.  Less for them.";

//NEW WINDOW FUNCTIONS

var newSmallWindow = null
var newMidWindow = null
var newBigWindow = null

function opensmallWindow(site) {
newSmallWindow = window.open(site, "client1", "width=350,height=225,scrollbars=yes,alwaysRaised,dependent")
}

function opensquareWindow(site) {
newSquareWindow = window.open(site, "client2", "width=600,height=300,scrollbars,alwaysRaised,resizable=yes,menubar,dependent")
}

function openbigWindow(site) {
newBigWindow = window.open(site, "client3", "width=700,height=450,scrollbars=yes,alwaysRaised,resizable=yes,toolbar,dependent")
}

function opencobrandWindow(site) {

newCobrandWindow = window.open(site, "client3")
}

function opensslWindow(site) {

newSslWindow = window.open(site, "client7", "width=780,height=450,scrollbars,alwaysRaised,resizable=yes,toolbar,status=yes,dependent=no")
}

function opencrcWindow(site) {
newCrcWindow = window.open(site, "client5", "width=394,height=250,alwaysRaised,toolbar,dependent")
}

function openbannerWindow(site) {
newCrcWindow = window.open(site, "client6", "width=468,height=60,alwaysRaised,toolbar,dependent")
}

function openmidWindow(site) {
newMidWindow = window.open(site, "client8", "width=300,height=312,scrollbars=yes,alwaysRaised,resizable=yes,dependent")
}

function openChildWindow(url, width, height) {
	window.open(url, "client9", "width="+width+",height="+height+",scrollbars=yes,alwaysRaised,resizable=yes,dependent")
	}

function openFullscreenWindow(url, width, height) {
	window.open(url, "client9", "width="+(window.screen.availWidth-20)+",height="+window.screen.availHeight+",scrollbars=yes,alwaysRaised,resizable=yes,dependent")
	}

function changepage()
{
window.top.location = document.choose.category.options[document.choose.category.selectedIndex].value
}


function removeSpaces(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += removeSpaces(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

/*
 * DOM show/hide functions.
 * Do not set display to "block", it breaks things like table rows.
 */
function showElement(strID) {
	try { document.getElementById(strID).style.display = ""; } catch(ex) {}
}
function hideElement(strID) {
	try { document.getElementById(strID).style.display = "none"; } catch(ex) {}
}

/*
 * CSS2 emulation for MS Internet Explorer.
 * Used for the rounded corners on sidepanel headers.
 */
function constExpression(x) {
   return x;
}
function sidepanelGroupH3MSIE(hNode) {
	try {
		switch(hNode.previousSibling.currentStyle.backgroundColor) {
			case "#ffffff": return "url(/images/common/round_corner_white.gif)"; break;
			case "#ffffcc": return "url(/images/common/round_corner_yellow.gif)"; break;
			case "transparent": return "url()"; break;
		}
	} catch(ex) {}
	return "url()";
}

/*
 * Generic UL-tree functions.
 * Used for calculator tree lists.
 */
function openTree(strIdRoot) {
	hideElement(strIdRoot.concat("-closed"));
	showElement(strIdRoot.concat("-open"));
}
function closeTree(strIdRoot) {
	hideElement(strIdRoot.concat("-open"));
	showElement(strIdRoot.concat("-closed"));
}
function closeAllTrees(arrIds) {
	for (var i=0; i < arrIds.length; i++) {
		closeTree(arrIds[i]);
	}
}

/*
 * Calculator-specific functions.
 */
var arrCalcIds = ["CalcLHP", "CalcLRE", "CalcLDC", "CalcLHE"];
var arrMoreIds = ["CalcMoreLHP", "CalcMoreLRE", "CalcMoreLDC", "CalcMoreLHE"];
function openCalcTree(strIdRoot) {
	closeAllTrees(arrCalcIds);
	openTree(strIdRoot);
	closeAllTrees(arrMoreIds);
}
function openCalcWindow(strFile) {
	var site = "http://www.lowermybills.com/fh/popUps/lending_calculator.jsp?content=http://partners.leadfusion.com/leadfusion/lowermybills/" + strFile;
	var newCalcWindow = window.open(site, "client3", "width=480,height=600,scrollbars=yes,alwaysRaised,resizable=yes,toolbar,dependent");
}

