// JavaScript Document

jQuery.noConflict();


 jQuery(document).ready(function(){
	
	/**
	 * Character Counter for inputs and text areas
	 */
	jQuery('.word_count').each(function(){
		// get current number of characters
		var length = jQuery(this).val().length;
		var max1 = jQuery(this).attr('maxlength');
		// get current number of words
		//var length = jQuery(this).val().split(/\b[\s,\.-:;]*/).length;
		// update characters 
		jQuery(this).parent().find('.counter').html( (max1-length) );
		// bind on key up event
		jQuery(this).keyup(function(){
			// get new length of characters
			var new_length = jQuery(this).val().length;		
			var new_max1 = jQuery(this).attr('maxlength');
			// get new length of words
			//var new_length = jQuery(this).val().split(/\b[\s,\.-:;]*/).length;
			// update
			jQuery(this).parent().find('.counter').html( (new_max1-new_length) );
		});
		
	});
 

	 
	
});


