var cmtoprightSM = "CMTOPRT410X60";
var cmtoprightLG = "CMTOPRT610X60";

// Constructor function for C_Ad Class
// is needed, this is avoided by using Custom Objects
function CM_Ad(pagepos, w, h){
	this.pagepos = pagepos;
	this.w      = w;
	this.h      = h;
}

// Build 'associative array' of CM_AdPlc
CM_AdPlc = new Object();

CM_AdPlc[cmtoprightSM] = new CM_Ad("cmtopright", "410", "60"); 
CM_AdPlc[cmtoprightLG] = new CM_Ad("cmtopright", "510", "60");

// get Double-click script tag
function getAd(thisAd){
	return '<scr'+'ipt language="JavaScript1.1" SRC="http://adremote.timeinc.net/js.ng/site=ew&channel=cm&adsize='+CM_AdPlc[thisAd].w+'x'+CM_AdPlc[thisAd].h+'&pagepos='+CM_AdPlc[thisAd].pagepos+'"></scr'+'ipt>';
}

function getAdName() {
	//var rn = Math.floor(Math.random()*100);
	
	//if (rn<50) return cmtoprightSM;
	//else return cmtoprightLG;
	
	return cmtoprightLG;
}

function writeCMAD(){
	var thisAd = getAdName();
	//  alert(thisAd); // for testing
	
	var finalAd = getAd(thisAd);
		
	document.write(finalAd);
}

writeCMAD();

