function isCorrettoCF(cf)
{
	var validi, i, s, set1, set2, setpari, setdisp;
	if( cf == '' )  return '';
	cf = cf.toUpperCase();
	if( cf.length != 16 )
		return 0;
	validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	for( i = 0; i < 16; i++ ){
		if( validi.indexOf( cf.charAt(i) ) == -1 )
			return 0;
	}
	set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
	setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
	s = 0;
	for( i = 1; i <= 13; i += 2 )
		s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
	for( i = 0; i <= 14; i += 2 )
		s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
	if( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )
		return 0;
	return 1;
}

function isCorrettoPIVA(pi)
{
	if( pi == '' )  return '';
	if( pi.length != 11 )
		return 0;
	validi = "0123456789";
	for( i = 0; i < 11; i++ ){
		if( validi.indexOf( pi.charAt(i) ) == -1 )
			return 0;
	}
	s = 0;
	for( i = 0; i <= 9; i += 2 )
		s += pi.charCodeAt(i) - '0'.charCodeAt(0);
	for( i = 1; i <= 9; i += 2 ){
		c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );
		if( c > 9 )  c = c - 9;
		s += c;
	}
	if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) )
		return 0;
	return 1;
}

function openwnp()
{
a=window.open("","openwnp","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=yes,width=350,height=280")
setTimeout("a.focus()",100);
}
function openinfo()
{
a=window.open("","openinfo","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=yes,width=500,height=550")
setTimeout("a.focus()",100);
}
function openwnmai()
{
a=window.open("","openwnmai","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=yes,width=400,height=400")
setTimeout("a.focus()",100);
}
function openprin()
{
a=window.open("","openprin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=yes,width=500,height=500")
setTimeout("a.focus()",100);
}
function openprint()
{
a=window.open("","openprint","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=635,height=530")
setTimeout("a.focus()",100);
}
function opendecr()
{
a=window.open("","opendecr","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=565,height=530")
setTimeout("a.focus()",100);
}
function openorder()
{
a=window.open("","openorder","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=600,height=500")
setTimeout("a.focus()",100);
}

function openoneclick()
{
a=window.open("","openoneclick","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=648,height=540")
setTimeout("a.focus()",100);
}

//template base_ita.tmp
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//template base_ita_registrato
function impostaSelect(cosa, valore)
{
  //dato un campo select, lo imposta a valore
  var i;

  for(i = 0; i < cosa.length; i++)
    if(cosa.options[i].text == valore)
    {
      cosa.selectedIndex = i;
      break;
    }
}
function eliminatore(cosa)
{
  document.riepilogo.codlib.value=cosa;
  document.riepilogo.elimina.value='si';
  document.riepilogo.submit();
}
  //controlla se il tipo di spedizione e' impostato
  function controllaTipoSpedizione(miaForm)
  {
    if(! miaForm.paese_sped.selectedIndex > 0)
    {
      alert("Inserire una nazione di destinazione");
      return(false);
    }
    else
      return(true);
  }
  //controlla form laterali ricerca
  function controllacus()
  {
    if(document.cus.autore.value.length < 2 && document.cus.titolo.value.length < 2)
    {
      alert("Inserire almeno 2 caratteri di titolo o di autore");
      return(false);
    }
    else
      return(true);
  }
  //form laterale login
  function controlla()
  {
    if(document.f.utente.value.length == 0 || document.f.password.value.length == 0)
    {
      alert("Inserire Login e Password");
      return(false);
    }
    else
      return(true);
  }
//lista registrati
function DISPLAYSTATUSMSG(msgStr) { //v1.2
  status=msgStr;
  document.returnValue = true;
}
  function ritorno(finestra){
 var newwindow=window.open(finestra,"","width=350,height=300")
newwindow.creator=self
}
function loadurl(url)
{
window.creator.location=url
window.close()
}


function catalogo(finestra){
 var newwindow=window.open(finestra,"","width=400,height=500")
newwindow.creator=self
}
function loadurl(url)
{
window.creator.location=url
window.close()
}

