/* UBO - JavaScript Document */

jQuery(document).ready(function(){
	
	// Zooms - Carrousel 
	if(jQuery('#zooms') && jQuery('#zoom-navigation') && jQuery('#zooms-tabs')){
		carrousel(jQuery('#zooms-list'), 'zoom', jQuery('#zooms-navigation .previous'), jQuery('#zooms-navigation .next'), jQuery('#zooms-tabs'), 290, 400, true, 8000);
	}
	
	// News - Ticker horizontal 
	if(jQuery('#news-list') && jQuery('#news-navigation')){
		horizontalTicker(jQuery('#news-list'), '.block', jQuery('#news-navigation .previous'), jQuery('#news-navigation .next'), null, 240, 'fast', jQuery('#news-navigation .position'));
	}
	
	// Slideshow
	jQuery('.slideshow').each(function(i, elm){
		console.log('slideshow : '+$(elm).find('.slideshow-slides'));
		horizontalTicker($(elm).find('.slideshow-slides ul'), 'li', $(elm).find('.navigation-previous'), $(elm).find('.navigation-next'), $(elm).find('.slideshow-tabs'), 240, 'normal', null);
	});
	// Liste déroulante
	initSlides();
	
	// Accordions
	initAccordions();
	
	// Blockquote inner
	jQuery('blockquote.blockquote-100').each(function(i, elm){
		var html = $(elm).html();
		$(elm).empty();
		$(elm).wrapInner('<div class="blockquote-inner">'+html+'</div>');
	});
	
	// Aligns
	jQuery('*[align=left]').each(function(i, elm){
		$(elm).addClass('align-left').removeAttr('align');
	});
	jQuery('*[align=right]').each(function(i, elm){
		$(elm).addClass('align-right').removeAttr('align');
	});
	jQuery('*[align=center]').each(function(i, elm){
		$(elm).addClass('align-center').removeAttr('align');
	});
	
	// Target blank
	jQuery('.target-blank').click(function(e){
		window.open(this.href);
		return false;
	});
	
	// Color scheme
	jQuery('.color-scheme').click(function(e){
		if($('html').hasClass('negative')) $('html').removeClass('negative');
		else $('html').addClass('negative');
		return false;
	});
	
	// Font size -
	jQuery('.font-smaller').click(function(e){
		changeFontSize('smaller');
		return false;
	});
	
	// Font size +
	jQuery('.font-bigger').click(function(e){
		changeFontSize('bigger');
		return false;
	});
	
	// Print
	jQuery('.print').click(function(e){
		window.print();
		return false;
	});
	
});

