function videos( url, id )
{
        this.url = url;
        this.id = id;

        this.req = new Object();
        
        this.showVideos = function( type, page )
        {
                if( !type ) return false;
                $( "#recently_added_videos" ).removeClass( 'cur' );
                $( "#most_popular_videos" ).removeClass( 'cur' );
                $( "#top_rated_videos" ).removeClass( 'cur' );
                $( "#most_discussed_videos" ).removeClass( 'cur' );
                $( "#top_favourites_videos" ).removeClass( 'cur' );
                $( "#runtime_videos" ).removeClass( 'cur' );

                $( "#recently_added_videos_title" ).hide();
                $( "#most_popular_videos_title" ).hide();
                $( "#top_rated_videos_title" ).hide();
                $( "#most_discussed_videos_title" ).hide();
                $( "#top_favourites_videos_title" ).hide();
                $( "#runtime_videos_title" ).hide();

                $( "#" + type + "_videos" ).addClass("cur");
                $( "#" + type + "_videos_title" ).show();
                sendRequest( this.req,
                             this.url,
                             {type: type, id: this.id, page: page},
                             function()
                             {
                                $( "#ajax_loading" ).show();
                             },
                             function( data )
                             {
                                $( "#ajax_loading" ).hide();
                                $( "#no_videos" ).hide();
                                videos.displayVideos( data );
                             },
                             function( data )
                             {
                                $( "#ajax_loading" ).hide();
                                //showMessageFromDiv( "error_loading_videos" );
                             });
                return false;
        }

        this.displayVideos = function( data )
        {
                if( !data ) 
                {
                        $( "#no_videos" ).show();
                        $( "#pagination" ).empty();
                        return false;
                }
                if( !data.videos )
                {
                        $( "#no_videos" ).show();
                        $("#pagination").empty();
                        return false;
                }
                $( "#videos_container" ).html( '' );
                $( "#videos_container" ).html( data.videos );
                $("#pagination").empty();
                $("#pagination").html( data.pagination );
                return true;
        }
}
