reNav = /MSIE (\d+)|Firefox\/(\d+)/; $hasLocBar=0;
gecko = (navigator.userAgent.indexOf('Gecko')>0)? 1: 0;
hasbar = reNav.exec(navigator.userAgent); hasLocBar=0;
if (hasbar[1]) { browser='IE'; versione=hasbar[1]; if (versione>=7) hasLocBar=1; }
if (hasbar[2]) { browser='FF'; versione=hasbar[2]; if (versione>=3) hasLocBar=1; }
sW=screen.availWidth; sH=screen.availHeight;

function OpenWin(url,w,h,opt,wnname)
{
if (!wnname) wnname='aux';	
if (window[wnname]) window[wnname].close();
//sW=screen.availWidth; sH=screen.availHeight;
if (w>sW) { w=sW*0.9; opt+=',scrollbars=yes'; }
if (h>sH) { h=sH*0.9; opt+=',scrollbars=yes'; }
if (!w && !h) { w=sW*0.9; h=sH*0.8; t=sH*0.05; l=sW*0.05; }
else
	{
	l=(sW-w)/2; if (l>300) l=300;
	t=(sH-h)/2-40; if (t>100) t=100; if (t<10) t=10;
	if (gecko) { h+=25; w+=20; }
	}
w=parseInt(w); h=parseInt(h); t=parseInt(t); l=parseInt(l);	
dim="left="+l+",top="+t+",width="+w+",height="+h+",resizable=yes";
if (opt) dim=(gecko)? opt+","+dim : dim+=","+opt;
eval(wnname+"=window.open(url,'"+wnname+"',dim);");
}

function sizeWindow(wAdd,hAdd,obj,cId)
{
if (!wAdd) wAdd=10; if (!hAdd) hAdd=10; if (!obj) obj=window; if (!cId) cId='sdim'; 
dim=obj.document.getElementById(cId);
myW=dim.offsetWidth+wAdd; myH=dim.offsetHeight+hAdd;
/*if (myW > screen.availWidth*0.9) myW=screen.availWidth*0.9;
if (myH > screen.availHeight*0.95) myH=screen.availHeight*0.95; */
if (myW > sW*0.9) myW=sW*0.9;
if (myH > sH*0.95) myH=sH*0.95; 
if (hasLocBar) myH+=25;
obj.resizeTo(myW,myH);
}

function goSez(cod,lang,url)
{ 
if (!url) url='index.php';
url='/'+lang+"/"+url;
location.href='/setcorso.php?cod='+cod+"&url="+url+"&lang="+lang;
}