/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var $ = jQuery.noConflict();
$(document).ready(function(){
    $('form.addComment').livequery(function(e){        
    	$(this).submit(function(e)
        {
    	   var formContainer = $(this).parents('div.commentFormContainer');	
           var options = {
               success: function(r)
               {
                  $(formContainer).html(r);
               }
           };
           $(this).ajaxSubmit(options);
           return false;
       });
   });
    $('div.commentItem a.responseLink, div.commentItem a.commentLink').click(function(e){        
    	var a = $(this);
    	$('div.commentItem a.responseLink').show();
    	$('div.commentItem div.commentFormContainer div.commentForm').remove();
        $.ajax({
            url: a.attr('href'),
            success: function(t)
            {
                a.parents('div.commentItem').find('div.commentFormContainer').html(t);
            }
        });    	
        if(!a.hasClass('commentLink')) a.hide();
    	return false;
    });     
    
    $('#confirm_newsletter').live('click',function(e){        
    	var a = $(this);
    	var email = $(this).parents('.newsletter_form').find('#email').val();

        $.ajax({
            url: '/pl/content/index/newsletter/email/'+email,
            success: function(t)
            {
                a.parents('div#contentNewsletter').html(t);
            }
        });    	
    	return false;
    });     
    
    
    $('form.addRecommend').livequery(function(e){        
    	$(this).submit(function(e)
        {
    	   var formContainer = $(this).parents('div.recommendFormBox');	
           var options = {
               success: function(r)
               {
                  $(formContainer).html(r);
               }
           };
           $(this).ajaxSubmit(options);
           return false;
       });
   });
    $('div.recommendForm a').click(function(e){        
    	var a = $(this);
        $.ajax({
            url: a.attr('href'),
            success: function(t)
            {
                $('div.recommendFormBox').html(t);
            }
        });    	
    	return false;
    });        
});

