(function($) {
    $(document).ready(
        function() {
			$(".tabs").tabs().css('visibility', 'visible');
			
			var players = $('a#player');
			if (players.length == 0)
				players = $('a.player');

			players.each(
				function() {
					var i = $(this);
					var thumbnail = i.attr('thumbnail')
					var autoplay = !i.hasClass('no-autoplay');
										
					i.flowplayer(
						"/_layouts/cr/flowplayer/flowplayer-3.1.2.swf",
						{
							clip: {
								autoPlay: autoplay
							},
							onStart: 
								function() {
									$('img', i).hide();
									$('object', i).removeClass('hidden-off-screen');
								}
						}
					);

					if (thumbnail != null && thumbnail.length > 0) {
						i.prepend('<img src="' + thumbnail + '" style="border: 0;" border="0" />');
						$('object', i).addClass('hidden-off-screen');
					}
				}
			)
        }
    );
})(jQuery);

function item_exists(lst, val) {
    for (var i = 0; i < lst.length; i++) {
        if (lst[i] == val) return true;
    }
    return false;
}
