function activateForms(selector) {
    
    $(selector).find('.comment-write textarea[name="msg"]').focus(function(){
        var el = jQuery(this);
        el.height(56);
        //el.parents('form').append('<input type="hidden" name="fukbots" value="NONCE" />');
        //el.val('');
    });
		    
    $("form").filter(selector).bind('submit', function(evt) {
        evt.preventDefault();
        var form_el = $(this),
            form = {};
		
        		
        jQuery.each(form_el.serializeArray(), function(i, kv){
            form[ kv.name ] = kv.value;
        });
        
        if(form.msg == 'write comment...' || !form.msg)
			return;
						
		form_el.parent().find('.comment-loader').show();
				        
        // ajax post & get
        jQuery.post(
			'rpc-pt_comment-s9.cfm', // url to post to
            form_el.serialize(), // data
            
			function(data){ // callback
				$.get(
					'rpc-comments-list-s9.cfm', 
					{blogid: form_el.parent().find('input[name="commentBlogID"]').val() }, 
					function(s){ form_el.parent().find('.commentbox').html(s); }
				);
				form_el.parent().find('.comment-loader').hide();
				form_el.parent().find('textarea[name="msg"]').val('write comment...');
				form_el.parent().find('textarea[name="msg"]').height(16);                
                
            }, 
            'html' // return type			
		); 
			
    });
    
    // Submits the comment form when user clicks the link
    $(selector).find(".comment-submit > a").click(function(evt) {
        evt.preventDefault();
        var el = $(this);
        el.parents('form').submit();		
    });
    
    $(selector).find('.comment-write textarea[name="msg"]').each(function() {
        var default_value = this.value;
        $(this).focus(function() {
            if(this.value == default_value) {
                this.value = '';
            }
        });
        $(this).blur(function() {	
            if(this.value == '') {
                this.value = default_value;
            }
        });
    });
    

}

$(function() {
    activateForms();
});
