//-- begin: Scroller's Algorithm -->
function start() {
	if(document.all) iemarquee(slider);
	else if(document.getElementById)ns6marquee(document.getElementById('slider'));
	else if(document.layers)ns4marquee(document.slider1.document.slider2);
	}

function iemarquee(whichdiv) {
	iediv=eval(whichdiv);
	iediv.style.pixelTop=sheight;
	iediv.innerHTML=wholemessage;
	sizeup=iediv.offsetHeight;ieslide();
	}
	
function ieslide() {
	if(iediv.style.pixelTop>=sizeup*(-1)) {
		iediv.style.pixelTop-=sspeed;
		setTimeout("ieslide()",100);
		}
	else {
		iediv.style.pixelTop=sheight;
		ieslide();
	}
}

function ns4marquee(whichlayer) {
	ns4layer=eval(whichlayer);
	ns4layer.top=sheight;ns4layer.document.write(wholemessage);
	ns4layer.document.close();
	sizeup=ns4layer.document.height;ns4slide();
	} 

function ns4slide() {
	if(ns4layer.top>=sizeup*(-1)) {
		ns4layer.top-=sspeed;
		setTimeout("ns4slide()",100);
		}
	else {
	ns4layer.top=sheight;
	ns4slide();
	}
}

function ns6marquee(whichdiv) {
	ns6div=eval(whichdiv);
	ns6div.style.top=sheight;
	ns6div.innerHTML=wholemessage;
	sizeup=ns6div.offsetHeight;
	ns6slide();
}

function ns6slide(){
	if(parseInt(ns6div.style.top)>=sizeup*(-1)) {
		ns6div.style.top=parseInt(ns6div.style.top)-sspeed;
		setTimeout("ns6slide()",100);
		}
	else {
		ns6div.style.top=sheight;
		ns6slide();
	}
}
//-- end Algorithm -->

//function PopUpMenu(pagina,nomePopUp,width, height,option) 
	//{   
     //open(pagina, nomePopUp, dimensioni);
	//}
	
	
function PopUpMenu(pagina,nomePopUp,width, height,option)
   { 
   if (document.all) 
      { 
      var x = window.screenLeft; 
      var y = window.screenTop; 
      var w = window.document.body.offsetWidth; 
      var h = window.document.body.offsetHeight; 
      } 
  else 
   { 
   var x = window.screenX; 
   var y = window.screenY; 
   var w = window.outerWidth; 
   var h = window.outerHeight; 
   } 
  var cntx = x + Math.round((w - width) / 2); 
  var cnty = y + Math.round((h - height) / 2); 
  window.open (pagina, nomePopUp, 'left=' + cntx + ',top=' + cnty + ',width=' + 
width + ',height=' + height + ',' + option); 
} 


function addPage() {
if ((navigator.appName=="Microsoft Internet Explorer") &&
(parseInt(navigator.appVersion)>=4)) {
window.external.addFavorite
("http://www.comodo.it", "Comodo - Il Portale dei preservativi");
} else {
var msg = "Il tuo browser non supporta lo script '" +
document.location.href + "' ai preferiti!";
if (navigator.appName=="Netscape") msg += " (CTRL-D)";
alert(msg);
}
}


function valida_sondaggio(form)
{
	var selezionato=false;
	for (var i = 0; i < form.risposte.length; i++) {
			if (form.risposte[i].checked) {
			selezionato=true;
			break;
		}
	}
  
  var msg="Attenzione, inserisci il tuo voto!";

  if(selezionato==false)
  {
	alert(msg);
    return false;
  }
  else return true;
}



function verifica_form_newsletters(form)
{
if((form.email.value==""))
{ 
   var msg="Alcune informazioni inserite non sono corrette:\n\n";
   msg+="        - Email non inserita  \n";
   alert(msg);
   return false;
}
else
 return true; 
}


function verifica_form_articoli(form)
{
if((form.ItemQuantity.value=="") || (form.ItemQuantity.value<1) || (form.ItemQuantity.value>999))
{ 
   var msg="Alcune informazioni inserite non sono corrette:\n\n";
   msg+="        - Inserire correttamente la quantità che si vuole acquistare  \n";
   alert(msg);
   return false;
}
else
 return true; 
}

