var siteVersion = "HTML"

window.onresize = function(){
	if(siteVersion == "FLASH"){
		centraCnt();
	}
}

window.onload = function() {
	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<=660){myHeight=660}
	if(myWidth<=900){myWidth=900}
	var flashDiv = document.getElementById('contenitoreGen');
	flashDiv.style.width = myWidth+"px";
	flashDiv.style.height = myHeight+"px";
}
function scriviFlash(){
	var flashDiv = document.getElementById('contenitoreGen');
	var percorso = ""
	if(window.location.href != null){
		percorso = window.location.href
	}else{
		percorso = "/"
	}
	var usAg = navigator.userAgent.toLowerCase();
	if(( usAg.indexOf("googlebot") < 0 ) && ( usAg.indexOf("msnbot") < 0 ) && ( usAg.indexOf("slurp") < 0 )){
		var siteFlash = new SWFObject('/_swf/index.swf', 'sito', '100%','100%', 9, '#FFFFFF')
		siteFlash.addParam('quality', 'high');
		siteFlash.addParam('wmode', 'transparent');
		siteFlash.addVariable('currentURL', percorso);
		siteFlash.write('contenitoreGen');
		if(document.getElementById('sito')){
			flashDiv.setAttribute("class", "contenitoreFlasVersion");
			flashDiv.setAttribute("className", "contenitoreFlasVersion"); 
			siteVersion = "FLASH"
			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<=660){myHeight=660}
			if(myWidth<=900){myWidth=900}
			flashDiv.style.width = myWidth+"px";
			flashDiv.style.height = myHeight+"px";
		}
	}
	flashDiv.style.display = 'block';
}
