$(document).ready(function() {

	$('body').append('<img id="preload" src="'+imgfile+'"/>');
	$('#preload').load(function() {
		$(this).remove();
		$('#top').prepend('<div id="anim1"></div><div id="anim2"></div>');
		$('#anim1, #anim2').css({'opacity': 0}).animate({opacity: 1}, 500);
		var i = 0;
		var t = setInterval(function() {
			i -= imgtype;
			if (i < imgtype2) i = 0;
			$('#anim2').stop()
				.css({"opacity": 0, "background-position": "0 " + ((imgtype == 223 || imgtype == 210) ? i - 1 : i) + "px"})
				.animate({"opacity": 1}, 1250, function() {
					$('#anim1').css({"background-position": "0 " + ((imgtype == 223 || imgtype == 210) ? i - 1 : i) + "px"});
					$(this).css({"opacity": 0});
				});
		}, 2000);
	});

	if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {
		$('#menu > li:has(ul)').hover(function() {
			$(this).find(':first').addClass('active');
			$(this).children('ul').show();
		}, function() {
			$(this).find(':first').removeClass('active');
			$(this).children('ul').hide();
		});
	}

	$('a[href*=".png"], a[href*=".gif"], a[href*=".jpg"], a[href*=".jpeg"]').fancybox({
		'zoomOpacity': true,
		'overlayColor': '#000',
		'overlayOpacity': 0.5,
		'zoomSpeedIn': 400,
		'zoomSpeedOut': 300,
		'enableEscapeButton': true,
		'hideOnOverlayClick': true,
		'hideOnContentClick': true,
		'centerOnScroll': true
	});

	$('#mycarousel, #mycarousel2').jcarousel({
		visible: 5,
		scroll: 5
    });

	$('.news ol li, .news ul li').addClass('redli').wrapInner('<span class="blackli" />');

	if (history.length) {
		$('a.zuruck:not(.nohistory)').attr('href', 'javascript:history.go(-1)');
	}

});