/***************************************
*usata in scheda_prodotto.asp e tree.asp
***************************************/
function sendMeInfo(cod){
	var email = isNull(document.forms["FORMCart"].preventivo_mail.value, "");
	
	if( (email.length > 0) && checkemail(email) ){
		document.forms["FORMCart"].sendmail.value = "SEND";
		document.forms["FORMCart"].action = "/search/scheda_prodotto.asp?cod="+cod;
		document.forms["FORMCart"].submit();
	}	else	{
		alert("Inserire una email valida.");
	}
}


function checkemail(email){
	var testresults;
	var str=email;
	var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)){
		testresults=true
	}	else	{
		testresults=false
	}
	
	return (testresults)
}

function login(){
	document.LOGINForm.submit();
}

function login2(){
	window.opener.LOGINForm.Login.value = document.POPLOGINForm.Login.value;
	window.opener.LOGINForm.Password.value = document.POPLOGINForm.Password.value;
	window.opener.LOGINForm.submit();
	window.close();
}

function login3(){
	if( (document.POPLOGINForm.Login.value != "") && (document.POPLOGINForm.Password.value != "") ){
		document.POPLOGINForm.submit();
	}	else	{
		alert("ATTENZIONE!\nInserire Email e Password");
	}
}
									
function registrati(){
	window.location.replace("/search/registrazione.asp");
}

function popRegistrati(){
	window.top.window.opener.location.replace("/search/registrazione.asp");
}

function logout(){
	document.LOGOUTForm.submit();
}

function changeMercato(){
	window.location.replace(document.SPForm.mercati.options[document.SPForm.mercati.selectedIndex].value);
}

//ONLOAD
function alertERROR(LOGINERROR){
	if(LOGINERROR != ""){
		alert("EMAIL o PASSWORD errati!");
	}
}

function level2(){
	alert("ATTENZIONE!\nOccorre registrarsi come utenti di LIVELLO 2");
}

function newsletterRegistrati(){
	document.mainForm.submit();
}