function speseGratisQuasiRaggiunte(spese) {
	alert("Attenzione, con una spesa ulteriore di € "+spese+" spese di spedizione GRATIS");
}

function verifica_form_articoliBoxer(form)
{
if((form.ItemQuantity.value=="") || (form.ItemQuantity.value<1) || (form.ItemQuantity.value>999))
{ 
   var msg="Alcune informazioni inserite non sono corrette:\n\n";
   msg+="        - Inserire correttamente la quantità che si vuole acquistare  \n";
   alert(msg);
   return false;
}

if((!form.tagliaXSS.checked) & (!form.tagliaSM.checked) & (!form.tagliaML.checked)) {
	var msg="Alcune informazioni inserite non sono corrette:\n\n";
   msg+="        - Inserire la taglia che si vuole acquistare  \n";
   alert(msg);
   return false;
}

if((!form.verde.checked) & (!form.arancio.checked) & (!form.celeste.checked)) {
	var msg="Alcune informazioni inserite non sono corrette:\n\n";
   msg+="        - Inserire il colore che si vuole acquistare  \n";
   alert(msg);
   return false;
}

if(form.ItemQuantity.value>1 & form.note.value == "") {
	var msg="Alcune informazioni inserite non sono corrette:\n\n";
   msg+="        - Gli articoli acquistati sono superiori ad 1, è necessario quindi specificare nel form \"note\" in che modo distribuire taglie e colori ai "+form.ItemQuantity.value+" articoli acquistati \n";
   alert(msg);
   return false;
}

 return true; 
}


function loadpage() {
browver= parseInt(navigator.appVersion);
browtype = navigator.appName;
browsertype = "old";
if (browtype == "Netscape" && !(browver < 3)) {
browsertype = "new"; 
}
if (browtype == "Microsoft Internet Explorer" && !(browver < 4)) {
browsertype = "new";
}
if (browsertype == "new") {
thetimer = setTimeout("changeimage()", 12000);
banneradcode = 0;
listofimages = new Array(3);
listofimages[0] = new Image(468,60);
listofimages[0].src = "banner-0.gif";
listofimages[1] = new Image(468,60);
listofimages[1].src = "banner-1.gif";
listofimages[2] = new Image(468,60);
listofimages[2].src = "banner-2.gif";


}
}

function changeimage(){
if (browsertype == "new") {
banneradcode = banneradcode + 1
if (banneradcode == "3") {
banneradcode = 0
}
imagesource = "banner-" + banneradcode + ".gif"
window.document.bannerad.src = imagesource
thetimer = setTimeout("changeimage()", 12000);
}
else if (browsertype == "old") {
}
}

function changepage() {
if (browsertype == "new") {
if (banneradcode == 0) 
newlocation = "./articoli.php?sort=marca&marca=28";
else if (banneradcode == 1)
newlocation = "./articoli.php?sort=marca&marca=4";
else if (banneradcode == 2)
newlocation = "./twolly.php";

location = newlocation;
}
else if (browsertype == "old") {
location = "http://www.comodo.it"
}
}


function valida_form_acquisti(form)
{
  var msg="Tutti i campi segnati (*) sono obbligatori";
  var msg2="E' necessario accettare l'informativa per il trattamento dei dati personali";
  
  
  if((form.nome.value=="") || (form.cognome.value=="")
       || (form.via.value=="") || (form.email.value =="") || (form.n.value =="")
	   || (form.citta.value =="") || (form.cap.value =="") || (form.provincia.value =="") || (form.celere.checked & form.telefono.value == ""))
  {
         alert(msg);
         return false;
  }
  
  else if(form.autorizzo.checked==false) {
	  alert(msg2);
      return false;
  }

  else {
  document.getElementById('Attendere').innerHTML = "<b>Elaborazione in corso</b>";
  document.getElementById('buttonAcquista').disabled = true;
  document.getElementById('buttonAcquista').value = "Attendere....";
  return true;
  }
  
}


