LOCNS.LocMap.RegRes("common/delta_1.js", "AdminActionMemberWarning", "The action you have taken will be applied to all the member courses in your group.  Are you sure you want to proceed?");

 var SubCheck_AllowSubmit = true;
 var AdminActionMemberWarning = LOCNS.LocMap.GetRes("common/delta_1.js","AdminActionMemberWarning");
 var Hide_Scrollbars = false;
  
 function SubCheckSubmit(el)
 {
   if (typeof(Page_ClientValidate) == 'function' && !Page_ClientValidate()) 
     return false;
   if(!SubCheck_AllowSubmit) 
     return false;
   SubCheck_AllowSubmit = false;
   
   return true;
 }
 
 function SubAllowSubmit()
 {
   SubCheck_AllowSubmit = true;
 }

function doNotImplemented() {
  alert("This feature has not yet been implemented.");
}

function doHelp(topicname,target) {
  // Comment 9841 - ignoring uppercase HTTPS.  should never happen due to our redirect
  var url = BaseAbsUrl+"/info/Help.aspx?topic="+escape(topicname);
  if (url.indexOf("https")>-1)
    url = url.replace("https","http");
  if (target) url += "&target="+escape(target);
  //I'm not going to use the popup subsytem since we won't know if popups_1.js is included
  popupWindow("help",url,{Width:600,Height:600,AutoClose:false});
}

function doPrint() {
   window.print();
//  alert("Print selected");
}

function doMemberList(courseId) {
  popupWindow("memberlist","CourseMemberList.aspx?cId="+courseId,{Width:560});
}

function doDocumentUpload(courseId) 
{
    //alert("doDocumentUpload()");
}


var jsclockServerDateTime = "";
var jsclockTdiff = 0;
var jsclockElementId = "";
var jsclockConstantUpdate = false;

// pass a string for the time zone adjusted datetime from the server
// usually CurrentAdjustedDateTimeString from IntelliPage
// elementId - ID of the div or span holding the time
// constUpdate=true - keep the clock running and live
function initClock() {
    d1 = Date.parse(jsclockServerDateTime);
    d2 = new Date();
    jsclockTdiff = d2.valueOf() - d1;
    updateClock();
}

function updateClock() {

    var dNow = new Date();
    var Digital = new Date(dNow.valueOf() - jsclockTdiff);

    var clockRef = document.getElementById(jsclockElementId);
    if (clockRef) {
        clockRef.innerHTML = formatLocalDate(Digital, LocClockPattern);
        if (jsclockConstantUpdate)
            setTimeout(updateClock, 1000 * 10);
    }

}

function getCurrentCourseTime() {
    var dNow = new Date();
    var Digital = new Date(dNow.valueOf() - jsclockTdiff);
    return Digital;
}

var wizardUrl="";
var supportLink="";

function doError(message,title,target,options)
{

/*
  options.Legend   - Determines if legend is shown or not.    Default = false;
  options.Help     - Determines if help button shown or not.  Default = false;
*/
  var legend  = false;
  var help    = false;
  var print   = false;

  if (typeof(options) != "undefined") {
    if (typeof(options.Legend) != "undefined") legend = options.Legend;
    if (typeof(options.Help) != "undefined") help = options.Help;
    if (typeof(options.Print) != "undefined") print = options.Print;    
  }

  var errorUrl = BaseUrl+"Student/Error.aspx";
  var params = "?message="+escape(message)+"&popup=yes&legend="+legend+"&help="+help+"&print="+print;
  
  if (title)
    params += "&title="+escape(title);
  if (target)
    params += "&target="+escape(target);
    
  popupWindow("doerror",errorUrl+params,{Width:500});
}

function doErrorMessage(mode) {
    var errorUrl = BaseUrl + "info/Message.aspx";
    var params = "?mode=" + escape(mode)
    popupWindow("doerror", errorUrl + params, { Width: 500 });
}

function goRetired(profview)
{
  var dest = BaseUrl+"Student/NoCalcXLPopup.aspx";

  if (profview)
    dest += "?profview=1";
    
  popupWindow("retiredCourse",dest,{Width:500});
}

function goSupport()
{
  popupWindow("support",supportLink,{Width:1024,Height:768});
}

function goWizard(params)
{
  if (!params)
    params = "";
  popupWindow("iwiz",wizardUrl+params,{Width:780,Height:535,AutoClose:false});
}
function goWizardNG(params)
{
  if (!params)
    params = "";
  popupWindow("iwiz",wizardUrl+params,{Width:780,AutoClose:false});
}
function goSysReqForce(forceWiz)
{
  var params="forceReq=1&forceWiz=" + forceWiz;
  popupWindow("iwiz",wizardUrl+"?" + escape(params),{Width:620,Height:400,AutoClose:false});
}
function goWizardCourse(courseId)
{
  var params = "?courseId="+courseId;
  goWizard(params);
}

function goWizardCourseNG(courseId, excludeTG, lang)
{
  var params = "?courseId="+courseId+"&excludeTG="+excludeTG+"&lang="+lang;
  goWizardNG(params);
}

function goWizardBookNG(bookId, lang)
{
  var params = "?bookId="+bookId+"&lang="+lang;
  goWizardNG(params);        
}
function goWizardBook(bookId)
{
  var params = "?bookId="+bookId;
  goWizard(params);        
}

function goWizardBookCode(bookCode)
{
  var params = "?bookCode="+bookCode;
  goWizard(params);        
}

function goWizardBookCodeNG(bookCode)
{
  // TODO - Do we need a lang here?
  var params = "?bookCode="+bookCode;
  goWizardNG(params);        
}

function goWizardForce(forceWiz)
{
  var params = "?forceWiz="+forceWiz;
  goWizard(params);                
}

