document.write("<script language='javascript' src='http://nymag.com/js/2/adconfig.js'><\/script>");

// Ad Display Globals
var zzzadslot = Math.floor(Math.random() * 10000000000000);
var adurl = "http://ad.doubleclick.net/adj/nym.nymag";
var pageads=new Array();
var ns4webtv=(((!document.images && navigator.userAgent.indexOf('Mozilla/2.') >= 0)||navigator.userAgent.indexOf("WebTV")>= 0))?true:false;
var gAdSubSection='';
var adid='';

var rotate_timer_id;
var rotate_timer_interval = 1;  // seconds
var rotate_timer_counter = 0;
var rotate_ads = new Array;
var rotate_ads_index = 0;

addOnload(rotateOnload);

function addOnload(new_function) {
	var old_onload = window.onload; 

	if (typeof window.onload != "function") { 
		window.onload = new_function; 
	} else { 
		window.onload = function() {
			old_onload();
			new_function();
		}
	} 
}

function getHashLength(h) {
	var ctr = 0;
	for (i in h) ctr++;
	return ctr;
}

function getTimestamp() {
	var dt = new Date();
	return dt.toString().replace(/^.+(\d\d:\d\d:\d\d).+$/, "$1");
}

function logmsg(s) {
	var logger = document.getElementById("logger");
	if (logger) {
		logger.innerHTML = "[" + getTimestamp() + "] " + s + "<br>" + logger.innerHTML;
	}
}

function updateOrd() {
	zzzadslot = Math.floor(Math.random() * 10000000000000);
}

function getRandomNum() {
	return Math.random() * 10000000000000000;
}

function rotateOnload() {
	logmsg("** rotateOnload **");

	if (!rotate_ads_flag) {
		logmsg("ad reloading disabled");
		return;
	}

	if (rotate_timer_id) {
		logmsg("rotate timer has already been set");
		return;
	}

	rotate_timer_id = window.setInterval("rotateAds()", rotate_timer_interval * 1000);
}

function rotateStop() {
	logmsg("** ad reload stopped **");
	window.clearInterval(rotate_timer_id);
	rotate_timer_id = null;
}

function rotateAds() {
	rotate_timer_counter++;

	for (ad_id in rotate_ads) {
		var first_time = rotate_ads[ad_id].display_time == 0;

		if ((rotate_timer_counter - rotate_ads[ad_id].display_time) >= rotate_ads[ad_id].reload_interval) {
			if (first_time) {
				insertIframe({ id: ad_id, width: rotate_ads[ad_id].width, height: rotate_ads[ad_id].height });
				rotate_ads[ad_id].display_time = rotate_timer_counter;
			}

			if (rotate_ads_index >= getHashLength(rotate_ads)) {
				rotate_ads_index = 0;
				updateOrd();
			}

			reloadAd({ ad_id: ad_id, js_uri: rotate_ads[ad_id].js_uri });
			rotate_ads[ad_id].display_time = rotate_timer_counter;
			rotate_ads_index++;

			break;
		}
	}
}

function reloadAds() {
	if (pageads && pageads.length > 0) {
		updateOrd();
		resetAdTimers();

		for (i in pageads) {
			logmsg("*** reloadAds(): " + pageads[i].AdId);
			if (pageads[i].AdId) {
				insertIframe({
					id: pageads[i].AdId,
					width: pageads[i].iWidth,
					height: pageads[i].iHeight
				});
				reloadAd({ ad_id: pageads[i].AdId, js_uri: pageads[i].dartjsuri });
			}
		}
	}
}

// args: { ad_id, js_uri }
function reloadAd(args) {
	var code = '<ht' + 'ml><bo' + 'dy><scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
		args.js_uri + ';ord=' + zzzadslot + ';random=' + getRandomNum() +
		'"></sc' + 'ript></b' + 'ody></h' + 'tml>';
	logmsg("reloadAd(): reloading " + args.ad_id + ": " + escapeHtml(code));
	injectIframe("adfr_" + args.ad_id, code);
}