function valida_form_acquisti_b2b(form)
{
  var msg="Tutti i campi segnati (*) sono obbligatori";
  var msg2="E' necessario accettare l'informativa per il trattamento dei dati personali";

  if((form.nome.value=="") || (form.cognome.value=="")
       || (form.via.value=="") || (form.email.value =="") || (form.n.value =="")
	   || (form.citta.value =="") || (form.cap.value =="") || (form.provincia.value =="")
	   || (form.stato.value =="") || (form.sociale.value =="") || (form.iva.value ==""))
  {
         alert(msg);
         return false;
  }
   else if(form.autorizzo.checked==false) {
	  alert(msg2);
      return false;
  }
  
   else {
  document.getElementById('Attendere').innerHTML = "<b>Elaborazione in corso</b>";
  document.getElementById('buttonAcquista').disabled = true;
  document.getElementById('buttonAcquista').value = "Attendere....";
  return true;
  }
}


function valida_form_reg(form)
{
  var msg="Tutti i campi segnati (*) sono obbligatori";

  if((form.nome.value=="") || (form.cognome.value=="")
       || (form.via.value=="") || (form.email.value =="") 
	   || (form.citta.value =="") || (form.cap.value =="") || (form.provincia.value =="")
	   || (form.iva.value =="") || (form.sociale.value ==""))
  {
         alert(msg);
         return false;
  }
  
   if((form.attivita.value =="") & (form.altro.value =="")) {
	  alert(msg);
      return false;
	  } 
   else return true;
}


function verifica_form_argomento(form)
{
if((form.argomento.value==""))
{ 
   var msg="Spiacente: ricerca non eseguibile\n";
   msg+="E' necessario inserire una stringa di ricerca";
   alert(msg);
   return false;
}
else
 return true; 
}


function verifica_form_cercaprodotto(form)
{
if((form.stprodotto.value==""))
{ 
   var msg="Spiacente: ricerca non eseguibile\n";
   msg+="E' necessario inserire una stringa di ricerca";
   alert(msg);
   return false;
}
else
 return true; 
}


function cancellaTesto(input)
{
	input.value="";
}


function verifica_form_b2b(form)
{
if((form.id.value=="") || (form.passwd.value==""))
{ 
   var msg="Spiacente: accesso non consentito\n";
   msg+="E' necessario inserire id e password";
   alert(msg);
   return false;
}
else
 return true; 
}


function verifica_form_passaparola(form)
{
 
 var msg="Alcune informazioni inserite non sono corrette:\n\n";
  
  if((form.nick.value=="") || (form.amico1.value=="") || (form.commenti.value==""))
  {
    //nick
          if(form.nick.value=="")
                msg+="        - Nome o pseudonimo non inserito  \n";
   
   //e-mail amico
          if(form.amico1.value=="")
                msg+="        - Email non inserita  \n";
  //commento		 
		  if(form.commenti.value=="")
                msg+="        - Commento non inserito  \n"; 
		 
		 alert(msg);
         return false;
 }
else
 return true; 
}



function verifica_form_passaparolaNewsletters(form)
{
 
 var msg="Alcune informazioni inserite non sono corrette:\n\n";
  
  if((form.nick.value=="") || (form.amico1.value==""))
  {
    //nick
          if(form.nick.value=="")
                msg+="        - Nome o pseudonimo non inserito  \n";
   
   //e-mail amico
          if(form.amico1.value=="")
                msg+="        - Email non inserita  \n";
		 
		 alert(msg);
         return false;
 }
else
 return true; 
}


function verifica_form_inviaNews(form)
{
 
 var msg="Alcune informazioni inserite non sono corrette:\n\n";
  
  if((form.nick.value=="") || (form.amico1.value=="") || (form.commenti.value==""))
  {
    //nick
          if(form.nick.value=="")
                msg+="        - Nome o pseudonimo non inserito  \n";
   
   //e-mail amico
          if(form.amico1.value=="")
                msg+="        - Email non inserita  \n";
  //commento		 
		  if(form.commenti.value=="")
                msg+="        - Commento non inserito  \n"; 
		 
		 alert(msg);
         return false;
 }
else {
  document.getElementById('Attendere').innerHTML = "<b>Elaborazione in corso</b>";
  document.getElementById('invianews').disabled = true;
  document.getElementById('invianews').value = "Attendere....";
  return true; 
 }
 
}



