// 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 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";
			}*/
		}
	}