// Javascript Document

//FUNCTION TO OPEN ANY POP UP WINDOWS.  DEFAULT H&W ARE SET
function popup(url,w,h,id) {
	if (!w) w = 800;
	if (!h) h = 550;
	if (!id) id = 'popupmain';
	window.open(url,id,'scrollbars,width='+w+',height='+h+',resizable=no,status=1');	
}
function OpenOnlineApp(url,w,h,id) {
	if (!w) w = 850;
	if (!h) h = 600;
	if (!id) id = 'OnlineApp';
	window.open(url,id,'scrollbars,width='+w+',height='+h+',resizable=yes,status=1,address=1');	
}

function GoMortBot(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function OpenMortBot(Control)
{
	var URL;
	URL = document.getElementById(Control).value;
	if(URL != 'None')
		window.open(URL,"_blank","toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes, resizable=yes,copyhistory=yes,width=900,height=700,help=yes")
}

	function ShowHideRegionDiv(DivID,hlID,divContainerID)
{
	var dRegion = document.getElementById(DivID);
	var hl = document.getElementById(hlID);
	var dContainer = document.getElementById(divContainerID);
	if (dRegion != null && hlID != null && dContainer != null)
	{
		//Toggle Element visibility
		if (dRegion.style.visibility == "hidden" || dRegion.style.visibility == '')
		{
			dRegion.style.visibility = "visible";
			hl.innerHTML = "Cancel";
			dContainer.className = "ZipFormOpen";
			return ("open");
		}
		else
		{
			dRegion.style.visibility = "hidden";
			hl.innerHTML = "Change";
			dContainer.className = "ZipFormClosed";
			return ("closed");
		}
	}
	else
	{
		return ('');
	}
}

function ShowHideRegionForm() {
		var action = ShowHideRegionDiv('dZipForm', 'hlShow', 'dZipContainer');

		if (action == "open") {
			
		}
		else if (action == "closed") {
			
		}
	}
	
	function SubmitZipAndClose() {
		var tbZip = document.getElementById('tbZip');
		var ltError = document.getElementById('lbZipError');
		
		if(tbZip) {
			document.zipform.submit();
			/*if (isUSZip(tbZip.value, true))
			{
			
				CommonHeader.RegionLookup(tbZip.value, GetRegionFromZip_callback);
			}
			else
			{
				dcsMultiTrack('DCS.dcsuri', '/regionalization/topnav/error_invalid');
				ltError.innerHTML = RGN_ERROR_INVALID;
				ltError.style.visibility = "visible";
			}*/
		}
	}
	
function Resize(modifier) {
	if (modifier == 1) {
		document.body.style.fontSize = "78%";
	}
	else if (modifier == 2) {
		document.body.style.fontSize = "95%";
	}
	else {
		document.body.style.fontSize = "62.5%";
	}
}

function HPApply(ob) {
	var obselect = ob
	if (obselect.value == "") {
	}
	else {
		if (document.ApplyAccountForm.applyaccount.value = "") {
			alert('Please select an account to apply for.');
		}
		else {
		document.ApplyAccountForm.submit();
		}
	}
}

function ApplyForAccount() {
	var e = document.getElementById("applyaccount");
	var strAcct = e.options[e.selectedIndex].value;
//	alert(e.options[e.selectedIndex].value);
	if (strAcct == "") {
		alert('Please select an account to apply for.');
	}
	else {
	document.ApplyAccountForm.submit();
	}
}
