var h = new Hash({});
h.set('setAgeClose', 'hideSSBlock');
h.set('setDlndClose', 'reloadPage');

_hasOnclose = '';


function getDimensions() {
	var xs, vs, ww, wh, pw, ph;
		
	if(window.innerHeight && window.scrollMaxY) {  
		xs = window.innerWidth + window.scrollMaxX;
		vs = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xs = document.body.scrollWidth;
		vs = document.body.scrollHeight;
	} else {
		xs = document.body.offsetWidth;
		vs = document.body.offsetHeight;
	}
	if(self.innerHeight) {
		if(document.documentElement.clientWidth){
			ww = document.documentElement.clientWidth; 
		} else {
			ww = self.innerWidth;
		}
		wh = self.innerHeight;

	} else if (document.documentElement && document.documentElement.clientHeight) {
		ww = document.documentElement.clientWidth;
		wh = document.documentElement.clientHeight;
	} else if (document.body) {
		ww = document.body.clientWidth;
		wh = document.body.clientHeight;
	}   
	if(vs < wh){
		ph = wh;
	} else { 
		ph = vs;
	}
	if(xs < ww){  
		pw = xs;		
	} else {
		pw = ww;
	}
	return [pw,ph,ww,wh];
}
  
function popupClose()	{
	popupIsDisplayed = false;
	if(h.has(_hasOnclose)) {
		cl = h.get(_hasOnclose);
		eval(cl + "()");		
	} else {
		var popup_bgr = document.getElementById('popup_bgr');
		var popup_wrapper = document.getElementById('popup_wrapper');
		var popupcontainer = document.getElementById('popupcontainer');
		
		popupcontainer.style.display = popup_bgr.style.display = popup_wrapper.style.display = 'none';
		
		var rb = $('rightBanner');
		if  (rb) {
	        rb.setStyle('visibility', 'visible');
	    }
	}
	
	if (mustCloseAttachPopup) {
		attachPopupClose();
	}
}

var ieCheck = false;
var popupIsDisplayed = false;
function showPopup(title, content, context) {
	popupIsDisplayed = true;
    var rb = $('rightBanner');
    if  (rb) {
        rb.setStyle('visibility', 'hidden');
    }
    
    if (! title) {
    	title = '&nbsp;';
    }
    
	$('popup_head').set('html', title);
	if (content != '') {
		$('popup_content').set('html', content);
	}
	
	var popup_bgr = document.getElementById('popup_bgr');
	var popup_wrapper = document.getElementById('popup_wrapper');
	var popupcontainer = document.getElementById('popupcontainer');
	var dim = getDimensions();
	
	popup_bgr.style.height = document.body.offsetHeight + 'px';

	popupcontainer.style.display = popup_bgr.style.display = popup_wrapper.style.display = '';
	if (! $('popup_wrapper').hasClass('vip_popup')) {
//	   $('popup_wrapper').setStyle('height', dim[3] + 'px');
	   var ief = $('ieFixedPossFix');
	   if (ief) {
	       popup_bgr.style.height = (ief.getScrollSize().y + ief.getDimensions().height) + 'px';
	   }
	} else {
	    centerPopup();
	}
	if(context) {
		_hasOnclose = context; 
	}
}

function isPopupDisplayed () {
	return popupIsDisplayed;
}

mustCloseAttachPopup = false;
function attachPopupClose()   {
	$('attachFold').destroy();
	
    if(h.has(_hasOnclose)) {
        cl = h.get(_hasOnclose);
        eval(cl + "()");        
    } else {
        var popup_wrapper = document.getElementById('attachPopup_wrapper');
        var popupcontainer = document.getElementById('attachPopupcontainer');
        
        popupcontainer.style.display = popup_wrapper.style.display = 'none';
		
		popup_wrapper.dispose().inject(document.getElement('body'));
    }
	
	mustCloseAttachPopup = false;
}

function showAttachPopup(title, content, target){
	target = target || null;
	if (! target) {
		return;
	}
	target = $(target);
	if (! target) {
		return;
	}
	
	mustCloseAttachPopup = true;
	
	target.setStyle('position', 'relative');
	
    $('attachPopup_head').set('html', title);
    if (content != '')
    {
        $('attachPopup_content').set('html', content);
    }
	
	var td = target.getCoordinates();
	if (! target.getElement('#attachFold')) {
		new Element ('div', {
	        'styles': {
	            'background-color': '#929292',
	            'opacity': 0.5,
	            'position': 'absolute',
	            'top': '0px',
	            'left': '0px',
	            'height': td.height + 'px',
	            'width': td.width + 'px'
	        }, 
	        'id': 'attachFold'
	    }).inject(target);
	}
	
    var popup_wrapper = $('attachPopup_wrapper');
	popup_wrapper.setStyles({
		'position': 'absolute'
	});
    var popupcontainer = document.getElementById('attachPopupcontainer');
    var dim = getDimensions();
	target.adopt(popup_wrapper);
    
    popupcontainer.style.display = popup_wrapper.style.display = '';
    if (! $('attachPopup_wrapper').hasClass('vip_popup')) {
       $('attachPopup_wrapper').setStyle('height', dim[3] + 'px');
       var ief = $('ieFixedPossFix');
       if (ief) {
           popup_bgr.style.height = (ief.getScrollSize().y + ief.getDimensions().height) + 'px';
       }
    } else {
        centerPopup();
    }
	
	centerAttachPopup();
}

function centerPopup() { //use when the popup is not displayed inside another table
    var p = $('popup_wrapper');
    var pd = p.getCoordinates();
    var wd = window.getCoordinates();
    var ws = window.getScroll();
    
	if($('ieFixedPossFix')) {
		p.setStyles({
	        'top': 10,
	        'left': Math.floor(wd.width / 2) - Math.floor(pd.width / 2)
	    });
	} else {
		if (p.getStyle('position') == 'fixed') {
	        var top = (pd.height > wd.height ? 10 : parseInt(wd.height / 2 - pd.height / 2));
	        p.setStyles({
	            'top': top,
	            'left': Math.floor(Math.floor(wd.width - pd.width) / 2)
	        });
	    } else {
	    	var top = ws.y + (pd.height > wd.height ? 10 : parseInt(wd.height / 2 - pd.height / 2));
	        p.setStyles({
	            'top': top,
	            'left': Math.floor(Math.floor(wd.width - pd.width) / 2)
	        });
	    }
	}
}

