wpniSite='slate'
wpniDomain='slate.com'
show_doubleclick_ad = true
rssString = "from=rss"
hourScope = 5;
numPop = 2;
tileThatGetsDcopt = 2;

wpniAds.templates.initRule('defaultTemplate');
wpniAds.templates.rules.defaultTemplate.what = new Array('!120x60','!88x31','!120x90','!customcover','!leaderboard_2','!336x90_most','!120x30','!mostread','!pushdown','!rightflex_2','!featurebar','!sponsor','!comment','!tooltile','!rightflex_3','!bigbox_2');

wpniAds.templates.initRule('bmDev');
wpniAds.templates.rules.bmDev.what = new Array('120x90');
wpniAds.templates.rules.bmDev.where = new Array('^bigmoney');

wpniAds.templates.initRule('homepage');
wpniAds.templates.rules.homepage.what = new Array('!leaderboard','!336x90')
wpniAds.templates.rules.homepage.where = new Array('^homepage');
wpniAds.templates.rules.homepage.when= new Array('');

wpniAds.templates.initRule('bizbox');
wpniAds.templates.rules.bizbox.what = new Array('bigbox','!bigbox_2','leaderboard')
wpniAds.templates.rules.bizbox.where = new Array('business/bizbox');
wpniAds.templates.rules.bizbox.when = new Array('200811200000/200911200000');

//10164-GL-213746058,213746105,213746137,213746174,213746182,213746193
wpniAds.templates.initRule('mastercard');
wpniAds.templates.rules.mastercard.what = new Array('mostread');
wpniAds.templates.rules.mastercard.when = new Array('200907070000/200912312359');

//11079-MB
if(front()=='front=n;')
{
wpniAds.templates.initRule('tooltile');
wpniAds.templates.rules.tooltile.what = new Array('tooltile');
wpniAds.templates.rules.tooltile.when = new Array('200909290000/200910252359');
wpniAds.templates.rules.tooltile.hardcodes = '<a href="http://www.yahoo.com" target="_blank" style="border:none"><img src="http://media.washingtonpost.com/wp-adv/advertisers/yahoo/images/yahoo_120x20.gif" alt="" width="120" height="20" border="0"/></a>';
}

//11121-AR
wpniAds.templates.initRule('hyatt');
wpniAds.templates.rules.hyatt.what = new Array('88x31');
wpniAds.templates.rules.hyatt.where = new Array('^arts/todayspictures$');
wpniAds.templates.rules.hyatt.when = new Array('200910050000/200910112359;200910190000/200910252359');
wpniAds.templates.rules.hyatt.hardcodes = '<a href="http://ad.doubleclick.net/clk;218555829;41656607;t?http://www.HyattMeetings.com?src=wp_meet_ba_1009" target="_blank"><img src="http://www.washingtonpost.com/wp-adv/advertisers/hyatt/images/hyatt_154x31.gif" alt="" width="154" height="31" border="0"/></a><img src="http://ad.doubleclick.net/ad/N4300.WashingtonPost/B3955436.10;sz=1x1;ord='+Math.round(Math.random()*10000000000)+'?" alt="" border="0" width="1" height="1" style="display:none"/>';

//11121-AR
wpniAds.templates.initRule('hyatt2');
wpniAds.templates.rules.hyatt2.what = new Array('88x31');
wpniAds.templates.rules.hyatt2.where = new Array('^arts/todayspictures/hyatt$');
wpniAds.templates.rules.hyatt2.when = new Array('200910070000/200911162359');
wpniAds.templates.rules.hyatt2.hardcodes = '<a href="http://ad.doubleclick.net/clk;218555829;41656607;t?http://www.HyattMeetings.com?src=wp_meet_ba_1009" target="_blank"><img src="http://www.washingtonpost.com/wp-adv/advertisers/hyatt/images/hyatt_154x31.gif" alt="" width="154" height="31" border="0"/></a><img src="http://ad.doubleclick.net/ad/N4300.WashingtonPost/B3955436.10;sz=1x1;ord='+Math.round(Math.random()*10000000000)+'?" alt="" border="0" width="1" height="1" style="display:none"/>';

