function dAnimation() {
    this.loadConfig();
    this.imgPreloader();
}

dAnimation.prototype.loadConfig = function() {
    /* Run-time values */
    this.inProgress = true; //While loading
    this.popUpInProgress = false; //While loading

    this.activeIndex = 0;
    this.newIndex;
    this.currentPopupId;

    this.delta = 8;
    this.deltaFast = 40;
    this.period = 30;

    this.popupWidth = 680;
    this.popupHeight = 357;

    this.popupCustomWidth = 437;
    this.popupCustomHeight = 499;

    this.popupProportion = this.popupHeight / this.popupWidth;
    this.delta2 = this.popupProportion * this.delta;
    this.deltaFast2 = this.popupProportion * this.deltaFast;

    this.popupCustomProportion = this.popupCustomHeight / this.popupCustomWidth;
    this.deltaCustom2 = this.popupCustomProportion * this.delta;
    this.deltaCustomFast2 = this.popupCustomProportion * this.deltaFast;


    this.popUpToOpen = false;

    /* center scrolls */
    this.centerScroller = new Array();
    this.centerScrollbar = new Array();

    /* popup scrolls */
    this.curScroller = new Array();
    this.curScrollbar = new Array();

    /* Names */
    this.holderId = 'holder';

    this.centerColumnId = 'center_c';
    this.rightColumnId = 'right_c';

    this.fadeDivName = 'fader';
}

dAnimation.prototype.imgPreloader = function() {
}

dAnimation.prototype.reset = function() {
    /* Holder */
    if (!this.holder || (typeof(this.holder) == 'undefined')) {
        this.holder = $(this.holderId);
    }

    if (this.holder && (typeof(this.holder) != 'undefined')) {
        this.holderWidth = this.holder.offsetWidth;
        this.holderHeight = this.holder.offsetHeight;
        //alert(this.holderWidth + ' x ' + this.holderHeight);
    } else {
        alert('ACHTUNG! No holder, take window!');
    }

    /* Current columns */
    this.centerColumn = $(this.centerColumnId + this.activeIndex);
    this.centerColumn.top0 = toInt(this.centerColumn.style.top);

    this.rightColumn = $(this.rightColumnId + this.activeIndex);
    this.rightColumn.top0 = toInt(this.rightColumn.style.top);

    /* New columns if needs */
    if ((this.newIndex >= 0) && (typeof(this.newIndex) != 'undefined') && (this.newIndex != this.activeIndex)) {
        this.newCenterColumn = $(this.centerColumnId + this.newIndex);
        this.newRightColumn = $(this.rightColumnId + this.newIndex);

        this.newCenterColumn.style.top = '-520px';
        this.newRightColumn.style.top = '-615px';
    }

    if (this.centerColumn && (typeof(this.centerColumn) != 'undefined') && this.rightColumn && (typeof(this.rightColumn) != 'undefined')) {
        //do nothing at now
    } else {
        alert('WARNING! There is some problems with your browser. Please, use Internet Explorer 6.0+ or FireFox 2.0+ or Opera 9+ to see this site correct!');
    }

    /* Fader */
    if (!this.fadeDiv || (typeof(this.fadeDiv) == 'undefined')) {
        this.fadeDiv = $(this.fadeDivName);
    }

    this.initCenterScroll(this.activeIndex);
}

dAnimation.prototype.initCenterScroll = function (id) {
    if ($('Scroller-c' + id) && $('Scrollbar-Container-c' + id)) {
        if (this.centerScroller[id] && (typeof(this.centerScroller[id]) != 'undefined')) {
            this.centerScroller[id] = null;
            this.centerScrollbar[id] = null;
            //this.centerScroller[id].reset($('Scroller-c' + id), $('Scroller-c' + id).offsetWidth, $('Scroller-c' + id).offsetHeight - 50);
            //this.centerScrollbar[id].reset($('Scrollbar-Container-c' + id), this.centerScroller[id], false, false, true);
        }

        this.centerScroller[id] = new jsScroller($('Scroller-c' + id), 20, 30);
        this.centerScrollbar[id] = new jsScrollbar($('Scrollbar-Container-c' + id), this.centerScroller[id], false, false, true);
    }
}

/* Tree 0  */
dAnimation.prototype.tree0 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree01 = $('tree01');
        this.tree01.done = false;

        this.tree02 = $('tree02');
        this.tree02.done = false;

        this.tree03 = $('tree03');
        this.tree03.done = false;

        this.brunch0 = $('brunch0');
        this.brunch0.done = false;

        this.flower01 = $('flower01');
        this.flower02 = $('flower02');
        this.flower03 = $('flower03');

        this.t0 = 0;

        this.tree0interv = setInterval('animator.tree0action()', this.period);
    }
}

dAnimation.prototype.tree0action = function() {
    var dt = new Date();

    if (this.tree01.offsetHeight < 314) {
        this.tree01.style.height = (this.tree01.offsetHeight + 5) + 'px';
    } else if (!this.tree01.done) {
        this.tree01.style.height = '384px';
        this.flower01.style.display = 'block';
        this.flower01.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree01.done = true;
    }

    if (this.tree02.offsetHeight < 490) {
        this.tree02.style.height = (this.tree02.offsetHeight + 18) + 'px';
    } else if (!this.tree02.done) {
        this.tree02.style.height = '560px';
        this.flower02.style.display = 'block';
        this.flower02.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree02.done = true;
    }

    if (this.tree03.offsetHeight < 352) {
        this.tree03.style.height = (this.tree03.offsetHeight + 7) + 'px';
    } else if (!this.tree03.done) {
        this.tree03.style.height = '422px';
        this.flower03.style.display = 'block';
        this.flower03.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree03.done = true;
    }

    if (this.brunch0.offsetWidth < 303) {
        if (this.t0 > 800) {
            this.brunch0.style.width = (this.brunch0.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch0.style.width = '303px';
        this.brunch0.done = true;
    }


    if ((this.tree01.done && this.tree02.done && this.tree03.done && this.brunch0.done) || (this.t0 >= 4000)) {
        window.clearInterval(this.tree0interv);
        this.inProgress = false;
    }

    this.t0 += this.period;
}

dAnimation.prototype.resetTree0 = function() {
    if (this.tree01 && (typeof(this.tree01) != 'undefined')) {
        this.tree01.style.height = '0';
        this.flower01.style.display = 'none';
        this.tree01.done = false;
    }

    if (this.tree02 && (typeof(this.tree02) != 'undefined')) {
        this.tree02.style.height = '0';
        this.flower02.style.display = 'none';
        this.tree02.done = false;
    }

    if (this.tree03 && (typeof(this.tree03) != 'undefined')) {
        this.tree03.style.height = '0';
        this.flower03.style.display = 'none';
        this.tree03.done = false;
    }

    if (this.brunch0 && (typeof(this.brunch0) != 'undefined')) {
        this.brunch0.style.width = '0';
        this.brunch0.done = false;
    }

    if ($('transformer0') && (typeof($('transformer0')) != 'undefined')) {
        $('transformer0').style.visibility = 'hidden';
    }
}

/* /Tree 0 */


/* Tree 1 */
dAnimation.prototype.tree1 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree11 = $('tree11');
        this.tree11.done = false;

        this.tree12 = $('tree12');
        this.tree12.done = false;

        this.tree13 = $('tree13');
        this.tree13.done = false;

        this.brunch1 = $('brunch1');
        this.brunch1.done = false;

        this.flower11 = $('flower11');
        this.flower12 = $('flower12');
        this.flower13 = $('flower13');

        this.t1 = 0;

        this.tree1interv = setInterval('animator.tree1action()', this.period);
    }
}

