$(function(){
	$('#menutop .m').hover(function(){
		$(this).addClass('over');
	},function(){
		$(this).removeClass('over');
	});
	
	$('#menu .m1').hover(function(){
		$(this).addClass('m1_over');
	},function(){
		$(this).removeClass('m1_over');
	});
	
	$('#menu .m2').hover(function(){
		$(this).addClass('m2_over');
	},function(){
		$(this).removeClass('m2_over');
	});
	
	$('#menu .m1, #menu .m2, #menutop .m').click(function(){
		window.location.href=$(this).find('a').attr('href');
	});	
	
	$('.hint').clearField();
	
	$('img').load(function(){
		boxy();
	});
	
	boxy_logowanie();
	
})

var $poprzednia_tresc = '';
function zablokuj($id)
{
	$e = document.getElementById($id);
	$poprzednia_tresc = $e.value;
	$e.value = 'Proszę czekać';
	$e.disabled = true;
}
function odblokuj($id)
{
	$e = document.getElementById($id);
	$e.value = $poprzednia_tresc;
	$e.disabled = ''; 
}
function addslashes( str ) {
    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");   
}
function szukajCheck(){
	$k = $('#szukajQuickValue');
	
	if($k.val()=='' || $k.val()=='wpisz szukaną frazę...'){
		alert("Proszę uzupełnić pole 'Szukaj'");
		$k.focus();
		return false;
	}
	
	return true;
}
function boxy(){
	$max_height = 0;
	$max_id = 0;
	$('.box_02').each(function(){
		$c = $(this).height();
		if($c > $max_height){
			$max_height = $c;
		}
	});
	
	$('.box_02').css('height',$max_height);
}

function boxy_logowanie(){
	$('#inputLogin,#inputPassword').focus(function(){
		$('#belka .b04').removeClass('b04_blur');
		$('#belka .b05').removeClass('b05_blur');
	}).blur(function(){
		if($('#inputLogin').val()=='' && $('#inputPassword').val()==''){
			$('#belka .b04').addClass('b04_blur');
			$('#belka .b05').addClass('b05_blur');
		}
	});
	
	
}

function loginCheck(){
	$l = $('#inputLogin').val();
	$p = $('#inputPassword').val();
	
//	zablokuj('btn-submit');
	xajax_zaloguj($l,$p);
}
function wyloguj(){
	xajax_wyloguj();
}
