// Code is compacted to reduce the total JS payload
function ShowModal(url, pixelHeight, pixelWidth){ 
    var modalResult = window.showModalDialog(url, "resizable:no;scroll:auto;status:no;help:no", "dialogWidth:" + pixelWidth + "px;dialogHeight:" + pixelHeight + "px;center:yes");
    return modalResult;
}

function ShowSelectLanguageModal(groupID,returnURL,currentPath)
{    return ShowModal(currentPath+'SelectLanguage.aspx?nGroupID=' + groupID + '&returnURL=' + returnURL,200,340);}

function ShowClassInfoModal(classID,mode,scheduleClassID,currentPath)
{   return ShowModal(currentPath+'popup/ClassInfo.aspx?ClassID=' + classID + '&Mode=' + mode + '&ScheduleClassID=' + scheduleClassID + '#top',600,500); }

function ShowAccountModal(currentPath,lcid){
    var w = 850;
    var h = 700;    
    window.showModalDialog(currentPath+'account/Account.aspx?localeID='+lcid, "resizable:no;scroll:auto;status:no;help:no", "dialogWidth:" + w + "px;dialogHeight:" + h + "px;center:yes");
}

// Javascript object to hold return values
function ReturnValue(){
    this.ID = -1;
    this.DisplayText = '';
}

// Returns the returnValueArray and closes the popup
function ClosePopupReturnArray(returnValueArray){
    window.returnValue = returnValueArray;
    window.close();
}

function IsEmailAddressValid(value){
    var emailPattern = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
    var emailid=value;
    var matchArray = emailid.match(emailPattern);
    if (matchArray == null)
    {  return false; }
    else
    {  return true;  }
}
