// JavaScript Document
var arr728 = ["728_90_thelegend","baccanti_728_90","fasano_728_90","mineo_728_90","nico_728_90","cardamone"]
var arr300x100 = ["cipolla","southMood_300_100","barMartin","lanzillotta"]
var arr300 = ["300_250_bannereNormal","300_250_contadina","300_250_russo","gramoglia","feudo","matinacar" ,"lombardo","gruppoBerardi"]


window.onresize = function(){
//	centraCnt();
}

window.onload = function() {
	scriviBanner();
//	scriviFlash();
}
function centraCnt(){
	var myHeight, myWidth
	if( typeof( window.innerHeight ) == 'number' ) {
		myHeight = window.innerHeight;
		myWidth = window.innerWidth;
	} else if( document.documentElement && (document.documentElement.clientHeight ) ) {
		myHeight = document.documentElement.clientHeight;
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myHeight = document.body.clientHeight;
		myWidth = document.body.clientWidth;
	}
	
	if(myHeight<=570){myHeight=570}
	if(myWidth<=1000){myWidth=1000}
	
	var flashDiv = document.getElementById('flashCntGen');

	flashDiv.style.width = myWidth+"px";
	flashDiv.style.height = myHeight+"px";
}
function scriviFlash(){
	var myHeight, myWidth
	document.getElementById('contenitoreGen').style.display = 'none';
	if( typeof( window.innerHeight ) == 'number' ) {
		myHeight = window.innerHeight;
		myWidth = window.innerWidth;
	} else if( document.documentElement && (document.documentElement.clientHeight ) ) {
		myHeight = document.documentElement.clientHeight;
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myHeight = document.body.clientHeight;
		myWidth = document.body.clientWidth;
	}
	
	if(myHeight<=570){myHeight=570}
	if(myWidth<=1000){myWidth=1000}
	
	
	var flashDiv = document.getElementById('flashCntGen');
	flashDiv.style.display = 'block';
	flashDiv.style.width = myWidth+"px";
	flashDiv.style.height = myHeight+"px";
	
	var percorso = ""
	if(window.location.href != null){
		percorso = window.location.href
	}else{
		percorso = "/"
	}
	var siteFlash = new SWFObject('/_swf/index.swf', 'sito', '100%','100%', 9, '#200025') ;
	siteFlash.addVariable('currentURL', percorso);
	siteFlash.addParam('quality', 'high');
	siteFlash.write('flashCntGen');
	
}
function scriviBanner(){
	var urlBanner1 = arr300[Math.floor(Math.random() * arr300.length)]
	var urlBanner2 = arr300x100[Math.floor(Math.random() * arr300x100.length)]
	var urlBanner3 = arr728[Math.floor(Math.random() * arr728.length)]
	
	swfobject.embedSWF('/_swf/banner/300x250/'+urlBanner1+'.swf', 'bannerHead', '300', '250', '8');
	swfobject.embedSWF('/_swf/banner/300x100/'+urlBanner2+'.swf', 'bannerColonna', '300', '100', '8');
	swfobject.embedSWF('/_swf/banner/728/'+urlBanner3+'.swf', 'banner728', '728', '90', '8');
	
	
}
function apriblocco(idDiv){
	var el=document.getElementById(idDiv);
	if(el.style.display=='none'){
		el.style.display='block';
	}else{
		el.style.display='none';
	}
	
} 