function resetAdTimers() {
	for (id in rotate_ads) {
		rotate_ads[id].display_time = rotate_timer_counter;
	}
}

function escapeHtml(s) {
	return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}

function formatForHtml(s) {
	return s.replace(/\n/g, "<br>");
}

function getIframeObj(id) {
	return document.getElementById(id);
}

function getIframeDoc(id) {
	var idoc;
	var iobj = getIframeObj(id);

	if (iobj)	{
		if (iobj.contentDocument) {
			idoc = iobj.contentDocument; 
		} else if (iobj.contentWindow) {
			idoc = iobj.contentWindow.document;
		} else {
			idoc = iobj.document;
		}
	}

	return idoc;
}

// args: { id, width, height }
function insertIframe(args) {
	var ad_div = document.getElementById(args.id);
	if (!ad_div) {
		logmsg("error: missing ad container id=" + args.id);
		return false;
	}

	if (getIframeDoc("adfr_" + args.id)) {
		//logmsg("iframe document already exists id=" + args.id);
		return false;
	}

	ad_div.innerHTML = '<ifra' + 'me id="adfr_' + args.id + '" src="about:blank" width="' +
		args.width + '" height="' + args.height +
		'" allowtransparency="true" marginwidth="0" marginheight="0" frameborder="0" ' +
		'scrolling="no"' + 'z-index="0" onload=\'fixIframeSize("adfr_' + args.id +
		'")\'></ifra' + 'me>';
}

function injectIframe(id, str) {
	var idoc = getIframeDoc(id);

	if (!idoc) {
		logmsg("error: undefined frame document for " + id);
		return false;
	}

	idoc.open();
	idoc.write(str);
//	idoc.close();
	window.setTimeout("closeIframeDoc('" + id + "')", 3000);
}

function closeIframeDoc(id) {
	var idoc = getIframeDoc(id);
	idoc.close();
}

function fixIframeSize(id) {
	var iobj = getIframeObj(id);
	var idoc = getIframeDoc(id);

	if (idoc && idoc.body) {
		if (iobj.width == 336) iobj.width = 300;
		if (iobj.height == 800) iobj.height = 600;
		window.setTimeout('fixIframeSize2("' + id + '")', 100);
	}
}

function fixIframeSize2(id) {
	var iobj = getIframeObj(id);
	var idoc = getIframeDoc(id);

	if (idoc && idoc.body) {
		if (idoc.body.scrollWidth > 300) iobj.width = idoc.body.scrollWidth;		
		if (idoc.body.scrollHeight > 600) iobj.height = idoc.body.scrollHeight;
	}
}


