// JavaScript Document
var viewportWidth;
var viewportHeight;
 
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 if (typeof window.innerWidth != 'undefined')
{
	viewportWidth = window.innerWidth,
    viewportHeight = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
{
	viewportWidth = document.documentElement.clientWidth,
    viewportHeight = document.documentElement.clientHeight
}
// older versions of IE
else
{
	viewportWidth = document.getElementsByTagName('body')[0].clientWidth,
    viewportHeight = document.getElementsByTagName('body')[0].clientHeight
}

var stopBanner = ((viewportHeight / 2) - 350);
var bannerLayer;

function chiudi(div_id){
	
	document.getElementById(div_id).style.display='none'
	document.getElementById(div_id).style.top='0px'
	document.getElementById(div_id).style.left='0px'
	document.getElementById(div_id).style.width='1px'
	document.getElementById(div_id).style.height='1px'	
	
	}


function createBannerLayer()
{
	bannerLayer = document.createElement("div");
	bannerLayer.setAttribute("id", "bannerLayer");
	bannerLayer.style.position = "absolute";
	bannerLayer.style.left = ((viewportWidth / 2) - 360)  + "px";
	bannerLayer.style.top = "-500px";
	bannerLayer.style.zIndex = "60";
	bannerLayer.style.width = "740px";
	bannerLayer.style.height = "316px";
	
	// pentecoste deu
	//bannerLayer.style.backgroundColor = "#000000";
	/*var bannerLayerInner = '<div style="position: absolute; top: 180px; width: 320px; text-align: center" id="contenuto"><div style="padding:6px; border:5px solid #59849E;background-color:#ffffff; color:#ffffff;font-size:13px">';
    bannerLayerInner += '<div style="width: 100%; height: 20px; text-align: right;"><a href="#" onClick="chiudi(\'bannerLayer\'); return false;" style="padding-right: 5px"><img src="../immagini/chiudi.jpg" border="0"></a></div>';
    bannerLayerInner += '<a href="http://www.pentecoste.travelemiliaromagna.com" target="_blank"><img src="../immagini/pentecoste.jpg" border="0"></a>';*/
	
	// Riviera Beach Games
	var bannerLayerInner = '<div style="position: absolute; top: 180px; width: 740px; text-align: center" id="contenuto"><div style="padding:6px; border:0px solid #F3A41D;background-color:#F3A41D; color:#F3A41D;font-size:13px">';
    bannerLayerInner += '<div style="width: 100%; height: 20px; text-align: right;background-color:#fff;"><a href="#" onClick="chiudi(\'bannerLayer\'); return false;" style="padding-right: 5px"><img src="../immagini/chiudi.jpg" border="0"></a></div>';
    bannerLayerInner += '<a href="http://www.rivierabeachgames.it/" target="_blank"><img src="../immagini/BANNER-RivieraBeachGames.gif" border="0"></a>';

	bannerLayer.innerHTML = bannerLayerInner;	
	window.document.body.appendChild(bannerLayer);
}

function scrollBanner()
{	
	bannerLayer.style.top = (parseInt(bannerLayer.style.top) + 15) + "px";  
	if(parseInt(bannerLayer.style.top) < stopBanner)
	{
		setTimeout("scrollBanner()", 1);	
	}
}

function banner_layer()
{
	createBannerLayer();
	scrollBanner();
}

function destroyBanner()
{
	var divElement = window.document.getElementById("bannerLayer");
	parentElement = divElement.parentNode;
	parentElement.removeChild(divElement);
}