Cufon.replace('h1', {fontFamily: 'citystedmedi'});
	Cufon.replace('h2', {fontFamily: 'citystedmedi'});
	Cufon.replace('h3', {fontFamily: 'citystedmedi'});
	Cufon.replace('h4', {fontFamily: 'cgpasqualeit'});
	Cufon.replace('#adres', {fontFamily: 'citystedmedi'});	
	Cufon.replace('#adres_extra', {fontFamily: 'citystedmedi'});
	Cufon.replace('#qm', {fontFamily: 'cgpasquale', fontSize: '80px'});
	

function showHint ( id, tops ){
	if( $('#hint_' + id ).text() ) { $('#hintdiv').stop().html( $('#hint_' + id ).text() ).show().css({'margin-top': (tops.top - 400) + 'px', 'margin-left': '-20px', 'z-index': '100'}); }
}

function hideHint( id ) {
	if ( $('#hintdiv') ) { $('#hintdiv').stop().hide(); }
}

var counter = 0;
function bounceOut ( a ) {
	$(this).animate({zelf: 1}, 1300).animate({'left' : '-600px'}, 700, false, function() {
		counter = counter + 1;
		if(counter == $('#textanim').children().size()) {
			timer = 0;
			counter = 0;
			$('#textanim').children().each(function() { $(this).css({'left': '820px'}); });
			reanim();
		}	
	});
}

function reanim() {
	var timer = 0;
	$('#textanim').children().each(function() {
		$(this).animate({zelf: 1, 'top': eval(Math.floor((160-39)*Math.random()) - 30) + 'px'}, timer).animate({left: '30px'}, 1900, false, bounceOut);
		timer = timer + 2900;
	});
}

$(document).ready(function() {
	
	reanim();
	
	$('.subblock img').each(function(){
		$(this).hover(
		function() {
			$(this).stop().animate({ opacity: 1 }, 100);
		},
		function() {
			$(this).stop().animate({ opacity: '.5' }, 500);			
		});
	});
	
	$('#header').cycle();
	
});