// DART section targeting
function convertSect(SectionName,SubSectionName) {
	cvtSect = new Object;

	// Convert DART section identifiers to Falk IDs (baseline)
	if (SectionName == 'gHome')		cvtSect.SectionName='homepage'
	else if (SectionName == 'gNews')	cvtSect.SectionName='news'
	else if (SectionName == 'gArts')	cvtSect.SectionName='arts'
	else if (SectionName == 'gShops')	cvtSect.SectionName='shopping'
	else if (SectionName == 'gFFF') 	cvtSect.SectionName='fashion'
	else if (SectionName == 'gFFF') 	cvtSect.SectionName='fashionshows'
	else if (SectionName == 'gTravel') 	cvtSect.SectionName='travel'
	else if (SectionName == 'gTest')	cvtSect.SectionName='test'
	else if (SectionName == 'arts')	 	cvtSect.SectionName='arts'
	else if (SectionName == 'bony') 	cvtSect.SectionName='bestofny'
	else if (SectionName == 'doctors') 	cvtSect.SectionName='bestdoctors'
	else if (SectionName == 'lawyers') 	cvtSect.SectionName='lawyers'
	else if (SectionName == 'homepage') 	cvtSect.SectionName='homepage'
	else if (SectionName == 'news') 	cvtSect.SectionName='news'
	else if (SectionName == 'personals') 	cvtSect.SectionName='springstreet'
	else if (SectionName == 'realestate') 	cvtSect.SectionName='realestate'
	else if (SectionName == 'propdetail') 	cvtSect.SectionName='propdetail'
	else if (SectionName == 'restaurants') 	cvtSect.SectionName='restaurants'
	else if (SectionName == 'shopping') 	cvtSect.SectionName='shopping'
	else if (SectionName == 'travel') 	cvtSect.SectionName='travel'
		else if (SectionName == 'family') 	cvtSect.SectionName='family'
		else if (SectionName == 'beauty') 	cvtSect.SectionName='beauty'
	else if (SectionName == 'test')		cvtSect.SectionName='test'
	else if (SectionName == 'everything')		cvtSect.SectionName='everything'
	else 								cvtSect.SectionName='ros';

	// Regex the DART based on URL criteria
	// This overrides page-based rules, so use conservatively
	// Note: hierarchical ranking, highest depth items must go first!
	var currenturl = parent.location.href;

	if (currenturl.match("bestofny"))		cvtSect.SectionName='bestofny';
	else if (currenturl.match("bestdoctors"))	cvtSect.SectionName='bestdoctors';
	else if (currenturl.match("lawyers"))		cvtSect.SectionName='lawyers';
	else if (currenturl.match("urban")) 		cvtSect.SectionName='guides';
	else if (currenturl.match("guides"))		cvtSect.SectionName='guides';
	else if (currenturl.match("visitorsguide"))	{ cvtSect.SectionName='travel'; cvtSect.SubSectionName='visitorsguide'; }
	else if (currenturl.match("nymetro/arts"))	cvtSect.SectionName='arts';
	else if (currenturl.match("news"))		cvtSect.SectionName='news';
	else if (currenturl.match("fashion/fashionshows")) cvtSect.SectionName='fashionshows';
	else if (currenturl.match("fashion"))		cvtSect.SectionName='fashion';
	else if (currenturl.match("homedesign"))	cvtSect.SectionName='homedesign';
	else if (currenturl.match("movies"))		cvtSect.SectionName='movies';
	else if (currenturl.match("nightlife"))		cvtSect.SectionName='nightlife';
	else if (currenturl.match("restaurants"))	cvtSect.SectionName='restaurants';
	else if (currenturl.match("food"))			cvtSect.SectionName='restaurants';
	else if (currenturl.match("marketplace"))	cvtSect.SectionName='shopping';
	else if (currenturl.match("storeopenings"))	cvtSect.SectionName='shopping';
	else if (currenturl.match("weddings"))		cvtSect.SectionName='weddings';
	else if (currenturl.match("everything"))	cvtSect.SectionName='everything';
	else if (currenturl.match("travel"))		cvtSect.SectionName='travel';
	else if (currenturl.match("family"))		cvtSect.SectionName='family';
	else if (currenturl.match("beauty"))		cvtSect.SectionName='beauty';


	// Populate Falk sub-section based on destination URL
	// This overrides all previous rules defined
	var adflag = 0;
	for (var i=0; i < adsection.length; i++) {
		var pattern = adsection[i][0];
		if (!adflag && currenturl.match(pattern)) {
			cvtSect.SectionName=adsection[i][1];
			cvtSect.SubSectionName=adsection[i][2];	
			adflag = 1;
		}
	}

	if (!adflag) cvtSect.SubSectionName='';

	if (document.referrer.match("halstead.com") &&
		(cvtSect.SectionName == "restaurants" || cvtSect.SectionName == "shopping")) {
		cvtSect.SubSectionName += ";referral=halstead";
	}
	
	return cvtSect;
}