function centerAttachPopup() { //use when the popup is not displayed inside another table
    if (!$('attachFold')) {
		return;
	}
    var p = $('attachPopup_wrapper');
    var pd = p.getCoordinates();
    var wd = $('attachFold').getCoordinates();
    var ws = getBaseScrollableElement().getScroll();
    
    p.setStyles({
        'top': ((wd.height - pd.height) / 2 > 0 ? (wd.height - pd.height) / 2 : 10),
        'left': Math.floor(wd.width / 2) - Math.floor(pd.width / 2)
    });
}

/* PopupConfirm */
var PopupConfirm = new Class({
    Implements: [Events, Options],
    
    options: {
        message: null,
        popupTitle: MooTools.lang.get('js', 'warning'),
        okText: MooTools.lang.get('js', 'yes'),
        cancelText: MooTools.lang.get('js', 'no'),
        onOkArguments: [],
        onCancelArguments: []
    },
    
    initialize: function (options) {
        if (options.events) {
            this.addEvents(options.events);
            
            delete options.events;
        }
        this.setOptions(options);
        
        this.bound = {
            onOk: this.onOk.create({bind: this}),
            onCancel: this.onCancel.create({bind: this})
        };
        
        return this;
    },
    
    show: function () {
        var message = new Element('div', {
            'class': 'gray',
            'style': 'font-weight: bold; margin: 10px 7px;',
            'html': this.options.message
        });
        
        var bc = new Element('a', {
            'style': 'float: right; margin-right: 10px; padding: 0px 4px;',
            'class': 'd_gray_anchor',
            'html': this.options.cancelText,
            'href': 'javascript: void(0);',
            'id': 'popConfCancel',
            'events': {
                'click': this.bound.onCancel
            }
        }); bc.grab(new Element('span'));
        
        var bo = new Element('a', {
            'style': 'float: right; margin-right: 18px; padding: 0px 4px;',
            'class': 'd_blue_anchor',
            'html': this.options.okText,
            'href': 'javascript: void(0);',
            'id': 'popConfOk',
            'events': {
                'click': this.bound.onOk
            }
        }); bo.grab(new Element('span'));
        
        var footer = new Element('div', {'style': 'margin: 7px; 0px;'}).adopt(bc, bo, 
        		new Element('div', {
        			'class': 'clear'
        		}));
        
        var pc = $('popup_content');
        pc.empty();
        pc.adopt(message, footer);
        
        showPopup(this.options.popupTitle, '');
    },
    
    onOk: function (event) {
        this.fireEvent('ok', this.options.onOkArguments);
        
        popupClose();
    },
    
    onCancel: function () {
        this.fireEvent('cancel', this.options.onCancelArguments);
        
        popupClose();
    }
});

function blurPopup(event) {
    if (! event || (event && !event.client)) {
        return;
    }
    if (event.target && event.target.tagName.toLowerCase() == 'option') {
        return;
    }
    
    var ap = $$('.popup');
    var c = null;
    if (ap.length > 0) {
        c = $(ap.pop()).getCoordinates();
    } else {
        c = $('popup_wrapper');
        popupClose();
    }
    
    if (c) {
        if((event.client.x > c.left + c.width || event.client.x < c.left) || 
           (event.client.y > c.top + c.height || event.client.y < c.top)) {
            popupClose();
        }
    }
}

var DatePicker = new Class({
    initialize: function (options) {
        this.day = $(options.day);
        this.month = $(options.month);
        this.year = $(options.year);
        
        if (! this.year) {
            return;
        }
        this.year.addEvent('change', this.changeYear.create({bind: this}));
        this.month.addEvent('change', this.changeMonth.create({bind: this}));
    },
    
    isYearLeap: function () {
        var y = parseInt(this.year.value);
        
        if (y == 0) {
            return false;
        }
        
        return (y % 4 == 0 || y % 100 == 0) && y % 400 != 0;
    },
    
    changeYear: function () {
        var m = parseInt(this.month.value);
        var dCnt = parseInt(this.day.getLast().value);
        var leapYear = this.isYearLeap();
        
        if(m == 2 && dCnt < 29 && leapYear) {
            this.day.grab(new Element('option', {
                'value': 29,
                'text': 29
            }));
        } else if (m == 2 && ! leapYear && dCnt > 28) {
            this.day.getLast().destroy();
        }
    },
    
    getMaxMonthDay: function () {
        var m = parseInt(this.month.value);
        
        switch(true) {
            case m == 2:
                return 28 + (this.isYearLeap() ? 1 : 0);
                break;
                
            case m <= 7:
                return m % 2 == 0 ? 30 : 31;
                break;
                
            default:
                return m % 2 == 0 ? 31 : 30;
                break;
        }
        
        return 0;
    },
    
    changeMonth: function () {
        var maxDay = this.getMaxMonthDay();
        if (maxDay == 0) {
            return;
        }
        
        var dCnt = parseInt(this.day.getLast().value);
        var addNew = maxDay > dCnt;
        var iterations = Math.abs(maxDay - dCnt);
        
        for (var i = 1; i <= iterations; i ++) {
            if (addNew) {
                this.day.grab(new Element('option', {
                    'value': dCnt + i,
                    'text': dCnt + i
                }));
            } else {
                this.day.getLast().destroy();
            }
        }
    }
});

