//gets revsci info
if (document.domain != '') {
document.write('<s\cript src="http://js.revsci.net/gateway/gw.js?csid=J05531"></s\cript>');
}
function getQSValue( name )
{
  locString=(arguments[1])?arguments[1]:window.location.href;
  var regex = new RegExp( "[\\?&;]"+name+"=([^&#]*)" );
  var results = regex.exec( locString );
  return (results==null)?"":results[1]
}
//generates random number (but not ord string) once for entire page
function RandomInt()
{
 if (typeof this.randReturnValue == 'undefined')
 {
  this.randReturnValue = Math.random() * 1000000000000000000;
    } 
 return this.randReturnValue
}
//generates ord string once for entire page
function ordMaker()
{ 
 if (typeof this.ordReturnValue == 'undefined')
 { 
  this.ordReturnValue = "ord=" + RandomInt();
    } 
 return this.ordReturnValue
}
//checks for dfpcomp variable. if it exists, return dfpcomp as a keyvalue.
function dfpComp()
{
 if(typeof this.dfpReturnValue == 'undefined' || this.dfpReturnValue == '')
 { 
  if(typeof dfpcomp != 'undefined')
  { 
   this.dfpReturnValue = 'dfpcomp=' + dfpcomp + ";";
  }
  else
  {
   this.dfpReturnValue = '';
  }
 }
 return this.dfpReturnValue;
}
//function for generating pageId
function pageId()
{
 if(typeof this.idReturnValue == 'undefined')
 {
  if(site!='slate')
  {
   var url = document.location.href;
   url = url.toLowerCase();
   var urlarray = url.split('/');
   var tail = urlarray[urlarray.length -1];
   if (tail.indexOf('nav=') != -1)
   {
    tail = tail.substring(0,tail.indexOf('nav='));
   }
   var illegals = ['?no_interstitial','?test_ads','?template_test','?debugadcode','?pageidtest','?','=','/','\\',':',';',',','*','(',')','&','$','%','@','!','^','+',' ','[',']','{','}','.html','.htm','.',];
   for (i=0;i<illegals.length;i++)
   {
    sRE = new RegExp('(\\' + illegals[i] + ')', 'g');
    tail = tail.replace(sRE,"");
   }
   if (tail == 'index' || tail == '')
   {
    tail = urlarray[urlarray.length -2];
   }
   for(i=1;i<urlarray.length;i++)
   {
    if(urlarray[i] == 'entry')
    {
     tail = urlarray[urlarray.length -4]+'_'+tail;
    }
   }
   this.idReturnValue = 'pageId='+tail;
   if (this.idReturnValue.length > 55)
   {
    this.idReturnValue = this.idReturnValue.substring(0,55);
   }
  }
  else
  { this.idReturnValue = "pageId=";
   slateURL = location.href;
   if(slateURL.match('view'))
   {
    this.idReturnValue += slateURL.split('/')[6]
   }
   else
   { 
    if(slateURL.split('/')[4] == null || typeof slateURL.split('/')[4] == 'undefined')
    {
     this.idReturnValue += 'www.slate.com'
    }
    else
    {
     this.idReturnValue += slateURL.split('/')[4]
    }
   }
  }
 }
 return this.idReturnValue + ";"
}

