$(document).ready(function(){
	$("#btn-client-zone").click(function(){

		if($.browser.msie && $.browser.version<"8.0")
		{
			$("#login-form").css({
				position: "absolute",
				top: $(window).height()/10,
				left: $(window).width()/2 - $("#login-form").width()/2,
				"z-index": "1001"
			}).fadeIn(500);

			$("#login-form-overlay").css({
				width: $("html").width(),
				height: $("html").height(),
				opacity: .5,
				position: "absolute",
				top: "0",
				left: "0",
				"z-index": "100"
			}).fadeIn(300);
		}
		else
		{
			$("#login-form-overlay").css({
				width: $("html").width(),
				height: $("html").height(),
				opacity: .5,
				position: "absolute",
				top: "0",
				left: "0",
				"z-index": "1000"
			}).fadeIn(300);

			$("#login-form").css({
				position: "fixed",
				top: $(window).height()/10,
				left: $(window).width()/2 - $("#login-form").width()/2,
				"z-index": "1001"
			}).fadeIn(500);
		}
		return false;
	});

	$("#btn-close-login-form").click(function(){
		$("#login-form-overlay").fadeOut(500);
		$("#login-form").fadeOut(300);
		return false
	});

	$("#login-form .submit").mouseover(function(){
		$(this).removeClass("submit");
		$(this).addClass("submit-over");
	}).mouseout(function(){
		$(this).removeClass("submit-over");
		$(this).addClass("submit");
	}).click(function(){
		client_name = $("#client-name").val();
		client_passwd = $("#client-passwd").val();
		$.ajax({
		  url: __WEB_BASE__ + "client_login.php",
		  global: false,
		  type: "POST",
		  data: ({name : client_name, passwd: client_passwd}),
		  success: function(msg){
			
			if (msg == "ok")
				location.assign(__WEB_BASE__ + "sk/klientska-zona.html");
			else
				$("#login-message").html("Nesprávne prihlasovace údaje !");
		  }
	   });
		return false;
	});
});


