function displayLoader() {
	if ($.browser.msie) {
		var ver = parseInt(jQuery.browser.version);
		if(ver < 7) {
			$('body').css("cursor", "wait");		
		}
		else {
			$('#loader').center();//.show("normal")
			$('#loader').fadeIn("normal");
		}
	} 
	else {
		$('#loader').center().fadeIn("normal");
	}
}

function hideLoader() {
	if ($.browser.msie) {
		var ver = parseInt(jQuery.browser.version);
		if(ver < 7) {
			$('body').css("cursor", 'auto');		
		}
		else {
			$('#loader').fadeOut("normal");	
		}
	} 
	else {
		$('#loader').fadeOut("normal");
	}
}

$(document).ready(function(){
	$('#oferta').click(function(){
		ajax=$('#ajax-enable').val();
		if(ajax == '0')
			return;

		cId=$('#contentId').val();
		if(cId!=1) {
			displayLoader();
			$.post('getfile.php', {sel: 1},
				function(data){
					$('#content').fadeOut('normal', function(){
						$('#content').html(data);						
						$('#content').fadeIn('normal');
						$('#contentId').val(1);
						hideLoader();
					})
				});				
		}
	});
	
	$('#o-mnie').click(function(){
		ajax=$('#ajax-enable').val();
		if(ajax == '0')
			return;
			
		cId=$('#contentId').val();
		if(cId!=2) {
			displayLoader();
			$.post('getfile.php', {sel: 2},
				function(data){
					$('#content').fadeOut('normal', function(){
						$('#content').html(data);						
						$('#content').fadeIn('normal');
						$('#contentId').val(2);
						hideLoader();
					})
				});				
		}		
	});

	$('#glowna').click(function(){
		ajax=$('#ajax-enable').val();
		if(ajax == '0')
			return;
			
		cId=$('#contentId').val();
		if(cId!=0) {
			displayLoader();
			$.post('getfile.php', {sel: 0},
				function(data){
					$('#content').fadeOut('normal', function(){
						$('#content').html(data);						
						$('#content').fadeIn('normal');
						$('#contentId').val(0);
						hideLoader();
					})
				});				
		}	
	});
	
	$('#menu_1').mouseover(function(){
		$('#menu_1_img').attr('src','img/przygotowania_a.jpg');
	});
	$('#menu_1').mouseout(function(){
		$('#menu_1_img').attr('src','img/przygotowania.jpg');
	});
	
	$('#menu_2').mouseover(function(){
		$('#menu_2_img').attr('src','img/slub_a.jpg');
	});
	$('#menu_2').mouseout(function(){
		$('#menu_2_img').attr('src','img/slub.jpg');
	});
	
	$('#menu_3').mouseover(function(){
		$('#menu_3_img').attr('src','img/wesele_a.jpg');
	});
	$('#menu_3').mouseout(function(){
		$('#menu_3_img').attr('src','img/wesele.jpg');
	});
	
	$('#menu_4').mouseover(function(){
		$('#menu_4_img').attr('src','img/sesja_a.jpg');
	});
	$('#menu_4').mouseout(function(){
		$('#menu_4_img').attr('src','img/sesja.jpg');
	});			
});