function getXmlHttpRequestObject() {
				if (window.XMLHttpRequest) {
					return new XMLHttpRequest();
				} else if(window.ActiveXObject) {
					return new ActiveXObject("Microsoft.XMLHTTP");
				} else {
					alert('Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.');
				}
};

var Req = new getXmlHttpRequestObject();

if (Req.readyState == 4 || Req.readyState == 0) {
			Req.onreadystatechange = handleReceive; 
			Req.open("GET", 'http://www.indowebster.com/static/list/list_iklandl.xml' , true);
			Req.async="false";
			Req.send(null);
}
function handleReceive () {
 if (Req.readyState == 4) {   
	
	var xmldoc = Req.responseXML;
	var list_nodes = xmldoc.getElementsByTagName("list"); 
	var n_list = list_nodes.length;
	//alert(n_list);
	if (n_list > 0)	
    	{  var rand_no = Math.random();
           //alert (rand_no);
		   rand_no = Math.floor(rand_no * (n_list));
           var _src = list_nodes[rand_no].getAttribute("isi");
		}
	
	
	
	
	var flash = document.getElementById('embed_player');
	var width = flash.width;
	var height = flash.height;
    
	var idws = document.getElementById('idwsads');
    idws.style.width = width + "px";
	idws.style.height = height + "px";
	var frame = document.createElement("div");
	frame.id='div_ads_player';
	frame.innerHTML = '<div style="height:50px;"></div><div id="div_img_iklan_player" align="center">'+_src+'</div>';
	frame.innerHTML += "<br><br>";
        frame.innerHTML += '<div style="width:200px;margin:0 auto;background:#ff0000;border:1px solid #cccccc;"><a href="javascript:tutup();" onclick="tutup()" style="color:#fff; font-size:11px;font-weight:bold;height:17px;line-height:16px;margin-left:60px;text-align:center;text-decoration:none;line-height:18px;font-family:Tahoma;width:110px;height:18px;font-weight:bolder;">Tutup Iklan </a></div>'
	idws.appendChild(frame);
	
       var div_ads = document.getElementById("div_ads_player");
       div_ads.style.position='relative';
	div_ads.style.zIndex=99;
	div_ads.style.backgroundColor="#000";
	//div_ads.style.left= flash.offsetLeft + "px";
	div_ads.style.top =  - height + "px"  ;
       
	div_ads.style.width=width + "px";
     	div_ads.style.height=height + "px";
       var div =document.getElementById("div_img_iklan_player");
	div.getElementsByTagName("img").item(0).style.border = "0";
	//setTimeout("tutup()",5000);
 }
}

function tutup()
{ 
  var d = document.getElementById('idwsads');
  var olddiv = document.getElementById('div_ads_player');
  d.removeChild(olddiv);
 
	//olddiv.style.display ="null";
}