dAnimation.prototype.tree1action = function() {
    var dt = new Date();

    if (this.tree11.offsetHeight < 381) {
        this.tree11.style.height = (this.tree11.offsetHeight + 7) + 'px';
    } else if (!this.tree11.done) {
        this.tree11.style.height = '451px';
        this.flower11.style.display = 'block';
        this.flower11.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree11.done = true;
    }

    if (this.tree12.offsetHeight < 490) {
        this.tree12.style.height = (this.tree12.offsetHeight + 18) + 'px';
    } else if (!this.tree12.done) {
        this.tree12.style.height = '560px';
        this.flower12.style.display = 'block';
        this.flower12.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree12.done = true;
    }

    if (this.tree13.offsetHeight < 284) {
        this.tree13.style.height = (this.tree13.offsetHeight + 5) + 'px';
    } else if (!this.tree13.done) {
        this.tree13.style.height = '354px';
        this.flower13.style.display = 'block';
        this.flower13.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree13.done = true;
    }

    if (this.brunch1.offsetWidth < 303) {
        if (this.t1 > 800) {
            this.brunch1.style.width = (this.brunch1.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch1.style.width = '303px';
        this.brunch1.done = true;
    }


    if ((this.tree11.done && this.tree12.done && this.tree13.done && this.brunch1.done) || (this.t1 >= 4000)) {
        window.clearInterval(this.tree1interv);
        this.inProgress = false;
    }

    this.t1 += this.period;
}

dAnimation.prototype.resetTree1 = function() {
    if (this.tree11 && (typeof(this.tree11) != 'undefined')) {
        this.tree11.style.height = '0';
        this.flower11.style.display = 'none';
        this.tree11.done = false;
    }

    if (this.tree12 && (typeof(this.tree12) != 'undefined')) {
        this.tree12.style.height = '0';
        this.flower12.style.display = 'none';
        this.tree12.done = false;
    }

    if (this.tree13 && (typeof(this.tree13) != 'undefined')) {
        this.tree13.style.height = '0';
        this.flower13.style.display = 'none';
        this.tree13.done = false;
    }

    if (this.brunch1 && (typeof(this.brunch1) != 'undefined')) {
        this.brunch1.style.width = '0';
        this.brunch1.done = false;
    }

    if ($('transformer1') && (typeof($('transformer1')) != 'undefined')) {
        $('transformer1').style.visibility = 'hidden';
    }
}
/* /Tree 1 */


/* Tree 2 */
dAnimation.prototype.tree2 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree21 = $('tree21');
        this.tree21.done = false;

        this.tree22 = $('tree22');
        this.tree22.done = false;

        this.tree23 = $('tree23');
        this.tree23.done = false;

        this.brunch2 = $('brunch2');
        this.brunch2.done = false;

        this.flower21 = $('flower21');
        this.flower22 = $('flower22');
        this.flower23 = $('flower23');

        this.t2 = 0;

        this.tree2interv = setInterval('animator.tree2action()', this.period);
    }
}

dAnimation.prototype.tree2action = function() {
    var dt = new Date();

    if (this.tree21.offsetHeight < 296) {
        this.tree21.style.height = (this.tree21.offsetHeight + 5) + 'px';
    } else if (!this.tree21.done) {
        this.tree21.style.height = '366px';
        this.flower21.style.display = 'block';
        this.flower21.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree21.done = true;
    }

    if (this.tree22.offsetHeight < 490) {
        this.tree22.style.height = (this.tree22.offsetHeight + 18) + 'px';
    } else if (!this.tree22.done) {
        this.tree22.style.height = '560px';
        this.flower22.style.display = 'block';
        this.flower22.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree22.done = true;
    }

    if (this.tree23.offsetHeight < 386) {
        this.tree23.style.height = (this.tree23.offsetHeight + 7) + 'px';
    } else if (!this.tree23.done) {
        this.tree23.style.height = '456px';
        this.flower23.style.display = 'block';
        this.flower23.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree23.done = true;
    }

    if (this.brunch2.offsetWidth < 303) {
        if (this.t2 > 800) {
            this.brunch2.style.width = (this.brunch2.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch2.style.width = '303px';
        this.brunch2.done = true;
    }


    if ((this.tree21.done && this.tree22.done && this.tree23.done && this.brunch2.done) || (this.t2 >= 4000)) {
        window.clearInterval(this.tree2interv);
        this.inProgress = false;
    }

    this.t2 += this.period;
}

dAnimation.prototype.resetTree2 = function() {
    if (this.tree21 && (typeof(this.tree21) != 'undefined')) {
        this.tree21.style.height = '0';
        this.flower21.style.display = 'none';
        this.tree21.done = false;
    }

    if (this.tree22 && (typeof(this.tree22) != 'undefined')) {
        this.tree22.style.height = '0';
        this.flower22.style.display = 'none';
        this.tree22.done = false;
    }

    if (this.tree23 && (typeof(this.tree23) != 'undefined')) {
        this.tree23.style.height = '0';
        this.flower23.style.display = 'none';
        this.tree23.done = false;
    }

    if (this.brunch2 && (typeof(this.brunch2) != 'undefined')) {
        this.brunch2.style.width = '0';
        this.brunch2.done = false;
    }

    if ($('transformer2') && (typeof($('transformer2')) != 'undefined')) {
        $('transformer2').style.visibility = 'hidden';
    }
}
/* /Tree 2 */


/* Tree 3  */
dAnimation.prototype.tree3 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree31 = $('tree31');
        this.tree31.done = false;

        this.tree32 = $('tree32');
        this.tree32.done = false;

        this.tree33 = $('tree33');
        this.tree33.done = false;

        this.brunch3 = $('brunch3');
        this.brunch3.done = false;

        this.flower31 = $('flower31');
        this.flower32 = $('flower32');
        this.flower33 = $('flower33');

        this.t3 = 0;

        this.tree3interv = setInterval('animator.tree3action()', this.period);
    }
}

