if (window.navigator.appName == 'Microsoft Internet Explorer') {
	document.createElement("header");
	document.createElement("footer");
	document.createElement("section");
	document.createElement("aside");
	document.createElement("nav");
	document.createElement("article");
	document.createElement("figure");
}

$(document).ready(function(){
	// Cufon
	// Cufon.replace('#content h2', { fontFamily: 'MetaKorrespondenz' });
	
	$('.top').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
	});
	
	// Original Font Size
	var originalFontSize = $('html').css('font-size');
	// Increase Font Size
	$("li.font-inc").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		$('html').css('font-size', newFontSize);
		return false;
	});
	// Decrease Font Size
	$(".font-dec").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		$('html').css('font-size', newFontSize);
		return false;
	});
	// Reset Font Size
	$(".font-rst").click(function(){
		$('html').css('font-size', originalFontSize);
	});
	
	$('#slider').nivoSlider({
        effect:'random', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:500, //Slide transition speed
        pauseTime:6500,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:true, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:1, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });
	
	// News Sliding
	$("#news-control").jFlow({
		slides: "#news",  // the div where all your sliding divs are nested in
		controller: ".jFlowControl", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "jFlowSelected",  // just pure text, no sign
		auto: true,
		width: "240px",  // this is the width for the content-slider
		height: "300px",  // this is the height for the content-slider
		duration: 600,  // time in miliseconds to transition one slide
		prev: ".jFlowPrev", // must be class, use . sign
		next: ".jFlowNext" // must be class, use . sign
	});
	
	// clear input.text on focus, if still in default
	$('#searchform input.input-txt').focus(function() {
		if($(this).val() == 'Rechercher sur le site') { $(this).val(''); }
		else if( $(this).val() == '') { $(this).val('Rechercher sur le site'); }
	});
	$('#searchform input.input-txt').blur(function() {
		if($(this).val() == '') { $(this).val('Rechercher sur le site');}
	});

	// fermer layer
	$('#info').load('ajax/index.html', function() {
		$('#info').hide();
		$('#info').fadeIn(1500);
	});
	$('.close').click(function(){
		$('#info').fadeOut(1000);
		// $('#info').hide("normal");
		return false;
	});
	
	// effet hover actualités
	$("body.category-actualites #page #content .post article").hover( function(){ $(this).addClass("active") }, function(){ $(this).removeClass("active") } );
	
	$('ul.accordion').accordion();
	
	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click
	$("h3.trigger").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	//Slide up and down on click
	$("h3.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");
	});
	
	//display jalert on an action
	$('.langu-en a').click(function (){
		//$('body').css("opacity", 0.8).fadeIn(150);
		//$('#info').css("opacity", 1);
		$('#top').jAlert('The english version is not available for the moment.', "info", 'infobox');
	});
});

/*
function eraseRecherche(i) {
	form = document.getElementsByName('search')[0];
	if ((form.s.value == "" || form.s.value=="Rechercher sur le site") && i==1 )
		form.s.value = "";
	if ((form.s.value == "" || form.s.value=="Rechercher sur le site") && i==2 )
		form.s.value = "Rechercher sur le site";
}*/
