

$(document).ready(function() {
	
	
	$(".thumbs-container li a").hover(function(){
		$(".tooltip strong").html($(this).attr("title"));
		$(".tooltip p").html($(this).attr("rel"));
		
		$(".tooltip").css("top", ($(this).offset().top+59)+"px");
		$(".tooltip").css("left", $(this).offset().left+"px");
		
		$(".tooltip").show();
		
	}, function(){
		$(".tooltip").hide();
	})
		
	///////// V I D E O  T H U M B N A I L S
	
	var thumbCount = $(".video-thumbs li").length;
	var press = 0;
	
	/// make next inactive when thumbnails are less than 4
	
	if(thumbCount <= 4) {
		$(".video-thumbs .next").addClass("inactive");
	}
	
	/// set the first thumb initially active
	
	$(".video-thumbs li:first-child").addClass("active");
	
	/// Next Function
	
	$(".video-thumbs .next").click(function() {
		
		if(press < thumbCount-4) {
			
			$(".video-thumbs ul").animate({
				marginLeft:"-=109"
			}, 600, "easeOutCubic");
			
			press++;
			
			if(press >= 1) {
				$(".video-thumbs .prev").removeClass("inactive");
			}
			
			if(press == thumbCount-4) {
				$(".video-thumbs .next").addClass("inactive");
			}
		
		}
		
	});
	
	/// Previous Function
	
	$(".video-thumbs .prev").click(function() {
		
		if(press >= 1) {
		
			$(".video-thumbs ul").animate({
				marginLeft:"+=109"
			}, 600, "easeOutCubic");
			
			press--;
			
			if(press == 0) {
				$(".video-thumbs .prev").addClass("inactive");
			}
			
			if(press < thumbCount-4) {
				$(".video-thumbs .next").removeClass("inactive");
			}
		
		}
		
	});
	
	/// Set active thumbnails when clicked
	
	$(".video-thumbs li a").click(function() {
		$(".video-thumbs li").removeClass("active");
		
		// Load the video to the screen
		$(".video-container").html(showFlash($(this).attr("name")));
		///
		$(this).parent().addClass("active");
	});
	
	
	////////// A R T I S T  P R O F I L E
	
	/// Remove (-) dash on Ryan Cayabyab's Name
	
	$(".slider li:first-child .artist-card h1").text('Ryan Cayabyab');  
	$(".slider li:first-child .more").text('More About Ryan Cayabyab');

	var artistCount = $(".slider ul li").length;
	var artistPress = 0;
	
	/// Set previous arrow initially inactive
	
	$(".slider-wrapper .prev").addClass("inactive");
	
	/// Next Function
	
	$(".slider-wrapper .next").click(function() {
		
		if(artistPress <= artistCount-2) {
		
			$(".slider ul").animate({
				marginLeft:"-=665"
			}, 1000, "easeOutCubic");
			
			artistPress++;
			
			if(artistPress >= 1) {
				$(".slider-wrapper .prev").removeClass("inactive");
			}
			
			if(artistPress == artistCount-1) {
				$(".slider-wrapper .next").addClass("inactive");
			}
			
		}
		
	});
	
	/// Previous Function
	
	$(".slider-wrapper .prev").click(function() {
		
		if(artistPress >= 1) {
		
			$(".slider ul").animate({
				marginLeft:"+=665"
			}, 1000, "easeOutCubic");
			
			artistPress--;
			
			if(artistPress == 0) {
				$(".slider-wrapper .prev").addClass("inactive");
			}
			
			if(artistPress < artistCount-1) {
				$(".slider-wrapper .next").removeClass("inactive");
			}
		
		}
		
	});
	
	
	
});

function showFlash(videoFile) {
	htmlVal = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"514\" height=\"314\" id=\"FLVPlayer\">"+
		    	  "<param name=\"movie\" value=\""+APPNAME+"site/default/FLVPlayer_Progressive.swf\" />"+
		    	  "<param name=\"salign\" value=\"lt\" />"+
		    	  "<param name=\"quality\" value=\"high\" />"+
		    	  "<param name=\"scale\" value=\"noscale\" />"+
		    	  "<param name=\"wmode\" value=\"transparent\" />"+
		    	  "<param name=\"FlashVars\" value=\"&MM_ComponentVersion=1&skinName="+APPNAME+"site/default/Clear_Skin_3&streamName="+APPNAME+"site/default/videos/"+videoFile+"&autoPlay=true&autoRewind=false\" />"+
		    	  "<embed src=\""+APPNAME+"site/default/FLVPlayer_Progressive.swf\" flashvars=\"&MM_ComponentVersion=1&skinName="+APPNAME+"site/default/Clear_Skin_3&streamName="+APPNAME+"site/default/videos/"+videoFile+"&autoPlay=true&autoRewind=false\""+ 
		    	  " quality=\"high\" scale=\"noscale\" width=\"514\" height=\"314\" name=\"FLVPlayer\" salign=\"LT\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\""+ 
		    	  "wmode=\"transparent\" /></object>";
	return htmlVal;
}

