

function swapCtaImg(imgName, show) {
	imgDir = "/images/consumer/";
	if (show) {
		document.images[imgName].src= imgDir + imgName + "_on.gif";
	} else {
		document.images[imgName].src= imgDir + imgName + ".gif";
	}
}

function imgOver(imgName)
{
	if (document.images)
	{
		document[imgName].src = "img/" + imgName + "on.gif";
	}
}

function imgOut(imgName)
{
	if (document.images)
	{
		document[imgName].src = "img/" + imgName + ".gif";
	}
}

function openWin(subpage) {
	popup=window.open(subpage,"doughnuts","height=500,width=500,scrollbars=yes,resizable=no,status=no,menubar=no,toolbar=no,location=no,top=1,left=1");
	if (!popup.opener) {
		popup.focus();
		popup.opener=self;
	} else {
		popup.focus();
	}
}


function openWinSS(subpage) {
	popup=window.open(subpage,"service","height=500,width=666,scrollbars=yes,resizable=yes,status=no,menubar=no,toolbar=no,location=no,top=1,left=1");
	self.name="lgmain";
	if (!popup.opener) {
		popup.focus();
		popup.opener=self;
	} else {
		popup.focus();
	}
}

function openMortgagePlanner(subpage) {
	popup=window.open(subpage,"planner","height=580,width=688,scrollbars=yes,resizable=yes,status=no,menubar=no,toolbar=no,location=no,top=1,left=1");
	self.name="lgmain";
	if (!popup.opener) {
		popup.focus();
		popup.opener=self;
	} else {
		popup.focus();
	}
}

function openWinSC(subpage) {
	popup=window.open(subpage,"iplan","height=500,width=666,scrollbars=yes,resizable=yes,status=yes,menubar=yes,toolbar=yes,location=yes,top=20,left=20");
	if (!popup.opener) {
		popup.focus();
		popup.opener=self;
	} else {
		popup.focus();
	}
}


function switchTo(dest) {
	if (this.opener) {
		this.opener.location=dest;
		window.close();
		return false;
	}
	return true;
}

function doPrintWarning() {
	alert("This print function is not available to you. To print this page you will need to click on your right hand mouse button and select print from the menu presented.\n\n Mac users will need to click on File.. in the top menu bar and select print from the menu presented.");
}

function closePrint() {
	document.write("<div align='center'>");
		document.write("<a href=\"#\" onclick=\"window.close();\"><img src=\"/img/close.gif\" alt=\"Close this Window\" border=\"0\" width=\"55\" height=\"22\"></a> ");
		document.write("<a href=\"#\" onclick=\"if (window.print) {window.print();} else { doPrintWarning(); };\"><img src=\"/img/print.gif\" alt=\"Print this Page\" border=\"0\" width=\"55\" height=\"22\"></a>");
	document.write("</div>");
}

