function getOff(num_righe, num_colonne, cellspacing , lato_immagine)
{

  var larghezza_img = (lato_immagine * num_colonne) + (cellspacing * (num_colonne + 1));
  var altezza_img = (lato_immagine * num_righe) + (cellspacing * (num_righe + 1));
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

/*
	var Contenitorejs = document.getElementById('contenitore');
	if (myHeight < altezza_img)
	{
	  Contenitorejs.style.height = altezza_img + "px";
	}
	else
	{
	  Contenitorejs.style.height = myHeight + "px";
	}	
*/	
	var Image_Window0 = document.getElementById('image-window-base');
	Image_Window0.style.width = larghezza_img + "px";
	Image_Window0.style.height = altezza_img + "px";

	if (altezza_img > myHeight) {
		Image_Window0.style.top = lato_immagine + "px";
	} else {
		Image_Window0.style.top = (myHeight - altezza_img)/2 -14 + "px";
	}
	if (larghezza_img > myWidth) {
		Image_Window0.style.left = "0px";
	} else {
		Image_Window0.style.left = (myWidth - larghezza_img)/2 + "px";
	}
	
	var piede_Window0 = document.getElementById('piede');
	piede_Window0.style.top = (myHeight - 45) + "px";
	piede_Window0.style.left = "0px";

}


function AltezzaFinestra()
{
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }


	var Contenitorejs = document.getElementById('piede');
  	Contenitorejs.style.height = myHeight + "px";
}
