/****************************************************************************************************************** Author : Lising, Jesus P. Warning : Unauthorized distribution/modification of this file is punishable by law. *******************************************************************************************************************/ var createUID = function(){ var newDate = new Date; return newDate.getTime(); }; function openExpireMessageOLD(){ $('#expiredsession').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"makesessionexpiremessage.htm",function(){$('#expiredsession').removeClass('ajax-loading');}).dialog({ title: "Session Expired", bgiframe: true, resizable: false, position:['center',80], modal: true, width: 400, height:420, overlay: { backgroundColor: '#000', opacity: 1 }, close: function() {top.location.reload();}, buttons: {'Ok': function() {top.location.reload();}} }); }; S(document).ready(function() { S(document).on("click",".ui-icon-gear",function() { $(this).parent().css({ position:"relative" }); var scroller = "#content, #content_dtl, .content, #grid, div"; var dis = $(this).offset(); setTimeout(function() { $(scroller).animate({'scrollTop': dis.top + $(scroller).scrollTop() - $(scroller).offset().top - 100},500); },1); }); }); var processLogin = function(objForm){ showEULA(function() { removeSpecialChars_(objForm['username']); remSpecialChars(objForm['password'].value); if($.trim($('#username').val())==""){jAlert("Username is required. Please enter a value in this field.", "Login"); $('#username').select();return;} if($.trim($('#password').val())==""){jAlert("Password is required. Please enter a value in this field.", "Login"); $('#password').select();return;} $('#feedback').html(' ').addClass('ajax-loading'); $('#feedback').html('Processing. Please wait...'); $('#cmdLogin').attr('disabled','disabled').addClass('ui-state-disabled'); $('input[type=text]').attr('readonly','readonly'); $.ajax({ url: "proclogin.htm", dataType: "text", data: $(objForm).serialize(), type: 'post', success: function(sResponse){ // processSendQuestionReviewSummary(false); sFeedback=sResponse.split("\t"); if(sFeedback[0]!="notexisting"){ //setCookie('candidatesListBehavior', 'results', 1); $('#feedback').html('Redirecting...'); eval(sFeedback[0]); }else{ $('#feedback').html(' ').removeClass('ajax-loading'); jAlert(sFeedback[1], "Login"); $('input[type=text]').attr('readonly',''); $('#cmdLogin').attr('disabled','').removeClass('ui-state-disabled'); } } }); }); }; var logoutCurrentUser= function() { $("#logoutdialog").dialog({ bgiframe: true, resizable: false, draggable: true, position:['center',80], height: 180, minHeight:140, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, close: function(){$(this).dialog('destroy');}, buttons: { Cancel: function() {$(this).dialog('destroy');}, 'Logout': function() {processLogoutUser();} } }); }; var processLogoutUser = function(){ $(":button:contains('Cancel')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Logout')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Logout')").html("Please wait..."); $.ajax({ url: "processlogoutuser.htm", dataType: "text", type: 'post', success: function(sResponse){ top.location.href='./'; } }); }; function doScrollFocus(obj,scroller) { var dis = $(obj).offset(); setTimeout(function() { $(scroller).animate({'scrollTop': dis.top + $(scroller).scrollTop() - $(scroller).offset().top - 100},500); },1); } var emailCheck = function(string1){ var filter = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (filter.test(string1)) return true; else return false; }; // FOR DASHBOARD ITEST JDA 2014 - 15 - 12 IE FIX var is_ie8 = function() { var bro = $.browser; var varis_ie8 = false; var ver = 0; if(typeof(bro.msie) != "undefined" && bro.msie) { ver = bro.version; } if(parseInt(ver) == 8) { varis_ie8 = true; } return varis_ie8; }; var get_ie_version = function() { var bro = $.browser; var varis_ie8 = false; var ver = 0; if(typeof(bro.msie) != "undefined" && bro.msie) { ver = bro.version; } return parseInt(ver); }; var is_ie = function() { var bro = $.browser; var is_iei = false; if(typeof(bro.msie) != "undefined" && bro.msie) { is_iei = true; } return is_iei; } ie8notificationblink = function() { if($(".notificationblink")) { var d = $(".notificationblink") ; //jAlert(d.css("color")); d.css("color",(d.css("color") == "orange" ? "yellow":"orange")); setTimeout('ie8notificationblink()', 1000); } } /* FOR IE8 OBJECT.KEYS MISSING FUNCTION */ if (!Object.keys) { Object.keys = function(obj) { var keys = []; for (var i in obj) { if (obj.hasOwnProperty(i)) { keys.push(i); } } return keys; }; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(searchElement, fromIndex) { var k; if (this == null) { throw new TypeError('"this" is null or not defined'); } var O = Object(this); var len = O.length >>> 0; if (len === 0) { return -1; } var n = +fromIndex || 0; if (Math.abs(n) === Infinity) { n = 0; } if (n >= len) { return -1; } k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); while (k < len) { if (k in O && O[k] === searchElement) { return k; } k++; } return -1; }; } if(typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } } if (!('bind' in Function.prototype)) { Function.prototype.bind= function(owner) { var that= this; if (arguments.length<=1) { return function() { return that.apply(owner, arguments); }; } else { var args= Array.prototype.slice.call(arguments, 1); return function() { return that.apply(owner, arguments.length===0? args : args.concat(Array.prototype.slice.call(arguments))); }; } }; } if (!('trim' in String.prototype)) { String.prototype.trim= function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }; } if (!('lastIndexOf' in Array.prototype)) { Array.prototype.lastIndexOf= function(find, i) { if (i===undefined) i= this.length-1; if (i<0) i+= this.length; if (i>this.length-1) i= this.length-1; for (i++; i-->0;) if (i in this && this[i]===find) return i; return -1; }; } if (!('forEach' in Array.prototype)) { Array.prototype.forEach= function(action, that ) { for (var i= 0, n= this.length; i>> 0; if (len === 0) { return -1; } n = len - 1; if (arguments.length > 1) { n = Number(arguments[1]); if (n != n) { n = 0; } else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } } for (k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); k >= 0; k--) { if (k in t && t[k] === searchElement) { return k; } } return -1; }; } if (document.getElementsByClassName) { document.getElementsByClassName = function (className) { var result = [], body = document.body; (function traverseDOM (node, fn) { if (node.nodeType === 1) { fn(node, className); } node = node.firstChild; while (node) { traverseDOM(node, fn); node = node.nextSibling; } }(body, function (elem, cName) { if ((' ' + (elem.className || elem.getAttribute('class')) + ' ').indexOf(' ' + cName + ' ') >= 0) { result.push(elem); } })); return result; }; } // if (!window.getComputedStyle) { // window.getComputedStyle = function(el, pseudo) { // this.el = el; // this.getPropertyValue = function(prop) { // var re = /(\-([a-z]){1})/g; // if (prop == 'float') prop = 'styleFloat'; // if (re.test(prop)) { // prop = prop.replace(re, function () { // return arguments[2].toUpperCase(); // }); // } // return el.currentStyle[prop] ? el.currentStyle[prop] : null; // } // return this; // } // } // getComputedStyle !('getComputedStyle' in this) && (this.getComputedStyle = (function () { function getPixelSize(element, style, property, fontSize) { var sizeWithSuffix = style[property], size = parseFloat(sizeWithSuffix), suffix = sizeWithSuffix.split(/\d/)[0], rootSize; fontSize = fontSize != null ? fontSize : /%|em/.test(suffix) && element.parentElement ? getPixelSize(element.parentElement, element.parentElement.currentStyle, 'fontSize', null) : 16; rootSize = property == 'fontSize' ? fontSize : /width/i.test(property) ? element.clientWidth : element.clientHeight; return (suffix == 'em') ? size * fontSize : (suffix == 'in') ? size * 96 : (suffix == 'pt') ? size * 96 / 72 : (suffix == '%') ? size / 100 * rootSize : size; } function setShortStyleProperty(style, property) { var borderSuffix = property == 'border' ? 'Width' : '', t = property + 'Top' + borderSuffix, r = property + 'Right' + borderSuffix, b = property + 'Bottom' + borderSuffix, l = property + 'Left' + borderSuffix; style[property] = (style[t] == style[r] == style[b] == style[l] ? [style[t]] : style[t] == style[b] && style[l] == style[r] ? [style[t], style[r]] : style[l] == style[r] ? [style[t], style[r], style[b]] : [style[t], style[r], style[b], style[l]]).join(' '); } function CSSStyleDeclaration(element) { var currentStyle = element.currentStyle, style = this, fontSize = getPixelSize(element, currentStyle, 'fontSize', null); for (property in currentStyle) { if (/width|height|margin.|padding.|border.+W/.test(property) && style[property] !== 'auto') { style[property] = getPixelSize(element, currentStyle, property, fontSize) + 'px'; } else if (property === 'styleFloat') { style['float'] = currentStyle[property]; } else { style[property] = currentStyle[property]; } } setShortStyleProperty(style, 'margin'); setShortStyleProperty(style, 'padding'); setShortStyleProperty(style, 'border'); style.fontSize = fontSize + 'px'; return style; } CSSStyleDeclaration.prototype = { constructor: CSSStyleDeclaration, getPropertyPriority: function () {}, getPropertyValue: function ( prop ) { return this[prop] || ''; }, item: function () {}, removeProperty: function () {}, setProperty: function () {}, getPropertyCSSValue: function () {} }; function getComputedStyle(element) { return new CSSStyleDeclaration(element); } return getComputedStyle; })(this)); /* IE8 MISSING FUNCTIONS */ S(document).ready(function() { if(window.location.href.indexOf(CLIENTAPP_NAME) < 0) return; if(window.location.href.indexOf("support") >= 0) return; if(is_ie8()) { //S("a.current").parent().css('background-color','red'); $(".ibox").corner("30px"); $.post("dashboard-cover.php",function(data) { if(document.getElementById("tmp_dash_ie8")) { document.getElementById("tmp_dash_ie8").innerHTML = data; } }); $(".notificationblink").css("color","orange"); ie8notificationblink(); } else { S("body").append(""); S("#tmp_dash").load("dashboard-cover.htm"); S("#tmp_dash").show(); } $('.btn-icon').hover( function() { $(this).addClass('scale-icon contrast'); }, function() { $(this).removeClass('scale-icon contrast'); } ); }); function openExpireMessage(){ $('#expiredsession').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"makesessionexpiremessage.htm",function(){$('#expiredsession').removeClass('ajax-loading');}).dialog({ title: "Session Expired", bgiframe: true, resizable: false, position:['center',80], modal: true, width: 570, height:470, overlay: { backgroundColor: '#000', opacity: 1 }, close: function() {top.location.reload();}, buttons: {'Ok': function() {top.location.reload();}} }); }; var isIE = function(){ return ($.browser.msie); }; var lockForm = function(objForm,bValue){ if(bValue){ $(":input").attr("disabled","disabled"); $(':button').addClass('ui-state-disabled'); }else{ $(":input").attr("disabled",""); $(':button').removeClass('ui-state-disabled'); } if($('#txtDefaultSearchField')) $('#txtDefaultSearchField').attr('disabled','disabled'); }; var showSwitchToAccount = function(){ $('#switchtoaccount').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"showswitchtoaccount.htm",function(){$('#switchtoaccount').removeClass('ajax-loading');}).dialog({ title: "Switch To Account", bgiframe: true, resizable: false, position:['center',80], width: 380, height:200, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, close: function(){$(this).empty().dialog('destroy');}, buttons: { Cancel: function() {$(this).empty().dialog('destroy');}, 'Proceed': function() { processSwitchToAccount($(this).find('form')); } } }); }; var processSwitchToAccount = function(objForm){ if($('#switchtoaccount').hasClass('ajax-loading')){jAlert("Please wait until the window is complete.\nIf the window takes time to load, kindly refresh the browser.", $.alerts.title);return;} if($.trim($('#txtUname').val())==''){ jAlert("Username must be specified.",$.alerts.title,function(){$('#txtUname').select();}); return; } if($.trim($('#txtPwd').val())==''){ jAlert("Password must be specified.",$.alerts.title,function(){$('#txtPwd').select();}); return; } //Disable the buttons $(":button:contains('Cancel')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Proceed')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Proceed')").html("Please wait..."); $.ajax({ url: ABSOLUTE_PATH+"processswitchtoaccount.htm", dataType: "text", data: $(objForm).serialize(), type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin"){ openExpireMessage(); }else if($.trim(sResponse)=="similaruname"){ jAlert('Username is similar to currently logged in user.', $.alerts.title); $(":button:contains('Please wait...')").attr("disabled",""); $(":button:contains('Cancel')").attr("disabled","").removeClass('ui-state-disabled'); $(":button:contains('Please wait...')").html("Proceed").removeClass('ui-state-disabled'); }else if($.trim(sResponse)=="invaliduname"){ jAlert('Unable to process your request. Invalid username.', $.alerts.title); $(":button:contains('Please wait...')").attr("disabled",""); $(":button:contains('Cancel')").attr("disabled","").removeClass('ui-state-disabled'); $(":button:contains('Please wait...')").html("Proceed").removeClass('ui-state-disabled'); }else if($.trim(sResponse)=="invalidpassword"){ jAlert("Unable to process your request. Invalid password.", $.alerts.title); $(":button:contains('Please wait...')").attr("disabled",""); $(":button:contains('Cancel')").attr("disabled","").removeClass('ui-state-disabled'); $(":button:contains('Please wait...')").html("Proceed").removeClass('ui-state-disabled'); }else{ jAlert("You are about to switch to another account.", $.alerts.title, function(){top.location.href= $.trim(sResponse);}); $('#switchtoaccount').empty().dialog('destroy'); } } }); }; var showChangeCurrentUserPassword = function(admin_id,uname){ $('#changeuserpassword').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"showchangecurrentuserpassword.htm?admin_id="+admin_id,function(){$('#changeuserpassword').removeClass('ajax-loading');}).dialog({ title: "Change Current User Password", bgiframe: true, resizable: false, position:['center',80], width: 380, height:220, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, close: function(){$(this).empty().dialog('destroy');}, buttons: { Cancel: function() {$(this).empty().dialog('destroy');}, 'Change': function() {processChangeCurrentUserPassword(admin_id,$(this).find('form'));} } }); }; var processChangeCurrentUserPassword = function(admin_id,objForm){ if($('#changeuserpassword').hasClass('ajax-loading')){jAlert("Please wait until the window is complete.\nIf the window takes time to load, kindly refresh the browser.");return;} if($.trim($('#txtOldPwd').val())==''){ jAlert("Old password is required. Please enter the old password.",$.alerts.title,function(){$('#txtOldPwd').select();}); return; } if($.trim($('#txtPwd').val()).length < 6){ jAlert("Password is invalid. Please enter at least six(6) characters.",$.alerts.title,function(){$('#txtPwd').select();}); return; } if(hasPasswordSpecialChars($('#txtPwd').val())){ jAlert("Password must not contain special characters. Only A-Z and 0-9 are allowed.\nPlease enter a valid value in this field.",$.alerts.title,function(){$('#txtPwd').select();}); return; } if($.trim($('#txtOldPwd').val())==$.trim($('#txtPwd').val())){ jAlert("New password is similar to old password. Please enter the new password.",$.alerts.title,function(){$('#txtPwd').select();}); return; } if($.trim($('#txtPwd').val())!=$.trim($('#txtConfirmPwd').val())){ jAlert("Passwords do not match. Please confirm the password again.",$.alerts.title,function(){$('#txtConfirmPwd').select();}); return; } //if(!confirm("Are you sure you want to change your password?")) return; jConfirm("Are you sure you want to change your password?",$.alerts.title,function(ans){ if(!ans){ return; } //Disable the buttons $(":button:contains('Cancel')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Change')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Change')").html("Please wait..."); $.ajax({ url: ABSOLUTE_PATH+"processchangecurrentuserpassword.htm", dataType: "text", data: $(objForm).serialize()+"&admin_id="+admin_id, type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin"){ openExpireMessage(); }else if($.trim(sResponse)=="invalidpassword"){ jAlert("Unable to process your request. Invalid old password."); //Disable the buttons $(":button:contains('Please wait...')").attr("disabled",""); $(":button:contains('Cancel')").attr("disabled","").removeClass('ui-state-disabled'); $(":button:contains('Please wait...')").html("Change").removeClass('ui-state-disabled'); }else{ jAlert("Your password has been successfully changed."); $('#changeuserpassword').empty().dialog('destroy'); } } }); }); }; function supportComments(sId){ $('#supportcomments').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+'support.htm?id='+sId,function(){$('#supportcomments').removeClass('ajax-loading');}).dialog({ title: "Support, Comments and Suggestions", bgiframe: true, resizable: false, position:['center',80], width: 435, height:450, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, close: function(){$(this).empty().dialog('destroy');}, buttons: { Cancel: function() {$(this).empty().dialog('destroy');}, 'Submit': function() {processSupportComments($(this).find('form'));} } }); }; function processSupportComments(objForm){ if($('#supportcomments').hasClass('ajax-loading')){jAlert("Please wait until the window is complete.\nIf the window takes time to load, kindly refresh the browser.");return;} if($.trim($('#txtName').val())==""){ jAlert("Name is required. Please enter a value in this field.",$.alerts.title,function(){$('#txtName').select();}); return; } if($.trim($('#txtEmail').val())==""){ jAlert("Email is required. Please enter a value in this field.",$.alerts.title,function(){$('#txtEmail').select();}); return; } if(!emailCheck($('#txtEmail').val())){ jAlert("Invalid email format. Please enter a valid email address.",$.alerts.title,function(){$('#txtEmail').select();}); return; } if($.trim($('#txtUname').val())==""){ jAlert("Username is required. Please enter a value in this field.",$.alerts.title,function(){$('#txtUname').select();}); return; } //if($.trim($('#txtPassword').val())==""){ // jAlert("Password is required. Please enter a value in this field."); // $('#txtPassword').select(); // return; //} if($.trim($('#txtMessage').val())==""){ jAlert("Message is required. Please enter a value in this field.",$.alerts.title,function(){$('txtMessage').select();}); return; } //Disable the buttons $(":button:contains('Cancel')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Submit')").attr("disabled","disabled").addClass('ui-state-disabled'); $(":button:contains('Submit')").html("Please wait..."); $.ajax({ url: ABSOLUTE_PATH+"processsupportcomments.htm", dataType: "text", data: $(objForm).serialize(), type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin") openExpireMessage(); else if($.trim(sResponse)=="wrongpassword"){ jAlert("Unable to process your request. Invalid username or password."); //Disable the buttons $(":button:contains('Please wait...')").attr("disabled",""); $(":button:contains('Cancel')").attr("disabled","").removeClass('ui-state-disabled'); $(":button:contains('Please wait...')").html("Submit").removeClass('ui-state-disabled'); }else if($.trim(sResponse)=="added"){ jAlert("Your message has been sent."); $('#supportcomments').empty().dialog('destroy'); }else{ jAlert("There is a problem in processing your request. Please try again."); //Disable the buttons $(":button:contains('Please wait...')").attr("disabled",""); $(":button:contains('Cancel')").attr("disabled","").removeClass('ui-state-disabled'); $(":button:contains('Please wait...')").html("Submit").removeClass('ui-state-disabled'); } } }); }; function dateDifference(fmonth,fday,fyear,fhours,fminutes,tmonth,tday,tyear,thours,tminutes){ var fdate = new Date(fyear,fmonth,fday,fhours,fminutes); var tdate = new Date(tyear,tmonth,tday,thours,tminutes); return fdate.getTime() - tdate.getTime(); }; S(window).resize(function() { setFlexibleLayout(); }); /* JDA 2015 - 05 - 11 */ var setFlexibleLayout = function() { var lc = S(".light-container"); var c = S("#content",lc); var pagecontent = S(".pagecontent",lc); var hdr = S("#content_hdr",lc); var dtl = S("#content_dtl",lc); if(S(window).width() <=1024) { var sb = S(".submenu td:eq(0)"); sb.css({ paddingLeft:"10%" }); } if(lc.length > 0){ lc.css({ "width": ( S(window).width() <= 1024 ? (S(window).width() - 150) : (S(window).width() * 0.90) ), "height": (S(window).height() * 0.91) - (S(window).width() <= 1024 ? 20 : 0) }); hdr.css({"width":"100%","min-width":"100%"}); hdr.css({"max-width":"100%","min-width":"100%"}); dtl.css({"width": "100%","min-width":"100%"}); dtl.css({"max_width": "100%","min-width":"100%"}); } //pagecontent if(c.length > 0){ c.css({ "width":( S(window).width() <= 1024 ? (S(window).width() - 150) : (S(window).width() * 0.90) ), "margin":"0", "padding":"0", "height": (S(window).height() - c.offset().top) - 130 }); } } var setDivHeight = function(objDiv,iHeightReduce,iWidthReduce){ setFlexibleLayout(); setCurrentSort(); // try { // var wWidth = S(window).width(); // var wHeight = S(window).height(); // var container = S(".light-container"); // container.css({ // "width":wWidth-((wWidth-300) <= 1024 ? 20 : 300), // height:wHeight-50, // }); // var content = S("#content",container); // var pagecontent = S(".pagecontent",container); // content.css({ // "padding":"0", // "margin":"0", // "height": pagecontent.height()-content.offset().top + 90, // "width":wWidth-((wWidth-300) <= 1024 ? 20 : 300), // "overflow-y":"scroll" // }); // } catch(e) { // } }; var setDivHeightNonFlex = function(objDiv,iHeightReduce,iWidthReduce){ var lc = S(".light-container"); var c = objDiv; if(S(window).width() <=1024) { var sb = S(".submenu td:eq(0)"); sb.css({ paddingLeft:"10%" }); } if(lc.length > 0){ var hdr = S("#content_hdr",lc); var dtl = S("#content_dtl",lc); lc.css({ "width": ( S(window).width() <= 1024 ? (S(window).width() - 150) : (S(window).width() * 0.90) ), "height": (S(window).height() * 0.91) - (S(window).width() <= 1024 ? 20 : 0) }); hdr.css({"width":"100%","min-width":"100%"}); hdr.css({"max-width":"100%","min-width":"100%"}); dtl.css({"width": "100%","min-width":"100%"}); dtl.css({"max_width": "100%","min-width":"100%"}); } if(c.length > 0){ c.css({ "width":( S(window).width() <= 1024 ? (S(window).width() - 150) : (S(window).width() * 0.90) ), "margin":"0", "padding":"0", "height": (S(window).height() - c.offset().top) - 160 }); } if(S(window).width() >= 1024) { if($(".current").attr("title") != "Data Transfer") $(".submenu td").css('padding-left',$(".current").position().left); } }; var setDivHeightOLD = function(objDiv,iHeightReduce,iWidthReduce){ var iHeight = 0, iWidth = 0; if(typeof(window.innerWidth ) == 'number' ){ iHeight = window.innerHeight; iWidth = window.innerWidth; }else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight )){ iHeight = document.documentElement.clientHeight; iWidth = typeof(document.documentElement.clientWidth)!='undefined'?document.documentElement.clientWidth:document.body.clientWidth; }else if( document.body && ( document.body.clientWidth || document.body.clientHeight )){ iHeight = document.body.clientHeight; iWidth = document.body.clientWidth; } if(iWidth < 1024){ //auto adjust if window size/screen size is lower than 1024 res $("body").css({'width':iWidth-iWidthReduce-5}); $("html").css({'width':iWidth-iWidthReduce-5}); $(objDiv).height(iHeight-iHeightReduce+20); }else{ $("body").css({'width':'1024px'}); $("html").css({'width':'1024px'}); $(objDiv).height(iHeight-iHeightReduce+40); } }; function check_date(iMonth,iDay,iYear){ if(iMonth=='' || iDay=='' || iYear=='') return false; var mo = new Array(12); mo[1] = 31; mo[2] = (iYear % 4) ? 28:29; mo[3] = 31; mo[4] = 30; mo[5] = 31; mo[6] = 30; mo[7] = 31; mo[8] = 31; mo[9] = 30; mo[10] = 31; mo[11] = 30; mo[12] = 31; //Check the day and month ranges if((parseFloat(iMonth) <= 0) || (parseFloat(iMonth) > 12)) return false; else if((parseFloat(iDay) <= 0) || (parseFloat(iDay) > mo[parseFloat(iMonth)])) return false; else return true; }; function AlphaNumericOnly(e){ var sAllow =' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += '!,.:;@-\'"_'; sAllow += '+-=()*/'; sAllow += "\n"; //sAllow += "<>?"; sAllow += "?"; /* For special characters 241 - � 209 - � 8 - Backspace 13 - Enter 0 - Delete, Home, End, Arrow */ sAllow += String.fromCharCode(241)+ String.fromCharCode(209)+ String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function showAbout(sId){ $('#aboutdialog').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+'showabout.htm',function(){$('#aboutdialog').removeClass('ajax-loading');}).dialog({ title: "About", bgiframe: true, resizable: false, position:['center',80], width: 620, height:360, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, close: function(){$(this).empty().dialog('destroy');}, buttons: { Ok: function() {$(this).empty().dialog('destroy');} } }); }; function hasSpecialChars(str){ var sAllow =' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += '!,.:;@-\'"_'; sAllow += '+-=()*/'; sAllow += "\n"; sAllow += "?"; //sAllow += "<>?"; sAllow += String.fromCharCode(241)+ String.fromCharCode(209)+ String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(164)+ String.fromCharCode(165)+ String.fromCharCode(13); bFound = false; for(i=0;i < str.length;i++){ if(sAllow.indexOf(str.charAt(i))==-1){ bFound=true;break; } } return bFound; }; var clearForm = function(obj) { $(obj).find(':input').each(function() { switch(this.type) { case 'password': case 'select-multiple': case 'select-one': case 'text': case 'textarea': $(this).val(''); break; case 'checkbox': case 'radio': this.checked = false; } }); }; function LettersAndNumbersOnly(e,sAllow){ sAllow +=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; /* For special characters 241 - � 209 - � 8 - Backspace 13 - Enter 0 - Delete, Home, End, Arrow */ sAllow += String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function hasPasswordSpecialChars(str){ var sAllow ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += String.fromCharCode(241)+ String.fromCharCode(209)+ String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); bFound = false; for(i=0;i < str.length;i++){ if(sAllow.indexOf(str.charAt(i))==-1){ bFound=true;break; } } return bFound; }; function WholeNumbersOnly(e){ var sAllow ='\t'; sAllow = '1234567890'; /* For special characters 241 - � 209 - � 8 - Backspace 13 - Enter 0 - Delete, Home, End, Arrow */ sAllow += String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function WholeNumbersWithDecimalOnly(e){ var sAllow ='\t'; sAllow = '1234567890'; sAllow += '.'; /* For special characters 241 - � 209 - � 8 - Backspace 13 - Enter 0 - Delete, Home, End, Arrow */ sAllow += String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function NumericOnly(e, extraAllowed){ var sAllow = '1234567890'; //sAllow += '-'; //sAllow += extraAllowed; /* For special characters 241 - ? 209 - ? 8 - Backspace 13 - Enter 0 - Delete, Home, End, Arrow */ sAllow += String.fromCharCode(241)+ String.fromCharCode(209)+ String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function NameCharsOnly(e){ var sAllow =' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += '\',-.'; //sAllow += '!,.:;@-\'"_'; //sAllow += '+-=()*/'; //sAllow += "\n"; //sAllow += "?"; //sAllow += "<>?"; sAllow += String.fromCharCode(241)+ String.fromCharCode(209)+ String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function hasSpecialCharsInName(str){ var sAllow =' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += '\',-.'; //sAllow += '!,.:;@-\'"_'; //sAllow += '+-=()*/'; //sAllow += "\n"; //sAllow += "?"; //sAllow += "<>?"; sAllow += String.fromCharCode(241)+ String.fromCharCode(209)+ String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(164)+ String.fromCharCode(165)+ String.fromCharCode(13); bFound = false; for(i=0;i < str.length;i++){ if(sAllow.indexOf(str.charAt(i))==-1){ bFound=true;break; } } return bFound; }; function UsernameCharsOnly(e){ var sAllow =' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += '\',-.'; //sAllow += '!,.:;@-\'"_'; //sAllow += '+-=()*/'; //sAllow += "\n"; //sAllow += "?"; //sAllow += "<>?"; sAllow += String.fromCharCode(8)+ String.fromCharCode(0)+ String.fromCharCode(13); k=document.all?parseInt(e.keyCode): parseInt(e.which); return (sAllow.indexOf(String.fromCharCode(k))!=-1); }; function hasSpecialCharsInUsername(str){ var sAllow =' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\t'; sAllow += '1234567890'; sAllow += '\',-.'; //sAllow += '!,.:;@-\'"_'; //sAllow += '+-=()*/'; //sAllow += "\n"; //sAllow += "?"; //sAllow += "<>?"; bFound = false; for(i=0;i < str.length;i++){ if(sAllow.indexOf(str.charAt(i))==-1){ bFound=true;break; } } return bFound; }; function setCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function getCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } var showDashboard = function(controller){ /* $("#dashboardwindow").html('').addClass('ajax-loading').load("showdashboard.htm",{controller:controller},function(){ $("#dashboardwindow").removeClass('ajax-loading');}).dialog({ */ $("#dashboardwindow").dialog({ title: "Dashboard", bgiframe: true, resizable: false, draggable: true, position:['center',20], width: 480, height:590, modal: true, overlay: { backgroundColor: '#1E552B', opacity: 1 }, close: function(){$(this).dialog('destroy');} }); }; var downloadInPDF = function(sUrl){ $caption = $('#cmdDownloadPDF').val(); $('#cmdDownloadPDF').attr('disabled','disabled').addClass('ui-state-disabled').val('Please wait...'); setTimeout(function(){top.location.href=sUrl;$('#cmdDownloadPDF').removeClass('ui-state-disabled').attr('disabled','').val($caption);},1000); }; var downloadInEXCEL = function(sUrl){ $('#cmdDownloadStatistics').attr('disabled','disabled').addClass('ui-state-disabled').val('Please wait...'); setTimeout(function(){top.location.href=sUrl;$('#cmdDownloadStatistics').removeClass('ui-state-disabled').attr('disabled','').val('Statistic Report');},1000); }; var downloadInXLS = function(sUrl){ $caption = $('#cmdDownloadXLS').val(); $('#cmdDownloadXLS').attr('disabled','disabled').addClass('ui-state-disabled').val('Please wait...'); setTimeout(function(){top.location.href=sUrl;$('#cmdDownloadXLS').removeClass('ui-state-disabled').attr('disabled','').val($caption);},1000); }; var downloadReport = function(objButton,type,excelurl,pdfurl){ switch(type.toUpperCase()){ case "EXCEL": caption = $(objButton).val(); if($.trim(caption)==''){ h = $(objButton).html(); $(objButton).html('Please wait...').addClass('ui-state-disabled').attr('disabled','disabled'); setTimeout(function(){$(objButton).html(h).removeClass('ui-state-disabled').attr('disabled','');},1000); }else{ $(objButton).val('Please wait...').addClass('ui-state-disabled').attr('disabled','disabled'); setTimeout(function(){$(objButton).val(caption).removeClass('ui-state-disabled').attr('disabled','');},1000); } top.location.href=excelurl; break; case "PDF": caption = $(objButton).val(); if($.trim(caption)==''){ h = $(objButton).html(); $(objButton).html('Please wait...').addClass('ui-state-disabled').attr('disabled','disabled'); setTimeout(function(){$(objButton).html(h).removeClass('ui-state-disabled').attr('disabled','');},1000); }else{ $(objButton).val('Please wait...').addClass('ui-state-disabled').attr('disabled','disabled'); setTimeout(function(){$(objButton).val(caption).removeClass('ui-state-disabled').attr('disabled','');},1000); } top.location.href=pdfurl; break; default: showDownloadReport(excelurl,pdfurl); } } var showDownloadReport = function(excelurl,pdfurl){ $("#window5").html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"showdownloadreport.htm",function(){$("#window5").removeClass('ajax-loading');}).dialog({ title: "Download Options", bgiframe: true, resizable: false, draggable: true, position:['center',20], width: 300, height:150, minHeigth: 150, modal: true, close: function(){$(this).dialog('destroy');}, buttons: { Cancel: function() {$(this).dialog('destroy');}, 'Download' : function(e) { sUrl = ($.trim($("input[name=rdoDocumentType]").filter(':checked').val()) == "PDF")?pdfurl:excelurl; $(e.target).html('Please wait...').addClass('ui-state-disabled').attr('disabled','disabled'); top.location.href=sUrl; setTimeout(function(){$(e.target).html('Download').removeClass('ui-state-disabled').attr('disabled','');},1000); } } }); }; //ADDED BY DSA FOR INCLUSION OF DATA ANALYSER QUERY function getReportCriteria(criteria,rtarget){ $.ajax({ url: "getreportcriteria.htm", dataType: "text", data: 'criteria=' + criteria, type: 'post', success: function(sResponse){ if($.trim(sResponse)!="notlogin"){ $('#'+rtarget).html(sResponse); }else openExpireMessage(); } }); }; function generateReport(){ if($('#cboPosition').val()==''){ jAlert('Please select the position you want to search.'); return false; } if($('#content').hasClass('ajax-loading')) return; //lock form if(typeof(objForm)=='object') lockForm(objForm ,true); $('#cboPage').attr('disabled','disabled'); $('#pagination').html(''); $('#content').html('').addClass('ajax-loading'); $('#cmdDownloadPDF').attr('disabled','disabled'); $('#cmdDownloadPDF').addClass('ui-state-disabled'); $.ajax({ url: "getqgen-listofquestionstat.htm?", dataType: "text", data: "&cboPosition=" + $('#cboPosition').val(), type: 'post', success: function(sResponse){ if($.trim(sResponse)!="notlogin"){ lockForm(objForm ,false); $('#content').removeClass('ajax-loading').html(sResponse); }else openExpireMessage(); } }); }; function getQuestionStats(){ //jAlert('ok'); if($('#content').hasClass('ajax-loading')) return; sURLVars=''; objForm = arguments[0]; //First argument of this function is a form //get the variables to be posted for(i = 0; i < arguments.length;i++){ sURLVars += (typeof(arguments[i])=='object')?$(arguments[i]).serialize():''; sURLVars += ($.trim(sURLVars)!='')?"&":''; sURLVars += (typeof(arguments[i])=='string')?arguments[i]:''; } //alert(typeof(objForm)); //lock form if(typeof(objForm)=='object') lockForm(objForm ,true); $('#cboPage').attr('disabled','disabled'); $('#pagination').html(''); $('#content').html('').addClass('ajax-loading'); $('#cmdDownloadPDF2').attr('disabled','disabled'); $('#cmdDownloadPDF2').addClass('ui-state-disabled'); $.ajax({ url: "getqgen-listofquestionstat.htm", dataType: "text", data: sURLVars, type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin") openExpireMessage(); else if($.trim(sResponse)=="notfound"){ jAlert("Unable to load question statistics.",$.alerts.title,function(){top.location.reload();}); }else{ if(typeof(objForm)=='object'){ lockForm(objForm ,false); } $('#content').removeClass('ajax-loading').html(sResponse); } } }); }; var showRetrieveAccount = function(){ if($("#window1").length == 0) { $("body").append(""); } $('#window1').html('').load(ABSOLUTE_PATH+'showretrieveaccount.htm').dialog({ title: "Forgot Account", bgiframe: true, resizable: false, position:['center',80], width: 580, height:260, modal: true, close: function(){$(this).dialog('destroy');}, open: function(event,ui) { //iWindow(); }, buttons: { Cancel: function() {$(this).dialog('destroy');} } }); }; var processRetrieveAccount = function() { $("#cmdRetrieve").attr("disabled","disabled").addClass('ui-state-disabled').html('Please wait...'); $.ajax({ url: ABSOLUTE_PATH+"processretrieveaccount.htm", dataType: "text", data: $("#frmRetrieveAccount").serialize(), type: 'post', success: function(sResponse){ eval(sResponse); //$("#window1").dialog('destroy'); } }); } function doShowSubNavigations(obj) { var index = $(".dashboard-icons a").index(obj); switch(index) { case 0: if($(".dashboard-sub-container").attr("shown") == "true") { var pr = $(obj).parent(); $(".dashboard-sub-container").hide(); $(".dashboard-sub-container").attr('shown',''); pr.removeClass('dashboard-icons-hover'); $(".dashboard-cholder:eq("+index+")").fadeOut("slow"); } else { var pr = $(obj).parent(); $(".dashboard-sub-container").show(); $(".dashboard-sub-container").attr('shown','true'); pr.addClass('dashboard-icons-hover'); $(".dashboard-cholder:eq("+index+")").fadeIn("slow"); } break; } } function doCloseDashboard(obj) { $(obj).css("top","-100%").hide(); } var showSlideDashboard = function() { if(is_ie8()) { $(".dashboard-container-overlay").corner("30px"); } $(".dashboard-cover-main").css({"top":"0%","top":"0"}).show(); getLicenseDetails(); centerDashboard1(); } S(document).ready(function() { if(is_ie8()) { setTimeout(function() { var container = document.getElementById("dashboard-container-form-id"); try { container.style.cssText = "margin-left:" + ((document.body.offsetWidth / 2) - (container.offsetWidth / 2)) + "px;margin-top:"+((document.body.offsetHeight / 2) - (container.offsetHeight / 2))+ "px;"; } catch(e) { } if(S("#has_dashboard_at_start").length > 0) { showSlideDashboard(); } },2000); window.onresize = function() { var container = document.getElementById("dashboard-container-form-id"); try { container.style.cssText = "margin-left:" + ((document.body.offsetWidth / 2) - (container.offsetWidth / 2)) + "px;margin-top:"+((document.body.offsetHeight / 2) - (container.offsetHeight / 2))+ "px;"; } catch(e) { } } } }); var iWindow = function() { $(".ui-dialog-titlebar").hide(); var pr = $(".ui-dialog-content").parent(); pr.addClass("iCorners").css({ "padding":"10px", }); $('.ui-widget-overlay').css({'background':'black','opacity':'1'}); }; var iWindowwithTitle = function() { var pr = $(".ui-dialog-content").parent(); pr.addClass("iCorners").css({ "padding":"10px", }); $('.ui-widget-overlay').css({'background':'black','opacity':'1'}); }; var showSysRequirements = function(){ $("#systemreq").dialog({ title: "System Requirements", bgiframe: true, resizable: false, draggable: true, position: ['center', 80], width: 500, height: 250, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, closeOnEscape: false, open: function(event, ui) { //iWindow(); }, close: function(event, ui) { $(this).dialog('destroy'); if ($('#isLoaded').val()) { $("#isLoaded").val(""); } } }); }; /* notification sliding panel : #JDA 2015-10-21 */ (function($) { 'strict'; $.jSlidingPanel = function(options) { var container = $(".trans-container"); var item = $(".trans-item"); var parent = typeof(options.parent) != "undefined" ? options.parent() : container.parent(); parent.css({"overflow":"hidden"}); options.linkBgColor = typeof(options.linkBgColor) != "undefined" ? options.linkBgColor : "#dadada"; options.linkColor = typeof(options.linkColor) != "undefined" ? options.linkColor : "#000000"; options.linkPadding = typeof(options.linkPadding) != "undefined" ? options.linkPadding : "5px"; options.linkPadding = typeof(options.linkPadding) != "undefined" ? options.linkPadding : ""; options.linkBorder = typeof(options.linkBorder) != "undefined" ? options.linkBorder : ""; options.contentBgColor = typeof(options.contentBgColor) != "undefined" ? options.contentBgColor : ""; container.css({"width":parent.width(),"height":parent.height(),"background":"","left":"0","top":"0"}); item.children("a").css({"-ms-transition":".7s","-o-transition":".7s","-moz-transition":".7s","-webkit-transition":".7s","transition":".7s"}).css({"margin-bottom":"2px","border":options.linkBorder,"color":options.linkColor,"display":"block","width":"auto","padding":options.linkPadding,"background": options.linkBgColor,"font-weight":"bolder","font-family":"arial","font-size":"15px","text-decoration":"none"}).mouseover(function() { $(this).css({"background":options.linkColor,"color":options.linkBgColor}); }).mouseout(function() { if($(this).attr("data-active") == "1") { return; } $(this).css({"background":options.linkBgColor,"color":options.linkColor});}).click(function() { item.children("a").css({"background":options.linkBgColor,"color":options.linkColor}).attr("data-active","0"); $(this).css({"background":options.linkColor,"color":options.linkBgColor}).attr("data-active","1"); var butonDis = $(this); item.children("div.trans-content").css({"top": (parent.height()+200) }); $(this).next().animate({"top": ("-="+(parent.height()+165))},500,function() { if($(this).attr("has-close")=="true") { } else { $(this).prepend("").attr("has-close","true"); if(typeof(butonDis.attr("data-func")) != "undefined") { eval(butonDis.attr("data-func")+"();"); } $(".trans-btn").unbind("click").click(function() { $(this).parent().animate({ "top" : (parent.height()+200) },1000,"linear",function() { item.children("a").css({"background":options.linkBgColor,"color":options.linkColor}).attr("data-active","0"); }); }); } }); }); item.children("div.trans-content").css({"left":"0","padding":"20px","z-index":"1000","position":"absolute","border":"1px solid #dadada","top":(parent.height()+200),"background": options.contentBgColor ,"width": parent.width(),"min-height":"500px"}); }; })(jQuery); /* notification sliding panel : #JDA 2015-10-21 */ var getListofNotTakenTheRequiredModule = function() { $("#nottakenrequiredmodule").html("
"); $.post("getlistof-notakenrequiredmodule.htm",function(data) { $("#nottakenrequiredmodule").html(data); }); }; var getListofCompletedModules = function() { $("#completedmodule").html("
"); $.post("getlistof-completedmodules.htm",function(data) { $("#completedmodule").html(data); }); }; var getListOfUnfinishedModules = function() { $("#unfinishedmodule").html("
"); $.post("getlistof-unfinishedmodules.htm",function(data) { $("#unfinishedmodule").html(data); }); }; var getListofEaseSummary = function() { $("#easesummary").html("
"); $.post("getlistof-easesummary.htm",function(data) { $("#easesummary").html(data); }); }; var viewTrainingRecordsFromNotif = function(param){ //sLabel = $('td[id=candidate-'+admin_id+']').html(); //$('td[id=candidate-'+admin_id+']').html('').addClass('centerspinnerintabledata'); $.ajax({ url: "viewtrainingrecords.htm", dataType: "text", data: param, type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin") openExpireMessage(); else eval(sResponse); //$('td[id=candidate-'+admin_id+']').html(sLabel).removeClass('centerspinnerintabledata'); } }); }; var viewTrainingRecords = function(admin_id,viewlink){ if (getCookie('candidatesListBehavior')=='itest' && viewlink==0){ showiTestDisclaimer(admin_id,false); return false; }else if (getCookie('candidatesListBehavior')=='elearning' && viewlink==0){ showLoadCBT(admin_id); return false; } sLabel = $('td[id=candidate-'+admin_id+']').html(); $('td[id=candidate-'+admin_id+']').html('').addClass('centerspinnerintabledata'); $.ajax({ url: "viewtrainingrecords.htm", dataType: "text", data: "admin_id="+admin_id, type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin") openExpireMessage(); else eval(sResponse); $('td[id=candidate-'+admin_id+']').html(sLabel).removeClass('centerspinnerintabledata'); } }); }; (function( $ ){ $.fn.jDropCheck = function(settings) { var context = $(this).parent(); settings.title = (typeof(settings.title) != "undefined" ? settings.title : ""); settings.borderColor = (typeof(settings.borderColor) != "undefined" ? settings.borderColor : "#c4c4c4"); settings.border = (typeof(settings.border) != "undefined" ? settings.border : "1px"); settings.borderRadius = (typeof(settings.borderRadius) != "undefined" ? settings.borderRadius : "3px"); settings.background = (typeof(settings.background) != "undefined" ? settings.background : "#f0f0f0"); settings.height = (typeof(settings.height) != "undefined" ? settings.height : "20px"); settings.width = (typeof(settings.width) != "undefined" ? settings.width : "auto"); settings.addClass = (typeof(settings.addClass) != "undefined" ? settings.addClass : "auto"); var cInstance = $(".dropdownPicker").length; var html = $(this).html(); var style = "text-align:left;font-weight:bolder;cursor:pointer;border:"+settings.border+" solid "+settings.borderColor+";width:"+(typeof($(this).attr('cwidth')) != "undefined" ? $(this).attr("cwidth") : settings.width)+";padding:5px;background:"+settings.background+";height:"+settings.height+";"; style+="-webkit-border-radius:"+settings.borderRadius+";border-radius:"+settings.borderRadius+";-moz-border-radius:"+settings.borderRadius+";position:relative;"; var name = ($(this).attr("name")); var check = []; $(this).find("option").each(function() { check[check.length] = " "+$(this).text()+""; }); var obj = {}; obj.uuid = function() { var d = new Date().getTime(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = (d + Math.random()*16)%16 | 0; d = Math.floor(d/16); return (c=='x' ? r : (r&0x3|0x8)).toString(16); }); return uuid; } var cuuid = obj.uuid(); var dropelement = "dropcheck-"+cuuid; $(this).replaceWith("
"+settings.title.substring(0,30)+"
"); $("#"+dropelement).click(function(e) { //$(this).children(".dropdownPicker").css('z-index',$(this).children(".dropdownPicker").css('z-index')+1+cInstance); var dr = $(this).find(".dropdownPicker"); if($(this).attr('state')=='hidden') { dr.show(); dr.css({ "position":"absolute", "width":$(this).width() - 20 + 8, "max-height":"300px", "overflow-y":"scroll", "background":"#f0f0f0", "left": "0px", "top":$(this).height()+15, "border":"1px solid #c4c4c4", "text-align":"left" }); dr.next().html("▲"); $(this).attr("state","shown"); } else { dr.hide(); $(this).attr("state","hidden"); dr.next().html("▼"); //dr.prev().html("("+dr.find("input[type='checkbox']:checked").length+") selected"); dr.prev().html((dr.find("input[type='checkbox']:checked").length!=0?"("+dr.find("input[type='checkbox']:checked").length+") selected":settings.title)); } $("body div[state='leave']").each(function() { var ctr = $(this).children("input[type='checkbox']:checked").length; $(this).prev().html((ctr!=0?"("+ctr+") selected":settings.title)); $(this).hide().attr('state','').next().html("▼").parent().attr("state","hidden"); }); dr.click(function(e) { e.stopPropagation(); }); //$(this).children(".dropdownPicker").attr("state","leave"); e.stopPropagation(); }).unbind("mouseover").mouseover(function() { $(this).children(".dropdownPicker").attr("state","active"); }).unbind("mouseout").mouseout(function() { $(this).children(".dropdownPicker").attr("state","leave"); }).children(".dropdownPicker").unbind("mouseover").mouseover(function() { $(this).attr("state","active"); }).unbind("mouseout").mouseout(function() { $(this).attr("state","leave"); }); if(typeof($("body,html").attr("cevt")) == "undefined") { $("body,html").attr("cevt",true); $(document).click(function() { $("body div[state='leave']").each(function() { var ctr = $(this).children("input[type='checkbox']:checked").length; $(this).prev().html((ctr!=0?"("+ctr+") selected":settings.title)); $(this).hide().attr('state','').next().html("▼").parent().attr("state","hidden"); }); }); }; return this; } })( jQuery ); var showNotifications = function() { $("body").append("
"); $("#notification01").html('').addClass('ajax-loading').load("shownotifications.htm",function(){$("#notification01").removeClass('ajax-loading'); $.jSlidingPanel({ target : "notif", linkBgColor : "#ffffff", linkColor : THEME_COLOR, //"#313A63" linkPadding : "10px", linkBorder : "1px solid "+THEME_COLOR, contentBgColor : "#E4E4E4" }); }).dialog({ title: "Notifications", bgiframe: true, resizable: false, draggable: true, position:['center',30], width: ($(window).width() * 0.80), height: 600, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, close: function(){$(this).empty().dialog('destroy');} }); }; /* inspired by RLT */ var setToFocalVar = function(dis,admin_id,app_id,mod_id) { $(dis).replaceWith(""); param = "&fromnotif=1&setFocus=true&admin_id="+admin_id+"&app_id="+app_id+"&mod_id="+mod_id; $.post("getlistof-notakenrequiredmodule.htm", param, function(data) { viewTrainingRecordsFromNotif(param); }); }; /* sey/20161003 */ var setCurrentSort = function(){ var i = localStorage.getItem('currentsort'); if(i == null || $('a.sortasc, a.sortdesc').eq(i).length <= 0) i = 0; $('a.sortasc, a.sortdesc').eq(i).addClass('currentsort'); $('a.sortasc, a.sortdesc').click(function(){ var i = $('a.sortasc, a.sortdesc').index(this); localStorage.setItem('currentsort', i); }); } var setCurrentSortTD = function(){ var i = localStorage.getItem('currentsorttd'); if(i == null || $('.fa-sort-asc, .fa-sort-desc').eq(i).length <= 0) i = 0; $('.fa-sort-asc, .fa-sort-desc').eq(i).closest('td').addClass('currentsort'); $('.fa-sort-asc, .fa-sort-desc').click(function(){ var i = $(this).index(this); localStorage.setItem('currentsorttd', i); }); } // For Multiple Animation in element $.fn.extend({ animateCss: function (animationName) { var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; $(this).addClass('animated ' + animationName).one(animationEnd, function() { $(this).removeClass(animationName); infAnimate(); }); } }); var infAnimate = function(){ var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; $('.animate-grid-icon').addClass('flip').one(animationEnd,function(){ $(this).removeClass('flip'); }); }; var animateGridIcon = function(){ $('.animate-grid-icon').css('display','inline-block').animateCss('rotateIn'); setInterval(infAnimate,10000); }; var getLicenseDetails = function(){ sURLVars=''; company_id = arguments[0]; if($.trim(company_id) != "") sURLVars = '&company_id=' + company_id; $("#divLicenseDetails").empty().addClass("ajax-loading"); $.ajax({ url: "getlicensedetails.htm", dataType : "text", data : sURLVars, type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin"){ openExpireMessage(); } else { $("#divLicenseDetails").removeClass("ajax-loading").html(sResponse); } } }); } var getLicenseAllocations = function(app_id, company_id){ $(".dashboard-cover-main").dblclick(); $('#divLicenseAllocations').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"getlicenseallocations.htm?app_id="+app_id+'&company_id='+company_id,function(){$('#divLicenseAllocations').removeClass('ajax-loading');}).dialog({ title: "License Allocation", bgiframe: true, resizable: false, position:['center',80], modal: true, width: 450, height:350, overlay: { backgroundColor: '#000', opacity: 1 }, close: function() { $(this).dialog('destroy'); showSlideDashboard();}, buttons: {'Close': function() { $(this).dialog('destroy'); showSlideDashboard();}} }); } var showWelcome = function(){ $('#welcome').html('').addClass('ajax-loading').load(ABSOLUTE_PATH+"showwelcome.htm",function(){$('#welcome').removeClass('ajax-loading');}).dialog({ title: "Welcome", bgiframe: true, resizable: false, position:['center',80], width: 450, height:220, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, open: function(){ //$(".ui-dialog-titlebar").hide(); }, close: function(){ $(this).empty().dialog('destroy'); //$(".ui-dialog-titlebar").show(); } }); }; var showEditCandidateFirstTime = function(admin_id){ var y = 400 ; var tmpWidth =475, tmpHeight = y; var btns = {}; //btns['Cancel'] = function(){ $(this).dialog("destroy"); location.reload();}; btns['Logout'] = function(){ processLogoutUser();}; btns['Update'] = function(){ processEditCandidateFirstTime($('#frmCandidate'),admin_id); }; $("#candidatewindow").html('').addClass('ajax-loading').load("showeditcandidatefirsttime.htm",{admin_id:admin_id},function(){$("#candidatewindow").removeClass('ajax-loading');}).dialog({ title: "Edit Candidate", bgiframe: true, resizable: false, draggable: true, position:['center',20], width: tmpWidth, height:tmpHeight, modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, //close: function(){getListOfCandidates($('#frmSearch'));$(this).empty().dialog('destroy');}, buttons: btns }); $(".ui-dialog-titlebar-close").hide(); }; var processEditCandidateFirstTime = function (objForm,admin_id){ if($('#candidatewindow').hasClass('ajax-loading')){jAlert("Please wait until the window is complete.\nIf the window takes time to load, kindly refresh the browser.");return;} if($.trim($('#ulname').val())==''){ jAlert("Last Name is required. Please enter a value in this field.",$.alerts.title,function(){$('#ulname').select();}); return; } if(hasSpecialCharsInName($('#ulname').val())){ jAlert("Last Name must not contain special characters. Please enter a valid value in this field.",$.alerts.title,function(){$('#ulname').select();}); return; } if($.trim($('#ufname').val())==''){ jAlert("First Name is required. Please enter a value in this field.",$.alerts.title,function(){$('#ufname').select();}); return; } if(hasSpecialCharsInName($('#ufname').val())){ jAlert("First Name must not contain special characters. Please enter a valid value in this field.",$.alerts.title,function(){$('#ufname').select();}); return; } if($.trim($('#umname').val())!='' && hasSpecialCharsInName($('#umname').val())){ jAlert("Middle Name must not contain special characters. Please enter a valid value in this field.",$.alerts.title,function(){$('#umname').select();}); return; } if(emailCheck($.trim($('#email').val()))!=true && $.trim($('#email').val()) != ''){ jAlert("Invalid email address. Please enter a valid value in this field.",$.alerts.title,function(){$('#email').select();}); return; } if($('#mobilephone').length > 0){ if($.trim($('#mobilephone').val())!='' && hasSpecialCharsInName($('#mobilephone').val())){ jAlert("Mobile Phone No. must not contain special characters. Please enter a valid value in this field.",$.alerts.title,function(){$('#mobilephone').select();}); return; } } // if(!confirm("Are you sure you want to update this candidate?")) return; jConfirm('Are you sure you want to update this information?', $.alerts.title, function(ans) { if (!ans){ return; } $(":button:contains('Update')").attr("disabled","disabled").addClass('ui-state-disabled').html("Please wait..."); $.ajax({ url: "processeditcandidatefirsttime.htm", dataType: "text", data: $(objForm).serialize()+"&admin_id="+admin_id, type: 'post', success: function(sResponse){ if($.trim(sResponse)=="notlogin"){ openExpireMessage(); }else if($.trim(sResponse)=="exists"){ jAlert("Unable to process your request. Candidate already exists.",$.alerts.title,function(){$('#ulname').select();}); $(":button:contains('Please wait...')").attr("disabled","").removeClass('ui-state-disabled').html("Update"); }else if($.trim(sResponse)=="idnumexists"){ jAlert("Unable to process your request. Candidate with similar ID No. already exists.",$.alerts.title,function(){$('#ulname').select();}); $(":button:contains('Please wait...')").attr("disabled","").removeClass('ui-state-disabled').html("Update"); }else if($.trim(sResponse)=="idnuminvalid"){ jAlert("Unable to process your request. Candidate ID No. must be specified.",$.alerts.title,function(){$('#ulname').select();}); $(":button:contains('Please wait...')").attr("disabled","").removeClass('ui-state-disabled').html("Update"); }else{ location.reload(); /* var btns = {}; btns['Close'] = function(){ location.reload(); $(this).dialog("destroy"); }; $("#candidatewindow").dialog("option", "buttons", btns); $('#candidatewindow').html(sResponse); */ } } }); }); }; var centerDashboard1 = function() { $(".dashboard-container-form").css({ "margin-top": $(window).height() / 2 - S(".dashboard-container-form").height() / 2, "margin-left": $(window).width() / 2 - S(".dashboard-container-form").width() / 2, }); }; var removeSpecialChars_ = function(obj){ obj.value = obj.value.replace(/[^A-Za-z0-9\s\_]/g, ''); obj.value = obj.value.replace(/\s/g, ""); return obj.value; }; var remSpecialChars = function(str){ var strVal = str.replace(/[^A-Za-z0-9\s\_]/g, ''); return strVal.replace(/\s/g, ""); }; var ObjEULA = { callback: null, admin_id: null }; var processEULA = function() { $.ajax({ url: "proclogin.php", type: "POST", data: "updateUserEulaStatus=1&username="+$("#username").val()+"&password="+$("#password").val(), success: function(data) { ObjEULA.callback(); } }); } var showEULA = function(callback){ ObjEULA.callback = callback; $.ajax({ url: "proclogin.php", type: "POST", data: "checkUserEULAStatus=1&username="+$("#username").val()+"&password="+$("#password").val(), success: function(data) { if(data == "not_exists") { alert("Invalid Username or Password"); } else if(data.indexOf("eula_accepted") != -1) { callback(); } else { $("#window1").html('').addClass('ajax-loading').load("eula.htm",function(){ $("#window1").removeClass('ajax-loading'); }).dialog({ title: "END-USER LICENSE AGREEMENT (EULA)", bgiframe: true, resizable: false, draggable: true, position: ['center', 80], width: 1105 , height: 710 , modal: true, overlay: { backgroundColor: '#000', opacity: 1 }, closeOnEscape: false, close: function(event, ui) { $(this).empty().dialog('destroy'); window.location.reload(); } }); } } }); }