function AR_LoadOverlay(id, alias)
{
	document.getElementById('overlay').style.display='block';
	
	if (AR_whichBrs() == 'Internet Explorer')
	{
		height = (document.documentElement.clientHeight-4);
		width = (document.documentElement.clientWidth-4);
	}
	else
	{
		height = (window.innerHeight-4);
		width = (window.innerWidth-4);
	}	
	
	document.getElementById('overlay').style.width=width+'px';
	document.getElementById('overlay').style.height=height+'px';
	
	url = '/plugins/ads/configure.php?id='+id+'&alias='+alias+"&width="+width+"&height="+height;
	
	new Ajax.Updater('overlay', url);
	
	document.getElementById('page_container').style.display='none';
}

function AR_RelayComplete()
{
	document.getElementById('overlay').style.display='none';
	document.getElementById('page_container').style.display='block';
	
	loc = document.getElementById('loc').value;
	container = 'content_' + loc; 
	
	new Ajax.Updater(container, '/plugins/ad_relay/reload.php?container='+loc);
}

function AR_Close()
{
	document.getElementById('overlay').style.display='none';
	document.getElementById('page_container').style.display='block';
}

function AR_Refresh()
{
	alert('Done');
}

function AR_whichBrs()
{
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1) return 'Opera';
	if (agt.indexOf("staroffice") != -1) return 'Star Office';
	if (agt.indexOf("webtv") != -1) return 'WebTV';
	if (agt.indexOf("beonex") != -1) return 'Beonex';
	if (agt.indexOf("chimera") != -1) return 'Chimera';
	if (agt.indexOf("netpositive") != -1) return 'NetPositive';
	if (agt.indexOf("phoenix") != -1) return 'Phoenix';
	if (agt.indexOf("firefox") != -1) return 'Firefox';
	if (agt.indexOf("safari") != -1) return 'Safari';
	if (agt.indexOf("skipstone") != -1) return 'SkipStone';
	if (agt.indexOf("msie") != -1) return 'Internet Explorer';
	if (agt.indexOf("netscape") != -1) return 'Netscape';
	if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
	if (agt.indexOf('\/') != -1) {
	if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
	return navigator.userAgent.substr(0,agt.indexOf('\/'));}
	else return 'Netscape';} else if (agt.indexOf(' ') != -1)
	return navigator.userAgent.substr(0,agt.indexOf(' '));
	else return navigator.userAgent;
}