var TabsController = new Class({
    Implements: [Events, Options],
    
    options: {
        activeTabClass: 'active',
        url: '', //the request url
        disableCache: false,
        autoRequestSelected: false,
        skipRequestAttr: 'sra',
        switchEvent: 'click'
    },
    contentsHolder: null,
    tabsHolder: null,
    currentTab: null,
    contentsHash: $H({}),
    
    initialize: function (tabsHolder, container, options) {
        this.contentsHolder = $(container);
        this.tabsHolder = $(tabsHolder);
        if (options.events) {
            this.addEvents(options.events);
            delete options.events;
        }
        this.setOptions(options);
        
        this.tabBound = $H({});
        this.tabBound.set(this.options.switchEvent, this.clickTab.create({bind: this}));
        
        this.contentBound = {
            'storeContent': this.storeContent.create({bind: this})
        },
        
        this.initTabs();
    },
    
    initTabs: function () {
    	if (! this.tabsHolder) {
    		return;
    	}
    	
        this.tabsHolder.getElements('a').each(function (item, index) {
        	
            if (item.getAttribute(this.options.skipRequestAttr)) {
                return;
            }
            if (item.hasClass(this.options.activeTabClass)) {
                this.currentTab = item.id;
            }

            $(item).addEvents(this.tabBound);
        }, this);
        
        if (this.options.autoRequestSelected && this.currentTab) {
            var tmp = this.currentTab;
            this.currentTab = null;
            
            this.clickTab({target: $(tmp)});
        }
    },
    
    initContent: function () {
        this.contentsHash.set(this.currentTab, {t: this.contentsHolder.get('html'), j: null});
    },
    
    switchTab: function (tab) {
        if (! tab) {
            return;
        }
        
        this.tabsHolder.getElements('a').each(function (item, index) {
            $(item).removeClass(this.options.activeTabClass);
        }, this);
        
        $(tab).addClass(this.options.activeTabClass);
    },
    
    storeContent: function (rt, re, rh, rj) {
    	try {
            if (! this.options.disableCache) {
                this.contentsHash.set(this.currentTab, {t: rh, j: rj});
            }
            this.contentsHolder.set('html', rh);
            eval(rj);
        } catch (err) {
            Log.log(err.message);
        }
        
        this.fireEvent('afterSwitch');
    },
    
    clickTab: function(event) {
        var target = event.target;
        target.blur();
        
        if (target.tagName.toLowerCase() != 'a') {
            target = $(target).getParent('a');
        }
        
        if (this.currentTab == target.id) {
            this.fireEvent('afterSwitch');
            return;
        }
        
        this.currentTab = target.id;
        
        if (this.request) {
            this.request.cancel();
        }
        
        this.switchTab(target.id);
        if (this.contentsHash.has(target.id)) {
            var c = this.contentsHash.get(target.id);
            this.contentsHolder.set('html', c.t);
            if(c.j) {
                eval(c.j);
            }
            
            this.fireEvent('afterSwitch');
            return ;
        }
        
        this.fireEvent('beforeSwitch');
        this.executeRequest(target);
    },
    
    executeRequest: function (target) {
    	placeAjaxLoading(this.contentsHolder, 'big', MooTools.lang.get('js', 'pleaseWait'));
    	
        var rData = target.getAttribute('rData');
        this.request = new Request.HTML({
            method: 'post',
            url: this.options.url,
            evalResponse: false,
            evalScripts: false,
            data: JSON.decode(rData),
            onSuccess: this.contentBound.storeContent
        });
        this.request.send();
    }
    
});

var TabsControllerPlugins = new Class({
	Implements: TabsController,
	
	executeRequest: function (target) {
		loadPlugin({'target': target}, this.contentBound);
	}
});

var TabsControllerHref = new Class({
	Implements: TabsController,
	executeRequest: function (target) {
	}
});

function onScroolPopup() {
    $('popup_wrapper').setStyle('top',  (window.getScroll().y + 100) + 'px');
}

function onResizeFix() {
    $('ieFixedPossFix').setStyle('height', window.getCoordinates().height + 'px');
    $('popup_bgr').setStyle('height', $('ieFixedPossFix').getStyle('height'));
}

