function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function cecco(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop,sfondo,blocca,bottone,scrBott) {  // v4.01
imageHeight2 = +imageHeight+ + 30	
if (posLeft.indexOf("ww") != -1) {posLeft = (screen.width - imageWidth)/2;}
if (posTop.indexOf("hh") != -1) {posTop = (screen.height - imageHeight2)/2;}
if (blocca.indexOf("si") != -1) {blocca = 'onBlur="focus()'}
if (bottone.indexOf("si") != -1) {bottone = '<input type="submit" name="submit" value="'+scrBott+'" onClick="self.close()">'} else {bottone= ''; imageHeight2 = imageHeight}
newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight2+",scrollbars=no,left="+posLeft+",top="+posTop);	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="'+sfondo+'" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" '+blocca+'"><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="top" height="1">');
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">');
	newWindow.document.write('</td></tr><tr><form name="form1111" method="post" action=""><td align="center" valign="middle">'+bottone+'</td></form></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}


	function invia() {
		conf=Convalida();
		if (conf==true) {
			document.registra.submit();
		}
	}

	function Convalida() {
	
		if (document.registra.nome.value.length < 2) {
			alert ("ATTENZIONE: inserire un Nome!");
			document.registra.nome.focus();
			return false;
		}


		if (document.registra.telefono.value.length < 5) {
			alert ("ATTENZIONE: inserire un numero di telefono valido!");
			document.registra.telefono.focus();
			return false;
		}

		
		if (document.registra.email.value.length < 3) {
			alert ("ATTENZIONE: inserire un E-Mail valida!");
			document.registra.email.focus();
			return false;
		}
		
		var okay = true;
		var atsign = document.registra.email.value;
		if (((atsign.indexOf('@') == -1) && (okay == true)) || ((okay == true) && (atsign == '')) || ((atsign.indexOf('.') == -1) && (okay == true)) ){
			alert ("ATTENZIONE: Specificare una E-mail valida!");
			okay = false;
			document.registra.email.focus();
			return false;
		}

		if (document.registra.privacy.checked!=true) {
			alert ("Per proseguire devi accettare l'informativa sulla Privacy");
			return false;
		}


		
		return true;
	}
	
function AccettaNumeri() 
{
		if (event.keyCode < 48 || event.keyCode > 57) 
		{
			event.keyCode = 0;
		}
		return true ;
}



function aumentaq(quantita,idprod){

	quantita=parseInt(quantita)+1
	document.carrello.quantita.value=quantita
	document.carrello.idprod.value=idprod
	document.carrello.action="carrello.asp?modo=aggiornaprod"
	document.carrello.submit()

}

function diminuisciq(quantita,idprod){

	quantita=parseInt(quantita)-1
	document.carrello.quantita.value=quantita
	document.carrello.idprod.value=idprod
	document.carrello.action="carrello.asp?modo=aggiornaprod"
	document.carrello.submit()

}



/* parte dedicata al codice AJAX PER UN CARICAMENTO NORMALE*/

function Richiesta(pagina,responsediv){

 
	 url  = pagina +"&rand="+escape(Math.random())
	 var xmlHttpReq = false;
    var self = this;
    // Xhr per Mozilla/Safari/Ie7
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // per tutte le altre versioni di IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			// Quando pronta, visualizzo la risposta del form
            updatepage1(self.xmlHttpReq.responseText,responsediv);
        }
		else{
			// In attesa della risposta del form visualizzo il msg di attesa
			updatepage1('<img src="images/preload4.gif">',responsediv);

		}
    }
     self.xmlHttpReq.open('GET', url, true);
    self.xmlHttpReq.send(null);
}


function updatepage1(str,responsediv){
    document.getElementById(responsediv).innerHTML = str;
}
/* FINE parte dedicata al codice AJAX PER UN CARICAMENTO NORMALE*/


function Chiudidiv(nomediv){

	updatepage1('',nomediv);
}
