//247

var loc = new String(location);

//configuration
var OAS_url = 'http://oascentral.lifetimetv.com/RealMedia/ads/';

if (top!=self) {
	var hostString = new String("http://" + location.hostname);
	var hostlen = hostString.length;
	var filepath = loc.substring(hostlen,loc.length);
} 
else {
	var filepath = new String(parent.window.location.pathname);
}

var OAS_listpos = 'Top1,Right1';
//switch domain for OAS if i come across Lifetimemag.com
var thisDomain = "www.lifetimetv.com";

//make all boards paths = /boards
var onBoards = (location.hostname.indexOf('boards.lifetimetv.com')!=-1);
if (onBoards) { filepath="/boards"; }

if (onBoards)
	{ 
	OAS_listpos = 'Top1';
}

if (loc.contains('.lovespringinternational.com')) { thisDomain="www.lovespringinternational.com"; }

if (
	(loc.indexOf('lifetimemag.com')!=-1) ||
	(loc.indexOf('lifetimetv.com/lmn')!=-1) ||
	(loc.indexOf('lifetimetv.com/lrw')!=-1)
	)
	{ 
	OAS_listpos = 'Top,Right1';
	
	//also...
	if (loc.indexOf('lifetimemag.com')!=-1) {
		thisDomain="www.lifetimemag.com"; 
	}
}

//added 072804 for games, can be re-used
//this changes the listpos on the fly, but specifies these urls under
//categories. it acts a spec sheet for which ad positions should be included 
//on this page

//Games only listpos rule for now. Initialized to top only
//Let the rules below change that as needed
if (loc.contains('.com/games/')) { OAS_listpos = 'Top1' }
if (loc.contains('.com/games/sudoku/')) { OAS_listpos = 'Top1,Right1' }
if (loc.contains('.com/sweeps/index.html')) { OAS_listpos = 'Top1' }
if (loc.contains('.com/movies/index.php')) { OAS_listpos = 'Top1' }
if (loc.contains('.com/shows/cheerleader/')) { OAS_listpos = 'Top1' }
if (loc.contains('.com/extra/nextstop/')) { OAS_listpos = 'Top1,x01,x50' }
if (loc.contains('.com/breastcancer/')) { OAS_listpos = 'Top1,x01' }

//topright ad - gets Top, Top Right
var topright_ad = [
	'/games/realarcade/ra_moregames.php',
	'/games/gemmys',
	'/games/games_more.php'
	];

//bottomright ad - gets Top, Bottom Right
var bottomright_ad =[
	'/games/index.php'
	];

for (u in topright_ad) {
	if (loc.contains(topright_ad[u])) { OAS_listpos += ",TopRight" }
}

for (u in bottomright_ad) {
	if (loc.contains(bottomright_ad[u])) { OAS_listpos += ",BottomRight" }
}

//if the last character in the path is '/', convert to '/index.html'
if (filepath.substring(filepath.length-1,filepath.length) == "/") { 
	filepath+="index.html";
}


var OAS_sitepage = thisDomain + filepath;

//if this is a cgi produced thank you page, use the hard-coded
//url embedded at the top of the html page

//if (filepath.indexOf('/cgi')!=-1) { 
	if (typeof OAS_sitepage_hard != 'undefined') {
	OAS_sitepage = OAS_sitepage_hard;
	}
//}

//for most pages load only the r1,r2 positions because the top will be a separate call


//added 031703 - dynamic listpos for popups
//see call in drawAdLayer function
//if (!document.referrer.contains('google.com')) {
//if (filepath.indexOf('/reallife/df/')!=-1) { OAS_listpos+=',x32'; }
//if (filepath.indexOf('/reallife/relation/')!=-1) { OAS_listpos+=',x32'; }
if (filepath.indexOf('/games/index.php')!=-1) { OAS_listpos+=',x32'; }
if (filepath.indexOf('/astro/index.html')!=-1) { OAS_listpos+=',x32'; }
if (filepath.indexOf('/sweeps/index.html')!=-1) { OAS_listpos+=',x32'; }
if (filepath.indexOf('/community/members/exclusive/index.php')!=-1) { OAS_listpos+=',x32'; }

