<!--

// get the domain name
var dn = document.domain;

jQuery.noConflict();
jQuery(document).ready(function($) { // Code that uses jQuery's $ can follow here. This conflicts with prototype.
	
	// FLOWPLAYER - VERTICAL SCROLL PLAYER 
	$(function() { 
		
		// start scroll function
		if ($('.clips a').length <= 3) { // if there's 3 or less in the list
			
			// disable the  buttons
			// jQuery tools
			$('.up').addClass('disabled');
			$('.down').addClass('disabled'); 
			
		} else { // scroll the list. Circumventing jQuery tools
		
			// set the speed for the scroll
			scrollspd = 500;
		
			// get the position of the playlist wrapper
			trklistpos = $("div.clips").position();
			trklisttop = trklistpos.top;
			
			// get the height of the buttons to know how far to move
			btnheight = $('.clips a.first').height() + 1;
			
			// get the height of the list
			listheight = $("div.clips").height();
			
			// this is the maximum position the list should move
			maxypos = trklisttop - (btnheight * ($('.clips a').length - 3)); // -4 because array length starts at 0
				
			// clicking the scroll down button
			$('.down').click(
				function() {
				
					// get the position of the list div
					listpos = $("div.clips").position();
					listtop = listpos.top;				
									
					if (listtop > maxypos) {
						// still move the button
						$("div.clips").animate({
							top: '-='+(btnheight * 3)
						}, scrollspd, function() {
							// Animation complete.
						});
					}
				}
			);
			
			// clicking the scroll up button
			$('.up').click(
				function() {
								
					// get the position of the list div
					listpos = $("div.clips").position();
					listtop = listpos.top;				
					
					if (trklisttop > listtop) {
						// still move the button
						$("div.clips").animate({
							top: '+='+(btnheight * 3)
						}, scrollspd, function() {
							// Animation complete.
						});
					}
				}
			);		     
		} 
		
		// setup player 
		$f("vertplayer", "/includes/javascript/flowplayer-3.1.5/flowplayer-3.1.5.swf", { 
			clip: {baseUrl: 'http://' + dn + '/media/video'}  
			// use playlist plugin to enable playlist items work as movie clips 
		}).playlist("div.clips");  
			  
	});
	
});
//-->
