/* Atlas support. Don't call directly, use the atlas_ad and atlas_populator helper methods */
var ad_count=0;
var ad_string="";
//var AAMB1="";var AAMB2="";var AAMB3="";var AAMB4="";var AAMB5="";
function place_ad(width, height, position) {
	ad_count += 1;
	ad_string += "/AAMB"+ad_count+"/aamsz="+width+"x"+height+"/pos="+position;
	document.writeln('<div style="position:relative;width:'+width+'px;height:'+height+'px;" id="atlas'+ad_count+'"></div>');
}
function load_ads(url) {
	var aamRnd = Math.round(Math.random() * 1000000);
	document.write('<SCR' + 'IPT SRC="' + url + '/acc_random=' + aamRnd + '/pageid=' + aamRnd + ad_string + '?" type="text/JavaScript" language="JavaScript">'); 
	document.write('</SCR' + 'IPT>');
}
function generate_ads() {
	for (a = 1; a <= ad_count; a++) {
		document.write('<div id="INVatlas'+a+'" style="display:none">'+eval('AAMB'+a)+'</div>');
	}
}
function populate_ads() {
	for (a = 1; a <= ad_count; a++) {
		document.getElementById('atlas'+a).appendChild(document.getElementById('INVatlas'+a)).style.display='';
	}
}

// Used by archive and static pagess
function place_direct_ad(url, width, height, position) {
   // Cache-busting and pageid values
   random = Math.round(Math.random() * 100000000);
   if (!pageNum) var pageNum = Math.round(Math.random() * 100000000);
   document.write('<IFRAME id="ad_' + position + '" SRC="'+url+'/pos='+position+'"');
   document.write(' NORESIZE SCROLLING=NO HSPACE=0 VSPACE=0 FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 WIDTH='+width+' HEIGHT='+height+'	allowTransparency="true"></IFRAME>'); 
   // End Hide -->
}

function place_dart_ad(url, width, height, tile) {
   document.write("<scr" + "ipt language='JavaScript' src='http://ad.doubleclick.net/adj/edh.medhelp/" + url + "ord=" + ord + "?' type='text/javascript'></scr" + "ipt>");
   document.write("<noscript><a href='http://ad.doubleclick.net/jump/edh.medhelp/" + url + "ord=" + ord + "?' target='_blank'><img src='http://ad.doubleclick.net/ad/edh.medhelp/default;tile=" + tile + ";sz="+width+"x"+height+";ord=" + ord + "?' width='"+width+"' height='"+height+"' border='0' alt=''></a></noscript>");
}
