ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

var subMenuShowing = "none";
var onMainMenu = "no";
var onSubMenu = "no";
var menuNumber = "";
var intervalTimeID;
var mainItemHighlighted = "none";
var mainMenuItem = "";
var mainBodyTextLoaded = "no";

var acceptablebrowser = "no";
if (ie4) { acceptablebrowser = "yes" }
if (ns4) { acceptablebrowser = "yes" }
if (acceptablebrowser != "yes") {
        self.location = "/misc/wrongbrowser.html";
}

function bodyTextIsLoaded() {
        mainBodyTextLoaded = "yes";
}


function mouseOverMainMenuItem(menuitem,mainitem)  {
        clearInterval(intervalTimeID);
        onMainMenu = "yes";
        showSubMenu(menuitem,mainitem);
}

function mouseOutMainMenuItem(mainitem)  {
        onMainMenu = "no";
        waitASec();
}

function mouseOverSubMenuItem()  {
        clearInterval(intervalTimeID);
        onSubMenu = "yes";
}

function mouseOutSubMenuItem()  {
        onSubMenu = "no";
        waitASec();
}

function showSubMenu(menuNumber,mainMenuItem)  {

        if (subMenuShowing != "none")  {
                hideSubMenu(subMenuShowing,mainItemHighlighted);
        }
        if (ns4) {
                if (mainBodyTextLoaded == "yes")  {
                        menuToShow = eval("document." + menuNumber);
                        menuToShow.visibility = "show";
                        menuToHighlight = eval("document.menubackground.document." + mainMenuItem)
                        menuToHighlight.visibility = "show";
                }
        }
        if (ie4) {
                menuToShow = eval(menuNumber + ".style");
                menuToShow.visibility = "visible";
                menuToHighlight = eval(mainMenuItem + ".style");
                menuToHighlight.visibility = "visible";
        }
        subMenuShowing = menuNumber;
        mainItemHighlighted = mainMenuItem;
}

function hideSubMenu(menuNumber,mainMenuItem)  {
        if (ns4) {
                if (mainBodyTextLoaded == "yes")  {
                        menuToShow = eval("document." + menuNumber);
                        menuToShow.visibility = "hide";
                        menuToHighlight = eval("document.menubackground.document." + mainMenuItem);
                        menuToHighlight.visibility = "hide";
                }
        }
        if (ie4) {
                menuToShow = eval(menuNumber + ".style");
                menuToShow.visibility = "hidden";
                menuToHighlight = eval(mainMenuItem + ".style");
                menuToHighlight.visibility = "hidden";
        }
        subMenuShowing = "none";
        mainMenuHighlighted = "none";
}

function waitASec()  {
        intervalTimeID = (window.setInterval ('checkMouse()', 1000));
}

function checkMouse()  {
        if ((onMainMenu == "no") && (onSubMenu == "no") && (subMenuShowing != "none")) {
                hideSubMenu(subMenuShowing,mainItemHighlighted);
        }
}
function initialise() {
        pulloutActive = 0;
        if (ns4) {
                sumexperience = document.pulloutInterface.document.pulloutContent.document.textsumexperience;
                itexperience = document.pulloutInterface.document.pulloutContent.document.textitexperience;
                texperience = document.pulloutInterface.document.pulloutContent.document.texttexperience;
                education = document.pulloutInterface.document.pulloutContent.document.texteducation;
                skills = document.pulloutInterface.document.pulloutContent.document.textskills;
                achievements = document.pulloutInterface.document.pulloutContent.document.textachievements;
                websites = document.pulloutInterface.document.pulloutContent.document.textwebsites;
        }
        if (ie4) {
                sumexperience = textsumexperience.style;
                itexperience = textitexperience.style;
                texperience = texttexperience.style;
				education = texteducation.style;
        }

        pulloutShown = sumexperience;
        pulloutShown.xpos = 0;
        pulloutNew = "none";
        pulloutNew.xpos = -600;
}

// Pullout Function, starts the sequence
function pullout(which) {
        if (!pulloutActive && pulloutShown != which) {
                pulloutActive = 1;  // this makes it so you can't start it again until it's finished
                pulloutNew = which;
                pulloutNew.xpos = -600;
                pulloutLeft();
        }
}

// Slide the old layer out of view
function pulloutLeft() {
        if (pulloutShown.xpos > -600) {
                pulloutShown.xpos -= 25;
                pulloutShown.left = pulloutShown.xpos;
                setTimeout("pulloutLeft()",1);
        } else {
                hide(pulloutShown);
                show(pulloutNew);
                pulloutRight();
        }
}

// Slide the new layer into view
function pulloutRight() {
        if (pulloutNew.xpos < 0) {
                pulloutNew.xpos += 25;
                pulloutNew.left = pulloutNew.xpos;
                setTimeout("pulloutRight()",1);
        } else {
                pulloutShown = pulloutNew;
                pulloutActive = 0;  // stops the sequence
        }
}

// Show/Hide Functions
function show(showobj) {
        if (ns4) showobj.visibility = "show";
        if (ie4) showobj.visibility = "visible";
}

function hide(hideobj) {
        if (ns4) hideobj.visibility = "hide";
        if (ie4) hideobj.visibility = "hidden";
}