
$(document).ready(function() {
    var username = 'leedstrinity'; // set user name
    var format = 'json'; // set format, you really don't have an option on this one
    var url = 'http://api.twitter.com/1/statuses/user_timeline/' + username + '.' + format + '?exclude_replies=true&callback=?'; // make the url

    $.getJSON(url, function(tweet) { // get the tweets
        tweet = linkify(tweet[0].text);
        $("#twitter").html(tweet); // get the first tweet in the response and place it inside the div
    });

    qb = 1;

    $('.arrow').click(function() {
        if (qb == 1) {
            $('.quick-bar').animate({
                bottom: '-=45'
            }, 300);
            $('.quick-bar .content').animate({
                bottom: '-=45'
            }, 300);
            $(this).addClass('arrow_up');
            qb = 0;
        } else {
            $('.quick-bar').animate({
                bottom: '+=45'
            }, 300);
            $('.quick-bar .content').animate({
                bottom: '+=45'
            }, 300);
            $(this).removeClass('arrow_up');
            qb = 1;
        }
    });

    $('.arrow_up').click(function() {
        $('.quick-bar').css('height', '90px');
        $('.quick-bar .content').css('height', '90px');
        $(this).removeClass('arrow_up');
    });

    $('.tabbed div').css('top', '120px').hide();

    $('#About-c').show();
    $('#About').addClass('active');

    $('.tabs li').click(function() {
        $('.tabs li').removeClass('active');
        $(this).addClass('active');
        $('.tabbed div').hide();
        var id = $(this).attr('id');
        $('#' + id + '-c').show();
    });

    $('#scroll-pane').jScrollPane({ showArrows: true });

    $('.black > div').mouseenter(function() {
        if ($(this).hasClass('selected'))
            return;

        var myClass = $(this).attr("class");
        $('.black').removeClass('selected');
        $('#black' + myClass).addClass('selected');
        $('.item img').hide();
        $('.item img#item' + myClass).show();
    });

});

function stop() {
    $f("*").each(function() {
        this.stop();
    });
}

function linkify(string) {
    string = string.replace(
	/((https?\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi,
	     function(url) {
	         var full_url = url;
	         if (!full_url.match('^https?:\/\/')) {
	             full_url = 'http://' + full_url;
	         }
	         return '<a href="' + full_url + '">' + url + '</a>';
	     }
	);
    return string;
}
