jQuery.fn.tooltip = function () {
	var showtooltip = 0;
    this.mouseenter(function() {
		showtooltip = 1;
		var tp = $(this);
			if ((showtooltip == 1) && (tp.attr('title') != ''))
			{
				var value = tp.attr('title');
				//value = value.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2')
				tp.attr('title', '');
				$('#tooltip p').html(value);
				var leftpos = tp.offset().left;
				leftpos = (leftpos+(tp.width()/2))-($('#tooltip').width()/2);
				var toppos = tp.offset().top;
				$('#tooltip').show();
				$('#tooltip').css({'height':($('#tooltip p').height()+20)+'px'})
				toppos = toppos-$('#tooltip').height()-10;
				$('#tooltip').css({"left":leftpos+"px","top":toppos+"px"});
			}
	});
	this.mouseleave(function() {
		var value = $('#tooltip p').html();
		if (value != '')
			$(this).attr('title', value);
		$('#tooltip').hide();
		showtooltip = 0;
	})
}

jQuery.fn.forminfo = function() {
			if ($(this).val() != '') {
				if (($(this).attr('name') == 'osoby') || ($(this).attr('name') == 'dni')) {
					$(this).removeClass('nieokreslona');
				} else {
					$(this).removeClass('nieokreslony');
				}
			} else {
				if (($(this).attr('name') == 'osoby') || ($(this).attr('name') == 'dni')) {
					$(this).addClass('nieokreslona');
				} else {
					$(this).addClass('nieokreslony');
				}
			}
}

function nopl(str)
{
	str = str.replace(/ą/g, "a");
	str = str.replace(/ś/g, "s");
	str = str.replace(/ć/g, "c");
	str = str.replace(/ę/g, "e");
	str = str.replace(/ń/g, "n");
	str = str.replace(/ó/g, "o");
	str = str.replace(/ł/g, "l");
	str = str.replace(/ź/g, "z");
	str = str.replace(/ż/g, "z");
	str = str.replace(/Ą/g, "A");
	str = str.replace(/Ś/g, "S");
	str = str.replace(/Ć/g, "C");
	str = str.replace(/Ę/g, "E");
	str = str.replace(/Ń/g, "N");
	str = str.replace(/Ó/g, "O");
	str = str.replace(/Ł/g, "L");
	str = str.replace(/Ź/g, "Z");
	str = str.replace(/Ż/g, "Z");
	str = str.replace(/ /g, "-");
	str = str.replace(/&/g, "");
	str = str.replace(/\?/g, "");
	str = str.replace(/!/g, "");
	str = str.replace(/%/g, "");
	str = str.replace(/\//g, "-");
	str = str.replace(/\(/g, "");
	str = str.replace(/\)/g, "");
	str = str.replace(/</g, "");
	str = str.replace(/>/g, "");
	str = str.replace(/:/g, "");
	str = str.replace(/\./g, "");
	str = str.replace(/,/g, "");
	str = str.replace(/-+/g, "-");
	str = str.replace(/^-/g, "");
	str = str.replace(/-$/g, "");
	return str;
}
