/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
jQuery(document).ready(function() {
    jQuery('.b-news .left ul li a').bind('click', function(event) {
        event.stopPropagation();
        event.preventDefault();
        jQuery('.b-news .left ul li').removeClass('active');
        link = jQuery(this).attr('href');
        jQuery(this).parent().addClass('active');
        jQuery.ajax({
            type: "GET",
            url: link,
            dataType: 'html',
            success: function(msg) {
                targetDiv = jQuery('.b-news .right .inside');
                targetDiv.empty();
                targetDiv.append(msg);
            },
            error: function (msg) {
                targetDiv = jQuery('.b-news .right .inside');
                targetDiv.empty();
                targetDiv.append("Shit Happens!<br />"+msg);
            }
        });
    });
    jQuery('form#subscribe').submit(function(event) {
        event.stopPropagation();
        event.preventDefault();
        email = jQuery('form#subscribe .ft .h input#email').attr('value');
        jQuery.ajax({
            type: "POST",
            url: "/subscribe",
            data: "email="+email,
            success: function(msg) {
                jQuery('.b-news .left ul li').removeClass('active');
                targetDiv = jQuery('.b-news .right .inside');
                targetDiv.empty();
                targetDiv.append(msg);
            }
        });
    });
});