//10052-DG
/*if(front().match(/front=n/))
{
wpniAds.templates.initRule('bottomlb');
wpniAds.templates.rules.bottomlb.what = new Array('leaderboard_2');
wpniAds.templates.rules.bottomlb.when = new Array('200906240000/200907032359');
}*/

//11228-MB-217832168
wpniAds.templates.initRule('dellPushdown');
wpniAds.templates.rules.dellPushdown.what = new Array('pushdown')
wpniAds.templates.rules.dellPushdown.where = new Array('^homepage');
wpniAds.templates.rules.dellPushdown.when = new Array('200911050000/200911052359','200912030000/200912032359');

//11089-AL-219251318
wpniAds.templates.initRule('adobeCustom');
wpniAds.templates.rules.adobeCustom.what = new Array('120x90')
wpniAds.templates.rules.adobeCustom.where = new Array('blogs/kaus');
wpniAds.templates.rules.adobeCustom.when = new Array('200911020000/200911152359');

//11410-AR-219094180,11412-AR-218501736
wpniAds.templates.initRule('siemensLB');
wpniAds.templates.rules.siemensLB.what = new Array('leaderboard','!tiffanytile');
wpniAds.templates.rules.siemensLB.where = new Array('^homepage');
wpniAds.templates.rules.siemensLB.when = new Array('200910260000/200910272359');

if(location.href.match('test_ads=apple-hero'))
{
wpniAds.templates.initRule('applehero');
wpniAds.templates.rules.applehero.what = new Array('!leaderboard','!tiffanytile','!rightflex','!120x240top','!120x240bottom','!mostread','pushdown','rightflex_3');
wpniAds.templates.rules.applehero.where = new Array('^homepage');
wpniAds.templates.rules.applehero.when = new Array('');
}

//11388-AL
/*wpniAds.templates.initRule('apple');
wpniAds.templates.rules.apple.what = new Array('!leaderboard','!tiffanytile','!rightflex','!120x240top','!120x240bottom','!mostread','pushdown','rightflex_3');
wpniAds.templates.rules.apple.where = new Array('^homepage');
wpniAds.templates.rules.apple.when = new Array('200911030000/200911032359');*/


//11548-PM-219105884 
/*wpniAds.templates.initRule('article_tooltile');
wpniAds.templates.rules.article_tooltile.what = new Array('tooltile');
wpniAds.templates.rules.article_tooltile.when = new Array('200911090000/200911152359');*/

//11388-AL
wpniAds.templates.initRule('applehero2');
wpniAds.templates.rules.applehero2.what = new Array('!leaderboard','!tiffanytile','!rightflex','!120x240top','!120x240bottom','!mostread','pushdown','rightflex_3');
wpniAds.templates.rules.applehero2.where = new Array('^homepage');
wpniAds.templates.rules.applehero2.when = new Array('200911120000/200911122359;200911240000/200911242359');



if(front()=='front=n;' && urlCheck('noRightRail'))
{
	document.write('<link href="http://www.washingtonpost.com/wp-srv/ad/css/slate_right_rail.css" type="text/css" rel="stylesheet"/>');
}

function funcPStax()
{
	return (typeof PStax != 'undefined') ? 'dept=' + PStax + ';' : '' ;
}

