//
// JavaScript Utilities
// Copyright (c) 2003 Gulliver S.r.L.
// All Rights Reserved.
//
//----------------------------------------------------------------------------------------------------

function stile_evos() {
	document.location.href = "stile_evos_PE_2010.htm";
}

function immagini(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos_PE_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}

function immaginiPE2007(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos/pe_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}

function immaginiPE2008(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos_pe_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}

function immaginiAI2009(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos_pe_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}

function immaginiAI2010(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos_PE_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}

function immaginiPE2009(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos_PE_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}


function immaginiAI2008(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="stile_evos_PE_2010/' + img + '" width="350" height="350" alt="" border="1"/>';
}

function newsPag(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="news/' + img + '" width="490" height="490" alt="" border="1"/>';
}

function eventiPag(img) {
	var subMenu1 = document.getElementById('evosBig');
	subMenu1.innerHTML = '<img src="eventi/' + img + '" alt="" border="1"/>';
}

function successivePE2007() {
	var subMenu1 = document.getElementById('imgpre');
	subMenu1.innerHTML = '<a href="stile_evos.htm">&laquo; precedenti</a>';
	var subMenu2 = document.getElementById('imgsuc');
	subMenu2.innerHTML = '';

	var subMenu3 = document.getElementById('evosBig');
	subMenu3.innerHTML = '<img src="stile_evos/pe_2010/sito16.jpg" width="350" height="350" alt="" border="1"/>';

	for (i=16;i<29;i++) {
		var elem = 'img' + (i - 15);
		var subMenu4 = document.getElementById(elem);
		var imgE = "sito" + i + ".jpg";
		subMenu4.innerHTML = '<a href="javascript:immaginiPE2010(\'' + imgE + '\');"><img src="stile_evos/pe_2010/t/t_' + imgE + '" width="80" height="80" alt="" border="1"/></a>';
	}
		for (i=29;i<31;i++) {
		var elem = 'img' + (i - 15);
		var subMenu4 = document.getElementById(elem);
		subMenu4.innerHTML = '';
	}
}

function ok() {
	var nomeValue 	    = document.couponForm.nome.value;
	var cognomeValue    = document.couponForm.cognome.value;
    var cityValue       = document.couponForm.city.value;
	var telefonoValue   = document.couponForm.telefono.value;
	var emailValue 		= document.couponForm.email.value;
	var testoValue 		= document.couponForm.testo.value;
	var privacyValue 	= getCheckedValue(document.couponForm.privacy);
    var emailck 	    = getCheckedValue(document.couponForm.emailck);
    var smsck           = getCheckedValue(document.couponForm.smsck);
	var body;
	var to;
	var from;
	var showAlert = false;
	  if (nomeValue == '') {
		showAlert = true;
		document.couponForm.nome.focus();
	  } else if (cognomeValue == '') {
		showAlert = true;
		document.couponForm.cognome.focus();
      } else if (cityValue == '') {
    	showAlert = true;
    	document.couponForm.city.focus();
      } else if (telefonoValue == '') {
		showAlert = true;
		document.couponForm.telefono.focus();
	  } else if (emailValue == '') {
		showAlert = true;
		document.couponForm.email.focus();
	  } else if (testoValue == '') {
		showAlert = true;
		document.couponForm.testo.focus();
	  }

	  if (showAlert) {
		alert("Hai omesso uno o pił campi obbligatori. ");
	  } else if (privacyValue != 'si') {
		alert("Devi autorizzare il trattamento dei dati personali. ");
	  } else if (isValidEmailAddrs(emailValue)) {
	  to = "JLD"
	  //to = "Prova";
		from = nomeValue + " " + cognomeValue;
			body =
					"\r\n\r\n================== INFO UTENTE ==================" +
					"\r\n Nome:       " + nomeValue +
					"\r\n Cognome:    " + cognomeValue +
                    "\r\n Cittą:      " + cityValue +
					"\r\n Telfono:    " + telefonoValue +
					"\r\n E-mail:     " + emailValue +
                    "\r\n Mailing:    " + emailck +
                    "\r\n Sms:        " + smsck +
					"\r\n=====================================================\r\n" +
					"\r\n\r\n\r\n Testo:\r\n" + testoValue;
					//showSendMailDlgBox(to, from, "Corani & partners - Contatto da web", body, emailValue);
			document.sendMailForm.nome.value 		= nomeValue;
			document.sendMailForm.cognome.value 	= cognomeValue;
			document.sendMailForm.telefono.value 	= telefonoValue;
			document.sendMailForm.email.value 		= emailValue;
			document.sendMailForm.testo.value 		= testoValue;
            document.sendMailForm.emailck.value 	= emailck;
            document.sendMailForm.smsck.value 		= smsck;
            document.sendMailForm.city.value 		= cityValue;
			document.sendMailForm.submit();
	  } else {
		alert("Hai scritto l'indirizzo di posta elettronica in modo errato.");
		document.couponForm.email.select();
		document.couponForm.email.focus();
	  }
}
