function VideoList(){
	var currentEventVideoSort = new Array();
	var currentPage = new Array();
	
    this.init = function(){
    	(function($) {
    		$('.videoListNextPage').click(function() {
    			this.showNextPage();
    			});
    	})(jQuery);
    }
    
	this.reloadVideos = function(id, where, sort, limit){
		(function($) {
			$('#'+id).slideUp('fast');
			
			if(sort) {
				currentEventVideoSort[id] = sort;
			}
			
			switch ( currentEventVideoSort[id] ) {
				case "RAND()": var sortClass = "sortRandom"; break;
				case "views DESC": var sortClass = "sortViews"; break;
				case "votes DESC": var sortClass = "sortVotes"; break;
			}
			

			$.post("/video-list-ajax", { order: currentEventVideoSort[id], where: where , limit: limit },
			   function(data){
				  $('#'+id).html(data);
				  $('#'+id+'Controls *').removeClass('active');
				  $('#'+id+'Controls .'+sortClass).addClass('active');
				  $('#'+id).slideDown('fast');
			    }
			);	
			
		})(jQuery);
	}

    var self = this;
}

var videoList = new VideoList();

(function($) {
	$(document).ready(function(){
		videoList.init();
	});

})(jQuery);
