function recuperaPassword ()
{
	var emailrecupero=document.getElementById("emailrecupero").value;
	location.href ="loginUtente.do?emailrecupero="+emailrecupero;
}



function dettaglioProdotti(idsottocategoria)
{
	location.href ="getProdotti.do?idsottocategoria="+idsottocategoria;
}

function getColoriProdottoByMisura(idsottocategoria)
{
	var indice=document.getElementById("misurabracciale").options.selectedIndex;
	var misura=document.getElementById("misurabracciale").options[indice].value;
	
	location.href ="getProdotti.do?idsottocategoria="+idsottocategoria+"&idmisura="+misura;
}

function getProdottoSelect(idsottocategoria)
{
	
	var indice2=document.getElementById("colorebracciale").options.selectedIndex;
	var colorebracciale=document.getElementById("colorebracciale").options[indice2].value;
	
	if(idsottocategoria!=6 && idsottocategoria!=7 && idsottocategoria!=8)
	{
		var indice=document.getElementById("misurabracciale").options.selectedIndex;
		var misura=document.getElementById("misurabracciale").options[indice].value;
		location.href ="getProdotti.do?idsottocategoria="+idsottocategoria+"&idmisura="+misura+"&idprodotto="+colorebracciale;
	}
	else
	{
		location.href ="getProdotti.do?idsottocategoria="+idsottocategoria+"&idprodotto="+colorebracciale;
	}
			
}


function getProdotto(idsottocategoria,idprodotto)
{
	
	if(idsottocategoria!=6 && idsottocategoria!=7 && idsottocategoria!=8)
	{
		var indice=document.getElementById("misurabracciale").options.selectedIndex;
		var misura=document.getElementById("misurabracciale").options[indice].value;
		location.href ="getProdotti.do?idsottocategoria="+idsottocategoria+"&idmisura="+misura+"&idprodotto="+idprodotto;
	}
	else
	{
		location.href ="getProdotti.do?idsottocategoria="+idsottocategoria+"&idprodotto="+idprodotto;
	}
}

function inviaRichiesta()
{
	var nomecompleto=document.getElementById("nome-completo").value;
	var indirizzoemail=document.getElementById("indirizzo-email").value;
	var richiestacontatti=document.getElementById("richiesta-contatti").value;
	
	
	if(controlloMail2(indirizzoemail) && nomecompleto!="" && richiestacontatti!="")
	{
		document.contattiform.submit();
	}
	else
	{
		alert("Indicare tutti i dati in maniera corretta")
		return;
	}
	
}


function redCheckOut()
{
	location.href ="checkOut.do";
}


function getOrderItems(idordine)
{
	location.href ="getOrdiniUtente.do?idordine="+idordine;
}


function getProdottiByMisura(idsottocategoria)
{
	var indice=document.getElementById("misure").options.selectedIndex;
	var misura=document.getElementById("misure").options[indice].value;
	location.href ="getProdotti.do?idsottocategoria="+idsottocategoria+"&misura="+misura;
}

function settaCampoForm(campo,valore)
{
    if(valore!="")
	   document.getElementById(campo).value=valore;
   
	
}

function settaComboValue(campo,valore)
{
	if(valore!="")
	   document.getElementById(campo).options.value=valore;
}

function setComboValue(document,comboName,param)
{
	if(param!='')
	{
		var comboLength = document.getElementById(comboName).length;
		for(var i = 0; i < comboLength; i++) 
		{
			if(document.getElementById(comboName).options[i].value==param) 
						document.getElementById(comboName).options.selectedIndex=i;
			
		}
	}
}



function addCart(paginacorrente)
{
        var quantitaprod=document.getElementById("quantitaprod").value;
     	var codice=document.getElementById("idprodotto").value; 
     	var indice=document.getElementById("misurabracciale").options.selectedIndex;
    	var misura=document.getElementById("misurabracciale").options[indice].value;
    	var url="setCart.do?paginacorr="+paginacorrente+"&addcart=true&idprodotto="+codice+"&quantitaprod="+quantitaprod+"&misura="+misura;
    	location.href=url;
}

function addCart2(paginacorrente)
{
        var quantitaprod=document.getElementById("quantitaprod").value;
     	var codice=document.getElementById("idprodotto").value; 
     	var url="setCart.do?paginacorr="+paginacorrente+"&addcart=true&idprodotto="+codice+"&quantitaprod="+quantitaprod;
    	location.href=url;
}





function visualizzaDettagli(idprodotto)
{
        var url="getProdotti.do?idprodotto="+idprodotto;
    	location.href=url;
   
}





function aggiornaQuant(paginacorrente,idprodotto)
{
    var quantitaprod=document.getElementById("quantitaprod"+idprodotto).value;
    var url="setCart.do?paginacorr="+paginacorrente+"&aggiornaQuant=true&idprodotto="+idprodotto+"&quantitaprod="+quantitaprod;
    location.href=url;
}

function deleteformCart(paginacorrente,idprodotto)
{
    var url="setCart.do?paginacorr="+paginacorrente+"&deleteformCart=true&idprodotto="+idprodotto;
    location.href=url;
}



/******************controlloCampo(campo,msg)******************************/
function controlloCampo(campo)
{
   if(document.getElementById(campo).value=='')
	{
		return false;	
    }
 return true;
 }
 
 
 /******************controlloMail(campo)******************************/
function controlloMail(campo)
{
  var valCampo=document.getElementById(campo).value;
  if(valCampo != "")
  {
		if(valCampo.indexOf("@") == -1)
		{
			if(valCampo.indexOf(".") == -1)
			{
            	alert("Inserire correttamente l'indirizzo e-mail");
                document.getElementById(campo).value = "";
                document.getElementById(campo).focus();
                return false;
            }
        }
   } 
return true;
}


function controlloMail2(valCampo)
{
  if(valCampo != "")
  {
		if(valCampo.indexOf("@") == -1)
		{
			if(valCampo.indexOf(".") == -1)
			{
            	return false;
            }
        }
   } 
return true;
}

/*****************void checkNumImporti()*******************************/
function checkNumImporti()
{

	var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1); // se browser è ie 
	if(ie) 
	{
    		key = event.keyCode; 
  	} 
	else key = e.which;
  	  
  	
	if((event.ctrlKey && key==86) || key==188 || key == 110 || key == 37 || key== 39 || key==9) return true;
  		
  		  		
  	if((key < 48 || key > 58) && (key != 8 && key != 13 && key != 46 )) 
   	{
        	if(key < 96 || key > 105)		
        	return false;                	
        }
  		
	return true;
}


/*****************void checkNumData()*******************************/
function checkNumData()
{

	var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1); // se browser è ie 
	if(ie) 
	{
    		key = event.keyCode; 
  	} 
	else key = e.which;
  	  
  	
	if((event.ctrlKey && key==86) || key==16 || key == 37 || key== 39 || key==9) return true;
  		
  		  		
  	if((key < 48 || key > 58) && (key != 8 && key != 13 && key != 46 )) 
   	{
        	if(key < 96 || key > 105)		
        	return false;                	
        }
  		
	return true;
}

