/* Ready script for /web/search/dsp_ProfilePage.a4d  */

//var j$ = jQuery;

j$(function(){
	j$("#profileTabsRowERC > ul").tabs();
	j$("ul.ui-tabs-nav > li").addClass("ui-tabs-nav-item");
	j$("#hideDescTillMoreERC").hide();
	j$(".preloadImageContainERC").appendTo("#profileImagePlayerERC");
	j$(".preloadImageContainERC").hide();
	j$(".preloadImageContainERC:first").show();
	// destroy the video player in case it's playing when we switch tabs
	j$("#profileListsContainERC > ul:first li > a").click(function(){destroyVideoPlayer();deselectSampleRow()});
});

/*
Show the image the user just clicked
*/
function showPreload(whatToShow) {
	j$(".preloadImageContainERC").hide();
	j$(whatToShow).show();
}

function destroyVideoPlayer () {
	// destroy the video player if it exists
	// clicking a tab would hide the video and stop playback, but
	// then it would start immediately when user clicked the video tab again... very annoying
	j$("#profileVideoPlayerERC").text("");
}

function deselectSampleRow() {
	// remove hiliting from all selected sample work rows
	j$('.sample-row').removeClass('selectedSampleERC')
}