     function count_key(textarea,counter,limit)
{
if((a=textarea.value.length)<=limit)
counter.value=limit-a;
else
	{
textarea.value=textarea.value.substring(0,limit);
alert("Maksymalnie 1000 znaków");
	}
}

	  $(document).ready(function() {
		$('.adver').mouseover(

			function()
		  {
			$(this).css("background-color","#e0e9ff");

		  });
		  $('.adver').mouseout(

			function()
		  {
			$(this).css("background-color","#ffffff");

		  });

		  $('.sprzedam_click').click(
			function()
		  {
			$(".Sprzedam").slideUp()
			$(".Kupię").slideUp()
			$(".Oddam").slideUp()
			$(".Przejmę").slideUp()
			$(".Sprzedam").slideDown()
		  });

		$('#modmar_next').click(
			function()
		  {
			$("#modmar").animate( { top:"-=160px" })
		  });
		  $('#points').load('points_howmany.php');
		  
         $("a.iframe").fancybox();
		 $("input#please_login.iframe").fancybox();
		 $("a.group").fancybox();
		 $("a.iframe").fancybox({
			 frameHeight: 270
		 });
    	 $("#form").validate({
			 rules: {
			    phone: {
			      digits: true
			    },
				email	: {
			      email: true
			    },
			  }
			});
		 $(".show_premium_adver").click(
			function()
			{
			$(".show_fast_adver").css({"background-color" : "#ebebeb", "border-bottom-width" : "1px"});
			$(".show_premium_adver").css({"background-color" : "#ffffff", "border-bottom-width" : "0px"});
			$("#fast_adver").css({"display" : "none"});
			$("#premium_adver").fadeIn("slow");
		});
		$(".show_fast_adver").click(
			function()
			{
			$(".show_premium_adver").css({"background-color" : "#ebebeb", "border-bottom-width" : "1px"});
			$(".show_fast_adver").css({"background-color" : "#ffffff", "border-bottom-width" : "0px"});
			$("#premium_adver").css({"display" : "none"});
			$("#fast_adver").fadeIn("slow");
		});
			var temp = $.get("index.php");
			var button_1 = $('#upload_button_1'), interval;
			new AjaxUpload(button_1,{action: 'upload.php', 
			//action: 'upload.htm', 
			name: 'myfile',	onSubmit : function(file, ext){	if (! (ext && /^(jpg|jpeg)$/.test(ext))){ alert('Błąd! Wybierz pliki typu jpg/jpeg'); return false;
                }
				button_1.html('<img src="images/esetka_loading.gif" alt="" />');
				this.disable();
				interval = window.setInterval(function(){
					var text = button_1.html();
				}, 200);
				},
				onComplete: function(file, response){button_1.html('<img src="images/photo_added.gif" alt="" />'); window.clearInterval(interval); this.disable();
					$.ajax({type: "POST", url: "points_increase.php", data: "", success: function(){ $('#points').load('points_howmany.php'); } }); }
				});
 });
