// 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,
 overlayColor: "#7C7A79"
   
});

$(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);


//////////////////////////////////////////////////menu top//////////////////////////////////////////////////////////////////
/*il menu prima la pop up interna*/
   $(".smenu a.ln").hover(
	function(){
	$(".smenu .act").removeClass('act');
	var idln=this.id;
	ln = idln.substr(2);
	//alert (ln);
	$('#ln'+ln).addClass('act');
	$('#im'+ln).addClass('act');
	$('#no'+ln).addClass('act');
	}
	);
/*il menu poi la gestione esterna*/   
   $("#head ul a").hover(
	function(){
	var idcat=this.id;
	cat = idcat.substr(3);
	//alert(cat);
	$("#head ul a").removeClass('act');
	$('#cat'+cat).addClass('act');
	$(".smenu").hide();
	$("#sottocat").show();
	$("#bgm").show();
	$('#sm'+cat).show();
	
	$(".smenu .act").removeClass('act');
	$('#sm'+cat+' a:first').addClass('act');
	$('#sm'+cat+' .imgh:first').addClass('act');
	$('#sm'+cat+' p:first').addClass('act');
	}
	);
/* la chiusura de menu */
   $("#sottocat").mouseleave(
	function(){	
	$("#sottocat").hide();
	$(".home").removeClass('act');
	
	}					 
	);
/*i casi in cui mancano le sottocategorie il menu non si deve aprire*/   
     $(".nomenu").hover(
	function(){	
	$("#sottocat").hide();
		$("#head ul a").removeClass('act');
	},
	function(){	
	$("#sottocat").hide();
		$("#head ul a").removeClass('act');
	}
	);
//////////////////////////////////////////////////fine menu top//////////////////////////////////////////////////////////////////	 

$(function() {
		 $('#slideservizi').cycle({
			fx:      'scrollUp', 
			speed:    300, 
			timeout:  4000 
		});
	});

$(function() {
		 $('.jc').cycle({
			fx:      'scrollUp', 
			speed:    300, 
			timeout:  4000 
		});
	});

$(function() {
		 $('#cucine').cycle({
			fx:      'fade', 
			speed:    300, 
			timeout:  4000 
		});
	});


$(function() {
			$('#eslide').cycle({ 
				fx:     'fade', 
				pager:	'#pager',
	 			cleartype:  1, // enable cleartype corrections
				pause:      1,     // true to enable "pause on hover" 
				timeout: 3000
			});
	});


$(function() {
			$('#immcntimg').cycle({ 
			  fx:     'scrollHorz', 
			  prev:   '#previmg', 
    		  next:   '#nextimg', 
    		  timeout: 0 
			});
	});

$(function() {
			$('#immcntimg2').cycle({ 
			  fx:     'scrollHorz', 
			  prev:   '#previmg2', 
    		  next:   '#nextimg2', 
    		  timeout: 0 
			});
	});


$(function() {
			$('#immcntvideo').cycle({ 
			  fx:     'scrollHorz', 
			  prev:   '#prevvideo', 
    		  next:   '#nextvideo', 
    		  timeout: 0 
			});
	});

$(function() {
			$('#immcntcase').cycle({ 
			  fx:     'scrollHorz', 
			  prev:   '#prevc', 
    		  next:   '#nextc', 
    		  timeout: 0 
			});
	});

$(function() {
			$('#immcnt').cycle({ 
			  fx:     'scrollHorz', 
			  prev:   '#prev', 
    		  next:   '#next', 
    		  timeout: 0 
			});
	});


