//<![CDATA[
var bookmark = {
    cur : 1,
    curIndex : 0,
    rbArray : mytabs,
    btArray : ['blog', 'list'],
    break_ : false,
    $ : function(id) {return document.getElementById(id);},
    switch_ : function(a, num, bottom) {
        if (num == this.cur) return true;
        if (bottom && this.$('rbLoadedId_' + num).style.display != 'none') return true;
        if (!bottom) {
            if (num == this.rbArray[0]) this.$('bookmarkUpId').className = 'upOff';
            else this.$('bookmarkUpId').className = 'up';
            if (num == this.rbArray[this.rbArray.length-1]) this.$('bookmarkDownId').className = 'downOff';
            else this.$('bookmarkDownId').className = 'down';
        }
        try {
            if (!bottom) this.cur = num;
            var i, td, curTD = 0, tr = a, div, node, nodefc;
            if (!this.break_) {
                if (num && (div = this.$('rbLoadedId_' + num))) {
                    if (bottom)
                        for (i = 0; i < this.btArray.length; i++)
                            this.$('rbLoadedId_' + this.btArray[i]).style.display = 'none';
                    else {
                        for (i = 0; i < this.rbArray.length; i++) {
                            this.$('rbLoadedId_' + this.rbArray[i]).style.display = 'none';
                            if (this.rbArray[i] == num) this.curIndex = i;
                        }
                    }
                    div.style.display = '';
                } else return false;
            }
            this.break_ = false;
            while (tr.parentNode && tr.nodeName.toLowerCase() != 'tr') {
                if (tr.nodeName.toLowerCase() == 'td') td = tr;
                tr = tr.parentNode;
            }
            for (i = 0; i < tr.cells.length; i++) {
                node = tr.cells[i];
                nodefc = node.firstChild.className;
                if (nodefc != 'lft' && nodefc != 'lft first' && nodefc != 'lst')
                    continue;
                if (node == td) {
                    node.className = 'act';
                    curTD = 1;
                } else {
                    node.className = curTD ? 'aftact' : 'pas';
                    curTD = 0;
                }
            }
            return false;
        } catch(e) {
            return false;
        }
    },
    new_ : null,
    old_ : null,
    wrap : null,
    timer : null,
    initMove : function() {
        try {
            this.break_ = true;
            var a = this.$('bs_' + this.rbArray[this.curIndex]);
            if (a == null)
                for (var i = this.curIndex; i >= 0; i--)
                    if ((a = this.$('bs_' + this.rbArray[i])) != null)
                        break;
            this.switch_(a, this.rbArray[this.curIndex]);
            this.new_ = this.$('rbLoadedId_' + this.cur);
            this.wrap = this.$('rbWrapperId');
            this.new_.style.display = '';
            this.wrap.style.overflow = 'hidden';
            var oldIE, ua = navigator.userAgent.toLowerCase();
            if (oldIE = ( ua.indexOf("opera") == -1 && ua.match(/msie (\d\.\d)/g) ))
                oldIE = parseFloat(RegExp.$1) < 8 ? true : false;
            this.wrap.style.height = (this.old_.offsetHeight + (oldIE ? 15 : 16)) + 'px';
        } catch(e) {}
    },
    move : function(y, startY, endY, increare) {
        var percent = y / (endY - startY);
        y = y + 10 + 15 * percent * (increare ? -1 : 1);
        clearTimeout(this.timer);
        this.timer = null;
        if (y > endY) {
            this.old_.style.display = 'none';
            this.wrap.style.overflow = 'visible';
            this.wrap.style.height = 'auto';
            if (increare) this.new_.style.marginTop = '0px';
            else this.old_.style.marginTop = '0px';
            this.new_ = this.old_ = null;
            return false;
        } else {
            if (increare) this.new_.style.marginTop = y + 'px';
            else this.old_.style.marginTop = (-1) * y + 'px';
            this.timer = setTimeout('bookmark.move('+y+', '+startY+', '+endY+', '+increare+')', 5);
        }
    },
    down : function(y, startY, endY) {
        if (this.new_ != null || this.old_ != null)
            return false;

        this.old_ = this.$('rbLoadedId_' + this.cur);
        this.curIndex++;
        this.$('bookmarkUpId').className = 'up';
        if (this.curIndex >= this.rbArray.length) {
            this.curIndex--;
            this.new_ = this.old_ = null;
            return false;
        } else if (this.curIndex == this.rbArray.length - 1)
            this.$('bookmarkDownId').className = 'downOff';
        else
            this.$('bookmarkDownId').className = 'down';
        this.initMove();
        this.move(0, 0, this.new_.offsetHeight - 20, 0);
        return false;
    },
    up : function() {
        if (this.new_ != null || this.old_ != null)
            return false;
        this.old_ = this.$('rbLoadedId_' + this.cur);
        this.curIndex--;
        this.$('bookmarkDownId').className = 'down';
        if (this.curIndex < 0) {
            this.curIndex = 0;
            this.new_ = this.old_ = null;
            return false;
        } else if (this.curIndex == 0)
            this.$('bookmarkUpId').className = 'upOff';
        else
            this.$('bookmarkUpId').className = 'up';
        this.initMove();
        this.new_.style.marginTop = ((-1)*this.new_.offsetHeight -24) + 'px';
        this.move((-1) * this.new_.offsetHeight, (-1) * this.new_.offsetHeight, 0, 1);
        return false;
    }
};
//]]>