// JavaScript Document

$(document).ready(function(){

	$("#MENU").find('TD[@TIPO=PLS]').mouseover(function(){
		$(this).attr({
			background: "Images/Sfondi/SfondoVerdeLucido.png"
		});
	});
	$("#MENU").find('TD[@TIPO=PLS]').mouseout(function(){
		$(this).attr({
			background: "Images/Sfondi/SfondoNeroLucido.gif"
		});
	});
	$("#MENU").find('TD[@TIPO=PLS]').click(function(){
		document.location = $(this).attr("LINK");
	});
	
	$("#CMD_ISCRIVITI").click(function(){
		if (document.getElementById("NW01_EMAIL").value == "") {
			alert("Inserire un indirizzo email");
			return false;
		} else {
			document.location = "IscrivitiNews.asp?NW01_EMAIL=" + document.getElementById("NW01_EMAIL").value;
		}
	});
	
	$("#PRODOTTI").find('TABLE[@TIPO=SFONDO_PROD]').mouseover(function(){
		document.getElementById($(this).attr("ID")).className = "ProdottiBorderUP";
	});
	$("#PRODOTTI").find('TABLE[@TIPO=SFONDO_PROD]').mouseout(function(){
		document.getElementById($(this).attr("ID")).className = "ProdottiBorder";
	});

	$("#CATEGORIE").find('SPAN[@TIPO=TESTO_CAT]').mouseover(function(){
		document.getElementById($(this).attr("ID")).className = "CategorieItemColorUP";
	});
	$("#CATEGORIE").find('SPAN[@TIPO=TESTO_CAT]').mouseout(function(){
		document.getElementById($(this).attr("ID")).className = "CategorieItemColor";
	});

	$("#CARRELLO").find('IMG[@TIPO=IMG_DEL]').click(function(){
		if (confirm("Eliminare questo articolo dal carrello?") == true ) {
			return true;
		} else {
			return false;
		}
	});

	$("#CMD_INVIOMODULO").click(function(){
		if (document.getElementById("MDL_EMAIL").value == "") {
			alert("Inserire un indirizzo email");
			return false;
		} else {
			return true;
		}
	});

	$("#CMD_ORDINA").click(function(){
		if (confirm("Stai per completare l\'ordine, assicurati di aver controllato bene i prodotti acquistati.\n\nVerrai rediretto nella pagina per compilare il modulo di acquisto.\n\nContinuare?") == true ) {
			document.location = "Ordine.asp"
		}
	});
	
	$("#CMD_COMPLETAORDINE").click(function(){
		if (document.getElementById("AQ04_EMAIL").value == "") {
			alert("Inserire un indirizzo email");
			return false;
		} else {											
			if (confirm("Completare l\'ordine?") == true ) {
				return true;
			} else {
				return false;
			}
		}
	});



	$.ImageBox.init(
		{
			loaderSRC: '/Framework/images/imagebox/loading.gif',
			closeHTML: '<img src="/Framework/images/imagebox/close.jpg" />'
		}
	);

});
