function switchTab(tabName) {
    var tabs = top.document.getElementsByTagName("img");
    var selectedTab = top.document.getElementById(tabName);

    if (selectedTab == null || selectedTab.attributes.getNamedItem("selected") == true)
        return; // this tab is already selected.

    for (var i = 0; i < tabs.length; i++) {
        var tab = top.document.getElementById(tabs[i].id);
        if (tab != null && hasAttribute(tab, "defaultImage")) { 
            tab.src = tab.attributes.getNamedItem("defaultImage").value;
            tab.attributes.getNamedItem("selected").value = "false";
        }
    }    
    var contentDiv = top.document.getElementById("Content");
    var height = selectedTab.attributes.getNamedItem("contentHeight").value;

    contentDiv.innerHTML = '<' + 'object id="' + tabName + 'Content" class="object" style="height:' + height + 'px;" name="' + tabName + 'Content" type="text/html" data="' + tabName + '.html"><\/object>';

    var contentObject = top.document.getElementById(tabName + 'Content');   

    
    if (selectedTab != null) {
        selectedTab.src = selectedTab.attributes.getNamedItem("selectedImage").value;
        selectedTab.attributes.getNamedItem("selected").value = "true";
        selectedTab.parentNode.blur();
    }
}

function getURLParam() {
    var qparts = window.location.href.split("?");
    if (qparts.length < 2) {
        return "home";
    }
    return qparts[1];
}

function hasAttribute(element, attribute)
{
    return element.attributes.getNamedItem(attribute) != null;
}

function mouseOver(image) {
    image.src = image.attributes.getNamedItem("selectedImage").value;
}

function mouseOut(image) {
    if (image.attributes.getNamedItem("selected").value == "false")
        image.src = image.attributes.getNamedItem("defaultImage").value;
}