var routing = {
    "home": {php:"home.php", tab:"hometab"},
    "my": {php:"channellayout.php", tab:"mychannelstab", activeclass:"active"},
    "top": {php:"channellayout.php", tab:"topchannelstab", activeclass:"active"},
    "new": {php:"channellayout.php", tab:"newchannelstab", activeclass:"active"},
    "hot": {php:"channellayout.php", tab:"hotchannelstab", activeclass:"active"},
    "twitterpresence": {php:"", tab:"twitconnectiontab", activeclass:"active"},
    "man": {php:"managechannels.php", tab:"managechannelstab", activeclass:"active"},
    "flash": {php:"flashdemo.php", tab:"", activeclass:""},
    "find": {php:"findchannels.php", tab:"findchannelstab", activeclass:"active"},
    "createch": {php:"createchannel.php", tab:"createchanneltab", activeclass:"active"},
    "faq": {php:"faq.php", tab:"", activeclass:""},
    "help": {php:"help.php", tab:"helptab", activeclass:"active"},
    "acct": {php:"accountsettings.php",tab:"", activeclass:""},
    "join": {php:"joinnow.php",tab:"", activeclass:"join active"},
    "forgotuname": {php:"loginrecover.php",tab:"", activeclass:""},
    "forgotpw": {php:"loginrecover.php",tab:"", activeclass:""},
    "about": {php:"aboutus.php",tab:"", activeclass:""},
    "contact": {php:"contactus.php",tab:"", activeclass:""},
    "careers": {php:"careers.php",tab:"", activeclass:""},
    "legal": {php:"legal.php",tab:"", activeclass:""},
    "abuse": {php:"reportabuse.php",tab:"", activeclass:""},
    "chroom": {php:"channellayout.php",tab:"", activeclass:""},
    "charch": {php:"charch.php",tab:"", activeclass:"active"},
    "topicwish": {php:"viewerwishlist.php",tab:"", activeclass:""},
    "widgets": {php:"",tab:"newswidgets", activeclass:"active"},
    "adwus": {php:"",tab:"advertisewithus", activeclass:"active"}
};
function pageFlip(routingName) {
    // Get the page contents
    //addHistory(routing[routingName].section, "");
    ajax(routing[routingName].php, "", execPageFlip);
    return false;
}
function execPageFlip(contents) {
    var body = document.getElementById("body");
    body.innerHTML = null;
    body.innerHTML = contents;       
}
function setTabs(route) {
    if (routing[route] !== undefined) {
        var tabName = routing[route]["tab"];
        if (tabName.length > 0) {
            var element = document.getElementById(tabName);
            if (element != null) {
                element.setAttribute("class", routing[route]["activeclass"]);
                element.setAttribute("className", routing[route]["activeclass"]);
            }
        }
    }    
}

