function Tab ( element_id, tab_tag_container, tab_delta_id ) 
{
    var timer;
    this.obj = null;
    var element_id = element_id;

    var use_link = true;
    
    if( tab_delta_id ) 		this.tab_delta_id = tab_delta_id ;
    if( tab_tag_container ) this.tab_tag_container = tab_tag_container ;
    
    var that = this;

    if( _( element_id ) ) 
	{ 
        var tab = _( element_id ).getElementsByTagName( this.tab_tag_element );
        for ( var i = this.tab_delta_id; i <= tab.length; i++ ) 
		{         
		    if( use_link == false ) 
			{
	            tab[i].onmouseover = function( e ) 	
				{
	                obj = this; 
    	            timer = setTimeout(that.timeCount, that.tab_timeout);
        	    }
	            tab[i].onmouseout = function( e ) 
				{
        	        clearTimeout(timer)
            	} 
		    } 
			else 
			{   
		        tab[i-1].onclick = function( e ) 
    		    {        
        		    that.obj = this;
            		var obj_link = that.obj.getElementsByTagName('a')[0];

		            obj_link.onclick = function (e) 
    		        {
        		        return false;
            		}

		        	that.timeCount();
	    	        return false;
    	    	}
			}
    	}

        this.timeCount = function () 
		{    
            if ( that.obj )
			{
                for( var i=that.tab_delta_id; i <= tab.length; i++ ) 
				{
                    tab[i-1].className = ""; 
                    _( element_id + that.tab_prefix_link + i ).className = '';
                    if( tab_tag_container ) 
					{
                        _( element_id + that.tab_block_div + i ).style.display = (i == that.obj.id) ? "block" : "none";
                    }
                }
                _( element_id + that.tab_prefix_link + that.obj.id ).parentNode.className = that.tab_css_current;


                if ( typeof(_('r')) == 'object' || typeof(_('c')) == 'object')
                {
                    if (element_id == 'calendar')
                    {

                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 0)
                        {
                            if (typeof(_('r')) == 'object')
                                _('r').style.display = "block";
                
                            if (typeof(_('c')) == 'object')
                                _('c').style.display = "none";
                        }

                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 1)
                        {
                            if (typeof(_('r')) == 'object')
                                _('r').style.display = "none";

                            if (typeof(_('c')) == 'object')
                                _('c').style.display = "block";
            
                        }
                     }   
                }

                if ( typeof(_('com')) == 'object' || typeof(_('search')) == 'object')
                {
                    if (element_id == 'tab')
                    {
                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 1)
                        {
                            if (typeof(_('com')) == 'object')
                                _('com').style.display = "block";

                            if (typeof(_('search')) == 'object')
                                _('search').style.display = "none";
                        }

                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 2)
                        {
                            if (typeof(_('com')) == 'object')
                                _('com').style.display = "none";

                            if (typeof(_('search')) == 'object')
                                _('search').style.display = "block";
                        }
                     }
                }

                if ( typeof(_('medals')) == 'object' )
                {
                    if (element_id == 'olimp')
                    {
                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 1)
                        {
                            if (typeof(_('medals')) == 'object')
                                _('medals').style.display = "block";
                        }

                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 2)
                        {
                            if (typeof(_('medals')) == 'object')
                            {
                                _('medals').style.display = "none";
                            }
                        }

                        if (_( element_id + that.tab_prefix_link + that.obj.id ).parentNode.id == 3)
                        {
                            if (typeof(_('medals')) == 'object')
                                _('medals').style.display = "none";
                        }
                     }
                }

                if( !tab_tag_container ) 
				{
                    var tabul = _( element_id + that.tab_prefix_ul ).getElementsByTagName( that.tab_tag_container );
                    for( var i=that.tab_delta_id; i<tabul.length; i++ ) 
					{
                        tabul[i].className = that.tab_css_base;
                    }
                    tabul[that.obj.id].className = that.tab_css_base + ' ' + that.tab_css_active;
                }
            }
            return false;
        }   
    }    
}

Tab.prototype = new Base();