function goHowToEnterAnswers(discipline)
{
    var url = "http://media.pearsoncmg.com/cmg/pmmg/pmmg_mml_shared/enter_answers.html";
    if (discipline == "nextgen_acct") // Comment 12816
    {
        url = "http://media.pearsoncmg.com/ph/bp/bp_mal_shared/tours/how_to_enter.html";
        popupWindow("howto", url, { Width: 560, Height: 560 });
        return;
    }
    popupWindow("howto",url,{Width:780,Height:500});
}

function goHowToEnterAnswersGlobal(culture) {
    var url;
    if (culture == "es")
        url = "http://media.pearsoncmg.com/cmg/pmmg/player_tour/enteranswers_espanol.html";
    else if (culture == "pt")
        url = "http://media.pearsoncmg.com/cmg/pmmg/player_tour/brasil/enteranswers_brasil.html";
    else if (culture == "en" || culture == "uk")
        url = "http://media.pearsoncmg.com/cmg/pmmg/player_tour/uk_schools/enteranswers_uk_schools.html";
    else if (culture == "enie")
        url = "http://media.pearsoncmg.com/intl/ema/mml_global/tour/index.html";
    popupWindow("howto", url, { Width: 920, Height: 610 });
}

function goMyPlaces(username) {
    var url = "http://www.mypearsonplaces.com/home";
    if (username != null && username.length > 0)
        url = "http://www.mypearsonplaces.com/home?loginname=" + escape(username);
    popupWindow("myplaces", url, { Width: 1050, Height: 670, AutoClose: false });
}

function goStudyPlan()
{
    location = "StudyPlan.aspx";
}

function goDoAssignments(params)
{
    var url = "DoAssignments.aspx";
    if(params)
        url += "?"+params;
    
    location = url;
}

function goStudyCenter()
{
     alert('Student Center');
}

function fixScrollbars(win,fixHorizontal) {

  if ( typeof(win) != "undefined" && win && win.document) {
    //This must be a window so use it
  } else {
    win = window;
  }
  
  if( win.document.documentElement
      && win.document.documentElement.scrollHeight
      && win.document.documentElement.clientHeight) {
    if (Hide_Scrollbars || win.document.documentElement.scrollHeight <= win.document.documentElement.clientHeight ) {
	      win.document.documentElement.style.overflowY = 'hidden';
    } else {
	      win.document.documentElement.style.overflowY = 'scroll';
    }
    
    if (typeof(fixHorizontal) != "undefined" && fixHorizontal) {
        //Apparently, you don't need to fool with horizontal if we don't use frames.   
        if (win.document.documentElement.scrollWidth <= win.document.documentElement.clientWidth ) {
            win.document.documentElement.style.overflowX = 'hidden';
        } else {
            win.document.documentElement.style.overflowX = 'scroll';
        }
    }
  }
}

function setupScrollbarFix() {
  //Only check for the IE version since this only breaks in IE
  if(window.attachEvent) { 
    window.attachEvent("onload",fixScrollbars); 
    window.attachEvent("onresize",fixScrollbars);
  }
}

function ShowWeightWarning(catId)
{
    popupWindow("ZeroWeightWarning","WeightWarning.aspx?catId=" + catId,{Width:450,Scrollbar:false,Statusbar:false});
}

function stripHTML(str)
{
    str=str.replace(/(<([^>]+)>)/ig,"");
    var dubQuot = /\"/g;
    str=str.replace(dubQuot, "&quote;");
    str=str.replace("<", "&lt;");
    str=str.replace(">", "&gt;");
    return str;
}

function validateName(str) {
    str = stripHTML(str);
    str = str.replace("&#", "");
    return str;
}

function deltaBack() {
  if (BackUrl != "") {
    location = BackUrl
  } else {
    history.back();
  }
}

function unloadRequest(url,async) {
    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
    } else {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (xhr == null) {
        alert("Your browser doesn't support AJAX.");
        return false;
    }

    if (url.indexOf("?") > -1)
        url = url + "&r=" + parseInt(Math.random() * 99999999);
    else
        url = url + "?r=" + parseInt(Math.random() * 99999999);

    xhr.open("GET", url, async);
    xhr.send(null);
}



//***showElement based on ID (string) or object reference

function showElement(o) {
    if (typeof (o) == "string") {
        document.getElementById(o).style.display = "";
    } else {
        o.style.display = "";
    }
}
function showElementIfExists(o) {
    if (typeof (o) == "string") {
        var el = document.getElementById(o);
        if (el)
            el.style.display = "";
    } else {
        o.style.display = "";
    }
}
//***hideElement based on ID (string) or object reference

function hideElement(o) {
    if (typeof (o) == "string") {
        document.getElementById(o).style.display = "none";
    } else {
        o.style.display = "none";
    }
}
function hideElementIfExists(o) {
    if (typeof (o) == "string") {
        var el = document.getElementById(o);
        if (el)
            el.style.display = "none";
    } else {
        o.style.display = "none";
    }
}

function setupFUSLinks() {
    if (typeof jQuery == 'undefined') {
        alert('jQuery must be included to use this link');
        return;
    }

    $('a.fusMyCourseDocuments').attr('href','#').fuuiClient({
        title: 'Course Documents',
        fusURL: '../Service/FileUploadServiceBrowse.aspx' + '?rc=' + (new Date()).getTime()
    });
}

// Make sure the first li does not show the separator in ul
function HideToolbarFirstItemBorder(toolbarID) {
    var firstEl = $('#' + toolbarID + ' li:first');
    if (firstEl) {
        var attrs = firstEl.attr('class');
        if (attrs && attrs.indexOf('noborder') < 0)
            firstEl.attr('class', (attrs + " noborder"));
    }
} 