function initAdType(what)
{
 var thisAdType = new AdInstance()
 thisAdType.testFlagArray = new Array('test_ads','test_' + what); 
 thisAdType.debugFlagArray = new Array('debugAdCode','debug' + what);
 
 thisAdType.dcCode += msnCobrand()  + funcPStax()  + frayId() + articleId() 
 
 switch(what)
 {
  case 'toolbar':
   thisAdType.size = "120x60"
   thisAdType.code = "ad=120x60;"
  break
  
    case 'customcover':
   thisAdType.size = "1x1"
   thisAdType.code = "ad=customcover;"
  break
  
  case 'leaderboard':
   thisAdType.size = "728x90"
   thisAdType.code = "ad=lb;"
  break
  
  case 'bigbox':
   thisAdType.size = "300x250"
   thisAdType.code = "ad=bb;"
  break
  case '150x29':
   thisAdType.size = "150x29"
   thisAdType.code = "ad=150x29;"
  break
  
  case '120x240top':
   thisAdType.size = "120x240"
   thisAdType.code = "ad=120x240;"
  break
  
  case '120x240bottom':
   thisAdType.size = "120x240"
   thisAdType.code = "ad=120x240;"
  break
 
  case '400x140':
   thisAdType.size = "400x140"
   thisAdType.code = "ad=400x140;"
  break
  
  case 'skyscraper':
   thisAdType.size = "160x600"
   thisAdType.code = "ad=ss;"
  break
  
  case 'featurebar':
   thisAdType.size = "446x33"
   thisAdType.code = "ad=fb;"
  break
  
  case 'midarticleflex':
  thisAdType.size = "446x33,300x250"
   thisAdType.code = "ad=fb;ad=bb;"
  break
  
  case '1x1':
   thisAdType.size = "1x1"
   thisAdType.code = "ad=onebyone;"
  break
  
  case 'pushdown':
   thisAdType.size = "1x1"
   thisAdType.code = ""
  break
  
  case 'tiffanytile':
   thisAdType.size = "264x90"
   thisAdType.code = "ad=tiff;"
   /*if('1|3|5|6'.match(thisDate().getDay()))
   {
	   
	   thisAdType.adExecute = function ()
	   {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="264" height="120" id="SweetSpot" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="http://www.washingtonpost.com/wp-adv/slate/SweetSpot.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />	<embed src="http://www.washingtonpost.com/wp-adv/slate/SweetSpot.swf" quality="high" bgcolor="#000000" width="264" height="120" name="SweetSpot" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>')
	   }
   }*/
  break
  
  case '120x60':
   thisAdType.size = "120x60"
   thisAdType.code = "ad=120x60;"
  break
  
  case '88x31':
   thisAdType.size = "88x31"
   thisAdType.code = "ad=88x31;"
  break
  
  case '120x90':
   thisAdType.size = "120x90";
   thisAdType.code = "ad=120x90;";
  break
  
  case 'rightflex':
   thisAdType.size = "160x600,336x850,300x250"
   thisAdType.code = "ad=ss;ad=hp;ad=bb;"
  break
  
  case 'leftflex':
   thisAdType.size = "160x600,336x850,300x250"
   thisAdType.code = "ad=ss;ad=hp;ad=bb;"
  break
  
  case 'mostread':
   thisAdType.size = "336x54,336x90"
   thisAdType.code = "ad=mostread;"
  break
  
  case '336x90':
   thisAdType.size = "336x90"
   thisAdType.code = "ad=336x90;"
  break
  
  case 'tooltile':
   thisAdType.size = "120x20,120x30"
   thisAdType.code = "ad=tooltile;"
  break
  
  case '120x30':
   thisAdType.size = "120x30"

   thisAdType.code = "ad=120x30;"
  break
  
  case 'comment':
   thisAdType.size = "120x30"
   thisAdType.code = "ad=comment;"
  break
  
  case 'sponsor':
   thisAdType.size = "1x1"
   thisAdType.code = ""
  break
  
  case 'video':
   thisAdType.adServer = 'http://ad.doubleclick.net/pfadx/'
   thisAdType.code = "ad=video"
   thisAdType.adExecute = function (currentLoc,varDcCount,what,delivery)
   {
    if(typeof config == 'undefined')
    {
     config = new Array();
    }
    config['adServerURL'] = this.adServer + currentLoc + ";" + this.code + ";" + thisAdType.testAction(thisAdType.testFlagArray) + ";";
    config['additionalAdTargetingParams'] = ';' + this.dcCode
    
    for(var x in this.debugFlagArray)
    {
     if (location.href.match(this.debugFlagArray[x]))
     {
      this.debugAction()
     }
    }
   }
   
   thisAdType.debugAction = function()
   {
    var output = "config['adServerURL']:" + config['adServerURL'] + "\n\r"
    output += "config['additionalAdTargetingParams']:" + config['additionalAdTargetingParams'] + "\n\r"  
   }
  break
 }
  
return thisAdType
}
//this translates from the old placeAd to the new one




function placeAd()
{
 var transArray = new Array('','leaderboard','bigbox','120x240top','skyscraper','featurebar','120x240bottom','1x1','120x60','tiffanytile','','rightflex','rightflex','toolbar')
 placeAd2(arguments[1],transArray[arguments[0]],false,'')
}

