var win=window;
var agent=navigator.userAgent.toLowerCase();
var IE=(agent.indexOf("msie")!=-1&&agent.indexOf("opera")==-1);
var IE7=(agent.indexOf("msie 7")!=-1);
var OPERA=(agent.indexOf("opera")!=-1);
var SAFARI=(agent.indexOf("safari")!=-1);
var FIREFOX=(agent.indexOf("gecko")!=-1);
var STRICT_MODE=(document.compatMode=="CSS1Compat");
var doc=win.document;
var DIV_ID;

function getWindowSize(win){var availW=win.innerWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.documentElement.clientWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.body.clientWidth;var availH=win.innerHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.documentElement.clientHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.body.clientHeight;return{w:availW,h:availH};}

function getDocumentSize(win){var winSize=getWindowSize(win);var scrollPos=getScrollPos(win);var w=winSize.w+scrollPos.left;var h=winSize.h+scrollPos.top;w=Math.max(w,win.document.body.offsetWidth);h=Math.max(h,win.document.body.offsetHeight);w=Math.max(w,win.document.body.scrollWidth);h=Math.max(h,win.document.body.scrollHeight);return{w:w,h:h};}

function getScrollPos(win){var scrollTop=win.pageYOffset;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.documentElement.scrollTop;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.body.scrollTop;var scrollLeft=win.pageXOffset;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.documentElement.scrollLeft;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.body.scrollLeft;return{top:scrollTop,left:scrollLeft};}


function hideLayer(lay){
	document.getElementById(lay).innerHTML = "";
	document.getElementById(lay).style.display = 'none';	
}

function goVideo(swf,del){
	
	if(del){
		document.getElementById('box_video').innerHTML = "";		
		setTimeout("hideLayer(DIV_ID)",1500);
	}else{
	//	if(MENU_OPEN){
//			find('sotto_barra').style.display = 'block'
//			find('sotto_barra').style.position = 'relative';
//			find("box_flash").innerHTML = '';
//			chiudi2();//alert(MENU_OPEN)
//		}
		
		//caricaTop(2,1);
		//find("box_flash").innerHTML = '';
		//chiudi2()
		var div_id = new Date().getTime();
		DIV_ID = div_id; 
		var photoBack=doc.createElement("div");
			photoBack.id=div_id;
			photoBack.style.top="0px";
			photoBack.style.left="0px";
			photoBack.style.bottom="0px";
			photoBack.style.right="0px";
			photoBack.style.margin="0";
			photoBack.style.padding="0";
			photoBack.style.border="none";
			//photoBack.style.cursor="pointer";
			photoBack.style.zIndex="0";
			//photoBack.style.backgroundColor="#000000";
			
			if(IE&&!(IE7&&STRICT_MODE)){ 
				photoBack.style.position="absolute";
				var docSize=getDocumentSize(win);
				photoBack.style.width=(docSize.w-21)+"px";
				photoBack.style.height=(docSize.h-4)+"px";
			}else{ 
				photoBack.style.position="fixed";
				photoBack.style.width="100%";
				photoBack.style.height="100%";
			}
			photoBack.onclick=function(){
				//doc.getElementById(div_id).style.visibility = 'hidden'
			}	
			doc.body.appendChild(photoBack);
			document.getElementById(div_id).innerHTML = "<div id='box_video' style='left:0;top:0px;height:100%; width:100%; z-index:1'></div>";
			
		   var fo = new SWFObject("/flash/"+swf+".swf", "my", "100%", "100%", "8.0.0.24", "", true);
		   fo.addParam("quality", "high");
		   fo.addParam("scale", "noscale");
		   fo.addParam("wmode", "transparent");
		   fo.write("box_video");	
		  // alert(div_id)
	}	  
}