/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var $ = jQuery.noConflict();
$(document).ready(function(){

    $('.post_read_more').livequery(function(e){
    $(this).each(function(index,item){

        $(item).bind("click", function(){
            
            $(item).parent().parent().find('.post_content_all').toggle("fast");
            return false;
           });
        });
    });
    $('.post_paginator').livequery(function(e){
        
        $(this).find('a').each(function(index,item){
            $(item).bind("click", function(){

                   $.ajax({
					type: 'post',
					url: $(item).attr('href'),
					error: function(){},
			    	success: function(t)
			    	{
				  		
                        $('.blog_posts').html(t);
                       
                        return false;
					}                    
                    });
                
                return  false;
            });
        });
    });
    $('.post_add_comment a').livequery(function(e){
       $(this).each(function(index,item){
            $(item).bind("click", function(){
                  $.ajax({
					type: 'post',
					url: $(item).attr('href'),
					error: function(){},
			    	success: function(t)
			    	{

                        $(item).parent().parent().find('.post_add_comment_form').html(t);
                        $(item).parent().parent().find('.post_add_comment_form').toggle();


                        return false;
					}
                    });
                    return false;

            });
       });
    });
    $('#post_commentAddForm').livequery(function(){
         $(this).submit(function(e)
         {
            var options={
                success: function(r)
                {
                    $('.new_post_comment').html(r);
                }
            };
            $(this).ajaxSubmit(options);
            return false;
        });
    });
    $('.post_show_comments').livequery(function(e){
    $(this).each(function(index,item){
        $(item).bind("click", function(){


              $.ajax({
					type: 'post',
					url: $(item).attr('href'),
					error: function(){},
			    	success: function(t)
			    	{
                        $(item).parent().parent().find('.post_comments').html(t);
                        $(item).parent().parent().find('.post_comments').toggle("fast");
                        return false;
					}
                    });
            return false;
           });
        });
    });
    $('.post_comments_paginator').livequery(function(e){

        $(this).find('a').each(function(index,item){
            $(item).bind("click", function(){

                   $.ajax({
					type: 'post',
					url: $(item).attr('href'),
					error: function(){},
			    	success: function(t)
			    	{

                        $('.post_comments_div').html(t);

                        return false;
					}
                    });

                return  false;
            });
        });
    });

});


