// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

jQuery.noConflict();

jQuery(document).ready(function($){
     // Do jQuery stuff using $
	function limitChars(textid, limit, infodiv) {
	  var text = $('#'+textid).val(); 
	  var textlength = text.length;
	  if(textlength > limit) {
	    $('#' + infodiv).html('You cannot write more then '+limit+' characters!');
	    $('#'+textid).val(text.substr(0,limit));
	    return false;
	  }
	  else {
	    $('#' + infodiv).html('You have <strong class="letter_count">'+ (limit - textlength) +'</strong> characters left.');
	    return true;
	  }
	}
	
	$(function(){
	  $('#site_description').keyup(function(){
	    limitChars('site_description', 160, 'charlimitinfo');
	  })
	});

});






