function makeHighlight (uid) {
	$.getJSON("/main/profiledata",{uid: uid},function(data){
			$(".HLavatar").html(data.avatar);
			$(".HLpseudo").html(data.pseudo);
			$(".HLrecipes").html("");
			if (data.recipes) {
				for (i=0;i<3;i++) {			
					if (data.recipes[i]) {
						r = data.recipes[i];
						$("<span></span>").html(r.thumb).appendTo($(".HLrecipes"));
						
					}
				}
			}
			var pres;
			$(".HLpresentation").html("");
			pres = data.profile.presentation;
			$(".HLpresentation").html(pres);
			$(".HLmore").attr("href",data.link);
	});
}


function ckCrslMakeHightlight(img) {
	$(".highlighted img").attr("src", img);					
}

function ckCrslRotate() {
	if ($(".carousel3h1t").attr("stopPlaying") != 1) {
		ckCrslCurrentPos++;
		if (ckCrslCurrentPos > 6) ckCrslCurrentPos = 1;
		$(".others div[order="+ckCrslCurrentPos+"]").click();
	}
	window.setTimeout ("ckCrslRotate()", 3000);	
}

ckCrslPositions = [];
ckCrslCurrentPos = 1;
$(function(){
		/*
		$(".membersMosaic ul li").click(function(e){
				e.stopPropagation();
				e.preventDefault();
				makeHighlight($(this).attr("uid"));
		});
		$(".membersMosaic ul li:first").click();
		*/
		
	$(".slider").click(function(e){
			document.location.href = $(".others div[order="+ckCrslCurrentPos+"] a").attr("href");
	});
	$(".others div").click(function(e){
			pos = $(this).attr("order");
			
			ckCrslMakeHightlight($(this).attr("img"));
			sliderPos = 11 + (pos-1)*37;
			$("#crsl3h1tslider").css("top", sliderPos+"px");
			ckCrslCurrentPos = $(this).attr("order");
	}).hover(function(e){
		$(".carousel3h1t").attr("stopPlaying", 1);
		//$(this).css("background-color","#808080");
		$(this).click();
	},function(e){

		//$(this).css("background-color","#aaaaaa");

		$(".carousel3h1t").attr("stopPlaying", 0);
	}).css("cursor","pointer");
	$(".highlighted").click(function(e) {
			document.location.href = $(".others div[order="+ckCrslCurrentPos+"] a").attr("href");
	}).css("cursor","pointer");
	$(".others div[order=1]").mouseover().mouseout();
	window.setTimeout ("ckCrslRotate()", 3000);
});

