var strTable;jQuery.fn.Upper=function(){return this.each(function(){($(this).is("textarea")||$(this).is("input:text"))&&$(this).keyup(function(){$(this).val($(this).val().toUpperCase())})})};
jQuery.fn.EmailOnly=function(){return this.each(function(){$(this).keydown(function(a){var b=a.charCode||a.keyCode||0;return 110==b||190==b&&!1===a.shiftKey||50==b&&!0===a.shiftKey||65<=b&&90>=b&&!1===a.ctrlKey||48<=b&&57>=b&&!1===a.shiftKey||109==b&&!0===a.shiftKey||46==b||8==b||9==b||18==b||27==b||13==b||35<=b&&40>=b||96<=b&&105>=b});$(this).bind("cut copy paste",function(a){a.preventDefault()})})};
jQuery.fn.Mobile_Comma_Only=function(){return this.each(function(){$(this).keydown(function(a){var b=a.charCode||a.keyCode||0;return 8==b||9==b||46==b||18==b||35<=b&&40>=b||48<=b&&57>=b&&!1===a.shiftKey||188<=b&&!1===a.shiftKey||96<=b&&105>=b})})};
jQuery.fn.UserName=function(){return this.each(function(){$(this).keydown(function(a){var b=a.charCode||a.keyCode||0;return 110==b||190==b&&!1===a.shiftKey||65<=b&&90>=b&&!1===a.ctrlKey||48<=b&&57>=b&&!1===a.shiftKey||109==b&&!0===a.shiftKey||46==b||8==b||9==b||18==b||27==b||13==b||35<=b&&40>=b||96<=b&&105>=b});$(this).bind("cut copy paste",function(a){a.preventDefault()})})};
jQuery.fn.Password=function(){return this.each(function(){$(this).keydown(function(a){var b=a.charCode||a.keyCode||0;return 32==b||222==b||!0===a.ctrlKey?!1:!0});$(this).bind("cut copy paste",function(a){a.preventDefault()})})};jQuery.fn.blockCopyPaste=function(){return this.each(function(){$(this).bind("cut copy paste",function(a){a.preventDefault()})})};
jQuery.fn.NumericOnly=function(){return this.each(function(){$(this).keydown(function(a){var b=a.charCode||a.keyCode||0;return 8==b||9==b||46==b||18==b||35<=b&&40>=b||48<=b&&57>=b&&!1===a.shiftKey||96<=b&&105>=b})})};
jQuery.fn.DecimalOnly=function(){return this.each(function(){$(this).keydown(function(a){a=a.charCode||a.keyCode||0;if(-1!=this.value.indexOf(".")){var b=this.value.split("."),b=b[1];return 2==b.length?8==a||9==a||46==a||18==a:8==a||9==a||46==a||18==a||35<=a&&40>=a||48<=a&&57>=a||96<=a&&105>=a}return 110==a||190==a||8==a||9==a||46==a||18==a||35<=a&&40>=a||48<=a&&57>=a||96<=a&&105>=a})})};
function checkEmailId(a){return/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i.test(a.val())?!0:!1}function checkFormValidation(a){alert(a.toSource())}function updateTips(a){tips.text(a).addClass("ui-state-highlight");setTimeout(function(){tips.removeClass("ui-state-highlight",1500)},500)}
function updateTipsErr(a,b){b.text(a).addClass("ui-state-highlight");setTimeout(function(){b.removeClass("ui-state-highlight",1500)},500)}function checkNull(a,b){return 0==a.val().length?(a.addClass("ui-state-error"),updateTips(b+" should not be blank."),!1):!0}function checkFromTo(a,b,c){return a.val()>=b.val()?(b.addClass("ui-state-error"),updateTips(c),!1):!0}function checkNullOnly(a){return 0==a.val().length?!1:!0}
function checkLength(a,b,c,d){return a.val().length>d||a.val().length<c?(a.addClass("ui-state-error"),updateTips("Length of "+b+" must be between "+c+" and "+d+"."),!1):!0}function checkMobileLength(a,b,c){return a.val().length>c||a.val().length<c?(a.addClass("ui-state-error"),updateTips("Length of "+b+" must be "+c),!1):!0}function checkMaxCredit(a,b,c){return 0<a.val()-b.val()?(a.addClass("ui-state-error"),updateTips(c),!1):!0}
function checkZero(a,b){return 0==a.val()?(a.addClass("ui-state-error"),updateTips(b),!1):!0}function checkNegative(a,b){return 0>=a.val()?(a.addClass("ui-state-error"),updateTips(b),!1):!0}function checkRegExp(a,b,c){if(b.test(a.val()))return!0;a.addClass("ui-state-error");updateTips(c);return!1}
function checkEmail(a){return checkRegExp(a,/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,"Wronge Email : eg info@devindia.net")}
function checkPassword(a){return checkRegExp(a,/^([0-9a-zA-Z])+$/,"Password field only allow : a-z 0-9")}function checkNumber(a,b){return checkRegExp(a,/^([0-9])+$/,b+" field only allow : 0-9")}function checkDecimalNumber(a,b){return checkRegExp(a,/^([0-9.])+$/,b+" field only allow Number")}function checkName(){return!0}function getChildCombo(a,b,c,d){$.post("php/"+d+"?cmd="+c+"&value="+a,function(a){$(b).html(a)})}
function getChildComboEdit(a,b,c,d,e){$.post("php_lib/"+d+"?cmd="+c+"&value="+a,function(a){$(b).html(a);$(b).val(e)})}
function edit(a){a="php/general.php?cmd=select&table="+a+"&key=id&value="+editID;$("#"+frmPrifix+"id").val(editID);$.post(a,function(a){$.each(a,function(a,b){try{"checkbox"==$("#"+frmPrifix+a).attr("type")&&($("#"+frmPrifix+a).click(function(){!0==$(this).attr("checked")?$(this).val(1):$(this).val(0)}),1==b?$("#"+frmPrifix+a).attr("checked","checked"):$("#"+frmPrifix+a).attr("checked","")),$("#"+frmId+" #"+frmPrifix+a).val(b)}catch(e){}});$(".date").each(function(){if(""!=$(this).val()){var a=parse_date($(this).val());
$(this).val(a.format("d.m.Y"))}})},"json")}
function addRecord(a,b,c,d,e,g,f){$.post(a,$("#"+frmId).serialize(),function(a){"true"==a.result?(jQuery("#"+d).trigger("reloadGrid"),$("#"+e).html(a.msg),$("#"+e).dialog("open"),jQuery("#"+b).css("display","inline"),jQuery("#"+c).css("display","none"),f.val("").removeClass("ui-state-error"),jQuery("#"+g).html("* Fields are mendatory")):(updateTips(a.error),f.removeClass("ui-state-error"),a.eid&&($("#"+frmPrifix+a.eid).focus(),$("#"+frmPrifix+a.eid).addClass("ui-state-error")))},"json")}
function editRecord(a,b,c,d,e,g,f){$.post(a,$("#"+frmId).serialize(),function(a){"true"==a.result?(editID="",jQuery("#"+d).trigger("reloadGrid"),jQuery("#"+b).css("display","inline"),jQuery("#"+c).css("display","none"),f.val("").removeClass("ui-state-error"),jQuery("#"+g).html("* Fields are mendatory"),$("#"+e).html(a.msg),$("#"+e).dialog("open")):(updateTips(a.error),f.removeClass("ui-state-error"),a.eid&&($("#"+frmPrifix+a.eid).focus(),$("#"+frmPrifix+a.eid).addClass("ui-state-error")))},"json")}
function generateLogin(a){$.post("php_lib/users.php?cmd=getUsername&ctrUsr="+a,function(a){jQuery("#"+frmPrifix+"Loginname").val(a)})}function gridLoadComplete(a){"false"==a.result&&alert(a.message)}function parse_date(a){var b=new Date,a=String(a).split(/[- :]/);b.setFullYear(a[0]);b.setMonth(a[1]-1);b.setDate(a[2]);b.setHours(a[3]);b.setMinutes(a[4]);b.setSeconds(a[5]);b.setMilliseconds(0);return b}
Date.prototype.format=function(a){for(var b="",c=Date.replaceChars,d=0;d<a.length;d++)var e=a.charAt(d),b=c[e]?b+c[e].call(this):b+e;return b};
Date.replaceChars={shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),longMonths:"January February March April May June July August September October November December".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),longDays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d:function(){return(10>this.getDate()?"0":"")+this.getDate()},D:function(){return Date.replaceChars.shortDays[this.getDay()]},j:function(){return this.getDate()},l:function(){return Date.replaceChars.longDays[this.getDay()]},
N:function(){return this.getDay()+1},S:function(){return 1==this.getDate()%10&&11!=this.getDate()?"st":2==this.getDate()%10&&12!=this.getDate()?"nd":3==this.getDate()%10&&13!=this.getDate()?"rd":"th"},w:function(){return this.getDay()},z:function(){return"Not Yet Supported"},W:function(){return"Not Yet Supported"},F:function(){return Date.replaceChars.longMonths[this.getMonth()]},m:function(){return(9>this.getMonth()?"0":"")+(this.getMonth()+1)},M:function(){return Date.replaceChars.shortMonths[this.getMonth()]},
n:function(){return this.getMonth()+1},t:function(){return"Not Yet Supported"},L:function(){return 0==this.getFullYear()%4&&0!=this.getFullYear()%100||0==this.getFullYear()%400?"1":"0"},o:function(){return"Not Supported"},Y:function(){return this.getFullYear()},y:function(){return(""+this.getFullYear()).substr(2)},a:function(){return 12>this.getHours()?"am":"pm"},A:function(){return 12>this.getHours()?"AM":"PM"},B:function(){return"Not Yet Supported"},g:function(){return this.getHours()%12||12},G:function(){return this.getHours()},
h:function(){return(10>(this.getHours()%12||12)?"0":"")+(this.getHours()%12||12)},H:function(){return(10>this.getHours()?"0":"")+this.getHours()},i:function(){return(10>this.getMinutes()?"0":"")+this.getMinutes()},s:function(){return(10>this.getSeconds()?"0":"")+this.getSeconds()},e:function(){return"Not Yet Supported"},I:function(){return"Not Supported"},O:function(){return(0>-this.getTimezoneOffset()?"-":"+")+(10>Math.abs(this.getTimezoneOffset()/60)?"0":"")+Math.abs(this.getTimezoneOffset()/60)+
"00"},P:function(){return(0>-this.getTimezoneOffset()?"-":"+")+(10>Math.abs(this.getTimezoneOffset()/60)?"0":"")+Math.abs(this.getTimezoneOffset()/60)+":"+(10>Math.abs(this.getTimezoneOffset()%60)?"0":"")+Math.abs(this.getTimezoneOffset()%60)},T:function(){var a=this.getMonth();this.setMonth(0);var b=this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/,"$1");this.setMonth(a);return b},Z:function(){return 60*-this.getTimezoneOffset()},c:function(){return this.format("Y-m-d")+"T"+this.format("H:i:sP")},
r:function(){return this.toString()},U:function(){return this.getTime()/1E3}};