function getStylesheet() {
	var bplat = navigator.platform;
	bplat = bplat.toLowerCase();
	var bbrow = navigator.appName;
	bbrow = bbrow.toLowerCase();

	if (bplat.indexOf("mac")!==-1) {
		var bvers = navigator.appVersion;
		bvers = bvers.toLowerCase();

		if (bvers.indexOf("msie 5.0")!=-1) {
			return "<link rel='stylesheet' type='text/css' href='/inc/mastermac5.css'>";
		} else if (bvers.indexOf("msie 4.0")!=-1) {
			return "<link rel='stylesheet' type='text/css' href='/inc/mastermac4.css'>";
		} else {
			return "<link rel='stylesheet' type='text/css' href='/inc/mastermac.css'>";
		}

	} else {
		if (bplat.indexOf("win")!==-1) { // Win based machine
			if (bbrow.indexOf("microsoft")!=-1) { // IE
				return "<link rel='stylesheet' type='text/css' href='/inc/masterie.css'>";
			} else if (bbrow.indexOf("netscape")!=-1) { // nn
				return "<link rel='stylesheet' type='text/css' href='/inc/masternn.css'>";
			} else { // added for Opera
				return "<link rel='stylesheet' type='text/css' href='/inc/masterie.css'>";
			}
		} else {
			return "<link rel='stylesheet' type='text/css' href='/inc/masterie.css'>";
		}
	}
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function shL(divname, v) {
  	if ((obj=findObj(divname))!=null) {
    	if (obj.style) {
			obj=obj.style;
			v=(v=='show')?'visible':(v='hide')?'hidden':v;
		}
		obj.visibility=v;
	}
}

function toggleL(divname) {
  	if ((obj=findObj(divname))!=null) {
	    	if (obj.style) {
			obj=obj.style;
//			v=(v=='show')?'visible':(v='hide')?'hidden':v;
		}
		v = obj.visibility;
		if 	(v=="visible") { v="hidden"; }
		else if (v=="hidden") { v="visible"; }
		else if (v=="show") { v="hide"; }
		else if (v=="hide") { v="show"; }
		obj.visibility = v;
	}
}

function closeAll() {
	shL('navpens','hide');
	clearPens();
	shL('navins','hide');
	clearIns();
	shL('navlife','hide');
	clearLife();
	shL('navmort','hide');
	clearMort();
	shL('navsave','hide');
	clearSave();
	shL('off','hide');
	shL('navonserv', 'hide');
	clearOnserv();
}

function clearPens() {
	shL('navpens1','hide');
}
function clearIns() {
	shL('navins1','hide');
	shL('navins2','hide');
	shL('navins2b','hide');
	shL('navins3','hide');
	shL('navins4','hide');
}

function clearLife() {
	shL('navlife1','hide');
	shL('navlife2','hide');
	shL('navlife3','hide');
	shL('navlife4','hide');
	shL('navlife5','hide');
	shL('navlife6','hide');
	shL('navlife7','hide');
}

function clearMort() {
	shL('navmort1','hide');
	shL('navmort2','hide');
	shL('navmort3','hide');
	shL('navmort4','hide');
	shL('navmort5','hide');
	shL('navmort6','hide');
	shL('navmort7','hide');
	shL('navmort31','hide');
}

function clearMort31() {
	shL('navmort31','hide');
}

function clearSave() {
	shL('navsave1','hide');
	shL('navsave2','hide');
	shL('navsave3','hide');
	shL('navsave4','hide');
	shL('navsave5','hide');
	shL('navsave6','hide');
	shL('navsave7','hide');
	clearSave1();
}

function clearSave1() {
	shL('navsave11','hide');
	shL('navsave12','hide');
	shL('navsave13','hide');
	shL('navsave21','hide');
	shL('navsave22','hide');
	shL('navsave23','hide');
	shL('navsave31','hide');
	shL('navsave32','hide');
	shL('navsave33','hide');
	shL('navsave51','hide');
	shL('navsave61','hide');
}

function clearOnserv() {
	shL('navonserv1','hide');
	shL('navonserv2','hide');
}

function layerMenuOn() {
	shL('off','show');
}



function showRightHandMenu() {
	shL('rightnav','show');
	shL('rightnav2','show');
}

function closeAllRight() {
	shL('rightnav','hide');
	shL('rightnav2','hide');
	shL('rightall','hide');
}

function showAllRight() {
	doMenuShift();
	shL('rightnav','show');
	shL('rightnav2','show');
	shL('rightall','show');
}
function reloadPage(init) {
//	if (init==true) with (navigator)
//		{
//			if ((appName=="Netscape") && (parseInt(appVersion)==4))
//			{
//				document.pgW=innerWidth;
//				document.pgH=innerHeight;
//				onresize=reloadPage;
//			 }
//		 }
//		 else if (innerWidth!=document.pgW || innerHeight !=document.pgH)
//				location.reload();
}


