(function() {
	
	$(document).ready(function() {
		prepareOnLoad();
		
		var b=false;
		
			
	  $("div.cal_gp").live("click",function() {
		
	
		
		 var id=$(this).attr("rel"); 

     if (b==false) {
	     b=true;
	   } else {
		
		     var act=$(".cal_gp").map(function() {
						return $(this).hasClass(".cal_active") ? this : null;
				 });
		
		     //$("img",act).each(function() {
		     //   this.src=this.src.replace(/ended|tobeplayed/gi,"").replace("small/","small/tobeplayed");
				 //});
				
		     $(".cal_gp").removeClass("cal_active");
			   
			   //$(this).find("img").each(function() {
				 //   this.src=this.src.replace(/ended|tobeplayed/gi,"").replace("small/","small/ended"); 
			   //}); 
		   	
			 	 $(this).removeClass("cal_tobeplayed").addClass("cal_active");
			
		 }
	

			  $.ajax({
				   url: "include/shared/team/anagrafica/"+id+".shtml",
				   success: function(txt){
				     $(".cal_info_container").html(txt);
				   }
				 });
				
				 $.ajax({
				   url: "include/shared/team/piloti/"+id+".shtml",
				   success: function(txt){
					    var html=$(txt).text();
					   // console.log(txt);   
					
				     $("div.cal_image_container").html(txt);
				   }
				 });
				
		
		
	  });
	
		$(".cal_gp:first").trigger("click");
	
	});
})()

 

