ok ecco il codice
Codice PHP:
function divNero() {
var divMaschera = document.getElementById("maschera");
if (divMaschera.style.display=="block") {
divMaschera.style.display = "none";
document.getElementById("divFinestra").style.display = "none";
} else {
var arrayPageSize = getPageSize();
divMaschera.style.width = arrayPageSize[0];
divMaschera.style.height = arrayPageSize[1];
divMaschera.style.display = "Block";
document.getElementById("divFinestra").style.display = "block";
}
}
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
//alert("primo if" +window.innerHeight);
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
//alert("secondo if" +document.body.scrollHeight);
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else if (document.body.scrollHeight < document.body.offsetHeight) { //If aggiunto come rimedio, va testato
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
//alert("terzo if" +window.innerHeight);
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
//alert("primo _2" +self.innerWidth);
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
//alert("secondo _2" +document.documentElement.clientWidth);
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
//alert("terzo _2" +document.body.clientWidth);
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
function resizePage() {
var divMaschera = document.getElementById("maschera");
if (divMaschera.style.display=="block") {
//divMaschera.style.display = "none";
var arrayPageSize = getPageSize();
divMaschera.style.width = arrayPageSize[0];
divMaschera.style.height = arrayPageSize[1];
divMaschera.style.display = "Block";
}
}