dAnimation.prototype.tree3action = function() {
    var dt = new Date();

    if (this.tree31.offsetHeight < 327) {
        this.tree31.style.height = (this.tree31.offsetHeight + 7) + 'px';
    } else if (!this.tree31.done) {
        this.tree31.style.height = '397px';
        this.flower31.style.display = 'block';
        this.flower31.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree31.done = true;
    }

    if (this.tree32.offsetHeight < 490) {
        this.tree32.style.height = (this.tree32.offsetHeight + 15) + 'px';
    } else if (!this.tree32.done) {
        this.tree32.style.height = '560px';
        this.flower32.style.display = 'block';
        this.flower32.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree32.done = true;
    }

    if (this.tree33.offsetHeight < 387) {
        this.tree33.style.height = (this.tree33.offsetHeight + 5) + 'px';
    } else if (!this.tree33.done) {
        this.tree33.style.height = '457px';
        this.flower33.style.display = 'block';
        this.flower33.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree33.done = true;
    }

    if (this.brunch3.offsetWidth < 303) {
        if (this.t3 > 800) {
            this.brunch3.style.width = (this.brunch3.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch3.style.width = '303px';
        this.brunch3.done = true;
    }


    if ((this.tree31.done && this.tree32.done && this.tree33.done && this.brunch3.done) || (this.t3 >= 4000)) {
        window.clearInterval(this.tree3interv);
        this.inProgress = false;
    }

    this.t3 += this.period;
}

dAnimation.prototype.resetTree3 = function() {
    if (this.tree31 && (typeof(this.tree31) != 'undefined')) {
        this.tree31.style.height = '0';
        this.flower31.style.display = 'none';
        this.tree31.done = false;
    }

    if (this.tree32 && (typeof(this.tree32) != 'undefined')) {
        this.tree32.style.height = '0';
        this.flower32.style.display = 'none';
        this.tree32.done = false;
    }

    if (this.tree33 && (typeof(this.tree33) != 'undefined')) {
        this.tree33.style.height = '0';
        this.flower33.style.display = 'none';
        this.tree33.done = false;
    }

    if (this.brunch3 && (typeof(this.brunch3) != 'undefined')) {
        this.brunch3.style.width = '0';
        this.brunch3.done = false;
    }

    if ($('transformer3') && (typeof($('transformer3')) != 'undefined')) {
        $('transformer3').style.visibility = 'hidden';
    }
}

/* /Tree 3 */

/* Tree 4 */
dAnimation.prototype.tree4 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree41 = $('tree41');
        this.tree41.done = false;

        this.tree42 = $('tree42');
        this.tree42.done = false;

        this.tree43 = $('tree43');
        this.tree43.done = false;

        this.brunch4 = $('brunch4');
        this.brunch4.done = false;

        this.flower41 = $('flower41');
        this.flower42 = $('flower42');
        this.flower43 = $('flower43');

        this.t4 = 0;

        this.tree4interv = setInterval('animator.tree4action()', this.period);
    }
}

dAnimation.prototype.tree4action = function() {
    var dt = new Date();

    if (this.tree41.offsetHeight < 319) {
        this.tree41.style.height = (this.tree41.offsetHeight + 5) + 'px';
    } else if (!this.tree41.done) {
        this.tree41.style.height = '389px';
        this.flower41.style.display = 'block';
        this.flower41.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree41.done = true;
    }

    if (this.tree42.offsetHeight < 490) {
        this.tree42.style.height = (this.tree42.offsetHeight + 18) + 'px';
    } else if (!this.tree42.done) {
        this.tree42.style.height = '560px';
        this.flower42.style.display = 'block';
        this.flower42.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree42.done = true;
    }

    if (this.tree43.offsetHeight < 384) {
        this.tree43.style.height = (this.tree43.offsetHeight + 7) + 'px';
    } else if (!this.tree43.done) {
        this.tree43.style.height = '454px';
        this.flower43.style.display = 'block';
        this.flower43.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree43.done = true;
    }

    if (this.brunch4.offsetWidth < 303) {
        if (this.t4 > 800) {
            this.brunch4.style.width = (this.brunch4.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch4.style.width = '303px';
        this.brunch4.done = true;
    }


    if ((this.tree41.done && this.tree42.done && this.tree43.done && this.brunch4.done) || (this.t4 >= 4000)) {
        window.clearInterval(this.tree4interv);
        this.inProgress = false;
    }

    this.t4 += this.period;
}

dAnimation.prototype.resetTree4 = function() {
    if (this.tree41 && (typeof(this.tree41) != 'undefined')) {
        this.tree41.style.height = '0';
        this.flower41.style.display = 'none';
        this.tree41.done = false;
    }

    if (this.tree42 && (typeof(this.tree42) != 'undefined')) {
        this.tree42.style.height = '0';
        this.flower42.style.display = 'none';
        this.tree42.done = false;
    }

    if (this.tree43 && (typeof(this.tree43) != 'undefined')) {
        this.tree43.style.height = '0';
        this.flower43.style.display = 'none';
        this.tree43.done = false;
    }

    if (this.brunch4 && (typeof(this.brunch4) != 'undefined')) {
        this.brunch4.style.width = '0';
        this.brunch4.done = false;
    }

    if ($('transformer4') && (typeof($('transformer4')) != 'undefined')) {
        $('transformer4').style.visibility = 'hidden';
    }
}
/* /Tree 4 */


/* Tree 5 */
dAnimation.prototype.tree5 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree51 = $('tree51');
        this.tree51.done = false;

        this.tree52 = $('tree52');
        this.tree52.done = false;

        this.tree53 = $('tree53');
        this.tree53.done = false;

        this.brunch5 = $('brunch5');
        this.brunch5.done = false;

        this.flower51 = $('flower51');
        this.flower52 = $('flower52');
        this.flower53 = $('flower53');

        this.t5 = 0;

        this.tree5interv = setInterval('animator.tree5action()', this.period);
    }
}

dAnimation.prototype.tree5action = function() {
    var dt = new Date();

    if (this.tree51.offsetHeight < 388) {
        this.tree51.style.height = (this.tree51.offsetHeight + 5) + 'px';
    } else if (!this.tree51.done) {
        this.tree51.style.height = '458px';
        this.flower51.style.display = 'block';
        this.flower51.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree51.done = true;
    }

    if (this.tree52.offsetHeight < 490) {
        this.tree52.style.height = (this.tree52.offsetHeight + 18) + 'px';
    } else if (!this.tree52.done) {
        this.tree52.style.height = '560px';
        this.flower52.style.display = 'block';
        this.flower52.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree52.done = true;
    }

    if (this.tree53.offsetHeight < 354) {
        this.tree53.style.height = (this.tree53.offsetHeight + 7) + 'px';
    } else if (!this.tree53.done) {
        this.tree53.style.height = '424px';
        this.flower53.style.display = 'block';
        this.flower53.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree53.done = true;
    }

    if (this.brunch5.offsetWidth < 303) {
        if (this.t5 > 800) {
            this.brunch5.style.width = (this.brunch5.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch5.style.width = '303px';
        this.brunch5.done = true;
    }


    if ((this.tree51.done && this.tree52.done && this.tree53.done && this.brunch5.done) || (this.t5 >= 4000)) {
        window.clearInterval(this.tree5interv);
        this.inProgress = false;
    }

    this.t5 += this.period;
}

dAnimation.prototype.resetTree5 = function() {
    if (this.tree51 && (typeof(this.tree51) != 'undefined')) {
        this.tree51.style.height = '0';
        this.flower51.style.display = 'none';
        this.tree51.done = false;
    }

    if (this.tree52 && (typeof(this.tree52) != 'undefined')) {
        this.tree52.style.height = '0';
        this.flower52.style.display = 'none';
        this.tree52.done = false;
    }

    if (this.tree53 && (typeof(this.tree53) != 'undefined')) {
        this.tree53.style.height = '0';
        this.flower53.style.display = 'none';
        this.tree53.done = false;
    }

    if (this.brunch5 && (typeof(this.brunch5) != 'undefined')) {
        this.brunch5.style.width = '0';
        this.brunch5.done = false;
    }

    if ($('transformer5') && (typeof($('transformer5')) != 'undefined')) {
        $('transformer5').style.visibility = 'hidden';
    }
}
/* /Tree 5 */


/* Tree 6 */
dAnimation.prototype.tree6 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree61 = $('tree61');
        this.tree61.done = false;

        this.tree62 = $('tree62');
        this.tree62.done = false;

        this.tree63 = $('tree63');
        this.tree63.done = false;

        this.brunch6 = $('brunch6');
        this.brunch6.done = false;

        this.flower61 = $('flower61');
        this.flower62 = $('flower62');
        this.flower63 = $('flower63');

        this.t6 = 0;

        this.tree6interv = setInterval('animator.tree6action()', this.period);
    }
}

