//function showPortraitWindow(id_participant, type) {
//	$(window).bind('resize', resizePortraitHandler);
//	
//	getPortraitWindow(id_participant, type, getPortraitWindowComplete);
//
//	initOverlay();
//
//	resizePortraitHandler();
//	
//	return false;
//}


function showPortraitWindow(id_participant, type) {
	overlayOpen = true;
	
	$("#youtube_video").css({visibility: "hidden"});
	
	$(window).bind('resize', resizePortraitHandler);
	
	initOverlay();
	
	$("#overlay").click(exitDetail);
	
	resizePortraitHandler();
	
	getParticipantPortrait(id_participant);
}


function getParticipantPortrait(id_participant){
	var searchPattern = $("#searchInput").val();
	if (searchPattern == 'search')
		searchPattern = '';
	
	setURL(id_participant);
	
	jQuery.post("ajax/getPortrait.php", {id_participant: id_participant, searchPattern: searchPattern, page: _pageNum, ages: $("#ages_hidden").val(), genres: $("#genres_hidden").val()}, getParticipantPortraitComplete);
}


function getParticipantPortraitComplete(data){
	$("#participant_details").html(data);
}

function onShootImageLoaded(position){
	var windowWidth = $("#participant_details").width() + 40;
	var windowHeight = $("#participant_details").height() + 40;
	
	switch( position ){
	case "previous":
		var portraitWidth = $("#rankin_by_you_previous_media img").width();
		var portraitHeight = $("#rankin_by_you_previous_media img").height();
		var top = (windowWidth - portraitWidth) * .5;
		var left = (windowHeight - portraitHeight) * .5;
		
		$("#rankin_by_you_previous_media").css({position: "absolute", top: top + "px", left: left + "px"});
		break;
	case "next":
//		var portraitWidth = $("#rankin_by_you_next_media img").width();
//		var portraitHeight = $("#rankin_by_you_next_media img").height();
//		$("#rankin_by_you_next_media").hide();
		//$("#rankin_by_you_next_media").css({position: "absolute", top: ((windowWidth - portraitWidth) * .5) + "px", left: ((windowHeight - portraitHeight) * .5) + "px"});
		break;
	case "middle":
//		var portraitWidth = $("#rankin_by_you_current_media img").width();
//		var portraitHeight = $("#rankin_by_you_current_media img").height();
//		$("#rankin_by_you_current_media").hide();
		//$("#rankin_by_you_current_media").css({position: "absolute", top: ((windowWidth - portraitWidth) * .5) + "px", left: ((windowHeight - portraitHeight) * .5) + "px"});
		break;
	}
}

function getOverlayWidth(){
	return $("#participant_details").width();
}

function getOverlayHeight(){
	return $("#participant_details").height();
}