function scrollingText() {
	var shift;
	var time;
	var indent = parseInt($('.newsline').css('textIndent').replace('px',''));
	shift = $('.newsline ul').outerWidth();
	if (shift <= $('.newsline').width()) return;
	time = Math.round(1000*(shift + indent)/100);
	$('.newsline').animate({'textIndent':-shift + 'px'}, time, 'linear', function(){$('.newsline').css({textIndent:$('.newsline').width()+'px'});scrollingText();});

}

$(function(){
	setTimeout(function(){
		$('.newsline').hover(function(){$('.newsline').stop();},scrollingText);
		scrollingText();
	}, 100);
	$(".contactform :text, .contactform textarea, .commentform :text, .commentform textarea").labelify({ text: "label" }).addClass('wide');
	$('.contactform label').parent().css('display', 'none');
	$('.commentform label span.vote').css('display', 'none');
	$('.commentform dl').children('dt').css('display', 'none');
	$('.commentform dd').css({
		width: 'auto'
	});
	$('dd ul.errors').css({
		width: '100%'
	});
	$('.commentform dd#vote-element').css({
		float: 'left'
	});
	$('.footer .feedback a').tooltip({showURL: false, track:true, fade: 250, positionLeft: true, left: -10, top: -40});
	$('a.category-block .category-face, a.category-inline .category-face').css({opacity:1});
	$('a.category-block, a.category-inline').hover(function(){$('.category-face', this).stop(true).animate({opacity:0}, 'slow');}, function(){$('.category-face', this).stop(true).animate({opacity:1}, 'slow');});

	$('ul.partners li.partner-item .partner-name, ul.partners li.partner-item .partner-thumb').tooltip({
		bodyHandler: function() {
			return $(this).parents('li.partner-item').children('.partner-description').html();
		},
		showURL: false,
		track:true,
		fade: 250
//		positionLeft: true,
//		left: -10,
//		top: -40
	});
	$('input.vote').rating(); 

	$('ul.links li a').tooltip({
		bodyHandler: function() {
			return $(this).parents('li').children('.link-description').html();
		},
		showURL: false,
		track:true,
		fade: 250,
		positionLeft: true,
		left: -10,
		top: -40
	});
	$('ul.documents li a').tooltip({
		bodyHandler: function() {
			return $(this).parents('li').children('.document-description').html();
		},
		showURL: false,
		track:true,
		fade: 250,
		positionLeft: true,
		left: -10,
		top: -40
	});
	$('ul.links li .link-description, ul.documents li .document-description').css('display', 'none');
	$('a.link-block .link-back, a.document-block .document-back').css({top: 0, opacity:0});
	$('a.link-block').hover(function(){$('.link-back', this).stop(true).animate({opacity:1}, 'slow');}, function(){$('.link-back', this).stop(true).animate({opacity:0}, 'slow');});
	$('a.document-block').hover(function(){$('.document-back', this).stop(true).animate({opacity:1}, 'slow');}, function(){$('.document-back', this).stop(true).animate({opacity:0}, 'slow');});

	$('a[rel=external]').each(function(){$(this).attr('target', '_blank');});
	
	$(".map").maphilight({fade: false});

	$("form.search input:text").labelify({ text: "label" });
	$('form.search dl dt').css('display', 'none');

	$('map *').tooltip({showURL: false, fade: 250, track:true});

});

