////////////////////////////////////////////////////////////////////// // function: trim // return the string that is trimmed. ////////////////////////////////////////////////////////////////////// String.prototype.trim = function() { // skip leading and trailing whitespace // and return everything in between return this.replace(/^\s*(\b.*\b|)\s*$/, "$1"); } ////////////////////////////////////////////////////////////////////// // function: isNull // return true if value is null. ////////////////////////////////////////////////////////////////////// function isNull(sVal) { if (sVal.trim.length==0){ return(true); } return(false); } ////////////////////////////////////////////////////////////////////// // function: checkNull // to check whether the string is empty or null ////////////////////////////////////////////////////////////////////// function checkNull(to) { if (to.length==0) { return(false); } return(true); } ////////////////////////////////////////////////////////////////////// // function: validateEmail // return true - if valid email address is entered // return false - if invalid email address is entered ////////////////////////////////////////////////////////////////////// function validateEmail(email) { if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){ return true; } return false; } ////////////////////////////////////////////////////////////////////// // function: checkDates // parameter : Start Date value, End Date value // return true - if start date is not greater than end date. (Valid scenario) // return false - if start date is greater than end date. (Invalid scenario, should prompt invalid message) ////////////////////////////////////////////////////////////////////// function checkDates(startdt, enddt) { if (startdt.length > 0 && enddt.length > 0) { var startDD = startdt.substring(0,2); var startMM = startdt.substring(3,5); var startYYtime = startdt.substring(6,startdt.length); var strStartDate = startMM + "/" + startDD + "/" + startYYtime; //alert (strStartDate); var endDD = enddt.substring(0,2); var endMM = enddt.substring(3,5); var endYYtime = enddt.substring(6,startdt.length); var strEndDate = endMM + "/" + endDD + "/" + endYYtime; //alert (strEndDate); var startdate = new Date(strStartDate); var enddate = new Date(strEndDate); if (startdate > enddate) { return false; } } return true; } ////////////////////////////////////////////////////////////////////// // function: isValidChar // check if the input string entered consists of any invalid charaters // parameter : the input string // return true - if consists of any invalid charater // return false - if no invalid charater ////////////////////////////////////////////////////////////////////// function isValidChar(str) { var invalidChar = "!@#$%^&*()-~,'<.>/?;:\|" for(i=0; i -1) { return false; } } return true; } function isValidChar(str, specialChar) { if (str != ""){ for (var i=0; i -1 && _start < a_strText.length) { if (_c == 0){ a_strText = a_strTo + a_strText.substring(_c+_l); }else{ a_strText = a_strText.substring(0,_c) + a_strTo + a_strText.substring(_c+_l); } _start = _c + _l; _c = a_strText.indexOf(a_strFrom,_start); }//end while return a_strText; } function printWindow() { document.all['sButton'].style.display='none'; window.print(); document.all['sButton'].style.display='inline'; } var gAutoPrint = true; // Flag for whether or not to automatically call the print function function printContent() { if (document.getElementById != null) { var html = '\n\n'; if (document.getElementsByTagName != null) { var headTags = document.getElementsByTagName("head"); if (headTags.length > 0) html += headTags[0].innerHTML; } html += '\n\n\n'; var printReadyElem = document.getElementById("printReady"); if (printReadyElem != null) { html += printReadyElem.innerHTML; } else { alert("Could not find the printReady section in the HTML"); return; } html += '\n\n'; var printWin = window.open("","printContent"); printWin.document.open(); printWin.document.write(html); printWin.document.close(); if (gAutoPrint){ printWin.print(); } } else { alert("Sorry, the print ready feature is only available in modern browsers."); } } function checkEnter(form){ if(event.keyCode) { if(event.keyCode=="13") // 13 == Enter form.submit(); } else if(event.which) { if(event.which=="13") form.submit(); } else if (window.event.keyCode == 13){ form.submit(); } } function getCurrentDate() { // Get today's current date. var now = new Date(); var day = now.getDate(); var mnth = now.getMonth()+1; var year = (now.getYear() < 1000)? now.getYear() + 1900 : now.getYear(); if(day < 10) day = '0' + day; if(mnth < 10) mnth = '0' + mnth; var todayDate = day+'/'+mnth+'/'+year; return todayDate; } function disableButtons(fm){ var totalButton = 0; for (var i=0;i -1 ) { str = str.replace( from, to ); idx = str.indexOf( from ); } return str; } function disableButtons(fm){ var totalButton = 0; for (var i=0;i