// JavaScript Document

var viewportwidth;
var viewportheight;

function get_hw(){
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
};

function vis_film(lar, alte) {
  get_hw();
  decr = 0;
  if (alte > viewportheight) {altezza = alte; decr = 13} else {altezza = viewportheight;};
  if (lar > viewportwidth) {larghezza = lar;} else {larghezza = viewportwidth;};
 
  var frame = document.getElementById('frame');
  var scuro = document.getElementById('scuro');
  
  scuro.style.display = "block";
  scuro.style.height = altezza+'px';
  scuro.style.width = (larghezza-decr)+'px';
  frame.height = alte;
  frame.width = lar;
  frame.style.marginLeft = ((viewportwidth-lar)/2)+"px";
  frame.style.marginTop = ((viewportheight-alte)/2)+"px";
    document.getElementById("frame").src = "filmato.html";
 /* parent.frame.document.getElementById("mediaPlayer").play();*/
};

function vis_tour(lar, alte) {
  get_hw();
  decr = 0;
  if (alte > viewportheight) {altezza = alte; decr = 13} else {altezza = viewportheight;};
  if (lar > viewportwidth) {larghezza = lar;} else {larghezza = viewportwidth;};
 
  var frame = document.getElementById('frame');
  var scuro = document.getElementById('scuro');
  
  scuro.style.display = "block";
  scuro.style.height = altezza+'px';
  scuro.style.width = (larghezza-decr)+'px';
  frame.height = alte;
  frame.width = lar;
  frame.style.marginLeft = ((viewportwidth-lar)/2)+"px";
  frame.style.marginTop = ((viewportheight-alte)/2)+"px";
  
};

function nas_film() {
  document.getElementById("frame").src = "img/loading.gif";
  document.getElementById("scuro").style.display = "none";
  /*parent.frame.document.getElementById("mediaPlayer").stop();*/
};

function nas_tour() {
  document.getElementById("scuro").style.display = "none";
};


function set_hw(lar, alte) {
  get_hw();
  decr = 0;
  if (alte > viewportheight) {altezza = alte; decr = 13} else {altezza = viewportheight;};
  if (lar > viewportwidth) {larghezza = lar;} else {larghezza = viewportwidth;};

  var frame = document.getElementById('frame');
  var scuro = document.getElementById('scuro');
  scuro.style.height = altezza+'px';
  scuro.style.width = (larghezza-decr)+'px';
  frame.style.height = alte;
  frame.style.width = lar;
  frame.style.marginLeft = ((viewportwidth-lar)/2)+"px";
  frame.style.marginTop = ((viewportheight-alte)/2)+"px";
};