function cDARTAd(AdId, Ord,hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, sSubSect){
	this.base = __cDARTAd;
	this.base(Ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, sSubSect);
	this.AdId = AdId;

	if (AdId) {
		if (AdId == "160x60") {
			AdId += (sSubSect == "left") ? "_left" : "_right";
		}

		var config_section = this.sectionname + (this.subsection ? "-" + this.subsection : "");
		if (!rotate_config[config_section]) {
			config_section = this.sectionname;
		}
		logmsg("cDARTAd(): config_section: " + config_section + ", ad_id: " + AdId +
			", sectionname: " + this.sectionname + ", subsection: " + this.subsection);

		if (rotate_config[config_section] && rotate_config[config_section]["formats"]) { 
			for (var i=0; i < rotate_config[config_section]["formats"].length; i++) {
				if (rotate_config[config_section]["formats"][i] == AdId) {
					rotate_ads[AdId] = {
						reload_interval: rotate_config[config_section].reload_interval,
						display_time: 0,
						js_uri: this.getJsUri(),
						width: (this.iWidth == 336) ? 300 : this.iWidth,
						height: (this.iHeight == 800) ? 600 : this.iHeight
					};

					logmsg("cDARTAd(): adding " + AdId + " to rotate list with reload interval=" +
						rotate_ads[AdId].reload_interval);
				}
			}
		}
	}
}

function __cDARTAd(Ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, sSubSect){
	this.ord=Ord;
	this.hrefname=hRefName;
	this.sectionname=SectionName;
	this.slot=sSlot;
	this.layer=sSlotLayer;
	this.tile=iTile;
	this.w=iWidth;
	this.h=iHeight;
	this.iWidth=iWidth;
	this.iHeight=iHeight;
	this.sW=iWidth+"x"+iHeight;
	this.subsection=sSubSect;

	cvtSect=convertSect(this.sectionname,this.subsection);
	this.sectionname=cvtSect.SectionName;
	if (this.subsection.length == 0) {
		this.subsection=cvtSect.SubSectionName;
	} else if ((this.subsection == "left") || (this.subsection == "right")) {
		this.position=this.subsection;
		if (cvtSect.SubSectionName.length > 0) {
			// this.position=this.subsection;
			this.subsection=cvtSect.SubSectionName;
		}
	} else {
	 	this.subsection=sSubSect;
	}

	// DART specific tuning here
	var position = '';
	if (this.position == 'left') {
		position='pos=left;';
		if (this.subsection == 'left')
			this.subsection='';
	} else if (this.position == 'right') {
		position='pos=right;';
		if (this.subsection == 'right')
			this.subsection='';
	}

	var multimedia = '';
	if ((this.w == 160) && (this.h == 60) && (position == 'pos=left;')) {
		multimedia = 'dcopt=ist;';
	}

	// DART Initiate
	if (this.subsection.length > 0)
		this.dartsubsect = this.subsection;

		if ((this.w == 300) && (this.h == 250)) {
		this.w = ''; this.h = '';
		this.dartres='300x250';
	} else if ((this.w > 0) && (this.w != 336))
		this.dartres=this.w+'x'+this.h;
	else if ((this.w == 336) && (this.h == 280)) {
		this.w = ''; this.h = '';
		this.dartres='300x250';
	} else if (this.w == 336) {
		this.w = '300'; this.h = '600';
		this.dartres='300x600';
	} 

	if (this.dartres == '3x3')
		this.sectionname = 'ros';


	// Show target placement (useful for testing)
	// document.writeln('<font color=\"#DD0000\" size=1>Ad tag: sect='+this.sectionname+((this.subsection.length>0)?';subs='+this.dartsubsect:'')+';comp='+adid+((position.length>0)?';'+position:'')+'</font><br>');

	this.zone = this.sectionname;

	// DART Build Tag
	this.dartjsuri = adurl + '/' + this.zone + ';sect=' + this.sectionname +
		((this.subsection.length > 0) ? ';subs=' + this.dartsubsect : '') + ';comp=' + adid +
		((position.length > 0)?';'+position:';') + 'tile=' + this.tile + ';' + multimedia + 'sz=' + this.dartres ;
		// ';' + position + ';tile=' + this.tile + ';' + multimedia + 'sz=' + this.dartres ;

	this.dartjssrc='<scr' + 'ipt type="text/javascript" language="JavaScript" src="'+this.dartjsuri +
		';ord=' + this.ord + '?"></sc' + 'ript>';

	this.core=this.dartjssrc;

	// document.writeln('<font color=\"#DD0000\" size=1>Ad url: '+adurl+'/'+this.sectionname+((this.subsection.length>0)?this.dartsubsect:'')+';sect='+this.sectionname+((this.subsection.length>0)?'subs='+this.dartsubsect:'')+';tile='+this.tile+';'+multimedia+'sz='+this.dartres+';'+position+'ord='+this.ord+'</font><p>');

	pageads[pageads.length]=this; // Ad to Collection for CloseAds

	this.write=function() { // write out Ad
		document.writeln(this.getAdCode());
	}

	this.getAdCodeBody = function() {
		return this.dartjsbody;
	}
	
	this.getAdCode = function() {
		return this.core;
	}

	this.getJsUri = function() {
		return this.dartjsuri;
	}

	this.close=function() { }
}

