/**
 * pres.js contains common client side function related to presentation
// Copy & Paste the IF block below into each template
if (navigator.appName == "Microsoft Internet Explorer") {
	document.write("<LINK REL=stylesheet HREF=../savings_calculator.asp_files/%22/soladmin/common/ie.css/%22 TYPE=\"text/css\">");	
	document.write("<meta name=\"Cache-Control\" content=\"post-check=0,pre-check=0\">");
} 
else {
	document.write("<LINK REL=stylesheet HREF=../savings_calculator.asp_files/%22/soladmin/common/ns.css/%22 TYPE=\"text/css\">");
	WM_netscapeCssFixCheckIn();
}
 */

function swapImg(daImage, daSrc){
	var objStr,obj;
	  
	// Check to make sure that images are supported in the DOM.
	if(document.images){ // Check to see whether you are using a name, number, or object
		if (typeof(daImage) == 'string') { // This whole objStr nonesense is here solely to gain compatability with ie3 for the mac.
			objStr = 'document.' + daImage;
			obj = eval(objStr);
			obj.src = daSrc;
		} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
			daImage.src = daSrc;
		}
	}
}


// It gets around another unfortunate bug whereby Netscape fires a resize event when the scrollbars pop up. This 
// checks to make sure that the window's available size has actually changed.
function WM_netscapeCssFix() {
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

// This function checks to make sure the version of Netscape in use contains the bug; if so, it records the window's 
// width and height and sets all resize events to be handled by the WM_netscapeCssFix() function.
function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}


function toggle(commonName) {
	var tbl;
	var gif;
	var iLength;

	if (document.layers) { // for netscape 
		gif = document.layers(commonName + "gif");
		iLength = document.layers("row" + commonName).length;
		for (var i=0; i<iLength; i++) {
			tbl = document.layers("row" + commonName)[i];
			if (tbl.style.visibility == "show") {
				tbl.style.visibility = "true";
				gif.src = "/images/app/plus.gif";
			}
			else {
				tbl.style.visibility = "hide";
				gif.src = "/images/app/minus.gif";
			}
		}
	}	

	if (document.all) {
		gif = document.all(commonName + "gif");
		iLength = document.all("row" + commonName).length;
		for (var i=0; i<iLength; i++) {
			tbl = document.all("row" + commonName)[i];
			if (tbl.style.display == "") {
				tbl.style.display = "none";
				gif.src = "/images/app/plus.gif";
			}
			else {
				tbl.style.display = "";
				gif.src = "/images/app/minus.gif";
			}
		}
	}
}

function expandAll(){
	var tables = document.all.tags("table");
	for(var i = 0; i < tables.length; i++){
		tables[i].style.display = "";
	}
}

function openNewWindow(url)	{
	var width=300;
	var height=150;
	openNewWindow(url, width, height)
}

function openNewWindow(url, width, height)	{

	// adds 18 pixels to Netscape new window height
	// so the two browsers view the quiz the same

	var browser = navigator.appName;
	if (browser.indexOf("Net") != -1){
		height += 18
	}
	// done checking browser
		
	var feature = 'toolbar=no,titlebar=no,location=no,directories=no,status=no,' + 
				  'menubar=no,resizable=yes,copyhistory=no,fullscreen=no,scrollbars=yes,' +
				  'width=' + '600' + ',height=' + '500'
	var Win = window.open(url,'comm', feature);		
	if (Win.opener == null) Win.opener = this;
}


function openNewWindow2(url, width, height)	{

	// adds 18 pixels to Netscape new window height
	// so the two browsers view the quiz the same

	var browser = navigator.appName;
	if (browser.indexOf("Net") != -1){
		height += 18
	}
	// done checking browser
		
	var feature = 'toolbar=no,titlebar=no,location=no,directories=no,status=no,' + 
				  'menubar=no,resizable=yes,copyhistory=no,fullscreen=no,scrollbars=yes,' +
				  'width=' + width + ',height=' + height
	var Win = window.open(url,'comm', feature);		
	if (Win.opener == null) Win.opener = this;
}



function sort(field)	{
  alert('sort by ' + field)
}

function expandAll(){
	var tables = document.all.tags("table");
	for(var i = 0; i < tables.length; i++){
		tables[i].style.display = "";
	}
}

function goToServer (newPage) {
	location.href = changeURL(newPage); 
}

function goToNewPage (newPage) {
	location.replace(changeURL(newPage)); 
}

function reload() {
	window.location = self.location;
}


function formFocus (e) {
  if (e) {
    e.focus();
  }
}