var d = document;

function backIssues() {
	 self.name = "AppMainWin";
	 var w = window.open("http://www.app.com/app/backissues/","backissues","scrollbars=0,width=250,height=135");
}

function statOn(stat) {
	self.status = stat;
}

function statOff() {
	self.status = "";
}

function togglePromo() {
	if (document.getElementById) {
		with (document.getElementById('circpromo').style) {
			if (display == "block") {
				display = "none";
			}else {
				display = "block";
			}
		}
	}
}
function togglePromo2() {
	if (document.getElementById) {
		with (document.getElementById('circpromo2').style) {
			if (display == "block") {
				display = "none";
			}else {
				display = "block";
			}
		}
	}
}

function submitIt(f) {
	if (f == d.poll) {
		var len = f.answer.length;
		for (var i=0; i<len; i++) {
			if (f.answer[i].checked){return true;}
		}
		alert("You must vote before submitting.");
		return false;
	}
}

function sitemap() {
	window.open("http://www.app.com/app/sitemap/", "sitemap", "scrollbars=1,width=350,height=300");
}



function fnd(item, str)
{
	var tmp = "^" + item + "$";
	if (tmp.indexOf(str) != -1) {
		return true;
	}else {return false;}
}
/* POPUP CALLS */
function popMain() {
	window.name = "homewin";
	window.open("http://www.injersey.com/promo/doyougetit/doyougetit_app.html", "popup_main", "width=300,height=200,scrollbars=no,resizable=no");
}
function popJerseygirl() {
	window.name = "homewin";
	window.open("http://www.injersey.com/jerseygirl/jerseygirl_popup.html", "popup_jerseygirlmonmouth", "width=227,height=275,scrollbars=no");
}
function popMeridian() {
	window.name = "homewin";
	window.open("http://www.injersey.com/promo/meridian/", "popup_meridian", "width=340,height=117,scrollbars=no,resizable=no");
}
function popPooltown() {
	window.name = "homewin";
	window.open("http://www.app.com/popups/pooltown/", "popup_pooltown", "width=250,height=300,scrollbars=no,resizable=no");
}
function popDentistry() {
	window.name = "homewin";
	window.open("http://www.app.com/popups/mancino/", "popup_dentistry", "width=282,height=300,scrollbars=no,resizable=0");
}
function popRecruitment() {
	window.name = "homewin";
	window.open("http://www.app.com/popups/recruitment/", "popup_recruitment", "width=300,height=200,scrollbars=no,resizable=0");
}

/* DETECT SECTION FOR POPUPS */
if (fnd(document.location,"/ocean/$") || fnd(document.location,"/monmouth/$")) {popJerseygirl();}
else if (fnd(d.location,"/jerseylife/$")) {popMeridian();}
else if (fnd(d.location,"/sports/$")) {popPooltown();}
//else if (fnd(d.location,"/community/$")) {popDentistry();}
//else if (fnd(d.location,"app.com/$") || fnd(d.location,"app.com/app/$")) {popMain();}
else if (fnd(d.location,"/webextras/$") || fnd(d.location,"/business/$") || fnd(d.location,"/troubleshooter/$")) {popRecruitment();}