﻿// JScript File

//history
var currentHash = ""; 
function watchAnchor() {
  if (location.hash != currentHash) {
    debuglog("watchAnchor triggered");
    currentHash = location.hash;
    loadHash();
  }
}

function loadHash()
{
    debuglog("loadHash");
    debuglog("hash=" + location.hash);
    if(location.hash == "")
    {
        handleMainMenuClick($("#main-menu-training a"));
    }
    else if(location.hash == "#QuickFix")
    {
        handleMainMenuClick($("#main-menu-quickfix a"));
    }
    else if(location.hash == "#Products")
    {
        handleMainMenuClick($("#main-menu-products a"));
    }
    else if(location.hash == "#Press")
    {
        handleMainMenuClick($("#main-menu-press a"));
    }
    else if(location.hash == "#Resigym")
    {
        handleMainMenuClick($("#main-menu-resigym a"));
    }
    else
    {
        handleMainMenuClick($("#main-menu-training a"));
    }
}

var tId = setInterval('watchAnchor()',300); 

function convertToHash(l)
{
    debuglog("convertToHash");
    if (l == "./")
    {
        return ".";
    }
    else
    {
        return l.substring(l.lastIndexOf("/") + 1, l.lastIndexOf(".aspx"));
    }
}
function convertFromHash(l)
{
    debuglog("convertFromHash");
    return l.substring(1) + ".aspx";
}