﻿/*
This script depends on the Collegeboard.Web CBWeb javascript library.
Make sure that library is registered with any page that uses these functions.
*/

function RedirectWithLoginId(loginCtrl, url) {
    var ctrl = CBWeb.getElementById(loginCtrl);
    var loginId = '';

    if (ctrl)
        loginId = ctrl.value;

    window.location = GetPageUrlPath() + url + '?username=' + loginId;
}

function GetPageUrlPath() {
    var loc = window.location;
    return loc.protocol + '//' +
           loc.host + 
           loc.pathname.substring(0, loc.pathname.lastIndexOf('/')) + '/';
}