dAnimation.prototype.tree6action = function() {
    var dt = new Date();

    if (this.tree61.offsetHeight < 383) {
        this.tree61.style.height = (this.tree61.offsetHeight + 7) + 'px';
    } else if (!this.tree61.done) {
        this.tree61.style.height = '453px';
        this.flower61.style.display = 'block';
        this.flower61.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree61.done = true;
    }

    if (this.tree62.offsetHeight < 490) {
        this.tree62.style.height = (this.tree62.offsetHeight + 18) + 'px';
    } else if (!this.tree62.done) {
        this.tree62.style.height = '560px';
        this.flower62.style.display = 'block';
        this.flower62.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree62.done = true;
    }

    if (this.tree63.offsetHeight < 289) {
        this.tree63.style.height = (this.tree63.offsetHeight + 5) + 'px';
    } else if (!this.tree63.done) {
        this.tree63.style.height = '359px';
        this.flower63.style.display = 'block';
        this.flower63.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree63.done = true;
    }

    if (this.brunch6.offsetWidth < 303) {
        if (this.t6 > 800) {
            this.brunch6.style.width = (this.brunch6.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch6.style.width = '303px';
        this.brunch6.done = true;
    }


    if ((this.tree61.done && this.tree62.done && this.tree63.done && this.brunch6.done) || (this.t6 >= 4000)) {
        window.clearInterval(this.tree6interv);
        this.inProgress = false;
    }

    this.t6 += this.period;
}

dAnimation.prototype.resetTree6 = function() {
    if (this.tree61 && (typeof(this.tree61) != 'undefined')) {
        this.tree61.style.height = '0';
        this.flower61.style.display = 'none';
        this.tree61.done = false;
    }

    if (this.tree62 && (typeof(this.tree62) != 'undefined')) {
        this.tree62.style.height = '0';
        this.flower62.style.display = 'none';
        this.tree62.done = false;
    }

    if (this.tree63 && (typeof(this.tree63) != 'undefined')) {
        this.tree63.style.height = '0';
        this.flower63.style.display = 'none';
        this.tree63.done = false;
    }

    if (this.brunch6 && (typeof(this.brunch6) != 'undefined')) {
        this.brunch6.style.width = '0';
        this.brunch6.done = false;
    }

    if ($('transformer6') && (typeof($('transformer6')) != 'undefined')) {
        $('transformer6').style.visibility = 'hidden';
    }
}
/* /Tree 6 */

/* ========================================================================== */

/* Tree 7  */
dAnimation.prototype.tree7 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree71 = $('tree71');
        this.tree71.done = false;

        this.tree72 = $('tree72');
        this.tree72.done = false;

        this.tree73 = $('tree73');
        this.tree73.done = false;

        this.brunch7 = $('brunch7');
        this.brunch7.done = false;

        this.flower71 = $('flower71');
        this.flower72 = $('flower72');
        this.flower73 = $('flower73');

        this.t7 = 0;

        this.tree7interv = setInterval('animator.tree7action()', this.period);
    }
}

dAnimation.prototype.tree7action = function() {
    var dt = new Date();

    if (this.tree71.offsetHeight < 314) {
        this.tree71.style.height = (this.tree71.offsetHeight + 5) + 'px';
    } else if (!this.tree71.done) {
        this.tree71.style.height = '384px';
        this.flower71.style.display = 'block';
        this.flower71.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree71.done = true;
    }

    if (this.tree72.offsetHeight < 490) {
        this.tree72.style.height = (this.tree72.offsetHeight + 18) + 'px';
    } else if (!this.tree72.done) {
        this.tree72.style.height = '560px';
        this.flower72.style.display = 'block';
        this.flower72.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree72.done = true;
    }

    if (this.tree73.offsetHeight < 352) {
        this.tree73.style.height = (this.tree73.offsetHeight + 7) + 'px';
    } else if (!this.tree73.done) {
        this.tree73.style.height = '422px';
        this.flower73.style.display = 'block';
        this.flower73.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree73.done = true;
    }

    if (this.brunch7.offsetWidth < 303) {
        if (this.t7 > 800) {
            this.brunch7.style.width = (this.brunch7.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch7.style.width = '303px';
        this.brunch7.done = true;
    }


    if ((this.tree71.done && this.tree72.done && this.tree73.done && this.brunch7.done) || (this.t7 >= 4000)) {
        window.clearInterval(this.tree7interv);
        this.inProgress = false;
    }

    this.t7 += this.period;
}

dAnimation.prototype.resetTree7 = function() {
    if (this.tree71 && (typeof(this.tree71) != 'undefined')) {
        this.tree71.style.height = '0';
        this.flower71.style.display = 'none';
        this.tree71.done = false;
    }

    if (this.tree72 && (typeof(this.tree72) != 'undefined')) {
        this.tree72.style.height = '0';
        this.flower72.style.display = 'none';
        this.tree72.done = false;
    }

    if (this.tree73 && (typeof(this.tree73) != 'undefined')) {
        this.tree73.style.height = '0';
        this.flower73.style.display = 'none';
        this.tree73.done = false;
    }

    if (this.brunch7 && (typeof(this.brunch7) != 'undefined')) {
        this.brunch7.style.width = '0';
        this.brunch7.done = false;
    }

    if ($('transformer7') && (typeof($('transformer7')) != 'undefined')) {
        $('transformer7').style.visibility = 'hidden';
    }
}

/* /Tree 7 */

/* ========================================================================== */

/* Tree 8  */
dAnimation.prototype.tree8 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree81 = $('tree81');
        this.tree81.done = false;

        this.tree82 = $('tree82');
        this.tree82.done = false;

        this.tree83 = $('tree83');
        this.tree83.done = false;

        this.brunch8 = $('brunch8');
        this.brunch8.done = false;

        this.flower81 = $('flower81');
        this.flower82 = $('flower82');
        this.flower83 = $('flower83');

        this.t8 = 0;

        this.tree8interv = setInterval('animator.tree8action()', this.period);
    }
}

