// JavaScript Document

$(window).bind('load', function() {
    var preload = new Array();
    $(".rollover").each(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_over.$1");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if(preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
});

var tb_pathToImage = "/squelettes/icono/loadingAnimation.gif";
$(document).ready(function () { 


	$('img.rollover').hover(
		function() {
			//over
			var newImage = $(this).attr('src').replace(/^(.*?)(\.(?:gif|jpg|png))$/, "$1_over$2"); //adjust for your scheme
			$(this).attr('src', newImage);
		},
		function() {
			//out
			var newImage = $(this).attr('src').replace('_over', '');
			$(this).attr('src', newImage);
		}
	);

	$(".Inp").click(function(){
		$(this).val("");
	 });

	

/*********************
*
* Petite Navigation 
*
**********************/
	// On ferme par default tous les ID commençant par PtteNav_
	$("[@id^='Gloss_']").hide();
	
	$(".TitGloss").toggle(function(){ 
		var IdRslt = "Gloss_" + this.name;
		$("div[@id=" + IdRslt + "]").show();
		$(this).css("background-image", "url(/squelettes/icono/structures/fleche_o.gif)");
	 },
	function(){
		var IdRslt = "Gloss_" + this.name;
		$("div[@id=" + IdRslt + "]").hide();

		$(this).css("background-image", "url(/squelettes/icono/structures/fleche.gif)");
	 });

/*********************
*
* Mon Parcours
*
**********************/
// On ferme par default tous les ID commençant par MonPar_
	$("[@id^='MonPar_']").hide();
	$("[@id$='_over']").hide();
	
	$(".MPBtn").toggle(function(){ 
		var IdRslt = "MonPar_" + this.name;
		var ImgBtn = "mp_" + this.name;
		var IdBtn = "MPBtn_" + this.name;
	
		$("ul[@id=" + IdRslt + "]").show();
		$("img[@id=" + IdBtn + "]").hide();
		$("img[@id=" + IdBtn + "_over]").show();

	 },
	function(){
		var IdRslt = "MonPar_" + this.name;
		var ImgBtn = "mp_" + this.name;
		var IdBtn = "MPBtn_" + this.name;

		$("ul[@id=" + IdRslt + "]").hide();
		$("img[@id=" + IdBtn + "]").show();
		$("img[@id=" + IdBtn + "_over]").hide();
	 });

/* TEMOIGNAGE */
	$(".Temoignage").corner("12px");



/*********************
*
* F.A.Q. 
*
**********************/
// On ferme les REPONSE				   
	$("div[@id^='faq_']").hide();	
	$(".QFaq").toggle(function(){ 
		var IdRslt = "faq_" + this.name;
		$("div[@id=" + IdRslt + "]").show();
	 },
	function(){
		var IdRslt = "faq_" + this.name;
		$("div[@id=" + IdRslt + "]").hide();
	 });
	
	$("._srub").change(function(){ 
		var formsub ="_srub"+ this.title;
	
	
		$("form[@id=" + formsub + "]").submit();						
	});
});


