function blog_global(){
/**
 *
 *  Defines the parent Category for the Blog
 */

var CAT=47;
    
    
    // Adjust links within fancybox layers
        if ($('.fancybox') !== null) {
            var hrefOriginal   = '';
            var redirectPrefix = '/redirect?target=';
            $('.blog .fancybox').each(function() {
                var href = $(this).attr('href');
                if (href !== null && href.indexOf('/redirect?target=') === -1 ) {
                    hrefOriginal = $(this).attr('href');
                    $(this).attr('href', redirectPrefix + hrefOriginal);
                }
            });
        }

    // Facebook
    FB.init({ 
        appId:'', cookie:true, 
        status:true, xfbml:true 
    });
    
    // Read More Link (single)
    $('.nav-previous a').bind('mouseenter',function(){
        $(this).children().children().attr('src','public/images/arrow_textlink_hover.png');
        $(this).css('color', '#136d7b !important');
    });
    $('.nav-previous a').bind('mouseout',function(){
        $(this).children().children().attr('src','public/images/arrow_textlink.png');
        $(this).css('color', '#124047 !important');
    });
    $('.nav-next a').bind('mouseenter',function(){
        $(this).children().children().attr('src','public/images/arrow_next_article_hover.png');
        $(this).css('color', '#136d7b !important');
    });
    $('.nav-next a').bind('mouseout',function(){
        $(this).children().children().attr('src','public/images/arrow_next_article.png');
        $(this).css('color', '#124047 !important');
    });

    $('.more a').bind('mouseenter',function(){
        $(this).children().attr('src','public/images/arrow_textlink_hover.png');

    });
    $('.more a').bind('mouseout',function(){
        $(this).children().attr('src','public/images/arrow_textlink.png');
    });

    $('.makeComment a').bind('mouseenter',function(){
        $(this).children().attr('src','public/images/arrow_textlink_hover.png');

    });
    $('.makeComment a').bind('mouseout',function(){
        $(this).children().attr('src','public/images/arrow_textlink.png');
    });

    if ($('#readmore')) {
        $('#readmore').bind('click', function(event) {
         
            if (event) {
                event.preventDefault();
            }
            
            var restcontents = $('.restcontents');
            
            if (restcontents) {
                $('.restcontents').fadeIn();
                $(this).parent().hide();    
            }
        });
    } 

    if ($('#makeAComment')) {
        $('#makeAComment').bind('click', function(event) {    

            if (event) {
                event.preventDefault();
            }
            
            if ($('.fb_iframe_widget')) {
                $('.fb_iframe_widget').fadeIn();
                $(this).parent().hide();
            }
        });
    }
    //rewriting links
    $('.blog a.fancybox').each(function(){
    	var THEME;
    	
    	THEME = 'dark';
 
    	
    	$(this).attr('href', $(this).attr('href') + '?t=' + THEME + ';amp;c=' + CAT );
    
    });
    
   $('.layer_close').html('').removeClass('layer_close').addClass('closelayer');
    
    $('.xoxo a, .cat-entry a, .fancybox').fancybox(); // needed? yes!
    $('.cats a').removeAttr('href')
    $.fancybox.resize();
    

}


// from http://widgets.twimg.com/j/1/widget.js
var K = function () {
    var a = navigator.userAgent;
    return {
        ie: a.match(/MSIE\s([^;]*)/)
    }
}();
 
var H = function (a) {
    var b = new Date();
    var c = new Date(a);
    if (K.ie) {
        c = Date.parse(a.replace(/( \+)/, ' UTC$1'))
    }
    var d = b - c;
    var e = 1000,
        minute = e * 60,
        hour = minute * 60,
        day = hour * 24,
        week = day * 7;
    if (isNaN(d) || d < 0) {
        return ""
    }
    if (d < e * 7) {
        return "right now"
    }
    if (d < minute) {
        return Math.floor(d / e) + " seconds ago"
    }
    if (d < minute * 2) {
        return "about 1 minute ago"
    }
    if (d < hour) {
        return Math.floor(d / minute) + " minutes ago"
    }
    if (d < hour * 2) {
        return "about 1 hour ago"
    }
    if (d < day) {
        return Math.floor(d / hour) + " hours ago"
    }
    if (d > day && d < day * 2) {
        return "yesterday"
    }
    if (d < day * 365) {
        return Math.floor(d / day) + " days ago"
    } else {
        return "over a year ago"
    }
};

