﻿var obj;
  
function startMoorquee() 
{
    obj = new mooquee($('mooquee1'));
   
}
     


var NewsFeed = new Class({

         
    initialize: function(divVideosTabID, divCommentsTabID, divVideosContentID, divCommentsContentID, imgVideosID, imgCommentsID, activeID)
    {
        var classRef = this;
        this.divVideosContentID = divVideosContentID;
        this.divCommentsContentID = divCommentsContentID;
        
        this.divVideosTab = $(divVideosTabID);
        this.divCommentsTab = $(divCommentsTabID);   
                         
        this.imgVideos = $(imgVideosID);
        this.imgComments = $(imgCommentsID);                    
        this.divVideosContent = divVideosContentID;
        this.divCommentsContent = divCommentsContentID;                    
        
        this.activeID = activeID;   
        
        if (activeID == divVideosContentID)
        {
            $(classRef.divCommentsContent).className = "NotDisplay";
            $(classRef.divVideosContent).className = "Display";
            classRef.divVideosTab.className =  "float_left";
            classRef.divCommentsTab.className =  "hand float_left";
        }
        else
        {
            $(classRef.divCommentsContent).className = "Display";
            $(classRef.divVideosContent).className = "NotDisplay"; 
            classRef.divVideosTab.className =  "hand float_left";
            classRef.divCommentsTab.className =  "float_left";                                               
            classRef.imgVideos.src = classRef.imgVideos.src.replace("freshvideos_tab_on.gif","freshvideos_tab_off.gif");
            classRef.imgComments.src = classRef.imgComments.src.replace("latest_act_tab_off.gif","latest_act_tab_on.gif");
        }                   
        
        this.divVideosTab.addEvent('click', function(e){
            e = new Event(e);  
            if (classRef.activeID != classRef.divVideosContentID)
            {
                obj.stopMooquee();
                $(classRef.divVideosContent).className = "Display";
                $(classRef.divCommentsContent).className = "NotDisplay";
                classRef.divVideosTab.className =  "float_left";
                classRef.divCommentsTab.className =  "hand float_left";
                classRef.activeID = classRef.divVideosContentID;
                classRef.imgVideos.src = classRef.imgVideos.src.replace("freshvideos_tab_off.gif","freshvideos_tab_on.gif");
                classRef.imgComments.src = classRef.imgComments.src.replace("latest_act_tab_on.gif","latest_act_tab_off.gif");
                obj.setStartPos();
                obj.resumeMooquee();
               
            }
            e.stop();
        });
        
        this.divCommentsTab.addEvent('click', function(e){
            e = new Event(e);  
            if (classRef.activeID != classRef.divCommentsContentID)
            {
                obj.stopMooquee();
                $(classRef.divVideosContent).className = "NotDisplay";
                $(classRef.divCommentsContent).className = "Display";
                classRef.divVideosTab.className =  "hand float_left";
                classRef.divCommentsTab.className =  "float_left";                       
                classRef.activeID = classRef.divCommentsContentID;
                classRef.imgVideos.src = classRef.imgVideos.src.replace("freshvideos_tab_on.gif","freshvideos_tab_off.gif");
                classRef.imgComments.src = classRef.imgComments.src.replace("latest_act_tab_off.gif","latest_act_tab_on.gif");
                obj.setStartPos();
                obj.resumeMooquee();
                
            }
            e.stop();
        });
    }         
});