 jQuery.noConflict();

function submitComment(obj, form_action) {

	if (document.forms.comment_form.new_comment.value == '') {
		alert ('Please enter a comment');
	} else {

  	SubmitForm(obj, form_action);
}
}

//$(function(){
jQuery(document).ready(function(){

jQuery('#moreComments').hide();
 var jump, obj;

// jump down to hidden form
 if ((jump = (window.location.href).match(/#add-comment$/)) != null) {
 if ((obj = jQuery(jump[0])).length) {
	jQuery('#slickbox').show();
	jQuery('textarea').focus();
	jQuery('html,body').scrollTop(obj.offset().top - 10);
 }
} else {
 jQuery('#slickbox').hide();
}



 // toggles the slickbox on clicking the noted link  
	jQuery('a#slick-toggle').click(function() {
		jQuery('#slickbox').toggle();
		jQuery('textarea').focus();
    return false;
  });
	
 // shows the slickbox on clicking the noted link  
  jQuery('a#slick-show').click(function() {
   jQuery('#moreComments').show('slow');
		jQuery('#show-link').hide('fast');
		jQuery('#hide-link').show('fast');
    return false;
  });


jQuery('textarea').keyup(function(){ 
      if(this.value.length >= 500) { 
           //handle the over the limit part here 
           jQuery(this).addClass('overlimit'); 
           this.value = this.value.substring(0, 500); 
      } else { 
          jQuery(this).removeClass('overlimit'); 
      } 
     jQuery('#counter').text(500-this.value.length + ' characters remaining') ; 

}); 

});