function controllari()
  {
    ok = 0;

    if(document.ricerca.sezioni)
    {
      if(document.ricerca.sezioni[0].checked)
        ok = 1;
      if(document.ricerca.sezioni[1].checked)
        ok = 1;
      if(document.ricerca.sezioni[2].checked)
        ok = 1;
      if(document.ricerca.sezioni[3].checked)
        ok = 1;
    }
    if(document.ricerca.autore)
    if(document.ricerca.autore.value.length > 3)
      ok = 1;
    if(document.ricerca.titolo)
    if(document.ricerca.titolo.value.length > 3)
      ok = 1;
    if(document.ricerca.collana)
    if(document.ricerca.collana.value.length > 3)
      ok = 1;
    if(document.ricerca.editore)
    if(document.ricerca.editore.value.length > 3)
      ok = 1;
    if(document.ricerca.periodo)
    if(document.ricerca.periodo.selectedIndex > 0)
      ok = 1;
    if(document.ricerca.luogo)
    if(document.ricerca.luogo.selectedIndex > 0)
      ok = 1;
    if(document.ricerca.sottosoggetto)
    if(document.ricerca.sottosoggetto.selectedIndex > 0)
      ok = 1;
    if(document.ricerca.extra)
    if(document.ricerca.extra.selectedIndex > 0)
      ok = 1;
    if(document.ricerca.lingua_libro)
    if(document.ricerca.lingua_libro.selectedIndex > 0)
      ok = 1;
    if(document.ricerca.isbn)
    if(document.ricerca.isbn.value.length > 3)
      ok = 1;
    if(!ok)
    {
alert("Inserire qualche criterio di scelta");
      return(false);
    }
    else
      return(true);
  }
function apriDescrizione(argomento)
{
window.open("/cgi-bin/argomenti.cgi?argomento=" + argomento ,"apriDescrizione","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=yes,width=455,height=350")
}
function aprihelp()
{
window.open("","apriDescrizione","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=yes,width=455,height=350")
}

function impostaHidden(miaForm)
{
  var origine = miaForm.riepilogoTerne;
  var destinazione = miaForm.tutti;

  destinazione.value = "Luogo-|-sottosoggetto-|-Periodo\n";
  for(i=0;i<origine.length;i++)
    destinazione.value = destinazione.value + origine.options[i].text + "\n";
}

function primaRiga(tipoRiepilogo)
{
  if(tipoRiepilogo.length == 1)
  {
    if(tipoRiepilogo.options[0].text.substring(0, 3) == "---")
      return 1;
    else
      return 0;
  }
  else
    return 0;
}


function aggiungiTrio(miaForm)
{
  var destinazione = miaForm.riepilogoTerne;
  var selezionato = destinazione.selectedIndex;
  var luogo = miaForm.luogo;
  var sottosoggetto = miaForm.sottosoggetto;
  var periodo = miaForm.periodo;

  if(luogo.selectedIndex<1 &&
     sottosoggetto.selectedIndex<1 &&
     periodo.selectedIndex<1)
  {
    alert("Scegliere almeno un elemento");
    return
  }
  if(primaRiga(destinazione))
    destinazione.options[0]=null;
  nuova_option = new Option(luogo.options[luogo.selectedIndex].text + "-|-" 
                           +sottosoggetto.options[sottosoggetto.selectedIndex].text+ "-|-"
                           +periodo.options[periodo.selectedIndex].text );
  destinazione.options[destinazione.length] = nuova_option;
}

function rimuoviTrio(miaForm)
{
  var origine = miaForm.riepilogoTerne;
  var scelta;
  var selezionato = origine.selectedIndex;

  if(selezionato != -1)
  {
    scelta = origine.options[selezionato].text;
    if(scelta != "")
    {
      if(!primaRiga(origine))
        origine.options[selezionato]=null;
      else
        alert("Non ci sono elementi da rimuovere");
    }
    else
      alert("Selezionare un elemento da rimuovere");
  }
  else
    alert("Selezionare un elemento da rimuovere");
}

function aggiungiExtra(miaForm)
{
  var destinazione = miaForm.riepilogoExtra;
  var selezionato = destinazione.selectedIndex;
  var extra = miaForm.extra;

  if(extra.selectedIndex<1)
  {
    alert("Scegliere un extra");
    return
  }
  if(primaRiga(destinazione))
    destinazione.options[0]=null;
  nuova_option = new Option(extra.options[extra.selectedIndex].text);
  destinazione.options[destinazione.length] = nuova_option;
}

