wpniSite='slate'
wpniDomain='thebigmoney.com'
show_doubleclick_ad = true
rssString = "from=rss"
hourScope = 5;
numPop = 2;
tileThatGetsDcopt = 1;

wpniAds.templates.initRule('defaultTemplate');
wpniAds.templates.rules.defaultTemplate.what = new Array('!336x90');


wpniAds.templates.initRule('ac_9999');
wpniAds.templates.rules.ac_9999.what = new Array('^336x90$');
wpniAds.templates.rules.ac_9999.when = new Array('200906190000/200912312359');
wpniAds.templates.rules.ac_9999.hardcodes = '<a href="http://ad.doubleclick.net/clk;215845208;29603947;o?http://www.thebigmoney.com/rss" target="_blank"><img width="336" height="90" border="0" alt="" src="http://media.washingtonpost.com/wp-adv/advertisers/tbm/061909/RSS.jpg" /></a>';

wpniAds.templates.initRule('ac_9999_2');
wpniAds.templates.rules.ac_9999_2.what = new Array('^336x90_2$');
wpniAds.templates.rules.ac_9999_2.when = new Array('200906190000/200912312359');
wpniAds.templates.rules.ac_9999_2.hardcodes = '<a href="http://ad.doubleclick.net/clk;215845250;29603947;l?http://www.facebook.com/home.php#/pages/The-Big-Money/19019344246?ref=ts" target="_blank"><img width="336" height="90" border="0" alt="" src="http://media.washingtonpost.com/wp-adv/advertisers/tbm/061909/Facebook_330x90.gif" /></a>';


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()   + articleId() 
 
 switch(what)
 {
   case '336x90':
   thisAdType.size = "336x90"
   thisAdType.code = "ad=336x90;"
  break
  
  case 'toolbar':
   thisAdType.size = "120x60"
   thisAdType.code = "ad=120x60;"
  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 '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 'tiffanytile':
   thisAdType.size = "264x90"
   thisAdType.code = "ad=tiff;"
  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 '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





//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':
		    
			hackReturnValue += ( what == 'leaderboard' || what == 'rightflex' || what == 'midarticleflex' ) ? ('/' + what) : '';
			
			if(what == 'rightflex' && currentLoc == 'homepage')
			{	
				hackReturnValue += '/hp';
				hackReturnValue += ( location.href.match('reload=true') ) ? 'refresh' : '';
			}
			
		break;
		
		case 'flex':
			hackReturnValue = false;
		break;
		
		case 'delivery':
			if(delivery=='AJAX' && what=='leaderboard')
			{
				ord_override = true;
			}
		break;
	}
	return hackReturnValue
}

//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
}


