function doNav(event, grpName, xarg1, xarg2, xarg3)
{
    var blnTesting = false;
    
    //Trigger the nav button events to sync cross-page navigation
    //have to use parent.parent because hotmail may open site in one if its frame windows
    if(parent.parent.frames["top_nav"]){
        //Top_Nav frame loaded, sync image
        parent.parent.frames["top_nav"].MM_nbGroup(event, grpName, xarg1, xarg2, xarg3);
    }
    else{
        if(blnTesting){alert('top.frames["top_nav"] not found');}

        doFrames();
    }
}

function doFrames(blnForceDev)
{
    var blnTesting = false;

    if(!parent.parent.frames["top_nav"]){
        //frames not found
        if(blnTesting){alert('top.frames["top_nav"] not found');}

        var blnStandAlone = (location.search.indexOf('standalone=1') > 0) ? true : false;
        if (!blnStandAlone){
            //standalone was not specified:

            //we want to reload the frames page and pass along the page name to load into
            //the content frame.  Since only pages that include this script will
            //be reloaded we shouldn't have to do that much parsing of the pathname
            var iPos1 = location.pathname.lastIndexOf('/')
            if(blnTesting){alert('iPos1 = ' + iPos1);}

            var strPage = location.pathname.substr((iPos1 > -1)? iPos1 + '/'.length : 0);
            if(blnTesting){alert('strPage = ' + strPage);}

            if(blnTesting){alert('indexOf(\'/dev/\') = ' + location.pathname.indexOf('/dev/'));}
            if (location.pathname.indexOf('/dev/') > -1 || blnForceDev){
                //we are in the dev directory
                location.replace("http://www.velocityengine.net/dev/?page=" + strPage);
            }
            else{
                //live application directory
                location.replace("http://www.velocityengine.net/?page=" + strPage);
            }
        }
        else{
            //standalone=1 was found in the querystring meaning the page
            //should not be reloaded with frames
            if(blnTesting){alert('standalone = true');}
        }
    }
    else{
        //Frames already loaded
        if(blnTesting){alert('top.frames["index_2"] found');}
    }
}
