function OpenWindow(URL,Name,features, wWidth, wHeight, wCenter) { //v3.0
  if(window.screen)if(wCenter)if(wCenter=="true"){
    var wLeft = (screen.width-wWidth)/2;
    var wTop = (screen.height-wHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+wLeft+',top='+wTop;
  }
  window.open(URL,Name,features+((features!='')?',':'')+'width='+wWidth+',height='+wHeight);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function swapImage(name, state){
	document.images[name].src = eval( name + state + ".src" );
}

function popupPressRelease(sUrl, sWidth, sHeight) {
	var popup = window.open(sUrl, 'PressRelease','toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,screenX=10,screenY=10,resizable=yes,width=' + sWidth + ',height=' + sHeight, true);
	if(navigator.appName.indexOf('Netscape') != -1) {
		popup.focus();
	}
}
		
function saveData(theURL) {
	window.open(theURL,'saveFile','height=180,width=300,titlebar,scrollbars');
}
	
function checkSaved(file_id,auth) {
	if (auth != "once" && file_id == "") {
		var submitOK = confirm("Area data has not been saved to a file.\nIf you continue without saving, area\ndata will be lost.\n\nAre you sure you want to continue?");
		return submitOK;
	} 
} 

function checkSubmission(file_id,saved) {
	var submitOK = true;
	if (file_id != "" && saved == "") {
		submitOK = confirm("Your Submission data has not been saved to the current file.\n\nAre you sure you want to continue?");
	}
			
	if (submitOK) {
		window.location = "/average_merc_calc_summary.html";
	}
} 
		
function openPrintWindow() {
	var myForm = document.theForm;
	var projTitle = myForm.title.value;
	var projAddress = myForm.address.value;
	var projCity = myForm.city.value;
	var projState = myForm.state.value;
	var projZip = myForm.zip.value;
	var register_date = myForm.reg_month.value + "/" + myForm.reg_day.value + "/" + myForm.reg_year.value;
	var buy_date = myForm.buy_month.value + "/" + myForm.buy_year.value;
	var redirect = "print_merc_app.html?title=" + projTitle + "&address=" + projAddress + "&city=" + projCity + "&state=" + projState + "&zip=" + projZip + "&register_date=" + register_date + "&buy_date=" + buy_date;
	window.open(redirect,'print','height=400,width=650,titlebar,toolbar,menubar,addressbar,scrollbars');
}
		
function deleteFile(file_id) {
	var submitOK = confirm("WARNING:\nAll data related to this file will be lost. This operation cannot be undone.\n\nAre you sure you want to delete this file?");
	if (submitOK) {
		var submitURL = "energy_savings_calc.html?delete=" + file_id;
		window.location = submitURL;
		}
}
			
function changedLamps() {
	alert("The appropriate Philips products have been selected in order to be able to complete the calculations.");
}

function check(contents) {
	if (((contents / contents) != 1) && (contents != 0)) {
		alert('Please enter only a number into this text box');
		return false;
	}
	else return true;
}

function MarkMe(obj) {
	if (obj.style.backgroundColor == "") {
		obj.style.backgroundColor = "#FFFFFF"
	}    
	else obj.style.backgroundColor = "";
}