function setVetrina(vetrinaDefault)
{
   
	document.getElementById("vetrina1").style.display="none";
	document.getElementById("vetrina2").style.display="none";
	//document.getElementById("vetrina3").style.display="none";
	document.getElementById("vetrinadefault").style.display="none";
	if(vetrinaDefault!="")
	{
	 	document.getElementById("vetrina"+vetrinaDefault).style.display="inline";
	}
	else
	{
	 	document.getElementById("vetrinadefault").style.display="inline";
	}
}

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

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


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 setCheckBoxStatus(document,checkStatus,checkName)
{
		if(checkStatus!='' && (checkStatus=='on' || checkStatus=='1'))
        document.getElementById(checkName).checked=true;
} 
function findProd()
{
    var appnome=document.getElementById("nomefind").value;
    if(appnome!="")
    location.href="findProducts.do?nomeprod="+appnome; 
}
function viewDettaglio(idprodotto)
{
		var idsottocat=document.getElementById("idsottocat").value;
		var metallo=document.getElementById("metallo").value;
		location.href="getProdotti.do?idprodotto="+idprodotto+"&idsottocategoria="+idsottocat+"&metallo="+metallo;
}



function setValuta(valuta,euro,dollaro,sterlina)
{
   
    document.getElementById(euro).style.display="none";
    document.getElementById(dollaro).style.display="none";
    document.getElementById(sterlina).style.display="none";
     
     
   if(valuta!="")
    {
    	if(valuta=="euro")
           document.getElementById(euro).style.display="inline";
        if(valuta=="sterlina")
           document.getElementById(sterlina).style.display="inline"; 
        if(valuta=="dollaro")
           document.getElementById(dollaro).style.display="inline";      
    }    

 

}


function sendMessage()
{
	var fullname=document.getElementById("fullname").value;
	var email=document.getElementById("email").value;
	var enquiry=document.getElementById("enquiry").value;
	if(email!="" && controlloMail("email")&& fullname!="" && enquiry!="")
	{
		location.href="genericRedirect.do?pagemenu=contact&fullname="+fullname+"&enquiry="+enquiry+"&email="+email;
	}
	else
	{
		document.getElementById("datierrati").style.display="inline"; 	
	}
	
	
}


function sendMessageSpecial()
{
	var fullname=document.getElementById("fullname").value;
	var email=document.getElementById("email").value;
	var enquiry=document.getElementById("enquiry").value;
	if(email!="" && controlloMail("email")&& fullname!="" && enquiry!="")
	{
		location.href="genericRedirect.do?pagemenu=specialrequest&fullname="+fullname+"&enquiry="+enquiry+"&email="+email;
	}
	else
	{
		document.getElementById("datierrati").style.display="inline"; 	
	}
	
	
}



function findProdByName()
{
    var appnome=document.getElementById("nomefindform").value;
    if(appnome!="")
       location.href="findProducts.do?nomeprod="+appnome; 
    else
       document.getElementById("datierrati").style.display="inline";
}

function findProdByPrice()
{
    var pricefrom=document.getElementById("pricefrom").value;
    var priceto=document.getElementById("priceto").value;
    var valprice=0;
    if(parseFloat(pricefrom)<parseFloat(priceto))
       valprice=1;
    
    
    
    if(pricefrom!="" && priceto!="" && valprice>0)
    {
       location.href="findProducts.do?pricefrom="+pricefrom+"&priceto="+priceto+"&findprodprice=true"; 
    }
    else
    {
       document.getElementById("datierrati").style.display="inline";
    }
}



function muovisinistra()
{
	try
	{
		Car_Direction=false;
		if(Car_Speed>4)
		   Car_Speed=Car_Speed-1;
		C_Stp2();
		Carousel();
	}
	catch(e)
	{
	}
}

function muovidestra()
{
	try
	{
		Car_Direction=true;
		if(Car_Speed>4)
		   Car_Speed=Car_Speed-1;
		C_Stp2();
		Carousel();
	}
	catch(e)
	{}
}

function Show()
{
	/* get the mouse left position */
	x = event.clientX+document.body.scrollLeft;
	/* get the mouse top position */
	y = event.clientY+document.body.scrollTop + 10;
	/* display the pop-up */
	Popup.style.display="block";
	/* set the pop-up's left */
	Popup.style.left = x;
	/* set the pop-up's top */
	Popup.style.top = y;
}
function Hide()
{
	/* hide the pop-up */
	Popup.style.display="none";
}

function resetCampiCommento()
{
	document.getElementById("titolocommento").value="";
	document.getElementById("testocommento").value="";
	document.getElementById("codicecommento").value="";
}

function editCommento(titolocommento,testocommento,idcommento)
{
    document.getElementById("testocommento").value=testocommento;
	document.getElementById("titolocommento").value=titolocommento;
	document.getElementById("codicecommento").value=idcommento;
}

function deleteCommento(idcommento)
{
 	if(confirm(deletemess))
 	   location.href ="gestioneCommenti.do?idcommento="+idcommento+"&delete=true";
 	else 
 	   return;   
}

function LunghezzaMax(campo)
{
    document.getElementById("maxchar").value=200-campo.value.length+1;
	if (campo.value.length>200)
	{
		campo.value=campo.value.substring(0,200);
		
	}
}


/************************void app(List1,Text,Value)**************/
function app(List1,Text,Value)
{
	var i = 0;
	//Text=Text.replace(/['"']/gi,"\\'");
	var option = new Option(Value,Text);
	document.getElementById(List1).options[document.getElementById(List1).length] = option;
}
