function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		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;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
}

function livello_vis(idel, idel2, widthimg, heightimg){
var rpx, rpy, x1, y1, vx, vy, sc_x, sc_y, sc_x2, sc_y2;
var dim_page = new Array();
dim_page = getPageSize();


document.getElementById(idel).style.left = 0;
document.getElementById(idel).style.top = 0;	  
document.getElementById(idel).style.width = dim_page[0] - 18;
document.getElementById(idel).style.height = dim_page[1];	
//document.getElementById(idel).style.background = "url('img/vuoto.gif')";	 
document.getElementById(idel).style.background = "url('img/sfondo.png')"; 

rpx = ((dim_page[2] / 2) - (widthimg / 2)) + document.body.scrollLeft;
rpy = ((dim_page[3] / 2) - (heightimg / 2)) + document.body.scrollTop;
	  //alert(rpx + " " + rpy);

      document.getElementById(idel2).style.left = rpx;
	  document.getElementById(idel2).style.top = rpy;
      //document.getElementById(idel).style.opacity = 0.70;
      //document.getElementById(idel).style.filter = "alpha(opacity:" + (1 * 70) + ")";	  
      document.getElementById(idel2).style.opacity = 1;
      document.getElementById(idel2).style.filter = "alpha(opacity:" + (1 * 100) + ")";	  	  
	  document.getElementById(idel).style.visibility = "visible";

}

function livello_vis2(idel, widthimg, heightimg){

var rpx, rpy, x1, y1, vx, vy, sc_x, sc_y;
if (document.all){
  
	  rpx = ((sc_x / 2) + document.body.scrollLeft) - (widthimg / 2);
	  rpy = ((sc_y / 2) + document.body.scrollTop) - (heightimg / 2);
	  //alert(rpx + " " + rpy);

      document.getElementById(idel).style.left = rpx;
	  document.getElementById(idel).style.top = rpy;  	  
	  document.getElementById(idel).style.visibility = "visible";
}
else
{

	  rpx = ((window.innerWidth / 2) + document.body.scrollLeft) - (widthimg / 2);
	  rpy = ((window.innerHeight / 2) + document.body.scrollTop) - (heightimg / 2);
	  //alert(rpx + " " + rpy);

      document.getElementById(idel).style.left = rpx;
	  document.getElementById(idel).style.top = rpy;
	  document.getElementById(idel).style.visibility = "visible";
}

}

function visibile_ev2(idel){
var rpx, rpy, x1, y1, vx, vy;
  if (document.all){
  vx = 200;
  vy = document.body.scrollTop + 30;
  document.getElementById(idel).style.pixelLeft = vx;
  document.getElementById(idel).style.pixelTop = vy;
  document.getElementById(idel).style.visibility = "visible";

  }
  
  else
  {
    if (document.layers){
    //bx = (window.innerWidth / 2) - 350;
    rpx = (mouseX / window.innerWidth);
	rpy = (mouseY / window.innerHeight);
	x1 = (widthimg * rpx);
	y1 = (heightimg * rpy);
    document.idel.left = mouseX  - x1;
	document.idel.top = mousey - y1;
    }
    else
    {
      if(document.getElementById) {
	  vx = 200;
      vy = document.body.scrollTop + 30;
      if (vy < 0){
      vy = 0;
      }
      if (vx < 0){
      vx = 0;
      }  
      document.getElementById(idel).style.left = vx;
	  document.getElementById(idel).style.top = vy;
	  document.getElementById(idel).style.visibility = "visible";
      }
    }
  }
}

function livello_no_vis(idel){
document.getElementById(idel).style.visibility = "hidden";
}


function liv_lingua(idel){
 if (document.getElementById("idliv_dove")){
 document.getElementById("idliv_dove").style.background = "#e0e0e0";
 }
 if (document.getElementById("idliv_testo")){
 document.getElementById("idliv_testo").style.background = "#e0e0e0";
 }
 if (document.getElementById("idliv_img")){
 document.getElementById("idliv_img").style.background = "#e0e0e0";
 }
 if (document.getElementById(idel)){
 document.getElementById(idel).style.background = "#ffffff";
 }
}