function abilitaFermoPosta(form) {
	
	
	if(document.formCassa.fermoPosta.checked) {
		document.formCassa.indirizzoFermoPosta.disabled=false;
		document.formCassa.indirizzoFermoPosta.focus();
	}
	else document.formCassa.indirizzoFermoPosta.disabled=true;
	
}


function abilitaSpecifica(controllo,form) {
	var valore=controllo.options[controllo.selectedIndex].value;
	if(valore=="motore di ricerca" || valore=="sito" || valore=="giornale") {
		document.forms[form].conoscenzaQuale.disabled=false;
		document.forms[form].conoscenzaQuale.focus();
	}
	else
	    document.forms[form].conoscenzaQuale.disabled=true;
}


function verifica_form_avvisami(form)
{
 
 var msg="Alcune informazioni inserite non sono corrette:\n\n";
  
  if((form.nick.value=="") || (form.email.value==""))
  {
    //nick
          if(form.nick.value=="")
                msg+="        - Nome o pseudonimo non inserito  \n";
   
   //e-mail amico
          if(form.email.value=="")
                msg+="        - Email non inserita  \n";
		 
		 alert(msg);
         return false;
 }
else
 return true; 
}



function verifica_formLogin(form)
{
 
 var msg="Alcune informazioni inserite non sono corrette:\n\n";
  
  if((form.username.value=="") || (form.password.value==""))
  {
    //nick
          if(form.username.value=="")
                msg+="        - Username non inserito  \n";
   
   //e-mail amico
          if(form.password.value=="")
                msg+="        - Password non inserita  \n";
		 
		 alert(msg);
         return false;
 }
else
 return true; 
}



function verifica_formRegistrazione(form)
{
  var msg="Tutti i campi segnati (*) sono obbligatori";
  var msg2="E' necessario accettare l'informativa per il trattamento dei dati personali";
  
  if((form.username.value=="") || (form.password.value=="") || (form.nome.value=="") || (form.cognome.value=="")
       || (form.via.value=="") || (form.email.value =="") || (form.n.value =="")
	   || (form.citta.value =="") || (form.cap.value =="") || (form.provincia.options[form.provincia.selectedIndex].value =="")
	   || (form.stato.options[form.stato.selectedIndex].value ==""))
  {
         alert(msg);
         return false;
  }
  else if(form.autorizzo.checked==false) {
	  alert(msg2);
      return false;
  }
  else 
  return true;
  
}


function speseCarta(speseCarta,speseContrassegno,totale,totalAll,tettoSpeseDiSpedizione) {
		if(speseCarta!=speseContrassegno & !document.getElementById("celere").checked & totale<tettoSpeseDiSpedizione) {
		alert("Selezionando il metodo di pagamento Carta di Credito\n le spese di spedizione sono pari a € "+speseCarta);
		document.getElementById("totale").innerHTML=totalAll;
		document.getElementById("speseCart").innerHTML=speseCarta;
		document.getElementById("spese").value=speseCarta;
		document.getElementById("total_all").value=totalAll;
		}
}

function spesePayPal(speseCarta,speseContrassegno,totale,totalAll,tettoSpeseDiSpedizione) {
		if(speseCarta!=speseContrassegno & !document.getElementById("celere").checked & totale<tettoSpeseDiSpedizione) {
		alert("Selezionando il metodo di pagamento PayPal\n le spese di spedizione sono pari a € "+speseCarta);
		document.getElementById("totale").innerHTML=totalAll;
		document.getElementById("speseCart").innerHTML=speseCarta;
		document.getElementById("spese").value=speseCarta;
		document.getElementById("total_all").value=totalAll;
		}
}

function speseContrassegno(speseCarta,speseContrassegno,totale,totalAll,tettoSpeseDiSpedizione, differenza) {
		if(speseCarta!=speseContrassegno & totale<tettoSpeseDiSpedizione) {
		alert("Selezionando il metodo di pagamento Contrassegno\n è previsto una spesa supplementare di € "+differenza);
		document.getElementById("totale").innerHTML=totalAll;
		document.getElementById("speseCart").innerHTML=speseContrassegno;
		document.getElementById("spese").value=speseContrassegno;
		document.getElementById("total_all").value=totalAll;
		}
}

