document.write("<style type='text/css'>tbody, thead, th, td, tr {border-bottom: none; border-top:none;}</style>");



var fullurl = location.href;

var dpc_calendar_idCat = "all";

var dpc_calendar_idCounty = "all";

var dpc_calendar_iEdition = "all";



//This is for the test site where we are using all/all and not zoning DAV 05/12/08

if (fullurl.indexOf("digitalpressconsortium.com")==-1)

{



if (

	fullurl.indexOf("gazette.net/calendar/") == -1

	)

{if (document.getElementById("idCategory")) {dpc_calendar_idCat = document.getElementById("idCategory").value;}

if (document.getElementById("idCounty")) {dpc_calendar_idCounty = document.getElementById("idCounty").value;}

if (document.getElementById("idEdition")) {dpc_calendar_iEdition = document.getElementById("idEdition").value;}

}





if (dpc_calendar_idCat == "" || null == dpc_calendar_idCat || typeof(dpc_calendar_idCat) == "undefined") {dpc_calendar_idCat = "all";}

	if (dpc_calendar_idCounty == "" || null == dpc_calendar_idCounty || typeof(dpc_calendar_idCounty) == "undefined") {dpc_calendar_idCounty = "all";}

	if (dpc_calendar_iEdition == "" || null == dpc_calendar_iEdition || typeof(dpc_calendar_iEdition) == "undefined") {dpc_calendar_iEdition = "all";}

}	



