$(document).ready(function() {
	// SIFR
	$.sifrSettings({ path: 'swf/', font: 'VAGRoundedStdBold', color: '#ff3300', underline : 0 });
	$('.section').sifr({fontSize: '13px', link: '#f00', hover : '#c00'});
	$('#page-2col #page-col-1 .section').sifr({fontSize: '26px', link: '#ff0000', hover : '#cc0000'});
	$('#page-2col #page-col-2 .section').sifr({fontSize: '20px', color: '#669933', link: '#ff0000', hover : '#cc0000'});
	$('#page-2col blockquote').sifr({fontSize: '20px', color: '#669933', link: '#ff0000', hover : '#cc0000'});
	$('.table-prodotti thead th').sifr({fontSize: '18px', color: '#669933', link: '#ff0000', hover : '#cc0000'});

	// tabelle e scheda azienda
	$('.table-prodotti').each(function(n) {
		$(this).find('tr:last td').css('border','none');
		$(this).find('tr:last th').css('border','none');
	});

	// Miniature immagini no ombra
	$('.thumbnail').addClass('image-right');
	$('.thumbnail-left').addClass('image-left');

	// Miniature immagini
	/*
	$('.slideshow img').wrap('<div class="alpha-shadow"><div></div></div>');
	$('.thumbnail').wrap('<div class="alpha-shadow"><div></div></div>');
	$('.thumbnail-left').wrap('<div class="alpha-shadowleft"><div></div></div>');
	
	/* citazioni e blockquote nei dettagli
	$("#detail #page-2col blockquot	e").prepend("<span class='lquotes'>&#8220;</span>").append("<span class='rquotes'>&#8221;</span>");	
	$('#detail cite:first').css('margin-top','15px');
	*/	
});



// MP3
$(document).ready(function(){
    $('a[@href$="mp3"]').flash(
        { src: 'swf/singlemp3player.swf', height: 20, width: 150 },
        { version: 7 },
        function(htmlOptions) {
            $this = $(this);
            htmlOptions.flashvars.file = $this.attr('href');
			
            $this.after('<br /><br />'+$.fn.flash.transform(htmlOptions));						
        }
    );
});


// youTube
$(document).ready(function(){
	$('a[@href^="http://www.youtube.com"]').flash(  
		{ width: 425, height: 350 },
		{ version: 8 },
		function(htmlOptions) {
			$this = $(this);
			htmlOptions.src = $this.attr('href');
			$this.before($.fn.flash.transform(htmlOptions));						
		}
	);
});

$(document).ready(function(){
$(' a[href~=youtube.com/watch?v=]').flash(  
		{ width: 425, height: 350 },
		{ version: 8 },
		function(htmlOptions) {
			$this = $(this);
			htmlOptions.src = $this.attr('href');
			$this.before($.fn.flash.transform(htmlOptions));						
		}
	);
});	
// shadowbox
$(document).ready(function(){
    var options = {
        resizeLgImages:     true,
        displayNav:         true,
		loadingImage:		'shadowbox/images/loading.gif',
		overlayBgImage:		'shadowbox/images/overlay-85.png',
        handleUnsupported:  'remove',
        keysClose:          ['c','x', 27], // c or esc
		keysNext:			['n','s',39] // n s o freccia
    };
    Shadowbox.init(options);
});

//lampeggia
function lampeggia( div ) {
	if (document.getElementById(div).style.visibility=="visible") {
		document.getElementById(div).style.visibility="hidden";
	} else {
		document.getElementById(div).style.visibility="visible";
	}
	setTimeout("lampeggia( '"+div+"')",1000);
}
/* NASCONDE-VISUALIZZA OGGETTI */	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	function hideObject(id) { 
			document.getElementById(id).style.visibility = "hidden"; 
	}
	function MM_showHideLayers() { //v6.0
	  var i,p,v,d,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) {
		v=args[i+2];
		d=args[i+2];
		if (obj.style) {
			obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;
				d=(d=='show')?'block':(d=='hide')?'none':d;
			}
			obj.visibility=v;
			obj.display=d;
		}
	}
   	function VisualizzaDiv(divName) {
		if (document.getElementById(divName).style.visibility == "hidden"){
			MM_showHideLayers(divName,'','show');	
		} else {
			MM_showHideLayers(divName,'','hide');	
		}

	}
