(function() { 	
	
	function oas_getObj(name) {
	  try {
		  if (document.getElementById)
		   this.obj = document.getElementById(name);
		  else if (document.all)
		   this.obj = document.all[name];
		  else if (document.layers)
		   this.obj = document.layers[name];
		  if (this.obj)
		   this.style = this.obj.style;
	  }
	  catch (e) {
	  }
	 }
	
	 function oas_addLoad(func) {
	  try {
		  if (window.addEventListener)
		   window.addEventListener("load", func, false);
		  else if (document.addEventListener)
		   document.addEventListener("load", func, false);
		  else if (window.attachEvent)
		   window.attachEvent("onload", func);
		  else if (typeof window.onload != "function")
		   window.onload = func;
		  else {
		   var oldonload = window.onload;
		   window.onload = function() {
			oldonload();
			func();
		   };
		  }
	  }
	  catch (e) {
	  }
	 }
	
    
	 function oas_init() {
	  try {
		  var apos = OAS_listpos.split(',');
		  var olddocwrite = document.write;
		  for(var i = 0; i < apos.length; i++) {
		   var object_togo = new oas_getObj('Pub'+apos[i]);
		   var object_tomove = new oas_getObj('HiddenPub'+apos[i]);
		   html = "";
		   //if (typeof(object_togo.obj) != "undefined" && typeof(object_tomove.obj) != "undefined") {
		   if (document.getElementById('Pub'+apos[i]) != null && document.getElementById('HiddenPub'+apos[i]) != null) {
			if (typeof(object_togo.obj) != "undefined" && typeof(object_tomove.obj) != "undefined") {
		   //alert("HiddenPub"+apos[i] + ":" + object_togo.obj + " - Pub" + apos[i] + ":" + object_tomove.obj);
				object_togo.obj.appendChild(object_tomove.obj);
				object_tomove.style.visibility = "visible";
			}
		   }
		  }
		}
		catch (e) {
			//alert(e.description);
		}
	 }
     
	 if (document.getElementById && document.createTextNode) oas_addLoad(oas_init);
	 
 })();

/** ShowDcolAds - method called to show an ad based on what is sent by OAS, is display:none by default
- adId: div id containing the ad (PubRight1)
- divId: global div id containing the ad (ex:Ad-DCOLTOP)
- idContainer: global ads container (ex:AdContainer for dcol ads) 
*/ 
 function ShowDcolAds(adId, divId, idContainer) {
	if (!(idContainer)) {
		idContainer = "AdContainer";
	}
    try {
		var ad = document.getElementById(adId);
        var link = ad.getElementsByTagName("a");
		if (ad.innerHTML != "") {
			if(link.length > 0) {
				if (link[0].href.indexOf("empty.gif") == -1) { // ad is shown if it doesn't contain a A tag with "empty.gif" string
					document.getElementById(divId).style.display = "block";
					document.getElementById(idContainer).style.display = "block";
				}
			} else { // ad also shown if it doesn't contain any A tag
				document.getElementById(divId).style.display = "block";
				document.getElementById(idContainer).style.display = "block";
			}
		}
    }
    catch (e) {	
    }
}