var fullscreenset_lvl2 = true;

function redirect_lvl2(vaia){
	location.href = vaia;
}

function annulla_lvl2(){
	
	innder ='';
	document.getElementById("iframe_lvl2").contentWindow.clearInterval();
	document.getElementById("iframe_lvl2").style.width = framew_lvl2+"px";
	document.getElementById("iframe_lvl2").style.height = frameh_lvl2+"px";
	document.getElementById("win_handle_lvl2").style.width = "500px";
	document.getElementById("win_handle_lvl2").style.top = "200px";
	document.getElementById("win_handle_lvl2").style.margin = "0 auto";
	
	framew_now = framew_lvl2;
	frameh_now = frameh_lvl2;
	
	//fullscreenset = false
	//document.getElementById("iframe_lvl2").contentWindow.changewh(framew_lvl2,frameh_lvl2);
	
	fullscreenset_lvl2 = true
	
	document.getElementById("win_handle_lvl2").innerHTML = innder;
	document.getElementById("win_root_lvl2").style.visibility = "hidden";	
	//window.document.getElementsByTagName('html')[0].style.overflow = ''
}

function fullscreen_lvl2(){
	
	if(fullscreenset_lvl2){
	
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//alert("A")
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//alert("B")
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//alert("C")
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		
		wtab = myWidth
		htab = myHeight
		
		//alert(wtab)
		//alert(htab)
		
		document.getElementById("iframe_lvl2").style.width = wtab-30+"px";
		document.getElementById("iframe_lvl2").style.height = htab-80+"px";
		document.getElementById("win_handle_lvl2").style.width = "100%"
		document.getElementById("win_handle_lvl2").style.height = "100%"
		document.getElementById("win_handle_lvl2").style.top = "0"
		
		document.getElementById("win_handle_lvl2").style.margin = "0 auto";
		//document.getElementById("win_root_lvl2").style.left = "0px";
		
		framew_now = wtab;
		frameh_now = htab;
		fullscreenset_lvl2 = true
		document.getElementById("iframe_lvl2").contentWindow.changewh(wtab,htab);
		
		fullscreenset_lvl2 = false
		
	}else{
		document.getElementById("iframe_lvl2").style.width = framew_lvl2+"px";
		document.getElementById("iframe_lvl2").style.height = frameh_lvl2+"px";
		
		document.getElementById("win_handle_lvl2").style.width = "500px";
		document.getElementById("win_handle_lvl2").style.top = "200px";		
		document.getElementById("win_handle_lvl2").style.margin = "0 auto";
		
		framew_now = framew_lvl2;
		frameh_now = frameh_lvl2;
		
		fullscreenset_lvl2 = false
		
		document.getElementById("iframe_lvl2").contentWindow.changewh(framew_lvl2,frameh_lvl2);
		
		fullscreenset_lvl2 = true
		
	}
	
	
}

var i = 0;
var inetrdownerMenu = ""

