/* calculate ratio number of 10000*/
var p=parent;var d=document;var axel=Math.random()+"";var rNum=(axel*10000)+"";var dotat=rNum.indexOf(".");var aNum=rNum.substring(0,dotat);
var count=1;var dUnit=false;var dUnitSky=false;var dUnitBox=false;var sops="";var spos;var skyAd=false;
if(!snc){if(p.snc){var snc=p.snc;}else{var snc="";}}
if(!spos){if(p.spos){var spos=p.spos;}else{var spos="";}}
if(!sky_exist){if(p.sky_exist){var sky_exist=p.sky_exist;}else{var sky_exist=false;}}

// set variable defaults

useHouseAds = true;

// house list array - edited by Rachel and Ednel. 
// If you aren't Rachel or Ednel and want to edit
// this file make sure you're using the latest version
// format is:
// added google ads functionality which is still very basic - only one google add exists for the skyscraper slot. 
// I also split the ad formats out into a block each - houseList is for leaderboards, skyList is for skyscrapers,  boxList for boxes.
// flash is selected by filename. you can have a swf leaderboard and a jpg sky or vice-versa. If the swf is created, as for dart, with a clickTag, the same link as for the image will be used.
// leaving include empty means the file may appear anywhere, inserting sadpg or szone include means that a unit will not appear in a page that doesn't have either its szone or sadpg listed
// exclude is performed after include so a page that is first included then excluded will not run the unit.
// include and exclude can contain multiple entries separated by commas -- <Idol,Junos,TopStories>
// default for target is "_top". Use "_blank" to open in a new window. Target doesn't work for flash.
// all artwork, except for swf files, need to filed using the img2 option in the pub tool. Path = /CTVShows/img2/Programs/Ads/
// all swf artwork needs to be FTP'd to: /generic/images/ads/SWF/

// format is:
// <link><sky ad filename><alt text><stats counter><szone exclude><sadpg exclude><szone include><sadpg include><target>
// ads on hold:
// none
var houseList_ctv = new Array(
"<http://www.ctv.ca/redirect/?adcounter=CTV_redirect_BNL_Housead_ctv&redirect=http://ctv1.ctv.ca/contests/bnl/><728_blam_tour.gif><BLAM_Tour><BLAM_Tour><><><><><_blank>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20040105/CornerGas-default/20070109/><728_cornergas_1110.jpg><Corner Gas><cornergas><><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20061220/><728_amerIdolA_20070122.jpg><American Idol><americanidol><><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20061220/><728_amerIdolB_20070122.jpg><American Idol><americanidol><><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20061220/><728_amerIdolC_20070122.jpg><American Idol><americanidol><><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20030923/CSI-default/20060920/><728_csi20070115.jpg><CSI><CSI><><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20050207/GreysAnatomy-default/20070108/><728_greys_ne.jpg><Grey's Anatomy><greysanatomy><><><><><_self>",
"<http://www.media-awareness.ca><728_media_awareness.swf><Media Awareness><mediaawareness><><><><><_self>",
"<http://primetime.ctvdigital.com/primetime/?name=lineup&id=324><728_smith070104.jpg><Watch Smith on Broadband><Smith><><><><><_blank>",
"<http://ctv.livedeal.ca/index.jsp?kbid=3044><728_livedeal_ctv.jpg><LiveDeal on CTV.ca><LiveDealCTV.ca><><><><><_blank>",
"<http://ctv.livedeal.ca/index.jsp?kbid=3044><728_livedeal_ctv.jpg><LiveDeal on CTV.ca><LiveDealCTV.ca><><><><><_blank>",
"<http://www4.insinc.com/ibc/acm/login/13/7/><780_livestream_promo_beach.jpg><CTV Newsnet Live Stream><NewsnetLiveStream><><><><><_blank>");

// format is:
// <link><sky ad filename><alt text><stats counter><szone exclude><sadpg exclude><szone include><sadpg include><target>
// ads on hold:


 

