
function confermaDelNews (url) {
  chiediConferma = confirm('Volete eliminare la News? ... non DISattivarla?');
  
  if (chiediConferma == true){
    location.href=(url); //ricarica la pagina
  }

}

function confermaDelFaq (url) {
  chiediConferma = confirm('Volete eliminare la F.A.Q.? ... non DISattivarla?');
  
  if (chiediConferma == true){
    location.href=(url); //ricarica la pagina
  }

}
function confermaDelLingua (url) {
  chiediConferma = confirm('Volete eliminare la Lingua? ... non DISattivarla?');
  
  if (chiediConferma == true){
    location.href=(url); //ricarica la pagina
  }

}


function MM_openBrWindow(theURL,winName,features) { 
	window.open(theURL,winName,features);
} 
function PopupCentrata(theUrl,w,h) {
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
      window.open(theUrl,"","scrollbars=1,width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
 }


function changeLocation(menuObj) {
  var i = menuObj.selectedIndex;
  if(i > 0) {
    window.location = menuObj.options[i].value;
  }
}

function copiaPagina(menuObj) {
	
  var i = menuObj.selectedIndex;
  if(i > 0) {
    window.location = menuObj.options[i].value;
  }
}


function getEl(id)
{
    element = document.getElementById(id);
    return element;
}
function hideEl(id)
{
    var element = getEl(id);
    element.style.display = 'none';
}
function showEl(id)
{
    var element = getEl(id);
    element.style.display = '';
}
function ShowHide(sid, last)
{
    //var p = document.images['plus_minus_' + sid];
    var el = 'info_' + sid;
    if(getEl(el).style.display == 'none') {
        var class_name = (last == true) ? 'meno_info ultimo' : 'meno_info';
        showEl(el);
        getEl('p_' + sid).className = class_name;
        //getEl('href_' + sid).innerHTML = ' -chiudi- ';
    } else {
        var class_name = (last == true) ? 'piu_info ultimo' : 'piu_info';
        hideEl(el);
        getEl('p_' + sid).className = class_name;
        //getEl('href_' + sid).innerHTML = ' -info- ';
    }
}

function autoSelect(selectTarget) {
 	if(selectTarget != null && ((selectTarget.childNodes.length == 1
      && selectTarget.childNodes[0].nodeName == "#text") || (selectTarget.tagName == "INPUT"
      && selectTarget.type == "text"))) {
  		if(selectTarget.tagName == 'TEXTAREA' || (selectTarget.tagName == "INPUT" && selectTarget.type == "text")) {
  			 selectTarget.select();
  		} 
 		}
	}
/*  FORM */
function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}

function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="" || value.search("#") != -1)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function checkboxvalidation(entered, alertbox)
{
with (entered)
{
if (checked == false)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}
// editare solo questa funzione
function validaRichiesta(thisform)
{
with (thisform)
{
if (emptyvalidation(nome,"Compilare tutti i campi #Nome")==false) {nome.focus(); return false;};
if (emptyvalidation(cognome,"Compilare tutti i campi #Cognome")==false) {cognome.focus(); return false;};
//if (emptyvalidation(indirizzo,"Compilare tutti i campi")==false) {indirizzo.focus(); return false;};
if (emailvalidation(email,"Indirizzo e-mail non valido")==false) {email.focus(); return false;};
//if (emptyvalidation(tel,"Compilare tutti i campi #Telefono")==false) {tel.focus(); return false;};
if (checkboxvalidation(autorizzo1,"Per proseguire autorizzare il trattamento dei dati personali")==false) {autorizzo1.focus(); return false;};
//if (checkboxvalidation(autorizzo2,"Per proseguire autorizzare il trattamento dei dati personali")==false) {autorizzo2.focus(); return false;};
}

}