var moveableBlocksController = new Class ({
    Implements: [Events, Options],
    
    options: {
        'oPosProp': 'op',
        'cookieSuffix': 'Moveables',
        'headClassTogglePos': 1
    },
    
    blockId: null,
    surroundingBlock: null,
    moveablesPosition: $H({}),
    moveablesExpanded: $H({}),
    actionsDisabled: false,
    
    initialize: function (sbi, options) {
        this.setOptions(options);
        
        this.bound = {
            'goUp': this.goUp.create({bind: this}),
            'goDown': this.goDown.create({bind: this}),
            'toggle': this.toggle.create({bind: this}),
            'disableActions': this.disableActions.create({bind: this}),
            'enableActions': this.enableActions.create({bind: this})
        };
        this.blockId = sbi;
        this.surroundingBlock = $(sbi);
        
        this.readMoveableSettings();
    },
    
    initButtonActions: function (buttons) {
        buttons.each(function (item, index) {
            if (item.hasClass('up')) {
                item.addEvent('click', this.bound.goUp);
            }
            if (item.hasClass('down')) {
                item.addEvent('click', this.bound.goDown);
            } 
            if (item.hasClass('close')) {
                item.addEvent('click', this.bound.toggle);
            }
        }.create({bind: this}));
    },
    
    goUp: function (event) {
        if (this.actionsDisabled) {
            return;
        }
        
        var block = event.target.getParent('.mvb');
        if (this.moveablesPosition.get(block.id) == 0) {
            return;
        }
        this.disableActions();
        
        var prevBlock = block.getPrevious();
        this.moveablesPosition.set(prevBlock.id, this.moveablesPosition.get(prevBlock.id) + 1);
        this.moveablesPosition.set(block.id, this.moveablesPosition.get(block.id) - 1);
        
        this.swapBlocks(prevBlock, block, block);
    },
    
    goDown: function (event) {
        if (this.actionsDisabled) {
            return;
        }
        
        var block = event.target.getParent('.mvb');
        if (this.moveablesPosition.get(block.id) == this.moveablesPosition.length) {
            return;
        }
        this.disableActions();
        
        var nextBlock = block.getNext();
        this.moveablesPosition.set(block.id, this.moveablesPosition.get(block.id) + 1);
        this.moveablesPosition.set(nextBlock.id, this.moveablesPosition.get(nextBlock.id) - 1);
        
        this.swapBlocks(block, nextBlock, block);
    },
    
    toggle: function (event) {
        if (this.actionsDisabled) {
            return;
        }
        this.disableActions();
        
        var block   = event.target.getParent().getParent();
        var target  = block.getParent('.mvb');
        
        var classAddon = 'shown';
        if (this.moveablesExpanded.get(target.id)) {
            var t = block.getNext();
            if (t.className == '' && t.id == '') {
                t = $(t.firstChild);
            }
            t.slide('out');
            this.moveablesExpanded.set(target.id, false);
            
            classAddon = 'hidden';
        } else {
            $(block.getNext().firstChild).slide('in');
            this.moveablesExpanded.set(target.id, true);
        }
        
        this.setHeadClass(block, classAddon, this.options.headClassTogglePos);
        this.saveMoveableSettings();
    },
    
    setHeadClass: function (block, replacement, replacementPos) {
        var headClassName = block.get('class');
        var segments = headClassName.split('_');
        segments[replacementPos] = replacement;
        
        block.set('class', segments.join('_'));
    },
    
    swapBlocks: function (fb, sb, focus) {
        var fc = fb.getCoordinates();
        var sc = sb.getCoordinates();
        var pn = $(fb.parentNode);
        
        pn.setStyle('height', pn.getCoordinates().height);
        
        fb.setStyles({'position': 'absolute', 'top': fc.top, 'opacity': 0.5});
        fb.setStyles({'position': 'absolute', 'top': sc.top, 'opacity': 0.5});
        
        new Fx.Tween(fb).start('top', fc.top, sc.top);
        new Fx.Tween(sb).start('top', sc.top, fc.top).chain(function () {
            sb.setStyle('position', '');
            fb.setStyle('position', '');
            fb.inject(sb, 'after');
            pn.setStyle('height', '');
            
            new Fx.Tween(fb, {'duration': 'short'}).start('opacity', 0.5, 1);
            new Fx.Tween(sb, {'duration': 'short'}).start('opacity', 0.5, 1);
            new Fx.Scroll(getBaseScrollableElement()).toElement(focus);
        }.create({bind: this}));
        
        this.saveMoveableSettings();
    },
    
    saveMoveableSettings: function () {
        var cv = '';
        var cnt = 0;
        
        this.moveablesPosition.each(function (item, index) {
            cv += item.toString() + ':' + $(index).getAttribute(this.options.oPosProp).toString() + ':' + (this.moveablesExpanded.get(index) ? '1' : '0') + ',';
            cnt ++;
        }.create({bind: this}));
        
        cv = cv.substring(0, cv.length - 1);
        Cookie.write(this.blockId + this.options.cookieSuffix, cv, {'duration': 7 * 24 * 60 * 60});
        
        this.enableActions();
    },
    
    readMoveableSettings: function () {
//        Cookie.write(this.blockId + 'Moveables', '');
        var cv      = Cookie.read(this.blockId + this.options.cookieSuffix);
        var bids    = $H({});
        
        this.surroundingBlock.getElements('.mvb').each(function (item, index) {
            this.moveablesPosition.set(item.id, index);
            this.moveablesExpanded.set(item.id, true);
            bids.set(item.getAttribute(this.options.oPosProp), item.id);
            
            this.initButtonActions($(item.firstChild).getElement('.icons').getElements('a'));
        }.create({bind: this}));
        
        if  (cv) {
            $A(cv.split(',')).each(function (item, index) {
                var segments = item.split(':');
                
                this.moveablesPosition.set(bids.get(segments[1]), parseInt(segments[0]));
                this.moveablesExpanded.set(bids.get(segments[1]), (segments[2] == '1' ? true : false));
                if (segments[2] == '0') {
                    var block = $(bids.get(segments[1])).childNodes[1];
                    
                    this.setHeadClass(block.getPrevious(), 'hidden', this.options.headClassTogglePos);
                    new Fx.Slide(block).hide();
                }
            }.create({bind: this}));
        }
    },
    
    disableActions: function () {
        this.actionsDisabled = true;
    },
    
    enableActions: function () {
        this.actionsDisabled = false;
    }
});

//moveables block with tabs tab click block expand
function moveblesTabSwitch (contentId, headId, classAddonPos, classAddon) { 
    $(contentId).slide('in'); 
    
    if(classAddonPos != -1) {
        var head = $(headId);
        var headClassName = head.get('class');
        var segments = headClassName.split('_');
        segments[classAddonPos] = classAddon;
        
        head.set('class', segments.join('_'));
    }
}

var bubbleTip = new Class({
    Implements: [Events, Options],
    
    options: {
        'bubbleClassName': 'yellow_tt_body',
        'text': '',
        'showEvent': 'focus',
        'hideEvent': 'blur',
        'showPrecondition': $empty, //if present must be function retirning true or false
        'hidePrecondition': $empty, //if present must be function retirning true or false
        'bubblePosition': 'bottom' //['top', 'bottom', 'left', 'right']
    }, 
    target: null,
    bubble: null,
    textNode: null,
    
    initialize: function (target, options) {
        this.setOptions(options);
        
        this.target = $(target);
        
        this.bound = {
            hide: this.hide.create({bind: this}),
            show: this.show.create({bind: this})
        };
        
        this.createBubble();
        
        var events = $H({});
        events.set(this.options.showEvent, this.bound.show);
        events.set(this.options.hideEvent, this.bound.hide);
        if (this.options.hideEvent != 'blur') {
            events.set('blur', this.bound.hide);
        }
        
        this.target.addEvents(events);
    },
    
    show: function () {
        if  (this.options.showPrecondition !== $empty) {
            if (! this.options.showPrecondition()) {
                return;
            }
        }
        
        var tc = this.target.getCoordinates();
        var bc = this.bubble.getCoordinates();
        
        switch (this.options.bubblePosition) {
            case 'bottom':
                this.bubble.setStyles({
                   'top': tc.top + tc.height + 14,
                   'left': tc.left - ((bc.width - tc.width) / 2)
                });
                break;
        }
        
        this.bubble.fade('in');
    },
    
    hide: function () {
        if  (this.options.hidePrecondition !== $empty) {
            if (! this.options.hidePrecondition()) {
                return;
            }
        }
        
        this.bubble.fade('out');
    },
    
    setText: function (text) {
        this.options.text = text;
        this.textNode.set('html', text);
    },
    
    createBubble: function () {
        this.bubble = new Element('div', {
            'class': this.options.bubbleClassName,
            'styles': {
                'opacity': 0,
                'visibility': 'visible'
            }
        });

        this.textNode = new Element('span', {'html': this.options.text});
           
        this.bubble.adopt(
            new Element('div', {'class': 'top'}),
            new Element('div', {'class': 'bottom'}),
            new Element('div', {'class': 'b_a', 'styles': {'visibility': this.options.bubblePosition == 'top' ? 'visible' : 'hidden'}}),
            new Element('div', {'class': 't_a', 'styles': {'visibility': this.options.bubblePosition == 'bottom' ? 'visible' : 'hidden'}}),
            new Element('div', {'class': 'r_a', 'styles': {'visibility': this.options.bubblePosition == 'left' ? 'visible' : 'hidden'}}),
            new Element('div', {'class': 'l_a', 'styles': {'visibility': this.options.bubblePosition == 'right' ? 'visible' : 'hidden'}}),
            this.textNode
        );
        
        $(document).getElement('body').adopt(this.bubble);
    }
});

