var video = new Array;
var num_videos = 0;
var inTransition = false;

$('.flv').livequery(function(){			
	var container_id = $(this).parent('div').attr('id');
	video[num_videos] = new SWFObject("/swf/player.swf","ply","500","325","9","#FFFFFF");
	video[num_videos].addParam("allowfullscreen","true");
	video[num_videos].addParam("allownetworking","all");
	video[num_videos].addParam("allowscriptaccess","always");
	video[num_videos].addParam("flashvars","file="+$(this).attr('href'));
	video[num_videos].write(container_id);
	num_videos++;
});

$(document).ready(function(){
		
	var dropdown = 'div#dropdown';

	$(dropdown + ' .tab a').hover(function(){
		if(!inTransition){
			inTransition = true;
			if($(this).hasClass('expanded')){
				closeDropdown();
				$(this).removeClass('expanded');
			} else {
				openDropdown();
				$(this).addClass('expanded');
			}
		}
	},function(){});
	
	function openDropdown() {
		$(dropdown).animate({top:'0px'},1000,'easeOutCubic',function(){inTransition=false});
	}

	function closeDropdown() {
		$(dropdown).animate({top:'-403px'},1000,'easeInCubic',function(){inTransition=false});
	}
	
	
});

	var colorInterval = 2000;

	function spectrum(){
		var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
		$('div#dropdown .tab a').animate( { color: hue }, colorInterval);
	}
	
	//spectrum();
	setInterval("spectrum()", colorInterval);	
