//
// JavaScript Utilities
// Copyright (c) 2005 Gulliver S.r.L.
// All Rights Reserved.
//
/*
Change Cell Backgrounds -
© Shivaji Basu (www.shivbasu.com)
To add more shock to your site, visit www.DHTML Shock.com
*/

function cOn(td){
    if(document.getElementById||(document.all && !(document.getElementById))){
        td.style.backgroundColor="#EEEEEE";
    }
}

function cOut(td){
    if(document.getElementById||(document.all && !(document.getElementById))){
        td.style.backgroundColor="#FFFFFF";
    }
}

//----------------------------------------------------------------------------------------------------
//
// Funzione di preload immagini
//

function lastre_piane_in_fibrocemento() {
    MM_preloadImages('corrugated_sheets/sil_entra_1.gif',
					 'corrugated_sheets/lastre_piane.gif',
					 'corrugated_sheets/chiudi_roll.gif');
}

function lastre_piane() {
}

//----------------------------------------------------------------------------------------------------
//
// Funzioni varie
//

function referenza(img, w, h) {
	var urlImg	= "corrugated_sheets/referenze/" + img;
	var paramy	= "width=" + w + ",height=" + h;
	openBrWindow(urlImg, "", paramy);
}

function zoom(img, w, h) {
	var urlImg	= "corrugated_sheets/" + img;
	var paramy	= "width=" + w + ",height=" + h;
	openBrWindow(urlImg, "", paramy);
}

function certificatis(img, w, h) {
	var urlImg	= "corrugated_sheets/" + img;
	var paramy	= "width=" + w + ",height=" + h;
	openBrWindow(urlImg, "", paramy);
}

function ok() {
	var aziendaValue 	 = document.couponForm.azienda.value;
	var nomeValue 		 = document.couponForm.nome.value;
	var cognomeValue 	 = document.couponForm.cognome.value;
	var comuneValue 	 = document.couponForm.comune.value;
	var telefonoValue 	 = document.couponForm.telefono.value;
	var faxValue 	 	 = document.couponForm.fax.value;
	var emailValue 		 = document.couponForm.email.value;
	var testoValue 		 = document.couponForm.testo.value;
	var privacyValue 	 = getCheckedValue(document.couponForm.privacy);
    var text;
    var to;
    var from;
    var showAlert = false;
	  if (aziendaValue == '') {
	  	showAlert = true;
		document.couponForm.azienda.focus();
	  } else if (comuneValue == '') {
	  	showAlert = true;
		document.couponForm.comune.focus();
	  } else if (nomeValue == '') {
	  	showAlert = true;
		document.couponForm.nome.focus();
	  } else if (cognomeValue == '') {
	  	showAlert = true;
		document.couponForm.cognome.focus();
	  } else if (emailValue == '') {
	  	showAlert = true;
		document.couponForm.email.focus();
	  }

	  var nominativoValue = nomeValue + " " + cognomeValue;

	  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)) {
    		text =
    					"\r\n\r\n================== INFO UTENTE ==================" +
					    "\r\n Azienda:    " + aziendaValue +
    					"\r\n Nominativo: " + nominativoValue +
    					"\r\n Cittą:  	  " + comuneValue +
    					"\r\n Telfono:    " + telefonoValue +
    					"\r\n Fax:        " + faxValue +
    					"\r\n E-mail:     " + emailValue +
    					"\r\n=====================================================\r\n" +
    					"\r\n\r\n\r\n Testo:\r\n" + testoValue;
                		 document.sendMailForm.nominativo.value = nominativoValue;
                		 document.sendMailForm.servizio.value = emailValue;
                		 document.sendMailForm.to.value = "info@sil-lastre.com";
                		 document.sendMailForm.from.value = nominativoValue;
                		 document.sendMailForm.subject.value = "Richiesta informazioni";
                		 document.sendMailForm.body.value = text;
                		 document.sendMailForm.submit();
	  } else {
		alert("Hai scritto l'indirizzo di posta elettronica in modo errato.");
		document.couponForm.email.select();
		document.couponForm.email.focus();
	  }
}