var ajaxTooltip = new Class({
	Implements: [Options, Events],
	
	options: {
		requestUrl: '/ajax/userTooltip.php',
		targetClass: 'userTooltip'
	},
	
	request: null,
	lastTarget: null,
	
	initialize: function (options) {
		this.setOptions(options);
		
		this.bound = {
			'setTooltipData': this.setTooltipData.create({bind: this}),
			'attachTooltipData': this.attachTooltipData.create({bind: this})
		};
		
		this.init();
	}, 
	
	init: function () {
		$$('.' + this.options.targetClass).each(function (item, index) {
			item.addEvent('mouseover', this.bound.setTooltipData);
		}, this);
	},
	
	setTooltipData: function (event) {
		if(! event || ! event.target) {
			return;
		}
		
		var target = $(event.target);
		this.lastTarget = target.hasClass(this.options.targetClass) ? target : target.getParent('.' + this.options.targetClass);
		
		if (! this.lastTarget) {
			return;
		}
		
		if(this.request) {
			this.request.cancel();
		}
		
		var data = JSON.decode(this.lastTarget.getAttribute('rData'));
		if (data.tipAddition) {
			delete data.tipAddition;
		}
		this.request = new Request.HTML({
			method: 'POST',
			url: this.options.requestUrl,
			'data': data,
			onSuccess: this.bound.attachTooltipData
		});
		
		this.request.send();
	},
	
	attachTooltipData: function (rt, re, data, rj) {
		if (this.lastTarget) {
			var trData = JSON.decode(this.lastTarget.getAttribute('rData'));
			if (trData.tipAddition) {
				data += trData.tipAddition;
			}
			
			this.lastTarget.store('tip:text', data);
			$$('.tip-text').each(function (item, index) {
				$(item).set('html', data);
			})
			this.lastTarget.removeEvent('mouseover', this.bound.setTooltipData);
			
			this.lastTarget = null;
			
			var tt = $$('.tooltip');
			if (tt) {
				tt.each(function (item, index) {
					fixTipWidth(item);
				});
			}
		}
	}
});

var enbleSlideHidden = false;
var slideHiddenEnabled = false;
function enableSlideHidden() {
	slideHiddenEnabled = true;
}
function slideHidden (event) {
	var target = $(event.target);
	var toSlide = target.getPrevious('.toSlideIn');
	var sfx = new Fx.Slide(toSlide);
	sfx.hide();
	toSlide.setStyle('display', '');
	sfx.slideIn();
	
	target.destroy();
}

//custom validators specification
function reloadCaptcha (target, show) {
	var t = $(target);
	
	t.set('spinner', {'class': 'spinner-small', 'img': {'class': 'spinner-img-small'}});
	t.spin();
	new Request.JSON({
		'url': '/ajax/captcha.php?act=new&show=' + show,
		'method': 'GET',
		'onSuccess': function (rj, rt) {
			t.unspin();
			t.src = rt + '?' + parseInt(Math.random() * 100000);
		}
	}).send();
}
Form.Validator.add('validate-captcha', {
	errorMsg: function() {
		return Form.Validator.getMsg('validate-captcha');
	},
	test: function(element) {
		var result = null;
		
		element.set('spinner', {'class': 'spinner-small', 'img': {'class': 'spinner-img-small'}});
		element.spin();
		new Request.JSON({
			'url': '/ajax/captcha.php?act=check&val=' + element.value.toString().trim(),
			'method': 'GET',
			'async': false,
			'onSuccess': function (rj, rt) {
				element.unspin();
				result = rj;
			}
		}).send();
		
		if (result) {
			element.readOnly = true;
			$('reload_' + element.id).setStyle('display', 'none');
		}
		
		return result;
	}
});
Form.Validator.add('validator-available-username', {
		errorMsg: function(element, props){
		var msg = Form.Validator.getMsg('validator-available-username');
		
		if (element.hasClass('showFPass')) {
			msg += ' ' + MooTools.lang.get('js', 'ifYoursUseFpass');
		}
		if(element.hasClass('logic_true')) {
			msg = ' ' + MooTools.lang.get('js', 'lostPassUsernameError');
		}
		
		if (element.hasClass('showSuggestions')) {
			new Request.JSON({
				'url': '/ajax/availableUsername.php?act=suggest&target=' + element.id + '&' + element.id + '=' + element.value.toString().trim(),
				'method': 'GET',
				'async': false,
				'onSuccess': function (rj, rt) {
					msg += rt;
				}
			}).send();
		}
	
		return msg;
	},
	test: function(element){
		var result = null;
		
		if ('' == element.value.toString().trim()) {
			return true;
		}
		
		element.set('spinner', {'class': 'spinner-small', 'img': {'class': 'spinner-img-small'}});
		element.spin();
		
		var cl = 0;
		if(element.hasClass('logic_true')) {cl = 1};
		
		new Request.JSON({
			'url': '/ajax/availableUsername.php?act=check&val=' + element.value.toString().trim() + '&cl=' + cl,
			'method': 'GET',
			'async': false,
			'onSuccess': function (rj, rt) {
				result = rj;
				element.unspin();
			}
		}).send();
		
		return result;
	}
});
Form.Validator.add('validator-available-email', {
	errorMsg: function(element, props){
		var msg = Form.Validator.getMsg('validator-available-email');
		
		if (element.hasClass('showFPass')) {
			msg += ' ' + MooTools.lang.get('js', 'ifYoursUseFpass');
		}
		
		if(element.hasClass('logic_true')) {
			msg = ' ' + MooTools.lang.get('js', 'lostPassEmailError');
		}
	
		return msg;
	},
	test: function(element){
		var result = null;
		
		if ('' == element.value.toString().trim()) {
			return true;
		}
		
		element.set('spinner', {'class': 'spinner-small', 'img': {'class': 'spinner-img-small'}});
		element.spin();
		var cl = 0;
		if(element.hasClass('logic_true')) {cl = 1};

		new Request.JSON({
			'url': '/ajax/availableEmail.php?val=' + element.value.toString().trim() + '&cl=' + cl,
			'method': 'GET',
			'async': false,
			'onSuccess': function (rj, rt) {
				element.unspin();
				result = rj;
			}
		}).send();
		
		return result;
	}
});