function DisplayAd(AdId, ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, SubSection) {
	var oFalkAd=new cDARTAd(AdId, ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, SubSection);
	oFalkAd.write();
}

function GetAdCode( AdId, ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, SubSection ) {
	var oFalkAd=new cDARTAd(AdId, ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, SubSection);
	return oFalkAd.getAdCode();
}

function GetAdCodeBody( AdId, ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, SubSection ) {
	var oFalkAd=new cDARTAd(AdId, ord, hRefName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight, SubSection);
	return oFalkAd.getAdCodeBody();
}

function EndAds() {	if (pageads.length>0)pageads[0].close(); }

function InsertAd(AdId, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight) {
	DisplayAd(AdId, zzzadslot, SectionName, SectionName, sSlot, sSlotLayer, iTile, iWidth, iHeight);
}

function InsertRichMedia() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:1;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd('', zzzadslot, sSect, sSect, '', '', iTile,'','', sSub);
}

function InsertBanner() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:1;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("468x60", zzzadslot, sSect, sSect, '', '', 7, 468, 60, sSub);
}

function InsertBanner2() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:1;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("728x90", zzzadslot, sSect, sSect, '', '', 2, 728, 90, sSub);
}

function InsertSquare() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:9;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("180x150", zzzadslot, sSect, sSect, '', '', iTile, 180, 150, sSub);
}

function InsertSmallSquare1() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:5;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("120x60", zzzadslot, sSect, sSect, '', '', iTile, 120, 60, sSub);
}

function InsertSmallSquare2() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:6;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	dISplayAd("120x60", zzzadslot, sSect, sSect, '', '', iTile, 120, 60, sSub);
}

function InsertSmallSquare3() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:3;
	// var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	var sSub = "right";
	DisplayAd("160x60_right", zzzadslot, sSect, sSect, '', '', 3, 160, 60, sSub);
}

function InsertSmallSquare3_2() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	// var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	var sSub = "left";
	DisplayAd("160x60_left", zzzadslot, sSect, sSect, '', '', 1, 160, 60, sSub);
}

function InsertSmallSquare3_3() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:4;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("160x60", zzzadslot, sSect, sSect, '', '', 3, 160, 60, sSub);
}

function InsertSmallSquare4() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:3;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	var sSub = "left";
	DisplayAd("160x60_left", zzzadslot, sSect, sSect, '', '', 1, 160, 60, sSub);
}

function InsertMedSquare() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:1;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("250x90", zzzadslot, sSect, sSect, '', '', 8, 250, 90, sSub);
}

function InsertBigSquare() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:1;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("250x250", zzzadslot, sSect, sSect, '', '', iTile, 250, 250, sSub);
}

function InsertBigSquare2() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:5;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("336x280", zzzadslot, sSect, sSect, '', '', 5, 300, 250, sSub);
}

function InsertTower() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("120x600", zzzadslot, sSect, sSect, '', '', iTile, 120, 600, sSub);
}

function InsertTower2() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:6;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd('160x600', zzzadslot, sSect, sSect, '', '', 4, 160, 600, sSub);
}

// Start right tower units -------------------------------------------------
function InsertRightAd(ad_id) {
	if (show_ad_format_flags && show_ad_format_flags[ad_id]) {
		try {
			eval("InsertRight_" + ad_id + "()");
		} catch(er) {
		}
	}
}

