var selectedImg='mini_1';

function prepareThumbnails(idGrande,imgPath){
	$('.collection_thumbnail').css('cursor','pointer');
	$('.collection_thumbnail').bind('click', function(event) {
		$('#'+selectedImg).fadeTo('fast',0.2);
		//$('#'+selectedImg).css('border','0px solid black');
		selectedImg=event.target.id;
		//$('#'+selectedImg).css('border','1px solid grey');
		var id=event.target.id.replace('mini_','');
		$('#'+idGrande).fadeOut(800,function(){
			$('#'+idGrande).attr('src',imgPath+'image'+id+'-grde.png');
		});
	});
	$('.collection_thumbnail').fadeTo('slow',0.2);
	$('#'+selectedImg).fadeTo('fast',1);
	//$('#'+selectedImg).css('border','1px solid grey');
		
	$('.collection_thumbnail').bind('mouseover', function(event) {
		if(event.target.id != selectedImg){
			$(event.target).fadeTo('slow',1);
		}
	});
	$('.collection_thumbnail').bind('mouseout', function(event) {
		if(event.target.id != selectedImg){
			$(event.target).fadeTo('slow',0.2);
		}
	});
}

function prepareImageProtection(idImage){
	$('#'+idImage).bind("contextmenu",function(){  
         return false;  
    });  
}

function prepareContextMenu(idImage){
	$(document).bind("contextmenu",function(){  
         return false;  
    });  
}

function prepareMenuItems(){
	$('.menu_image').css('cursor','pointer');
	$('.menu_image').bind("click",function(event){
		deactivateMenuItems();
		event.target.src=event.target.src.replace('noir','gris');
		$("#collection_texte").each(function(){
			regex=new RegExp('(/[^/]*)\-texte\.png');
			if(this.src.replace(regex,'/'+event.target.id.replace('menu_image_',''))+'-texte.png'!=this.src){
				$(this).fadeOut(800, function(){
					this.src=this.src.replace(regex,'/'+event.target.id.replace('menu_image_',''))+'-texte.png';
				});
				
			}
		});
		
	});
}
function deactivateMenuItems() {
	$('.menu_image').each(function(){
		if(this.src.replace('gris','noir')!=this.src){
			this.src=this.src.replace('gris','noir');
		}
	});
}