var elem = null;
$(document).ready(function(){
    elem = $('#brinkabs');
    Yloc = parseInt(elem.css("top").substring(0,elem.css("top").indexOf("px")))
    $(window).scroll(function(){
        var offset = Yloc+$(document).scrollTop()+"px";
        elem.animate({top:offset},{duration:500,queue:false});
    });
    var counter = 0;
    $('#projectslist ul li').each(function(){
        var el = $(this);
        el.wrapInner('<span class="text"></span>').append('<span class="bg">&nbsp;</span>');
        if(counter % 2 > 0) el.children('.bg').addClass('gray');
        el.hover(
            function(){
                var w = parseInt(el.children('.text').css('width').substring(0,el.children('.text').css('width').indexOf("px")));
                if(isNaN(w))
                    el.children('.bg').animate({width: '450px'},{duration:250});
                else
                    el.children('.bg').animate({width: (w+75)+'px'},{duration:250});
                el.children('.text').children('a').css('color','#fff');
            },
            function(){
                el.children('.bg').animate({width: '25px'},{duration:150});
                el.children('.text').children('a').css('color','#888');
            }
        );
        counter++;
    });
    $("a[rel^='prettyPhoto']").prettyPhoto({theme: 'dark_rounded', allowresize: false});
});