// GLOBAL FUNCTION
var oldMenu = null;
function showMenu(id) {
	hideMenu();
	document.getElementById(id).style.display="block";
	oldMenu = id;
}
function hideMenu() {
	if (oldMenu) {
		document.getElementById(oldMenu).style.display="none";
	}
}

function moveTopScroll(){
	window.scrollTo(0,0);
}

function myAlert(str){
	str = str.replace(/%20/g," ");
	alert(str);	
}

function popupwindow(LarghezzaCont,AltezzaCont,Pagina,nome,scrol,stat) {
	var lsBrowser = navigator.appName;
	var navInfo = navigator.userAgent;
	if (scrol == "yes") {
		if (navInfo == "Mac" && lsBrowser.indexOf("Microsoft") >= 0) {
				aw = 0;
		} else {
		aw = 17;
		}		
	} else {
	aw = 0;
	}		
    var iMyWidth;
    var iMyHeight;
    var LarghezzaPagina;
    var AltezzaPagina;
    LarghezzaPagina = screen.availWidth;
    AltezzaPagina = screen.availHeight;
    LarghezzaCont=LarghezzaCont.toUpperCase()
    AltezzaCont=AltezzaCont.toUpperCase()
				
    if (LarghezzaCont == "FULL") {
            LarghezzaWindow = screen.availWidth;
        } else {
            LarghezzaWindow = parseInt(LarghezzaCont) + aw;
        }
    if (AltezzaCont == "FULL") {
            AltezzaWindow = screen.availHeight;
        } else {
            AltezzaWindow = AltezzaCont;
        }
    iMyWidth = (LarghezzaPagina/2) - (LarghezzaWindow/2);
    iMyHeight = (AltezzaPagina/2) - (AltezzaWindow/2);
    win = window.open(Pagina,nome,"height=" + AltezzaWindow + ",width="	+ LarghezzaWindow 
	+ ",menubar=0,resizable=yes,scrollbars=" + scrol + ",status=" + stat + ",titlebar=0,toolbar=0,left="
	+ iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + "");
    win.focus();
}


//FLASH RESIZER
function chkW(a) {
	if (a<=1000) {
		var tmp = "1000";
	} else {
		var tmp = "100%";
	}
	return tmp;
}

function chkH(a) {
	if (a<=580) {
		var tmp = "580";
	} else {
		var tmp = "100%";
	}
	return tmp;
}

function alertSize() {
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	flashResizer(chkW(myWidth),chkH(myHeight));
}
function flashIsRunning(){
}
function flashResizer(w,h){
		window.document.flashobj.width=w;
		window.document.flashobj.height=h;
		if (w != "100%"){
			w = w+"px";
		}		
		if (h != "100%"){
			h = h+"px";
		}
		document.getElementById("flash").style.width=w;		
		document.getElementById("flash").style.height=h;	
}


var myWidthOLD;
var myHeightOLD;

window.onresize = function(){
	alertSize();
}