var lastPuls="";
var prevClass="";
var lastTimeout="";
function goTo(location){
		window.location = location;
}
//Metodo di rimpiazzo entità con lettere accentate
/*
function htmlEntityReplace(stringa){
	stringa = stringa.replace(/&agrave;/,"à");
	stringa = stringa.replace(/&egrave;/,"è");
	stringa = stringa.replace(/&eacute;/,"é");
	stringa = stringa.replace(/&igrave;/,"ì");
	stringa = stringa.replace(/&ograve;/,"ò");
	stringa = stringa.replace(/&ugrave;/,"ù");
	return stringa;
}
*/
/*
function stampaPdf(link_pdf){
	var finestraPopup = window.open("stampa_pdf.php?link_pdf="+link_pdf,'Stampa Pdf','width=800,height=600,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=yes');
	finestraPopup.focus();
}
*/
//Salvataggio errori in ajax
//Invio della richiesta
function salvaErrore(parametri) {
	alert(parametri);
	req.open('get', 'ajax_error.php?tipo=salvaerrore&' + parametri);
//	req.onreadystatechange = function(){};
	req.send(null);
}
//Metodi per lampeggio pulsanti premuti
/*
function slampa(pulsante){
	if (lastPuls!=""){
		//lastPuls.className = "buttonTast";
		lastPuls.className = prevClass;
		clearTimeout(lastTimeout);
	}
	prevClass = pulsante.className;
	pulsante.className = "premuto";
	lastPuls = pulsante;
	//lastTimeout = setTimeout("lastPuls.className='buttonTast'", 300);//millisecondi
	lastTimeout = setTimeout("lastPuls.className=prevClass", 300);//millisecondi
}
*/
//
function preparaCampo(campo){
	if (campo.id=="emailh" && campo.value=="email")
		document.getElementById("emailh").value = "";
	else if (campo.id=="passwordh" && campo.value=="password")
		document.getElementById("passwordh").value = "";
	else if (campo.id=="cerca_t" && campo.value=="Cerca prodotto")
		document.getElementById("cerca_t").value = "";
}
function pulisciCampo(campo){
	if (campo.id=="emailh" && campo.value=="")
		document.getElementById("emailh").value = "email";
	else if (campo.id=="passwordh" && campo.value=="")
		document.getElementById("passwordh").value = "password";
	else if (campo.id=="cerca_t" && campo.value=="")
		document.getElementById("cerca_t").value = "Cerca prodotto";
}
function checkformmarche(form){
	if (form.id_marca.value==0){
		alert("Non è stato selezionato alcun marchio!");
		return false;
	}
}
function checkformricerca(form){
	if (form.cerca_t.value=="" || form.cerca_t.value=="Cerca prodotto"){
		alert("Inserire un termine di ricerca!");
		return false;
	}
}
