if ( ( typeof( NN_reloadPage ) ).toLowerCase() != 'undefined' ) { NN_reloadPage( true ); }
if ( ( typeof( opacity_init  ) ).toLowerCase() != 'undefined' ) { opacity_init(); }
if ( ( typeof( set_min_width ) ).toLowerCase() != 'undefined' ) { set_min_width( 'pageWrapper' , 600 , true ); }

$(document).ready(function() {
	banner1();

	$("#header-menu li a").click(function () {
	$("#header-menu li a").removeClass("corrente");
  		$(this).addClass("corrente");
	});
  
	$(".thumbs img").mouseover(function () {
		$("#anteprima").attr({src:$(this).attr("src")});
	});
	/*
	$("#vetrina img.thumbs").click(function () { //fix IE click link image
		window.location=$(this).parent().parent().parent().attr("href");
	});
	$("#catalogo img.thumbs").click(function () { //fix IE click link image
		window.location=$(this).parent().parent().parent().attr("href");
	});
	*/
	$("#hor-zebra tr:even").addClass("even");
	$("#hor-zebra tr:odd").addClass("odd"); 
		
});

function show_submenu(divname){
	$("#" + divname).toggle();
	//alert(divname);
}
function updateCart(formname,max,orig){
	
	alert(q+"-"+max + "--" + orig);
	
	if(orig==q) {
		alert("Non hai modificato la quantita'!");
		return false;
	}
	else if(q<max ){
		alert(q+"-"+max);
		this.submit();
		return true;
	}
	else {
		alert("Non e' disponibile la quantita' richiesta");
		return false;
	}
}
function inscoupon(baseurl){
	var cod_coupon = "";
	cod_coupon = prompt("Inserisci il coupon");
	if (cod_coupon) {
		$("#cod_coupon").val(cod_coupon);
		if (cod_coupon != "") {
			$("#res_coupon").load(baseurl + "?cosa=coupon2&t=" + document.ordine.totale.value + "&coupon=" + cod_coupon, "", function(responseText, textStatus, XMLHttpRequest){
				var val_coupon = parseInt($("#coupon").val());
				if (val_coupon > 0) {
					$("#totale-ordine").html(document.ordine.totale.value - val_coupon + parseFloat($("#spedizione").val()) + " &euro;");
					calcola_totale();
				}
				else 
					//if (val_coupon == -1) {
						//alert("spedizione vale " + parseFloat($("#spedizione").val()) + " mentre tutto risulta " + document.ordine.totale.value + parseFloat($("#spedizione").val()) + " &euro;");
						$("#totale-ordine").html(parseFloat(document.ordine.totale.value) + parseFloat($("#spedizione").val()) + " &euro;");
						calcola_totale();
					//}
					
			});
		}
	}
	
}