﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />

$(document).ready(function() {

    var $articles = $(".artbtn");

    $articles.click(function() {
        $("#article").load($(this).attr("href"), function() {
            Cufon.replace("#article > h3"); //callback when loaded. replace the fonts.
        });
        return false;
    });

    //ensure the first one is visible on load

    var qs = $.getAllQueryStrings()["a"];

    if (qs != null) {
        var id = qs.value;

        var $initart = $articles.filter(function(index) {
            return $.getAllQueryStrings({ URL: $(this).attr("href") })["i"].value == id;
        });

        if ($initart.length) {
            $initart.click();
        } else
            $articles.eq(0).click();
    } else
        $articles.eq(0).click();
});