var skyList_ctv = new Array(
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20040105/CornerGas-default/20070109/><CornerGas120_20070115.jpg><Corner Gas><cornergas><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20070112/><AmerIdol2A120_20070115.jpg><American Idol><americanidol><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20070112/><AmerIdol2B120_20070115.jpg><American Idol><americanidol><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20050207/GreysAnatomy-default/20070112/><120_greys20070115.jpg><Grey's Anatomy><greys><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20030923/CSI-default/20060920/><120_csi20070115.jpg><C.S.I.><csi><FilmFest,politicsblog><><><><_self>",
"<><joop_sky1.swf><Hanso><Lost><><><><Lost><_blank>",
"<><google1><><><Consumer,WFive><Consumer,WFive,Lost><><><>",
"<><google3><><><Consumer,WFive><Consumer,WFive,Lost><><><>",
"<><google2><><><Consumer,WFive><Consumer,WFive,Lost><><><>"
);
// format is:
// <link><Box ad filename><alt text><stats counter><szone exclude><sadpg exclude><szone include><sadpg include><target>
// ads on hold:
// none
var boxList_ctv = new Array(
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20040105/CornerGas-default/20070109/><300_cgas2.jpg><Corner Gas><cornergas><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20061220/><300_amerIdolA_20070122.jpg><American Idol><americanidol><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20061220/American_Idol_season6_20061220/20061220/><300_amerIdolB_20070122.jpg><American Idol><americanidol><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20030923/CSI-default/20060920/><300_csi20070115.jpg><CSI><CSI><FilmFest,politicsblog><><><><_self>",
"<http://www.ctv.ca/servlet/ArticleNews/show/CTVShows/20050207/GreysAnatomy-default/20070108/><300_greys_anatomy.jpg><Grey's Anatomy><greysanatomy><FilmFest,politicsblog><><><><_self>",
"<http://www.media-awareness.ca><300_mnet.swf><300MediaAwareness><Media Awareness><politicsblog><><><><_self>",
"<http://primetime.ctvdigital.com/primetime/?name=lineup&id=324><300_smith070104.jpg><Watch Smith on Broadband><Smith><><><><><_blank>",
"<http://ctv.livedeal.ca/index.jsp?kbid=3044><300_livedeal_ctv.jpg><LiveDeal on CTV.ca><LiveDealCTV.ca><politicsblog><ShowsHome><><><_self>",
"<http://ctv.livedeal.ca/index.jsp?kbid=3044><300_livedeal_ctv.jpg><LiveDeal on CTV.ca><LiveDealCTV.ca><politicsblog><ShowsHome><><><_self>",
"<http://www.ctv.ca/politics><300_duffy_live.swf><Mike Duffy Live><Mike Duffy Live><><><politicsblog><><_self>",
"<http://www4.insinc.com/ibc/acm/login/13/7/><300_livestream_promo_beach.jpg><CTV Newsnet Live Stream><NewsnetLiveStream><FilmFest,politicsblog><ShowsHome><><><_blank>",
"<><google4><><><><><FilmFest,PhotoGallery><><>");
// ads on hold:
// none

/* for google ads */
function googleAdVars(adname,width,height){ 

if(adname=="google1" && width=="120"){
google_ad_client = "pub-8664210252640829";
google_alternate_ad_url = "http://www.ctv.ca/generic/dynInclude/ads/skyAd/iframe.html";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text";
google_ad_channel ="1396848704";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "003094";
google_color_url = "003094";
google_color_text = "000000";
}
else if (adname=="google2" && width=="120"){
google_ad_client = "pub-8664210252640829";
google_alternate_ad_url = "http://www.ctv.ca/generic/dynInclude/ads/skyAd/iframe.html";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text";
google_ad_channel ="1396848704";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "003094";
google_color_url = "003094";
google_color_text = "000000";
}
else if (adname=="google3" && width=="120"){
google_ad_client = "pub-8664210252640829";
google_alternate_ad_url = "http://www.ctv.ca/generic/dynInclude/ads/skyAd/iframe.html";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text";
google_ad_channel ="1396848704";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "003094";
google_color_url = "003094";
google_color_text = "000000";
}

else if(width=="300" && szone != "Toronto"){

google_ad_client = "pub-8664210252640829";
google_alternate_ad_url = "http://www.ctv.ca/generic/dynInclude/ads/skyAd/iframe.html";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text";
google_ad_channel ="7884233294";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "003094";
google_color_text = "000000";
google_color_url = "003094";

}
else if(width=="300"){

google_ad_client = "pub-8664210252640829";
google_alternate_ad_url = "http://www.ctv.ca/generic/dynInclude/ads/skyAd/iframe.html";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text";
google_ad_channel ="4661160393";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "003094";
google_color_text = "000000";
google_color_url = "003094";


}

}


// pick house ad
function selectImg(format){


			if (format == "728x90"){
			
			houseArray = houseList_ctv;	}
			else if (format == "300x250"){ houseArray = boxList_ctv;	}
			else if (format == "120x600"){ houseArray = skyList_ctv;}
			houseArrayParse     = /<(.*)><(.*)><(.*)><(.*)><(.*)><(.*)><(.*)><(.*)><(.*)>/g ;
			szoneExclIndex = "5";
			sadpgExclIndex = "6";
			szoneInclIndex = "7";
			sadpgInclIndex = "8";
			popWin = "9";

		
			
dropAds(format);
// alert(houseArray.length);
	randNum = Math.floor(Math.random()*houseArray.length) ;
// alert(randNum);
	url = houseArray.slice(randNum,randNum+1) ;
	left  = houseArray.slice(0,randNum) ;
	right = houseArray.slice(randNum+1) ;
// alert(houseArray);
	houseArray = left.concat(right) ;
	return url ;
	

	
}

