var $ = $.noConflict(); if (navigator.cookieEnabled == 0) { alert("You need to enable cookies for this site to load properly!"); } function pad(str, max) { str = str.toString(); return str.length < max ? pad("0" + str, max) : str; } function SetTxt(e, val) { if (e.value == '') e.value = val; return val; } function ResetTxt(e, val) { if (e.value == val) e.value = ''; return ''; } function isDecimal(evt, element) { // onkeypress var charCode = (evt.which) ? evt.which : event.keyCode; if ((charCode != 46 || $(element).val().indexOf('.') != -1) && // “.” CHECK DOT, AND ONLY ONE. (charCode < 48 || charCode > 57)) return false; return true; } function isNumber(evt, element) { // onkeypress var charCode = (evt.which) ? evt.which : event.keyCode; if (//(charCode != 45 || $(element).val().indexOf('-') != -1) && // “-” CHECK MINUS, AND ONLY ONE. (charCode < 48 || charCode > 57)) return false; return true; } function isInteger(evt, element) { // onkeypress var charCode = (evt.which) ? evt.which : event.keyCode; if ((charCode != 45 || $(element).val().indexOf('-') != -1) && // “-” CHECK MINUS, AND ONLY ONE. (charCode < 48 || charCode > 57)) return false; return true; } function printDiv(dvPrint) { var divToPrint = document.getElementById('dvPrint'); var newWin = window.open('', 'Print-Window', 'width=800,height=700'); newWin.document.open(); newWin.document.write('' + divToPrint.innerHTML + ''); newWin.document.close(); setTimeout(function () { newWin.close(); }, 1000); } function setCookie(c_name, value, expiredays) { var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays); document.cookie = c_name + "=" + value + ";path=/" + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } function deletecookie(name) { var d = new Date(); d.setDate(d.getDate() - 1) document.cookie = name + '=;expires=" + d.toGMTString() + ";" + ";'; } // Check Email id Valid var IsEmail = function (email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); }; var ValidateCCNum = function (e) { var numbers = /^[0-9]+$/; if (!e.value.match(numbers)) { e.value = e.value.substring(0, e.value.length - 1); return false; } return true; }; var ValidateEmail = function (e) { var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if (e.value == '') return true; else if (e.value.match(mailformat)) { return true; } else { alert("Invalid Email address!"); return false; } }; // Validate Mobile var ValidateMobNum = function (e) { var numbers = /^[0-9]+$/; if (e.value.length <= 10) { if (!e.value.match(numbers)) { e.value = e.value.substring(0, e.value.length - 1); return false; } } else { e.value = e.value.substring(0, e.value.length - 1); return false; } return true; }; //function to get querystring value by name function GetParameterValues(param) { var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < url.length; i++) { var urlparam = url[i].split('='); if (urlparam[0] == param) { return urlparam[1]; } } }