var playVideo = false;
var flashvars = {};
flashvars.hl="en_US";
flashvars.fs="1";

var params = {};
params.movie="http://www.youtube.com/v/WVBNHWtzzpw&hl=en_US&fs=1&";
params.allowFullScreen="true";
params.allowScriptAccess="always";
params.wmode="transparent";
params.hl="en_US";
params.fs="1";


var attributes = {};
attributes.id="videoplayer";
attributes.name="videoplayer";

var loadVideo = function(vidCode,w,h,id){
	if(!id) {
	 id = 'videoplayer';
	}
	if(!w) { 
		w = 480;
	}
	if(!h) { 
		h = 385;
	}
	swfobject.embedSWF("http://www.youtube.com/v/"+vidCode+"?enablejsapi=1&playerapiid=ytplayer", id, w, h, "9.0.0", "expressInstall.swf",flashvars, params, attributes);
}

var loadNewVideo = function(e,refId,vidCode){
	$('.videothumbs div').removeClass('active');
	$(e).addClass('active');
	playVideo = true;
	loadVideo(vidCode);
	vidTitle = $(e).attr('title');
	$('#videotitle').html(vidTitle);
	$('#videoaltcontent').load('/community/includes/video-sidebar/',{refid:refId, ajax:true});
}


//Default callback for yt player
var onYouTubePlayerReady = function(playerId) {
	ytplayer = document.getElementById("videoplayer");
		$('#embedfield').val(ytplayer.getVideoEmbedCode());
		if(playVideo == true) {
			ytplayer.playVideo();
		}
}

var switchVidCats = function(e,id){
	$('.headertab').removeClass('active');
	$(e).parent('div').addClass('active');
	$('.videothumbs').removeClass('active');
	$('#'+id).addClass('active');
}






