// Utility functions for datapaq.com web pages

function FindNavFrame()
{ //v2.0
    // Find the index of the NavBar frame.
    var lFrameIndex = -1;
    for (i = 0;i < top.frames.length;i++)
    {
        if (top.frames[i].name == "NavFrame")
        {
            lFrameIndex = i;
            break;
        }
    }

    return lFrameIndex;
}

// This function can be called from within any page and passes it's arguments to the corresponding
// function in the nav bar.
// Given the name of a navigation button it will simulate clicking on that button
// 8-Oct-2002 - Added seconds argument 'Label' as optional goto label within target page
function DoClickButton(ButtonName, Label)
{
    // Find the index of the NavBar frame.
    var lFrameIndex = FindNavFrame();

    if (lFrameIndex > -1)
    {
		parent.frames[lFrameIndex].DoClickButton(ButtonName, Label);
    }
}

// This function can be called from within any page and passes it's arguments to the corresponding
// function in the nav bar.
// Given the name of a navigation button it will ensure that the nav bar is set on that button
function DoSynchNavbar(ButtonName)
{
    // Find the index of the NavBar frame.
    var lFrameIndex = FindNavFrame();

    if (lFrameIndex > -1)
    {
		parent.frames[lFrameIndex].DoSynchNavbar(ButtonName);
    }
    else
    {
    	// Can't find the NavBar so assume we landed here directly and need to load the frameset
    	// Pass out URL to Home.htm so it can call us back
    	document.location.replace("/Home.htm?url="+document.location.href);

    }
}


