
	var timer, timeout = 5000;

	function slide_selfads() {
		$("#selfads li:last").fadeOut(function() {
			$(this).prependTo( $(this).parent() ).show().find('div').hide();
			$("#selfads li:last").find('div').animate({height: "toggle"});
		});
	}
	
	$(document).ready(function() {
		/*
		*	Top menu
		*/

		$("#menu_top td").hover(function() {
			var pos = $('span', this).position();
			var w	= $('ul', this).outerWidth();

			$('ul', this).css({
				top		: pos.top + 33,
				left	: w + pos.left + 46 > $(window).width() ? pos.left	+ $('span', this).width() + 23 - w : pos.left	- 23
			}).show();

			$('a', this).addClass('hover');

		}, function() {
			$('ul',this).hide();
			$('a', this).removeClass('hover');
		});
		
		/*
		*	Fancybox
		*/
		
		$("a[rel=lightbox]").fancybox();

	});
	
	$(window).bind("load", function() {
		/*
		*	Selfads
		*/
	
		timer = setInterval("slide_selfads()", timeout);
		
		$("#selfads").mouseenter(function() {
			clearInterval( timer );
			
		}).mouseleave(function() {
			clearInterval( timer );
			timer = setInterval("slide_selfads()", timeout);
		});
		
		$("#selfads li:last").find('div').animate({height: "toggle"});
	});	