Form.Validator.add('validator-gsm', {
	errorMsg: function(element, props){
		var msg = Form.Validator.getMsg('validator-gsm');
	
		return msg;
	},
	test: function(element, props){
		var result = true;
		
		if (props.regex) {
			var tester = new RegExp(props.regex);
			
			result = tester.test(element.value.toString().trim());
		}
		
		return result;
	}
});

var Dropdown = {
	onchange: function(element, value, func) {
		var el = $(element).getParent().getPrevious('.arrow');
		
		if (! el) {
			return;
		}
		
		el.set('html', value);
		
		var input = el.getParent('.custom_dropdown').getPrevious('input');
		var val = $(element).getAttribute('value');

		if (input && $type(val)) {
			input.value = val;
		}
		
		if (formValidators) {
			var parentForm = el.getParent('form');
			
			if (parentForm) {
				var validator = formValidators.get(parentForm.name + 'Validator');
				
				if (validator) {
					validator.validateField(el.getParent('div').getPrevious('input'));
				}
			}
		}
		
		if (func) {
			func(element, value);
		}
	}
}

function getBaseElementToScroll () {
	var el = $('ieFixedPossFix');
	if (! el) {
		el = window;
	}
	
	return el;
}

var Asseted = $H({});
function loadAjaxPage (url, method, data) {
	var updateTarget = $('siteMainContainer');
	
	if (browserHash && '' != browserHash.getHash() && 0 === url.indexOf('?')) {
		url = browserHash.getCleanURLFromHash() + url;
	}
	
	new Fx.Scroll(getBaseElementToScroll()).toTop();

	new Request.HTML({
		'url': '/ajax/index.php?requestUrl=' + escape(url),
		'method': method,
		'update': updateTarget,
		'data': data,
		'useSpinner': true,
		'spinnerOptions': {'class': 'spinner-big', 'img': {'class': 'spinner-img-big'}}
	}).send();
	
	if (data && null !== data && browserHash) {
		browserHash.write(url, null);
	}
	
	return false;
}

function handleLoggedLinks (event) {
	var target = 'a' == event.target.tagName.toLowerCase() ? $(event.target) : $(event.target).getParent('a');
	var href = browserHash.decodeHash(target.getProperty('href'));
	
	if (! href) {
		return true;
	}
	
	if (-1 != href.toString().indexOf('javascript:') || target.hasClass('ajaxDenied')) {
		return;
	} else {
		loadAjaxPage(href, 'GET', {});
		event.stop();
		return false;
	}
}

function getCleanUrl (url) {
	var u = new URI(url);
	
	return u.get('scheme') + '://' + u.get('host') + u.get('directory');
}

function handleLoggedForms (event) {
	var target = $(event.target);
	
	if (! target) {
		return true;
	}
	
	if (target.hasClass('ajaxDenied') || target.getAttribute('rData') || target.getAttribute('rdata') || target.retrieve('rData') || target.retrieve('rdata')) {
		return true;
	}
	
	if (formValidators.get(target.id + 'Validator')) {
		if (! formValidators.get(target.id + 'Validator').validate()) {
			event.stop();
			return false;
		}
	}
	
	var method = target.method;
	var cUrl = '';
	if ('post' == method.toString().toLowerCase()) {
		cUrl = browserHash.getHash() == '' ? getCleanUrl(null) : browserHash.getHash();
	} else {
		cUrl = browserHash.getHash() == '' ? getCleanUrl(null) : browserHash.getCleanURLFromHash();
	}
	var url = target.action != '' ? target.action : cUrl;
	var qs = target.toQueryString();
	
	if ('get' == method.toString().toLowerCase()) {
		url += url.indexOf('?') == -1 ? '?' : '&';
		url += qs;
		qs = {};
	} else {
		qs = qs.parseQueryString();
	}
	
	loadAjaxPage(url, method, qs);
	
	event.stop();
	return false;
}

function loadPluginOnValidate (valid, form, event) {
	if (valid) {
		loadPlugin(event);
	}
}

var pluginChainQueue = [];

function executePluginFromChainQueue () {
	if (pluginChainQueue && pluginChainQueue.length) {
		loadPlugin(pluginChainQueue.shift(), executePluginFromChainQueue);
	}
}

function loadPlugin (event, _onSuccess) {
	if (! event || ! event.target) {
		return;
	}
	
	if ('array' == $type(event)) {
		pluginChainQueue = event;
		
		event = pluginChainQueue.shift();
		_onSuccess = executePluginFromChainQueue;
	}
	
//	var target = $(event.target);
//	if (! target) {
//		target = $H(event.target);
//	}
//	var target = ($type(event) == 'event') ? $(event.target) : $H(event.target);
	var target = null;
	if('event' == $type(event.target)) {
		target = $(event.target);
	} else {
		if('element' == $type(event.target)) {
			target = $(event.target);
		} else {
			target = $H(event.target);
		}
	}
	
	var href = target.href | '';
	var rData = '';
	
	if (target && target.getAttribute && target.getAttribute('rdata')) {
		rData = $H(JSON.decode(target.getAttribute('rdata')));
	} else if (target.retrieve && target.retrieve('rData')) {
		rData = $H(target.retrieve('rData'));
	} else if (target && target.has && target.has('rData')) {
		rData = $H(target.get('rData'));
	} else {
		return false;
	}
	
	if (rData.has('rpcp')) {
		rData.set('rpcp', JSON.encode(rData.get('rpcp')));
	}
	
	if (! href) {
		var qs = null;
		
		if (target.tagName && 'form' != target.tagName.toLowerCase() && target.getParent) {
			var pf = target.getParent('form');
			if(pf) {
				qs = pf.toQueryString();
			}
		} else if (target.tagName && 'form' == target.tagName.toLowerCase()) {
			qs = target.toQueryString();
		} else if (target.has('qs')) {
			qs = target.get('qs');
		}
		
		if (qs) {
			var seg = qs.split('&');
			
			if (seg.length && seg.length > 0) {
				for (var i = 0; i < seg.length; i ++) {
					var parts = seg[i].split('=');
					if (parts.length > 1) {
						rData.set(parts[0], parts[1]);
					}
				}
			}
		}
	} else {
		href = 'requestUrl=' + href;
	}
	
	updateTarget = $(rData.get('rut'));
//	if (updateTarget) {
//		var ut = updateTarget.getCoordinates();
//		
//		if (ut.height > 10) {
//			updateTarget.set('spinner', {'class': 'spinner-big-top', 'img': {'class': 'spinner-img-big'}});
//			updateTarget.spin();
//		} else {
//			updateTarget = null;
//		}
//	}
	
	var requestOptions = {
		'url': '/ajax/index.php?' + href,
		'method': 'POST',
		'data': rData,
		'update': updateTarget, 
		'useSpinner': true,
		'spinnerOptions': {'class': 'spinner-big-top', 'img': {'class': 'spinner-img-big'}},
		'onSuccess': function () { centerPopup(); if (updateTarget) { updateTarget.unspin(); } }
	};
	
	if (_onSuccess) {
		requestOptions.onSuccess = _onSuccess;
	}
	
	new Request.HTML(requestOptions).send();
	
	if (event.stop) {
		event.stop();
		return false;
	}
}