function rimuoviExtra(miaForm)
{
  var origine = miaForm.riepilogoExtra;
  var scelta;
  var selezionato = origine.selectedIndex;

  if(selezionato != -1)
  {
    scelta = origine.options[selezionato].text;
    if(scelta != "")
    {
      if(!primaRiga(origine))
        origine.options[selezionato]=null;
      else
        alert("Non ci sono elementi da rimuovere");
    }
    else
      alert("Selezionare un elemento da rimuovere");
  }
  else
    alert("Selezionare un elemento da rimuovere");
}
function aggiungiLingua(miaForm)
{
  var destinazione = miaForm.riepilogoLingue;
  var selezionato = destinazione.selectedIndex;
  var lingua = miaForm.lingua;

  if(lingua.selectedIndex<1)
  {
    alert("Scegliere una lingua");
    return
  }
  if(primaRiga(destinazione))
    destinazione.options[0]=null;
  nuova_option = new Option(lingua.options[lingua.selectedIndex].text);
  destinazione.options[destinazione.length] = nuova_option;
}

function rimuoviLingua(miaForm)
{
  var origine = miaForm.riepilogoLingue;
  var scelta;
  var selezionato = origine.selectedIndex;

  if(selezionato != -1)
  {
    scelta = origine.options[selezionato].text;
    if(scelta != "")
    {
      if(!primaRiga(origine))
        origine.options[selezionato]=null;
      else
        alert("Non ci sono elementi da rimuovere");
    }
    else
      alert("Selezionare un elemento da rimuovere");
  }
  else
    alert("Selezionare un elemento da rimuovere");
}

function controllaMailingList(form)
{
  var origine = form.riepilogoTerne;

  if(origine.length<=1)
  if(origine.length == 0 ||
     (origine.length == 1 && origine.options[0].value.charAt(0) == '-'))
  {
    alert("Selezionare almeno una terna");
    return(false);
  }
  if(!form.novita_arte.checked &&
     !form.novita_architettura.checked &&
     !form.fuori_commercio.checked &&
     !form.libri_50.checked &&
     !form.libri_banca.checked)
  {
    alert("Selezionare almeno un tipo (Novitā arte, novitā architettura, ...)");
    return(false);
  }
  
  for(i=0;i<origine.length;i++)
    origine.options[i].selected = true;
  origine = form.riepilogoExtra;
  for(i=0;i<origine.length;i++)
    origine.options[i].selected = true;
  origine = form.riepilogoLingue;
  for(i=0;i<origine.length;i++)
    origine.options[i].selected = true;
  return(true);
}

function checkemail(cosa)
{
  var 
filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

  if (cosa.length == 0)
    return(false)
  else
  if (filter.test(cosa))
    return(true)
  else
    return(false)
}

function controllaDatiOrdine(form)
{
  if(form.codicefiscale_fat.value.length >0)
  if(!isCorrettoCF(form.codicefiscale_fat.value) &&
     !isCorrettoPIVA(form.codicefiscale_fat.value))
  {
    alert("Codice Fiscale errato");
    form.codicefiscale_fat.focus();
    return(false);
  }
  return(true);
}

