// 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
 
   
});

$(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)');




//	slide	
/*	$(function() {
				$('#tgallery').cycle({ 
					fx:     'fade', 
					speed:  5000,  
					timeout: 1
				});
		});
*/


	
	/*gallery news home*/
	$(function() {
			$('#eslide').cycle({ 
				fx:     'fade', 
				pager:	'#pager',
	 			cleartype:  1, // enable cleartype corrections
				pause:      1,     // true to enable "pause on hover" 
				timeout: 6000
			});
	});
	
	
	
	//categorie in evidenza
	
	
	
	$("#cer").hover(
	  function () {
		$('#cer img').fadeOut(500);
	  },
	  function () {
		$('#cer img').fadeIn(500);
	  }
	);
	

	$("#osp").hover(
	  function () {
		$('#osp img').fadeOut(500);
	  },
	  function () {
		$('#osp img').fadeIn(500);
	  }
	);
	
	
		$("#con").hover(
	  function () {
		$('#con img').fadeOut(500);
	  },
	  function () {
		$('#con img').fadeIn(500);
	  }
	);



/********************mediagallery******************************/



$('a#t1').click(function() {
//		$("#mediagallery").animate({ height:"230px"}, 1000 );				 
		$("#mediagallery div").hide();
		$("#mediagallery .pr").hide();
		$("#mediagallery .nx").hide();		
		//$("#tc").show('slow');
		$("#tnextimg").show('slow');
		$("#tprevimg").show('slow');
		$("#immagini").slideToggle("slow");
		/*$("#immagini div").show('slow');*/
	});

$('a#t2').click(function() {
//		$("#mediagallery").animate({ height:"110px"}, 1000 );					 
		$("#mediagallery div").hide();
		$("#mediagallery .pr").hide();
		$("#mediagallery .nx").hide();			
	//	$("#tc").show('slow');
		$("#tnextvid").show('slow');
		$("#tprevvid").show('slow');
		$("#video").slideToggle("slow");
	});
$('a#t3').click(function() {
//		$("#mediagallery").animate({ height:"110px"}, 1000 );					 
		$("#mediagallery div").hide();
		$("#mediagallery .pr").hide();
		$("#mediagallery .nx").hide();			
	//	$("#tc").show('slow');
		$("#tnextdoc").show('slow');
		$("#tprevdoc").show('slow');
		$("#docs").slideToggle("slow");
	});
$('a#t4').click(function() {
//		$("#mediagallery").animate({ height:"110px"}, 1000 );					 
		$("#mediagallery div").hide();
		$("#mediagallery .pr").hide();
		$("#mediagallery .nx").hide();			
		//$("#tc").show('slow');
		$("#tnexturl").show('slow');
		$("#tprevurl").show('slow');
		$("#link").slideToggle("slow");
	});
/*$('a#tc').click(function() {
//		$("#mediagallery").animate({ height:"20px"}, 1000 );					 
		//$("#tabs div").hide("slow");
		$("#tc").hide();
	});*/



/*elenco media gallery*/
/*gestione degli accordion nelle gallery di immagini*/
	


    lastBlock = $(".a1");
    maxWidth = 358;
    minWidth = 33;	

    $("#immagini .itemmedia a").hover(
      function(){
        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
	lastBlock = this;
	
      }
    );
	
	
	
    $("#video .itemmedia a").hover(
      function(){
        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
	lastBlock = this;
      }
    );

		$(function() {
				$('#immagini').cycle({ 
					fx:     'fade', 
					speed:  1500,  
					prev:   '#tprevimg',
					next:   '#tnextimg',
				//	after:   onAfter,
					timeout: 0
				});
				
			
			
				
		});
	/*function onAfter(curr, next, opts) {
    				
      			 $(".a1").animate({width: 358+"px"}, { queue:false, duration:400 });
				 lastBlock = $(".a1");
     				 }
		*/	
		
		$(function() {
				$('#video').cycle({ 
					fx:     'fade', 
					speed:  1500,  
					prev:   '#tprevvid',
					next:   '#tnextvid', 
					timeout: 0
				});
				
		});
			
		
		


		$(function() {
				$('#docs').cycle({ 
					fx:     'scrollLeft', 
					speed:  1500,  
					prev:   '#tprevdoc',
					timeout: 0
				});
				
		});
		$(function() {
				$('#docs').cycle({ 
					fx:     'scrollRight', 
					speed:  1500,  
					next:   '#tnextdoc', 
					timeout: 0
				});
				
		});	
		$(function() {
				$('#link').cycle({ 
					fx:     'scrollLeft', 
					speed:  1500,  
					prev:   '#tprevurl',
					timeout: 0
				});
				
		});
		$(function() {
				$('#link').cycle({ 
					fx:     'scrollRight', 
					speed:  1500,  
					next:   '#tnexturl', 
					timeout: 0
				});
				
		});	







	

$('#dFrom').change(function() {  
		var a= $('#dFrom').val();
	if (a.substring(0,1) == '0') a = a.substring(1); 
	pos = a.indexOf("/");
        dd = parseInt(a.substring(0, pos))// day
	a = a.substring(pos+1)// '/'
	if (a.substring(0,1) == '0') a = a.substring(1); 
	pos = a.indexOf("/");
        mm = parseInt(a.substring(0, pos))// month
        yy = parseInt(a.substring(pos+1))// year

$('#ddlArrivoGiorno').val(dd);
$('#ddlArrivoMese').val(mm);
$('#ddlArrivoAnno').val(yy);

					 });


$('#dTo').change(function() {  
		var a= $('#dTo').val();
	if (a.substring(0,1) == '0') a = a.substring(1); 
	pos = a.indexOf("/");
        dd = parseInt(a.substring(0, pos))// day
	a = a.substring(pos+1)// '/'
	if (a.substring(0,1) == '0') a = a.substring(1); 
	pos = a.indexOf("/");
        mm = parseInt(a.substring(0, pos))// month
        yy = parseInt(a.substring(pos+1))// year




$('#ddlPartenzaGiorno').val(dd);
$('#ddlPartenzaMese').val(mm);
$('#ddlPartenzaAnno').val(yy);

					 });


//columnize
	/*$('#agdetail #txt').columnize({
						
						
						columns: 4, 
						lastNeverTallest:true 
						});
	$('#contenitore #txtartimg').columnize({
						width:150

						
						});

	*/
});