//if revsci array exists, creates revsci keyvalues
function revsci()
{ 
 if (typeof rsinetsegs != 'undefined' && (typeof this.revsciReturnValue == 'undefined' || this.revsciReturnValue == '') )
 {
  this.revsciReturnValue='';
  for(i=0;i<rsinetsegs.length;i++)
  {
   this.revsciReturnValue += "rs="+rsinetsegs[i].replace("J05531_","j")+";";
  }
 }
 else if (typeof this.revsciReturnValue=='undefined')
 {
  this.revsciReturnValue='';
 }
 
 return this.revsciReturnValue
}
//creates debugAdCode box for each ad spot
function debugTextArea(ac)
{
  var re = new RegExp("\"","g") ;
  var ac = ac.replace(re,"\\\"");
  var re = new RegExp("<","g") ;
  var ac = ac.replace(re,"<\\");
  document.write('<div style="position:relative;float:left;z-index:1000000000">');
  document.write('<div style="text-align:left;text-transform:none;letter-spacing:normal;line-spacing:normal;padding:8px;position:absolute:top:0px;left:0px;width:300px;background-color:#FFAA00;color:#770000;font-family:verdana;font-size:9px;word-wrap:break-word;text-wrap:unrestricted;overflow:scroll">');
  document.write(ac+'<br/>');
  var re = new RegExp("/adj/","g")
  var ac = ac.replace(re,"/adi/")
  document.write('<a style="color:#111177;font-weight:bold;text-decoration:none" target="_blank" href="' + ac + '">Click Here To See The Ad Call In Its Own Window</a>')
  document.write('</div></div>')
}
//getCookie function
function getCookie(name) {
 var cookie = " " + document.cookie;
 var search = " " + name + "=";
 var setStr = null;
 var offset = 0;
 var end = 0;
 if (cookie.length > 0) {
  offset = cookie.indexOf(search);
  if (offset != -1) {
   offset += search.length;
   end = cookie.indexOf(";", offset)
   if (end == -1) {
    end = cookie.length;
   }
   setStr = unescape(cookie.substring(offset, end));
  }
 }
 return(setStr);
}
//returns size if it isn't a flex
function wpFlex(flexBoolean,size) 
{ 
 this.flexAndSizeReturnValue = '';
 if (typeof size != 'undefined' && size != '')
 {
 this.flexAndSizeReturnValue = 'sz='+size+';'
 }
 return this.flexAndSizeReturnValue
}
//setcookie function
function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
//sets Point of Entry value--once for entire page
function poe()
{
 if(typeof this.poeReturnValue == 'undefined')
 {
  this.poeReturnValue = 'poe=no;';
  if (getCookie(poeString) == null || getCookie(poeString) == "false")
  {
   this.poeReturnValue = 'poe=yes;';
   setCookie(poeString,"true","","/","",'')
  }
 }
 return this.poeReturnValue
}
//sets rss-user values--once for entire page
function rss()
{ 
 if (typeof this.rssReturnValue == 'undefined')
 {
  if (location.href.indexOf(rssString) != -1)
  {
   this.rssReturnValue="fromrss=y;";
   setCookie('rss_now','true','','/',wpniDomain,'');
   setCookie('rss','true',''+cookieExpStringMaker((28 * 24 * 60 * 60 * 1000),thisDate())+'','/',wpniDomain,'');
  }
  else
  {
   this.rssReturnValue="fromrss=n;";
   setCookie('rss_now','false',''+cookieExpStringMaker((28 * 24 * 60 * 60 * 1000),thisDate())+'','/',wpniDomain,'');
  }
  if (getCookie('rss') != null) 
  {
   this.rssReturnValue+='rss=y;'
  }
  else 
  {
   this.rssReturnValue += 'rss=n;'
  }
 }
 
 return this.rssReturnValue
}
//figures out if this user came from a link (not heavy) or opened a window with this (heavy)
function heavy()
{
 if (typeof this.heavyReturnValue == 'undefined')
 {
  this.heavyReturnValue = "heavy=n;"
  if (typeof document.referrer != "undefined")
  {
   if (document.referrer == '') this.heavyReturnValue = "heavy=y;"
  }
 }
 return this.heavyReturnValue
}
//writes a doubleclick tile keyvalue
function tile(tileBoolean,varDcCount)
{
 if (tileBoolean == true)
 {
  return "tile=" + varDcCount + ";"
 }
}
//returns a string that is the current date plus an amount of milliseconds, passed in the argument
function cookieExpStringMaker() {
 var today = new Date()
 var todayPlusDay = today.getTime() + arguments[0]
 today.setTime(todayPlusDay)
 return '' + today + ''
}
//returns true if the user...
function hasntSeenMoreThanFourPopUpsIn24Hours()
{
 var returnValue24 = true;
 if(getCookie('popUpClockCookie'))
 {
  if (parseInt(getCookie('popUpClockCookie')) > 8 )
  {
   var returnValue24 = false
  }
  else
  {
   setCookie('popUpClockCookie','' + (parseInt(getCookie('popUpClockCookie')) + 1) + '', cookieExpStringMaker((24 * 60 * 60 * 1000),thisDate()), '/', wpniDomain,'')
  }
 }
 else
 {
  setCookie('popUpClockCookie','1','' + cookieExpStringMaker((24 * 60 * 60 * 1000),thisDate()) + '','/', wpniDomain,'')
 }
 return returnValue24
}
//returns true if the user...
function didntSeePopUpOnPreviousPage()
{
 var returnValuePrev = true;
 if(getCookie('popUpOnPreviousPageCookie')!=null)
 {
   if(getCookie('popUpOnPreviousPageCookie') == 'true')
   {
         var returnValuePrev = false
         setCookie('popUpOnPreviousPageCookie','false','', '/', wpniDomain,'')
        }
      else
        {
         setCookie('popUpOnPreviousPageCookie','true','', '/', wpniDomain,'')
        }
 }
 else
 { 
      setCookie('popUpOnPreviousPageCookie','true','', '/',wpniDomain,'')
 }
 return returnValuePrev
}
//is passed one or more strings and then asks the question...
function isAnyOfTheseInTheUrl()
{
 var returnValue = false;
  for(var x=0;x<arguments.length;x++)
  {
   if(location.href.match(arguments[x]))
   {
    returnValue = true;
   }
  }
 return returnValue
}
//interstitial and popup manager
function interstitial()
{
 //interstitial is processed if the returnValue doesn't exist, if we're on the home domain, if no_interstitials isn't in the URL, and this is the right tile number
 if(typeof this.intReturnValue == 'undefined' && !isAnyOfTheseInTheUrl('no_interstitials') && arguments[1] == tileThatGetsDcopt)
 {
  //default is that dcopt=ist should be passed
  this.intReturnValue = "dcopt=ist;";
  //if this is a refresh page or from a google search page, skip pops
  if(!isAnyOfTheseInTheUrl('g=1','o=','sid=','reload=true'))
  { 
   var a = hasntSeenMoreThanFourPopUpsIn24Hours();
   var b = didntSeePopUpOnPreviousPage();
   if(a && b && !location.href.match('www.slatev.com') && location.href.match('slate.com'))
   {
    this.intReturnValue += 'ad=pop;';
   }
  }
  return this.intReturnValue;
 } 
 return ''
}
function thisDate()
{
 if (typeof this.dateReturnValue == 'undefined')
 {
  this.dateReturnValue = new Date()
 }
 return this.dateReturnValue
}
function dateToString()
{
 if (typeof this.dtsReturnValue == 'undefined')
 {
  var thisDateObj = thisDate()
  var yyyy = thisDateObj.getFullYear();
  var mm = thisDateObj.getMonth() + 1;
  var dd = thisDateObj.getDate();
  var hour = thisDateObj.getHours();
  var min = thisDateObj.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;
  this.dtsReturnValue = ''+yyyy+mm+dd+hour+min;
 }
 return this.dtsReturnValue
}
function dayOfWeekCheck(now,dosString)
{
 //if day of week string is undefined, return true
 if(typeof dosString == 'undefined') return true;
 dosDate = thisDate()
 thisDos = dosDate.getDay()
 return (dosString.match(thisDos))?true:false
 
}
function dateCheck(when,now)
{
 
 this.dateCheckReturnValue=false;
 if (typeof when == "undefined" || when == '')
 {
  this.dateCheckReturnValue = true;
 }
 else
 {
  dateSets = when.split(';')
  for (x=0;x<dateSets.length;x++)
  {
   if (now >= dateSets[x].split('/')[0] && now <= dateSets[x].split('/')[1] && dayOfWeekCheck(now,dateSets[x].split('/')[2]))
   {
    this.dateCheckReturnValue=true
   }
  }
 }
 return this.dateCheckReturnValue 
}
function locationCheck(where,currentLoc)
{
 //presume false
 this.locCheckReturnValue=false;
 //if empty string is passed for where, it's ROS, so true
 if (typeof where == 'undefined' || where == '')
 {
  return true
 }
 
 var nodes = where.split(';');
 
 //if only exclusions are passed, presume true
 for (x=0;x<nodes.length;x++)
 {
 
 }
 
 var pageIdWithoutSC = pageId()
 pageIdWithoutSC = pageIdWithoutSC.substring(0,pageIdWithoutSC.length-1)
 for (x=0;x<nodes.length;x++)
 {
  if (currentLoc == nodes[x] || pageIdWithoutSC == nodes[x])
  {
   this.locCheckReturnValue = true;
  }
  if (('-' + currentLoc) == nodes[x] || ('-' + pageIdWithoutSC) == nodes[x])
  {
   this.locCheckReturnValue = false;
  }
 }
 return this.locCheckReturnValue
}
function getHighestValue()
{
 var longest = 0;
 var loop;
 for (loop=0;loop<arguments.length;loop++)
 {
  if (arguments[loop] > longest)
  {
   longest = arguments[loop];
  }
 }
return longest;
}
//time-location management function. Turns ad spot in if you're testing. 
function testCheck(isTestBoolean)
{
 if(typeof isTestBoolean == 'undefined' || !isTestBoolean)
 {
  return true
 }
 else
 {
  return (location.href.match('test_ads'))?true:false
 }
}
function AdInstance()
{ 
 this.when = new Array()
 this.where = new Array()
 this.isTest = new Array()
 
 this.debugAction = function (output) { return debugTextArea(output) }
 
 this.dateObject = new Date()
 this.now = dateToString(this.dateObject)
 
 this.tile = true
 this.flex = false
 
 this.doubleClickFlag = true;
 this.doubleClickAdType = "adj";
 this.dcCode =   heavy() + pageId() + poe() + revsci() + dfpComp() + rss(this.dateObject);
 
 this.testAction = function (testFlagArray)
 { 
  return doubleClickTestCode(testFlagArray)
 }
 
 this.code = ''
 this.isThisManaged = false
 
 this.adExecute = function (currentLoc,varDcCount,what,flexBoolean,onTheFly) {
  var doIt = true;
  
  if (this.isManaged)
  { 
   var doIt = false;
   numberOfFlights=findLongestArray(this.when,this.where,this.isTest)
   
   for (loop=0;loop<numberOfFlights;loop++)
   {
    if (dateCheck(this.when[loop],this.now) && locationCheck(this.where[loop],currentLoc) && testCheck(this.isTest[loop]))
    {
     doIt = true;
    }
   }
  }
   
  if (doIt == true)
  { 
   
   if (this.doubleClickFlag == true)
   {
    
    var adAddress = "http://ad.doubleclick.net/" + this.doubleClickAdType + "/" + siteZoneDir(currentLoc) + front() + this.code + this.testAction(this.testFlagArray) + wpFlex(flexBoolean,this.size) + tile(this.tile,varDcCount) + interstitial(this.interstitial,varDcCount) + this.dcCode + posMaker(what) + onTheFly +  ordMaker() +  "?"
    
    var output="<s\cript language='JavaScript1.1' src='" + adAddress + "'></s\cript>"
    document.write(output)
    
   }
  
  for(var x in this.debugFlagArray)
    {
     if (location.href.match(this.debugFlagArray[x]))
     {
      this.debugAction(adAddress)
     }
    }
  }
 }
}
function findLongestArray()
{
 var highestYet = 0;
 for(var arrayIndex = 0;arrayIndex < arguments.length;arrayIndex++)
 {
  var x = arguments[arrayIndex].length
  if(x > highestYet)
  {
   highestYet = x
  }
 }
 return highestYet
}
function doubleClickTestCode(testFlagArray)
{
 dctCodeValue = ''
 for(x in testFlagArray)
 { 
  if(location.href.match(testFlagArray[x]))
  {
   dctCodeValue += 'kw=test_ads;'
  }
 }
 return dctCodeValue
}
function posMaker(what)
{ 
 if (typeof this.usedSpots == 'undefined')
 {
  this.usedSpots = new Array();
 }
 if (this.usedSpots[what] == null)
 {
  this.usedSpots[what] = 1;
  return 'pos='+what+';';
 }
 else
 {
  this.usedSpots[what]++;
  return 'pos='+what+"_"+this.usedSpots[what]+';';
 }
}