function controllaIscrizione(form)
{
  if(form.login.value.length < 4)
  {
    alert("login mancante o troppo corto");
    form.login.focus();
    return(false);
  }
  if(!checkemail(form.email.value))
  {
    alert("email errata o mancante");
    form.email.focus();
    return(false);
  }
  //if(form.password.value.length < 6)
  //{
  //  alert("password mancante o troppo corta (almeno 6)");
  //  form.password.focus();
  //  return(false);
  //}
  //if(form.password2.value != form.password.value)
  //{
  //  alert("Password diverse");
  //  form.password.focus();
  //  return(false);
  //}
  if(form.nome.value.length < 6)
  {
    alert("nome mancante o nome troppo corto");
    form.nome.focus();
    return(false);
  }
  if(form.tipo.selectedIndex)
  if(form.tipo.options[form.tipo.selectedIndex].value == 'privato')
  if(form.data_nascita.value.length > 0)
  {
    if (form.data_nascita.value.substring(2,3) != "/" ||
      form.data_nascita.value.substring(5,6) != "/" ||
      isNaN(form.data_nascita.value.substring(0,2)) ||
      isNaN(form.data_nascita.value.substring(3,5)) ||
      isNaN(form.data_nascita.value.substring(6,10))) {
        alert("Inserire nascita in formato gg/mm/aaaa");
        form.data_nascita.focus();
        return false;
    }
    else if (form.data_nascita.value.substring(0,2) > 31) {
       alert("Impossibile utilizzare un valore superiore a 31 per i giorni");
       form.data_nascita.focus();
       return false;
    }
    else if (form.data_nascita.value.substring(3,5) > 12) {
       alert("Impossibile utilizzare un valore superiore a 12 per i mesi");
       form.data_nascita.focus();
       return false;
    }
    else if (form.data_nascita.value.substring(6,10) < 1800) {
       alert("Impossibile utilizzare un valore inferiore a 1800 per l'anno");
       form.data_nascita.focus();
       return false;
    }
    oggi = new Date()
    if(oggi.getFullYear() - parseInt(form.data_nascita.value.substring(6,10)) > 18)
    {
      //nulla
    }
    else
      if(oggi.getFullYear() - parseInt(form.data_nascita.value.substring(6,10)) == 18 &&
         oggi.getMonth() +1 > parseInt(form.data_nascita.value.substring(3,5)))
      {
        //nulla
      }
      else
        if(oggi.getFullYear() - parseInt(form.data_nascita.value.substring(6,10)) == 18 &&
           oggi.getMonth() +1 == parseInt(form.data_nascita.value.substring(3,5)) &&
           oggi.getDate() >= parseInt(form.data_nascita.value.substring(0,2)))
        {
          //nulla
        }
        else
        {
          alert("Non sei maggiorenne");
          return false;
        }
  }
  if(form.indirizzo.value.length < 3)
  {
    alert("indirizzo mancante o troppo corto");
    form.indirizzo.focus();
    return(false);
  }
  if(form.civico.value.length < 1)
  {
    alert("numero civico mancante");
    form.civico.focus();
    return(false);
  }
  if(form.cap.value.length < 4)
  {
    alert("cap mancante o troppo corto");
    form.cap.focus();
    return(false);
  }
  if(form.telefono.value.length < 4)
  {
    alert("telefono mancante o troppo corto");
    form.telefono.focus();
    return(false);
  }
  if(form.citta.value.length < 4)
  {
    alert("citta mancante o troppo corta");
    form.citta.focus();
    return(false);
  }
  if(form.paese.options[form.paese.selectedIndex].value == 'Italia' ||
     form.paese.options[form.paese.selectedIndex].value == 'Italy'  ||
     form.paese.options[form.paese.selectedIndex].text == 'Italia' ||
     form.paese.options[form.paese.selectedIndex].text == 'Italy')
  if(form.codicefiscale.value.length == 0)
  {
    alert("Codice Fiscale obbligatorio");
    form.codicefiscale.focus();
    return(false);
  }
  if(form.codicefiscale)
  if(form.codicefiscale.value.length >0)
  if(!isCorrettoCF(form.codicefiscale.value) &&
     !isCorrettoPIVA(form.codicefiscale.value))
  {
    alert("Codice Fiscale errato");
    form.codicefiscale.focus();
    return(false);
  }
  if(form.codicefiscale_fat)
  if(form.codicefiscale_fat.value.length >0)
  if(!isCorrettoCF(form.codicefiscale_fat.value) &&
     !isCorrettoPIVA(form.codicefiscale_fat.value))
  {
    alert("Codice Fiscale errato");
    form.codicefiscale_fat.focus();
    return(false);
  }
  if(form.tipo.options[form.tipo.selectedIndex].text != 'privato')
  if(form.tipo.options[form.tipo.selectedIndex].text != 'private')
  if(form.tipo.options[form.tipo.selectedIndex].value != 'privato')
  if(form.tipo.options[form.tipo.selectedIndex].value != 'private')
  if(form.paese.options[form.paese.selectedIndex].text == 'Italia' ||
     form.paese.options[form.paese.selectedIndex].text == 'Italy'  ||
     form.paese.options[form.paese.selectedIndex].value == 'Italia' ||
     form.paese.options[form.paese.selectedIndex].value == 'Italy')
  if(form.piva.value.length == 0)
  {
    alert("Partita iva obbligatoria");
    form.piva.focus();
    return(false);
  }
  if(!form.accetto_contratto.checked)
  {
    alert("Per procedere con la registrazione č necessario accettare i termini del contratto");
    return(false);
  }
  return(true);
}

function apriApprofondimento(cosa)
{
  if(cosa != 'Tutti' &&
     cosa != 'All')
  {
    a = window.open("aaa","approf","width=40,height=50");
    a.close();
    comando = "window.open(\"/cgi-bin/argomenti.cgi?argomento="+cosa+"#"+cosa+"\", \"approf\", \"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=418,height=500\")"
    setTimeout(comando,100);
  }
}
function apriApprofondimentoex(cosa)
{
  if(cosa != 'Tutti' &&
     cosa != 'All')
  {
    a = window.open("aaa","approf","width=40,height=50");
    a.close();
    comando = "window.open(\"/cgi-bin/argomenti_extra.cgi?argomento="+cosa+"#"+cosa+"\", \"approf\", \"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=418,height=500\")"
    setTimeout(comando,100);
  }
}

