// JavaScript Document
// file di configurazione script per mediatrading




//shadow box
Shadowbox.init({
    language:   "it",
    players:  ['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'],
	enableKeys:			true,
	continuous:			true
 
   
});

function apriSB(type, title, url,  w, h) //serve per le gallery di immagini
{
Shadowbox.init({skipSetup: true});
Shadowbox.open({player: type, title: title, content: url, width: w, height: h});
};

$(document).ready(function()
{
//attiva  pngfix 
$(document).pngFix();

	//apre i link in esterno in base all'url
	$("a.ext").click(function() {  
		window.open(this.href,'','');
		return false;
	}); 
	
	
	//animazione in apertura delle pagina

//il menu apertura e chiusura
//
//$(filter).animateClass(newClass,[oldClass], duration);
//gestiamo radio button $ chekbox

$("label:has(input[type='radio'])").addClass('radio');
$("label:has(input[type='checkbox'])").addClass('check');

//il primo ed ultimo fieldset
$("fieldset:first").addClass('first');
$("fieldset:last").addClass('last');

//i campi hidden
$("input[type='hidden']").css('display','none');
//$("button[type='reset']").css('background-image','url(../images/ico/reset_msg.gif)');



//il menu


// gestione menu
	$("#btnclose").click(function() { $(".smenu").hide(); $('#sottocat').hide(''); });
    $("#head ul li a").mouseover(function(){
		 							 
		$(".smenu").hide();
		var idcat=this.id;
		livello = idcat.substr(3);
		var coord = $('#cat'+livello).offset();
	
		
		offset_top = coord.top-10;
		$('#sottocat').css("top", offset_top+"px");
		
		var SCREENwidth = $(document).width();
		/*909 è la larghezza del sito*/
	    var correzione= (SCREENwidth-909)/2;
		
		offset_left = (coord.left-correzione)+80;
		$('#sottocat').css("left", offset_left+"px");
		
		
		$('#sm'+livello).show(); 
		$('#sottocat').show(); 
		
		
	}).mouseout(function(){ $(".smenu").hide(); $('#sottocat').hide(); });
	$("#sottocat").mouseover(function(){ $('#sm'+livello).show(); $('#sottocat').show(); }).mouseout(function(){ $(".smenu").hide(); $('#sottocat').hide(); });


$("#head ul li a.nomenu").mouseover(function() { $(".smenu").hide(); $('#sottocat').hide(''); });




$(function() {
			$('#shlhome').cycle({ 
				fx:     'fade', 
				pager:	'#pager',
	 			cleartype:  1, // enable cleartype corrections
				pause:      1,     // true to enable "pause on hover" 
				timeout: 5000
			});
	});



//	slide	
/*	$(function() {
				$('#tgallery').cycle({ 
					fx:     'fade', 
					speed:  5000,  
					timeout: 1
				});
		});
*/


$('#gallerycnt').after('<ul id="pager">').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 0, 
    pager:  '#pager',
	
     
    // callback fn that creates a thumbnail to use as pager anchor 
	
    pagerAnchorBuilder: function(idx, slide) {
		
		
        return '<li><a href="#" class="'+ slide.title +'"><img src="' + slide.src + '"  /></a></li>';
		alert (slide);
    } 
});
	
	
$(".player").click(function() { $("#gallerycnt").append('<span></span>'); });	
	
$(".noplayer").click(function() { $("#gallerycnt span").remove(''); });	
	
	
	

/********************mediagallery******************************/


/*

$('a#t1').click(function() {
		$("#mediagallery").animate({ height:"110px"}, 1000 );				 
		$("#mediagallery div").hide();
		$("#tc").show('slow');
		$("#fimm").show('slow');
		$("#immagini").slideToggle("slow");
		$("#immagini div").show('slow');
	});

$('a#t2').click(function() {
		$("#mediagallery").animate({ height:"110px"}, 1000 );					 
		$("#mediagallery div").hide();
		$("#tc").show('slow');
		$("#fvid").show('slow');
		$("#video").slideToggle("slow");
	});
$('a#t3').click(function() {
		$("#mediagallery").animate({ height:"110px"}, 1000 );					 
		$("#mediagallery div").hide();
		$("#tc").show('slow');
		$("#fdoc").show('slow');
		$("#docs").slideToggle("slow");
	});
$('a#t4').click(function() {
		$("#mediagallery").animate({ height:"110px"}, 1000 );					 
		$("#mediagallery div").hide();
		$("#tc").show('slow');
		$("#furl").show('slow');
		$("#link").slideToggle("slow");
	});
$('a#tc').click(function() {
		$("#mediagallery").animate({ height:"20px"}, 1000 );					 
		$("#tabs div").hide("slow");
		$("#tc").hide();
	});

elenco media gallery
		$(function() {
				$('#immagini').cycle({ 
					fx:     'fade', 
					speed:  1500,  
					prev:   '#tprevimg',
					next:   '#tnextimg',
					timeout: 0
				});
				
		});
	
		
		$(function() {
				$('#video').cycle({ 
					fx:     'fade', 
					speed:  1500,  
					prev:   '#tprevvid',
					next:   '#tnextvid', 
					timeout: 0
				});
				
		});
		$(function() {
				$('#docs').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#tprevdoc',
					next:   '#tnextdoc',
					timeout: 0
				});
				
		});
	
		$(function() {
				$('#link').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#tprevurl',
					next:   '#tnexturl', 
					timeout: 0
				});
				
		});
		







//columnize
	/*$('#agdetail #txt').columnize({
						
						
						columns: 4, 
						lastNeverTallest:true 
						});
	$('#contenitore #txtartimg').columnize({
						width:150

						
						});

	*/
});




