function isInt(input){
	return typeof(input)=='number'&&parseInt(input)==input;
}

function maxRandom(max){
	var num = Math.round(Math.random()*10);
	if(num <= max && num != 0){
		return num;
	}else{
		return maxRandom(max);
	}
}

var timeout; // timeout holder (global)

$(function(){	
	$('a').click(function(){
		this.blur();
	});


	//
	// fake hover (over image anchors set via html style attr)
	$('#navi_1 li a').not('.active').hover(function(){
		$(this).css('background-position','0 bottom');
	},function(){
		$(this).css('background-position','0 top');
	});
	$('#navi_1 li a.active').css('background-position','0 bottom');


	//
	// locations show/hide
	if($('body').hasClass('locationsLayout')){
		$('.loc').css({
			'position' : 'absolute',
			'top' : 0,
			'display' : 'none'
		});
		$('#locations a').click(function(){
			$('#locations a.active').removeClass('active');
			$(this).addClass('active');
			$('.loc').not(':hidden').fadeOut(200);
			$($(this).attr('href')).fadeIn(300);
			id = $(this).attr('id');
			if(id in{loc1:1,loc2:1,loc3:1,loc4:1}){
				switch(id){
					case "loc2":
						img = 'warszava.jpg';
						break;
					case "loc3":
						img = 'bucharest.jpg';
						break;
					case "loc4":
						img = 'geneve.jpg';
						break;
					default:
						img = 'prague.jpg';
						break;
				}
				$('#page_img > img').fadeOut(200,function(){
					$(this).attr('src','/img/page/'+img).fadeIn(300);

				});
			}
		});
		$('a[href="'+window.location.hash+'"]').click();
	}


});
