/* Marquee */
    $(function () {
        $('div.titreencours marquee').marquee('pointer').mouseover(function () {
            $(this).trigger('stop');
        }).mouseout(function () {
            $(this).trigger('start');
        }).mousemove(function (event) {
            if ($(this).data('drag') == true) {
                this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
            }
        }).mousedown(function (event) {
            $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
        }).mouseup(function () {
            $(this).data('drag', false);
        });
    });
	
	
/* Menu */
$(function() {
	$("#menu").megaMenu('show');
	/*$("#menu").megaMenu('click_open_close');*/
});

/* Slider*/
$(document).ready(function(){
	$('#preFeature').siteFeature();
}); 
	

/* Tabs */

$(document).ready(function() {

$.fn.simpleTabs = function(){ 
	//Default Action
	$(this).find(".contenu_tabs").hide(); //Hide all content
	$(this).find("ul.tabs_actu_home li:first").addClass("actif").show(); //Activate first tab
	$(this).find(".contenu_tabs:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs_actu_home li").click(function() {
		$(this).parent().parent().find("ul.tabs_actu_home li").removeClass("actif"); //Remove any "actif" class
		$(this).addClass("actif"); //Add "actif" class to selected tab
		$(this).parent().parent().find(".contenu_tabs").hide(); //Hide all tab content
		var actifTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the actif tab + content
		$(actifTab).show(); //Fade in the actif content
		return false;
	});
};//end function

$("div[class^='simpleTabs']").simpleTabs(); //Run function on any div with class name of "Simple Tabs"


});


/* Slide vertical */
		$(function(){
			$.unobtrusivelib();
			prettyPrint();
			$("div.slidenews").carousel( { 
			autoSlide: false, 
			autoSlideInterval: 5000						
			
			} );
		});
		





		
		
		$(function(){
			$.unobtrusivelib();
			prettyPrint();
			$("div.vertical").carousel( {
			direction: "vertical", 
			autoSlideInterval: 8000			
						
			
			} );
		});		
		

				

/* Accordeon */
	jQuery().ready(function(){
		// simple accordion
		jQuery('#list1a').accordion();
		jQuery('#list1b').accordion({
			active: false,
			alwaysOpen: false,
			autoheight: false
			
		});
		
		// second simple accordion with special markup
		jQuery('#navigation').accordion({
			active: false,
			header: '.head',
			navigation: true,
			event: 'mouseover',
			fillSpace: true,
			animated: 'easeslide'
		});
		
		
		
		
		
		// highly customized accordion
		jQuery('#list2').accordion({
			event: 'mouseover',
			active: '.selected',
			selectedClass: 'active',
			animated: "bounceslide",
			header: "dt"
		}).bind("change.ui-accordion", function(event, ui) {
			jQuery('<div>' + ui.oldHeader.text() + ' hidden, ' + ui.newHeader.text() + ' shown</div>').appendTo('#log');
		});
		
		// first simple accordion with special markup
		jQuery('#list3').accordion({
			header: 'div.title',
			active: false,
			alwaysOpen: false,
			animated: false,
			autoheight: false
		});
		
		var wizard = $("#wizard").accordion({
			header: '.title',
			event: false
		});
		
		var wizardButtons = $([]);
		$("div.title", wizard).each(function(index) {
			wizardButtons = wizardButtons.add($(this)
			.next()
			.children(":button")
			.filter(".next, .previous")
			.click(function() {
				wizard.accordion("activate", index + ($(this).is(".next") ? 1 : -1))
			}));
		});
		
		// bind to change event of select to control first and seconds accordion
		// similar to tab's plugin triggerTab(), without an extra method
		var accordions = jQuery('#list1a, #list1b, #list2, #list3, #navigation, #wizard');
		
		jQuery('#switch select').change(function() {
			accordions.accordion("activate", this.selectedIndex-1 );
		});
		jQuery('#close').click(function() {
			accordions.accordion("activate", -1);
		});
		jQuery('#switch2').change(function() {
			accordions.accordion("activate", this.value);
		});
		jQuery('#enable').click(function() {
			accordions.accordion("enable");
		});
		jQuery('#disable').click(function() {
			accordions.accordion("disable");
		});
		jQuery('#remove').click(function() {
			accordions.accordion("destroy");
			wizardButtons.unbind("click");
		});
	});
	
	
			