function deselectMainTabs () {
	var navCont = $$('.nav_cont').pop();
	
	if (navCont) {
		navCont.getElements('a').each(function (item, index) { 
			item.removeClass('active'); 
			if (item.hasClass('home_active')) {
				item.addClass('home');
				item.removeClass('home_active');
			}
		});
	}
}

Form.Validator.Extended = new Class({
	Extends: Form.Validator.Inline,
	
	showAdvice: function(className, field){
		var advice = this.getAdvice(className, field);
		if (field.hasClass('extended_tooltip')) {
			if (advice && !field.retrieve(this.getPropName(className))) {
				Registry.get('ExtendedTooltip').showError(field, advice)
			}
		} else {
			this.parent(className, field);
		}
	},
	
	hideAdvice: function(className, field){
		var advice = this.getAdvice(className, field);
		if (field.hasClass('extended_tooltip')) {
			if (advice && !field.retrieve(this.getPropName(className))) {
				Registry.get('ExtendedTooltip').hide();
			}
		} else {
			this.parent(className, field);
		}
	}
});

var ExtendedTooltip = new Class ({
	Extends: Tips,
	lastEvent: null, //the last occured mouse over event to capture the target element
	bound: {},
	displayForced: false,
	
	initialize: function(){
		this.options.fixed = true;
		this.options.className = '';
		this.options.hideDelay = 500;
		this.options.width = 305;
		this.options.onShow = function (tip, element) {
			if (0 == this.container.childNodes.length) {
				return;
			}
			
			tip.setStyles({
				'visibility': 'hidden',
				'display': 'block',
				'opacity': 0
			});
			tip.set('tween', {'duration': 150});
			tip.tween('opacity', 0, 1);
		};
		this.options.onHide = function (tip, element) {
			this.displayForced = false;
			var tw = tip.get('tween');
			
			if (tw && tw.stop) {
				tw.stop();
				tip.setStyle('opacity', 0);
			}
			
			if (0 == this.container.childNodes.length) {
				tip.setStyle('opacity', 0);
				return;
			}
			
			tip.set('tween', {'duration': 150});
			tip.tween('opacity', 1, 0);
		};
		
		this.parent(arguments);
		
		this.bound = {
			'tipenter': this.tipEnter.create({bind: this}),
			'tipleave': this.tipLeave.create({bind: this})
		};
		
		//clear previous entires
		var pet = Registry.get('ExtendedTooltip');
		if (pet) {
			pet.hide();
			$(pet).destroy();
		}
		
		Registry.set('ExtendedTooltip', this);
	},
	
	toElement: function() {
		if (this.tip)  {
			return this.tip;
		}

		this.tip = new Element('div', {
			'class': 'q_tooltip',
			styles: {
				position: 'absolute',
				top: 0,
				left: 0
			}
		}).adopt(
			new Element('div', {
				'class': 'br3 info main_shadow'  + (this.options.className ? ' ' + this.options.className : '')
			}).adopt(
				new Element('div', {
					'class': 'arrow'
				}),
				this.container
			)
		).inject(document.body);
		
		$A(['enter', 'leave']).each(function (event) {
			this.tip.addEvent('mouse' + event, this.bound['tip' + event]);
		}, this);
		
		return this.tip;
	},
	
	attach: function(elements) {
		this.parent(elements);
		
		$$(elements).each(function (element) {
			var events = ['focus', 'blur'];
			
			events.each(function(value){
				var event = element.retrieve('tip:' + value);
				if (!event) event = this['element' + value.capitalize()].bindWithEvent(this, element);
				
				element.store('tip:' + value, event).addEvent(value, event);
			}, this);
		}, this);
	},
	
	tipEnter: function (event) {
		$clear(this.timer);
	},
	
	tipLeave: function (event) {
		this.fireEvent('hide', [this.tip, $(this.lastEvent.target)]);
	},
	
	elementFocus: function (event, element) {
		this.elementEnter(event, element);
	},
	
	elementBlur: function (event, element) {
		this.elementLeave(event, element);
	},
	
	elementEnter: function(event, element, forceDisplay) {
		if (this.displayForced) {
			return;
		}
		
		this.displayForced = forceDisplay;
		if (event.type && ! forceDisplay) {
			switch (true) {
				case 'mouseover' == event.type :
					if (element.retrieve('tip:disable_mouse_events')) {
						return;
					}
					break;
			}
		}
		
		this.lastEvent = event;
		
		this.tip.getFirst().removeClass('err');
		
		this.parent(event, element);
		
		if (! forceDisplay && 0 == this.container.childNodes.length) {
			$clear(this.timer);
			this.hide();
		}
	},
	
	position: function(event) {
		if (!this.tip) { 
			document.id(this);
		}
		
		var targ =  $(this.lastEvent.target);
		
		if (! targ.hasClass) {
			this.hide();
			return;
		}
		
		if (! targ.hasClass('extended_tooltip')) {
			targ = targ.getParent('.extended_tooltip');
		}
		
		if (! targ.retrieve('tip:extended')) {
			targ.store('tip:extended', this);
		}

		var targCoords = targ.getCoordinates();
		
		var position = targ.retrieve('tip:pos');
		
		var width = targ.retrieve('tip:width') || this.options.width;
		this.tip.setStyle('width', width.toString() + 'px');
		
		switch (position) {
			case 'below':
				this.tip.setStyles({
					'top': targCoords.top + targCoords.height + 7,
					'left': targCoords.left
				});
				this.tip.getElement('.arrow').addClass('up');
				break;
				
			default:
				this.tip.setStyles({
					'top': targCoords.top,
					'left': targCoords.left + targCoords.width + 13
				});
				this.tip.getElement('.arrow').removeClass('up');
				break;
		}
	},
	
	showError: function (element, message) {
		if (! this.lastEvent) {
			this.lastEvent = {'target': null};
		}
		this.lastEvent.target = element;
		
		if (message) {
			this.elementEnter(this.lastEvent, element, true);
			
			if (! this.tip.getFirst().hasClass('err')) {
				this.tip.getFirst().addClass('err');
			}
			
			this.container.empty();
			
			//extract message
			switch ($type(message)) {
				case 'string' :
					break;
			
				case 'element' :
					message = $(message).get('html');
					break;
			}
			
			this.fill(new Element('div', {'class': 'tip-title'}).inject(this.container), MooTools.lang.get('js', 'warning'));
			this.fill(new Element('div', {'class': 'tip-text'}).inject(this.container), message);
			
			//fade out after few seconds
			this.timer = setTimeout('Registry.get("ExtendedTooltip").hide();', 5000);
		}
	}
	
});

