
$_DUCEDIS.extend({
	initFoot: function(){		
		this.showItemChild();
		try{
			var topmenu = $ES('.topmenu a');
			var first = topmenu[0];

			if ( $_CONFIG['favlink'] ) {
				var menus = topmenu ? topmenu.length : 0;
				var target = $E('.topmenu .TreeList') ? $E('.topmenu .TreeList') : $E('.topmenu');
				var i = $_CONFIG['favlink']['index'];
				i = i < 0 ? menus + i + 1 : i;

				var el = new Element('div', {
					'class': $_find('cat', topmenu[0].parentNode.className) ? 'cat1' : ''
				}).adopt( new Element('a', {
					'styles': { cursor: 'pointer'},
					'class': i ? '' : 'nobg',
					'href': 'javascript:;',
					'events': {
						'click' : function(){
							if ( document.all )
								window.external.addFavorite($_CONFIG['favlink']['host'], $_CONFIG['favlink']['title']);
							else if ( window.sidebar )
								window.sidebar.addPanel($_CONFIG['favlink']['title'], $_CONFIG['favlink']['host'], "");
						}
					}
				}).set('text', $_CONFIG['favlink']['text']) );

				first = i ? topmenu[0] : null;

				if ( i >= menus || i < 0 ){
					target.appendChild(el);
				} else {
					var before = $_find('cat', topmenu[i].parentNode.className) ? topmenu[i].parentNode : topmenu[i];
					target.insertBefore(el, before);
				}
			}

			if(first) 
				first.style.background = 'none';
		}
		catch(e){}

		var gotop=new Element('a', {
			'class': 'gotop',
			'styles': {
				cursor: 'pointer', 
				position:'fixed',
				zIndex:10,
				'bottom':'10%',
				display: 'none'
			},
			'events': {	
				'click' : function(){ 
					document.body.scrollTo(0); 
					this.setStyle('display', 'none');
					return false;
				} 
			}
		});

		var backTopLeft=function(){
			var btLeft = window.getWidth()/2+485;
			if(window.ie6) gotop.setStyle('position', 'absolute');
			if(btLeft <= 970){
				gotop.setStyle('left', 970);
			}else{
				gotop.setStyle('left', btLeft);
			}
		};

		window.addEvents({
			'domready': function(){
				gotop.inject(document.body);
				backTopLeft();
			},
			'scroll': function(){
				if(window.getScrollTop()===0){
					gotop.setStyle('display', 'none');
				}else{
					gotop.setStyle('display', 'block');
					if(window.ie6)
						gotop.setStyle('top', window.getScrollTop()+window.getHeight()-150);
				}
			},
			'resize':function(){
				backTopLeft();
			}
		});
	}
});

$_DUCEDIS.initFoot();