function siteZoneDir(currentLoc)
{
 if(typeof this.szdReturnValue == 'undefined')
 {
  this.szdReturnValue = site + "." + currentLoc + ";";
  
  var currentLocArray = currentLoc.split('/');
  for(var x in currentLocArray)
  {
   this.szdReturnValue += 'dir=' + currentLocArray[x] + ";"
  }
 }
 return this.szdReturnValue
}

function placeAd2(currentLoc,what,flex,onTheFly)
{ 

 argNames = new Array('currentLoc','what','flex','onTheFly');
 for(var x = 0;x<argNames.length;x++) {eval(argNames[x] + '=hackBin("'+argNames[x]+'",currentLoc,what,flex,onTheFly)')};

 
 //if no_ads is in the url, it bails
 if (location.href.match('no_ads'))
 {
 return
 }
 
 //onTheFly was getting passed as undefined
 if (typeof onTheFly == 'undefined')
 {
  onTheFly = ''
 }
 
 //if array adClasses doesn't exist, initializes it.
 if (typeof adClasses == "undefined")
 {
  adClasses = new Array()
 }
 //if the specified ad type (what) doesn't exist in the array adClasses, define it with initAdType
 
 if (typeof adClasses[what] == "undefined")
 {
  adClasses[what] = initAdType(what)
 }
 
 //if this is a doubleclick thing, iterate (or initialize) the tile number. 
 if (adClasses[what].doubleClickFlag == true)
 {
  if (typeof this.varDcCount == 'undefined')
  {
   this.varDcCount = 1
  }
  else
  {
   this.varDcCount++
   
  }
  
  
  
  //this logic will prevent excessive pop-ups on non wpni domain sites
var dom = new Array('slate','loudounextra','newsweek','readexpress');
	
for(j=0;j<dom.length;j++){
	
	if (wpniDomain == document.location.href.match(dom[j])){
	
		wpniDomain = true;
	
	}
		
	else {
		
		wpniDomain = false;
		
	}
}

  
  
 }
 

 
 
 
 
 //run this adtype's adExecute method, which actually does what has to be done.
 adClasses[what].adExecute(currentLoc,varDcCount,what,flex,onTheFly)
 }