function doLogon() {
  var userTextCtrlValue = document.logonForm.userTextCtrl.value;
  var passwordCtrlValue = document.logonForm.passwordCtrl.value;

  if (userTextCtrlValue == '') {
	alert("Devi specificare un nome utente ed una password per l'accesso! ");
	document.logonForm.userTextCtrl.focus();
  } else if (passwordCtrlValue == '') {
	alert("Devi specificare un nome utente ed una password per l'accesso! ");
	document.logonForm.passwordCtrl.focus();
  } else {
		//openBrWindow("dlgbox-access.htm", "SIL", "width=320,height=180");
		document.brexForm.USER.value	= userTextCtrlValue;
		document.brexForm.PWD.value		= passwordCtrlValue;
		document.brexForm.LANG.value	= "EN";
		document.brexForm.submit();
  }
}

function colorate(img) {
	var subMenu 		= document.getElementById('lastrecolorate');
	subMenu.innerHTML 	= '<img src="corrugated_sheets/' + img + '" width="350" height="130" border="0" alt="" class="lastre_piane_antifuoco"/>';
}

function certificati(pag) {
	var subMenu1 = document.getElementById('pagina');
	var subMenu2 = document.getElementById('certificato1');
	var subMenu3 = document.getElementById('certificato2');

	if (pag == "pag2") {
		subMenu1.innerHTML 	= '<a href="javascript:certificati(\'pag1\');"><b>Pag. 1</b></a>    Pag. 2    ';
		subMenu2.innerHTML 	= '<img src="corrugated_sheets/certificato_2.jpg" width="350" height="481" border="0" alt="" class="lastre_piane_antifuoco"/>';
		subMenu3.innerHTML 	= '<img src="corrugated_sheets/certificato_4.jpg" width="350" height="481" border="0" alt="" class="lastre_piane_antifuoco"/>';
	} else {
		subMenu1.innerHTML 	= 'Pag. 1    <a href="javascript:certificati(\'pag2\');"><b>Pag. 2</b></a>    ';
		subMenu2.innerHTML 	= '<img src="corrugated_sheets/certificato_1.jpg" width="350" height="481" border="0" alt="" class="lastre_piane_antifuoco"/>';
		subMenu3.innerHTML 	= '<img src="corrugated_sheets/certificato_3.jpg" width="350" height="481" border="0" alt="" class="lastre_piane_antifuoco"/>';
	}
}

function cartina(cartina) {
	var subMenu1 = document.getElementById('cartina');
	subMenu1.innerHTML 	= '<br/><img src="corrugated_sheets/' + cartina + '" width="365" height="290" border="1" alt="" class="lastre_piane_antifuoco"/>';
}

function silbonitcolor(color) {
	var subMenu1 = document.getElementById('silbonit');
	subMenu1.innerHTML 	= '<img src="corrugated_sheets/silbonit_' + color + '.jpg" width="450" height="245" border="1" alt="" class="lastre_piane_antifuoco"/>';
}

function pigmentacolor(color) {
	var subMenu1 = document.getElementById('silbonit');
	subMenu1.innerHTML 	= '<img src="corrugated_sheets/sil-pig-menta_' + color + '.jpg" width="450" height="245" border="1" alt="" class="lastre_piane_antifuoco"/>';
}

function sildecocolor(color) {
	var subMenu1 = document.getElementById('silbonit');
	subMenu1.innerHTML 	= '<img src="corrugated_sheets/sil-deco_' + color + '.jpg" width="330" height="245" border="1" alt="" class="lastre_piane_antifuoco"/>';	
}
function openSilProduct(liv1,liv2) {
    openBrWindow("http://194.196.130.67/sil_lastre/publicbridge.jsp?GB_METHOD=getCataloguePage&GB_CUSTOMIZEDFOR=SIL&GB_TYPER=SIL_CATPAGE&GB_LANG=IT&pageIndex=1&sectionCode=12387&subsection1Code=45596&subsection2Code=&subsection3Code=&subsection4Code=", "prodDlgBoxWin", "scrollbars=yes,menubar=no,width=780,height=580");
}