var estNow = new Date();
var estNowInMillis = estNow.getTime();
var millisFromEST = (estNow.getTimezoneOffset() - 240) * 60000;
var estNow = new Date( estNowInMillis + millisFromEST )

//used for site wide buyout
var fbOverride = false;

adOpsLocalFlag = (typeof adOpsLocalFlag == 'undefined')?false:adOpsLocalFlag;
 

featureBars = new Array ()
//arguments are: wpid, start date in MMDDHHMM, end date in MMDDHHMM, and semi-colon-delimited targeting values

//5358-AK-204099539,rev-10186-AR-216170054
featureBars.push('artsandliving/theater','200907140000','201007142359','');

//10695-AL-216278244
featureBars.push('travel/escapes','200908310000','200910252359','');

//10860-AL-217563443,217563466
featureBars.push('artsandliving/style','200909140000','200909272359','');
featureBars.push('artsandliving/style','200909280000','200910252359','');


function dateToString(date) {
	var yyyy = date.getYear();
	yyyy += (yyyy < 1900 )?1900:0;
	var mm = date.getMonth() + 1;
	var dd = date.getDate();
	var hour = date.getHours();
	var min = date.getMinutes();

	if (mm < 10) mm = "0"+mm;
	if (dd < 10) dd = "0"+dd;
	if (hour < 10) hour = "0"+hour;
	if (min < 10) min = "0"+min;
	return ''+yyyy+mm+dd+hour+min;
}


function checkLoc(locString)
{
returnValue = false
liveSpots = locString.split('|')
for(y=0;y<liveSpots.length;y++)
{
	if((typeof pageId() != 'undefined' && liveSpots[y] == pageId()) || liveSpots[y] == commercialNode)
	returnValue = true;
}
return returnValue;
}

function checkTargeting(targVal)
{
	var returnValue = false;
	var wpatcCookie = getCookie('WPATC');
	if (targVal == '' || wpatcCookie == null) return true;
	targArray = targVal.split(';');
	for(var y=0;y<targArray.length;y++)
	{
		returnValue = (wpatcCookie.match(targArray[y]))?true:false
	}
	
	return returnValue;
}

	var nowFB = dateToString(estNow);

if(fbOverride == false)
{
	for (x=0;x<featureBars.length;x=x+4)
	{
		if (checkLoc(featureBars[x]) && nowFB >= featureBars[x+1] && nowFB <= featureBars[x+2] && checkTargeting(featureBars[x+3]))
		{
			if(commercialNode != 'cityguide' && commercialNode != 'weather')
			{document.writeln ('<div align="left" style="padding:3px 0px 3px 0px"><img src="http://media3.washingtonpost.com/wp-srv/hp/img/ad_label_leftjust.gif" alt="ad_icon" width="100" height="13" border="0"/></div>' );}
			placeAd('SECTION',commercialNode,7,wpid+';ad=fb;',true)
			try{
				document.getElementById('ad7').style.paddingBottom = '5px';
			}catch(err){}
			
			if((commercialNode.match('opinion') || commercialNode.match('politics')) && document.getElementById('ad7'))
			{
				document.getElementById('ad7').style.textAlign = 'left';
			}
			
			if(commercialNode == 'cityguide')
			{
			
				if(document.getElementById('ad7') && document.getElementById('bread_crumbs'))
				{
					document.getElementById('wrapperMain').style.position = 'relative';
					var ad7 = document.getElementById('ad7')
					document.getElementById('bread_crumbs').style.paddingBottom = "15px";
					ad7.style.marginBottom = '5px';
					ad7.style.position = 'absolute';
					ad7.style.top = '0px';
					ad7.style.left = '0px';
				}
			
			}
			break
			
		}
	}
}// JavaScript Document