$(document).ready(function() {  
  
    $('textarea[maxlength]').keyup(function(){  
        //get the limit from maxlength attribute  
        var limit = parseInt($(this).attr('maxlength'));  

        //get the current text inside the textarea  
        var text = $(this).val();  
        //count the number of characters in the text  
        var chars = text.length;  
  
        //check if there are more characters then allowed  
        if(chars > limit){  
            //and if there are use substr to get the text before the limit  
            var new_text = text.substr(0, limit);  
  
            //and change the current text with the new text  
            $(this).val(new_text);  
        }  
		
		//info o ilosci znakow
		id_max = '#' + this.id + '_max';
		$(id_max).html('Liczba znaków: '+limit + ', pozostało: '+ (limit-chars));
    });  
	
	
	

	

  
});


function dodaj_art()
{
	$('#dodaj_art').show('fast');
	
	if ( window.CKEDITOR && false)
	{
		CKEDITOR.replace( 'kol_tekst',{
			//contentsCss : '{$C4_WWW.ckeditor_css}'
			//,filebrowserBrowseUrl: "{/literal}{$C4_WWW.site_url_cms}{literal}apps/kfm/"						
			//,filebrowserBrowseUrl: "{/literal}{$C4_WWW.site_url_cms}{literal}apps/simogeo/index.html"
	  });                
	}
	
	//$('#dodaj_art').slideDown();
	
	return false;
}