dAnimation.prototype.tree8action = function() {
    var dt = new Date();

    if (this.tree81.offsetHeight < 314) {
        this.tree81.style.height = (this.tree81.offsetHeight + 5) + 'px';
    } else if (!this.tree81.done) {
        this.tree81.style.height = '384px';
        this.flower81.style.display = 'block';
        this.flower81.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree81.done = true;
    }

    if (this.tree82.offsetHeight < 490) {
        this.tree82.style.height = (this.tree82.offsetHeight + 18) + 'px';
    } else if (!this.tree82.done) {
        this.tree82.style.height = '560px';
        this.flower82.style.display = 'block';
        this.flower82.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree82.done = true;
    }

    if (this.tree83.offsetHeight < 352) {
        this.tree83.style.height = (this.tree83.offsetHeight + 7) + 'px';
    } else if (!this.tree83.done) {
        this.tree83.style.height = '422px';
        this.flower83.style.display = 'block';
        this.flower83.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree83.done = true;
    }

    if (this.brunch8.offsetWidth < 303) {
        if (this.t8 > 800) {
            this.brunch8.style.width = (this.brunch8.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch8.style.width = '303px';
        this.brunch8.done = true;
    }


    if ((this.tree81.done && this.tree82.done && this.tree83.done && this.brunch8.done) || (this.t8 >= 4000)) {
        window.clearInterval(this.tree8interv);
        this.inProgress = false;
    }

    this.t8 += this.period;
}

dAnimation.prototype.resetTree8 = function() {
    if (this.tree81 && (typeof(this.tree81) != 'undefined')) {
        this.tree81.style.height = '0';
        this.flower81.style.display = 'none';
        this.tree81.done = false;
    }

    if (this.tree82 && (typeof(this.tree82) != 'undefined')) {
        this.tree82.style.height = '0';
        this.flower82.style.display = 'none';
        this.tree82.done = false;
    }

    if (this.tree83 && (typeof(this.tree83) != 'undefined')) {
        this.tree83.style.height = '0';
        this.flower83.style.display = 'none';
        this.tree83.done = false;
    }

    if (this.brunch8 && (typeof(this.brunch8) != 'undefined')) {
        this.brunch8.style.width = '0';
        this.brunch8.done = false;
    }

    if ($('transformer8') && (typeof($('transformer8')) != 'undefined')) {
        $('transformer8').style.visibility = 'hidden';
    }
}

/* /Tree 8 */


/* Tree 404  */
dAnimation.prototype.tree404 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree4041 = $('tree4041');
        this.tree4041.done = false;

        this.tree4042 = $('tree4042');
        this.tree4042.done = false;

        this.tree4043 = $('tree4043');
        this.tree4043.done = false;

        this.brunch404 = $('brunch404');
        this.brunch404.done = false;

        this.flower4041 = $('flower4041');
        this.flower4042 = $('flower4042');
        this.flower4043 = $('flower4043');

        this.t404 = 0;

        this.tree404interv = setInterval('animator.tree404action()', this.period);
    }
}

