
function open_popup(file, largeur, hauteur){
	if(largeur == undefined){
		largeur = 650;
	}
	
	if(hauteur == undefined){
		hauteur = 650;
	}
	window.open(file, "_blank", "menubar=no, status=no, scrollbars=yes, menubar=no, width="+largeur+", height="+hauteur+",location=no");
}






function mouse_over_rayon(id){
	$("#vignette_rayon_"+id).attr('class', "over");
	$("#titre_rayon_"+id).attr('class', "over");
}
function mouse_out_rayon(id){
	$("#vignette_rayon_"+id).attr('class', "out");
	$("#titre_rayon_"+id).attr('class', "out");
}




function slide_show_preload() { 


	tmp_img_loaded = new Array();
	tmp_img = new Array();
	tmp_img_loaded_count = 0
	
	for(a = 0; a < diaporama_array.length; a++){
		array_img =diaporama_array[a].split('|');
		
		tmp_img[a] = new Image(); 
		tmp_img[a].src  = array_img[0];
		tmp_img_loaded[a] = false
	}										  
	slide_show_checkload()

}




function slide_show_checkload() {
	if (tmp_img_loaded_count == diaporama_array.length) { 
		slide_show(0);
		return false;
	}
	for (i = 0; i <= diaporama_array.length; i++) {
		if (tmp_img_loaded[i] == false && tmp_img[i].complete) {
			tmp_img_loaded[i] = true;
			tmp_img_loaded_count++;
		}
	}
	timerID = setTimeout("slide_show_checkload()",10) 
}


function slide_show(id){

	array_img =diaporama_array[id].split('|');
	

	$("#slide_show").css('background-image', "url('"+array_img[0]+"')");
	$("#slide_show .titre a").html(array_img[1]);
	$("#slide_show .texte a").html(array_img[2]);
	
	
		$("#slide_show .titre a").attr('title', array_img[1]);
		$("#slide_show .titre a").attr('target', '_self');
		$("#slide_show .titre a").attr('href', array_img[3]);
	
		$("#slide_show .texte a").attr('title', array_img[1]);
		$("#slide_show .texte a").attr('target', '_self');
		$("#slide_show .texte a").attr('href', array_img[3]);
	
	/*
	document.getElementById(diaporama_image).onclick=function(){
		document.location.replace(array_img[2]);
	}
	*/
	
      $("#slide_show").fadeTo(500,1, function () {
			new_id = (current_id == diaporama_array.length - 1) ? 0 : current_id+1;
			MyTimout = setTimeout("slide_show_fade_out("+new_id+")",diaporama_vitesse);
      });

	

	
}	


function slide_show_fade_out(id){
      $("#slide_show").fadeTo(500,0, function () {
			current_id = id;
			slide_show_timout(id)
      });
}

function slide_show_timout(id){
	slide_show(id);
}





function slide_show_next(){
	clearTimeout(MyTimout)
	id  = current_id;
	id = (id == diaporama_array.length - 1) ? 0 : id+1;
	slide_show_fade_out(id);
}
function slide_show_previous(){
	
		clearTimeout(MyTimout)

	id  = current_id;
	id = (id == 0) ? diaporama_array.length - 1 : id-1;
	slide_show_fade_out(id);
}

