$(document).ready(function(){
	try{
		$("a[rel^='prettyPhoto']").prettyPhoto();
	}catch(e){}


	$('table.menu div.menu').hover(function(){
		if($(this).children().hasClass('select')) return;

		$(this).children().addClass('selected');
		$(this).children().addClass('hand');
	}, function(){
		if($(this).children().hasClass('select')) return;

		$(this).children().removeClass('selected');
		$(this).children().removeClass('hand');
	});

	$('table.menu #title').click(function(ev){
		window.location.href = 'index.php';
	});

	$('table.menu div.menu').click(function(ev){
		if($(this).children().hasClass('select')) return;

		$('table.menu div.menu').children().removeClass('hand');
		$('table.menu div.menu').children().removeClass('select');
		$('table.menu div.menu').children().removeClass('selected');
		$(this).children().addClass('select');
		$(this).children().addClass('selected');

		window.location.href = $(this)[0].id + '.php';
	});

	$("a.to-top").click(function(){
		$(this).blur();
		$('html,body').animate({ scrollTop: 0 }, 'slow', 'easeOutExpo');

		return false;
	});

	$('a[href*=#]').click(function() {
		if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname){
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if($target.length){
				var targetOffset = $target.offset().top - 25;
				$('html,body').animate({scrollTop: targetOffset}, 'slow', 'easeOutExpo');
				return false;
			}
		}
	});

	$('.date_input').datepicker({
		showOn: 'button',
		buttonImage: 'img/calender_btn.png',
		buttonImageOnly: true,
		dateFormat: 'yy/mm/dd'
	});

});