function siteZoneDir(currentLoc)
{
 this.szdReturnValue = site + "." + currentLoc + ";";
  var currentLocArray = currentLoc.split('/');
  for(var x in currentLocArray)
  {
   this.szdReturnValue += 'dir=' + currentLocArray[x] + ";"
  }
 return this.szdReturnValue
}





//EVERYTHING ABOVE IS WPNI GLOBAL--CHANGES MUST BE REFLECTED IN WPNI_AD.JS
//EVERYTHING BELOW IS SITE SPECIFIC
site='slate'
wpniDomain='.slate.com'
show_doubleclick_ad = true
poeString = "slate_poe"
rssString = "/fr/rss/"
tileThatGetsDcopt = 2
//this declares what kinds of ads are on this site

function initAdType(what)
{
 thisAdType = new AdInstance()
 thisAdType.testFlagArray = new Array('test_ads','test_' + what); 
 thisAdType.debugFlagArray = new Array('debugAdCode','debug' + what);
 thisAdType.dcCode += msnCobrand() + "dept=" + PStax + ";" + frayId() + articleId();
 
 switch(what)
 {
  case 'toolbar':
   thisAdType.size = "120x60"
   thisAdType.code = "ad=120x60;"
   thisAdType.isManaged = true
   thisAdType.when[0] = "200703140000/200703152359"
   thisAdType.where[0] = "homepage/slate"
   
  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 = "264x120"
   thisAdType.code = "ad=tiff;"
  break
  
  case '120x60':
   thisAdType.size = "120x60"
   thisAdType.code = "ad=120x60;"
  break
  
  case '88x31':
   thisAdType.size = "88x31"
   thisAdType.code = "ad=88x31;"
   thisAdType.isManaged = true;
  break
  
  case '120x90':
   thisAdType.size = "120x90";
   thisAdType.code = "ad=120x90;";
   thisAdType.isManaged = true;
   thisAdType.where[1] = "homepage/slate";
   thisAdType.when[1]="200704240000/200705092359";
   thisAdType.where[2] = "";
   thisAdType.when[2]="200704240000/200704272359";
  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,flexBoolean)
   {
    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()
{
 //slate currentLoc syntax is site.zone/site so we reduce it to zone/site here
 currentLoc=arguments[1].split('.')[1]
 spot = arguments[0] 
 onTheFly=''
 flex=false
 var transArray = new Array('','leaderboard','bigbox','120x240top','skyscraper','featurebar','120x240bottom','1x1','120x60','tiffanytile','','rightflex','rightflex','toolbar')
 flexVal=false;
 //if (spot==11 || spot==12) {flexVal=true};

 placeAd2(currentLoc,transArray[spot],flexVal,onTheFly)
}
//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;
	}
	else
	{
		var urlString = location.href;
		var urlStringNoQS = location.href.split('?')[0];
		this.aIdReturnValue = '';
	}
	
	if(urlStringNoQS.substring(urlStringNoQS.length-3,urlStringNoQS.length) == 'com' || urlStringNoQS.substring(urlStringNoQS.length-3,urlStringNoQS.length) == 'om/')
	{
		this.aIdReturnValue = 'articleId=www.slate.com;';
		return this.aIdReturnValue
	}
	else
	{
		
		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)+';'
		}
		else if(slashMatchArray)
		{
			
			switch(slashMatchArray.length)
			{
				case 1:
					this.aIdReturnValue = 'articleId='+slashMatchArray[0].substring(1,slashMatchArray[0].length-1)+';'
				break;
				case 2:
					this.aIdReturnValue = 'pArticleId='+slashMatchArray[0].substring(1,slashMatchArray[0].length-1)+';' + 'articleId='+slashMatchArray[1].substring(1,slashMatchArray[1].length-1)+';'
				break;
				case 3:
					this.aIdReturnValue = 'pArticleId='+slashMatchArray[0].substring(1,slashMatchArray[0].length-1)+';' + 'articleId='+slashMatchArray[1].substring(1,slashMatchArray[1].length-1)+';' + 'subArticleId='+slashMatchArray[2].substring(1,slashMatchArray[2].length-1)+';'
				break;
				default:
					if(typeof s != 'undefined' && typeof s.prop12 != 'undefined')
					{
						this.aIdReturnValue = 'articleId=' + s.prop12 + ';';
					}
				break;
			}
		}
	}
	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/')?'y':'n') + ";"
	return this.frontReturnValue
}
	
function hackBin(_arg,currentLoc,what,flex,onTheFly)
{
	hackReturnValue=eval(_arg)
	switch(_arg)
	{
		case 'currentLoc':
			if(currentLoc.split('/')[1]=='marginad' && what=='rightflex')
			{
				hackReturnValue = currentLoc.split('/')[0] + '/' + 'flex'
			}
			if(what == 'midarticleflex')
			{
				
				hackReturnValue = currentLoc.split('/')[0] + '/midarticleflex'
			}
		break;
	}
	return hackReturnValue
}