var userLeavingPage=false; window.onbeforeunload=function(){ userLeavingPage=true; } callAjaxExecuting=false; callAjaxQ=new Array(); function addToCallAjaxQ(url, data, func){ var newEl={"strURL":url,"strPostData":data,"thefunction":func}; callAjaxQ.splice(callAjaxQ.length, 0, newEl); } function executeFromCallAjaxQ(){ if(callAjaxQ.length==0) return; var newEl=callAjaxQ[0]; callAjax(newEl.strURL, newEl.strPostData, newEl.thefunction); callAjaxQ.splice(0,1); } function callAjax(strURL,strPostData,thefunction) { if(callAjaxExecuting){ addToCallAjaxQ(strURL, strPostData, thefunction); return; } callAjaxExecuting=true; var xmlHttpReq = false; var self = this; var msg=""; // Mozilla/Safari var www=(window.location.href.toLowerCase().indexOf("https://www.")>0)?"https://www.":"https://"; var strURL=strURL.replace("https://",www); if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { callAjaxExecuting=false; if(self.xmlHttpReq.status != 200 && !userLeavingPage){ alert('OOPS! Connection Error.\nPlease Check your Internet Connection.'); return; } if($.trim(self.xmlHttpReq.responseText)=='{"status":0,"msg":"Your Session seems to have expired. Please try refreshing the page to login again."}'){ alert('Your Session seems to have expired. Please try refreshing the page to login again.'); thefunction(''); return; } thefunction(self.xmlHttpReq.responseText); setTimeout('executeFromCallAjaxQ();', 5) ; } else { //alert(self.xmlHttpReq.readyState); } } self.xmlHttpReq.send(strPostData); } function selectDropDownValue(el, val){ if(!el) return; for(var i=0; i= 65 && w <= 90) && !s) || ((w >= 97 && w <= 122) && s); cb.call(this, c); }); }; function mbsToggleColumn(options){ if(!options.tblId && !options.table) return; if(!options.colTitle && !options.colNumber) return; if(options.table){ var table=options.table; } else{ var table=$('#'+options.tblId); } //var table=(options.table || $('#'+options.tblId)); if(!options.colNumber && options.colTitle){ options.colNumber=-1; var ths=$('th', table); if(!(ths.length>0)){ ths=$('#'+options.tblId+' tr:eq(0) td'); } ths.each(function(index){ if($(this).text()==options.colTitle){ options.colNumber=index+1; } }); } if(options.colNumber<0) return; if(options.removeCells===true){ table.find('td:nth-child('+options.colNumber+')').remove(); table.find('th:nth-child('+options.colNumber+')').remove(); } else{ table.find('td:nth-child('+options.colNumber+')').toggle(); table.find('th:nth-child('+options.colNumber+')').toggle(); } } function dump(arr,level) { var dumped_text = ""; if(!level) level = 0; //The padding given at the beginning of the line. var level_padding = ""; for(var j=0;j \"" + value + "\"\n"; } } } else { //Stings/Chars/Numbers etc. dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; } return dumped_text; }