dAnimation.prototype.tree404action = function() {
    var dt = new Date();

    if (this.tree4041.offsetHeight < 314) {
        this.tree4041.style.height = (this.tree4041.offsetHeight + 5) + 'px';
    } else if (!this.tree4041.done) {
        this.tree4041.style.height = '384px';
        this.flower4041.style.display = 'block';
        this.flower4041.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree4041.done = true;
    }

    if (this.tree4042.offsetHeight < 490) {
        this.tree4042.style.height = (this.tree4042.offsetHeight + 18) + 'px';
    } else if (!this.tree4042.done) {
        this.tree4042.style.height = '560px';
        this.flower4042.style.display = 'block';
        this.flower4042.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree4042.done = true;
    }

    if (this.tree4043.offsetHeight < 352) {
        this.tree4043.style.height = (this.tree4043.offsetHeight + 7) + 'px';
    } else if (!this.tree4043.done) {
        this.tree4043.style.height = '422px';
        this.flower4043.style.display = 'block';
        this.flower4043.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree4043.done = true;
    }

    if (this.brunch404.offsetWidth < 303) {
        if (this.t404 > 800) {
            this.brunch404.style.width = (this.brunch404.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch404.style.width = '303px';
        this.brunch404.done = true;
    }


    if ((this.tree4041.done && this.tree4042.done && this.tree4043.done && this.brunch404.done) || (this.t404 >= 4000)) {
        window.clearInterval(this.tree404interv);
        this.inProgress = false;
    }

    this.t404 += this.period;
}

dAnimation.prototype.resetTree404 = function() {
    if (this.tree4041 && (typeof(this.tree4041) != 'undefined')) {
        this.tree4041.style.height = '0';
        this.flower4041.style.display = 'none';
        this.tree4041.done = false;
    }

    if (this.tree4042 && (typeof(this.tree4042) != 'undefined')) {
        this.tree4042.style.height = '0';
        this.flower4042.style.display = 'none';
        this.tree4042.done = false;
    }

    if (this.tree4043 && (typeof(this.tree4043) != 'undefined')) {
        this.tree4043.style.height = '0';
        this.flower4043.style.display = 'none';
        this.tree4043.done = false;
    }

    if (this.brunch404 && (typeof(this.brunch404) != 'undefined')) {
        this.brunch404.style.width = '0';
        this.brunch404.done = false;
    }

    if ($('transformer404') && (typeof($('transformer404')) != 'undefined')) {
        $('transformer404').style.visibility = 'hidden';
    }
}

/* /Tree 404 */

/* ========================================================================== */

/* Tree 777  */
dAnimation.prototype.tree777 = function(forceAnimation) {
    if ((!this.inProgress) || forceAnimation) {
        this.inProgress = true;

        this.tree7771 = $('tree7771');
        this.tree7771.done = false;

        this.tree7772 = $('tree7772');
        this.tree7772.done = false;

        this.tree7773 = $('tree7773');
        this.tree7773.done = false;

        this.brunch777 = $('brunch777');
        this.brunch777.done = false;

        this.flower7771 = $('flower7771');
        this.flower7772 = $('flower7772');
        this.flower7773 = $('flower7773');

        this.t777 = 0;

        this.tree777interv = setInterval('animator.tree777action()', this.period);
    }
}

dAnimation.prototype.tree777action = function() {
    var dt = new Date();

    if (this.tree7771.offsetHeight < 314) {
        this.tree7771.style.height = (this.tree7771.offsetHeight + 5) + 'px';
    } else if (!this.tree7771.done) {
        this.tree7771.style.height = '384px';
        this.flower7771.style.display = 'block';
        this.flower7771.style.backgroundImage = 'url("/defa/i/flower1.gif?nocache=' + dt.getTime() + '")';
        this.tree7771.done = true;
    }

    if (this.tree7772.offsetHeight < 490) {
        this.tree7772.style.height = (this.tree7772.offsetHeight + 18) + 'px';
    } else if (!this.tree7772.done) {
        this.tree7772.style.height = '560px';
        this.flower7772.style.display = 'block';
        this.flower7772.style.backgroundImage = 'url("/defa/i/flower2.gif?nocache=' + dt.getTime() + '")';
        this.tree7772.done = true;
    }

    if (this.tree7773.offsetHeight < 352) {
        this.tree7773.style.height = (this.tree7773.offsetHeight + 7) + 'px';
    } else if (!this.tree7773.done) {
        this.tree7773.style.height = '422px';
        this.flower7773.style.display = 'block';
        this.flower7773.style.backgroundImage = 'url("/defa/i/flower3.gif?nocache=' + dt.getTime() + '")';
        this.tree7773.done = true;
    }

    if (this.brunch777.offsetWidth < 303) {
        if (this.t777 > 800) {
            this.brunch777.style.width = (this.brunch777.offsetWidth + 15) + 'px';
        }
    } else {
        this.brunch777.style.width = '303px';
        this.brunch777.done = true;
    }


    if ((this.tree7771.done && this.tree7772.done && this.tree7773.done && this.brunch777.done) || (this.t777 >= 4000)) {
        window.clearInterval(this.tree777interv);
        this.inProgress = false;
    }

    this.t777 += this.period;
}

dAnimation.prototype.resetTree777 = function() {
    if (this.tree7771 && (typeof(this.tree7771) != 'undefined')) {
        this.tree7771.style.height = '0';
        this.flower7771.style.display = 'none';
        this.tree7771.done = false;
    }

    if (this.tree7772 && (typeof(this.tree7772) != 'undefined')) {
        this.tree7772.style.height = '0';
        this.flower7772.style.display = 'none';
        this.tree7772.done = false;
    }

    if (this.tree7773 && (typeof(this.tree7773) != 'undefined')) {
        this.tree7773.style.height = '0';
        this.flower7773.style.display = 'none';
        this.tree7773.done = false;
    }

    if (this.brunch777 && (typeof(this.brunch777) != 'undefined')) {
        this.brunch777.style.width = '0';
        this.brunch777.done = false;
    }

    if ($('transformer777') && (typeof($('transformer777')) != 'undefined')) {
        $('transformer777').style.visibility = 'hidden';
    }
}

/* /Tree 777 */

/* ========================================================================== */


/* Page change */

dAnimation.prototype.changePage = function(index) {
    index = toInt(index);
    if (!this.inProgress) {
        this.inProgress = true;
        this.newIndex = index;

        /* Reorient new divs according window size */
        if (resizer && (typeof(resizer) != 'undefined') && (typeof(resizer.reset) == 'function')) {
            resizer.reset(this.newIndex);
        }

        if ($('secondmenu_' + this.activeIndex) && (typeof($('secondmenu_' + this.activeIndex)) != 'undefined')) {
            $('secondmenu_' + this.activeIndex).style.display = 'none';
        }
        if ($('mainmenu_lnk' + this.activeIndex) && (typeof($('mainmenu_lnk' + this.activeIndex)) != 'undefined')) {
            $('mainmenu_lnk' + this.activeIndex).className = '';
        }
        if ($('mainmenu_lnk' + this.newIndex) && (typeof($('mainmenu_lnk' + this.newIndex)) != 'undefined')) {
            $('mainmenu_lnk' + this.newIndex).className = 'selected';
        }
        if ($('secondmenu_' + this.newIndex) && (typeof($('secondmenu_' + this.newIndex)) != 'undefined')) {
            $('secondmenu_' + this.newIndex).style.display = 'block';
        }

        if ($('subscribe_left_c') && (typeof($('subscribe_left_c')) != 'undefined')) {
            if (this.newIndex == 5) {
                $('subscribe_left_c').style.display = 'block';
            } else {
                $('subscribe_left_c').style.display = 'none';
            }
        }

        /* Toggle for left fixed menu */
        if ((this.newIndex == 7) || (this.newIndex == 8)) {
            if ($('fixed_menu' + this.newIndex)) {
                $('fixed_menu' + this.newIndex).className = 'selected';
            }
        }
        if ((this.activeIndex == 7) || (this.activeIndex == 8)) {
            if ($('fixed_menu' + this.activeIndex)) {
                $('fixed_menu' + this.activeIndex).className = '';
            }
        }

        /* Toggle for corner. It have to be recoded in HTML */
        for (var i = 1; i <= 6; i++) {
            if ($('mainmenu_lnk' + i) && (i != index)) {
                $('mainmenu_lnk' + i).className = '';
            }
        }

        if (index > 0) {
            if ((index > 1) && (index <= 6)) {
                $('mainmenu_lnk' + (index - 1)).className = 'toggle_l';
            }
            if (index < 6) {
                $('mainmenu_lnk' + (index + 1)).className = 'toggle_r';
            }
        }

        if ($('left_corner_toggle')) {
            if (index == 1) {
                $('left_corner_toggle').style.display = 'block';
            } else {
                $('left_corner_toggle').style.display = 'none';
            }
        }

        if (this.newIndex != this.activeIndex) {
            eval('this.resetTree' + this.newIndex + '();');

            this.reset();
            this.initCenterScroll(this.newIndex);

            this.transformer = $('transformer' + this.activeIndex);
            if (this.transformer && (typeof(this.transformer) != 'undefined')) {
                this.transformer.style.height0 = this.transformer.offsetHeight;
                this.transformer.style.height = '0';
                this.transformer.style.visibility = 'visible';
                this.transformer.done = false;
            }

            if (this.newCenterColumn && (typeof(this.newCenterColumn) != 'undefined') && this.newRightColumn && (typeof(this.newRightColumn) != 'undefined')) {
                if (toInt(this.centerColumn.style.top) < (this.holderHeight + this.centerColumn.top0)) {
                    this.interv = setInterval('animator.changePageAction()', this.period);
                }
            } else {
                alert('WARNING! There is some problems with your browser. Please, use Internet Explorer 6.0+ or FireFox 2.0+ or Opera 9+ to see this site correct!');
            }
        } else {
            this.inProgress = false;
        }
    }
}

dAnimation.prototype.changePageAction = function() {
    if ((toInt(this.newRightColumn.style.top) + this.delta) < 0) {
        this.centerColumn.style.top = toInt(this.centerColumn.style.top) + this.delta + "px";
        this.rightColumn.style.top = toInt(this.rightColumn.style.top) + this.delta + "px";

        this.newCenterColumn.style.top = toInt(this.newCenterColumn.style.top) + this.delta + "px";
        this.newRightColumn.style.top = toInt(this.newRightColumn.style.top) + this.delta + "px";

        if (this.transformer && (typeof(this.transformer) != 'undefined')) {
            if (this.transformer.offsetHeight < this.transformer.style.height0) {
                this.transformer.style.height = toInt(this.transformer.style.height) + Math.round(0.7 * this.delta) + 'px';
            } else if (!this.transformer.done) {
                this.transformer.style.height = this.transformer.style.height0 + 'px';
                this.transformer.done = true;
                if ($('tree' + this.newIndex) && (typeof($('tree' + this.newIndex)) != 'undefined')) {
                    eval('this.tree' + this.newIndex + '(true);');
                }
            }
        }
    } else {
        this.newCenterColumn.style.top = this.centerColumn.top0 + 'px';
        this.newRightColumn.style.top = this.rightColumn.top0 + 'px';
        this.rightColumn.style.top = "-615px";
        //alert('done ('+this.centerColumn.style.top+')');
        this.activeIndex = this.newIndex;
        clearInterval(this.interv);
        //this.inProgress = false;
    }
}

/* /Page change */

/* Pop-up works */

dAnimation.prototype.showPopUp = function(id, fromUrlParser, noCache) {
    this.popUpInProgress = true;
    var container = $('fake');
    this.currentPopupId = id;
    var popup = $('popup_' + id);

    if (popup && (typeof(popup) != 'undefined') && (!noCache || (typeof(noCache) == 'undefined'))) {
        if (popup.style.display == 'none') {
            this.fadeOut();
            redrawMenu('', id);
            animator.showPopUpAction(id);
        }
    } else {
        if ($('secondmenu_real_lnk' + id)) {
            this.fadeOut();
            var lnk = $('secondmenu_real_lnk' + id).innerHTML;
            while (lnk.indexOf("&amp;") != -1) {
                lnk = lnk.replace("&amp;", '&');
            }

            if (/^(\d+)_/.test(id)) {
                var arr = /^(\d+)_/.exec(id);
                var iteration = toInt(arr[1]);
            } else {
                var iteration = 0;
            }

            lnk += ((lnk.indexOf('?') == -1) ? '?' : '&') + 'mode=bot_inner&popup_id=' + id + '&iteration=' + iteration;

            if (noCache && (typeof(noCache) != 'undefined')) {
                var curTime = new Date();
                lnk += '&nocache=' + curTime.getTime();
            }

            var ajaxRequest = new Ajax(lnk, {method: 'get', encoding: 'CP1251', postBody: '', onComplete:
                function(txt, xml) {
                    if (trim(txt) != 404) {
                        var div = document.createElement('div');
                        div.innerHTML = txt;
                        container.appendChild(div);
                        redrawMenu('', id);
                        animator.showPopUpAction(id);
                    } else {
                        animator.fadeIn();
                        animator.changePage(404);
                    }
                }
            });
            ajaxRequest.request();
        } else {
            var i, j, tmpId, tmpElem;
            var arrId = explode(id, '.');
            if (arrId && (typeof(arrId) != 'undefined') && (arrId.length > 0)) {
                for (i = 0; i < arrId.length; i++) {
                    tmpId = '';
                    for (j = 0; j <= i; j++) {
                        tmpId += ((j > 0) ? '.' : '') + arrId[j];
                    }

                    tmpElem = $('secondmenu_real_lnk' + tmpId);
                    if (tmpElem && (typeof(tmpElem) != 'undefined')) {
                        this.fadeOut();
                        var lnk = $('secondmenu_real_lnk' + tmpId).innerHTML;
                        while (lnk.indexOf("&amp;") != -1) {
                            lnk = lnk.replace("&amp;", '&');
                        }

                        if (/^(\d+)_/.test(tmpId)) {
                            var arr = /^(\d+)_/.exec(tmpId);
                            var iteration = toInt(arr[1]);

                            if (noCache && (typeof(noCache) != 'undefined')) {
                                var curTime = new Date();
                                tmpId += '.' + curTime.getTime();
                            }

                            //Trying to parse GET-params
                            var getStr = strSubdivision(id, tmpId);
                            var getParams = '';
                            if (getStr.length > 0) {
                                var re = new RegExp('^(\\.)?([a-z0-9_]+)\\.(\\d+)(\\.|$)', 'i');
                                var arr;
                                while (re.test(getStr)) {
                                    arr = re.exec(getStr);
                                    if (arr[3] && (typeof(arr[3]) != 'undefined') && (toInt(arr[3]) > 0)) {
                                        getParams += '&' + arr[2] + '=' + arr[3];
                                        tmpId += arr[0];
                                    }

                                    getStr = getStr.replace(arr[0], '');
                                }
                            }

                            //Making URL
                            lnk += ((lnk.indexOf('?') == -1) ? '?' : '&') + 'mode=bot_inner&popup_id=' + tmpId + '&iteration=' + iteration;

                            if (noCache && (typeof(noCache) != 'undefined')) {
                                var curTime = new Date();
                                lnk += '&nocache=' + curTime.getTime();
                            }

                            if (getParams.length > 0) {
                                lnk += getParams;
                            }

                            var ajaxRequest = new Ajax(lnk, {method: 'get', encoding: 'CP1251', postBody: '', onComplete:
                                function(txt, xml) {
                                    if (trim(txt) != 404) {
                                        var div = document.createElement('div');
                                        div.innerHTML = txt;
                                        container.appendChild(div);
                                        animator.currentPopupId = tmpId;
                                        redrawMenu('', tmpId);
                                        animator.showPopUpAction(tmpId);
                                    } else {
                                        animator.fadeIn();
                                        animator.changePage(404);
                                    }
                                }
                            });
                            ajaxRequest.request();
                        }

                        return;
                    }
                }
            }
        }
    }
}

dAnimation.prototype.showPopUpAction = function(id) {
    if (this.intervPopRes) {
        var tmp = setTimeout('animator.showPopUpAction("' + id + '")', 500);
        return;
    }
    var container = $('fake');
    var menu = $('menu');
    var popup = $('popup_' + id);

    if (popup && (typeof(popup) != 'undefined')) {
        if ($('secondmenu_lnk' + id) && (typeof($('secondmenu_lnk' + id)) != 'undefined')) {
            $E('a', 'secondmenu_lnk' + id).className = 'selected';
        }
        location.hash = '#page' + id;

        popup.style.display = 'block';

        this.maximizePopUp(popup, id);

        new Drag.Move('popup_' + id, {'container': container, 'droppables': null});

        popup.style.top = '130px';
        if (menu && (typeof(menu) != 'undefined') && toInt(menu.style.marginLeft) > 0) {
            popup.style.left = toInt(menu.style.marginLeft) + 'px';
        } else {
            popup.style.left = '250px';
        }
    }
}

dAnimation.prototype.hidePopUp = function(id, dontFade) {
    if (this.intervPopRes) {
        if (!dontFade || (typeof(dontFade) == 'undefined')) {
            dontFade = false;
        }
        var tmp = setTimeout('animator.hidePopUp("' + id + '", ' + dontFade + ')', 500);
        return;
    }
    var popup = $('popup_' + id);
    this.currentPopupId = null;

    if (popup && (typeof(popup) != 'undefined')) {
        redrawMenu(id, '');
        this.minimizePopUp(popup, id, dontFade);
        if ($('secondmenu_lnk' + id) && (typeof($('sec_lnk_' + id)) != 'undefined')) {
            $E('a', 'secondmenu_lnk' + id).className = '';
        }
        location.hash = '#page' + this.activeIndex;
    }
}

dAnimation.prototype.maximizePopUp = function(popup, id) {
    var useCustomSizes = false;

    //Custom sized popup
    if (/\[PopUpSize:(\d+)x(\d+)\]/.test(popup.innerHTML)) {
        var arr = /\[PopUpSize:(\d+)x(\d+)\]/.exec(popup.innerHTML);

        if ((arr[1] > 0) && (arr[2] > 0)) {
            this.popupCustomWidth = toInt(arr[1]);
            this.popupCustomHeight = toInt(arr[2]);

            this.popupCustomProportion = this.popupCustomHeight / this.popupCustomWidth;
            this.deltaCustom2 = this.popupCustomProportion * this.delta;
            this.deltaCustomFast2 = this.popupCustomProportion * this.deltaFast;

            useCustomSizes = true;
        }
    }

    this.intervPopRes = setInterval('animator.maximizePopUpAction("' + id + '", ' + useCustomSizes + ')', this.period - 10);
    this.hidePreloader();
}

dAnimation.prototype.maximizePopUpAction = function(id, useCustomSizes) {
    var popup = $('popup_' + id);

    if (useCustomSizes) {
        var maxW = this.popupCustomWidth;
        var maxH = this.popupCustomHeight;
        var deltaW = this.deltaFast;
        var deltaH = this.deltaCustomFast2;
    } else {
        var maxW = this.popupWidth;
        var maxH = this.popupHeight;
        var deltaW = this.deltaFast;
        var deltaH = this.deltaFast2;
    }

    if (popup && (typeof(popup) != 'undefined')) {
        if ((popup.offsetWidth + deltaW) < maxW) {
            popup.style.width = popup.offsetWidth + deltaW + 'px';
        } else {
            popup.style.width = maxW + 'px';
        }

        if ((popup.offsetHeight + deltaH) < maxH) {
            popup.style.height = popup.offsetHeight + deltaH + 'px';
        } else {
            popup.style.height = maxH + 'px';
        }

        if ((popup.offsetWidth >= maxW) && (popup.offsetHeight >= maxH)) {
            clearInterval(this.intervPopRes);
            this.intervPopRes = null;
            $('popup_' + id + '_content').style.display = 'block';
            $('popup_' + id + '_drag_content').style.display = 'block';
            this.popUpInProgress = false;
            this.initScroll(id);
        }
    } else {
        clearInterval(this.intervPopRes);
        this.intervPopRes = null;
        this.popUpInProgress = false;
        this.hidePreloader();
    }
}

dAnimation.prototype.minimizePopUp = function(popup, id, dontFade) {
    var useCustomSizes = false;

    //Custom sized popup
    if (/\[PopUpSize:(\d+)x(\d+)\]/.test(popup.innerHTML)) {
        var arr = /\[PopUpSize:(\d+)x(\d+)\]/.exec(popup.innerHTML);

        if ((arr[1] > 0) && (arr[2] > 0)) {
            this.popupCustomWidth = toInt(arr[1]);
            this.popupCustomHeight = toInt(arr[2]);

            this.popupCustomProportion = this.popupCustomHeight / this.popupCustomWidth;
            this.deltaCustom2 = this.popupCustomProportion * this.delta;
            this.deltaCustomFast2 = this.popupCustomProportion * this.deltaFast;

            useCustomSizes = true;
        }
    }


    $('popup_' + id + '_content').style.display = 'none';
    $('popup_' + id + '_drag_content').style.display = 'none';
    if (!dontFade || (typeof(dontFade) == 'undefined')) {
        dontFade = false;
    }
    this.intervPopRes = setInterval('animator.minimizePopUpAction("' + id + '", ' + dontFade + ', ' + useCustomSizes + ')', this.period - 10);
}

dAnimation.prototype.minimizePopUpAction = function(id, dontFade, useCustomSizes) {
    var popup = $('popup_' + id);

    if (useCustomSizes) {
        var deltaW = this.deltaFast;
        var deltaH = this.deltaCustomFast2;
    } else {
        var deltaW = this.deltaFast;
        var deltaH = this.deltaFast2;
    }

    if (popup && (typeof(popup) != 'undefined')) {
        if ((popup.offsetWidth - deltaW) > 0) {
            popup.style.width = popup.offsetWidth - deltaW + 'px';
        } else {
            popup.style.width = '0';
        }

        if ((popup.offsetHeight - deltaH) > 0) {
            popup.style.height = popup.offsetHeight - deltaH + 'px';
        } else {
            popup.style.height = '0';
        }

        if ((popup.offsetWidth <= 0) && (popup.offsetHeight <= 0)) {
            clearInterval(this.intervPopRes);
            this.intervPopRes = null;
            if (!dontFade || (typeof(dontFade) == 'undefined')) {
                this.fadeIn();
            }
            this.popUpInProgress = false;
            popup.style.display = 'none';
        }
    } else {
        clearInterval(this.intervPopRes);
        this.intervPopRes = null;
        this.popUpInProgress = false;
    }
}

dAnimation.prototype.initScroll = function(id) {
    if ($('Scroller-' + id) && (typeof($('Scroller-' + id)) != 'undefined')) {
        var i = this.curScroller.length;
        this.curScroller[i]  = new jsScroller($('Scroller-' + id), 100, 300);
        this.curScrollbar[i] = new jsScrollbar($('Scrollbar-Container-' + id), this.curScroller[i], false, false);
        $('Scroller-' + id).curIndex = i;
    }
}

dAnimation.prototype.fadeOut = function() {
    $(this.fadeDivName).style.display = 'block';
    this.showPreloader();
}

dAnimation.prototype.fadeIn = function() {
    $(this.fadeDivName).style.display = 'none';
    this.hidePreloader();
}

dAnimation.prototype.showPreloader = function() {
    if ($('preloader')) {
        $('preloader').style.display = 'block';
    }
}

dAnimation.prototype.hidePreloader = function() {
    if ($('preloader')) {
        $('preloader').style.display = 'none';
    }
}

dAnimation.prototype.hideOpenedPopUp = function(dontFade) {
    if (this.currentPopupId && (typeof(this.currentPopupId) != 'undefined')) {
        this.hidePopUp(this.currentPopupId, dontFade);
    }
}

/* /Pop-up works */

/* Toggles */
dAnimation.prototype.replaceSecondMenu = function() {
    if ($('menu')) {
        for (var i = 1; i <= 6; i++) {
            if ($('secondmenu_' + i)) {
                $('menu').appendChild($('secondmenu_' + i));
            }
        }
    }
}


dAnimation.prototype.proto = function() {
}

/* ========================================================================== */
var animator = new dAnimation();

window.onload = function() {
    animator.reset();
    animator.inProgress = false;
    eval('animator.tree' + animator.activeIndex + '();');
    if (animator.popUpToOpen) {
        animator.showPopUp(animator.popUpToOpen);
        animator.popUpToOpen = false;
    }
}

/* ========================================================================== */

/* Toggle */

var tmp1 = new Image();
tmp1.src = '/defa/i/menu/left_corner_toggle.gif';