//<!--
/************
This file is part of Genwi JS Lib.
All Rights Reserved.

Desc: brose.js. Controls ths tabs on play & read page.
Trunk Version.

************/

function BrowseFeed()
{
    this.aTabLinks = {'rel':'feedType','dis':'feedComments'};
    this.aTabLIs = {'rel':'li_related','dis':'li_discuss'};
    this.aTabs = {};
    this.aLayers = {};
    this.aRelLinks = {};
    this.oDisLyr = this.oRelLyr =   this.oMoreItemLyr = this.oRelTab = 
    this.oDisTab = this.sCurTab = this.sCurRelLink = this.oDesc = null;    
    this.sFullDesc = this.sCollDesc = null;
    this.bInitialized = false;
        
    this.init = function()
    {
        if (sPageName.is('play'))
        {
            var oDesc = this.oDesc = new HTMLLayer('description');
            if (oDesc.elem)
            {
                var s = this.sFullDesc = oDesc.getValue() + '&nbsp;<span class="ulink3"><a href="#" onclick="oBF.toggleDesc(false);return false;">hide</a></span>';
                if (s.length > 175)
                {
                    this.sCollDesc = s.substr(0,175) + '&nbsp;<span class="ulink3"><a href="#" onclick="oBF.toggleDesc(true);return false;">more</a></span>';
                    oDesc.setValue(this.sCollDesc);
                }
            }
        }
        
        
        this.bInitialized = true;
    }
    
    this.toggleDesc = function(pToggle)
    {
        this.oDesc.setValue(pToggle ? this.sFullDesc : this.sCollDesc);
        
        if (!pToggle)
            if (document.documentElement)
                document.documentElement.scrollTop = 0 + 'px';
            else
                document.body.scrollTop = 0 + 'px';
        
    }
}

var oBF = new BrowseFeed();
var sPageName = 'browse';
window.onload = function()
{
    if (!oBF.bInitialized)
        oBF.init();
}
