﻿// If user arrives to the page with a url with hash - stop loading and redirect to the hashed url
if (document.location.hash.substring(1).length > 0) {
    try {
        window.stop();
        document.location = document.location.hash.substring(1);
    } catch (err) { }
}


// Setup chroma-hash for passwords
$('input:password').livequery(function() {
    $(this).chromaHash({ number: 3 });
});



$(document).ready(function() {
    // Setup basic stuff like clicks on links, etc
    initPage();

    timeoutRecentlyPlayedMixes = setTimeout('updateRecentlyPlayed();', 1000);

    window.onbeforeunload = function() {
        if (LetsMixPlayer.IsPlaying)
        {
            setupHijaxClick('body');
            return "\n\nNOTICE!\nYou have a mix playing, it will be closed (and if playing - stop) if you continue.\n\n(Avoid this by right-clicking the link and choose \"Open in New Window\", or you could also detach the player to a window of it's own)\n\n";
        }
    }
});

function initPage() {
    initModules();
    initPlayerPanel();
    initComments();
    initPlayQue();
}
