
/*
 *
 */

// called from StoryboardNavigation.xsl (for topic pages) and
// ThisCourse_Shared (for the course home page)

function setTRLocation()
{
    if (top != this) {
        if (top.trWin && top.trWin.open) {
            // course tracking uses top.trWin to point to the tracking window, and trWin currently
            // points to a window with an open function, so things seems good so far
            if (!top.trWin.closed) {
                // the window pointed to by top.trWin hasn't been closed
                if (top.trDisp && top.trDisp != null) {
                    // trDisp is the display class for the tracking window
                    // set the new location for the tracking window using the
                    // current location of the courseWindow frame (that called setTRLocation)
                    l = "?disp="+top.trDisp+"&location="+escape(this.location);
                    top.trWin.location = l;
                }
            }
            else {
                if (top.closeTracker) {
                    top.closeTracker();
                }
            }
        }
        else {
            // only course tracking uses a top frameset on campus, currently
            // but maybe in the future there would be another possibility that
            // piggy-backs on the setTRLocation call made from course content
        }
    }
}

// included here to make it available on campus pages.
// Used to deal with XSLT using utf-8 encoding for non-ascii characters
// in an <a href="javascript:alert(...)>
//
function alertDecodeURI(text) {
   alert(decodeURIComponent(escape(text))); // need to escape first to get back to the URI encoding
}


