var sin1 = "info";
var sin2 = "ordini";
var sin3 = "admin";
var des = "e-pen";
var este = ".it";

function link_posta1() {
	document.write("<a href=\"mailto");
	document.write(":"+ sin1 + "@");
	document.write(des + este + "\"><img src=\"immagini/emailh.jpg\" border=\"0\"><\/a>");
}

function link_posta2() {
	document.write("<a href=\"mailto");
	document.write(":"+ sin2 + "@");
	document.write(des + este +  "\">" + sin2 + "@" + des + este + "<\/a>");
}


function link_posta3() {
	document.write("<a href=\"mailto");
	document.write(":"+ sin3 + "@");
	document.write(des + este +  "\">" + sin3 + "@" + des + este + "<\/a>");
}

function PopImage(imageName, pop_wdt, pop_hgt) { 
  if (document.all) {
    var x = window.screenLeft;
    var y = window.screenTop;
    var w = window.document.body.offsetWidth;
    var h = window.document.body.offsetHeight;
  }else{
    var x = window.screenX;
    var y = window.screenY;
    var w = window.outerWidth;
    var h = window.outerHeight;
  }
    var pop_wdt2 = 0;
    var pop_hgt2 = 0;
    var pop_offset_x = 2*35;
    var pop_offset_y = 2*40;
    var pop_wdt2 = pop_wdt + pop_offset_x;
    var pop_hgt2 = pop_hgt + pop_offset_y;
    var cntx = x + Math.round((w - pop_wdt2) / 2);
    var cnty = y + Math.round((h - pop_hgt2) / 2);
    myWindow = window.open('','portfolio','left='+ cntx +',screenX='+ cntx +',top='+ cnty +',screenY='+ cnty +',width=' + pop_wdt2 +',height=' + pop_hgt2 +',toolbar=0, location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0'); 
    myWindow.document.write("<HTML><HEAD><title>e-pen.it</title><\/HEAD>");
	myWindow.document.write("<link rel='stylesheet' href='style2.css' type='text/css'>");
    myWindow.document.write("<BODY bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
    myWindow.document.write("<table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0'><tr>");
    myWindow.document.write("<td align='center' valign='middle'>");
    myWindow.document.write("<a href='javascript:;' onClick='window.close()'><IMG SRC='" + imageName + "' + border='0' alt='Click screen to close'></a>");
    myWindow.document.write("<div class='testonero'>Alcuni esempi di personalizzazione</div>");
    myWindow.document.write("</td></tr></table>");
    myWindow.document.write("<\/BODY><\/HTML>");
    myWindow.window.resizeTo(pop_wdt2, pop_hgt2);
    myWindow.document.close();
    myWindow.focus();
} 
//<a href="javascript:PopupImage('mass_cantone/galleria.jpg',450,337)">

function testform() {
messaggio = "Ci sono particolari che non hai selezionato";
if(document.itemsform.extendedoption_1_1!=undefined && document.itemsform.extendedoption_1_1.value == "vuoto"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_2_1!=undefined && document.itemsform.extendedoption_2_1.value == "vuoto"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_3_1!=undefined && document.itemsform.extendedoption_3_1.value == "vuoto"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_4_1!=undefined && document.itemsform.extendedoption_4_1.value == "vuoto"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_5_1!=undefined && document.itemsform.extendedoption_5_1.value == "vuoto"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_6_1!=undefined && document.itemsform.extendedoption_6_1.value == "vuoto"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_7_1!=undefined && document.itemsform.extendedoption_7_1.value == "0"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_8_1!=undefined && document.itemsform.extendedoption_8_1.value == "0"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_9_1!=undefined && document.itemsform.extendedoption_9_1.value == "0"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_10_1!=undefined && document.itemsform.extendedoption_10_1.value == "0"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_11_1!=undefined && document.itemsform.extendedoption_11_1.value == "0"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_12_1!=undefined && document.itemsform.extendedoption_12_1.value == "0"){
    alert(messaggio);
    return false;
    }
if(document.itemsform.extendedoption_13_1!=undefined && document.itemsform.extendedoption_13_1.value == "0"){
    alert(messaggio);
    return false;
    }

}

function changephoto(){
	if (!document.images)
		return
		document.images.intro.src=document.itemsform.extendedoption_4_1.options[document.itemsform.extendedoption_4_1.selectedIndex].value;
}

 function testNewsletter() {
	if(document.newsletter.cognome.value == ""){
		alert("Il cognome é obbligatorio");
		document.newsletter.cognome.focus();
		return false;
		}
	if(document.newsletter.nome.value == ""){
		alert("Il nome é obbligatoria");
		document.newsletter.nome.focus();
		return false;
		}
	 if(document.newsletter.email.value == ""){
		alert("L'e-mail é obbligatoria");
		document.newsletter.email.focus();		
		return false;
		}
	 if(document.newsletter.datip.checked == false){
		alert("E' necessario spuntare la voce acconsento al trattamento dei dati");
		return false;
		}
  }


 function testSearch() {
	 if(document.motRicerca.extendedoption_1_A.value=="vuoto" && document.motRicerca.extendedoption_1_T.value=="vuoto" && document.motRicerca.extendedoption_1_P.value=="vuoto"){
		alert("Seleziona almeno una voce");
		return false;
		}

  }

function PopDimensioni(imageName, pop_wdt, pop_hgt) { 
  if (document.all) {
    var x = window.screenLeft;
    var y = window.screenTop;
    var w = window.document.body.offsetWidth;
    var h = window.document.body.offsetHeight;
  }else{
    var x = window.screenX;
    var y = window.screenY;
    var w = window.outerWidth;
    var h = window.outerHeight;
  }
    var pop_wdt2 = 0;
    var pop_hgt2 = 0;
    var pop_offset_x = 2*0;
    var pop_offset_y = 2*15;
    var pop_wdt2 = pop_wdt + pop_offset_x;
    var pop_hgt2 = pop_hgt + pop_offset_y;
    var cntx = x + Math.round((w - pop_wdt2) / 2);
    var cnty = y + Math.round((h - pop_hgt2) / 2);
    myWindow = window.open('','portfolio','left='+ cntx +',screenX='+ cntx +',top='+ cnty +',screenY='+ cnty +',width=' + pop_wdt2 +',height=' + pop_hgt2 +',toolbar=0, location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0'); 
    myWindow.document.write("<HTML><HEAD><title>e-pen.it</title><\/HEAD>");
	myWindow.document.write("<link rel='stylesheet' href='style2.css' type='text/css'>");
    myWindow.document.write("<BODY bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
    myWindow.document.write("<table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0'><tr>");
    myWindow.document.write("<td align='center' valign='middle'>");
    myWindow.document.write("<a href='javascript:;' onClick='window.close()'><IMG SRC='" + imageName + "' + border='0' alt='Click screen to close'></a>");
    myWindow.document.write("</td></tr></table>");
    myWindow.document.write("<\/BODY><\/HTML>");
    myWindow.window.resizeTo(pop_wdt2, pop_hgt2);
    myWindow.document.close();
    myWindow.focus();
} 
//<a href="javascript:PopupImage('mass_cantone/galleria.jpg',450,337)">

function changeImage(PhotoPosition,NamePhoto){
	var photo = new Image(95,55)
	photo.src = NamePhoto ;
	eval("document."+PhotoPosition).src=photo.src;
}
//onMouseOver="changeImage('nome.gif')" onMouseOut="changeImage('nome.gif')"

/*nasconde il layer offerta del giorno*/
function HideOfferta(){
	document.getElementById("offertaDay").style.display="none";
}

function Logout(){
	document.cookie="eDenter_user=;expires=Thu, 1 Jan 1970 00:00:00 UTC";
	document.cookie="eDenter_sign=;expires=Thu, 1 Jan 1970 00:00:00 UTC";
	document.cookie="eDenter_list=;expires=Thu, 1 Jan 1970 00:00:00 UTC";
	self.location="logout.php";
}

function testFeedback(mag){
var msg1 = "Non hai selezionato la risposta alla domanda nr. ";			
var elemento="";
	for (var i=1; i<=mag; i++){
		elemento = document.feedback.elements["dom"+i];
		if ((!elemento[0].checked) && (!elemento[1].checked) && (!elemento[2].checked) && (!elemento[3].checked) && (!elemento[4].checked)){
			alert(msg1 +i);
			elemento[0].focus();
			document.getElementById("txtdom"+i).style.color="#FFFFFF";
			document.getElementById("txtdom"+i).style.background="#FF0000";
		return false;
		} 
	}

	if(document.feedback.titolo.value == ""){
		alert("Ci sono campi che non hai selezionato");
		document.feedback.titolo.focus();
		return false;
	}
}

function disPersAntalis(){
 	var contatore = 5;
	for(i=1; i<=contatore; i++){
		//document.getElementById('op1'+i).disabled = true;
		eval('document.itemsform.op1'+ i).disabled = true;
		
	} 
}

function PersAntalis(id){
	//var thequantity = document.getElementById('qt'+id).value;
	var thequantity = eval('document.itemsform.qt'+ id).value;
	if (thequantity >= 100) {
		//document.getElementById('op1'+id).disabled = false;
		eval('document.itemsform.op1'+ id).disabled = false;
	} else {
		//document.getElementById('op1'+id).disabled = true;
		eval('document.itemsform.op1'+ id).disabled = true;
	} 
}

function logout() {
	if(document.getElementById("commento").value == ""){
		alert("Campo obbligatorio");
		document.getElementById("commento").focus();
		return false;
	}
	
	if(document.getElementById("email").value == ""){
		alert("L'e-mail é obbligatoria");
		document.getElementById("email").focus();
		return false;
	}
}

function testInfoProdotto() {
	if(document.richiestaInfo.cognome.value == ""){
		alert("Il cognome é obbligatorio");
		document.richiestaInfo.cognome.focus();
		return false;
	}
	if(document.richiestaInfo.nome.value == ""){
		alert("Il nome é obbligatoria");
		document.richiestaInfo.nome.focus();
		return false;
	}
	if(document.richiestaInfo.telefono.value == ""){
		alert("Il telefono é obbligatorio");
		document.richiestaInfo.telefono.focus();		
		return false;
	}
	if(document.richiestaInfo.email.value == ""){
		alert("L'e-mail é obbligatoria");
		document.richiestaInfo.email.focus();		
		return false;
	}
	if(document.richiestaInfo.datip.checked == false){
		alert("E' necessario spuntare la voce acconsento al trattamento dei dati");
		return false;
	}
	
	
}

function RiContatto() {
	if(document.RicContatto.nome.value == ""){
		alert("Il nome é obbligatoria");
		document.RicContatto.nome.focus();
		return false;
	}

	if(document.RicContatto.cognome.value == ""){
		alert("Il cognome é obbligatorio");
		document.RicContatto.cognome.focus();
		return false;
	}

	if(document.RicContatto.telefono.value == ""){
		alert("Il telefono é obbligatorio");
		document.RicContatto.telefono.focus();		
		return false;
	}

	/*if(document.RicContatto.email.value == ""){
		alert("L'e-mail é obbligatoria");
		document.RicContatto.email.focus();
		return false;
	}else{
		var filter =/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var mail = document.RicContatto.email;
		if(!filter.test(mail.value)){
			alert("E' necessario inserire un indirizzo email valido");
			document.RicContatto.email.focus();
			return false;
		}
	}*/
	
}

