	$(function() {
    	var clickMenuHref = false;
		function _showError(msg) {
			$('#messages', this).html(msg);
		}
			    	
        $('#listProfileRegister').tabs({ fxAutoHeight: false, disabled: [2,3,4,5] });                
		$('#listProfile').tabs({ fxAutoHeight: false, disabled: [], bookmarkable: false });           
		$('#dayList').tabs({ fxAutoHeight: true, disabled: [], bookmarkable: false });          				     
		$('#billingProfile').tabs({ fxAutoHeight: false, disabled: [], bookmarkable: false });          				     
		
		$('.printLink').click(function(){ $.jPrintArea('.printArea') }); 
		$('#logowanie form').submit(function() {
			$.ajax({
				url: $(this).attr('action'),
				type: 'POST',
				dataType: 'json',
				data: $(':input', this).serialize(),
				success: function(json) {
					if((json.error == "") || (json.error == 1)) {
						document.cookie = "login=" + escape(json.login)+";path=/";
						window.location.href = window.location.href; 
					} else {
						_showError(json.error);
					}
				},
				error: function() {
					_showError('Wystąpił nieznany błąd.');
				}      	
			});			
			return false;
		});
		$('#loginForgotSubmit').click(function() {
			$.ajax({
				url: '/profile/index/forgotfirst',
				type: 'POST', dataType: 'html',
				data: {'email': $('#loginForgotEmail').val()},
				success: function(text) {
					if(text == "0") {
						_showError("Podany email nie istnieje w bazie.");
					} else {
						$('#loginForgotQuestion').html(text);
						$('#loginForgotTab').hide();
						$('#loginQuestionTab').show();
					}
				},
				error: function() {
					_showError('Wystąpił nieznany błąd.');
				}      	
			});				
			return false;
		});
		$('#loginQuestionSubmit').click(function() {
			$.ajax({
				url: '/profile/index/forgotlast',
				type: 'POST', dataType: 'html',
				data: {'answer': $('#loginQuestionValue').val()},
				success: function(text) {
					if(text == "0") {
						_showError("Odpowiedź niepoprawna.");
					} else {
						$('#loginForgotPasword').html(text);
						$('#loginQuestionTab').hide();
						$('#loginAnswerTab').show();
					}
				},
				error: function() {
					_showError('Wystąpił nieznany błąd.');
				}      	
			});				
			return false;
		});
		
		$('#loginRegister a.thickbox').click(function() {
			$('.jsHide').hide();
			$('#loginForgotEmail').val("");
			$('#loginQuestionValue').val("");
			$('#loginForgotPasword').html("");
			$('#loginForgotQuestion').html("");
		});
				
		var $parent = $('#advSearch').get(0);
		$('input[name=pay]', $parent).click(function() {
			if($(this).val() == 2) {
				$('#payPrice').show();
			} else {
				$('#payPrice').hide();
			}
		});
    });
    
    $.fn.replace = function(a) { return this.after(a).remove(); }; 
    
    function rozmiar(warstwa, size) {

		$("."+warstwa+"").css("fontSize",""+size+"px");
	}

bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
       return false
   } else if (bIE && (event.button >1)) {
      return false;
   }
}

function clickIE() {if (document.all) {return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {;return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}