function InsertRight_336x280() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
//	return GetAdCode(zzzadslot, sSect, sSect, '', '', iTile, 300, 250, sSub);
	// DisplayAd( zzzadslot, sSect, sSect, '', '', iTile, 336, 280, sSub );
	DisplayAd("336x280", zzzadslot, sSect, sSect, '', '', 5, 300, 250, sSub);
}

function InsertRight_336x280_2() {
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd("336x280_2", zzzadslot, sSect, sSect, '', '', 5, 300, 250, sSub);
}

function InsertRight_336x600() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
//	return GetAdCode(zzzadslot, sSect, sSect, '', '', iTile, 336, 600, sSub);
	//// DisplayAd( zzzadslot, sSect, sSect, '', '', iTile, 300, 250, sSub );
	DisplayAd("336x600", zzzadslot, sSect, sSect, '', '', 9, 336, 600, sSub);
}
function InsertRight_336x800() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
//	return GetAdCode(zzzadslot, sSect, sSect, '', '', iTile, 336, 800, sSub);
	//// DisplayAd( zzzadslot, sSect, sSect, '', '', iTile, 300, 250, sSub );
	DisplayAd("336x800", zzzadslot, sSect, sSect, '', '', 9, 336, 800, sSub);
}
function InsertRight_160x600() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
//	return GetAdCode(zzzadslot, sSect, sSect, '', '', iTile, 160, 600, sSub);
	DisplayAd("160x600", zzzadslot, sSect, sSect, '', '', 4, 160, 600, sSub);
}
// End right tower units ---------------------------------------------------


function InsertGoogle() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:8;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd( '', zzzadslot, sSect, sSect, '', '', iTile, 3, 3, sSub );
}

function InsertButton() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:3;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd( '', zzzadslot, sSect, sSect, '', '', iTile, 125, 125, sSub);
}
function InsertPopup() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:5;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd( '', zzzadslot, sSect, sSect, '', '', iTile, 1, 1, sSub );
}

function InsertHalfB() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:2;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd( '', zzzadslot, sSect, sSect, '', '', iTile, 234, 60, sSub );
}

function InsertFashionAd() {
	// var bNum=(arguments.length>0)?arguments[0]:'';
	var sSect=(arguments.length>1)?arguments[1]:'fashion';
	var iTile=(arguments.length>2)?arguments[2]:5;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd( '', zzzadslot, sSect, sSect, '', '', iTile, 100, 60, sSub);
}

function InsertFashionSlideshowInterstitial() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:5;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd('700x440', zzzadslot, sSect, sSect, '', '', iTile, 700, 440, sSub);
}

function Insert160x140() {
	// var bNum=(arguments.length>0)?arguments[0]:1;
	var sSect=(arguments.length>1)?arguments[1]:gAdTag;
	var iTile=(arguments.length>2)?arguments[2]:5;
	var sSub=(arguments.length>3)?arguments[3]:gAdSubSection;
	DisplayAd('160x140', zzzadslot, sSect, sSect, '', '', iTile, 160, 140, sSub);
}

// Soon to be obsolete
function DisplayBanner( hRefName, SectionName ) {
	DisplayAd( '', zzzadslot, hRefName, SectionName, "slot1", "adslot1", 7, 468, 60, gAdSubSection );
}

function DisplayTower( hRefName, SectionName ) {
	DisplayAd( '', zzzadslot, hRefName, SectionName, "vmslot1", "vmslot1", 2, 120, 600, gAdSubSection );

}

function DisplayTower2( hRefName, SectionName ) {
	DisplayAd( '', zzzadslot, hRefName, SectionName, "vmslot1", "vmslot1", 2, 160, 600, gAdSubSection );

}


function DisplayButton( hRefName, SectionName ) {
	DisplayAd( '', zzzadslot, hRefName, SectionName, "sqslot1", "sqslot1", 3, 125, 125, gAdSubSection );
}

// CloseAds function is obsolete. Use EndAds.
var CloseAds=EndAds;

// Below is from DoubleClick to avoid disappearance of dropdowns when Polo Ad is served.

