/*
    Hyperlink hooker thing~ (Yes, it'll take your money for s**)
*/

$(window).load(OnLoad);

/**************** Anchor Tag Hooking ****************/
function OnLoad()
{
    // parse all hyper links.
    $('a').each(function()
    {
        // parse all hyperlinks and check the rel attribute (handle if its recognised, if not set it to the default)
        if ($(this).attr('rel') == 'nav-link')
        {
            // hooks for navbar
            $(this).click({ url: $(this).attr('href') }, OnNavLinkClick);
        }
    });
}

/****************  Nav Link Event ****************/
function OnNavLinkClick(event)
{
    // get the url
    var url = event.data.url;
    
    // set the window location correctly.
    window.location = '#/' + url.substring(SiteUrl.length);
    
    // check if the current url is the new url
    
    // transit of it isnt
    
    // but lets just hack this for now :D
    
    // TODO: REMOVE THIS SHIT!!
    var animationDuration = 500;
    var slideDelay = 300;
    $('#splash-image').delay(slideDelay).animate({ opacity: '0' }, animationDuration).animate({ opacity: '1' }, animationDuration);
    $('#content-region').animate({ bottom: '-500px' }, animationDuration).delay(slideDelay * 2).animate({ bottom: '0' }, animationDuration);
    // END TODO
    
    return false;
}
