footerClass = {
    pointsBlinkint : undefined,
    pointsBlinktimeout : undefined,
    init : function()
    {
        this.intiFootermenu();
        this.initPointmenu();
    },
    intiFootermenu : function()
    {

        $("#footermenu").icoLinkMenu({
            menuItems:[ {
                icoClass:	'',
                text:$.lng('global','terms'),
                link:		'javascript:homeClass.showTermsAndConditions();'
            },
            {
                icoClass:	'',
                text:$.lng('global','mylang')
            },
            {
                icoClass:	'',
                text:$.lng('global','help')
            },
            {
                icoClass:	'',
                text:$.lng('global','advertising')
            }],
            highlight:		'text',
            itemColor : 	'default',
            itemType:		'text',
            direction:		'horizontal'
        });
    },
    initPointmenu : function()
    {
        $("#pointsmenu").mouseover(function(){
            pointsClass.toggle();
        }).mouseout(function(){
            pointsClass.toggle();
        });

        $('#points').live('pointsChange',function(event){
            //console.log('points changed',event.activity,event.value);
            var displayPoints = event.total+' pt.';
            if(event.value){
                var valuesymbol = event.value > 0 ? '+' : '';
                displayPoints = '<span class="default">('+valuesymbol+event.value+') </span>'+displayPoints;
            }
            $("#pointsmenu").html(displayPoints);
            blinkinit();
        });
        
        function blinkinit(){
            if(this.pointsBlinkint)clearInterval(this.pointsBlinkint);
            if(this.pointsBlinktimeout) clearTimeout(this.pointsBlinktimeout);
            this.pointsBlinktimeout = setTimeout(stopblink, 1000);
            this.pointsBlinkint = setInterval(blink,100);
        }
        
        function blink(){
            $("#pointsmenu").toggle();
        }
        function stopblink(){
           clearInterval(this.pointsBlinkint);
           $("#pointsmenu span").remove();
           $("#pointsmenu").show();
        }

        clearTimeout(this.id);
        this.id = setTimeout('footerClass.calculateMinFooterWidth()', 100);
    },
    calculateMinFooterWidth : function(){
        var footerWidth = 50;
        $('#footer').children().each(function(index, child) {
            footerWidth += $(child).outerWidth();
        });
        $('#footer').css('min-width',footerWidth);
    }
};

