// Autore: Simone Morlacchini - 01/2009

//Gestione del caricamento di una finestra popup (tipicamente per la pagina "mappa sito")


function ShowPopUp(pagina, nome) {

	//Valori di default
	var w = 584; var h = 657;	

	switch (nome) {
		case 'mappa': //Pop-up per la mappa in google maps
			w = 584; h = 637;
		break;
		
		case 'area_ftp': //Pop-up per l'area ftp
			w = 584; h = 337;
		break;
		
		case 'mappa_sito': //Pop-up per la mappa del sito
		default:
			w = 584; h = 657;
			
			if ( navigator.userAgent.indexOf("MSIE 6") != -1 ) {
				h = h - 35;
			}
			else if ( navigator.userAgent.indexOf("MSIE 7") != -1 ) {
				h = h - 7;
			}
				
			
		break;
	}


	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2) - 100;
	
	window.open(pagina,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
	//window.open(pagina,"","width=" + w + ",height=" + h + ",left=" + l);
	
	//,resizable=no,fullscreen=no,menubar=no,toolbar=no,location=no,scrollbars=no,status=no
}

function load_page(pageToLoad) {
	//Ricarica nella finestra padre la nuova pagina.
	window.opener.location.href = pageToLoad;
	//Chiude la pop-up
	window.close();	
}



/*function resizeme() {
	
	//Variabili di incremento per le dimensioni w e h che tengono conto della dimensione della finestra del browser.
	//Devono dipendere dal tipo di browser.
	var offset_width;
	var offset_height;
	
	// Explorer 6 
	if ( navigator.userAgent.indexOf("MSIE 6") != -1 ) {
		offset_width = 8;
		offset_height = 37;
	}
	
	// Explorer 7
	else if ( navigator.userAgent.indexOf("MSIE 7") != -1 ) {
		offset_width = 8;
		offset_height = 82;
	}
	// Firefox
	else {
		offset_width = 8;
		offset_height = 85;
	}
	
	
	var container = document.getElementById("container");
	//16 è l'altezza della banda verde.
	var h = container.offsetHeight + 16 + offset_height;
	
	var header = document.getElementById("header");
	var w = header.offsetWidth + offset_width;
	
	
	//alert(w + "+" + h);
	window.focus();
	window.moveTo(0,0); 
	window.resizeTo(w,h);
}*/