document.cnnAdNetwork = "3475.si";
document.cnnBranding = "";
document.cnnAdDisplayAds = (document.location.host == 'jcmsprod8.turner.com:84') ? false : true;
document.cnnAdPath = ( ( document.URL ).replace( /http:\/\/([^\/]+)/, "" ) ).replace( /\/\//, "/" );
if( ( document.cnnAdPath ).charAt( ( document.cnnAdPath ).length - 1 ) == "/" ) document.cnnAdPath += "index.html"; // make sure there's always a filename
document.cnnAdPathArray = ( ( document.cnnAdPath ).substr( 1 ) ).split( "/" );

/* start audience science */
var rsi_segs = [];
var segs_beg=document.cookie.indexOf('rsi_segs=');
if(segs_beg>=0){
	segs_beg=document.cookie.indexOf('=',segs_beg)+1;
	if(segs_beg>0){
		var segs_end=document.cookie.indexOf(';',segs_beg);
		if(segs_end==-1)segs_end=document.cookie.length;
			rsi_segs=document.cookie.substring(segs_beg,segs_end).split('|');
	}
}
var segLen=20
var segQS="",segArr=new Array()
if (rsi_segs.length<segLen){segLen=rsi_segs.length}
for (var i=0;i<segLen;i++){
	segArr=rsi_segs[i].split("_")
	if (segArr.length>1) segQS+=("rsi"+"="+segArr[1]+";")
}
/* end audience science */

/* start quantcast */
function _quantgc(n) {
	var c=document.cookie;
	if(!c)return '';
	var i=c.indexOf(n+"=");
	if(-1==i)return '';
	var len=i+n.length+1;
	var end=c.indexOf(";", len);
	return c.substring(len,end<0?c.length:end);
}
// Code below is customizable per publisher
quantSegs = "";
var _qsegs = _quantgc('__qseg').split('|');
for (i in _qsegs) {
	var qArr=_qsegs[i].split("_");
	quantSegs += ("qc=" + qArr[1] + ";");
}
/* end quantcast */

/* start flash sync */
var __pageTimeStamp = new Date().getTime();
function cnnad_getPageTimeStamp(){
     return __pageTimeStamp;
}
/* end flash sync */

function cnnad_createAd( dart_value, parameters, width, height, multisize ) {
	// disable ads internally
	if (!document.cnnAdDisplayAds) {
		document.write ('<div style="display: block; background: #444; color: #fff; width: '+width+'; height: '+height+'; font-size: 10px; text-align: center; ">'+width+'x'+height+' Ad</div>');
		return;
	}
	var adcode = 'http://ad.doubleclick.net/adj/' + document.cnnAdNetwork + '/';
	var adparameters = cnnad_getKeywords( dart_value, parameters ) + cnnad_getPath() + cnnad_getFile();
	var adsize = 'dcove=d;sz=' + width + 'x' + height; if( multisize != null ) adsize += ',' + multisize; adsize += ';';
	// team pages except index get multisize
	if( ( parameters.indexOf( 'ptyp=team;' ) > -1 ) && ( cnnad_getFile() != "file=index_html;" ) && ( width == 300 ) ) adsize = adsize.replace( /250/, "250,300x600" );
	var addcopt = ''; if( document.cnnAdInterstitial != "" ) addcopt = 'dcopt=' + document.cnnAdInterstitial + ';';
	var adtile = 'ptile=' + document.cnnAdTile + ';';
	var adord = 'ord=' + document.cnnAdRandom;

	// put it all together
	adcode = '<scr'+'ipt language="JavaScript1.1" src="' + adcode + cnnad_getDartValue( dart_value ) + adparameters + segQS + quantSegs + addcopt + adtile + adsize + adord + '?"></scr'+'ipt>';

	// if you have the cookie, write out the script file source
	if( allCookies['cnnad_solbright'] == "set" ) {
		document.write( '<div class="cnnSiteDebug">' + ( ( ( adcode.substring( ( adcode ).indexOf( 'http' ), ( adcode ).lastIndexOf( '"' ) ) ).replace( /;/g, "; " ) ).replace( /\//g, " / " ) ).replace( /\./g, ". " ) + '</div>' );
	}

	// write it
	document.write( adcode );
}

function cnnad_createRefreshAd ( dart_value, parameters, width, height, refresh ) {
	var src = '/si_adspaces/2.1/adshow.html?dart_value='+(dart_value)
		+'&parameters='+cnnad_getKeywords( dart_value, parameters ) + cnnad_getPath() + cnnad_getFile()
		+'&width='+width
		+'&height='+height
		+'&Interstitial='+(document.cnnAdInterstitial)
		+'&Tile='+(document.cnnAdTile)
		+'&Random='+(document.cnnAdRandom)
		+'&refresh='+refresh;
	var frameHTML = '<iframe width="'+width+'" scrolling="no" height="'+height+'" frameborder="0" marginheight="0" marginwidth="0" id="browsePane" name="browsePane" src="'+src+'"></iframe>';
	document.write (frameHTML);
}

function cnnad_createGameflashAd ( dart_value, parameters, width, height, multisize, refresh ) {
	var src = '/si_adspaces/2.1/adshow-gameflash.html?dart_value='+(dart_value)
		+'&parameters='+cnnad_getKeywords( dart_value, parameters ) + cnnad_getPath() + cnnad_getFile()
		+'&width='+width
		+'&height='+height
		+'&multisize='+multisize
		+'&Interstitial='+(document.cnnAdInterstitial)
		+'&Tile='+(document.cnnAdTile)
		+'&Random='+(document.cnnAdRandom)
		+'&refresh='+refresh;
	var frameWidth = width; if( width == 728 ) frameWidth = 978;
	var frameHeight = height;
	var frameHTML = '<iframe width="'+frameWidth+'" scrolling="no" height="'+frameHeight+'" frameborder="0" marginheight="0" marginwidth="0" id="browsePane" name="browsePane" src="'+src+'"></iframe>';
	document.write (frameHTML);
}

function cnnad_createAdHTML( dart_value, parameters, width, height, multisize ) {
	var adcode = 'http://ad.doubleclick.net/adj/' + document.cnnAdNetwork + '/';
	var adparameters = cnnad_getKeywords( dart_value, parameters ) + cnnad_getPath() + cnnad_getFile();
	var adsize = 'dcove=d;sz=' + width + 'x' + height; if( multisize != null ) adsize += ',' + multisize; adsize += ';';
	if( ( parameters.indexOf( 'ptyp=team;' ) > -1 ) && ( cnnad_getFile() != "file=index_html;" ) && ( width == 300 ) ) adsize = adsize.replace( /250/, "250,300x600" );
	var addcopt = ''; if( document.cnnAdInterstitial != "" ) addcopt = 'dcopt=' + document.cnnAdInterstitial + ';';
	var adtile = 'ptile=' + document.cnnAdTile + ';';
	var adord = 'ord=' + document.cnnAdRandom;

	var returnCode = '<scr'+'ipt language="JavaScript1.1" src="' + adcode + cnnad_getDartValue( dart_value ) + adparameters + segQS + quantSegs + addcopt + adtile + adsize + adord + '?"></scr'+'ipt>';
	return returnCode;
}

function cnnad_getDartValue( input ) {  // sometimes input isn't a proper zone value, so return a proper one
	if( input == "writers" ) {
		var writer = cnnad_getWriter();
		if( ( writer == "alan_shipnuck" ) || ( writer == "don_banks" ) || ( writer == "dr_z" ) || ( writer == "frank_deford" ) || ( writer == "gary_van_sickle" ) || ( writer == "jack_mccallum" ) || ( writer == "john_donovan" ) || ( writer == "lars_anderson" ) || ( writer == "luke_winn" ) || ( writer == "marty_burns" ) || ( writer == "peter_king" ) || ( writer == "stewart_mandel" ) || ( writer == "tom_verducci" ) ) { input += "." + writer; }
	} else if( ( input == "football_ncaa" ) && ( arrayIndexOf( "nfl", document.cnnAdPathArray ) > 0 ) && ( arrayIndexOf( "scoreboards", document.cnnAdPathArray ) > 0 ) ) {
		input = "football_nfl/gameflash";
	} else if( ( input == "football_ncaa" ) && ( arrayIndexOf( "ncaa", document.cnnAdPathArray ) > 0 ) && ( arrayIndexOf( "scoreboards", document.cnnAdPathArray ) > 0 ) ) {
		input = "football_ncaa/gameflash";
	}
	if( input != "" ) { input += '/'; } // all non-blank dart values should end with a slash
	return input + ';'; // all dart values should end with a semicolon
}

function cnnad_getKeywords( dart_value, input ) { // return a complete list of keywords
	var retValue = cnnad_getPtyp( dart_value, input );
	if( arrayIndexOf( "women", document.cnnAdPathArray ) > 0 ) { retValue += 'kw=women;'; } // if there is "women" in the section path, pass up keyword "women"
	if( arrayIndexOf( "womens_worldcup", document.cnnAdPathArray ) > 0 ) { retValue += 'kw=women;'; } // if there is "womens_worldcup" in the section path, pass up keyword "women"
	document.cnnBranding = document.cnnBranding.replace( /\./g, "_" );
	if( cnnad_isCMSStory() ) {
		if( cnnad_isWriterPage() ) {
			var writer = cnnad_getWriter();
			if( ( document.cnnBranding ).indexOf( 'rankings' ) > -1 ) { retValue += 'kw=' + document.cnnBranding + ';'; } // if the url is a story and a writer, and branding contains "rankings", pass up keyword branding
			if( writer == 'peter_king' ) { retValue += 'kw=' + document.cnnBranding + ';'; } // if the url is a story and a writer, and the writer is "peter_king", pass up keyword branding
			if( document.cnnBranding ) { retValue += 'writ=' + writer + '_' + document.cnnBranding + ';'; } // if the url is a story and a writer, pass up the writer
			else { retValue += 'writ=' + writer + ';'; }
		}
		if( ( arrayIndexOf( "olympics", document.cnnAdPathArray ) > 0 ) && ( arrayIndexOf( "specials", document.cnnAdPathArray ) > 0 ) ) {
			retValue += 'kw=' + ( document.cnnAdPathArray )[ arrayIndexOf( "specials", document.cnnAdPathArray ) + 1 ] + ';'; // if the url is a story and an olympics story, pass up keyword section
		}
		if( ( document.cnnBranding == "ipod" ) || ( document.cnnBranding == "tv_sched" ) || ( document.cnnBranding == "truth_rumors" ) || ( document.cnnBranding == "sioc_vent" ) || ( document.cnnBranding == "sioc_alist" ) || ( document.cnnBranding == "spring_break" ) ) { retValue += 'kw=' + document.cnnBranding + ';'; }
		retValue += cnnad_getSlug( ( document.cnnAdPathArray )[ ( document.cnnAdPathArray ).length - 2 ]  ); // if the url is a story, pass up the slug
	} else if( dart_value == 'swimsuit.models' ) {
		if( ( ( document.cnnAdPathArray )[2] == "models" ) && ( ( document.cnnAdPathArray )[3] != 'index.html' ) && ( ( document.cnnAdPathArray )[3] != 'siextra.html' ) )  {
			var model = document.cnnAdPathArray[ document.cnnAdPathArray.length - 1];
			model = model.replace( /\.html/, "" );
			if( ( model.substr( 0, 2 ) ).match( /\d{2}/ ) ) { model = model.substring( model.indexOf( '_' ) + 1 , model.lastIndexOf( '_' ) ); }
			retValue += 'kw=' + model + ';';
		}
		if( ( ( document.cnnAdPathArray )[2] == "allstar" ) && ( ( document.cnnAdPathArray )[3] != 'index.html' ) )  {
			var model = document.cnnAdPathArray[ document.cnnAdPathArray.length - 1];
			model = model.replace( /\.html/, "" );
			if( ( model.substr( 0, 2 ) ).match( /\d{2}/ ) ) { model = model.substring( model.indexOf( '_', 4 ) + 1 , model.lastIndexOf( '_' ) ); }
			retValue += 'kw=' + model + ';';
		}
		if( ( document.cnnAdPathArray )[0] == "pr" ) {
			var model = document.cnnAdPathArray[ document.cnnAdPathArray.length - 1];
			model = model.replace( /\.html/, "" );
			if( ( model.substr( 0, 2 ) ).match( /\d{2}/ ) ) { model = model.substring( model.indexOf( '_' ) + 1 , model.lastIndexOf( '_' ) ); }
			retValue += 'kw=' + model + ';';
		}
	} else if( cnnad_isWriterPage() ) {
		var writer = cnnad_getWriter();
		if( document.cnnBranding ) { retValue += 'writ=' + writer + '_' + document.cnnBranding + ';'; } // if the url is a story and a writer, pass up the writer
		else { retValue += 'writ=' + writer + ';'; }
	} else if( cnnad_isPollPage() ) {
		retValue += 'poll=' + ( document.location.hash ).substr( 1 ) + ';';
	} else if( ( dart_value == "football_ncaa" ) && ( arrayIndexOf( "nfl", document.cnnAdPathArray ) > 0 ) && ( input == "spt=football_ncaa;" ) ) {
		retValue = retValue.replace( "spt=football_ncaa;", "spt=football_nfl;" );
		if( ( ( window.location.pathname ).indexOf( '09/07/2906' ) > 0 ) || ( ( window.location.pathname ).indexOf( '280901129' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '09/28/3047' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20080928020' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '10/05/2962' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081005030' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '10/12/3006' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081012022' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '10/19/3066' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081019003' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '10/26/3137' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081026018' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '11/02/2926' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081102010' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '11/09/3002' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081109021' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '11/16/3071' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081116019' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '11/23/3090' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081123010' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '11/30/2925' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081130009' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '12/07/3031' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081207023' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '12/14/3068' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081214020' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '12/21/3099' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081221019' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '12/28/3129' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081228020' ) > 0 ) ) {
			retValue += "path=tmobile;";
		}
	} else if( ( dart_value == "baseball_mlb/gameflash" ) && ( arrayIndexOf( ".element", document.cnnAdPathArray ) == 0 ) ) {
		if( ( ( document.referrer ).indexOf( '07/20/19162' ) > 0 ) || ( ( document.referrer ).indexOf( '280720103' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '07/27/20804' ) > 0 ) || ( ( document.referrer ).indexOf( '280727121' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '08/03/19858' ) > 0 ) || ( ( document.referrer ).indexOf( '280803110' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '08/10/19174' ) > 0 ) || ( ( document.referrer ).indexOf( '280810103' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '08/17/19919' ) > 0 ) || ( ( document.referrer ).indexOf( '280817119' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '08/24/21369' ) > 0 ) || ( ( document.referrer ).indexOf( '280824122' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '09/01/19943' ) > 0 ) || ( ( document.referrer ).indexOf( '280901129' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '09/14/19018' ) > 0 ) || ( ( document.referrer ).indexOf( '280914118' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '09/21/19684' ) > 0 ) || ( ( document.referrer ).indexOf( '280921115' ) > 0 ) ) {
			retValue += "path=tmobile;";
		} else if( ( ( document.referrer ).indexOf( '05/25/26670' ) > 0 ) || ( ( document.referrer ).indexOf( '290525105' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '05/31/25984' ) > 0 ) || ( ( document.referrer ).indexOf( '290531103' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/07/26614' ) > 0 ) || ( ( document.referrer ).indexOf( '290607117' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/07/27638' ) > 0 ) || ( ( document.referrer ).indexOf( '290607125' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/14/26869' ) > 0 ) || ( ( document.referrer ).indexOf( '290614127' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/14/26713' ) > 0 ) || ( ( document.referrer ).indexOf( '290614105' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/21/26359' ) > 0 ) || ( ( document.referrer ).indexOf( '290621107' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/21/25640' ) > 0 ) || ( ( document.referrer ).indexOf( '290621102' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/28/27346' ) > 0 ) || ( ( document.referrer ).indexOf( '290628121' ) > 0 ) ||
			   ( ( document.referrer ).indexOf( '06/28/26527' ) > 0 ) || ( ( document.referrer ).indexOf( '290628115' ) > 0 ) ) {
			retValue += "path=optix;";
		}
	} else if( ( dart_value == "football_nfl/gameflash" ) && ( arrayIndexOf( ".element", document.cnnAdPathArray ) == 0 ) ) {
		if( ( ( document.referrer ).indexOf( '09/07/2906' ) > 0 ) || ( ( document.referrer ).indexOf( '280901129' ) > 0 ) ||
			( ( document.referrer ).indexOf( '09/28/3047' ) > 0 ) || ( ( document.referrer ).indexOf( '20080928020' ) > 0 ) ||
			( ( document.referrer ).indexOf( '10/05/2962' ) > 0 ) || ( ( document.referrer ).indexOf( '20081005030' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '10/12/3006' ) > 0 ) || ( ( document.referrer ).indexOf( '20081012022' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '10/19/3066' ) > 0 ) || ( ( document.referrer ).indexOf( '20081019003' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '10/26/3137' ) > 0 ) || ( ( document.referrer ).indexOf( '20081026018' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '11/02/2926' ) > 0 ) || ( ( document.referrer ).indexOf( '20081102010' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '11/09/3002' ) > 0 ) || ( ( document.referrer ).indexOf( '20081109021' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '11/16/3071' ) > 0 ) || ( ( document.referrer ).indexOf( '20081116019' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '11/23/3090' ) > 0 ) || ( ( document.referrer ).indexOf( '20081123010' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '11/30/2925' ) > 0 ) || ( ( document.referrer ).indexOf( '20081130009' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '12/07/3031' ) > 0 ) || ( ( document.referrer ).indexOf( '20081207023' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '12/14/3068' ) > 0 ) || ( ( document.referrer ).indexOf( '20081214020' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '12/21/3099' ) > 0 ) || ( ( document.referrer ).indexOf( '20081221019' ) > 0 ) ||
		    ( ( document.referrer ).indexOf( '12/28/3129' ) > 0 ) || ( ( document.referrer ).indexOf( '20081228020' ) > 0 ) ) {
			retValue += "path=tmobile;";
		}
	} else if( dart_value == "football_nfl/gameflash" ) {
		if( ( ( window.location.pathname ).indexOf( '09/07/2906' ) > 0 ) || ( ( window.location.pathname ).indexOf( '280901129' ) > 0 ) ||
			( ( window.location.pathname ).indexOf( '09/28/3047' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20080928020' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '10/05/2962' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081005030' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '10/12/3006' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081012022' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '10/19/3066' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081019003' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '10/26/3137' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081026018' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '11/02/2926' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081102010' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '11/09/3002' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081109021' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '11/16/3071' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081116019' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '11/23/3090' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081123010' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '11/30/2925' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081130009' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '12/07/3031' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081207023' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '12/14/3068' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081214020' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '12/21/3099' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081221019' ) > 0 ) ||
		    ( ( window.location.pathname ).indexOf( '12/28/3129' ) > 0 ) || ( ( window.location.pathname ).indexOf( '20081228020' ) > 0 ) ) {
			retValue += "path=tmobile;";
		}
	}
	return retValue;
}

function cnnad_getPtyp( dart_value, input ) { // sometimes input has an incorrect pty, so return the proper one
	var retValue = input;
	if( cnnad_isTeamPage( dart_value ) ) {
		retValue = cnnad_getPtypHelper( input, "team" );
	} else if( cnnad_isSchedulePage( dart_value ) ) {
		retValue = cnnad_getPtypHelper( input, "schedule" );
	} else if( cnnad_isScoreboardPage( dart_value ) ) {
		retValue = cnnad_getPtypHelper( input, "scoreboard" );
	}
	return retValue;
}

function cnnad_getPtypHelper( input, ptyp ) { // if ptyp exists in input then overwrite ptyp; else add ptyp
	var retValue = input;
	if( input.indexOf( 'ptyp' ) > -1 ) {
		var ptypArray = input.split( ";" );
		for( var x = 0; x < ptypArray.length; x++ ) {
			if( ptypArray[x].indexOf( 'ptyp' ) > -1 ) {
				ptypArray[x] = 'ptyp=' + ptyp + '';
			}
		}
		retValue = ptypArray.join( ";" );
	} else {
		retValue += 'ptyp=' + ptyp + ';';
	}
	return retValue;
}

function cnnad_isTeamPage( zone ) { // determines if the page is a team page
	var retValue = false;
	var teamsIndex = arrayIndexOf( "teams", document.cnnAdPathArray );
	if( teamsIndex > 0 ) {
		if( ( zone == "football_ncaa" ) || ( zone == "football_nfl" ) || ( zone == "baseball_mlb" ) || ( zone == "basketball_nba" ) || ( zone == "basketball_ncaa" ) || ( zone == "hockey_nhl" ) ) { retValue = cnnad_getFile() == "file=index.html;"; }
	}
	return retValue;
}

function cnnad_isPollPage() { // determines if the page is a popup poll ad frame
	var tempPath = cnnad_getPath();
	var retValue = false;
	if( tempPath.indexOf( 'path=POLLSERVER;' ) >= 0 ) {
		retValue = true;
	}
	return retValue;
}

function cnnad_isSchedulePage( zone ) { // determines if the page is a schedule page
	var retValue = false;
	var teamsIndex = arrayIndexOf( "schedules", document.cnnAdPathArray );
	if( teamsIndex > 0 ) {
		if( ( zone == "football_ncaa" ) || ( zone == "football_nfl" ) || ( zone == "baseball_mlb" ) || ( zone == "basketball_nba" ) || ( zone == "basketball_ncaa" ) || ( zone == "golf" ) || ( zone == "hockey_nhl" ) ) { retValue = cnnad_getFile() == "file=index.html;"; }
	}
	return retValue;
}

function cnnad_isScoreboardPage( zone ) { // determines if the page is a scoreboard page
	var retValue = false;
	var teamsIndex = arrayIndexOf( "scoreboards", document.cnnAdPathArray );
	if( teamsIndex > 0 ) {
		if( ( zone == "football_ncaa" ) || ( zone == "football_nfl" ) || ( zone == "baseball_mlb" ) || ( zone == "basketball_nba" ) || ( zone == "basketball_ncaa" ) || ( zone == "hockey_nhl" ) ) { retValue = cnnad_getFile() == "file=index.html;"; }
	}
	if( ( zone == "golf" ) && ( arrayIndexOf( "leaderboards", document.cnnAdPathArray ) > 0 ) ) { retValue = cnnad_getFile() == "file=index.html;"; } // golf uses leaderboards in the url of its scoreboard page
	return retValue;
}

function cnnad_getSlug( input ) { // given a slug, split on the period and pass each element as a value of "slug"
	var retValue = "";
	var adslug_array = input.split( "." );
	for( var x = 0; x < adslug_array.length; x++ ) { retValue += 'slug=' + adslug_array[x] + ';'; }
	return retValue;
}

function cnnad_isCMSStory() { // determines if the story could have been created through the CMS
	var retValue = false;
	if( ( document.cnnAdPathArray )[0].match( /^\d{4}/ ) ) { retValue = true; } // if the first element of the path array is 4 digits, it's a story.
	else if( ( document.cnnAdPathArray )[0] == "pr" ) {
		if( ( ( document.cnnAdPathArray )[1] == "subs" ) || ( ( document.cnnAdPathArray )[1] == "subs2" ) ) {
			if( ( document.cnnAdPathArray )[2] == "siexclusive" ) {
				retValue = true; // if the first three elements of the path array are "pr", "subs" or "subs2", and "siexclusive", it's a story
			}
		}
	}
	return retValue;
}

function cnnad_isWriterPage() { // determines if the page is a writer page
	var retValue = false;
	if( ( document.cnnAdPathArray )[1] == "writers" ) { retValue = true; } // writer stories
	else if( ( ( document.cnnAdPathArray )[0] == "writers" ) && ( ( document.cnnAdPathArray )[2] == "archive" ) ) { retValue = true; } // writer archives
	else if( ( ( document.cnnAdPathArray )[0] == "pr" ) && ( ( document.cnnAdPathArray )[4] == "writers" ) ) { retValue = true; } // siexclusive writer stories
	else if( ( document.cnnAdPathArray )[0] == "si_blogs" ) { retValue = true; }
	else if( ( document.cnnAdPathArray )[0] == "podcasts" ) { retValue = true; } // writer podcasts
	return retValue;
}

function cnnad_getWriter() { // returns the writer's name
	var retValue = "";
	if( ( document.cnnAdPathArray )[1] == "writers" ) { retValue = document.cnnAdPathArray[2]; }
	else if( ( ( document.cnnAdPathArray )[0] == "writers" ) && ( ( document.cnnAdPathArray )[2] == "archive" ) ) { retValue = document.cnnAdPathArray[1]; }
	else if( ( ( document.cnnAdPathArray )[0] == "pr" ) && ( ( document.cnnAdPathArray )[4] == "writers" ) ) { retValue = document.cnnAdPathArray[5]; }
	else if( ( ( document.cnnAdPathArray )[0] == "si_blogs" ) && ( ( document.cnnAdPathArray )[1] == "riffs_reilly" ) ) { retValue = "rick_reilly"; }
	else if( ( ( document.cnnAdPathArray )[0] == "si_blogs" ) && ( ( document.cnnAdPathArray )[1] == "ncaa_tourney" ) ) { retValue = "luke_winn"; }
	else if( ( ( document.cnnAdPathArray )[0] == "si_blogs" ) && ( ( document.cnnAdPathArray )[1] == "basketball" ) && ( ( document.cnnAdPathArray )[1] == "ncaa" ) ) { retValue = "luke_winn"; }
	else if( ( document.cnnAdPathArray )[0] == "si_blogs" ) { retValue = ( document.cnnAdPathArray )[1]; }
	else if( ( document.cnnAdPathArray )[0] == "podcasts" ) { retValue = ( document.cnnAdPathArray )[1]; }
	return retValue;
}

function cnnad_isBlog() { // determines if the story is a blog
	var retValue = false;
	if( ( document.cnnAdPathArray )[0] == "si_blogs" ) { retValue = true; } // if the first element of the path array is "si_blogs", it's a blog.
	return retValue;
}

function cnnad_getPath() { // given a path, split on the slash and pass each element as a value of "path" ( url minus file minus hostname )
	var retValue = "";
	var temp_path = "";
	if( ( document.location.host ).indexOf( 'secondthought' ) > -1 ) { temp_path += document.location.host + "/"; }
	else if( document.location.host == "games.si.cnn.com" ) { temp_path += document.location.host + "/"; }
	if( document.cnnAdPathArray.length > 1 ) {
		if( document.cnnAdPathArray[0] != "si_adspaces" ) {
			temp_path += document.cnnAdPathArray.slice( 0, document.cnnAdPathArray.length - 1 ).join( "/" );
		}
	}
	var path_array = temp_path.split( "/" );
	for( var x = 0; x < path_array.length; x++ ) { retValue += 'path=' + ( path_array[x].replace( /\./g, "_" ) ).replace( /,/g, "_" ) + ';'; }
	return retValue;
}

function cnnad_getFile() { // return the file of the url
	var retValue = "";
	var fileArray = ( document.cnnAdPathArray[ document.cnnAdPathArray.length - 1] ).split( "#" );
	if( document.cnnAdPathArray[0] != "si_adspaces" ) {
		retValue = 'file=' + fileArray[0] + ';'
	}
	return retValue.replace( /\./g, "_" );
}

function arrayIndexOf( searchValue, in_array ) { // if searchValue exists in in_array, return the index of searchValue; otherwise return -1
	var ret_value = -1;
	for( var x = 0; x < in_array.length; x++ ) { if( in_array[x] == searchValue ) { ret_value = x; } }
	return ret_value;
}
