$(document).ready(function(){
    
    /* Work grid thumbnail behavior */
    $('#work a').each(function(){
        var title = $(this).attr('title');
        $(this).removeAttr('title');
        var message = "<span>" + title + "</span>";
        $(this).prepend(message);
    });
    
    $('#work a').hover(function(){
        $(this).children('span').stop().animate({
            top : '0'
        },200);
        $(this).children('img').stop().animate({
            top : '25px'
        },200);
    },function(){
        $(this).children('span').stop().animate({
            top : '-26px'
        },200);
        $(this).children('img').stop().animate({
            top : '0'
        },200);
    });
    
    /* external links */
    externalLinks();
    
    /* TODO Footer link pop backup for ie6 */
    
    /* TODO drop up hover keep */
    
});


function externalLinks() {
    if (!document.getElementsByTagName){
        return;
    }
    
    var anchors = document.getElementsByTagName("a");
    
    for (var i=0; i<anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
            anchor.target = "_blank";
        }
    }
}