function emailValidation(frm) {
var esito = true;
var Lang = frm.ver.value;

   var EmailAddr = frm.txtMail.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (!Filtro.test(EmailAddr))
		{
		esito = false;
		alert(Locale("Indirizzo e-mail non valido","E-mail address not valid","E-mail unzulässig",Lang));
		frm.txtMail.focus();
      }
	return esito		
}

function Locale(str1,str2,str3,lng) {
var Loc;
	switch (lng) {
		case "it": Loc = str1; break;
		case "en": Loc = str2; break;
		case "de": Loc = str3; break;
	}
	return Loc;
}

function LoginValidation(frm){
	var esito = true;
	if (frm.txtMail.value == "" || frm.txtPassword.value == "") esito = false;
	return esito;
}

function CheckValue(frm,n) {
	with (frm) {
		switch (n) {
			case 0: 
				if (txtMail.value == "e-mail" || txtMail.value == "password") txtMail.value = ""; 
				break;
			case 1: 
				if (txtMail.value == "") txtMail.value = "e-mail"; 
				break;
		}
	}
}

function InputPassword(frm,stato,p1,p2) {
	with (frm) {
		if (stato == "on") {
			document.getElementById(p1).style.display = "none";
			document.getElementById(p2).style.display = "inline";
			document.getElementById(p2).style.width = "85px";
			document.getElementById(p2).focus()
		} else {
			if (txtPassword.value == "") {
				document.getElementById(p2).style.display = "none";
				document.getElementById(p1).style.display = "inline";
				txtPassword_tmp.value = "password"
			}
		}
	}
}

function InputEmail(frm,n) {
	with (frm) {
		switch (n) {
			case 0:
				if (txtMail.value == "e-mail") txtMail.value = "";
				break;
				
			case 1:
				if (txtMail.value == "") txtMail.value = "e-mail"
				break;					
		}
	}
}

function cambiaIMG(c,path,nrec) {

	var border = "1px solid #797979";
	var no_border = "1px solid #ffffff";

	with (document) {
		switch (c) {
			case 1:
				getElementById("thumb1").style.borderTop = no_border;
				switch(nrec) {
					case 2:
						getElementById("thumb2").style.borderTop = border;
						break;
					case 3:
						getElementById("thumb2").style.borderTop = border;
						getElementById("thumb3").style.borderTop = border;
						break;
				}
				break;

			case 2:
				getElementById("thumb1").style.borderTop = border;
				switch (nrec) {
					case 2:
						getElementById("thumb2").style.borderTop = no_border;
						break;
					case 3:
						getElementById("thumb2").style.borderTop = no_border;
						getElementById("thumb3").style.borderTop = border;
						break;
				}
				break;

			case 3:
				getElementById("thumb1").style.borderTop = border;
				switch (nrec) {
					case 2:
						getElementById("thumb2").style.borderTop = border;
						break;
					case 3:
						getElementById("thumb2").style.borderTop = border;
						getElementById("thumb3").style.borderTop = no_border;
						break;
				}
				break;

		}
		images.zoom.src = path;
		
	}
}

function CambiaALT(tag) {
	with (document) {
		getElementById("zoom").style.borderBottom = "1px solid #797979";
		images.zoom.alt = tag
	}
}

function NewWindow(oggetto,w,h,scroll){
	var win2 = window.open(oggetto,"NewWindow","toolbar=no,directories=no,menubar=0,scrollbars="+scroll+",width="+w+",height="+h+",top=50,left=50")
}

function CheckNum() {
	with (document.frmCarrello) {
		var n = qta.value;
		n = Math.floor(n);
		if ((String(n*1)=="NaN")||(n=="")) {qta.value="1"} 
		else {qta.value=Math.round(n*Math.pow(10,2))/Math.pow(10,2)}
	}	
}