function setCreditCard(controllo) {
	var valore=controllo.options[controllo.selectedIndex].value;
	if(valore!="Italia") {
		document.getElementById('rdCard').checked=true;
		document.getElementById('rdContr').disabled=true;
	}
	else {
		document.getElementById('rdContr').disabled=false;
	}
}

function festa8Marzo(controllo) {
	if(controllo.value.substring(controllo.value.length-1,controllo.value.length)=="a" || 
		controllo.value.substring(controllo.value.length-1,controllo.value.length)=="A")
		alert("Ciao "+controllo.value+"!\nil nostro sistema ti ha riconosciuto come una Donna.\nIn occasione di questo per te oggi le spese di spedizione sono gratis!\nControlla nella email di riepilogo che l'importo sia stato realmente azzerato.\nAuguri da Comodo.it!");
}

function verificaPaccoCelere(controllo,registrato,spesePaccoCelere,speseCarta,totalAll1,totalAll2,tettoSpeseDiSpedizione,totale) {
	if(controllo.checked) {
		document.getElementById("totale").innerHTML=totalAll2;
		document.getElementById("speseCart").innerHTML=spesePaccoCelere;
		document.getElementById("spese").value=spesePaccoCelere;
		
		document.getElementById('rdCard').checked=true;
		document.getElementById('rdContr').disabled=true;
		document.getElementById('obbl').innerHTML = "(*) Telefono:";
		if(registrato=="si") 
			document.getElementById('cambiaTel').innerHTML = "<input type=\"text\" name=\"telefono\" class=\"normalText\">";
			
		alert("Selezionando l'opzione \"pacco celere\" \nl'unica modalità di pagamento possibile è \nCarta di Credito €" + spesePaccoCelere);
	}
	else {
		if(totale>=tettoSpeseDiSpedizione) {
		document.getElementById("totale").innerHTML=totale;
		document.getElementById("speseCart").innerHTML="GRATIS";
		document.getElementById("spese").value=0;
		}
		else {
		document.getElementById("totale").innerHTML=totalAll1;
		document.getElementById("speseCart").innerHTML=speseCarta;
		document.getElementById("spese").value=spesePaccoCelere;	
		}
		
		document.getElementById('rdContr').disabled=false;
	}
}

