/*----------------------------------------------------
functions.js

Functions used in the operation of amegymortgage.com
Written by Chuck Campbell, Websoft Publishing Company.
05/07/2008
-----------------------------------------------------*/


function displayMailLink(AccountName,Domain,Subject,LinkText) {
	document.write("<a href=" + "mail" + "to:" + AccountName + "@" + Domain + "?subject=" + Subject + ">" + LinkText + "</a>") ;
}
function openWindow(w,h,x,y,url) {
	var openString = "scrollbars=yes,width=" + w + ",height=" + h + ",top=" + y + ",left=" + x;
	var programs = window.open("","programs",openString);
	programs.location.href = url;
		if (programs.opener == null) programs.opener = window;
	programs.opener.name = "opener";
}
function displayData(html) {
	var section = document.getElementById(html);
	if (section.style.display == "none") {
		section.style.display = "block";
	}
	else {
		section.style.display = "none";
	}
}
function printIt() {
	print();
}

function displayFlash(URL,codebase,width,height,bgcolor) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\n');
	if (codebase == 'true') {
		document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"\n');
	}
	document.write('width="' + width + '" height="' + height + '" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="' + URL + '" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="' + bgcolor + '" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	if (codebase == 'true') {
		document.write('<embed src="' + URL + '" wmode="transparent" quality="high" width="' + width + '" height="' + height + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	}
	else {
		document.write('<embed src="' + URL + '" wmode="transparent" quality="high" width="' + width + '" height="' + height + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" />\n');
	}
	document.write('</object>\n');
}
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;

function show(sw,obj,sub) {
	obj = obj.replace(" ","");
	obj = obj.toLowerCase();
	if (sw == true) {
		// hide menus that are not being moused over
		switch (obj) {
			case "company":
				show(false,"residential",true);
				show(false,"construction",true);
				show(false,"commercial",true);
				show(false,"customerservice",true);
			case "residential":
				show(false,"company",true);
				show(false,"construction",true);
				show(false,"commercial",true);
				show(false,"customerservice",true);
			case "construction":
				show(false,"company",true);
				show(false,"residential",true);
				show(false,"commercial",true);
				show(false,"customerservice",true);
			case "commercial":
				show(false,"company",true);
				show(false,"residential",true);
				show(false,"construction",true);
				show(false,"customerservice",true);
			case "customerservice":
				show(false,"company",true);
				show(false,"residential",true);
				show(false,"construction",true);
				show(false,"commercial",true);
		}
	}
	// show/hide the divisions
	if (sw && (ie4 || ie5) ) {
		//document.images[obj].src = eval("nav_" + obj + "_on.src");
		obj = obj + "_menu"
		obj = eval(document.all[obj]);
		var phase = "visible";
		var phase2 = "block";
	}
	if (!sw && (ie4 || ie5) ) {
		//document.images[obj].src = eval("nav_" + obj + "_off.src");
		obj = obj + "_menu"
		obj = eval(document.all[obj]);
		var phase = "hidden";
		var phase2 = "none";
	}
	if (sw && ns4) {
		//document.images[obj].src = eval("nav_" + obj + "_on.src");
		obj = obj + "_menu"
		obj = eval(document.layers[obj]);
		var phase = "visible";
		var phase2 = "block";
	}
	if (!sw && ns4) {
		//document.images[obj].src = eval("nav_" + obj + "_off.src");
		obj = obj + "_menu"
		obj = eval(document.layers[obj]);
		var phase = "hidden";
		var phase2 = "none";
	}
	if (sw && ns6) {
		//document.images[obj].src = eval("nav_" + obj + "_on.src");
		if (sub == true) {
			obj = obj + "_menu"
			obj = eval(document.getElementById(obj))
			var phase = "visible";
			var phase2 = "block";
		}
	}
	if (!sw && ns6) {
		//document.images[obj].src = eval("nav_" + obj + "_off.src");
		if (sub == true) {
			obj = obj + "_menu"
			obj = eval(document.getElementById(obj))
			var phase = "hidden";
			var phase2 = "none";
		}
	}
	if (sub == true) {
		obj.style.visibility = phase;
		obj.style.display = phase2;
	}
}
function hideAll() {
	show(false,"company",true);
	show(false,"residential",true);
	show(false,"construction",true);
	show(false,"commercial",true);
	show(false,"customerservice",true);
}
