$(window).load(	
	function() {
		$("#li-banner").sp_Li_Slider({						
			animation						: "Regular-Custom",	// type of Animation: Regular, Random, Regular-Custom, Random-Custom, Regular-Exception, Random-Exception  			
			transitions					: 'Fade',				// None|transition_name(s) // List of custom animations - for full list please reference to the preview (works only with "Regular-Custom, Random-Custom, Regular-Exception , Random-Exception ")
			auto_play 					: true,   			// true|false - auto play on start
			repeat	 						: true,					// true|false|number - how many times to repeat all slides
			modalMode						:	'prettyPhoto',// lightBox|prettyPhoto|off
			goToSlideOnStart		:	1,						// value //any slide number starting from 1 or url?sp_slide=2
			timer								: 'line_bottom',// no|line_bottom|line_top|line_right|line_left
			pauseOnMouseOver		:	false,					// true|false
			tooltip							:	'none',			// none|text|image
			tooltipSize					: 20,						// value // % of slider dimentions from 0 to 100. Use 0 to disable it
			shuffle							:	true,				// true|false - randomize the images order
			delay     					: 4000,					// value // time period of a photos displaying /default - 3000 (3 sec)
			trans_period				:	800,					// value // time period of chenging the photos /default - 1000 (1 sec)
			vert_sections				:	10,						// value // number of vertical sectors (only for Animation type Blind) /default - 15
			sqr_sections_Y			:	4,						// value // number of squeres by vertical (only for Animation type Sqr) /default - 5
			active_links				:	false,					// true|false //activate links of photos /default - true
			buttons_show				:	true,					// true|false //show all buttons 		/default - true
			play_pause_show			:	false,					// true|false //show Play or Pause buttons	/default - true
			next_prev_show			:	true,					// true|false //show Next or Prev buttons	/default - true
			auto_hide 					: true,					// true|false // auto hide buttons ot start (when auto_play is true)
			buttons_show_time		:	800,					// value 			//time period befor displayins of the buttons 	/default - 100
			buttons_show_delay	:	500,					// value //time period for appearing of the buttons		/default - 300
			buttons_hide_time 	:	2000,					// value //time period befor disappearing of the buttons/default - 2000
			buttons_hide_delay	:	500						// value //time period for disappearing of the buttons	/default - 500
		});
	}
);

$(document).ready(function() {

	$("#menu").megaMenu('hover_fade');

	jQuery('#acc-menu2').AccordionImageMenu({
	  'border' : 0,
	  'openItem': 0,
	  'duration': 400,
	  'openDim': 250,
	  'closeDim': 142,
	  'effect': 'easeOutQuint',
	  'fadeInTitle': true,
	  'height':160 
	});	
	
	
  /* scroll fade */
  	
  /*$(function(){
  tiles = $("#comunicati, #slides, #cont_footer").fadeTo(0, 0);

	$(window).scroll(function(d,h) {
		tiles.each(function(i) {
			a = $(this).offset().top + $(this).height();
			b = $(window).scrollTop() + $(window).height();
			if (a < b) $(this).fadeTo(500,1);
		});
	});

  }); 	*/
  
  
// Reset Font Size
  var originalFontSize = $('#cont_sezione').css('font-size');
  $(".resetFont").click(function(){
  $('#cont_sezione').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
  	var currentFontSize = $('#cont_sezione').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	$('#cont_sezione').css('font-size', newFontSize);
	return false;
	
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
  	var currentFontSize = $('#cont_sezione').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
	$('#cont_sezione').css('font-size', newFontSize);
	return false;
  });  
  
  
  	
});

$(function(){
	$('#slides').slides({
		preload: true,
		preloadImage: 'img/loading.gif',
		play: 3500,
		pause: 2500,
		hoverPause: true,
		slideEasing: "easeOutQuad",
		effect: 'slide',
		animationStart: function(current){
			$('.caption').fadeOut(100);
			if (window.console && console.log) {
				// example return of current slide number
				console.log('animationStart on slide: ', current);
			};
		},
		animationComplete: function(current){
			$('.caption').fadeIn(200);
			if (window.console && console.log) {
				// example return of current slide number
				console.log('animationComplete on slide: ', current);
			};
		},
		slidesLoaded: function() {
			$('.caption').fadeIn(200);
		}
	});
});

function setLabelLanguage(sID) {
    $.ajax({
        url: "__Lang.aspx",
        dataType: "text",
        data: {
            sLabel: sID
        },
        success: function(data) {
        
            if (data != "")
                document.getElementById(sID).innerHTML = data;
        },
        error: function(xhr, ajaxOptions, thrownError) {
            
        }
    });
}

function setLabelLanguage2(sID, sIDReal) {
    $.ajax({
        url: "__Lang.aspx",
        dataType: "text",
        data: {
            sLabel: sID
        },
        success: function(data) {

            if (data != "")
                document.getElementById(sIDReal).innerHTML = data;
        },
        error: function(xhr, ajaxOptions, thrownError) {

        }
    });
}