function dropAds(format){

		for (i=(houseArray.length) ; i > 0 ; --i) {
		
			var currentZone = houseArray[i-1].replace(houseArrayParse,"$"+szoneExclIndex);
			var currentAdpg = houseArray[i-1].replace(houseArrayParse,"$"+sadpgExclIndex);	
			
			var currentiZone = houseArray[i-1].replace(houseArrayParse,"$"+szoneInclIndex);
			var currentiAdpg = houseArray[i-1].replace(houseArrayParse,"$"+sadpgInclIndex);
			
			var testCurrentZone = currentZone.split(/\,/g);
			var testCurrentAdpg = currentAdpg.split(/\,/g);
			
			var testCurrentiZone = currentiZone.split(/\,/g);
			var testCurrentiAdpg = currentiAdpg.split(/\,/g);		
			
			var currentAdIncl = 1;
			if((currentiZone != "") || (currentiAdpg != "")){
			
			currentAdIncl = 0;
			for (j=(testCurrentiZone.length) ; j > 0 ; --j) {
			if(testCurrentiZone[j-1] == szone){
				currentAdIncl = 1;
			}
			}

			for (j=(testCurrentiAdpg.length) ; j > 0 ; --j) {
			if(testCurrentiAdpg[j-1] == sadpg){
				currentAdIncl = 1;
				
			}			
			}
			}

			for (j=(testCurrentZone.length) ; j > 0 ; --j) {
			if((testCurrentZone[j-1] == szone) && (szone != "")){
				currentAdIncl = 0;
			}
			}
			for (j=(testCurrentAdpg.length) ; j > 0 ; --j) {
			if((testCurrentAdpg[j-1] == sadpg) && (sadpg != "")){
				currentAdIncl = 0;
				
			}			
			}		
			
			if(currentAdIncl == 0){

				houseArray.splice((i-1),1);

			}		
			
		}
}

// house ad code
function writeHouseAd(format){
display = selectImg(format);

if(houseArray.length > 0) {
	pick = 1 ;
		for (i=0 ; i <= pick-1 ; i++ ) {

			var urlVal  = display[0].replace(houseArrayParse,"$1") ;
			var text  = display[0].replace(houseArrayParse,"$3") ;
			var adCounter  = display[0].replace(houseArrayParse,"$4") ;
			var currentDiv = document.getElementById(format+"temp");}
			var img=display[0].replace(houseArrayParse,"$2") ;
			
		if(format=="120x600"){
			var ad_width="120";
			var ad_height="600";
			

		}	
		else if(format=="728x90") {
			var ad_width="728";
			var ad_height="90";
			
		}
		else if (format=="300x250"){
			var ad_width="300";
			var ad_height="250";
}
		var currentPopWin = display[0].replace(houseArrayParse,"$"+popWin);
		var	imgParse     = /(.*)\.(.*)/g ;
		var imgFormat = img.replace(imgParse,"$2") ;
		
		if(isbroadband=true && szone.match(/Video/)){
		currentPopWin = "_blank";
		}
		else if(currentPopWin == ""){
		currentPopWin = "_top";
		}
		
			var adString = "";
			if(imgFormat.indexOf("google")!=-1){
			
			googleAdVars(img,ad_width,ad_height);
			adString+= '<scr'+'ipt type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr'+'ipt>';
 adString += '<div style="display: none"><img src="http://adcounter.theglobeandmail.com/servlet/AdletCounter?ad1=ctv_google_'+ad_width+'x'+ad_height+'_ctv&ad2=ctv_'+sadpg+'Google_'+ad_width+'x'+ad_height+'_ctv" width="1" height="1" border="0"></div>';
			
			}
					else if(imgFormat=="swf"){
adString += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=3,0,0,0" id="FLASH_AD" height="'+ad_height+'" width="'+ad_width+'"><param name="movie" value="http://www.ctv.ca/generic/images/ads/SWF/'+img+'?clickTag='+urlVal+'"><param name="quality" value="autohigh"><param name="bgcolor" value="#ffffff"><param name="wmode" value="opaque"><embed wmode="opaque" src="http://www.ctv.ca/generic/images/ads/SWF/'+img+'?clickTag='+urlVal+'" quality="autohigh" swliveconnect="TRUE" bgcolor="#ffffff" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" height="'+ad_height+'" width="'+ad_width+'"></object>'
                        adString += '<div style="display: none"><img src="http://adcounter.theglobeandmail.com/servlet/AdletCounter?ad1=ctv_'+adCounter+'House_'+ad_width+'x'+ad_height+'swf_ctv&ad2=ctv_'+sadpg+'House_'+ad_width+'x'+ad_height+'_ctv" width="1" height="1" border="0"></div>';

}
		else {
			adString += '<a href="'+urlVal+'" target="'+currentPopWin+'"><img src="http://www.ctv.ca/archives/CTVShows/img2/Programs/Ads/'+img+'" width="'+ad_width+'" name="&lid=AdLink_' + adCounter + '_' +ad_width+'x'+ad_height+ '" height="'+ad_height+'" alt="'+text+'" border="0"></a>';
			adString += '<div style="display: none"><img src="http://adcounter.theglobeandmail.com/servlet/AdletCounter?ad1=ctv_'+adCounter+'House_'+ad_width+'x'+ad_height+'_ctv&ad2=ctv_'+sadpg+'House_'+ad_width+'x'+ad_height+'_ctv" width="1" height="1" border="0"></div>'; 

}

// if(format == '120x600'){
// document.write('<scr'+'ipt type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr'+'ipt>')
// }
// else{
if((document.getElementById(format+"temp")) && (imgFormat.indexOf("google")==-1)){

			currentDiv.innerHTML = adString;
			currentDiv.style.display = "block";
}
else{

document.write(adString);
}
}
}	

