/* vindex.js */

//On marque la prochaine image qui doit être sélectionnée
var ImgIdxI = 2;
var CountI = 1;

function PreloadImg(){
	$.ImagePreload("photos/vindex/vindex_2.jpg");
	$.ImagePreload("photos/vindex/vindex_3.jpg");
	$.ImagePreload("photos/vindex/vindex_4.jpg");
	$.ImagePreload("photos/parc_mans.jpg");
}

var BoucleI = setInterval("SwitchImgI()",5200);

function RestoreImgI(){
	$("#vindex").ImageSwitch({Type:$(this).attr("rel"),NewImage:"photos/vindex/vindex_1.jpg", speed: 4500});
	setTimeout("MagicImgI()",9800);
	}

function MagicImgI(){
		$("#vindex").ImageSwitch({Type:$(this).attr("rel"),NewImage:"photos/vindex/vindex_3.jpg", speed: 4500});
	}

function SwitchImgI(){
	$("#vindex").ImageSwitch({Type:$(this).attr("rel"),NewImage:"photos/vindex/vindex_"+ImgIdxI+".jpg", speed: 5000});		
	ImgIdxI++;
	if(ImgIdxI>4) {ImgIdxI = 1;}
	CountI++;
	if(CountI>3) {clearInterval(BoucleI);setTimeout("RestoreImgI()",5600);}
}

$(document).ready(function(){
PreloadImg();
SwitchTxt();
AfficheInfos()
});

/* Infos défilantes */
function SwitchTxt(){
/* on lance après la fin de l' animation d'images*/
setTimeout("NewsIt()",500);
}

function NewsIt(){
	// le contenu initial HTML est uniquement respecté pour le referencement*/
			/* on charge par Ajax
			// ainsi on externalise le fichier contenant les news
			// ce qui est plus facile pour les mise-à-jour */
			$.get(
					"ajax/messages.html", {}, function(data)
					{
					$("#accroche").html(data).find("#messages").newsTicker(10000);
						if(flag == 4 || flag > 4 ){
						$("#messages").children().stop();
						}
					}
				)
}

/* Info parc le Mans */	
function AfficheInfos(){

    $(".aff_info").click(function () {
    	$("#info_parc_mans").slideDown("slow");
    	$("#partenaire_list").hide();
    });
    
    $("#close_plan").click(function () {
    	$("#info_parc_mans").hide();
    	$("#partenaire_list").fadeIn("slow");
    });	
}
	
	
	
	
	
