<!--  crw 1.16.2008 standard functions used in zip checking -->

//zip check functions
function viewmamap(pagename, zip, ma)
{
	document.location = pagename + '?zip=' + zip + '&ma=' + ma;
}
function submitMeToMe (clearfirst, pagename, formname)
{
	var frm = getObjectAnyBrowser(formname);
	if (frm!=null)
	{
		if (clearfirst)
			{ frm.marketArea.value=''; }
		frm.action=pagename + '?pb=y#lh';  //lh=land here, the name of the anchor
		frm.submit();
	}
}

function hideZipMessage()
{
	var zm = getObjectAnyBrowser('divZipExplanation');
	if (zm != null)
		zm.style.display="none";
}
function showZipMessage()
{
	var zm = getObjectAnyBrowser('divZipExplanation');
	if (zm != null)
	{
		zm.style.display="block";
		var anc = getObjectAnyBrowser('ancEmailZipCode');
		var zc = getObjectAnyBrowser('txtZip');
		if (anc != null && zc != null) 
		{
			anc.href="emailzipcode.asp?zip=" + zc.value;
		}
		zc.focus();
	}
}
function testZipAndExplain()
{
	var anyzip = getObjectAnyBrowser('txtZip');
		
	if (anyzip === null)
	{
		alert('Unable to test ZIP Code.  Nothing found name [txtZip].');
		return true;   // don't hold up user because of my error
	}
	
	if (anyzip.value === '') 
		return true;
		
	if(!IsZip(anyzip,'Please enter Valid Zip Code.'))
	{
		anyzip.focus();
		return false;
	}
	if (findValueInList('txtZip'	, 'lstAllZipsInMA', '', '', ''))
	{
		hideZipMessage();
		return true;
	}
	else
	{
		showZipMessage();
		return false;
	} 
}
