// Global variables present on all pages var justPopped = false; var showWarning = true; var clickedselecteditem = false; var IsServerDirty = false; var DirtyCount = 0; var expired = 2; var popupDivContainerSelectReport = ''; var errorCount = 0; var warningCount = 0; var infoCount = 0; var postBackElementId = ''; function FindControlId(sid) { for (var index = document.body.sourceIndex; index < document.all.length ; index++) { var el = document.all[index]; if (el.id.indexOf(sid) > -1) return el.id; } return sid; } function GetAttributLabelHtml(num) { if (document.getElementById("AttributeLabel"+num) == null) return null; return document.getElementById("AttributeLabel"+num).innerHTML }; function GetAttributValueHtml(num) { if (document.getElementById("Attribute"+num) == null) return null; return document.getElementById("Attribute"+num).innerHTML }; function SetLastFocus(id) { document.getElementById("LastFocus").value = id; }; function changesize() { var tbl = document.getElementById('EditTable'); var cols; if (tbl == null) return; if(tbl.clientWidth == 0) { setTimeout("changesize()", 50); return; } cols = parseInt(tbl.clientWidth/300) + 1; var AttrCol = document.getElementById('HiddenAttributeColumns'); if (cols == AttrCol.value) return; AttrCol.value = cols; CWidth = Math.max(2, Math.round(100.0/cols)) + "%"; var AttrLabels = new Array(); var Attrs = new Array(); var i = 0; var AttrLabelStr = GetAttributLabelHtml(i); var AttrStr = GetAttributValueHtml(i); while (AttrStr != null) { AttrLabels[i] = AttrLabelStr; Attrs[i] = AttrStr; i++; AttrStr = GetAttributValueHtml(i); AttrLabelStr = GetAttributLabelHtml(i); } if (i == 0) return; crow = document.getElementById('TRFirst'); if (crow != null) { do { var lastRow = tbl.rows.length; if (lastRow > 4) tbl.deleteRow(lastRow - 1); } while (lastRow>4); do { var lastcol = crow.cells.length; if (lastcol > 4) crow.deleteCell(lastcol - 1); } while (lastcol>4); document.getElementById('TDStartTime').setAttribute('width', CWidth); document.getElementById('TDNotes').setAttribute('width', CWidth); for (var k=2; k < cols; k++) { cleft = crow.insertCell(2*k); cleft.setAttribute('width', '0%'); cright = crow.insertCell(2*k + 1); cright.setAttribute('width', CWidth); } } else { do { var lastRow = tbl.rows.length; if (lastRow > 0) tbl.deleteRow(lastRow - 1); } while (lastRow>0); } var row; for(var j=0; j < i; j++) { var c = j % cols; if (c == 0) row = tbl.insertRow(tbl.rows.length); var cellleft = row.insertCell(2*c); cellleft.id = "AttributeLabel" + j; cellleft.nowrap = true; cellleft.setAttribute('width', '0%'); cellleft.innerHTML = AttrLabels[j]; var cellright = row.insertCell(2*c + 1); cellright.id = "Attribute" + j; cellright.setAttribute('width', CWidth); cellright.innerHTML = Attrs[j]; } var lastfocus = document.getElementById("LastFocus").value; if (lastfocus == null || lastfocus =="" ) return; var lastFocusControl = document.getElementById(lastfocus); if (lastFocusControl) ETSSetFocus(lastFocusControl, false); }; function updatedropdown(areastr, dropindicatorstr, cookie, display) { var area = document.getElementById(areastr); var dropindicator = document.getElementById(dropindicatorstr); if (area) { if (GetCookie(cookie) != '1') { area.style.display = "none"; if (dropindicator) dropindicator.className = "MiniButtonDropdown"; } else { if (display) { area.style.display = display; } else area.style.display = ""; if (dropindicator) dropindicator.className = "MiniButtonDroppeddown"; } } } function toggle(area, dropindicator, cookie, display) { if (area) { if (area.style.display != "none") { area.style.display = "none"; if (dropindicator) dropindicator.className = "MiniButtonDropdown"; if (cookie) document.cookie = cookie + "=0"; } else { if (display) { area.style.display = display; } else area.style.display = ""; if (dropindicator) dropindicator.className = "MiniButtonDroppeddown"; if (cookie) document.cookie = cookie + "=1"; } } hideLoadMessage(); } function SetDivWidthBySidebar(div) { if (div == null) return; if(document.all["sidebarcontent"].style.display=="none") div.style.width = document.body.clientWidth - 20; else div.style.width = document.body.clientWidth - 200; } function OnSidebarToggle() { SetDivWidthBySidebar(document.all["divEnterTime"]); SetDivWidthBySidebar(document.all["div-ReviewTimesheet"]); SetDivWidthBySidebar(document.all["div-ReviewTimesheetItem"]); SetDivWidthBySidebar(document.all["div-ReviewTimesheetSummary"]); } //do postback on attribute dropdownlist blur function OnAttributeBlur(ctrl) { if ((ctrl.type == 'select-one') || (ctrl.type == 'select-multiple')) for (var k=0; k < ctrl.options.length; ++k) if (ctrl.options[k].selected != ctrl.options[k].defaultSelected) { setTimeout("DoNoWarningPostBack('" + ctrl.id + "')", 50); break; } } //do postback no warning function DoNoWarningPostBack(id) { showWarning = false; __doPostBack('" + id + "', ''); showWarning = true; } // Retrieve the value of the cookie with the specified name. function GetCookie(sName) { // cookies are separated by semicolons var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { // a name/value pair (a crumb) is separated by an equal sign var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } // a cookie with the requested name does not exist return null; } // Retrieve the value of the cookie with the specified name. function SetCookie(sName, value) { // cookies are separated by semicolons var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { // a name/value pair (a crumb) is separated by an equal sign var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) aCrumb[1] = value; aCookie[i] = aCrumb[0] + "="; } var docCookie; for (var i=0; i < aCookie.length; i++) { } // a cookie with the requested name does not exist return null; } function AddMessage(messageclass, message, control) { newLink = document.createElement("A"); newLink.className = messageclass; if (control) { newLink.href = "#"; // newLink.onclick = "ETSErrorDialogSetFocus('"+control.id+"');"; } newSpan = document.createElement("SPAN"); newSpan.className = messageclass; newSpan.innerHTML = message; if (document.getElementById("ErrorBoxDialog")) { if (control) { newLink.appendChild(newSpan); } document.getElementById("ErrorBoxDialog").appendChild(newLink); } } function AddError(message, control) { AddMessage("error", message, control); } function AddWarning(message, control) { AddMessage("warning", message, control); } function ShowError(message, control) { ShowMessage("error", message, control); } function ShowWarning(message, control) { ShowMessage("warning", message, control); } function ShowMessage(messageclass, message, control) { AddMessage(messageclass, message, control); DisplayLogViewer(); } function ETSSetFocus(control, scroll) { if (control.focus) { // if (scroll) // control.scrollIntoView(); if (!control.disabled && (control.id != "sidebarcollapse") && (control.id != "sidebarexpand")) control.focus(); } else { if (document.getElementById(control)) { // if (scroll) // document.getElementById(control).scrollIntoView(); if (!document.getElementById(control).disabled && (control != "sidebarcollapse") && (control != "sidebarexpand")&& (document.getElementById(control).clientWidth != 0)) document.getElementById(control).focus(); } } } function DisplayLogViewer (element) { result = 'ok'; errorCount = 0; warningCount = 0; infoCount = 0; postBackElementId = ''; if(element != undefined && element != '') postBackElementId = element; errordiv = document.getElementById("ErrorBoxDialog"); if (errordiv) { for (i = 0; i < errordiv.childNodes.length; i++) { if (errordiv.childNodes[i].className.toUpperCase() == "ERROR") errorCount++; if (errordiv.childNodes[i].className.toUpperCase() == "WARNING") warningCount++; if (errordiv.childNodes[i].className.toUpperCase() == "INFO") infoCount++; } if (errorCount + warningCount + infoCount != 0) // result = window.showModalDialog('LogViewer.aspx',ErrorBoxDialog,'dialogHeight:255px;dialogWidth:450px;resizable:yes; scroll:no; status:no;'); { var arrButtons = []; if (errorCount > 0) { arrButtons.push({ text: getLocalizedCaption('Close'), click: function() { processReturnedValue('cancel'); $(this).dialog('close'); } }); } if ((warningCount > 0) && (errorCount == 0)) { arrButtons.push({ text: getLocalizedCaption('Yes'), click: function() { processReturnedValue('ok'); $(this).dialog('close'); } }); arrButtons.push({ text: getLocalizedCaption('No'), click: function() { processReturnedValue('cancel'); $(this).dialog('close'); } }); } if ((infoCount > 0) && ((errorCount + warningCount) == 0)) { arrButtons.push({ text: getLocalizedCaption('OK'), click: function() { processReturnedValue('ok'); $(this).dialog('close'); } }); } $(function () { $("#ErrorBoxDialog").dialog({ modal: true, title: "Confirmation", width: 455, height: 210, buttons: arrButtons, position: { my: "center", at: "top", of: window} }); }); } else { if(postBackElementId == 'LinkbuttonSave' || postBackElementId == 'LinkbuttonSavePlusNew' || postBackElementId == 'LinkbuttonDuplicate') { document.getElementById("HiddenPassUndo").value = "True"; __doPostBack(postBackElementId,''); return; } else if (postBackElementId == 'lblCopyItem') { document.getElementById("HiddenPassUndo").value = "True"; OpenURLInDialogWindow('CopySelect', 'PopupParentContainer', event, 'LinkbuttonCopyItem'); return; } else if (postBackElementId == 'lblCopyDay') { document.getElementById("HiddenPassUndo").value = "True"; OpenURLInDialogWindow('CopySelect', 'PopupParentContainer', event, 'LinkbuttonCopyDay'); return; } else if(postBackElementId == 'btn_Submit') { __doPostBack(postBackElementId,''); return; } } } } function getLocalizedCaption(buttonName) { var language = window.navigator.userLanguage || window.navigator.language; if (language.indexOf('fr') != -1) { if( buttonName == 'Yes') return 'Oui'; else if (buttonName == 'No') return 'Non' else if (buttonName == 'Close') return 'Fermer'; } return buttonName; } function processReturnedValue(result) { document.getElementById("ErrorBoxResult").value = result; if (warningCount > 0 && result == 'ok') { if(postBackElementId != '') { if(postBackElementId == 'LinkbuttonSendToPayroll') __doPostBack(postBackElementId,''); else if(postBackElementId == 'LinkbuttonDuplicate') { document.getElementById("HiddenPassUndo").value = "True"; __doPostBack(postBackElementId, ''); } return; } if (document.getElementById("PostbackID").value == "LinkButtonGenerate" ) { document.getElementById("StartGenerate").value = "true"; } document.forms["WorkForm"].submit(); } else if (document.getElementById("PostbackID").value == "ApproveFormNoChange") document.forms["WorkForm"].submit(); } function StartProcess() { var features; features = "toolbar:no;menubar:no;minimizable:no;scrollbars:no;resizable:no;dialogHeight:40px;dialogWidth:228px;status:no;unadorned:yes;help:no;"; window.showModelessDialog('ProgressBar.aspx?id=13ahgbn5ohx0kniybe35jhc1&id2='+Math.random(),'ProgressBar', features); } function ScrollIntoView(controlID) { var control = document.getElementById(controlID); if (control) control.scrollIntoView(); } function ClearLogViewer() { if (document.getElementById("ErrorBoxDialog")) { document.getElementById("ErrorBoxDialog").innerHTML = ""; } } function IsEmpty(textField) { if ((textField.value.length==0) || (textField.value==null)) { return true; } else { return false; } } function ValidateLogin(form) { /* check the username */ if (IsEmpty(form.TextBoxUsername) || IsEmpty(form.TextBoxPassword)) { alert("Please enter an Employee Number and Password."); form.TextBoxUsername.focus(); return false; } else { /* if we get here everything is ok */ return true; } } function doHourglass() { if (document.getElementById("forceNoHourglass") != null) return; document.body.style.cursor = 'wait'; if (document.all) for (var i=0;i < document.all.length; i++) if ((document.all(i).className.toUpperCase() == 'LINKBUTTON') || (document.all(i).className.toUpperCase() == 'SIDEBARLINK')) document.all(i).style.cursor = 'wait'; } function doDefaultCursor() { document.body.style.cursor = 'auto'; if (document.all) for (var i=0;i < document.all.length; i++) if ((document.all(i).className.toUpperCase() == 'LINKBUTTON') || (document.all(i).className.toUpperCase() == 'SIDEBARLINK')) document.all(i).style.cursor = 'auto'; } function hideLoadMessage() { if (document.all.loadmessage != null && document.all.loadmessage.style != null) document.all.loadmessage.style.display="none"; } function showLoadMessage() { if (document.all.loadmessage != null && document.all.loadmessage.style != null) document.all.loadmessage.style.display="inline"; } function OnBeforeUnload() { showLoadMessage(); //doHourglass(); if (showWarning && (document.all['EnablePrompt'].value == 'True') && (document.all['SavePrompt'].value == 'True' && !clickedselecteditem || IsServerDirty || isDirty())) { if (justPopped == false) { justPopped = true; event.returnValue = "You will lose all changes made since your last save."; setTimeout("TurnDownJustPopped()",50); } } //doDefaultCursor(); hideLoadMessage(); } function OnUnload() { // allow deleting a memory-hogging element (eg. a grid with 1000s of rows // before sending any viewstate or any other data back to the server. var deleteInput = document.getElementById("ElementToDeleteOnClose"); if (deleteInput != null && deleteInput.value != "") { deleteElement = document.getElementById(deleteInput.value); if (deleteElement != "" && deleteElement != null) { deleteElement.parentNode.removeChild(deleteElement); } } } function GetKeyCode(event) { var e = event || window.event; if (e.keyCode) return e.keyCode; else if (e.which) return e.which; return null; } function ButtonHasFocus() { if (document.activeElement == null) return false; if (document.activeElement.tagName != 'A') return false; var className = document.activeElement.className.toLowerCase(); if (className == 'linkbutton' || className == 'sidebarlink' || className == 'minibuttondropdown') // ESS stylized byttons (linkbutton) and sidebar menu items return true; return false; } function OnKeyDown(event) { if (GetKeyCode(event) != 32 || !ButtonHasFocus()) return true; // Do not scroll the page when space is pressed and will trigger a button click. var e = event || window.event; if (e.cancelBubble) { // cancelBubble is only supported in IE e.cancelBubble(); } else if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } // Note: Don't set e.returnValue = false, because then the OnKeyPress handler won't fire. return false; } function OnKeyPress(event) { if (GetKeyCode(event) != 32) return; if (!ButtonHasFocus()) return; // allow space to click our "buttons" (linkbutton, etc.) document.activeElement.click(); var e = event || window.event; if (e.cancelBubble) { // cancelBubble is only supported in IE e.cancelBubble(); } else if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } e.returnValue = false; return false; } var defaultPostBack; function doCustomPostBack() { if (typeof(__doPostBack) == 'function') { defaultPostBack = __doPostBack; __doPostBack = customPostBack; } document.onclick = onclickHWithVerify; document.onkeyup = onclickHWithVerify; } function doCustomPostBackNoSaveAlert() { if (typeof(__doPostBack) == 'function') { defaultPostBack = __doPostBack; __doPostBack = customPostBackNoSaveAlert; } document.onclick = onclickH; document.onkeyup = onclickH; } function ReSetControls() { var DropDownLists = new Array(); var CheckBoxs = new Array(); DropDownLists[0] = 'DropDownListPeriod'; DropDownLists[1] = 'DropDownListFieldtype'; CheckBoxs[0] = 'CheckBoxShowCom'; CheckBoxs[1] = 'CheckBoxAllAttributes'; CheckBoxs[2] = 'CheckboxAllValues'; CheckBoxs[3] = 'CheckboxShowLimited'; CheckBoxs[4] = 'CheckBoxAllReports'; for (var i=0; i < DropDownLists.length; ++i) { currEl = document.all[DropDownLists[i]]; if (currEl != null) for (var k=0; k < currEl.options.length; ++k) currEl.options[k].selected = currEl.options[k].defaultSelected; } for (var i=0; i < CheckBoxs.length; ++i) { currEl = document.all[CheckBoxs[i]]; if (currEl != null) currEl.checked = currEl.defaultChecked; } } function ConfirmUnsavedMessage() { if (!justPopped && showWarning && (document.all['EnablePrompt'].value == 'True') && (document.all['SavePrompt'].value == 'True' && !clickedselecteditem || IsServerDirty || isDirty())) return confirm("You will lose all changes made since your last save."); else return true; } function customPostBack(param1, param2) { var response; response = true; showLoadMessage(); //doHourglass(); if (ConfirmUnsavedMessage()) { justPopped = true; customPostBackNoSaveAlert(param1, param2); } else { //doDefaultCursor(); hideLoadMessage(); ReSetControls(); } } function customPostBackNoSaveAlert(param1, param2) { IgnoreClicksControl = param1; setTimeout("IgnoreClicksControl = '';", 5000); if(typeof(defaultPostBack) == 'function') defaultPostBack(param1,param2); } function PreviewReport(popupDivContainer) { //var childWindow = null; var reportIndex = 0; var periodIndex = 0; var departmentIndex = 0; var statusIndex = 0; var sortBy = 0; var sortByLevel1 = 0; var base_width = screen.width; var height_vs_width = 0.80; var percentage = 0.85; var popup_width = base_width * percentage; var popup_height = popup_width * height_vs_width; window.parent.$('#' + popupDivContainer).dialog('close'); if (document.all['LinkButtonPrintNominations'] != null) { // childWindow = window.showModalDialog('PrintDailyTimesheet.aspx?ReportType=4&ReportIndex=' + 0 + '&PeriodIndex=' + 0 + '&SortBy=' + sortBy, // 'NominationList', 'center:yes;' + GetPopupSizeString() + 'resizable:yes; scroll:yes; status:no;'); ShowDialog('PrintDailyTimesheet.aspx?ReportType=4&ReportIndex=' + 0 + '&PeriodIndex=' + 0 + '&SortBy=' + sortBy, popupDivContainer, popup_height, popup_width); return; } if (document.all['DropDownListSortby'] != null) sortBy = document.all['DropDownListSortby'].selectedIndex; if (document.all['ddlSortByLevel1'] != null) sortByLevel1 = document.all['ddlSortByLevel1'].selectedIndex; if (document.all['DropDownListReports'] != null) reportIndex = document.all['DropDownListReports'].selectedIndex; if (document.all['DropDownListPayPeriod'] != null) periodIndex = document.all['DropDownListPayPeriod'].selectedIndex; if (document.all['DropDownListDepartment'] != null) departmentIndex = document.all['DropDownListDepartment'].selectedIndex; if (document.all['DropdownlistStatus'] != null) statusIndex = document.all['DropdownlistStatus'].selectedIndex; if (document.all['DropdownlistStatus'] != null) { //childWindow = window.showModalDialog('PrintDailyTimesheet.aspx?ReportType=3&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&DepartmentIndex=' + departmentIndex + '&StatusIndex=' + statusIndex + '&SortBy=' + sortBy, // 'SummaryReport', 'center:yes;' + GetPopupSizeString() + 'resizable:yes; scroll:yes; status:no;'); ShowDialog('PrintDailyTimesheet.aspx?ReportType=3&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&DepartmentIndex=' + departmentIndex + '&StatusIndex=' + statusIndex + '&SortBy=' + sortBy, popupDivContainer, popup_height, popup_width); } else if (document.all['RadioButtonDetail'] == null || document.all['RadioButtonDetail'].checked == true) { //childWindow = window.showModalDialog('PrintDailyTimesheet.aspx?ReportType=0&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&SortBy=' + sortBy + '&SortByLevel1=' + sortByLevel1, // 'DetailReport', 'center:yes;' + GetPopupSizeString() + 'resizable:yes; scroll:yes; status:no;'); ShowDialog('PrintDailyTimesheet.aspx?ReportType=0&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&SortBy=' + sortBy + '&SortByLevel1=' + sortByLevel1, popupDivContainer, popup_height, popup_width); } else if (document.all['RadioButtonSummary'].checked == true) { //childWindow = window.showModalDialog('PrintDailyTimesheet.aspx?ReportType=1&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&SortBy=' + sortBy + '&SortByLevel1=' + sortByLevel1, // 'SummaryReport', 'center:yes;' + GetPopupSizeString() + 'resizable:yes; scroll:yes; status:no;'); ShowDialog('PrintDailyTimesheet.aspx?ReportType=1&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&SortBy=' + sortBy + '&SortByLevel1=' + sortByLevel1, popupDivContainer, popup_height, popup_width); } else if (document.all['RadioButtonInconvenience'].checked == true) { //childWindow = window.showModalDialog('PrintDailyTimesheet.aspx?ReportType=2&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&SortBy=' + sortBy, // 'InconvenienceReport', 'center:yes;' + GetPopupSizeString() + 'resizable:yes; scroll:yes; status:no;'); ShowDialog('PrintDailyTimesheet.aspx?ReportType=2&ReportIndex=' + reportIndex + '&PeriodIndex=' + periodIndex + '&SortBy=' + sortBy, popupDivContainer, popup_height, popup_width); } // if (childWindow == expired) // { // CloseMe(); // } } function ClickSubmit() { return confirm(document.all['SubmitMessage'].value); } function TurnDownJustPopped() { justPopped = false; } function ModifyTable(gridtable) { if (gridtable.tagName.toUpperCase() != "TABLE") return false; gridtable.border = 0; // Create elements var tblHeader = gridtable.cloneNode(false); var tblBody = gridtable.cloneNode(false); var divCntr = document.createElement("DIV"); divCntr.appendChild(tblBody); // Get column widths var rgWidths = new Array(); for (var i = 0; i < gridtable.rows[0].cells.length; i++) { rgWidths[i] = gridtable.rows[0].cells[i].offsetWidth; } // Add header row var tbdyHeader = document.createElement("TBODY"); tblHeader.appendChild(tbdyHeader); tbdyHeader.appendChild(gridtable.rows[0].cloneNode(true)); // Add body rows for (var i = 1; i < gridtable.rows.length; i++) { var oRow = gridtable.rows[i].cloneNode(true); var tbdyBody = document.createElement("TBODY"); tbdyBody.appendChild(oRow); tblBody.appendChild(tbdyBody); } // Set up body container divCntr.style.overflow = "auto"; if (tblBody.clientHeight > 200) divCntr.style.height = "200px"; // Change existing table for (var i = gridtable.rows.length; i > 0; i--) { gridtable.rows[i-1].removeNode(true); } var tr1 = gridtable.insertRow(); var td1 = tr1.insertCell(); var tr2 = gridtable.insertRow(); var td2 = tr2.insertCell(); td1.appendChild(tblHeader); td2.appendChild(divCntr); // Set column widths of all but the last column for (var i = 0; i < rgWidths.length - 1; i++) { tblHeader.rows[0].cells[i].width = rgWidths[i]; if (tblBody.rows[0]) tblBody.rows[0].cells[i].width = rgWidths[i]; } if ((tblHeader.rows[0]) && (rgWidths.length > 0)) tblHeader.rows[0].cells[rgWidths.length-1].width = "100%"; tblHeader.style.fontSize = "100%"; tblHeader.width = "100%"; tblHeader.style.tableLayout = "fixed"; tblHeader.className = gridtable.headerCSS ? gridtable.headerCSS : ""; tblHeader.border = 1; tblBody.style.fontSize = "100%"; tblBody.width = "100%"; tblBody.style.tableLayout = "fixed"; tblBody.className = gridtable.bodyCSS ? gridtable.bodyCSS : ""; tblBody.border = 1; } function isDirty() { return (DirtyCount > 0); } var IgnoreClicksControl = ''; function onclickH() { e = window.event; if (e.srcElement.type == '' && e.srcElement.id != '' ) if( e.srcElement.id == IgnoreClicksControl) { e.cancelBubble = true; return false; } SetLastFocus(e.srcElement.id); } function onclickHWithVerify() { e = window.event; if (e.srcElement.type == '' && e.srcElement.id != '' ) if( e.srcElement.id == IgnoreClicksControl) { e.cancelBubble = true; return false; } SetLastFocus(e.srcElement.id); VerifyChanged(e.srcElement); } function DisplayDay() { e = window.event; document.all.EditDayFrame.src = e.srcElement.attributes["UrlName"]; } function GetPopupSizeString(windowName) { var base_width = screen.width; var height_vs_width = 0.80; var percentage = 0.85; var popup_width = base_width * percentage; var popup_height = popup_width * height_vs_width; if (windowName == 'EnterTime') { popup_width = 880; popup_height = 660; } else if (windowName == 'CopySelect') { popup_width = 450; popup_height = 380; } else if (windowName == 'Autogenerate') { popup_width = 450; popup_height = 380; } else if (windowName == 'EmployeeOptions') { popup_width = 840; popup_height = 480; } var popup_left = (base_width - popup_width)/2.0; var popup_top = (base_width - popup_width)*height_vs_width/2; return ('dialogWidth:'+ popup_width +'px;dialogHeight:' + popup_height + 'px;dialogLeft:' + popup_left +';dialogTop:' + popup_top); } function OpenPrintReport(popupDivContainer) { popupDivContainerSelectReport = popupDivContainer; if (document.all['DataGridEmployee'] == null) { var height_vs_width = 0.43; var percentage = 0.50; if (screen.width < 1024) { height_vs_width = 0.40; percentage = 0.70; } } else { var height_vs_width = 0.60; var percentage = 0.50; if (screen.width < 1024) { height_vs_width = 0.50; percentage = 0.75; } } var base_width = screen.width; var popup_width = base_width * percentage; var popup_height = popup_width * height_vs_width; ShowDialog('SelectReport.aspx?DisableMenus=true', popupDivContainer, popup_height, popup_width); //figure out the window size // if (document.all['DataGridEmployee'] == null) //{ // var height_vs_width = 0.43; // var percentage = 0.50; // if (screen.width < 1024) // { // height_vs_width = 0.40; // percentage = 0.70; // } //} //else //{ // var height_vs_width = 0.60; // var percentage = 0.50; // if (screen.width < 1024) // { // height_vs_width = 0.50; // percentage = 0.75; // } //} //var base_width = screen.width; //var popup_width = base_width * percentage; //var popup_height = popup_width * height_vs_width; //var popup_left = (base_width - popup_width)/2.0; //var popup_top = (base_width - popup_width)*height_vs_width/2; //var sizeString = 'dialogWidth:'+ popup_width +'px;dialogHeight:' + popup_height + 'px;dialogLeft:' + popup_left +';dialogTop:' + popup_top; //var childWindow = null; //childWindow = window.showModalDialog('SelectReport.aspx?DisableMenus=true', 'MyWindow', 'center:yes;' + sizeString + 'resizable:yes; scroll:no; status:no;'); //if (childWindow == expired && document.all['sidebarcell'] != null) //{ // document.all['ChildWindowExpired'].value = 'true'; // window.location = 'Logout.aspx'; //} //else if (childWindow == expired) // CloseMe(); } function OpenURLInDialogWindow(windowName, popupDivContainer, e, selectReportCallie) { if (!ConfirmUnsavedMessage()) return false; // var childWindow = null; //showLoadMessage(); //doHourglass(); //e = e || window.event; //var target = e.target || e.srcElement; //var show_str = 'center:yes;'+ GetPopupSizeString(windowName) + ';resizable:yes; scroll:yes; status:yes;'; //console.log(e); //console.log(target); //console.log(window.event); //var url = target.attributes["UrlName"].value; //childWindow = window.showModalDialog(url, 'MyWindow', show_str); //hideLoadMessage(); //doDefaultCursor(); //if (childWindow == expired && document.all['sidebarcell'] != null) //{ // document.all['ChildWindowExpired'].value = 'true'; // window.location = 'Logout.aspx'; //} //else if (childWindow == expired) // CloseMe(); //showWarning = false; //return true; e = e || window.event; var target = e.target || e.srcElement; var url = target.attributes["UrlName"].value; if(selectReportCallie) { url += '?callie=' + selectReportCallie; } var popup_width; var popup_height; if (windowName == 'EnterTime') { popup_width = 880; popup_height = 660; } else if (windowName == 'CopySelect') { popup_width = 450; popup_height = 380; } else if (windowName == 'Autogenerate') { popup_width = 450; popup_height = 380; } else if (windowName == 'EmployeeOptions') { popup_width = 840; popup_height = 480; } ShowDialog(url, popupDivContainer, popup_height, popup_width); return true; } function ShowDialog(page, popupDivContainer, h, w) { var $dialog = window.parent.$('#' + popupDivContainer) .html('') .dialog({ autoOpen: false, modal: true, height: h, width: w //, //buttons: [{ //text: "Close", //click: function() { // $(this).dialog("close"); // } //}] }); $dialog.dialog('open'); } function OpenGenerateTimesheets(popupDivContainer) { var popup_width = 450; var popup_height = 380; ShowDialog('AutogenerateTimesheets.aspx', popupDivContainer, popup_height, popup_width); // var childWindow = null; // showLoadMessage(); // doHourglass(); // var show_str = 'center:yes;'+ GetPopupSizeString('Autogenerate') + ';resizable:yes; scroll:yes; status:yes;'; // childWindow = window.showModalDialog('AutogenerateTimesheets.aspx', 'MyWindow', show_str); // hideLoadMessage(); // doDefaultCursor(); // if (childWindow == expired && document.all['sidebarcell'] != null) // { // document.all['ChildWindowExpired'].value = 'true'; // window.location = 'Logout.aspx'; // } // else if (childWindow == expired) // CloseMe(); // document.WorkForm.submit(); } function CloseMe() { window.returnValue = expired; window.close(); } // closes window without setting the expiry flag function CloseCopySelectWin(callie) { //window.close(); window.parent.$('#PopupParentContainer').dialog('close'); window.parent.__doPostBack(callie,''); } function CloseEnterTime() { window.parent.$('#PopupParentContainer').dialog('close'); window.parent.__doPostBack('',''); } function CloseWinSelectReport() { window.parent.$('#PopupParentContainer').dialog('close'); } function VerifyChanged(ctrl) { // If we need to, ignore the control only if conditions below are satisfied if (!( // if control is marked as no check (ctrl.getAttribute("ets-IgnoreDirty") != null) || // or it's a checkbox with parent marked as no check ( (ctrl.type == 'radio' || ctrl.type == 'checkbox') && (ctrl.parentNode.getAttribute("ets-IgnoreDirty") != null) ) )) { if (ctrl.type == 'radio' || ctrl.type == 'checkbox') { if (ctrl.checked != ctrl.defaultChecked) { DirtyCount ++; } else { DirtyCount --; } } else if ((ctrl.type == 'text' || ctrl.type == 'textarea') && (ctrl.value != ctrl.defaultValue)) DirtyCount ++; else if ((ctrl.type == 'select-one') || (ctrl.type == 'select-multiple')) for (var k=0; k < ctrl.options.length; ++k) if (ctrl.options[k].selected != ctrl.options[k].defaultSelected) DirtyCount ++; } } function OnPayCodeChange(drop) { var Infos = document.all["HiddenStatPayCodes"].value.split(','); var DropHoliday = document.all[Infos[0]]; var StatHolidayCodes = Infos[1].split(':'); var code = drop.options[drop.selectedIndex].text; if (code.length > 0) { code = code.split('[')[1].split(']')[0]; for (var intI = 0; intI < StatHolidayCodes.length; intI++) if (StatHolidayCodes[intI] == code) { DropHoliday.disabled = false; return; } } if(DropHoliday != null) { DropHoliday.selectedIndex = 0; DropHoliday.disabled = true; } } function NumberKeyDownHandler(ctrl, lang) { if (ctrl.type != 'text') return; var i = parseInt(event.keyCode); //alert(lang); // if (i != 16) // alert(i); if ( !event.ctrlKey && !event.altKey && ( i == 32 // space || (i >= 48 && i <= 57 && event.shiftKey) // 0 ~ 9 || (i >= 65 && i <= 90) //a ~ z || i == 106 || i == 107 || i == 111 || i == 186 || i == 187 || (i >= 188 && i <= 190 && event.shiftKey) // . , - || ( ( (i == 188 || i == 190) && !event.shiftKey || i == 110) && (ctrl.value.indexOf('.') > -1 ||ctrl.value.indexOf(',') > -1 )) || ((i == 189 && !event.shiftKey || i == 109) && ctrl.value != '') || i == 191 || i == 192 || (i >= 219 && i <= 222) ) ) { if ((i == 189 && !event.shiftKey || i == 109) && ctrl.value.indexOf('-') == -1) ctrl.value = '-' + ctrl.value; event.returnValue=false; event.cancel = true; return; } } function ScrollToElement(theElement){ var selectedPosX = 0; var selectedPosY = 0; while(theElement != null){ selectedPosX += theElement.offsetLeft; selectedPosY += theElement.offsetTop; theElement = theElement.offsetParent; } window.scrollTo(selectedPosX,selectedPosY); } function GetResString(code) { if (code.toLowerCase() == "password:") {return "Password:";} if (code.toLowerCase() == "userpasswordresetneeded") {return "The user's password must be reset.";} if (code.toLowerCase() == "ttsearchnominations") {return "Search for nominations according your selected search criteria";} if (code.toLowerCase() == "summary:") {return "Summary:";} if (code.toLowerCase() == "ttpostulate") {return "Apply to this position";} if (code.toLowerCase() == "errorstacktrace") {return "Stack Trace: {0}";} if (code.toLowerCase() == "ttfuturaddress") {return "Review your submitted Future address";} if (code.toLowerCase() == "emailrequiredforpasswordreset") {return "An email address must be supplied for each employee having his or her password reset.";} if (code.toLowerCase() == "ttcurrentaddress") {return "Review your current address";} if (code.toLowerCase() == "labelcontinue") {return "Please click the Back button and try again, or select a menu item from the side bar.";} if (code.toLowerCase() == "deleteprompt") {return "Are you sure you want to delete the {0}?";} if (code.toLowerCase() == "employeeno") {return "Employee Number";} if (code.toLowerCase() == "application") {return "Application";} if (code.toLowerCase() == "import") {return "Import";} if (code.toLowerCase() == "employeeexists") {return "Employee already exists.";} if (code.toLowerCase() == "importsuccess") {return "Import Successful.";} if (code.toLowerCase() == "uploadsuccess") {return "Upload successful!";} if (code.toLowerCase() == "firsttimelogin") {return "Please enter your Network Login and Password to login the first time.";} if (code.toLowerCase() == "upload") {return "Upload";} if (code.toLowerCase() == "confirmpostulate") {return "Are you sure you want to apply to this job offer?";} if (code.toLowerCase() == "nopaychequefound") {return "There is no pay statement available for the selected date.";} if (code.toLowerCase() == "nofileuploaded") {return "There isn’t currently any file uploaded. Please select a file to upload.";} if (code.toLowerCase() == "sametimeactionmessage") {return "Another reviewer is currently generating or approving timesheets for employees in your list. Please try again later.";} if (code.toLowerCase() == "yearendformapprovalmessage") {return "The '{0}' form for employee number '{1}' is approved.";} if (code.toLowerCase() == "autogeneratedeleteprompt") {return "Generating the timesheet from the schedule will delete any existing timesheet data for {0} for the selected date range, are you sure?";} if (code.toLowerCase() == "passwordquestionchangefailed") {return "Your security question was not changed. Please re-enter your password and try again.";} if (code.toLowerCase() == "addressrejectionmessagenowebsite") {return "Your address change request has been rejected by the reviewer ({0}, {1}).";} if (code.toLowerCase() == "web self service") {return "Web Self Service";} if (code.toLowerCase() == "sendemailsuccess") {return "The email was successfully sent.";} if (code.toLowerCase() == "facilityrequired") {return "Please specify the facility";} if (code.toLowerCase() == "incorrectsin") {return "The SIN entered does not match the one on record.";} if (code.toLowerCase() == "import year end adjustment data") {return "Import Year End Adjustment Data";} if (code.toLowerCase() == "businessno") {return "Business Number";} if (code.toLowerCase() == "telvalidator") {return "must be in form: (XXX) XXX-XXXX";} if (code.toLowerCase() == "incorrectlogin") {return "The Employee Number and Password do not match. Please try again.";} if (code.toLowerCase() == "facilitynotfound") {return "Unable to find the facility";} if (code.toLowerCase() == "addressrejectionmessage") {return "Your address change request has been rejected by the reviewer ({0}, {1}).&#0D;&#0A;&#0D;&#0A;Please visit {2} to correct and resubmit the address.";} if (code.toLowerCase() == "emailformatinvalid") {return "The email address format is not valid.";} if (code.toLowerCase() == "importfailure") {return "Import failed";} if (code.toLowerCase() == "passwordsecurityanswermismatch") {return "The value for Security Answer must match the value for Confirm Security Answer.";} if (code.toLowerCase() == "mandatoryfieldsmissing") {return "Please complete all mandatory fields.";} if (code.toLowerCase() == "connect") {return "Connection";} if (code.toLowerCase() == "loading...") {return "Loading...";} if (code.toLowerCase() == "special pay") {return "Special";} if (code.toLowerCase() == "overlapmessage") {return "The selected time overlaps with an existing entry({0}-{1}).";} if (code.toLowerCase() == "pending") {return "In process";} if (code.toLowerCase() == "incorrectfirstlogin") {return "The Network Login and Password do not match. Please try again.";} if (code.toLowerCase() == "invalidemployeenumberentered") {return "The employee number entered could not be found.";} if (code.toLowerCase() == "yearendemptyforms") {return "There are empty forms. Please add amounts or delete.";} if (code.toLowerCase() == "telvalidatormsgovern") {return "must be in form: XXX-XXX-XXXX or a maximum of 12 characters.";} if (code.toLowerCase() == "sendemailfailure") {return "Failed to send the email.";} if (code.toLowerCase() == "loginprompt") {return "Please enter an Employee Number and Password.";} if (code.toLowerCase() == "approveformprompt") {return "Warning: Once the form is approved, you will be totally unable to modify it… &#0D;&#0A; Regardless of this warning, do you want to continue?";} if (code.toLowerCase() == "confirmcancelsubmission") {return "Do you really want to cancel your address change?";} if (code.toLowerCase() == "rejectionmessage") {return "This message has been automatically sent to you by the Employee Self-Service server because your timesheet from {0} to {1} has been rejected by the reviewer {2}.&#0D;&#0A;&#0D;&#0A;Please visit {3} to make corrections.";} if (code.toLowerCase() == "uploaderror") {return "File could not be uploaded.";} if (code.toLowerCase() == "buttonamend") {return "Amend";} if (code.toLowerCase() == "processing") {return "Processing...";} if (code.toLowerCase() == "recipientbnformat") {return "Recipient Business Number format: 123456789AB1234";} if (code.toLowerCase() == "login") {return "Login";} if (code.toLowerCase() == "unapprovedforms") {return "There are pending unapproved forms.";} if (code.toLowerCase() == "subjectandmessagerequired") {return "The Subject and Message fields cannot be empty.";} if (code.toLowerCase() == "electronicoptinmessage") {return "Would you like to Opt-in for Electronic Tax Slip? Click Yes if you accept or No to ignore.";} if (code.toLowerCase() == "enddatelessthanstartdate") {return "The end date must be greater or equal than the start date.";} if (code.toLowerCase() == "nosecurityquestioncontactadmin") {return "You do not have a Security Question set. Please contact your system administrator.";} if (code.toLowerCase() == "incorrectloginwithfacility") {return "The Employee Facility, Number and Password do not match. Please try again.";} if (code.toLowerCase() == "ttcancelsubmission") {return "Cancel your address change request";} if (code.toLowerCase() == "errorsource") {return "Source: {0}";} if (code.toLowerCase() == "regular pay") {return "Regular";} if (code.toLowerCase() == "invalidrecipientbusinessnumber") {return "The recipient Business Number is invalid . Correct format is {0}.";} if (code.toLowerCase() == "noyearendformfound") {return "There is no year-end form available for the selected date.";} if (code.toLowerCase() == "errormessage") {return "Message: {0}";} if (code.toLowerCase() == "yearendformapprovalsubject") {return "Year end form approval notification from client {0}.";} if (code.toLowerCase() == "choosefile") {return "Choose the year end adjustment file to import: ";} if (code.toLowerCase() == "errortype") {return "Type: {0}";} if (code.toLowerCase() == "yearlessthanstartyear") {return "The selected year must be greater than '{0}'.";} if (code.toLowerCase() == "rejected") {return "Rejected";} if (code.toLowerCase() == "invalidsin") {return "This is not a valid Social Insurance Number.";} if (code.toLowerCase() == "employeenumber:") {return "Employee Number:";} if (code.toLowerCase() == "employeeidformat") {return "{0} [{1}]";} if (code.toLowerCase() == "default.defaultpageheader") {return "Electronic Time Sheet";} if (code.toLowerCase() == "approved") {return "Approved";} if (code.toLowerCase() == "ttresetall") {return "Reset all form fields";} if (code.toLowerCase() == "yearendformstartyear") {return "Year-end forms before the {0} tax year are not available to be viewed online.";} if (code.toLowerCase() == "ttwithdraw") {return "Cancel your application to this position";} if (code.toLowerCase() == "senderemailformatinvalid") {return "The Return Email Address is not in a valid format.";} if (code.toLowerCase() == "ttsubmit") {return "Submit your request";} if (code.toLowerCase() == "do you wish to proceed?") {return "Do you wish to proceed?";} if (code.toLowerCase() == "paystubreadymessage") {return "Your pay statement ({0}, {1}) is ready to be viewed online.&#0D;&#0A;&#0D;&#0A;Please visit {2}";} if (code.toLowerCase() == "passwordmessage") {return "Facility: {0}&#0D;&#0A; Client: {1}&#0D;&#0A; &#0D;&#0A;Your temporary password is:&#0D;&#0A;&#0D;&#0A; {2}&#0D;&#0A;&#0D;&#0A;Please visit {3} to change your password.";} if (code.toLowerCase() == "application error") {return "Application Error";} if (code.toLowerCase() == "formtypemandatory") {return "The form type is missing.";} if (code.toLowerCase() == "confirmdelete") {return "Are you sure you want to delete this item? ";} if (code.toLowerCase() == "labelsorry") {return "An unexpected error occurred.";} if (code.toLowerCase() == "confirmwithdraw") {return "Are you sure you want to withdraw your candidature? ";} if (code.toLowerCase() == "passwordresetmessage") {return "Your password has been reset. Please create a new password to continue.";} if (code.toLowerCase() == "submitprompt") {return "Are you sure that you have completed and reviewed your timesheet and are ready to submit it for approval?";} if (code.toLowerCase() == "withdrawapplication") {return "Withdrawal";} if (code.toLowerCase() == "resubmittedmessage") {return "This message has been automatically sent to you by the Employee Self-Service server because the timesheet from {0} to {1} of your employee {2}, has been corrected and resubmitted.&#0D;&#0A;&#0D;&#0A;Please visit {3} to review this timesheet.";} if (code.toLowerCase() == "ttsearchjoboffers") {return "Search for job offers according your selected search criteria";} if (code.toLowerCase() == "emailvalidator") {return "Must be in form: xxx@xxxxx.xxx";} if (code.toLowerCase() == "paystubreadymessagenowebsite") {return "Your pay statement ({0}, {1}) is ready to be viewed online.";} if (code.toLowerCase() == "selectexcelfilesonly") {return "Please select Excel type files only";} if (code.toLowerCase() == "fromsur") {return "of";} if (code.toLowerCase() == "approveformnochange") {return "This form cannot be approved because it is identical to the original or has no saved changes. Please make the required changes and then press the Save button at the top of the form.";} if (code.toLowerCase() == "passwordquestionchangedbutanswernot") {return "You must enter a new Security Answer when you change your Security Question.";} }