function calcolaSpeseCelererdContr(controllo, 
							peso,
							speseSpedizioneCartaCelereU3,
							speseSpedizioneCartaCelereO3,
							speseSpedizioneContrassegnoCelereU3,
							speseSpedizioneContrassegnoCelereO3,
							totalAll,
							speseSpedizioneCarta,
							speseSpedizioneContrassegno,
							totalAllCartaU3,
							totalAllCartaO3,
							totalAllContrassegnoU3,
							totalAllContrassegnoO3) {
	
	if(document.getElementById('paccocelere').checked) {
		if(peso<=3000) {
			alert("Selezionando l'opzione \"pacco celere\" con contrassegno \n le spese di spedizione sono pari a € "+speseSpedizioneContrassegnoCelereU3+" per pacchi inferiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
			document.getElementById("totale").innerHTML=" "+totalAllContrassegnoU3;
			document.getElementById("spese").innerHTML=" "+speseSpedizioneContrassegnoCelereU3;
		}
		else {
			alert("Selezionando l'opzione \"pacco celere\" con contrassegno \n le spese di spedizione sono pari a € "+speseSpedizioneContrassegnoCelereO3+" per pacchi superiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
			document.getElementById("totale").innerHTML=" "+totalAllContrassegnoO3;
			document.getElementById("spese").innerHTML=" "+speseSpedizioneContrassegnoCelereO3;
		}
	}
	
}

function calcolaSpeseCelererdCard(controllo, 
							peso,
							speseSpedizioneCartaCelereU3,
							speseSpedizioneCartaCelereO3,
							speseSpedizioneContrassegnoCelereU3,
							speseSpedizioneContrassegnoCelereO3,
							totalAll,
							speseSpedizioneCarta,
							speseSpedizioneContrassegno,
							totalAllCartaU3,
							totalAllCartaO3,
							totalAllContrassegnoU3,
							totalAllContrassegnoO3) {
	
	if(document.getElementById('paccocelere').checked) {
		if(peso<=3000) {
			alert("Selezionando l'opzione \"pacco celere\" con carta di credito \n le spese di spedizione sono pari a € "+speseSpedizioneCartaCelereU3+" per pacchi inferiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
			document.getElementById("totale").innerHTML=" "+totalAllCartaU3;
			document.getElementById("spese").innerHTML=" "+speseSpedizioneCartaCelereU3;
		}
		else {
			alert("Selezionando l'opzione \"pacco celere\" con carta di credito \n le spese di spedizione sono pari a € "+speseSpedizioneCartaCelereO3+" per pacchi superiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
			document.getElementById("totale").innerHTML=" "+totalAllCartaO3;
			document.getElementById("spese").innerHTML=" "+speseSpedizioneCartaCelereO3;
		}
	}
	
}


function calcolaSpeseCelere(controllo, 
							peso,
							speseSpedizioneCartaCelereU3,
							speseSpedizioneCartaCelereO3,
							speseSpedizioneContrassegnoCelereU3,
							speseSpedizioneContrassegnoCelereO3,
							totalAll,
							speseSpedizioneCarta,
							speseSpedizioneContrassegno,
							totalAllCartaU3,
							totalAllCartaO3,
							totalAllContrassegnoU3,
							totalAllContrassegnoO3) {
	
	if(controllo.checked) {
		if(peso<=3000) {
			if(document.getElementById('rdCard').checked) {
				alert("Selezionando l'opzione \"pacco celere\" con carta di credito \n le spese di spedizione sono pari a € "+speseSpedizioneCartaCelereU3+" per pacchi inferiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
				document.getElementById("totale").innerHTML=" "+totalAllCartaU3;
				document.getElementById("spese").innerHTML=" "+speseSpedizioneCartaCelereU3;
			}
			else {
				alert("Selezionando l'opzione \"pacco celere\" con contrassegno \n le spese di spedizione sono pari a € "+speseSpedizioneContrassegnoCelereU3+" per pacchi inferiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
				document.getElementById("totale").innerHTML=" "+totalAllContrassegnoU3;
				document.getElementById("spese").innerHTML=" "+speseSpedizioneContrassegnoCelereU3;
			}
		} // peso<=3000
		else {
			if(document.getElementById('rdCard').checked) {
				alert("Selezionando l'opzione \"pacco celere\" con carta di credito \n le spese di spedizione sono pari a € "+speseSpedizioneCartaCelereO3+" per pacchi superiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
				document.getElementById("totale").innerHTML=" "+totalAllCartaO3;
				document.getElementById("spese").innerHTML=" "+speseSpedizioneCartaCelereO3;
			}
			else {
				alert("Selezionando l'opzione \"pacco celere\" con contrassegno \n le spese di spedizione sono pari a € "+speseSpedizioneContrassegnoCelereO3+" per pacchi superiori ai 3kg.\n E' necessario specificare il proprio recapito telefonico al fine di una corretta consegna postale.");
				document.getElementById("totale").innerHTML=" "+totalAllContrassegnoO3;
				document.getElementById("spese").innerHTML=" "+speseSpedizioneContrassegnoCelereO3;
			}
			
		} // peso>3000
		document.getElementById("telefono").innerHTML="(*) Telefono:";
		} // controllo.checked
	 else {
		 if(document.getElementById('rdCard').checked) {
			document.getElementById("totale").innerHTML=" "+totalAll;
			document.getElementById("spese").innerHTML=" "+speseSpedizioneCarta;
		}
		else {
			document.getElementById("totale").innerHTML=" "+totalAll;
			document.getElementById("spese").innerHTML=" "+speseSpedizioneContrassegno;
		}
	  document.getElementById("telefono").innerHTML="Telefono:";	
	 }
	} //end function


function verificaProvinciaEstera(controllo,speseStraniere,totalStraniero,total,speseContrassegno,totalContrassegno,tettoSpeseDiSpedizione) {
	var valore=controllo.options[controllo.selectedIndex].value;
	if(valore=="Provincia straniera") {
		document.getElementById('rdCard').checked=true;
		document.getElementById('rdContr').disabled=true;
		
		document.getElementById('celere').checked=false;
		document.getElementById("celere").disabled=true;
		document.getElementById("totale").innerHTML=totalStraniero;
		document.getElementById("speseCart").innerHTML=speseStraniere;
		document.getElementById("spese").value=speseStraniere;
		
		alert("Selezionando l'opzione estero l'unica modalità\ndi pagamento possibile è la Carta di Credito.\nLe spese di spedizione sono pari a "+speseStraniere);
	}
	else {
		
		document.getElementById('rdContr').disabled=false;
		document.getElementById('rdContr').checked=true;
		document.getElementById("celere").disabled=false;
		
		if(total>=tettoSpeseDiSpedizione) {
		document.getElementById("totale").innerHTML=total;
		document.getElementById("speseCart").innerHTML="GRATIS";
		}
		else {
		document.getElementById("totale").innerHTML=totalContrassegno;
		document.getElementById("speseCart").innerHTML=speseContrassegno;
		}
		
		
	}
}


function uploadInspiral(lista) {
	
	location.href="uploadinspiral.php?numMaxActual="+lista.value;
	
}

function popUpWindow(URLStr, width, height)
{
  if (document.all) 
      { 
      var x = window.screenLeft; 
      var y = window.screenTop; 
      var w = window.document.body.offsetWidth; 
      var h = window.document.body.offsetHeight; 
      } 
  else 
   { 
   var x = window.screenX; 
   var y = window.screenY; 
   var w = window.outerWidth; 
   var h = window.outerHeight; 
   } 
  var cntx = x + Math.round((w - width) / 2); 
  var cnty = y + Math.round((h - height) / 2); 
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+cntx+', top='+cnty+'');
}
  
  
function controllaUpload(maxImage, formUpload) {
	var num;
	num = 0;
	if(document.getElementById('imagecomodo1').checked) 
		num++;
	if(document.getElementById('imagecomodo2').checked) 
		num++;	
	if(document.getElementById('imagecomodo3').checked) 
		num++;
	if(document.getElementById('imagecomodo4').checked) 
		num++;
	if(document.getElementById('imagecomodo5').checked) 
		num++;
	if(document.getElementById('imagecomodo6').checked) 
		num++;
	if(document.getElementById('imagecomodo7').checked) 
		num++;
	if(document.getElementById('imagecomodo8').checked) 
		num++;
	if(document.getElementById('imagecomodo9').checked) 
		num++;
	if(document.getElementById('imagecomodo10').checked) 
		num++;
		
	for(i=1; i <= formUpload ; i++) {
	  if(document.getElementById('image'+i).value != "") 
		num++;
	}
	
	if(num > maxImage) {
		alert("Attenzione non è possibile selezionare un numero di immagini superiore alle scatole acquistate");
		return false;
	}
	else if(num < maxImage & document.getElementById('note').value == "") {
		alert("Attenzione è necessario specificare come applicare le "+num+" \nimmagini alle "+maxImage+" scatole acquistate attraverso il modulo Note");
		return false;
	}
	else {
		return true;
	}
}

function verifica_formCambiaDati(form)
{
  var msg="Tutti i campi segnati (*) sono obbligatori";
  if((form.nome.value=="") || (form.cognome.value=="")
       || (form.via.value=="") || (form.email.value =="") || (form.n.value =="")
	   || (form.citta.value =="") || (form.cap.value =="") || (form.provincia.value =="")
	   || (form.stato.value ==""))
  {
         alert(msg);
         return false;
  }
  
}

function verifica_formCambiaPassword(form) {
	var msg1="Tutti i campi segnati (*) sono obbligatori";
	var msg2="Errore: Password non corrispondenti";
	 if((form.oldPassword.value=="") || (form.newPassword.value=="") || (form.newPasswordConfirm.value=="")) {
		 alert(msg1);
		 return false;
	 }
	 else if(form.newPassword.value != form.newPasswordConfirm.value) {
		 alert(msg2);
		 return false;
	 }
	 else
	 	return true;
	
}
