var TemplateImagePath = 'http://www.phillyburbs.com/pb-dyn/images/default/template/';
var baseHREF = 'http://www.phillyburbs.com/pb-dyn/';
var OAS_url = 'http://del1.phillyburbs.com/RealMedia/ads/';

var sectionID;
var sportsID;
var sitepage;
var menuNo;
var paperImage;
var sitedate;
var edition;
var username;
var firstname;
var zipcode=19102;
var _condition;
var userid;
var expYears = 10;
var site = 'www.phillyburbs.com';
var subscribe;

var expdate = new Date();
expdate.setTime(expdate.getTime() + (1000 * 60 * 60 * 24 * expYears * 365));

var d = new Date();
sitedate = (d.getMonth()+1) + '/' + d.getDate() + '/' + d.getFullYear();

edition = GetCookie('myEdition');

if ((GetCookie('myZone') == "6") || (GetCookie('myZone') == "7")){
	sectionId = 112;
	sportsID = 109;
	menuNo = 3;
	paperImage = "pb_bct.gif";
	sitepage = "burlingtoncountytimes";
	subscribe = "http://www.phillyburbs.com/pb-dyn/page.cfm?name=subbct";
	}
else if ((GetCookie('myZone') == "1") || (GetCookie('myZone') == "2") || (GetCookie('myZone') == "5")){
	sectionId = 113;
	sportsID =110;
	menuNo = 2;
	paperImage = "pb_cni.gif";
	sitepage = "intelligencerrecord";
	subscribe = "http://www.phillyburbs.com/pb-dyn/page.cfm?name=subcni";
	}
else if ((GetCookie('myZone') == "3") || (GetCookie('myZone') == "4")){
	sectionId = 111;
	menuNo = 1;
	sportsID = 108;
	paperImage = "pb_cti.gif";
	sitepage = "couriertimes";
	subscribe = "https://www.formrouter.net/circulation@BUCKS/index.htm";
	}
else{
	sectionId = 0;
	sportsID = 108;
	menuNo = 0;
	paperImage = "pb_all.gif";
	sitepage = "";
	subscribe = "http://www.phillyburbs.com/pb-dyn/page.cfm?name=sub";
}

if(edition == null || edition == "")
	edition = 'Standard';

if(GetCookie('firstname') == null)
	firstname = GetCookie('username');
else
	firstname = GetCookie('firstname');
	
if(GetCookie('myZip') != null)
	zipcode = GetCookie('myZip');

function open_mw_window_new(url, name, properties) {
	window.open (url, name, properties);
}

function popup(desktopURL)
{
  var desktop = window.open(desktopURL, "_blank", "toolbar=no,location=no,status=no,menubar=yes,scrollbars=no,width=450,height=300,resizable=no" );
}

function _go(url) {
	window.open (url);
}

function stock_search (ticker) {
  window.open("http://www.phillyburbs.com/pb-dyn/apmoneywire.asp?company=" + ticker, "secondWindow","scrollbars=no,width=600, height=500");
  return false;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
var doc=document;
var dZ="Zip";
function verifyYP() {
var origTXTCat=escape("Keyword(s)");
var origTXTName =escape("Business Name");
var sC = escape(doc.swbgetcat.C.value);
var sL = escape(doc.swbgetcat.L.value);
var sT = escape(doc.swbgetcat.T.value);
var sS = escape(doc.swbgetcat.S.value);
var sA = escape(doc.swbgetcat.A.value);
var sZ = escape(doc.swbgetcat.Z.value);
if(sC==origTXTCat){sC="";}
if(sL==origTXTName){sL="";}
if(sT=="*Town" ||sT=="Town" ){sT="";}
if(sS=="*ST" ||sS=="ST"){sS="";}
if(sA==escape("Street Address")){sA="";}	  
if(sZ==escape(dZ)){sZ="";}	 	  
   	if(doc.swbgetcat.ST[1].checked){
    	//search in
    	if ((sC == "") && (sL == "")) {
   
alert("Please enter a Category or Business Name.");
    
doc.swbgetcat.C.focus();
doc.swbgetcat.C.select();
    
return false;
   
}
    	if ((sZ=="") && (sS == "") && (sT !== "")){
   
alert("Please choose a State.");
    
doc.swbgetcat.S.focus();
doc.swbgetcat.S.select();
    
return false;
   
}
    
}else{
//search near
    	if (sT==""&&sS==""&&sZ=="") {
    
alert('Please enter a city and state');
    
doc.swbgetcat.T.focus();
    	    return false;
    	    }
    	if (sT!=""&&sS==""&&sZ=="") {
    
alert('Please enter a state when searching in a city.');
    
doc.swbgetcat.S.focus();
doc.swbgetcat.S.select();
    
    	    return false;
    	    }
}
if(sC==""){doc.swbgetcat.C.value="";}
if(sL==""){doc.swbgetcat.L.value="";}
if(sT==""){doc.swbgetcat.T.value="";}
if(sS==""){doc.swbgetcat.S.value="";}
if(sA==""){doc.swbgetcat.A.value="";}
if(sZ==""){doc.swbgetcat.Z.value="";}
return true;
}

//function for main menu
sfHover = function(){
	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"), "");
		}
	}
}//end function

if (window.attachEvent) window.attachEvent("onload", sfHover);

/*if (document.images) 
{
   img1 = new Image();
   img2 = new Image();
   img3 = new Image();
   img4 = new Image();
   img5 = new Image();
   img6 = new Image();
   img1.src = "http://www.phillyburbs.com/pb-dyn/images/default/template/as06.gif";
   img2.src = "http://www.phillyburbs.com/pb-dyn/images/default/template/bs06.gif";
   img3.src = "http://www.phillyburbs.com/pb-dyn/images/default/template/cs06.gif";
   img4.src = "http://www.phillyburbs.com/pb-dyn/images/default/template/js06.gif";
   img5.src = "http://www.phillyburbs.com/pb-dyn/images/default/template/hs06.gif";
   img6.src = "http://www.phillyburbs.com/pb-dyn/images/default/template/paperedge06.gif";
}*/

function _skip(the_option){
	var bgood;	
	var break_option = the_option.split(",");
	bgood = _setZipCookie(break_option[0], break_option[1], break_option[2]);
	
	window.location='http://www.phillyburbs.com/pb-dyn/section.cfm?id='+break_option[3]+'&tmpl=news';
}

function _setZipCookie(zipCode, zone, edition){
	
	var expdate = new Date();
	expdate.setTime(expdate.getTime() + (1000 * 60 * 60 * 24 * expYears * 365));

	SetCookie('myZip', zipCode, expdate, '/', '.phillyburbs.com');
	SetCookie('myZone', zone, expdate, '/', '.phillyburbs.com');
	SetCookie('myEdition', edition, expdate, '/', '.phillyburbs.com');
	return true;
}