/* 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 and audio player in case it's playing when we switch tabs
	j$("#profileTabsRowERC > ul > li > a").click(function(){destroyVideoPlayer();destroyAudioPlayer();deselectSampleRow()});
	
	// start the slike show
	j$('#profileImageSlideshowERC').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

});

/*
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 destroyAudioPlayer () {
	// destroy the Audio player if it exists
	j$("#profileAudioPlayerERC").text("");
}

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