// doubleclick code

function writeDClick(size) {
if(!ord){var abc=Math.random()+"";var ord=abc.substring(2,abc.length);}
if((size=="728x90")&&(sky_exist)){spos="dsky";}
if(isbroadband=true && szone.match(/Video/)){
 
var adCodeTxt ='<iframe src="http://ad.ca.doubleclick.net/adi/ctv/Video'+szone+';!category=pop;!category=video;!category=float;!category=expand;sz='+size+';ord='+ord+'" id="adiframe" width="728" height="90" scrolling="no" frameborder="0"></iframe>';
adCodeTxt += '<div style="display: none"><img src="http://adcounter.theglobeandmail.com/servlet/AdletCounter?ad1=ctv_'+sadpg+'Dart_'+size+'_ctv" width="1" height="1" border="0"></div>';
document.getElementById(size+'temp').innerHTML=adCodeTxt;
}
else{
var adCodeTxt='<scr'+'ipt type=\"text/javascript\" src=\"http://ad.ca.doubleclick.net/adj/ctv/'+szone+';abr=!webtv;mode='+smode+';loc=hub;adpg='+sadpg+';'+sarena+';ops='+sops+';pos='+spos+';kw=;nc='+snc+';sz='+size+';tile='+count+';ord='+ord+'?\">'+'<\/scr'+'ipt>';

document.write(adCodeTxt);
document.write('<div style="display: none"><img src="http://adcounter.theglobeandmail.com/servlet/AdletCounter?ad1=ctv_'+sadpg+'Dart_'+size+'_ctv" width="1" height="1" border="0"></div>');
	var currentDiv = document.getElementById(size+"temp");
	currentDiv.style.display = "none";
}
	count=count+1;spos="";
}









// main functions
// the stardard way to place an ad is writeHouseAd("120x600");
function placeRandom(format){

// ratio of doubleclick ads to house ads is 1 to nth (right now 1 to 8) 
var nth = 8;
var rnd = Math.floor(Math.random() * nth) + 1;
if (rnd == nth) {
     useHouseAds = false; 
}
// initialize variables and set conditions
// exceptions to this ratio follow:
// only doubleclick ads on the Contest Hub 
// - traffic is low on this hub and it 
// makes it easy to see dart ads to have 
// one hub with only doubleclick.


// skyscrapers ratio
if((format == "120x600")){
	useHouseAds = true;
	if(aNum>=10000){useHouseAds=false;}
	}



// Home
if((szone == "Home")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=8000){useHouseAds=false;}}
	}


// TopStories
if((szone == "TopStories")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=7000){useHouseAds=false;}}
	if(format=="300x250"){if(aNum>=5000){useHouseAds=false;}}
	}

// Canada, World, Health
if((szone == "Canada" || szone == "World" || szone == "Health")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=7000){useHouseAds=false;}}	
	if(format=="300x250"){if(aNum>=5000){useHouseAds=false;}}
	}

