function initMenu()
{
	var nodes = document.getElementById("content").getElementsByTagName("li");
	for (var i=0; i<nodes.length; i++)
	{
		nodes[i].onmouseover = function()
		{
			this.className += " hover";
		}
		nodes[i].onmouseout = function()
		{
			this.className = this.className.replace(" hover", "");
		}
	}
}
if (document.all && !window.opera) attachEvent("onload", initMenu);

function initFadeGallery() {

	// settings
	var _item = $('#right .gallery .images a');
	var _len = _item.length;
	var _prev = 0;
	var _next = 0;
	
	var __hovered = false;
	var __delay = 5000; // pause
	var __duration = 800; // slide duration
	
	// reset
	_item.eq(_prev).css('z-index',2);
	
	function ajaxed(_obj) {
		var _href = _obj.attr('rel');
		if(_href) {
			_obj.html('<img src="' + _href + '" alt=""/>')
			.css({
				'opacity':0,
				'text-indent':0
			}).animate({
				'opacity':1
			},__duration);
			$('span.loading').hide();
			// include files ajax commented
			/*
			$.ajax({
				url: _href,
				cache: false,
				dataType: 'html',
				success: function(_html){
					_obj.html(_html).css({
						'opacity':0,
						'text-indent':0
					}).animate({
						'opacity':1
					},__duration);
					$('span.loading').hide();
				}
			});
			*/
		}
	}
	ajaxed(_item.eq(_next));
	
	// autofading
	function autoFade(){
		setInterval(function(){
			if(!__hovered) fadeMe();
		},__delay)
	}
	
	// fadin'
	function fadeMe() {
		_prev = _next;
		if(_next!=_len-1) _next++
		else _next = 0;
		
		_item.css('z-index',1);
		_item.eq(_prev).css('z-index',2);
		_item.eq(_next).css({
			'z-index':3,
			'opacity':0
		});
		ajaxed(_item.eq(_next));
	}
	
	// hover
	_item.parent().hover(function(){
		__hovered = true;
	},function(){
		__hovered = false;
	});
	
	// init
	autoFade();
}

function initSlideGallery(){
	
	// settings
	var _slider = $('#sidebar .text div');
	var _len = _slider.find('li').length;
	var _elWidth = 260;
	var _maxWidth = _len * _elWidth;
	
	var __hovered = false;
	var __delay = 10000; // pause
	var __duration = 800; // slide duration
	
	//reset
	var _before = _slider.find('ul').clone(true).prependTo(_slider);

	// autoslide
	function autoSlide(){
		setInterval(function(){
			if(!__hovered) slideMe();
		},__delay)
	}
	
	// slidin'
	function slideMe() {
		_slider.animate({
			'marginLeft':'-=' + _elWidth
		},__duration,function(){
			if(parseInt(_slider.css('marginLeft')) == -_maxWidth) _slider.css('marginLeft',0);
		});
	}
	
	// hover
	_slider.parent().hover(function(){
		__hovered = true;
	},function(){
		__hovered = false;
	});
	
	// init
	autoSlide();
}

