if (document.images) 
{

	urls = new Array();
	urls[0] = "/gfx/nav/active_arts.png";
	urls[1] = "/gfx/nav/active_commentary.png";
	urls[2] = "/gfx/nav/active_dining.png";
	urls[3] = "/gfx/nav/active_editorial.png";
	urls[4] = "/gfx/nav/active_feature.png";
	urls[5] = "/gfx/nav/active_health.png";
	urls[6] = "/gfx/nav/active_marketplace.png";
	urls[7] = "/gfx/nav/active_national.png";
	urls[8] = "/gfx/nav/active_navback.png";
	urls[9] = "/gfx/nav/active_nightlife.png";
	urls[10] = "/gfx/nav/active_resources.png";
	urls[11] = "/gfx/nav/active_sandiego.png";
	urls[12] = "/gfx/nav/active_social.png";

	urls[13] = "/gfx/nav/hover_classifieds.png";
	urls[14] = "/gfx/nav/hover_placead.png";
	urls[15] = "/gfx/nav/hover_businessdir.png";
	urls[16] = "/gfx/nav/hover_realestate.png";

	urls[17] = "/gfx/nav/hover_contact.png";
	urls[18] = "/gfx/nav/hover_advertise.png";
	urls[19] = "/gfx/nav/hover_about.png";

	for(i=1;i<=19;i++) {
		img = new Image();
		img.src = urls[i];
	}

}

var hoverDebug = Array();
sfHover = function() {
	try
	{

		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	catch(err)
	{
		hoverDebug[0] = err;
	}
}

function setCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
	((expires == null) ? "" : "; expires=" + expires) +
	((path == null) ? "" : "; path=" + path) +
	((domain == null) ? "" : "; domain=" + domain) +
	((secure == null) ? "" : "; secure");
}

function getCookie(name) {
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if (end == -1) end = dc.length;
				return unescape(dc.substring(begin, end));
		}
	}
	return null;
}

function openWin(url) {
	if (navigator.appName.indexOf("WebTV") != -1) {
		top.location = url;
	} else {
		pw = window.open(url,'MailingLists','width=430,height=220,scrollbars=yes,resizable=no,status=yes');
	}
}

function showHide(aBox) {
	toggleBox = document.getElementById(aBox);
	if (toggleBox.style.visibility == 'visible') {
		toggleBox.style.visibility = 'hidden';
		toggleBox.style.display = 'none';
	} else {
		toggleBox.style.visibility = 'visible';
		toggleBox.style.display = 'block';
		toggleBox.style.zIndex = '5000';
	}
}

function swapImg(imgType, imgLink, img) {
	img.src = "/gfx/nav/" + imgType + "_" + imgLink + ".png";
}

function submitForm()
{
	var continueToSubmit = true;
	if( continueToSubmit && document.optin.OILB_EMAIL.value.length != 0 )
	{
		var emailValue = document.optin.OILB_EMAIL.value;
		if( ( emailValue.indexOf( '@' ) <= 0 ) || ( emailValue.indexOf( '.', emailValue.indexOf( '@' ) ) <= 0 ) )
	{
			continueToSubmit = false;
			alert('You must provide a valid e-mail address.');
			document.optin.OILB_EMAIL.focus();
		}
	}
	if( continueToSubmit && document.optin.OILB_EMAIL.value.length == 0 )
	{
		continueToSubmit = false;
		alert('You must enter an e-mail address.');
		document.optin.OILB_EMAIL.focus();
	}
	if( continueToSubmit )
	{
		document.optin.submit();
	}
}
