﻿// GLOBAL FUNCTION
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=0,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<=930) {
		var tmp = "930";
	} else {
		var tmp = "100%";
	}
	return tmp;
}

function chkH(a) {
	if (a<=575) {
		var tmp = "575";
	} 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;
	}
	if(myWidthOLD != myWidth || myHeightOLD != myHeight) {
		flashResizer(chkW(myWidth),chkH(myHeight));
	}
	myWidthOLD = myWidth;
	myHeightOLD = myHeight;
}

function flashResizer(w,h){
	document.getElementById("flashobj").width=w;
	if (h != "100%"){
		h = h+"px";
	}
	document.getElementById("flashobj").style.height=h;
	document.getElementsByTagName("body")[0].style.height=h;
}


var myWidthOLD;
var myHeightOLD;

window.onresize = function(){
	alertSize();
}

window.onload = function(){
	alertSize();
}

