// 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;
	}); 
	
  $( '#sx' ).scrollFollow();
	
/*	
	$(function() {
	$("img[rel]").overlay();
});
		*/
	
	
	//animazione testata
	
	/*$("#freccia_avanti").click(function() {
		var pos_job = $("#testata_img").position();
		var pos_rea = $("#testata_img_r").position();
		var pos_vis = $("#testata_img_v").position();
		var pos_kno = $("#testata_img_k").position();
		
		if(pos_job.left == "243"){
		
			$("#testata_img_r").attr('style', 'left:-3000px');
			$("#testata_img").animate({
				left:'1000px'			 
				}
			, 2000);
			$("#testata_img_r").animate({
				left:'243px'
			}, 3000);
									   
			$("#testata ").animate({
				backgroundColor:'#e78800' 
						  }, 2000);
			$("#freccia_avanti").animate({
				backgroundColor:'#ebb900'				 
										 }, 2000);
			$("#freccia_indietro").animate({
				backgroundColor:'#ebb900'				 
										 }, 2000);
			$("#testata_testo_j").css("display","none");
			$("#testata_testo_r").css("display", "block");
			$("#testata_testo_v").css("display","none");
			$("#testata_testo_k").css("display","none");
		
		}
		else 
		if(pos_rea.left == "243"){
			$("#testata_img").attr('style', 'left:-3000px');
			$("#testata_img_r").animate({
				left:'1000px'			 
				}
			, 2000);
			$("#testata_img").animate({
				left:'243px'
			}, 3000);
									   
			$("#testata ").animate({
				backgroundColor:'#3d395e' 
						  }, 2000);
			$("#freccia_avanti").animate({
				backgroundColor:'#3d395e'				 
										 }, 2000);
			$("#freccia_indietro").animate({
				backgroundColor:'#3d395e'				 
										 }, 2000);
			$("#testata_testo_j").css("display","block");
			$("#testata_testo_r").css("display", "none");
			$("#testata_testo_v").css("display","none");
		*/	$("#testata_testo_k").css("display","none");
			/*$("#testata_testo_j").animate({
				display:'none'					
										},6000);
			$("#testata_testo_r").animate({
					display:'block'					  
										  },6000);*/
	/*	}
		else
		if(pos_vis.left == "243"){
			$("#testata_img").attr('style', 'left:-3000px');
			$("#testata_img_v").animate({
				left:'1000px'			 
				}
			, 2000);
			$("#testata_img").animate({
				left:'243px'
			}, 3000);
									   
			$("#testata ").animate({
				backgroundColor:'#3d395e' 
						  }, 2000);
			$("#freccia_avanti").animate({
				backgroundColor:'#3d395e'				 
										 }, 2000);
			$("#freccia_indietro").animate({
				backgroundColor:'#3d395e'				 
										 }, 2000);
			$("#testata_testo_j").css("display","block");
			$("#testata_testo_r").css("display", "none");
			$("#testata_testo_v").css("display","none");
			$("#testata_testo_k").css("display","none");
		*/	/*$("#testata_testo_j").animate({
				display:'none'					
										},6000);
			$("#testata_testo_r").animate({
					display:'block'					  
										  },6000);*/
	/*	}
		else
		
		
		
		
		
		
		if(pos_rea.left == "243"){
			if($("#testata_img_r").hasClass("class_prima")){
				$("#testata_img_r").removeClass('class_prima');
			}
			if($("#testata_img").hasClass("class_seconda")){
				$("#testata_img").removeClass('class_seconda');
			}

		}
		if(pos_job.left == "243"){
			
			if($("#testata_img").hasClass("class_prima")){
				$("#testata_img").removeClass('class_prima');
			}
			if($("#testata_img_r").hasClass("class_seconda")){
				$("#testata_img_r").removeClass('class_seconda');
			}

		}
		
		

	});
	
	*/
	
	
	
	
	/*
	
		
		$("#freccia_indietro").click(function() {	
			var pos_job = $("#testata_img").position();
			var pos_rea = $("#testata_img_r").position();
			
		if(pos_rea.left =="243"){
			$("#testata_img").attr('style', 'left:2000px');
			$("#testata_img_r").animate({
				left:'-1000px'			 
				}
			, 3000);
			$("#testata_img").animate({
				left:'243px'
			}, 3000);
									   
			$("#testata img").animate({
				backgroundColor:'#3d395e' 
						  }, 3000);
			$("#freccia_avanti").animate({
				backgroundColor:'#3d395e'				 
										 }, 3000);
			$("#freccia_indietro").animate({
				backgroundColor:'#3d395e'				 
										 }, 3000);
			$("#testata_testo_j").css("display","block");
			$("#testata_testo_r").css("display", "none");
			
		}else if(pos_job.left == "243"){
			
			$("#testata_img_r").attr('style', 'left:2000px');
			$("#testata_img").animate({
				left:'-1000px'			 
				}
			,3000);
			$("#testata_img_r").animate({
				left:'243px'
			}, 3000);
									   
			$("#testata img").animate({
				backgroundColor:'#ebb900' 
						  }, 3000);
			$("#freccia_avanti").animate({
				backgroundColor:'#ebb900'				 
										 }, 3000);
			$("#freccia_indietro").animate({
				backgroundColor:'#ebb900'				 
										 }, 3000);
		
			$("#testata_testo_j").css("display","none");
			$("#testata_testo_r").css("display", "block");
		}
		
			if(pos_rea.left == "243"){
			if($("#testata_img_r").hasClass("class_prima")){
				$("#testata_img_r").removeClass('class_prima');
			}
			if($("#testata_img").hasClass("class_seconda")){
				$("#testata_img").removeClass('class_seconda');
			}
		}
		if(pos_job.left == "243"){
			
			if($("#testata_img").hasClass("class_prima")){
				$("#testata_img").removeClass('class_prima');
			}
			if($("#testata_img_r").hasClass("class_seconda")){
				$("#testata_img_r").removeClass('class_seconda');
			}

		}
	});
										 
	*/
		$("#content #testo #immag").cycle({
			 fx:'scrollHorz', 
			 prev:   '#prevt',
			 next:   '#nextt',
			 after:   onAfter, 
			 timeout: 0 
										  });
		
		function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    $('#prevt')[index == 0 ? 'hide' : 'show']();
    $('#nextt')[index == opts.slideCount - 1 ? 'hide' : 'show']();
}

		
									 
			$("#banner_articoli").cycle({
			   fx:     'wipe', 
   speed:   1000, 
   timeout: 6000, 
   delay:  -4000, 
   clip:   'l2r' 
			 //continuous: 1 
										  });							 
									 
									 
									 
	/*								 
		$("#banner_articoli").cycle({
			fx:'scrollLeft', 
			 timeout: 5000 				
									});
	
	
	$("#reclami_sugg").hover(function(){
		$("#testo_reclami").css("display","block");
									  }, function(){
		$("#testo_reclami").css("display", "none");
									  });
	
	$("#immagini").hover(function(){
		$('#immagini').css('backgroundColor', '#e5e5e5');	
									  }, function(){
		$('#immagini').css('backgroundColor', '#ffffff');
									  });
	*/

	


	
	   
	
	
	//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
			});
	});
	
	
	
	
	
	
	

/********************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:   '#previmg',
					next:   '#nextimg',
					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

						
						});

	*/
});