//	slide	
/*	$(function() {
				$('#galleryslide').cycle({ 
					fx:     'turnDown', 
					speed:  1500,  
					prev:   '#prev1', 
					next:   '#next1', 
					before:   onAfter,
					timeout: 0
				});
				function onAfter() {
					$('#output1').html(this.title);
				}
		});



		$(function() {
				$('#portgallery').cycle({ 
					fx:     'fade', 
					speed:  1500,  
					prev:   '#prev', 
					next:   '#next', 
					before:   onAfter,
					timeout: 0
				});
				function onAfter() {
					$('#output').html(this.title);
				}
		});
	
	
		$('#portslide') 
		.cycle({ 
			fx:     'turnDown', 
			speed:  'slow', 
			timeout: 0,
			pause:   1,
			pager:  '#paginate' 
		});
	
	

	//columnize
	$('#agdetail #txt').columnize({
						
						
						columns: 4, 
						lastNeverTallest:true 
						});
	$('#contenitore #txtartimg').columnize({
						width:150

						
						});



// all overlays use the "apple" effect by default 
$.tools.overlay.conf.effect = "apple";

$("img[rel]").overlay();
*/
// setup ul.tabs to work as tabs for each div directly under div.panes
  
  // select #flowplanes and make it scrollable. use circular and navigator plugins 
   $("#flowpanes").scrollable({size: 1, clickable: false}).navigator({ 
 
        // select #flowtabs to be used as navigator 
     navi: "#flowtabs", 
 
        // select A tags inside the navigator to work as items (not direct children) 
        naviItem: 'a', 
 
        // assign "current" class name for the active A tag inside navigator 
      activeClass: 'current' 
 
    }); 
//cicletop
		$('#slidetop') 
		.cycle({ 
			fx:     'fade' 
			
		});
$.fn.cycle.defaults = { 
    fx:           'zoom', // one of: fade, shuffle, zoom, scrollLeft, etc 
    timeout:       4000,  // milliseconds between slide transitions (0 to disable auto advance) 
    continuous:    0,     // true to start next transition immediately after current one completes 
    speed:         1000,  // speed of the transition (any valid fx speed value) 
    speedIn:       null,  // speed of the 'in' transition 
    speedOut:      null,  // speed of the 'out' transition 
    next:          null,  // id of element to use as click trigger for next slide 
    prev:          null,  // id of element to use as click trigger for previous slide 
    prevNextClick: null,  // callback fn for prev/next clicks:  function(isNext, zeroBasedSlideIndex, slideElement) 
    pager:         null,  // id of element to use as pager container 
    pagerClick:    null,  // callback fn for pager clicks:  function(zeroBasedSlideIndex, slideElement) 
    pagerEvent:   'click', // event which drives the pager navigation 
    pagerAnchorBuilder: null, // callback fn for building anchor links 
    before:        null,  // transition callback (scope set to element to be shown) 
    after:         null,  // transition callback (scope set to element that was shown) 
    end:           null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options) 
    easing:        null,  // easing method for both in and out transitions 
    easeIn:        null,  // easing for "in" transition 
    easeOut:       null,  // easing for "out" transition 
    shuffle:       null,  // coords for shuffle animation, ex: { top:15, left: 200 } 
    animIn:        null,  // properties that define how the slide animates in 
    animOut:       null,  // properties that define how the slide animates out 
    cssBefore:     null,  // properties that define the initial state of the slide before transitioning in 
    cssAfter:      null,  // properties that defined the state of the slide after transitioning out 
    fxFn:          null,  // function used to control the transition 
    height:       'auto', // container height 
    startingSlide: 0,     // zero-based index of the first slide to be displayed 
    sync:          1,     // true if in/out transitions should occur simultaneously 
    random:        1,     // true for random, false for sequence (not applicable to shuffle fx) 
    fit:           0,     // force slides to fit container 
    pause:         1,     // true to enable "pause on hover" 
    autostop:      0,     // true to end slideshow after X transitions (where X == slide count) 
    autostopCount: 0,     // number of transitions (optionally used with autostop to define X) 
    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative) 
    slideExpr:     null,  // expression for selecting slides (if something other than all children is required) 
    cleartype:     0,     // true if clearType corrections should be applied (for IE) 
    nowrap:        0      // true to prevent slideshow from wrapping 
};		
		
//cicletop
//scrollpane
$('.holder').jScrollPane();







//gestione form 



$("input[type='hidden']").css('display','none');


//gestione marche



    $("#selcategorie").click(function () {
      $("#marche").hide();
	  $("#categorie").show();
	  $("#selector h4").removeClass("mrk");
	  $("#selector h4").addClass("cat");
    //  return true;
    });
	
	
    $("#selmarche").click(function () { 
      $("#categorie").hide();
	  $("#marche").show();
	  $("#selector h4").removeClass("cat");
  	  $("#selector h4").addClass("mrk");
      //return true;
    });




});

