var player=null;var current_video=null;var stats_video_file='';function playerReady(obj){player_id=obj.id;player=document.getElementById(player_id);addListeners();};function addListeners(){playlist=player.getPlaylist();if(playlist!=null){player.addViewListener("LOAD","videoLoad");player.addViewListener("PLAY","videoStatistics");}else{setTimeout("addListeners();",100);}}
function videoLoad(o){stats_video_file=decodeURIComponent(o['object']['file']);}
function videoStatistics(o){var cfg=player.getConfig();var id=cfg['id'];var state=cfg['state'];if(stats_video_file==''){stats_video_file=cfg['file'];}
$('#video_views').load('/mp',{mp:'html',html:'xmlhttp-video_statistics',action:'add_view',file:stats_video_file});return true;}
$(document).ready(function(){$(".library li").click(function(){$(".library li").removeClass();$(this).addClass('active');var video_anchor=$(this).find("a");parseLoad(video_anchor);player.sendEvent('PLAY','true');return false;});$(".maintabs a").click(function(){$(".library li").removeClass();var tabID=$(this).attr("href");var listItem=$(tabID).find("li:first");$(listItem).addClass('active');var video_anchor=$(listItem).find("a");parseLoad(video_anchor);return false;});function parseLoad(video_anchor){player.sendEvent('LOAD',{file:encodeURIComponent($(video_anchor).attr('video_src')),image:$(video_anchor).attr('video_image'),type:'video'});$('#video_title').html($(video_anchor).attr('video_name'));$('#video_desc').html($(video_anchor).attr('video_desc'));$('#video_views').load('/mp',{mp:'html',html:'xmlhttp-video_statistics',file:$(video_anchor).attr('video_src')});$('.video_ratings_comments').hide();$('#video_ratings_comments_'+$(video_anchor).attr('video_sku')).show();};function initializePlayer(){var firstItem=$('ul.library:first').find('li:first');$(firstItem).addClass('active');var relVars=$(firstItem).find("a").attr("rel");};initializePlayer();});