// JavaScript Document
function showAdd(elementID)
{
	var myAddsElement = document.getElementById(elementID);
	var hostname=getHost();
	var responseHtml=null;
	
	responseHtml='<iframe src="http://diro.ws/webservices/showadd.php?hostname='+hostname+'&type=adsense&_adtillasess='+Math.random()+'" frameborder="0" scrolling="no" style="backgrount:transparent; width:100%;"></iframe>';
	myAddsElement.innerHTML=responseHtml;
}

function showBannerAdd(elementID)
{
	var myAddsElement = document.getElementById(elementID);
	var hostname=getHost();
	var responseHtml=null;
	
	responseHtml='<iframe src="http://diro.ws/webservices/show-banner-add.php?hostname='+hostname+'&type=banner&_adtillasess='+Math.random()+'" frameborder="0" scrolling="no" style="backgrount:transparent; width:100%; height:80px;"></iframe>';
	myAddsElement.innerHTML=responseHtml;
}


function showFeaturedAdd(elementID)
{
	var myAddsElement = document.getElementById(elementID);
	var hostname=getHost();
	var responseHtml=null;
	
	responseHtml='<iframe src="http://diro.ws/webservices/show-featured-add.php?hostname='+hostname+'&type=featured&_adtillasess='+Math.random()+'" frameborder="0" scrolling="no" style="backgrount:transparent; width:100%;"></iframe>';
	myAddsElement.innerHTML=responseHtml;
}

function getHost()
{
	var hostName=document.location.host;
	var newHostName=null;
	var hostArray=new Array();
	var newHostNameArray=new Array();
	hostArray =hostName.split(".");
	var count=hostArray.length;
	//alert(count);
	var hostWithoutWWW='';
	var newHostArray=new Array();
	//alert(hostArray[0]);
	if((count>2) && (hostArray[0]=='www'))
	{
		
		for(var i=(count-1);i>0;i=i-1)
		{
			//alert(hostArray[i]);
			newHostNameArray[i-1]=hostArray[i];
		}
		
		newHostName=newHostNameArray.join(".");
	}
	else
	{
		newHostName=hostName;
	}	
	
	return newHostName;
}


function createRequest()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
  	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	return xmlhttp;
	
}