//added 040203 - dynamic listpos for Right2 position only
//lifetimetv.com homepage
if ( 
	(
	(filepath=='/index.html') || 
	(filepath=='/ez_index.html')) && (thisDomain == "www.lifetimetv.com")
	) 
	{ OAS_listpos ='Top1,x01,x02,x03,x04'; }

//other sites
//if ((filepath.indexOf('/shows/head2toe/')!=-1) && (thisDomain == "www.lifetimetv.com")) { OAS_listpos+=',Right2,Right3'; }

var OAS_query = 'QUERY';
var OAS_target = '_top';
var OAS_rn = new String(Math.random()); 
var OAS_rns = OAS_rn.substring(2,11);
var OAS_version = 11;

if (navigator.userAgent.indexOf('Mozilla/3') != -1 || 
	navigator.userAgent.indexOf('Mozilla/4.0 WebTV') != -1) { 
	OAS_version = 10; 
}
if (OAS_version>=11) {
	document.write('<SCR' + 'IPT LANGUAGE=JavaScript1.1 SRC="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '?' + OAS_query + '"><\/SCRIPT>');
	document.write('');
}

function OAS_NORMAL(pos) {
	var normalTag = '<A HREF="' + OAS_url + 'click_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '"TARGET=' + OAS_target + '>' +
	'<IMG SRC="' + OAS_url + 'adstream_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '"BORDER=0></A>';	
	document.write(normalTag);
}

function OAS_AD(pos) {
	if (OAS_version>=11) OAS_RICH(pos);
	else OAS_NORMAL(pos);
}

function DisplayAds(position,width,height) {
	var OASpage = OAS_sitepage + '/1' + OAS_rns + '@' + position;
	
	if (OAS_version<11) {
		document.write('<A HREF="' + OAS_url + 'click_nx.ads/' + OASpage + '" TARGET="_top"><IMG SRC="' + OAS_url + 'adstream_nx.ads' + OASpage + '" BORDER="0" WIDTH="' + width + '" HEIGHT="' + height + '"><\/a>');
	}
	else {
		document.write('<SCRIPT LANGUAGE="JavaScript1.1" SRC="' + OAS_url + 'adstream_jx.ads/' + OASpage + '"><\/SCRIPT\>');
	}
}

/* function drawCGIAd(cgipos, cgisite) { */
/* 	//special function for cgi success (or 'thank you') pages */
/* 	OAS_version = 11; */
/* 	cgisite = new String(cgisite); */
/* 	cgisite = cgisite.substring(cgisite.indexOf('oas=')+4,cgisite.length); */
/*  */
/* 	if (OAS_version<11) { */
/* 		document.write('<A HREF="http://oascentral.lifetimetv.com/RealMedia/ads/click_nx.ads/'+cgisite+'/11234567890@'+cgipos+'" TARGET="_top">\ */
/* 		<IMG SRC="http://oascentral.lifetimetv.com/RealMedia/ads/adstream_nx.ads/'+cgisite+'/11234567890@'+cgipos+'" BORDER="0" \ */
/* 		WIDTH="468" HEIGHT="60"></a>'); */
/* 	} */
/* 	else { */
/* 		document.write('<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://oascentral.lifetimetv.com/RealMedia/ads/adstream_jx.ads/'+cgisite+'/11234567890@'+cgipos+'"></SCRIPT>'); */
/* 	} */
/* } */

/*****************************************************************/

function drawBanner(width,height,tilenum,layernum) {
	DisplayAds('Bottom!Bottom',468,60);
}

function drawHREFAd(width,height,tilenum) { }

function drawAdLayer(width,height,tile,layernum,addX,addY) { }
