$(document).ready(function(){	
	
	animation();
	
    $("#portfolio_col1 img").hover(function()
        {
		if (!$(this).hasClass("selected")) {
	        $(this).css("border-color", "#FFE386");
		}
        },
     function()
     {		
		if (!$(this).hasClass("selected")) {	 
		$(this).css("border-color", "#000");
		}
     });	

	$("#portfolio_col1 img").bind("click", function(e){	
		   e.preventDefault();
		   var image=$(this);
		   var id = image.parent().attr("href");
		   id = id.substring(id.indexOf("id=")+3);
		  
		   $("#portfolio_col2 td").html("<img src='images/loader.gif'>").append("<div id='loadhere'></div>");
		   $("#loadhere").css("display","none");
			image.parent().blur();
			$("#portfolio_col1 .selected").removeClass("selected");
			image.css("border-color","").addClass("selected");
		   
			$.ajax({
			  url: "portfolio_fn.php",
			  type: "GET",
			  data : "id="+id,
			  cache: true,
			  success: function(html){
				$("#loadhere").html(html);
				
			  },
			error: function(er){ 			
			 $("#loadhere").html("Oops... une erreur est survenue.").css("display","");			 
			}			  
			});


	});
});
function showPortfolio() {
	$("#portfolio_col2 td img:first").css("display","none")
	$("#loadhere").css("display","");
	animation();

}
function animation() {
	$('#anim').cycle({fx:'blindY', speed:500, timeout:4000,delay:-2000});	
}
