var varAlert;
/* --------- document ready ---------- */

$(document).ready(function() {
	
		/* slideshow */
	$("#banner_home").slideShow();
	$("#banner_azienda1").slideShow();
	$("#banner_azienda2").slideShow({delay:2000});
	$("#banner").slideShow();
	

 
/* -- */

	$(function () {
        $(".elemento").hover(
		function()
		{
			$(this).find("span").css("text-decoration","underline").css("color","black").css("background-image","url(../media/comuni/freccia-on.png)");
			$(this).find("img").animate({opacity: 0.7}, 500, function() {});
		},
		function()
		{
			$(this).find("span").css("text-decoration","none").css("color","#674c37").css("background-image","url(../media/comuni/freccia.png)");
			$(this).find("img").animate({opacity: 1}, 500, function() {});
		});
		
		$(".finitura").hover(
		function()
		{
			$(this).find("span").css("text-decoration","underline").css("color","black");
			$(this).find("img").animate({opacity: 0.7}, 500, function() {});
		},
		function()
		{
			$(this).find("span").css("text-decoration","none").css("color","#674c37");
			$(this).find("img").animate({opacity: 1}, 500, function() {});
		});			
	});
	
	$(function () {
        $("#finiture tr:even").addClass("grey");
        $("#finiture tr:gt(1)").find("td:first").addClass("essenza");
        $("#finiture tr:eq(1)").find("td:gt(0)").addClass("finitura");	
	});
	
	$(function() {
        $('#abaco a').lightBox();
    });
		
	$(document).bind("contextmenu",function(e){
		alert(varAlert);
		return false;
	});

	$(function () {
        $('a.lnk_download').each(function () {
			var ico = $(this).attr('href').split('.').pop().toLowerCase();
			switch(ico) {
		        //if .jpg/.gif/.png do something
		        case 'jpg': case 'gif': case 'png':
		            $('<img src="/media/dbs/grafica/icone/jpg.gif" border="0"/>').appendTo(this);
		        break;
		        //if .zip/.rar do something else
		        case 'zip': case 'rar':
		            $('<img src="/media/dbs/grafica/icone/odt.gif" border="0"/>').appendTo(this);
		        break;
		
		        //if .pdf do something else
		        case 'pdf':
		            $('<img src="/media/dbs/grafica/icone/pdf.gif" border="0"/>').appendTo(this);
	            break;
    		}
		});	
	});
	
 });  
 
 
    /* -- gallery prodotti -- */
 function GalleryStart(testodettagli) {
     var corrente;
     jQuery(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({ autoplay_slideshow: false, theme: "unikolegno", allow_resize: false,  openmodal: false, testo_dettagli: testodettagli});
     if (window.location.hash.length == 0) {
         jQuery(".gallery a:first").click();
     }
     else {
         _corrente = "#prodotto" + window.location.hash.substring(1);
         jQuery(_corrente).click();
     }

     jQuery(window.location).bind(
	"change",
	function (objEvent, objData) {
	    _corrente = "#prodotto" + objData.currentHash;
	    if (jQuery('.pp_pic_holder').css('display') != "block") //se  visible non e esegue la chiamata
	    {
	        jQuery("#galleria").scrollTop();
//	        jQuery("#containerabaco").css("visibility", "hidden").css("display", "none");
	        jQuery(_corrente).click();
	    }
	});
 }

function Popup(open) {
	var w = 600;
	var h = 500;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	var stile = "top="+t+", left="+l+", width="+w+", height="+h+", status=no, menubar=no, toolbar=no, scrollbars=yes";
	window.open(open, "", stile);
}