function getAds(categorycode,countycode,editioncode) {

	var fullurl2 = location.href;

//This is for the test site where we are using all/all and not zoning DAV 05/12/08

if (fullurl.indexOf("digitalpressconsortium.com")==-1)

{



if (

	fullurl2.indexOf("gazette.net/calendar/") == -1

	)

{

	if ((categorycode == "" || null == categorycode || typeof(categorycode) == "undefined") && document.getElementById("idCategory")) {categorycode = document.getElementById("idCategory").value;}

	if ((countycode == "" || null == countycode || typeof(countycode) == "undefined") && document.getElementById("idCounty")) {countycode = document.getElementById("idCounty").value;}

	if ((editioncode == "" || null == editioncode || typeof(editioncode) == "undefined") && document.getElementById("idEdition")) {editioncode = document.getElementById("idEdition").value;}

}

}

	

	//countycode is county

//edition is edition

//categorycode is category







var cat_ran_unrounded=Math.random()*2;

var cat_ran_number=Math.floor(cat_ran_unrounded);

var co_ran_unrounded=Math.random()*2;

var co_ran_number=Math.floor(co_ran_unrounded);

var all_ran_unrounded=Math.random()*2;

var all_ran_number=Math.floor(all_ran_unrounded);

var all_all_ran_unrounded=Math.random()*2;

var all_all_ran_number=Math.floor(all_all_ran_unrounded);

var ch_cat_ran_unrounded=Math.random()*10;

var ch_cat_ran_number=Math.floor(ch_cat_ran_unrounded);

var ch_co_ran_unrounded=Math.random()*3;

var ch_co_ran_number=Math.floor(ch_co_ran_unrounded);

var oldcounty;

var oldcategory;









var writeleader;

var writeclassad;

var mycounty = "all";

var leadercode;

var mycategory = "all";

var writeskyscraper;

var skyscrapercode;

//var fullurl = location.href;

var myElements = fullurl.split("/");

//var categorycode = myElements[4];

//var countycode = myElements[5];

//var editioncode = myElements[5];







//var addchars1 = 3;

//var testit = fullurl.indexOf("gazette.net");

//var pastfirstslash = fullurl.indexOf("gazette.net") + 21;

//var urllength = fullurl.length;

//var templength = urllength;

//var getparams = fullurl.substring(pastfirstslash,urllength);

//templength = getparams.length;

//var loseyear = getparams.indexOf("/") + 1;

//var yearend = getparams.substring(loseyear,templength);

//var losemonth = yearend.indexOf("/") + 1;

//templength = yearend.length;

//var monthend = yearend.substring(losemonth,templength);

//var loseday = monthend.indexOf("/") + 1;

//var starthere1 = pastfirstslash + loseyear + losemonth + loseday;

//var starthere1 = fullurl.indexOf("gazette.net") + 32;

//var urltrunc = fullurl.substring(starthere1,urllength);

//var categorycode = urltrunc.substring(0,urltrunc.indexOf("/"));

//var startcounty = urltrunc.indexOf("/") + 1;

//var tempcounty = urltrunc.substring(startcounty,urltrunc.length);

//var countycode = tempcounty.substring(0,tempcounty.indexOf("/"));

//var startedition = tempcounty.indexOf("/") + 1;

//var tempedition = tempcounty.substring(startedition,tempcounty.length);

//var theend = tempcounty.length;

//var checklength = tempedition.substring(0,theend).length;

//if (checklength > 3) {theend = tempedition.indexOf("/");}

//var editioncode = tempedition.substring(0,theend);



//var starthere3 = starthere1;

//var endhere3 = starthere3 + 3;

//var categorycode = fullurl.substring(starthere3,endhere3);

//if (categorycode.indexOf("/") != -1) {categorycode = fullurl.substring(starthere3,starthere3+2);} else {starthere1 = starthere1+1;}

//var testforall1 = fullurl.substring(starthere1,starthere1+3);

//if (testforall1.indexOf("all") == 0) {addchars1 = 4;}

//starthere1 = starthere1 + addchars1;

//var endhere1 = starthere1 + 2;

//var starthere2 = endhere1 + 1;

//var endhere2 = starthere2 + 2;

//var countycode = fullurl.substring(starthere1,endhere1);

//if (countycode == "al") {starthere2 = starthere2 + 1; endhere2 = endhere2 + 1;}

//var editioncode = fullurl.substring(starthere2,endhere2);

//if (editioncode.indexOf("/") != -1) {editioncode = fullurl.substring(starthere2,starthere2+1);}

//if (editioncode.indexOf("/") != -1) {editioncode = fullurl.substring(starthere2,starthere2);}





 

//if (

	//fullurl.indexOf("gazette.net/node") != -1

	//)

//{countycode = document.getElementById("idCounty").value; editioncode = document.getElementById("idEdition").value; categorycode = document.getElementById("idCategory").value;}





//This is for the test site where we are using all/all and not zoning DAV 05/12/08

if (fullurl.indexOf("digitalpressconsortium.com")==-1)

{







if (countycode.length == 4) {editioncode = countycode;}

if (countycode == "" || null == countycode || typeof(countycode) == "undefined") {countycode = "all";}

if (editioncode == "" || null == editioncode || typeof(editioncode) == "undefined") {editioncode = "all";}

if (categorycode == "" || null == categorycode || typeof(categorycode) == "undefined") {categorycode = "all";}



if (countycode == "all") {mycounty = "all";}

if (categorycode == "all") {mycategory = "all";}





//start counties



//fredcarroll

if (

countycode == "73" || countycode == "80"

)

{mycounty = "fredcarroll";

}



//pg

if (

countycode == "59"

)

{mycounty = "pg";

}



//montgomery

if (

countycode == "41"

)

{mycounty="montgomery";

}



if (

countycode == "195"

)

{mycounty="all";

}



//frederick & carroll -- editions which override county choice if conflict

if (

editioncode >= 1393 && editioncode <= 1402

)

{mycounty = "fredcarroll";

}



//pg -- editions which override county choice if conflict

if (

editioncode >= 1380 && editioncode <= 1392

)

{mycounty = "pg";

}



//montgomery -- editions which override county choice if conflict

if (

editioncode >= 1362 && editioncode <= 1379

)

{mycounty="montgomery";

}





// end for counties



//start categories





if (

categorycode >= 181 && categorycode <= 190 

)

{mycategory = "education";

}



if (

categorycode == "90" || categorycode == "113" || (categorycode >= 117 && categorycode <= 131) || categorycode == "193"

)

{mycategory = "community";

}



if (

categorycode == "83" || (categorycode >= 161 && categorycode <= 180) || categorycode == "199"

)

{mycategory = "arts";

}



if (

categorycode == "106" || (categorycode >= 158 && categorycode <= 160) || categorycode == "192"

)

{mycategory = "politics";

}



if (

categorycode == "86" || (categorycode >= 152 && categorycode <= 156)

)

{mycategory = "business";

}



if (

categorycode == "99" || (categorycode >= 132 && categorycode <= 136) 

)

{mycategory = "health";

}



if (

categorycode == "116" || (categorycode >= 137 && categorycode <= 141) 

)

{mycategory = "volunteer";

}



if (

categorycode == "107" || (categorycode >= 142 && categorycode <= 148) 

)

{mycategory = "religion";

}



if (

categorycode == "111" || (categorycode >= 149 && categorycode <= 151) || categorycode == "194" || categorycode == "198"

)

{mycategory = "sports";

}



if (

categorycode == "197"

)

{mycategory = "all";

}



if (

categorycode == "200" 

)

{mycategory = "family friendly";

}



//To account for advertisers who bought all categories, we will randomly pick either the specific category or all depending on this random number

//if (cat_ran_number == 0) {oldcategory = mycategory; mycategory = "all";}



//To account for advertisers who bought all counties, we will randomly pick either the specific county or all depending on this random number

//if (co_ran_number == 0) {oldcounty = mycounty; mycounty = "all";}



//We cannot have all counties & all categories (we don't sell ads that way), so let's check for that. If it happened (because of the random numbers) we will change either county or category back to old value. Which one changes depends on a random number, but if one of the old values is all, we leave it alone and change the other value, ignoring the random number. Otherwise, we're back at all counties & all categories. My brain hurts!!!

if (mycounty == "all" && mycategory == "all") {

if (all_ran_number == 0 && oldcategory != "all") {mycategory = oldcategory;}

if (all_ran_number == 1 && oldcounty != "all") {mycounty = oldcounty;}

}



if (mycounty == "all" && mycategory == "all") {

	if (all_all_ran_number == 0) {

		//change cateogry

		if (ch_cat_ran_number == 0) {mycategory = "sports";}

		if (ch_cat_ran_number == 1) {mycategory = "religion";}

		if (ch_cat_ran_number == 2) {mycategory = "volunteer";}

		if (ch_cat_ran_number == 3) {mycategory = "health";}

		if (ch_cat_ran_number == 4) {mycategory = "business";}

		if (ch_cat_ran_number == 5) {mycategory = "politics";}

		if (ch_cat_ran_number == 6) {mycategory = "arts";}

		if (ch_cat_ran_number == 7) {mycategory = "community";}

		if (ch_cat_ran_number == 8) {mycategory = "education";}

		if (ch_cat_ran_number == 9) {mycategory = "family friendly";}

	}

	else {

		//change county

		if (ch_co_ran_number == 0) {mycounty = "montgomery";}

		if (ch_co_ran_number == 1) {mycounty = "fredcarroll";}

		if (ch_co_ran_number == 2) {mycounty = "pg";}

	}

}

		

		



//montgomery



if (mycounty == "montgomery") {

	

if (mycategory == "all") {

leadercode = "291584";

skyscrapercode = "291530";

}



if (mycategory == "arts") {

	

	leadercode = "291521";

	skyscrapercode = "291531";

}



if (mycategory == "business") {

	leadercode = "291522";

	skyscrapercode = "291532";

}



if (mycategory == "community") {

	leadercode = "291523";

	skyscrapercode = "291533";

}



if (mycategory == "education") {

	leadercode = "291524";

	skyscrapercode = "291534";

}



if (mycategory == "health") {

	leadercode = "291525";

	skyscrapercode = "291535";

}



if (mycategory == "politics") {

	leadercode = "291526";

	skyscrapercode = "291536";

}



if (mycategory == "religion") {

	leadercode = "291527";

	skyscrapercode = "291537";

}



if (mycategory == "sports") {

	leadercode = "291528";

	skyscrapercode = "291538";

}



if (mycategory == "volunteer" || mycategory == "family friendly") {

	leadercode = "291529";

	skyscrapercode = "291539";

}

}





//pg



if (mycounty == "pg") {

	

if (mycategory == "all") {

leadercode = "291549";

skyscrapercode = "291540";

}



if (mycategory == "arts") {

	leadercode = "291550";

	skyscrapercode = "291541";

}



if (mycategory == "business") {

	leadercode = "291556";

	skyscrapercode = "291542";

}



if (mycategory == "community") {

	leadercode = "291557";

	skyscrapercode = "291543";

}



if (mycategory == "education") {

	leadercode = "291551";

	skyscrapercode = "291572";

}



if (mycategory == "health") {

	leadercode = "291558";

	skyscrapercode = "291544";

}



if (mycategory == "politics") {

	leadercode = "291552";

	skyscrapercode = "291545";

}



if (mycategory == "religion") {

	leadercode = "291553";

	skyscrapercode = "291546";

}



if (mycategory == "sports") {

	leadercode = "291554";

	skyscrapercode = "291547";

}



if (mycategory == "volunteer") {

	leadercode = "291555";

	skyscrapercode = "291548";

}

}





//fredcarroll



if (mycounty == "fredcarroll") {

	

if (mycategory == "all") {

leadercode = "291511";

skyscrapercode = "291573";

}



if (mycategory == "arts") {

	leadercode = "291512";

	skyscrapercode = "291574";

}



if (mycategory == "business") {

	leadercode = "291513";

	skyscrapercode = "291575";

}



if (mycategory == "community") {

	leadercode = "291514";

	skyscrapercode = "291576";

}



if (mycategory == "education") {

	leadercode = "291515";

	skyscrapercode = "291578";

}



if (mycategory == "health") {

	leadercode = "291516";

	skyscrapercode = "291579";

}



if (mycategory == "politics") {

	leadercode = "291517";

	skyscrapercode = "291580";

}



if (mycategory == "religion") {

	leadercode = "291518";

	skyscrapercode = "291581";

}



if (mycategory == "sports") {

	leadercode = "291519";

	skyscrapercode = "291582";

}



if (mycategory == "volunteer") {

	leadercode = "291520";

	skyscrapercode = "291583";

}

}









//all counties



if (mycounty == "all") {

	

//if (mycategory == "all") {

//leadercode = "291651";

//skyscrapercode = "291652";

//}



if (mycategory == "arts") {

	leadercode = "291653";

	skyscrapercode = "291654";

}



if (mycategory == "business") {

	leadercode = "291655";

	skyscrapercode = "291656";

}



if (mycategory == "community") {

	leadercode = "291657";

	skyscrapercode = "291658";

}



if (mycategory == "education") {

	leadercode = "291660";

	skyscrapercode = "291659";

}



if (mycategory == "health") {

	leadercode = "291661";

	skyscrapercode = "291662";

}



if (mycategory == "politics") {

	leadercode = "291663";

	skyscrapercode = "291664";

}



if (mycategory == "religion") {

	leadercode = "291665";

	skyscrapercode = "291666";

}



if (mycategory == "sports") {

	leadercode = "291667";

	skyscrapercode = "291668";

}



if (mycategory == "volunteer") {

	leadercode = "291670";

	skyscrapercode = "291669";

}

}



//alert (mycounty);

//alert (mycategory);

//alert (countycode);

//alert (editioncode);

//alert (categorycode);



if (leadercode == "" || null == leadercode || typeof(leadercode) == "undefined") {leadercode = "291584";}

if (skyscrapercode == "" || null == skyscrapercode || typeof(skyscrapercode) == "undefined") {skyscrapercode = "291530";}



//This is for the test site where we are using all/all and not zoning DAV 05/12/08

}



else

{

leadercode="291651";

skyscrapercode="291652";

}



//alert(leadercode);

writeleader="<iframe width='728' height='90' noresize scrolling=No frameborder=0 marginheight=0 marginwidth=0 src='http://rotator.adjuggler.com/servlet/ajrotator/" + leadercode + "/0/vh?z=gazette&dim=108623'><scr" + "ipt language=JavaScript src='http://rotator.adjuggler.com/servlet/ajrotator/" + leadercode + "/0/vj?z=gazette&dim=108623&abr=$scriptiniframe'><\/scr" + "ipt>\<noscr" + "ipt><a href='http://rotator.adjuggler.com/servlet/ajrotator/" + leadercode + "/0/cc?z=gazette'><img src='http://rotator.adjuggler.com/servlet/ajrotator/" + leadercode + "/0/vc?z=gazette&dim=108623&abr=$imginiframe' width='728' height='90' border='0'></a><\/noscr" + "ipt></iframe>";





writeskyscraper="<iframe width='160' height='600' noresize scrolling=No frameborder=0 marginheight=0 marginwidth=0 src='http://rotator.adjuggler.com/servlet/ajrotator/" + skyscrapercode + "/0/vh?z=gazette&dim=124173'><scr" + "ipt language=JavaScript src='http://rotator.adjuggler.com/servlet/ajrotator/" + skyscrapercode + "/0/vj?z=gazette&dim=124173&abr=$scriptiniframe'><\/scr" + "ipt><nosc" + "ript><a href='http://rotator.adjuggler.com/servlet/ajrotator/" + skyscrapercode + "/0/cc?z=gazette'><img src='http://rotator.adjuggler.com/servlet/ajrotator/" + skyscrapercode + "/0/vc?z=gazette&dim=124173&abr=$imginiframe' width='160' height='600' border='0'></a><\/noscr" + "ipt></iframe>";



var newcontent = document.createElement('div');

newcontent.id = "leaderad";

newcontent.innerHTML = writeleader;

var puthere = document.getElementById("promo");

puthere.parentNode.insertBefore(newcontent, puthere);





var newcontent_sky = document.createElement('div');

newcontent_sky.id = "skyad";

newcontent_sky.innerHTML = writeskyscraper;

var puthere_sky = document.getElementById("sky_here");

puthere_sky.parentNode.insertBefore(newcontent_sky, puthere_sky);



	//var newcontent = document.createElement('div');

//newcontent.id = "leaderad";

//newcontent.innerHTML = writeleader;

//var puthere = document.getElementById("promo");

//puthere.parentNode.insertBefore(newcontent, puthere);

}