function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}

function affiliato (value) 
{
  var myDate=new Date();
  myDate.setDate(myDate.getDate()+60);
  setCookie ('affiliato', value, myDate) ;
}

function setCookie (name, value, expires) 
{
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "; path=/" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}

function testCookies(chi)
{
  var cosa = "-----------------";
  setCookie("ciaobello",cosa);
  if(GetCookie("ciaobello") != cosa)
  {
    chi.blur();
    alert("ATTENZIONE: il browser non č configurato correttamente.\nNon sarā possibile effettuare il Login e procedere all'acquisto.");
    window.open("/help_cookie.html");
  }
}
function testCookieseng(chi)
{
  var cosa = "-----------------";
  setCookie("ciaobello",cosa);
  if(GetCookie("ciaobello") != cosa)
  {
    chi.blur();
    alert("ATTENZIONE: il browser non č configurato correttamente (il suo computer non accetta i cookies).\nNon č possibile vedere i propri sconti nč effettuare acquisti.");
    window.open("/help_cookie_eng.html");
  }
}
//function right(e) {
//if (navigator.appName == 'Netscape' && 
//(e.which == 3 || e.which == 2))
//return false;
//else if (navigator.appName == 'Microsoft Internet Explorer' && 
//(event.button == 2 || event.button == 3)) {
//alert("Libroco (R)");
//return false;
//}
//return true;
//}
//document.onmousedown=right;
//if (document.layers) window.captureEvents(Event.MOUSEDOWN);
//window.onmousedown=right;
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function hide(the_id)
{
   var obj = (document.getElementById(the_id))? document.getElementById(the_id): document.all[the_id];
   obj.style.visibility = "hidden";
   obj.style.display = "none";
}

function show(the_id)
{
   var obj = (document.getElementById(the_id))? document.getElementById(the_id): document.all[the_id];
   obj.style.visibility = "visible";
   obj.style.display = "block";
}

function show_hide(the_id)
{
     var obj = (document.getElementById(the_id))? document.getElementById(the_id): document.all[the_id];

     if(obj.style.visibility == "hidden" ||
        obj.style.display == "none"){
          obj.style.visibility = "visible";
          obj.style.display = "block";
     } else {
          obj.style.visibility = "hidden";
          obj.style.display = "none";
     }
}

function metti_il_valore_random()
{
   for(i=0;i<document.forms.length;i++)
     if(document.forms[i].random)
     {
       document.forms[i].random.value = Math.random();
     }
}
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
        if(!document.forms[FormName])
                return;
        var objCheckBoxes = document.forms[FormName].elements[FieldName];
        if(!objCheckBoxes)
                return;
        var countCheckBoxes = objCheckBoxes.length;
        if(!countCheckBoxes)
                objCheckBoxes.checked = CheckValue;
        else
                // set the check value for all check boxes
                for(var i = 0; i < countCheckBoxes; i++)
                        objCheckBoxes[i].checked = CheckValue;
}
var AttenderePrego_vecchio_valore;
var AttenderePrego_bottone;
function AttenderePrego(bottone)
{
   AttenderePrego_vecchio_valore = bottone.value;
   AttenderePrego_bottone = bottone;
   bottone.value='Attendere prego ...';
   setTimeout('AttenderePrego_bottone.value=AttenderePrego_vecchio_valore', 7000);
}

if(!window.jQuery)
{
    document.write('<script language="javascript" src="/js/jquery.js"></script>');
/*
    var scriptObj = document.createElement("script");
    scriptObj.src = "/js/jquery.js";
    scriptObj.type = "text/javascript";
    var head=document.getElementsByTagName('head')[0];
    head.insertBefore(scriptObj,head.firstChild);
*/
}
if(1)
{
    document.write('<script language="javascript" src="/js/jquery.geekSkypeRemover-1.0.js"></script>');
    document.write('<script language="javascript">jQuery(document).ready(function() { jQuery.geekSkypeRemover(5000); });</script>');
/*
    var scriptObj = document.createElement("script");
    scriptObj.src = "/js/jquery.geekSkypeRemover-1.0.js";
    scriptObj.type = "text/javascript";
    var head=document.getElementsByTagName('head')[0];
    head.insertBefore(scriptObj,head.firstChild);

    var ss = document.createElement('script');
    ss.text = 'jQuery(document).ready(function() { jQuery.geekSkypeRemover(5000); });';
    var head = document.getElementsByTagName('head')[0];
    head.appendChild(ss);
*/
}