//detects msn cobranding status--once a page
function msnCobrand()
{
 if (typeof this.msnReturnValue == 'undefined')
 {
  this.msnReturnValue='msn_refer=n;'
  if (typeof msn_cobrand != "undefined")
  {
   if (msn_cobrand != 0)
   {
    this.msnReturnValue='msn_refer=y;';
   }
  }
 }
 
 return this.msnReturnValue
}
//this is to for targeting ads to specific pages on fray==returns frayId
function frayId()
{
 //if fray is in the query string and id= has a query string value, return id=value
 returnValue =  (location.href.match('fray') && getQSValue('id')!='')?"frayId="+getQSValue('id')+";":"" 
 //this is a hack
 returnValue += (document.getElementById && document.getElementById( 'threadname' ) && getQSValue( 'tp',document.getElementById( 'threadname' ).getAttribute( 'href' ) ) == 'fixfray' )?"kw=cisco_landing;":""
 return returnValue
}

//this is for passing the unique number that corresponds to slate articles. It is either a number
//between slashes in the URL, or after id=.
function articleId()
{
	if(typeof this.aIdReturnValue != 'undefined')
	{
		return this.aIdReturnValue;
	}
	
	if(typeof s != 'undefined' && typeof s.prop12 != 'undefined')
	{
		this.aIdReturnValue = 'articleId=' + s.prop12 + ';';
		return this.aIdReturnValue;
	}
	
	this.aIdReturnValue = 'articleId=www.slate.com;';	
	var urlString = location.href;
	
	var idRegExp = RegExp('id=[0-9]{4,}','g');
	var slashRegExp = RegExp('/[0-9]{4,}[/\?]','g');
	var idMatchArray = urlString.match(idRegExp);
	var slashMatchArray = urlString.match(slashRegExp);
	if(idMatchArray)
	{
		this.aIdReturnValue = 'articleId='+idMatchArray[0].substring(3,idMatchArray[0].length)+';'
		return this.aIdReturnValue;
	}
	if(slashMatchArray)
	{
		var idIndex = 0;
		if(slashMatchArray.length > 1)
		{
			idIndex = 1;
		}
		this.aIdReturnValue = 'articleId='+slashMatchArray[idIndex].substring(1,slashMatchArray[0].length-1)+';'
		return this.aIdReturnValue;
	}
	return this.aIdReturnValue;
}

//override generic pageId function--make it the same as articleId


function front()
{
	if(typeof this.frontReturnValue != 'undefined')
	{
		return this.frontReturnValue;
	}


	this.frontReturnValue = 'front=' + ((location.href.match('/view/') || location.href.split('?')[0].match(/http:\/\/www.slate.com\/*$/gi))?'y':'n') + ";"
	return this.frontReturnValue
}

function hackBin(_arg,currentLoc,what,delivery,onTheFly)
{

	var hackReturnValue = eval(_arg)
	switch(_arg)
	{
		case 'currentLoc':
		   
		  
		   if(typeof commercialNode != 'undefined' && hackReturnValue != commercialNode)
			{
				hackReturnValue = commercialNode;	
			}
			 if(currentLoc == 'fray')
		   {
				
				hackReturnValue = 'arts/fray';
				
		   }
			hackReturnValue += ( what == 'leaderboard' || what == 'rightflex' || what == 'midarticleflex' ) ? ('/' + what) : '';
			//illegal substrings: slate., slate or marginad zones, slash at end, and spaces
			hackReturnValue = hackReturnValue.replace(/(^slate\.)|(\/(slate|marginad)(?=\/|$))|(\/$)| /gi,'');
			hackReturnValue.replace(/ /gi,'_');
			
			if(what == 'rightflex' && currentLoc == 'homepage')
			{	
				hackReturnValue += '/hp';
				hackReturnValue += ( location.href.match('reload=true') ) ? 'refresh' : '';
			}
			
			
			
		break;
		
		case 'onTheFly':
			if(location.href.match('/slideshow/') && what.match('leaderboard')){
				hackReturnValue += '!c=media;'
			}
			//10834-MB
			hackReturnValue += (urlCheck(/default\.aspx\?id\=3944/))?'search=y;':'';
		break;
		
		
		
		
	}
	return hackReturnValue
}