function SVopenWin_lvl2(urlframe,w,h,full,closed){
	
		document.getElementById("win_handle_lvl2").style.width = w;
		document.getElementById("win_handle_lvl2").style.height = h;
		
		framew_lvl2 = w; 
		frameh_lvl2 = h;
		
		innder ='<table border="0" cellpadding="0" cellspacing="0">'
		innder +='<tr>'
		innder +='<td width="15" height="16"><img src="include_app/visivamod/images/popup_01.gif" width="15" height="16" /></td>'
		innder +='<td height="16" background="include_app/visivamod/images/popup_02.gif"></td>'
		innder +='<td width="15" height="16"><img src="include_app/visivamod/images/popup_03.gif" width="15" height="16" /></td>'
		innder +='</tr><tr>'
		innder +='<td><img src="include_app/visivamod/images/popup_04.gif" width="15" height="32" /></td>'
		innder +='<td background="include_app/visivamod/images/popup_06.gif">'
		
		
		
		innder +='<table width="100%" border="0" cellpadding="0" cellspacing="0">'
		//innder +='<tr><td width="100%" style="text-align:left; font-size:18px; font-family:helvetica, sans-serif; color:#ffffff; vertical-align: middle;"><span id="namepopframe"></span></td><td width="25px"><a href="javascript:annulla();"><img src="include_app/visivamod/images/closebig.png"/></a></td>'
		innder +='<tr><td width="100%" style="text-align:left; font-size:18px; font-family:helvetica, sans-serif; color:#ffffff; vertical-align: middle;"><span id="namepopframe_lvl2"></span></td>'
		if (full){
			innder +='<td width="25px"><a href="javascript:fullscreen_lvl2();"><img src="include_app/visivamod/images/fullscreen.png"/></a></td>'
		}else{
			innder +='<td width="25px">&nbsp;</td>'
		}
		
		if(closed){
			innder +='<td width="25px"><a href="javascript:annulla_lvl2();"><img src="include_app/visivamod/images/closebig.png"/></a></td>'
		}else{
			innder +='<td width="25px">&nbsp;</td>'
		}
		innder +='</table>'
		innder +='</td><td><img src="include_app/visivamod/images/popup_07.gif" width="15" height="32" /></td>'
		innder +='</tr><tr>'
		innder +='<td rowspan="2" background="include_app/visivamod/images/popup_08.gif" ></td>'
		innder +='<td height="5px" background="include_app/visivamod/images/popup_09.gif"></td>'
		innder +='<td rowspan="2" background="include_app/visivamod/images/popup_10.gif" ></td>'
		innder +='</tr><tr>'
		innder +='<td height="10px" background="include_app/visivamod/images/popup_12.gif"></td>'
		innder += ' </tr><tr>'
		innder += '<td background="include_app/visivamod/images/popup_13.gif"></td>'
		innder += '<td bgcolor="#FFFFFF">'
		
		innder += '<iframe name="iframe_lvl2" src="'+urlframe+'" id="iframe_lvl2" style="width:'+w+'px; height:'+h+'px;margin:0" frameborder="0" ></iframe>';
		
		innder += '</td>'
		innder += '<td background="include_app/visivamod/images/popup_15.gif">&nbsp;</td>'
		innder += '</tr><tr>'
		innder += '<td width="15" height="15"><img src="include_app/visivamod/images/popup_16.gif" width="15" height="15" /></td>'
		innder += '<td background="include_app/visivamod/images/popup_17.gif"></td>'
		innder += '<td width="15" height="15"><img src="include_app/visivamod/images/popup_18.gif" width="15" height="15" /></td>'
		innder += '</tr></table>'
		
		document.getElementById("win_handle_lvl2").innerHTML = innder;
		//document.getElementById("win_root_lvl2").style.visibility = "hidden";
		
		var Dimheight;
		if (window.innerHeight){
			Dimheight = window.innerHeight;
		}else if (document.documentElement && document.documentElement.clientHeight != 0){
			Dimheight = document.documentElement.clientHeight;
		}else if (document.body){
			Dimheight = document.body.clientHeight;
		} 
		
		var Dimhight_pop = document.getElementById("win_handle_lvl2").offsetHeight;
		
		document.getElementById("win_handle_lvl2").style.top = ((Dimheight-Dimhight_pop)/2)+"px";
		document.getElementById("win_handle_lvl2").style.margin= "0 auto";
		//document.getElementById("win_root_lvl2").style.visibility = "visible";
		document.getElementById("win_root_lvl2").style.visibility = "visible";
		
	
	fullscreenset_lvl2 = true
	
}
		
	/*
	function downerMenu(h,a){
		i = (i+(i/12));
		document.getElementById("win_root_lvl2").style.top = (a+i)+"px";		
		if((a+i) >= ((h/2)-70)){
			clearInterval(inetrdownerMenu)	
		}
	}
	*/
