
// gestione menu dell'heder principale

to = '';
function showMenu (menu) {
  // nascondo tutti i menu
  document.getElementById('menu_scuola').style.display = 'none';
  document.getElementById('menu_compagnia').style.display = 'none';
  document.getElementById('menu_teatri').style.display = 'none';
  document.getElementById('menu_consorzi').style.display = 'none';
  document.getElementById('menu_progetti').style.display = 'none';

  if (to > 0) eleminaTimeoutMenu();
  
  var idMenu = 'menu_'+menu;
  elemMenu = document.getElementById(idMenu);
  elemMenu.style.display = 'inline';
  elemMenu.parentNode.onmouseout = function () {
    to = window.setTimeout('hideMenu("'+idMenu+'");',1);
  }
  lastOpenMenu = idMenu;
  
}

function setMenuTimeOut (idMenu,val)
{
	to = window.setTimeout('hideMenu("'+idMenu+'");',val);
	
}

function hideMenu (idMenu) {	
  document.getElementById(idMenu).style.display = 'none';
  eleminaTimeoutMenu();
}

function eleminaTimeoutMenu () {
	
 clearTimeout(to);
}


// per le pagine teatro, compagnia, sede, e sottopagine

function showSubmenu(element,submenu){
  element.style.background='url(img/menuTeatroOver.gif)';
  document.getElementById(submenu).style.display='block';
}

function hideSubmenu(element,submenu){
  element.style.background='url(img/menuTeatro.gif)';
  document.getElementById(submenu).style.display='none';
}

function hideSubmenuDelayed(element,submenu){
  
  window.setTimeout('hideSubmenu("'+element+','+submenu+'");',1000);
  
}

// swap per i box contenenti le news


function swap (idFrom, idToSwap) {
	var currElem = document.getElementById(idFrom);
	var toSwap = document.getElementById(idToSwap);
	
	currElem.style.display = 'none';
	toSwap.style.display = 'block';
}


function swapTab (tabName,tabArr) {
  for (i = 0 ; i < tabArr.length ; i++ ) {  
    if (tabArr[i] != tabName){
      document.getElementById(tabArr[i]).style.display = 'none';
    } else {
      document.getElementById(tabArr[i]).style.display = 'block';    
    }
  }
}  
  
  
 /* Funzioni di validazione dei forms */
 
function CheckEmail(NameObject) {
	var temp;
	var space;
	 
	if (NameObject.value == "")
	  {
	    alert("Il campo \"E-mail\" è obbligatorio");
	    NameObject.focus();
	    return (false);
	  }
	 // check validità email
	txt=NameObject.value;
	if (txt.indexOf("@")<2)
	 // check presenza @
	  {
	    alert("Indirizzo E-mail non valido");
	    NameObject.focus();
	 return (false);
	}
	if (txt.lastIndexOf(".")<txt.indexOf("@"))
	 // check presenza .
	  {
	 alert("Indirizzo E-mail non valido");
	 NameObject.focus();
	 return (false);
	  }
	 
	if (txt.length<6)
	 // check lunghezza almeno 6 char
	  {
	 alert("Indirizzo E-mail non valido");
	 NameObject.focus();
	 return (false);
	  }
	 
	return (true);
}

function apriVideo(path,w,h) {
	fin = window.open('/video_pop.php?path='+path,'pop','width='+w+',height='+h);
	fin.focus();
}
//usata, in spettacolo.php
function apriVideoById(did,w,h) {
	fin = window.open('/video_pop.php?did='+did,'pop','width='+w+',height='+h);
	fin.focus();
}
function apriPopUp(path,w,h) {
	fin = window.open('/finPopUp.php?path='+path,'pop','width='+w+',height='+h);
	fin.focus();
}
function apriImmagine(path,w,h,scroll) {
	if (scroll == "") {
		scroll = "no";
	}
	fin = window.open('/imgPopUp.php?path='+path,'pop','scrollbars='+scroll+',width='+w+',height='+h);
	fin.focus();
}
function apriTesto(path,w,h,scroll) {
	if (scroll == "") {
		scroll = "no";
	}
	fin = window.open('/popTestoSez.php?path='+path,'pop','scrollbars='+scroll+',width='+w+',height='+h);
	fin.focus();
}

function TPPopUp(path,w,h) {
	fin = window.open('/generic/tpPopUp.php?path='+path,'pop','width='+w+',height='+h);
	if (fin){
		fin.focus();	
	}
	
}
  

