/* Javascript Document */

/* per semplificare le popup */
function imgPopup(url,w,h) {
    w = w+15;
    h = h+15;
	var win = window.open (url, "IMAGES", "width="+w+",height="+h+",scrollbars=no");
	win.focus();
	return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function my_openBrWindow(theURL,winName,features) { //v2.0
  var win = window.open(theURL,winName,features);
  win.focus();
}

// Apre la scheda novità
function schedaNovitaEsp(codice, sortid, curLang, w, h, prova) {
	var href = '/'+curLang+'/pop_scheda.php?CODICE='+codice+'&SORTID='+sortid;
	if (prova) { href += '&P=1';}
	var minH = 400;
	var minW = 400;
	h += 170;
	w += 50;
	if (h < minH) {h=minH;}
	if (w < minW) {w=minW;}
	var features = 'width='+w+',height='+h+',scrollbars=0,status=0';
	//alert(features);
	//alert(href);
	my_openBrWindow(href,'_blank',features);
	return(false);		// non fa l'href
} // schedaNovitaEsp

// Apre la popup con la mappa
function mappaEsp(cod_sta, curLang) {
	var href = '/php/e_pop_mappa.php?COD_STA='+cod_sta+'&langCode='+curLang;
	var minH = 450;
	var minW = 650;
	h = 170;
	w = 50;
	if (h < minH) {h=minH;}
	if (w < minW) {w=minW;}
	var features = 'width='+w+',height='+h+',scrollbars=1,status=0';
	//alert(features);
	//alert(href);
	my_openBrWindow(href,'_blank',features);
	return(false);		// non fa l'href
} // mappaEsp

// apre le popup di info e privacy
function footer(href) {
	var h = 600;
	var w = 650;
	var features = 'width='+w+',height='+h+',scrollbars=yes,status=0';
	//alert(features);
	//alert(href);
	my_openBrWindow(href,'_blank',features);
	return(false);		// non fa l'href
} // footer

// Apre la popup del dettaglio della ricerca sul modulo_a
function dettModuloAEsp(codice, curLang) {
	var href = '/'+curLang+'/v_ricerca_modulo_a_dett.php?CODICE_EXPO='+codice;
	var h = 400;
	var w = 650;
	var features = 'width='+w+',height='+h+',scrollbars=yes,status=0';
	//alert(features);
	//alert(href);
	my_openBrWindow(href,'_blank',features);
	return(false);		// non fa l'href
} // dettModuloAEsp

// Apre la popup del dettaglio della ricerca sul modulo_a
function dettPCommEsp(codice, curLang) {
	var href = '/'+curLang+'/r_ricerca_pcomm_dett.php?CODICE='+codice;
	var h = 400;
	var w = 650;
	var features = 'width='+w+',height='+h+',scrollbars=yes,status=0';
	//alert(features);
	//alert(href);
	my_openBrWindow(href,'_blank',features);
	return(false);		// non fa l'href
} // dettPCommEsp

function checkPrivacy(f,m){
	if(f.elements['Privacy'].checked){
	    return true;
	}
	alert(m);
	return false;
}//checkPrivacy


function privacyTest() {
  f = document.getElementById('PersonalCard');
  if (f.elements["privacy[]"].checked) {
	   return true;
	   alert("Please, check for privacy");
	   return false;
  }
   alert("Please, check for privacy");
   return false;
}
/* prova modifica heigh col javascripa
function testa() {
	p = document.getElementById('page').clientHeight;
	c = document.getElementById("center_tab").clientHeight;
	alert('page height: '+p+' center_tab height: '+c);
	document.getElementById("center_tab").clientHeight = p-2;
}
*/

// indice del processo di setTimeOut, utile per cancellarlo dalla coda
var setTo = new Array();

//LoP: funzione per lo show/hide layer del menu a tendina (migliorabile, forse..)
function toggle(ul,on){
	
    ulElement = document.getElementById(ul);
    if (ulElement){
        ulElement.style.display = (on)?'block':'none';
    }
}//toggle

//Aggiungo un delay all'esecuzione del toggle() per evitare il flicker di IE6
// ul: id del menu da nascondere/visualizzare
// sty: stile da applicare (on o off)
// on: flag true o false
function menuShow(ul,on){
	if(on) {
	    window.clearTimeout(setTo[ul]);
	    toggle(ul,on);
	} else {
	    setTo[ul] = window.setTimeout("toggle('" + ul + "'," + on + ");",100);
	}
}//menuShow