function resetValidatorField (event) {
	if (! event) {
		return;
	}
	
	var target = $(event.target);
	if (! target) {
		return;
	}
	
	var form = target.getParent('form');
	if (! form) {
		return;
	}
	
	if (! formValidators.get(target.getParent('form').name + 'Validator')) {
		return;
	}
	
	formValidators.get(target.getParent('form').name + 'Validator').resetField(event.target);
}

var pluginsRates = new Class ({
	Implements: [Events, Pluggable],
	
	options: {
		'container': null,
		'input': null,
		'ratesClassPrefix': 'rate',
		'containerSelectClassPrefix': 'sr_select',
		'containerHoverClassPrefix': 'sr',
		'ratesMultiplier': 10, /*selctedRate * ratesMultiplier = container_class_name_suffix; ex.: rate is 5 -> container classname is sr50*/
		'rateDescription': [],
		'rateDescriptionContainerClass': 'description',
		'defaultRateDescription': '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
		'rateRowClass': 'rateRow'
	},
	
	container: null,
	input: null,
	description: null,
	bound: null,
	ratesCount: 0,
	currentRatesClass: '',
	
	initialize: function (options) {
		this.setOptions(options);
		
		this.bound = {
			'setRateAction': this.setRateAction.create({bind: this}),
			'hoverRateAction': this.hoverRateAction.create({bind: this}),
			'leaveRate': this.leaveRate.create({bind: this})
		};
		
		this._initElements();
	},
	
	_initElements: function () {
		this.container = $(this.options.container);
		this.input = $(this.options.input);
		this.description = this.container.getParent('.' + this.options.rateRowClass).getElement('.' + this.options.rateDescriptionContainerClass);
		
		this.container.addEvent('mouseleave', this.bound.leaveRate);
		
		this.container.getElements('a').each(function (item, index) {
			$(item).addEvents({
				'mouseenter': this.bound.hoverRateAction,
				'click': this.bound.setRateAction
			}).addClass(this.options.ratesClassPrefix + ((index+1) * this.options.ratesMultiplier));
			
			this.ratesCount ++;
		}, this);
	},
	
	_getContainerClassName: function (rate, select) {
		return (select ? this.options.containerSelectClassPrefix : this.options.containerHoverClassPrefix) + rate;
	},
	
	setRateAction: function (event) {
		this.setRate(parseInt($(event.target).className.replace(this.options.ratesClassPrefix, '')));
	},
	
	hoverRateAction: function (event) {
		this.hoverRate(parseInt($(event.target).className.replace(this.options.ratesClassPrefix, '')));
	},
	
	setRate: function (rate) {
		this.hoverRate(rate, true);
		
		this.input.value = rate / this.options.ratesMultiplier;
		
		this.fireEvent('setRate');
	},
	
	hoverRate: function (rate, select) {
		if (this.currentRatesClass) {
			this.container.removeClass(this.currentRatesClass);
		}
		
		rate = parseInt(rate);
		
		this.currentRatesClass = this._getContainerClassName(rate, select);
		
		this.container.addClass(this.currentRatesClass);
		
		if (this.description) {
			var rateIndex = (rate > 0 ? rate / this.options.ratesMultiplier : 0) - 1;
			var rateDesc = this.options.defaultRateDescription;
			
			if (0 <= rateIndex) { 
				rateDesc = this.options.rateDescription[rateIndex];
				this.description.show();
			}
			
			this.description.set('html', rateDesc);
		}
	},
	
	leaveRate: function (event) {
		this.hoverRate(parseInt(this.input.value) * this.options.ratesMultiplier, true);
	}
	
});

var AssetOnce = {
	loaded: $H({}),
		
	isSourceAsseted: function (source) {
		return AssetOnce.loaded.hasValue(source);
	},
	
	javascript: function(source, properties) {
		if (AssetOnce.isSourceAsseted(source)) {
			if (properties.onload) {
				properties.onload(); 
			}
			
			return null;
		}
		
		AssetOnce.loaded.set('js' + (Math.random() * 10000), source);
		return Asset.javascript(source, properties);
	},
	
	css: function(source, properties){
		if (AssetOnce.isSourceAsseted(source)) {
			if (properties.onload) {
				properties.onload(); 
			}
			
			return null;
		}
		
		AssetOnce.loaded.set('css' + (Math.random() * 10000), source);
		return Asset.css(source, properties);
	},
	
	image: function(source, properties){
		return Asset.image(source, properties);
	},
	
	images: function(sources, options){
		return Asset.images(sources, properties);
	}
}

function scrollToElement (element) {
	new Fx.Scroll(window, {"offset": {"x": 0, "y": $(element).getCoordinates().top - $("headerHelper").getCoordinates().height - 20}}).start();
}