// Business
if((szone == "Business")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=0000){useHouseAds=false;}}
	if(format=="120x600"){if(aNum>=10000){useHouseAds=false;}}
	}

// SciTech
if((szone == "SciTech")){
	useHouseAds = true;
	if(format=="300x250"){if(aNum>=0000){useHouseAds=false;}}
	}

// Entertainment
if((szone == "Entertainment" || szone == "entertainment")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=7000){useHouseAds=false;}}
	if(format=="300x250"){if(aNum>=0){useHouseAds=false;}}
	if(format=="120x600"){if(aNum>=10000){useHouseAds=false;}}	
	}

// only paid ads on Canada AM 
if((szone == "CanadaAM")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=3000){useHouseAds=false;}}
	if(format=="120x600"){if(aNum>=10000){useHouseAds=false;}}
	}

// only paid ads on Poll Results 
if((szone == "AM")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=0000){useHouseAds=false;}}
	}

// only paid ads on Photo Gallery
if((szone == "PhotoGallery" && format == "300x250")){
	useHouseAds = true;
	if(format=="300x250"){if(aNum>=8000){useHouseAds=false;}}
	}

// Sports
if((szone == "Sports")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=0000){useHouseAds=false;}}
	if(format=="120x600"){if(aNum>=10000){useHouseAds=false;}}	
	}

// Kris Abel
if((szone == "krisabel")){
	useHouseAds = true;
	if(format=="300x250"){if(aNum>=0000){useHouseAds=false;}}
	}

// only paid ads on Programs, TV Listings and Contest
if((szone == "ShowsHome" || szone == "ComingUp" || szone == "Daytime" || szone == "HDTV" ||  szone == "LateNight" || szone == "TopShows" ||  szone == "tvlist" || szone == "AToZ" || szone == "Primetime" || szone == "ContestsHub")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=0){useHouseAds=false;}}
	}

// only paid ads on Weather 
if((szone == "Weather")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>=0000){useHouseAds=false;}}
	if(format=="120x600"){if(aNum>=5000){useHouseAds=false;}}
	}

// only paid on Junos
if((szone == "Junos")){
	useHouseAds = true;
	}

// only paid on Oscars
if((szone == "Oscars")){
	useHouseAds = true;
	}

// only paid on FilmFest
if((szone == "FilmFest")){
	useHouseAds = true;
	}

// only paid ads on Toronto
if((szone == "Toronto" && format == "300x250")){
	useHouseAds = true;
	if(format=="300x250"){if(aNum>=4000){useHouseAds=false;}}
	}

// only house ads on Consumer
if((szone == "Consumer")){
	useHouseAds = true;
	}



// only paid ads on test
if((szone == "test")){
	useHouseAds = false;
	}

// only house ads on PSA
if((szone == "PSA")){
	useHouseAds = true;
	}


// only house ads on idol
if((szone == "Idol" || szone == "idol")){
	useHouseAds = true;
	if(format=="300x250"){if(aNum>=10000){useHouseAds=false;}}		
	}


// Degrassi
if((szone == "Degrassi")){
	useHouseAds = true;
	if(format=="728x90"){if(aNum>6000){useHouseAds=false;}}
	if(format=="300x250"){if(aNum>=4000){useHouseAds=false;}}		
	}

// Instant Star
if((szone == "InstantStar")){
	useHouseAds = true;
	}

// Video
if(szone.match(/Video/)){
	useHouseAds = true;
	}

// Video News Zones
if((szone == "VideoETalk" || szone == "VideoNews" || szone == "VideoElevenP" || szone == "VideoWFive" || szone == "VideoNewsTab" || szone == "VideoDocs" || szone =="VideorelatedTopStories" || szone =="VideorelatedWorld" || szone=="VideorelatedCanada" || szone=="VideoVGDEGR" || szone=="VideoVGCIDOL")){
	useHouseAds = false;
	}

// Happy box ads
if((szone == "happy" && format == "300x250")){
	useHouseAds = false;
	}

// Happy leaderboard
if((szone == "happy" && format == "728x90")){
	useHouseAds = false;
	}

// Lost
if (sadpg == "Lost" && format =="120x600") {
	useHouseAds = true;
}

if((dUnitSky)||(dUnitBox)){useHouseAds=false;}

if(useHouseAds == true){
	writeHouseAd(format);
	}
else {
	writeDClick(format);
}
	}
// these functions are for reverse-compatibility 
function placeCTVRandom120x600Img(isBlank){

placeRandom("120x600");
}
function placeRandom728x90Img(isBlank){

placeRandom("728x90");
}

function placeRandom300x250Img(isBlank){
placeRandom("300x250");

}

