(function(j){var o={},p,k,l,e=j.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),b=false;j.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){j.tooltip.blocked=!j.tooltip.blocked}};j.fn.extend({tooltip:function(s){s=j.extend({},j.tooltip.defaults,s);a(s);return this.each(function(){j.data(this,"tooltip",s);this.tOpacity=o.parent.css("opacity");this.tooltipText=this.title;j(this).removeAttr("title");this.alt=""}).mouseover(n).mouseout(f).click(f)},fixPNG:e?function(){return this.each(function(){var s=j(this).css("backgroundImage");if(s.match(/^url\(["']?(.*\.png)["']?\)$/i)){s=RegExp.$1;j(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+s+"')"}).each(function(){var t=j(this).css("position");if(t!="absolute"&&t!="relative"){j(this).css("position","relative")}})}})}:function(){return this},unfixPNG:e?function(){return this.each(function(){j(this).css({filter:"",backgroundImage:""})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){j(this)[j(this).html()?"show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}});function a(s){if(o.parent){return}o.parent=j('<div id="'+s.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if(j.fn.bgiframe){o.parent.bgiframe()}o.title=j("h3",o.parent);o.body=j("div.body",o.parent);o.url=j("div.url",o.parent)}function h(s){return j.data(s,"tooltip")}function m(s){if(h(this).delay){l=setTimeout(q,h(this).delay)}else{q()}b=!!h(this).track;j(document.body).bind("mousemove",c);c(s)}function n(){if(j.tooltip.blocked||this==p||(!this.tooltipText&&!h(this).bodyHandler)){return}p=this;k=this.tooltipText;if(h(this).bodyHandler){o.title.hide();var v=h(this).bodyHandler.call(this);if(v.nodeType||v.jquery){o.body.empty().append(v)}else{o.body.html(v)}o.body.show()}else{if(h(this).showBody){var u=k.split(h(this).showBody);o.title.html(u.shift()).show();o.body.empty();for(var t=0,s;(s=u[t]);t++){if(t>0){o.body.append("<br/>")}o.body.append(s)}o.body.hideWhenEmpty()}else{o.title.html(k).show();o.body.hide()}}if(h(this).showURL&&j(this).url()){o.url.html(j(this).url().replace("http://","")).show()}else{o.url.hide()}o.parent.addClass(h(this).extraClass);if(h(this).fixPNG){o.parent.fixPNG()}m.apply(this,arguments)}function q(){l=null;if((!e||!j.fn.bgiframe)&&h(p).fade){if(o.parent.is(":animated")){o.parent.stop().show().fadeTo(h(p).fade,p.tOpacity)}else{o.parent.is(":visible")?o.parent.fadeTo(h(p).fade,p.tOpacity):o.parent.fadeIn(h(p).fade)}}else{o.parent.show()}c()}function c(w){if(j.tooltip.blocked){return}if(w&&w.target.tagName=="OPTION"){return}if(!b&&o.parent.is(":visible")){j(document.body).unbind("mousemove",c)}if(p==null){j(document.body).unbind("mousemove",c);return}o.parent.removeClass("viewport-right").removeClass("viewport-bottom");var u=o.parent[0].offsetLeft;var x=o.parent[0].offsetTop;if(w){u=w.pageX+h(p).left;x=w.pageY+h(p).top;var t="auto";if(h(p).positionLeft){t=j(window).width()-u;u="auto"}o.parent.css({left:u,right:t,top:x})}var y=d(),s=o.parent[0];if(y.x+y.cx<s.offsetLeft+s.offsetWidth){u-=s.offsetWidth+20+h(p).left;o.parent.css({left:u+"px"}).addClass("viewport-right")}if(y.y+y.cy<s.offsetTop+s.offsetHeight){x-=s.offsetHeight+20+h(p).top;o.parent.css({top:x+"px"}).addClass("viewport-bottom")}}function d(){return{x:j(window).scrollLeft(),y:j(window).scrollTop(),cx:j(window).width(),cy:j(window).height()}}function f(u){if(j.tooltip.blocked){return}if(l){clearTimeout(l)}p=null;var t=h(this);function s(){o.parent.removeClass(t.extraClass).hide().css("opacity","")}if((!e||!j.fn.bgiframe)&&t.fade){if(o.parent.is(":animated")){o.parent.stop().fadeTo(t.fade,0,s)}else{o.parent.stop().fadeOut(t.fade,s)}}else{s()}if(h(this).fixPNG){o.parent.unfixPNG()}}})(jQuery);jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(j,f,e,h,a){return jQuery.easing[jQuery.easing.def](j,f,e,h,a)},easeInQuad:function(j,f,e,h,a){return h*(f/=a)*f+e},easeOutQuad:function(j,f,e,h,a){return -h*(f/=a)*(f-2)+e},easeInOutQuad:function(j,f,e,h,a){if((f/=a/2)<1){return h/2*f*f+e}return -h/2*((--f)*(f-2)-1)+e},easeInCubic:function(j,f,e,h,a){return h*(f/=a)*f*f+e},easeOutCubic:function(j,f,e,h,a){return h*((f=f/a-1)*f*f+1)+e},easeInOutCubic:function(j,f,e,h,a){if((f/=a/2)<1){return h/2*f*f*f+e}return h/2*((f-=2)*f*f+2)+e},easeInQuart:function(j,f,e,h,a){return h*(f/=a)*f*f*f+e},easeOutQuart:function(j,f,e,h,a){return -h*((f=f/a-1)*f*f*f-1)+e},easeInOutQuart:function(j,f,e,h,a){if((f/=a/2)<1){return h/2*f*f*f*f+e}return -h/2*((f-=2)*f*f*f-2)+e},easeInQuint:function(j,f,e,h,a){return h*(f/=a)*f*f*f*f+e},easeOutQuint:function(j,f,e,h,a){return h*((f=f/a-1)*f*f*f*f+1)+e},easeInOutQuint:function(j,f,e,h,a){if((f/=a/2)<1){return h/2*f*f*f*f*f+e}return h/2*((f-=2)*f*f*f*f+2)+e},easeInSine:function(j,f,e,h,a){return -h*Math.cos(f/a*(Math.PI/2))+h+e},easeOutSine:function(j,f,e,h,a){return h*Math.sin(f/a*(Math.PI/2))+e},easeInOutSine:function(j,f,e,h,a){return -h/2*(Math.cos(Math.PI*f/a)-1)+e},easeInExpo:function(j,f,e,h,a){return(f==0)?e:h*Math.pow(2,10*(f/a-1))+e},easeOutExpo:function(j,f,e,h,a){return(f==a)?e+h:h*(-Math.pow(2,-10*f/a)+1)+e},easeInOutExpo:function(j,f,e,h,a){if(f==0){return e}if(f==a){return e+h}if((f/=a/2)<1){return h/2*Math.pow(2,10*(f-1))+e}return h/2*(-Math.pow(2,-10*--f)+2)+e},easeInCirc:function(j,f,e,h,a){return -h*(Math.sqrt(1-(f/=a)*f)-1)+e},easeOutCirc:function(j,f,e,h,a){return h*Math.sqrt(1-(f=f/a-1)*f)+e},easeInOutCirc:function(j,f,e,h,a){if((f/=a/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+e}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+e},easeInElastic:function(e,l,h,j,k){var m=1.70158;var f=0;var n=j;if(l==0){return h}if((l/=k)==1){return h+j}if(!f){f=k*0.3}if(n<Math.abs(j)){n=j;var m=f/4}else{var m=f/(2*Math.PI)*Math.asin(j/n)}return -(n*Math.pow(2,10*(l-=1))*Math.sin((l*k-m)*(2*Math.PI)/f))+h},easeOutElastic:function(e,l,h,j,k){var m=1.70158;var f=0;var n=j;if(l==0){return h}if((l/=k)==1){return h+j}if(!f){f=k*0.3}if(n<Math.abs(j)){n=j;var m=f/4}else{var m=f/(2*Math.PI)*Math.asin(j/n)}return n*Math.pow(2,-10*l)*Math.sin((l*k-m)*(2*Math.PI)/f)+j+h},easeInOutElastic:function(e,l,h,j,k){var m=1.70158;var f=0;var n=j;if(l==0){return h}if((l/=k/2)==2){return h+j}if(!f){f=k*(0.3*1.5)}if(n<Math.abs(j)){n=j;var m=f/4}else{var m=f/(2*Math.PI)*Math.asin(j/n)}if(l<1){return -0.5*(n*Math.pow(2,10*(l-=1))*Math.sin((l*k-m)*(2*Math.PI)/f))+h}return n*Math.pow(2,-10*(l-=1))*Math.sin((l*k-m)*(2*Math.PI)/f)*0.5+j+h},easeInBack:function(a,j,e,f,h,k){if(k==undefined){k=1.70158}return f*(j/=h)*j*((k+1)*j-k)+e},easeOutBack:function(a,j,e,f,h,k){if(k==undefined){k=1.70158}return f*((j=j/h-1)*j*((k+1)*j+k)+1)+e},easeInOutBack:function(a,j,e,f,h,k){if(k==undefined){k=1.70158}if((j/=h/2)<1){return f/2*(j*j*(((k*=(1.525))+1)*j-k))+e}return f/2*((j-=2)*j*(((k*=(1.525))+1)*j+k)+2)+e},easeInBounce:function(j,f,e,h,a){return h-jQuery.easing.easeOutBounce(j,a-f,0,h,a)+e},easeOutBounce:function(j,f,e,h,a){if((f/=a)<(1/2.75)){return h*(7.5625*f*f)+e}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+e}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+e}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+e}}}},easeInOutBounce:function(j,f,e,h,a){if(f<a/2){return jQuery.easing.easeInBounce(j,f*2,0,h,a)*0.5+e}return jQuery.easing.easeOutBounce(j,f*2-a,0,h,a)*0.5+h*0.5+e}});
/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/
(function(c){function b(j){var k=j||window.event,f=[].slice.call(arguments,1),l=0,d=0,m=0;j=c.event.fix(k);j.type="mousewheel";if(j.wheelDelta){l=j.wheelDelta/120}if(j.detail){l=-j.detail/3}m=l;if(k.axis!==undefined&&k.axis===k.HORIZONTAL_AXIS){m=0;d=-1*l}if(k.wheelDeltaY!==undefined){m=k.wheelDeltaY/120}if(k.wheelDeltaX!==undefined){d=-1*k.wheelDeltaX/120}f.unshift(j,l,d,m);return c.event.handle.apply(this,f)}var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}})})(jQuery);(function(w){var A,u,O,f,p,B,o,h,n,H,T=0,N={},C=[],U=0,S={},d=[],a=null,I=new Image(),G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,x=/[^\.]\.(swf)\s*$/i,y,X=1,q=0,F="",z,v,R=false,s=w.extend(w("<div/>")[0],{prop:0}),K=w.browser.msie&&w.browser.version<7&&!window.XMLHttpRequest,c=function(){u.hide();I.onerror=I.onload=null;if(a){a.abort()}A.empty()},D=function(){if(false===N.onError(C,T,N)){u.hide();R=false;return}N.titleShow=false;N.width="auto";N.height="auto";A.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');P()},l=function(){var ae=C[T],Y,ad,aa,ac,Z,ab;c();N=w.extend({},w.fn.fancybox.defaults,(typeof w(ae).data("fancybox")=="undefined"?N:w(ae).data("fancybox")));ab=N.onStart(C,T,N);if(ab===false){R=false;return}else{if(typeof ab=="object"){N=w.extend(N,ab)}}aa=N.title||(ae.nodeName?w(ae).attr("title"):ae.title)||"";if(ae.nodeName&&!N.orig){N.orig=w(ae).children("img:first").length?w(ae).children("img:first"):w(ae)}if(aa===""&&N.orig&&N.titleFromAlt){aa=N.orig.attr("alt")}Y=N.href||(ae.nodeName?w(ae).attr("href"):ae.href)||null;if((/^(?:javascript)/i).test(Y)||Y=="#"){Y=null}if(N.type){ad=N.type;if(!Y){Y=N.content}}else{if(N.content){ad="html"}else{if(Y){if(Y.match(G)){ad="image"}else{if(Y.match(x)){ad="swf"}else{if(w(ae).hasClass("iframe")){ad="iframe"}else{if(Y.indexOf("#")===0){ad="inline"}else{ad="ajax"}}}}}}}if(!ad){D();return}if(ad=="inline"){ae=Y.substr(Y.indexOf("#"));ad=w(ae).length>0?"inline":"ajax"}N.type=ad;N.href=Y;N.title=aa;if(N.autoDimensions){if(N.type=="html"||N.type=="inline"||N.type=="ajax"){N.width="auto";N.height="auto"}else{N.autoDimensions=false}}if(N.modal){N.overlayShow=true;N.hideOnOverlayClick=false;N.hideOnContentClick=false;N.enableEscapeButton=false;N.showCloseButton=false}N.padding=parseInt(N.padding,10);N.margin=parseInt(N.margin,10);A.css("padding",(N.padding+N.margin));w(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){w(this).replaceWith(B.children())});switch(ad){case"html":A.html(N.content);P();break;case"inline":if(w(ae).parent().is("#fancybox-content")===true){R=false;return}w('<div class="fancybox-inline-tmp" />').hide().insertBefore(w(ae)).bind("fancybox-cleanup",function(){w(this).replaceWith(B.children())}).bind("fancybox-cancel",function(){w(this).replaceWith(A.children())});w(ae).appendTo(A);P();break;case"image":R=false;w.fancybox.showActivity();I=new Image();I.onerror=function(){D()};I.onload=function(){R=true;I.onerror=I.onload=null;W()};I.src=Y;break;case"swf":N.scrolling="no";ac='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+N.width+'" height="'+N.height+'"><param name="movie" value="'+Y+'"></param>';Z="";w.each(N.swf,function(ag,af){ac+='<param name="'+ag+'" value="'+af+'"></param>';Z+=" "+ag+'="'+af+'"'});ac+='<embed src="'+Y+'" type="application/x-shockwave-flash" width="'+N.width+'" height="'+N.height+'"'+Z+"></embed></object>";A.html(ac);P();break;case"ajax":R=false;w.fancybox.showActivity();N.ajax.win=N.ajax.success;a=w.ajax(w.extend({},N.ajax,{url:Y,data:N.ajax.data||{},error:function(ag,ah,af){if(ag.status>0){D()}},success:function(ag,ai,ah){var af=typeof ah=="object"?ah:a;if(af.status==200){if(typeof N.ajax.win=="function"){ab=N.ajax.win(Y,ag,ai,ah);if(ab===false){u.hide();return}else{if(typeof ab=="string"||typeof ab=="object"){ag=ab}}}A.html(ag);P()}}}));break;case"iframe":Q();break}},P=function(){var Z=N.width,Y=N.height;if(Z.toString().indexOf("%")>-1){Z=parseInt((w(window).width()-(N.margin*2))*parseFloat(Z)/100,10)+"px"}else{Z=Z=="auto"?"auto":Z+"px"}if(Y.toString().indexOf("%")>-1){Y=parseInt((w(window).height()-(N.margin*2))*parseFloat(Y)/100,10)+"px"}else{Y=Y=="auto"?"auto":Y+"px"}A.wrapInner('<div style="width:'+Z+";height:"+Y+";overflow: "+(N.scrolling=="auto"?"auto":(N.scrolling=="yes"?"scroll":"hidden"))+';position:relative;"></div>');N.width=A.width();N.height=A.height();Q()},W=function(){N.width=I.width;N.height=I.height;w("<img />").attr({id:"fancybox-img",src:I.src,alt:N.title}).appendTo(A);Q()},Q=function(){var Y,Z;u.hide();if(f.is(":visible")&&false===S.onCleanup(d,U,S)){w.event.trigger("fancybox-cancel");R=false;return}R=true;w(B.add(O)).unbind();w(window).unbind("resize.fb scroll.fb");w(document).unbind("keydown.fb");if(f.is(":visible")&&S.titlePosition!=="outside"){f.css("height",f.height())}d=C;U=T;S=N;if(S.overlayShow){O.css({"background-color":S.overlayColor,opacity:S.overlayOpacity,cursor:S.hideOnOverlayClick?"pointer":"auto",height:w(document).height()});if(!O.is(":visible")){if(K){w("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"})}O.show()}}else{O.hide()}v=b();t();if(f.is(":visible")){w(o.add(n).add(H)).hide();Y=f.position(),z={top:Y.top,left:Y.left,width:f.width(),height:f.height()};Z=(z.width==v.width&&z.height==v.height);B.fadeTo(S.changeFade,0.3,function(){var aa=function(){B.html(A.contents()).fadeTo(S.changeFade,1,V)};w.event.trigger("fancybox-change");B.empty().removeAttr("filter").css({"border-width":S.padding,width:v.width-S.padding*2,height:N.autoDimensions?"auto":v.height-q-S.padding*2});if(Z){aa()}else{s.prop=0;w(s).animate({prop:1},{duration:S.changeSpeed,easing:S.easingChange,step:M,complete:aa})}});return}f.removeAttr("style");B.css("border-width",S.padding);if(S.transitionIn=="elastic"){z=L();B.html(A.contents());f.show();if(S.opacity){v.opacity=0}s.prop=0;w(s).animate({prop:1},{duration:S.speedIn,easing:S.easingIn,step:M,complete:V});return}if(S.titlePosition=="inside"&&q>0){h.show()}B.css({width:v.width-S.padding*2,height:N.autoDimensions?"auto":v.height-q-S.padding*2}).html(A.contents());f.css(v).fadeIn(S.transitionIn=="none"?0:S.speedIn,V)},k=function(Y){if(Y&&Y.length){if(S.titlePosition=="float"){return'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+Y+'</td><td id="fancybox-title-float-right"></td></tr></table>'}return'<div id="fancybox-title-'+S.titlePosition+'">'+Y+"</div>"}return false},t=function(){F=S.title||"";q=0;h.empty().removeAttr("style").removeClass();if(S.titleShow===false){h.hide();return}F=w.isFunction(S.titleFormat)?S.titleFormat(F,d,U,S):k(F);if(!F||F===""){h.hide();return}h.addClass("fancybox-title-"+S.titlePosition).html(F).appendTo("body").show();switch(S.titlePosition){case"inside":h.css({width:v.width-(S.padding*2),marginLeft:S.padding,marginRight:S.padding});q=h.outerHeight(true);h.appendTo(p);v.height+=q;break;case"over":h.css({marginLeft:S.padding,width:v.width-(S.padding*2),bottom:S.padding}).appendTo(p);break;case"float":h.css("left",parseInt((h.width()-v.width-40)/2,10)*-1).appendTo(f);break;default:h.css({width:v.width-(S.padding*2),paddingLeft:S.padding,paddingRight:S.padding}).appendTo(f);break}h.hide()},e=function(){if(S.enableEscapeButton||S.enableKeyboardNav){w(document).bind("keydown.fb",function(Y){if(Y.keyCode==27&&S.enableEscapeButton){Y.preventDefault();w.fancybox.close()}else{if((Y.keyCode==37||Y.keyCode==39)&&S.enableKeyboardNav&&Y.target.tagName!=="INPUT"&&Y.target.tagName!=="TEXTAREA"&&Y.target.tagName!=="SELECT"){Y.preventDefault();w.fancybox[Y.keyCode==37?"prev":"next"]()}}})}if(!S.showNavArrows){n.hide();H.hide();return}if((S.cyclic&&d.length>1)||U!==0){n.show()}if((S.cyclic&&d.length>1)||U!=(d.length-1)){H.show()}},V=function(){if(!w.support.opacity){B.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}if(N.autoDimensions){B.css("height","auto")}f.css("height","auto");if(F&&F.length){h.show()}if(S.showCloseButton){o.show()}e();if(S.hideOnContentClick){B.bind("click",w.fancybox.close)}if(S.hideOnOverlayClick){O.bind("click",w.fancybox.close)}w(window).bind("resize.fb",w.fancybox.resize);if(S.centerOnScroll){w(window).bind("scroll.fb",w.fancybox.center)}if(S.type=="iframe"){w('<iframe id="fancybox-frame" name="fancybox-frame'+new Date().getTime()+'" frameborder="0" hspace="0" '+(w.browser.msie?'allowtransparency="true""':"")+' scrolling="'+N.scrolling+'" src="'+S.href+'"></iframe>').appendTo(B)}f.show();R=false;w.fancybox.center();S.onComplete(d,U,S);E()},E=function(){var Z,Y;if((d.length-1)>U){Z=d[U+1].href;if(typeof Z!=="undefined"&&Z.match(G)){Y=new Image();Y.src=Z}}if(U>0){Z=d[U-1].href;if(typeof Z!=="undefined"&&Z.match(G)){Y=new Image();Y.src=Z}}},M=function(Y){var Z={width:parseInt(z.width+(v.width-z.width)*Y,10),height:parseInt(z.height+(v.height-z.height)*Y,10),top:parseInt(z.top+(v.top-z.top)*Y,10),left:parseInt(z.left+(v.left-z.left)*Y,10)};if(typeof v.opacity!=="undefined"){Z.opacity=Y<0.5?0.5:Y}f.css(Z);B.css({width:Z.width-S.padding*2,height:Z.height-(q*Y)-S.padding*2})},m=function(){return[w(window).width()-(S.margin*2),w(window).height()-(S.margin*2),w(document).scrollLeft()+S.margin,w(document).scrollTop()+S.margin]},b=function(){var aa=m(),Y={},ac=S.autoScale,Z=S.padding*2,ab;if(S.width.toString().indexOf("%")>-1){Y.width=parseInt((aa[0]*parseFloat(S.width))/100,10)}else{Y.width=S.width+Z}if(S.height.toString().indexOf("%")>-1){Y.height=parseInt((aa[1]*parseFloat(S.height))/100,10)}else{Y.height=S.height+Z}if(ac&&(Y.width>aa[0]||Y.height>aa[1])){if(N.type=="image"||N.type=="swf"){ab=(S.width)/(S.height);if((Y.width)>aa[0]){Y.width=aa[0];Y.height=parseInt(((Y.width-Z)/ab)+Z,10)}if((Y.height)>aa[1]){Y.height=aa[1];Y.width=parseInt(((Y.height-Z)*ab)+Z,10)}}else{Y.width=Math.min(Y.width,aa[0]);Y.height=Math.min(Y.height,aa[1])}}Y.top=parseInt(Math.max(aa[3]-20,aa[3]+((aa[1]-Y.height-40)*0.5)),10);Y.left=parseInt(Math.max(aa[2]-20,aa[2]+((aa[0]-Y.width-40)*0.5)),10);return Y},j=function(Z){var Y=Z.offset();Y.top+=parseInt(Z.css("paddingTop"),10)||0;Y.left+=parseInt(Z.css("paddingLeft"),10)||0;Y.top+=parseInt(Z.css("border-top-width"),10)||0;Y.left+=parseInt(Z.css("border-left-width"),10)||0;Y.width=Z.width();Y.height=Z.height();return Y},L=function(){var Y=N.orig?w(N.orig):false,ab={},Z,aa;if(Y&&Y.length){Z=j(Y);ab={width:Z.width+(S.padding*2),height:Z.height+(S.padding*2),top:Z.top-S.padding-20,left:Z.left-S.padding-20}}else{aa=m();ab={width:S.padding*2,height:S.padding*2,top:parseInt(aa[3]+aa[1]*0.5,10),left:parseInt(aa[2]+aa[0]*0.5,10)}}return ab},J=function(){if(!u.is(":visible")){clearInterval(y);return}w("div",u).css("top",(X*-40)+"px");X=(X+1)%12};w.fn.fancybox=function(Y){if(!w(this).length){return this}w(this).data("fancybox",w.extend({},Y,(w.metadata?w(this).metadata():{}))).unbind("click.fb").bind("click.fb",function(aa){aa.preventDefault();if(R){return}R=true;w(this).blur();C=[];T=0;var Z=w(this).attr("rel")||"";if(!Z||Z==""||Z==="nofollow"){C.push(this)}else{C=w("a[rel="+Z+"], area[rel="+Z+"]");T=C.index(this)}l();return});return this};w.fancybox=function(aa){var Y;if(R){return}R=true;Y=typeof arguments[1]!=="undefined"?arguments[1]:{};C=[];T=parseInt(Y.index,10)||0;if(w.isArray(aa)){for(var ab=0,Z=aa.length;ab<Z;ab++){if(typeof aa[ab]=="object"){w(aa[ab]).data("fancybox",w.extend({},Y,aa[ab]))}else{aa[ab]=w({}).data("fancybox",w.extend({content:aa[ab]},Y))}}C=jQuery.merge(C,aa)}else{if(typeof aa=="object"){w(aa).data("fancybox",w.extend({},Y,aa))}else{aa=w({}).data("fancybox",w.extend({content:aa},Y))}C.push(aa)}if(T>C.length||T<0){T=0}l()};w.fancybox.showActivity=function(){clearInterval(y);u.show();y=setInterval(J,66)};w.fancybox.hideActivity=function(){u.hide()};w.fancybox.next=function(){return w.fancybox.pos(U+1)};w.fancybox.prev=function(){return w.fancybox.pos(U-1)};w.fancybox.pos=function(Y){if(R){return}Y=parseInt(Y);C=d;if(Y>-1&&Y<d.length){T=Y;l()}else{if(S.cyclic&&d.length>1){T=Y>=d.length?0:d.length-1;l()}}return};w.fancybox.cancel=function(){if(R){return}R=true;w.event.trigger("fancybox-cancel");c();N.onCancel(C,T,N);R=false};w.fancybox.close=function(){if(R||f.is(":hidden")){return}R=true;if(S&&false===S.onCleanup(d,U,S)){R=false;return}c();w(o.add(n).add(H)).hide();w(B.add(O)).unbind();w(window).unbind("resize.fb scroll.fb");w(document).unbind("keydown.fb");B.find("iframe").attr("src",K&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");if(S.titlePosition!=="inside"){h.empty()}f.stop();function Z(){O.fadeOut("fast");h.empty().hide();f.hide();w.event.trigger("fancybox-cleanup");B.empty();S.onClosed(d,U,S);d=N=[];U=T=0;S=N={};R=false}if(S.transitionOut=="elastic"){z=L();var Y=f.position();v={top:Y.top,left:Y.left,width:f.width(),height:f.height()};if(S.opacity){v.opacity=1}h.empty().hide();s.prop=1;w(s).animate({prop:0},{duration:S.speedOut,easing:S.easingOut,step:M,complete:Z})}else{f.fadeOut(S.transitionOut=="none"?0:S.speedOut,Z)}};w.fancybox.resize=function(){if(O.is(":visible")){O.css("height",w(document).height())}w.fancybox.center(true)};w.fancybox.center=function(){var Z,Y;if(R){return}Y=arguments[0]===true?1:0;Z=m();if(!Y&&(f.width()>Z[0]||f.height()>Z[1])){return}f.stop().animate({top:parseInt(Math.max(Z[3]-20,Z[3]+((Z[1]-B.height()-40)*0.5)-S.padding)),left:parseInt(Math.max(Z[2]-20,Z[2]+((Z[0]-B.width()-40)*0.5)-S.padding))},typeof arguments[0]=="number"?arguments[0]:200)};w.fancybox.init=function(){if(w("#fancybox-wrap").length){return}w("body").append(A=w('<div id="fancybox-tmp"></div>'),u=w('<div id="fancybox-loading"><div></div></div>'),O=w('<div id="fancybox-overlay"></div>'),f=w('<div id="fancybox-wrap"></div>'));p=w('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);p.append(B=w('<div id="fancybox-content"></div>'),o=w('<a id="fancybox-close"></a>'),h=w('<div id="fancybox-title"></div>'),n=w('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),H=w('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));o.click(w.fancybox.close);u.click(w.fancybox.cancel);n.click(function(Y){Y.preventDefault();w.fancybox.prev()});H.click(function(Y){Y.preventDefault();w.fancybox.next()});if(w.fn.mousewheel){f.bind("mousewheel.fb",function(Z,Y){if(R){Z.preventDefault()}else{if(w(Z.target).get(0).clientHeight==0||w(Z.target).get(0).scrollHeight===w(Z.target).get(0).clientHeight){Z.preventDefault();w.fancybox[Y>0?"prev":"next"]()}}})}if(!w.support.opacity){f.addClass("fancybox-ie")}if(K){u.addClass("fancybox-ie6");f.addClass("fancybox-ie6");w('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(p)}};w.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};w(document).ready(function(){w.fancybox.init()})})(jQuery);(function(K){var F="function",D="password",M="maxLength",O="type",L=true,J="",N=false,z="watermark",A,G=z,C="watermarkClass",w="watermarkFocus",E="watermarkSubmit",I="watermarkMaxLength",B="watermarkPassword",P="watermarkText",y=":data("+G+")",H=":text,:password,:search,textarea",v=["Page_ClientValidate"],x=N;K.extend(K.expr[":"],{search:function(a){return"search"===(a.type||J)},data:function(a,b,e){var j,c=/^((?:[^=!^$*]|[!^$*](?!=))+)(?:([!^$*]?=)(.*))?$/.exec(e[3]);if(c){j=K(a).data(c[1]);if(j!==A){if(c[2]){j=J+j;switch(c[2]){case"=":return j==c[3];case"!=":return j!=c[3];case"^=":return j.slice(0,c[3].length)==c[3];case"$=":return j.slice(-c[3].length)==c[3];case"*=":return j.indexOf(c[3])!==-1}}return L}}return N}});K.watermark={version:"3.0.6",options:{className:z,useNative:L},hide:function(b){K(b).filter(y).each(function(){K.watermark._hide(K(this))})},_hide:function(p,o){var h=p.val()||J,d=p.data(P)||J,f=p.data(I)||0,a=p.data(C);if(d.length&&h==d){p.val(J);if(p.data(B)){if((p.attr(O)||J)==="text"){var s=p.data(B)||[],q=p.parent()||[];if(s.length&&q.length){q[0].removeChild(p[0]);q[0].appendChild(s[0]);p=s}}}if(f){p.attr(M,f);p.removeData(I)}if(o){p.attr("autocomplete","off");window.setTimeout(function(){p.select()},1)}}a&&p.removeClass(a)},show:function(b){K(b).filter(y).each(function(){K.watermark._show(K(this))})},_show:function(j){var o=j.val()||J,a=j.data(P)||J,f=j.attr(O)||J,h=j.data(C);if((o.length==0||o==a)&&!j.data(w)){x=L;if(j.data(B)){if(f===D){var d=j.data(B)||[],c=j.parent()||[];if(d.length&&c.length){c[0].removeChild(j[0]);c[0].appendChild(d[0]);j=d;j.attr(M,a.length)}}}if(f==="text"||f==="search"){var b=j.attr(M)||0;if(b>0&&a.length>b){j.data(I,b);j.attr(M,a.length)}}h&&j.addClass(h);j.val(a)}else{K.watermark._hide(j)}},hideAll:function(){if(x){K.watermark.hide(H);x=N}},showAll:function(){K.watermark.show(H)}};K.fn.watermark=function(b,a){var e="string";if(!this.length){return this}var c=N,d=typeof b===e;if(typeof a==="object"){c=typeof a.className===e;a=K.extend({},K.watermark.options,a)}else{if(typeof a===e){c=L;a=K.extend({},K.watermark.options,{className:a})}else{a=K.watermark.options}}if(typeof a.useNative!==F){a.useNative=a.useNative?function(){return L}:function(){return N}}return this.each(function(){var o="dragleave",n="dragenter",f=this,m=K(f);if(!m.is(H)){return}if(m.data(G)){if(d||c){K.watermark._hide(m);d&&m.data(P,b);c&&m.data(C,a.className)}}else{if(a.useNative.call(f,m)){if((J+m.css("-webkit-appearance")).replace("undefined",J)!==J&&(m.attr("tagName")||J)!=="TEXTAREA"){d&&m.attr("placeholder",b);return}}m.data(P,d?b:J);m.data(C,a.className);m.data(G,1);if((m.attr(O)||J)===D){var h=m.wrap("<span>").parent(),j=K(h.html().replace(/type=["']?password["']?/i,'type="text"'));j.data(P,m.data(P));j.data(C,m.data(C));j.data(G,1);j.attr(M,b.length);j.focus(function(){K.watermark._hide(j,L)}).bind(n,function(){K.watermark._hide(j)}).bind("dragend",function(){window.setTimeout(function(){j.blur()},1)});m.blur(function(){K.watermark._show(m)}).bind(o,function(){K.watermark._show(m)});j.data(B,m);m.data(B,j)}else{m.focus(function(){m.data(w,1);K.watermark._hide(m,L)}).blur(function(){m.data(w,0);K.watermark._show(m)}).bind(n,function(){K.watermark._hide(m)}).bind(o,function(){K.watermark._show(m)}).bind("dragend",function(){window.setTimeout(function(){K.watermark._show(m)},1)}).bind("drop",function(p){var l=p.originalEvent.dataTransfer.getData("Text");m.val().replace(l,J)===m.data(P)&&m.val(l);m.focus()})}if(f.form){var k=f.form,q=K(k);if(!q.data(E)){q.submit(K.watermark.hideAll);if(k.submit){q.data(E,k.submit);k.submit=function(p,l){return function(){var s=l.data(E);K.watermark.hideAll();if(s.apply){s.apply(p,Array.prototype.slice.call(arguments))}else{s()}}}(k,q)}else{q.data(E,1);k.submit=function(l){return function(){K.watermark.hideAll();delete l.submit;l.submit()}}(k)}}}}K.watermark._show(m)})};v.length&&K(function(){for(var b,e,f=v.length-1;f>=0;f--){b=v[f];e=window[b];if(typeof e===F){window[b]=function(c){return function(){K.watermark.hideAll();return c.apply(null,Array.prototype.slice.call(arguments))}}(e)}}})})(jQuery);(function(d){var c=function(){var aA={},ar,aH=65,af,ax='<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',b={eventName:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:"ff0000",livePreview:true,flat:false},aD=function(h,f){var e=al(h);d(f).data("colorpicker").fields.eq(1).val(e.r).end().eq(2).val(e.g).end().eq(3).val(e.b).end()},ag=function(e,f){d(f).data("colorpicker").fields.eq(4).val(e.h).end().eq(5).val(e.s).end().eq(6).val(e.b).end()},aw=function(e,f){d(f).data("colorpicker").fields.eq(0).val(az(e)).end()},an=function(e,f){d(f).data("colorpicker").selector.css("backgroundColor","#"+az({h:e.h,s:100,b:100}));d(f).data("colorpicker").selectorIndic.css({left:parseInt(150*e.s/100,10),top:parseInt(150*(100-e.b)/100,10)})},X=function(e,f){d(f).data("colorpicker").hue.css("top",parseInt(150-150*e.h/360,10))},aj=function(e,f){d(f).data("colorpicker").currentColor.css("backgroundColor","#"+az(e))},V=function(e,f){d(f).data("colorpicker").newColor.css("backgroundColor","#"+az(e))},ap=function(h){var f=h.charCode||h.keyCode||-1;if((f>aH&&f<=90)||f==32){return false}var e=d(this).parent().parent();if(e.data("colorpicker").livePreview===true){au.apply(this)}},au=function(e){var f=d(this).parent().parent(),h;if(this.parentNode.className.indexOf("_hex")>0){f.data("colorpicker").color=h=ao(Z(this.value))}else{if(this.parentNode.className.indexOf("_hsb")>0){f.data("colorpicker").color=h=av({h:parseInt(f.data("colorpicker").fields.eq(4).val(),10),s:parseInt(f.data("colorpicker").fields.eq(5).val(),10),b:parseInt(f.data("colorpicker").fields.eq(6).val(),10)})}else{f.data("colorpicker").color=h=ak(aG({r:parseInt(f.data("colorpicker").fields.eq(1).val(),10),g:parseInt(f.data("colorpicker").fields.eq(2).val(),10),b:parseInt(f.data("colorpicker").fields.eq(3).val(),10)}))}}if(e){aD(h,f.get(0));aw(h,f.get(0));ag(h,f.get(0))}an(h,f.get(0));X(h,f.get(0));V(h,f.get(0));f.data("colorpicker").onChange.apply(f,[h,az(h),al(h)])},aq=function(e){var f=d(this).parent().parent();f.data("colorpicker").fields.parent().removeClass("colorpicker_focus")},aE=function(){aH=this.parentNode.className.indexOf("_hex")>0?70:65;d(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");d(this).parent().addClass("colorpicker_focus")},aC=function(h){var f=d(this).parent().find("input").focus();var e={el:d(this).parent().addClass("colorpicker_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:(this.parentNode.className.indexOf("_hsb")>0?100:255),y:h.pageY,field:f,val:parseInt(f.val(),10),preview:d(this).parent().parent().data("colorpicker").livePreview};d(document).bind("mouseup",e,ae);d(document).bind("mousemove",e,aF)},aF=function(e){e.data.field.val(Math.max(0,Math.min(e.data.max,parseInt(e.data.val+e.pageY-e.data.y,10))));if(e.data.preview){au.apply(e.data.field.get(0),[true])}return false},ae=function(e){au.apply(e.data.field.get(0),[true]);e.data.el.removeClass("colorpicker_slider").find("input").focus();d(document).unbind("mouseup",ae);d(document).unbind("mousemove",aF);return false},ai=function(e){var f={cal:d(this).parent(),y:d(this).offset().top};f.preview=f.cal.data("colorpicker").livePreview;d(document).bind("mouseup",f,ad);d(document).bind("mousemove",f,am)},am=function(e){au.apply(e.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,(e.pageY-e.data.y))))/150,10)).get(0),[e.data.preview]);return false},ad=function(e){aD(e.data.cal.data("colorpicker").color,e.data.cal.get(0));aw(e.data.cal.data("colorpicker").color,e.data.cal.get(0));d(document).unbind("mouseup",ad);d(document).unbind("mousemove",am);return false},Y=function(e){var f={cal:d(this).parent(),pos:d(this).offset()};f.preview=f.cal.data("colorpicker").livePreview;d(document).bind("mouseup",f,a);d(document).bind("mousemove",f,ac)},ac=function(e){au.apply(e.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,(e.pageY-e.data.pos.top))))/150,10)).end().eq(5).val(parseInt(100*(Math.max(0,Math.min(150,(e.pageX-e.data.pos.left))))/150,10)).get(0),[e.data.preview]);return false},a=function(e){aD(e.data.cal.data("colorpicker").color,e.data.cal.get(0));aw(e.data.cal.data("colorpicker").color,e.data.cal.get(0));d(document).unbind("mouseup",a);d(document).unbind("mousemove",ac);return false},ah=function(e){d(this).addClass("colorpicker_focus")},ay=function(e){d(this).removeClass("colorpicker_focus")},ab=function(e){var f=d(this).parent();var h=f.data("colorpicker").color;f.data("colorpicker").origColor=h;aj(h,f.get(0));f.data("colorpicker").onSubmit(h,az(h),al(h),f.data("colorpicker").el)},U=function(k){var h=d("#"+d(this).data("colorpickerId"));h.data("colorpicker").onBeforeShow.apply(this,[h.get(0)]);var j=d(this).offset();var f=aa();var e=j.top+this.offsetHeight;var l=j.left;if(e+176>f.t+f.h){e-=this.offsetHeight+176}if(l+356>f.l+f.w){l-=356}h.css({left:l+"px",top:e+"px"});if(h.data("colorpicker").onShow.apply(this,[h.get(0)])!=false){h.show()}d(document).bind("mousedown",{cal:h},aI);return false},aI=function(e){if(!aB(e.data.cal.get(0),e.target,e.data.cal.get(0))){if(e.data.cal.data("colorpicker").onHide.apply(this,[e.data.cal.get(0)])!=false){e.data.cal.hide()}d(document).unbind("mousedown",aI)}},aB=function(f,e,j){if(f==e){return true}if(f.contains){return f.contains(e)}if(f.compareDocumentPosition){return !!(f.compareDocumentPosition(e)&16)}var h=e.parentNode;while(h&&h!=j){if(h==f){return true}h=h.parentNode}return false},aa=function(){var e=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(e?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(e?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(e?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(e?document.documentElement.clientHeight:document.body.clientHeight)}},av=function(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}},aG=function(e){return{r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}},Z=function(f){var j=6-f.length;if(j>0){var h=[];for(var e=0;e<j;e++){h.push("0")}h.push(f);f=h.join("")}return f},at=function(e){var e=parseInt(((e.indexOf("#")>-1)?e.substring(1):e),16);return{r:e>>16,g:(e&65280)>>8,b:(e&255)}},ao=function(e){return ak(at(e))},ak=function(f){var e={h:0,s:0,b:0};var h=Math.min(f.r,f.g,f.b);var k=Math.max(f.r,f.g,f.b);var j=k-h;e.b=k;if(k!=0){}e.s=k!=0?255*j/k:0;if(e.s!=0){if(f.r==k){e.h=(f.g-f.b)/j}else{if(f.g==k){e.h=2+(f.b-f.r)/j}else{e.h=4+(f.r-f.g)/j}}}else{e.h=-1}e.h*=60;if(e.h<0){e.h+=360}e.s*=100/255;e.b*=100/255;return e},al=function(m){var e={};var k=Math.round(m.h);var j=Math.round(m.s*255/100);var n=Math.round(m.b*255/100);if(j==0){e.r=e.g=e.b=n}else{var l=n;var h=(255-j)*n/255;var f=(l-h)*(k%60)/60;if(k==360){k=0}if(k<60){e.r=l;e.b=h;e.g=h+f}else{if(k<120){e.g=l;e.b=h;e.r=l-f}else{if(k<180){e.g=l;e.r=h;e.b=h+f}else{if(k<240){e.b=l;e.r=h;e.g=l-f}else{if(k<300){e.b=l;e.g=h;e.r=h+f}else{if(k<360){e.r=l;e.g=h;e.b=l-f}else{e.r=0;e.g=0;e.b=0}}}}}}}return{r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)}},T=function(e){var f=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];d.each(f,function(j,h){if(h.length==1){f[j]="0"+h}});return f.join("")},az=function(e){return T(al(e))},W=function(){var f=d(this).parent();var e=f.data("colorpicker").origColor;f.data("colorpicker").color=e;aD(e,f.get(0));aw(e,f.get(0));ag(e,f.get(0));an(e,f.get(0));X(e,f.get(0));V(e,f.get(0))};return{init:function(e){e=d.extend({},b,e||{});if(typeof e.color=="string"){e.color=ao(e.color)}else{if(e.color.r!=undefined&&e.color.g!=undefined&&e.color.b!=undefined){e.color=ak(e.color)}else{if(e.color.h!=undefined&&e.color.s!=undefined&&e.color.b!=undefined){e.color=av(e.color)}else{return this}}}return this.each(function(){if(!d(this).data("colorpickerId")){var f=d.extend({},e);f.origColor=e.color;var j="collorpicker_"+parseInt(Math.random()*1000);d(this).data("colorpickerId",j);var h=d(ax).attr("id",j);if(f.flat){h.appendTo(this).show()}else{h.appendTo(document.body)}f.fields=h.find("input").bind("keyup",ap).bind("change",au).bind("blur",aq).bind("focus",aE);h.find("span").bind("mousedown",aC).end().find(">div.colorpicker_current_color").bind("click",W);f.selector=h.find("div.colorpicker_color").bind("mousedown",Y);f.selectorIndic=f.selector.find("div div");f.el=this;f.hue=h.find("div.colorpicker_hue div");h.find("div.colorpicker_hue").bind("mousedown",ai);f.newColor=h.find("div.colorpicker_new_color");f.currentColor=h.find("div.colorpicker_current_color");h.data("colorpicker",f);h.find("div.colorpicker_submit").bind("mouseenter",ah).bind("mouseleave",ay).bind("click",ab);aD(f.color,h.get(0));ag(f.color,h.get(0));aw(f.color,h.get(0));X(f.color,h.get(0));an(f.color,h.get(0));aj(f.color,h.get(0));V(f.color,h.get(0));if(f.flat){h.css({position:"relative",display:"block"})}else{d(this).bind(f.eventName,U)}}})},showPicker:function(){return this.each(function(){if(d(this).data("colorpickerId")){U.apply(this)}})},hidePicker:function(){return this.each(function(){if(d(this).data("colorpickerId")){d("#"+d(this).data("colorpickerId")).hide()}})},setColor:function(e){if(typeof e=="string"){e=ao(e)}else{if(e.r!=undefined&&e.g!=undefined&&e.b!=undefined){e=ak(e)}else{if(e.h!=undefined&&e.s!=undefined&&e.b!=undefined){e=av(e)}else{return this}}}return this.each(function(){if(d(this).data("colorpickerId")){var f=d("#"+d(this).data("colorpickerId"));f.data("colorpicker").color=e;f.data("colorpicker").origColor=e;aD(e,f.get(0));ag(e,f.get(0));aw(e,f.get(0));X(e,f.get(0));an(e,f.get(0));aj(e,f.get(0));V(e,f.get(0))}})}}}();d.fn.extend({ColorPicker:c.init,ColorPickerHide:c.hidePicker,ColorPickerShow:c.showPicker,ColorPickerSetColor:c.setColor})})(jQuery);if(jQuery){(function($){function renderOption(id,option){var html='<label><input type="checkbox" name="'+id.replace("_",".")+'[]" value="'+option.value+'"';if(option.selected){html+=' checked="checked"'}html+=" />"+option.text+"</label>";return html}function renderOptions(id,options,o){var html="";for(var i=0;i<options.length;i++){if(options[i].optgroup){html+='<label class="optGroup">';if(o.optGroupSelectable){html+='<input type="checkbox" class="optGroup" />'+options[i].optgroup}else{html+=options[i].optgroup}html+='</label><div class="optGroupContainer">';html+=renderOptions(id,options[i].options,o);html+="</div>"}else{html+=renderOption(id,options[i])}}return html}function buildOptions(options){var multiselect=$(this);var multiselectoptions=multiselect.next(".multiselectoptions");var o=multiselect.data("config");var callback=multiselect.data("callback");multiselectoptions.html("");var html="";if(o.selectAll){html+='<label class="selectAll"><input type="checkbox" class="selectAll" />'+o.selectAllText+"</label>"}html+=renderOptions(multiselect.attr("id"),options,o);multiselectoptions.html(html);var initialWidth=multiselectoptions.width();var hasScrollbar=false;if(multiselectoptions.height()>o.listHeight){multiselectoptions.css("height",o.listHeight+"px");hasScrollbar=true}else{multiselectoptions.css("height","")}var scrollbarWidth=hasScrollbar&&(initialWidth==multiselectoptions.width())?17:0;if((multiselectoptions.width()+scrollbarWidth)<multiselect.outerWidth()){multiselectoptions.css("width",multiselect.outerWidth()-2+"px")}else{multiselectoptions.css("width",(multiselectoptions.width()+scrollbarWidth)+"px")}if($.fn.bgiframe){multiselect.next(".multiselectoptions").bgiframe({width:multiselectoptions.width(),height:multiselectoptions.height()})}if(o.selectAll){multiselectoptions.find("INPUT.selectAll").click(function(){multiselectoptions.find("INPUT:checkbox").attr("checked",$(this).attr("checked")).parent("LABEL").toggleClass("checked",$(this).attr("checked"))})}if(o.optGroupSelectable){multiselectoptions.addClass("optGroupHasCheckboxes");multiselectoptions.find("INPUT.optGroup").click(function(){$(this).parent().next().find("INPUT:checkbox").attr("checked",$(this).attr("checked")).parent("LABEL").toggleClass("checked",$(this).attr("checked"))})}multiselectoptions.find("INPUT:checkbox").click(function(){$(this).parent("LABEL").toggleClass("checked",$(this).attr("checked"));updateSelected.call(multiselect);multiselect.focus();if($(this).parent().parent().hasClass("optGroupContainer")){updateOptGroup.call(multiselect,$(this).parent().parent().prev())}if(callback){callback($(this))}});multiselectoptions.each(function(){$(this).find("INPUT:checked").parent().addClass("checked")});updateSelected.call(multiselect);if(o.optGroupSelectable){multiselectoptions.find("LABEL.optGroup").each(function(){updateOptGroup.call(multiselect,$(this))})}multiselectoptions.find("LABEL:has(INPUT)").hover(function(){$(this).parent().find("LABEL").removeClass("hover");$(this).addClass("hover")},function(){$(this).parent().find("LABEL").removeClass("hover")});multiselect.keydown(function(e){var multiselectoptions=$(this).next(".multiselectoptions");if(multiselectoptions.css("visibility")!="hidden"){if(e.keyCode==9){$(this).addClass("focus").trigger("click");$(this).focus().next(":input").focus();return true}if(e.keyCode==27||e.keyCode==37||e.keyCode==39){$(this).addClass("focus").trigger("click")}if(e.keyCode==40||e.keyCode==38){var allOptions=multiselectoptions.find("LABEL");var oldHoverIndex=allOptions.index(allOptions.filter(".hover"));var newHoverIndex=-1;if(oldHoverIndex<0){multiselectoptions.find("LABEL:first").addClass("hover")}else{if(e.keyCode==40&&oldHoverIndex<allOptions.length-1){newHoverIndex=oldHoverIndex+1}else{if(e.keyCode==38&&oldHoverIndex>0){newHoverIndex=oldHoverIndex-1}}}if(newHoverIndex>=0){$(allOptions.get(oldHoverIndex)).removeClass("hover");$(allOptions.get(newHoverIndex)).addClass("hover");adjustViewPort(multiselectoptions)}return false}if(e.keyCode==13||e.keyCode==32){var selectedCheckbox=multiselectoptions.find("LABEL.hover INPUT:checkbox");selectedCheckbox.attr("checked",!selectedCheckbox.attr("checked")).parent("LABEL").toggleClass("checked",selectedCheckbox.attr("checked"));if(selectedCheckbox.hasClass("selectAll")){multiselectoptions.find("INPUT:checkbox").attr("checked",selectedCheckbox.attr("checked")).parent("LABEL").addClass("checked").toggleClass("checked",selectedCheckbox.attr("checked"))}updateSelected.call(multiselect);if(callback){callback($(this))}return false}if(e.keyCode>=33&&e.keyCode<=126){var match=multiselectoptions.find("LABEL:startsWith("+String.fromCharCode(e.keyCode)+")");var currentHoverIndex=match.index(match.filter("LABEL.hover"));var afterHoverMatch=match.filter(function(index){return index>currentHoverIndex});match=(afterHoverMatch.length>=1?afterHoverMatch:match).filter("LABEL:first");if(match.length==1){multiselectoptions.find("LABEL.hover").removeClass("hover");match.addClass("hover");adjustViewPort(multiselectoptions)}}}else{if(e.keyCode==38||e.keyCode==40||e.keyCode==13||e.keyCode==32){$(this).removeClass("focus").trigger("click");multiselectoptions.find("LABEL:first").addClass("hover");return false}if(e.keyCode==9){multiselectoptions.next(":input").focus();return true}}if(e.keyCode==13){return false}})}function adjustViewPort(multiselectoptions){var selectionBottom=multiselectoptions.find("LABEL.hover").position().top+multiselectoptions.find("LABEL.hover").outerHeight();if(selectionBottom>multiselectoptions.innerHeight()){multiselectoptions.scrollTop(multiselectoptions.scrollTop()+selectionBottom-multiselectoptions.innerHeight())}if(multiselectoptions.find("LABEL.hover").position().top<0){multiselectoptions.scrollTop(multiselectoptions.scrollTop()+multiselectoptions.find("LABEL.hover").position().top)}}function updateOptGroup(optGroup){var multiselect=$(this);var o=multiselect.data("config");if(o.optGroupSelectable){var optGroupSelected=true;$(optGroup).next().find("INPUT:checkbox").each(function(){if(!$(this).attr("checked")){optGroupSelected=false;return false}});$(optGroup).find("INPUT.optGroup").attr("checked",optGroupSelected).parent("LABEL").toggleClass("checked",optGroupSelected)}}function updateSelected(){var multiselect=$(this);var multiselectoptions=multiselect.next(".multiselectoptions");var o=multiselect.data("config");var i=0;var selectAll=true;var display="";multiselectoptions.find("INPUT:checkbox").not(".selectAll, .optGroup").each(function(){if($(this).attr("checked")){i++;display=display+$(this).parent().text()+", "}else{selectAll=false}});display=display.replace(/\s*\,\s*$/,"");if(i==0){multiselect.html(o.noneSelectedText)}else{if(o.oneOrMoreSelected=="*"){multiselect.html(display);multiselect.attr("title",display)}else{multiselect.html(o.oneOrMoreSelected.replace("%",i))}}if(o.selectAll){multiselectoptions.find("input.selectAll").attr("checked",selectAll).parent("label").toggleClass("checked",selectAll)}}$.extend($.fn,{multiselect:function(o,callback){if(!o){o={}}if(o.selectAll==undefined){o.selectAll=true}if(o.selectAllText==undefined){o.selectAllText="Select All"}if(o.noneSelectedText==undefined){o.noneSelectedText="Select options"}if(o.oneOrMoreSelected==undefined){o.oneOrMoreSelected="% selected"}if(o.optGroupSelectable==undefined){o.optGroupSelectable=false}if(o.listHeight==undefined){o.listHeight=150}$(this).each(function(){var select=$(this);var html='<div class="multiselect mockField mockSelect"></div>';html+='<div class="multiselectoptions" style="position: absolute; z-index: 99999; visibility: hidden;"></div>';$(select).after(html);var multiselect=$(select).next(".multiselect");var multiselectoptions=multiselect.next(".multiselectoptions");multiselect.data("config",o);multiselect.data("callback",callback);var options=[];$(select).children().each(function(){if(this.tagName.toUpperCase()=="OPTGROUP"){var suboptions=[];options.push({optgroup:$(this).attr("label"),options:suboptions});$(this).children("OPTION").each(function(){if($(this).val()!=""){suboptions.push({text:$(this).html(),value:$(this).val(),selected:$(this).attr("selected")})}})}else{if(this.tagName.toUpperCase()=="OPTION"){if($(this).val()!=""){options.push({text:$(this).html(),value:$(this).val(),selected:$(this).attr("selected")})}}}});$(select).remove();multiselect.attr("id",$(select).attr("id"));buildOptions.call(multiselect,options);multiselect.hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).click(function(evt){if($(this).hasClass("active")){$(this).multiselectoptionsHide()}else{$(this).multiselectoptionsShow()}return false}).focus(function(){$(this).addClass("focus")}).blur(function(){$(this).removeClass("focus")});$(document).click(function(event){if(!($(event.target).parents().andSelf().is(".multiselectoptions"))){multiselect.multiselectoptionsHide()}})})},multiselectoptionsUpdate:function(options){buildOptions.call($(this),options)},multiselectoptionsHide:function(){$(this).removeClass("active").removeClass("hover").next(".multiselectoptions").css("visibility","hidden")},multiselectoptionsShow:function(){var multiselect=$(this);var multiselectoptions=multiselect.next(".multiselectoptions");var o=multiselect.data("config");$(".multiselect").multiselectoptionsHide();multiselectoptions.find("label").removeClass("hover");multiselect.addClass("active").next(".multiselectoptions").css("visibility","visible");multiselect.next(".multiselectoptions").scrollTop(0);var offset=multiselect.position();multiselect.next(".multiselectoptions").css({top:offset.top+$(this).outerHeight()+"px"});multiselect.next(".multiselectoptions").css({left:offset.left+"px"})},selectedValuesString:function(){var selectedValues="";$(this).next(".multiselectoptions").find("input:checkbox:checked").not(".optGroup, .selectAll").each(function(){selectedValues+=$(this).attr("value")+","});return selectedValues.replace(/\s*\,\s*$/,"")}});$.expr[":"].startsWith=function(el,i,m){var search=m[3];if(!search){return false}return eval("/^[/s]*"+search+"/i").test($(el).text())}})(jQuery)}jQuery.notifyBar=function(a){(function(d){var c=notifyBarNS={};notifyBarNS.shown=false;if(!a){a={}}notifyBarNS.html=a.html||"Your message here";notifyBarNS.delay=a.delay||2000;notifyBarNS.animationSpeed=a.animationSpeed||200;notifyBarNS.jqObject=a.jqObject;notifyBarNS.cls=a.cls||"";notifyBarNS.close=a.close||false;if(notifyBarNS.jqObject){c=notifyBarNS.jqObject;notifyBarNS.html=c.html()}else{c=jQuery("<div></div>").addClass("jquery-notify-bar").addClass(notifyBarNS.cls).attr("id","__notifyBar")}c.html(notifyBarNS.html).hide();var b=c.attr("id");switch(notifyBarNS.animationSpeed){case"slow":asTime=600;break;case"normal":asTime=400;break;case"fast":asTime=200;break;default:asTime=notifyBarNS.animationSpeed}if(c!="object"){}jQuery("body").prepend(c);c.click(function(){if(c.attr("id")=="__notifyBar"){jQuery("#"+b).slideUp(asTime,function(){jQuery("#"+b).remove()})}else{jQuery("#"+b).slideUp(asTime)}return false});c.slideDown(asTime);if(notifyBarNS.delay!=-1){if(c.attr("id")=="__notifyBar"){setTimeout("jQuery('#"+b+"').slideUp("+asTime+", function() {jQuery('#"+b+"').remove()});",notifyBarNS.delay+asTime)}else{setTimeout("jQuery('#"+b+"').slideUp("+asTime+", function() {jQuery('#"+b+"')});",notifyBarNS.delay+asTime)}}})(jQuery)};jQuery.fn.corners=function(z){var v="rounded_by_jQuery_corners";var m=y(z);var ac=false;try{ac=(document.body.style.WebkitBorderRadius!==undefined);var c=navigator.userAgent.indexOf("Chrome");if(c>=0){ac=false}}catch(ab){}var n=false;try{n=(document.body.style.MozBorderRadius!==undefined);var c=navigator.userAgent.indexOf("Firefox");if(c>=0&&parseInt(navigator.userAgent.substring(c+8))<3){n=false}}catch(ab){}return this.each(function(D,A){$e=jQuery(A);if($e.hasClass(v)){return}$e.addClass(v);var C=/{(.*)}/.exec(A.className);var E=C?y(C[1],m):m;var B=A.nodeName.toLowerCase();if(B=="input"){A=w(A)}if(ac&&E.webkit){s(A,E)}else{if(n&&E.mozilla&&(E.sizex==E.sizey)){u(A,E)}else{var F=aa(A.parentNode);var G=aa(A);switch(B){case"a":case"input":d(A,E,F,G);break;default:h(A,E,F,G);break}}}});function s(D,C){var A=""+C.sizex+"px "+C.sizey+"px";var B=jQuery(D);if(C.tl){B.css("WebkitBorderTopLeftRadius",A)}if(C.tr){B.css("WebkitBorderTopRightRadius",A)}if(C.bl){B.css("WebkitBorderBottomLeftRadius",A)}if(C.br){B.css("WebkitBorderBottomRightRadius",A)}}function u(D,C){var A=""+C.sizex+"px";var B=jQuery(D);if(C.tl){B.css("-moz-border-radius-topleft",A)}if(C.tr){B.css("-moz-border-radius-topright",A)}if(C.bl){B.css("-moz-border-radius-bottomleft",A)}if(C.br){B.css("-moz-border-radius-bottomright",A)}}function d(D,G,E,H){var F=j("table");var B=j("tbody");F.appendChild(B);var C=j("tr");var K=j("td","top");C.appendChild(K);var A=j("tr");var J=k(D,G,j("td"));A.appendChild(J);var L=j("tr");var I=j("td","bottom");L.appendChild(I);if(G.tl||G.tr){B.appendChild(C);b(K,G,E,H,true)}B.appendChild(A);if(G.bl||G.br){B.appendChild(L);b(I,G,E,H,false)}D.appendChild(F);if(jQuery.browser.msie){F.onclick=f}D.style.overflow="hidden"}function f(){if(!this.parentNode.onclick){this.parentNode.click()}}function w(C){var B=document.createElement("a");B.id=C.id;B.className=C.className;if(C.onclick){B.href="javascript:";B.onclick=C.onclick}else{jQuery(C).parent("form").each(function(){B.href=this.action});B.onclick=p}var A=document.createTextNode(C.value);B.appendChild(A);C.parentNode.replaceChild(B,C);return B}function p(){jQuery(this).parent("form").each(function(){this.submit()});return false}function h(E,B,C,D){var A=k(E,B,document.createElement("div"));E.appendChild(A);if(B.tl||B.tr){b(E,B,C,D,true)}if(B.bl||B.br){b(E,B,C,D,false)}}function k(B,A,C){var F=jQuery(B);var D;while(D=B.firstChild){C.appendChild(D)}if(B.style.height){var G=parseInt(F.css("height"));C.style.height=G+"px";G+=parseInt(F.css("padding-top"))+parseInt(F.css("padding-bottom"));B.style.height=G+"px"}if(B.style.width){var E=parseInt(F.css("width"));C.style.width=E+"px";E+=parseInt(F.css("padding-left"))+parseInt(F.css("padding-right"));B.style.width=E+"px"}C.style.paddingLeft=F.css("padding-left");C.style.paddingRight=F.css("padding-right");if(A.tl||A.tr){C.style.paddingTop=l(B,A,F.css("padding-top"),true)}else{C.style.paddingTop=F.css("padding-top")}if(A.bl||A.br){C.style.paddingBottom=l(B,A,F.css("padding-bottom"),false)}else{C.style.paddingBottom=F.css("padding-bottom")}B.style.padding=0;return C}function l(A,B,E,D){if(E.indexOf("px")<0){try{console.error("%s padding not in pixels",(D?"top":"bottom"),A)}catch(C){}E=B.sizey+"px"}E=parseInt(E);if(E-B.sizey<0){try{console.error("%s padding is %ipx for %ipx corner:",(D?"top":"bottom"),E,B.sizey,A)}catch(C){}E=B.sizey}return E-B.sizey+"px"}function j(B,A){var C=document.createElement(B);C.style.border="none";C.style.borderCollapse="collapse";C.style.borderSpacing=0;C.style.padding=0;C.style.margin=0;if(A){C.style.verticalAlign=A}return C}function aa(B){try{var C=jQuery.css(B,"background-color");if(C.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&B.parentNode){return aa(B.parentNode)}if(C==null){return"#ffffff"}if(C.indexOf("rgb")>-1){C=x(C)}if(C.length==4){C=t(C)}return C}catch(A){return"#ffffff"}}function t(A){return"#"+A.substring(1,2)+A.substring(1,2)+A.substring(2,3)+A.substring(2,3)+A.substring(3,4)+A.substring(3,4)}function x(A){var B=255;var D="";var C;var E=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;var F=E.exec(A);for(C=1;C<4;C++){D+=("0"+parseInt(F[C]).toString(16)).slice(-2)}return"#"+D}function y(B,D){var B=B||"";var C={sizex:5,sizey:5,tl:false,tr:false,bl:false,br:false,webkit:true,mozilla:true,transparent:false};if(D){C.sizex=D.sizex;C.sizey=D.sizey;C.webkit=D.webkit;C.transparent=D.transparent;C.mozilla=D.mozilla}var A=false;var E=false;jQuery.each(B.split(" "),function(F,G){G=G.toLowerCase();var H=parseInt(G);if(H>0&&G==H+"px"){C.sizey=H;if(!A){C.sizex=H}A=true}else{switch(G){case"no-native":C.webkit=C.mozilla=false;break;case"webkit":C.webkit=true;break;case"no-webkit":C.webkit=false;break;case"mozilla":C.mozilla=true;break;case"no-mozilla":C.mozilla=false;break;case"anti-alias":C.transparent=false;break;case"transparent":C.transparent=true;break;case"top":E=C.tl=C.tr=true;break;case"right":E=C.tr=C.br=true;break;case"bottom":E=C.bl=C.br=true;break;case"left":E=C.tl=C.bl=true;break;case"top-left":E=C.tl=true;break;case"top-right":E=C.tr=true;break;case"bottom-left":E=C.bl=true;break;case"bottom-right":E=C.br=true;break}}});if(!E){if(!D){C.tl=C.tr=C.bl=C.br=true}else{C.tl=D.tl;C.tr=D.tr;C.bl=D.bl;C.br=D.br}}return C}function e(A,D,B){var E=Array(parseInt("0x"+A.substring(1,3)),parseInt("0x"+A.substring(3,5)),parseInt("0x"+A.substring(5,7)));var C=Array(parseInt("0x"+D.substring(1,3)),parseInt("0x"+D.substring(3,5)),parseInt("0x"+D.substring(5,7)));r="0"+Math.round(E[0]+(C[0]-E[0])*B).toString(16);g="0"+Math.round(E[1]+(C[1]-E[1])*B).toString(16);D="0"+Math.round(E[2]+(C[2]-E[2])*B).toString(16);return"#"+r.substring(r.length-2)+g.substring(g.length-2)+D.substring(D.length-2)}function b(A,B,C,E,D){if(B.transparent){a(A,B,C,D)}else{q(A,B,C,E,D)}}function q(I,A,B,N,L){var H,Q;var J=document.createElement("div");J.style.fontSize="1px";J.style.backgroundColor=B;var O=0;for(H=1;H<=A.sizey;H++){var E,D,C;arc=Math.sqrt(1-Math.pow(1-H/A.sizey,2))*A.sizex;var P=A.sizex-Math.ceil(arc);var G=Math.floor(O);var F=A.sizex-P-G;var M=document.createElement("div");var K=J;M.style.margin="0px "+P+"px";M.style.height="1px";M.style.overflow="hidden";for(Q=1;Q<=F;Q++){if(Q==1){if(Q==F){E=((arc+O)*0.5)-G}else{D=Math.sqrt(1-Math.pow(1-(P+1)/A.sizex,2))*A.sizey;E=(D-(A.sizey-H))*(arc-G-F+1)*0.5}}else{if(Q==F){D=Math.sqrt(1-Math.pow((A.sizex-P-Q+1)/A.sizex,2))*A.sizey;E=1-(1-(D-(A.sizey-H)))*(1-(O-G))*0.5}else{C=Math.sqrt(1-Math.pow((A.sizex-P-Q)/A.sizex,2))*A.sizey;D=Math.sqrt(1-Math.pow((A.sizex-P-Q+1)/A.sizex,2))*A.sizey;E=((D+C)*0.5)-(A.sizey-H)}}o(A,M,K,L,e(B,N,E));K=M;var M=K.cloneNode(false);M.style.margin="0px 1px"}o(A,M,K,L,N);O=arc}if(L){I.insertBefore(J,I.firstChild)}else{I.appendChild(J)}}function o(C,A,E,D,B){if(D&&!C.tl){A.style.marginLeft=0}if(D&&!C.tr){A.style.marginRight=0}if(!D&&!C.bl){A.style.marginLeft=0}if(!D&&!C.br){A.style.marginRight=0}A.style.backgroundColor=B;if(D){E.appendChild(A)}else{E.insertBefore(A,E.firstChild)}}function a(J,G,D,A){var K=document.createElement("div");K.style.fontSize="1px";var H=document.createElement("div");H.style.overflow="hidden";H.style.height="1px";H.style.borderColor=D;H.style.borderStyle="none solid";var E=G.sizex-1;var B=G.sizey-1;if(!B){B=1}for(var I=0;I<G.sizey;I++){var F=E-Math.floor(Math.sqrt(1-Math.pow(1-I/B,2))*E);if(I==2&&G.sizex==6&&G.sizey==6){F=2}var C=H.cloneNode(false);C.style.borderWidth="0 "+F+"px";if(A){C.style.borderWidth="0 "+(G.tr?F:0)+"px 0 "+(G.tl?F:0)+"px"}else{C.style.borderWidth="0 "+(G.br?F:0)+"px 0 "+(G.bl?F:0)+"px"}A?K.appendChild(C):K.insertBefore(C,K.firstChild)}if(A){J.insertBefore(K,J.firstChild)}else{J.appendChild(K)}}};
/*
 * jQuery Form Plugin
 * version: 2.43 (12-MAR-2010)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(a){a.fn.ajaxSubmit=function(v){if(!this.length){b("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof v=="function"){v={success:v}}var s=a.trim(this.attr("action"));if(s){s=(s.match(/^([^#]+)/)||[])[1]}s=s||window.location.href||"";v=a.extend({url:s,type:this.attr("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},v||{});var w={};this.trigger("form-pre-serialize",[this,v,w]);if(w.veto){b("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(v.beforeSerialize&&v.beforeSerialize(this,v)===false){b("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var u=this.formToArray(v.semantic);if(v.data){v.extraData=v.data;for(var p in v.data){if(v.data[p] instanceof Array){for(var o in v.data[p]){u.push({name:p,value:v.data[p][o]})}}else{u.push({name:p,value:v.data[p]})}}}if(v.beforeSubmit&&v.beforeSubmit(u,this,v)===false){b("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[u,this,v,w]);if(w.veto){b("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var h=a.param(u);if(v.type.toUpperCase()=="GET"){v.url+=(v.url.indexOf("?")>=0?"&":"?")+h;v.data=null}else{v.data=h}var x=this,c=[];if(v.resetForm){c.push(function(){x.resetForm()})}if(v.clearForm){c.push(function(){x.clearForm()})}if(!v.dataType&&v.target){var l=v.success||function(){};c.push(function(j){var k=v.replaceTarget?"replaceWith":"html";a(v.target)[k](j).each(l,arguments)})}else{if(v.success){c.push(v.success)}}v.success=function(k,n,j){for(var y=0,q=c.length;y<q;y++){c[y].apply(v,[k,n,j||x,x])}};var f=a("input:file",this).fieldValue();var e=false;for(var m=0;m<f.length;m++){if(f[m]){e=true}}var t=false;if((f.length&&v.iframe!==false)||v.iframe||e||t){if(v.closeKeepAlive){a.get(v.closeKeepAlive,d)}else{d()}}else{a.ajax(v)}this.trigger("form-submit-notify",[this,v]);return this;function d(){var H=x[0];if(a(":input[name=submit]",H).length){alert('Error: Form elements must not be named "submit".');return}var j=a.extend({},a.ajaxSettings,v);var y=a.extend(true,{},a.extend(true,{},a.ajaxSettings),j);var G="jqFormIO"+(new Date().getTime());var q=a('<iframe id="'+G+'" name="'+G+'" src="'+j.iframeSrc+'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');var C=q[0];q.css({position:"absolute",top:"-1000px",left:"-1000px"});var K={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;q.attr("src",j.iframeSrc)}};var J=j.global;if(J&&!a.active++){a.event.trigger("ajaxStart")}if(J){a.event.trigger("ajaxSend",[K,j])}if(y.beforeSend&&y.beforeSend(K,y)===false){y.global&&a.active--;return}if(K.aborted){return}var k=false;var B=0;var z=H.clk;if(z){var F=z.name;if(F&&!z.disabled){j.extraData=j.extraData||{};j.extraData[F]=z.value;if(z.type=="image"){j.extraData[F+".x"]=H.clk_x;j.extraData[F+".y"]=H.clk_y}}}function A(){var N=x.attr("target"),M=x.attr("action");H.setAttribute("target",G);if(H.getAttribute("method")!="POST"){H.setAttribute("method","POST")}if(H.getAttribute("action")!=j.url){H.setAttribute("action",j.url)}if(!j.skipEncodingOverride){x.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(j.timeout){setTimeout(function(){B=true;I()},j.timeout)}var L=[];try{if(j.extraData){for(var O in j.extraData){L.push(a('<input type="hidden" name="'+O+'" value="'+j.extraData[O]+'" />').appendTo(H)[0])}}q.appendTo("body");q.data("form-plugin-onload",I);H.submit()}finally{H.setAttribute("action",M);N?H.setAttribute("target",N):x.removeAttr("target");a(L).remove()}}if(j.forceSync){A()}else{setTimeout(A,10)}var E=100;function I(){if(k){return}var L=true;try{if(B){throw"timeout"}var n,O;O=C.contentWindow?C.contentWindow.document:C.contentDocument?C.contentDocument:C.document;var N=j.dataType=="xml"||O.XMLDocument||a.isXMLDoc(O);b("isXml="+N);if(!N&&(O.body==null||O.body.innerHTML=="")){if(--E){b("requeing onLoad callback, DOM not available");setTimeout(I,250);return}b("Could not access iframe DOM after 100 tries.");return}b("response detected");k=true;K.responseText=O.body?O.body.innerHTML:null;K.responseXML=O.XMLDocument?O.XMLDocument:O;K.getResponseHeader=function(R){var S={"content-type":j.dataType};return S[R]};if(j.dataType=="json"||j.dataType=="script"){var Q=O.getElementsByTagName("textarea")[0];if(Q){K.responseText=Q.value}else{var M=O.getElementsByTagName("pre")[0];if(M){K.responseText=M.innerHTML}}}else{if(j.dataType=="xml"&&!K.responseXML&&K.responseText!=null){K.responseXML=D(K.responseText)}}n=a.httpData(K,j.dataType)}catch(P){b("error caught:",P);L=false;K.error=P;a.handleError(j,K,"error",P)}if(L){j.success(n,"success");if(J){a.event.trigger("ajaxSuccess",[K,j])}}if(J){a.event.trigger("ajaxComplete",[K,j])}if(J&&!--a.active){a.event.trigger("ajaxStop")}if(j.complete){j.complete(K,L?"success":"error")}setTimeout(function(){q.removeData("form-plugin-onload");q.remove();K.responseXML=null},100)}function D(L,n){if(window.ActiveXObject){n=new ActiveXObject("Microsoft.XMLDOM");n.async="false";n.loadXML(L)}else{n=(new DOMParser()).parseFromString(L,"text/xml")}return(n&&n.documentElement&&n.documentElement.tagName!="parsererror")?n:null}}};a.fn.ajaxForm=function(c){return this.ajaxFormUnbind().bind("submit.form-plugin",function(d){d.preventDefault();a(this).ajaxSubmit(c)}).bind("click.form-plugin",function(k){var h=k.target;var d=a(h);if(!(d.is(":submit,input:image"))){var l=d.closest(":submit");if(l.length==0){return}h=l[0]}var f=this;f.clk=h;if(h.type=="image"){if(k.offsetX!=undefined){f.clk_x=k.offsetX;f.clk_y=k.offsetY}else{if(typeof a.fn.offset=="function"){var j=d.offset();f.clk_x=k.pageX-j.left;f.clk_y=k.pageY-j.top}else{f.clk_x=k.pageX-h.offsetLeft;f.clk_y=k.pageY-h.offsetTop}}}setTimeout(function(){f.clk=f.clk_x=f.clk_y=null},100)})};a.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};a.fn.formToArray=function(e){var p=[];if(this.length==0){return p}var f=this[0];var d=e?f.getElementsByTagName("*"):f.elements;if(!d){return p}for(var l=0,t=d.length;l<t;l++){var c=d[l];var o=c.name;if(!o){continue}if(e&&f.clk&&c.type=="image"){if(!c.disabled&&f.clk==c){p.push({name:o,value:a(c).val()});p.push({name:o+".x",value:f.clk_x},{name:o+".y",value:f.clk_y})}continue}var k=a.fieldValue(c,true);if(k&&k.constructor==Array){for(var m=0,q=k.length;m<q;m++){p.push({name:o,value:k[m]})}}else{if(k!==null&&typeof k!="undefined"){p.push({name:o,value:k})}}}if(!e&&f.clk){var h=a(f.clk),s=h[0],o=s.name;if(o&&!s.disabled&&s.type=="image"){p.push({name:o,value:h.val()});p.push({name:o+".x",value:f.clk_x},{name:o+".y",value:f.clk_y})}}return p};a.fn.formSerialize=function(c){return a.param(this.formToArray(c))};a.fn.fieldSerialize=function(d){var c=[];this.each(function(){var j=this.name;if(!j){return}var h=a.fieldValue(this,d);if(h&&h.constructor==Array){for(var e=0,f=h.length;e<f;e++){c.push({name:j,value:h[e]})}}else{if(h!==null&&typeof h!="undefined"){c.push({name:this.name,value:h})}}});return a.param(c)};a.fn.fieldValue=function(c){for(var e=[],d=0,h=this.length;d<h;d++){var f=this[d];var j=a.fieldValue(f,c);if(j===null||typeof j=="undefined"||(j.constructor==Array&&!j.length)){continue}j.constructor==Array?a.merge(e,j):e.push(j)}return e};a.fieldValue=function(d,k){var m=d.name,e=d.type,j=d.tagName.toLowerCase();if(typeof k=="undefined"){k=true}if(k&&(!m||d.disabled||e=="reset"||e=="button"||(e=="checkbox"||e=="radio")&&!d.checked||(e=="submit"||e=="image")&&d.form&&d.form.clk!=d||j=="select"&&d.selectedIndex==-1)){return null}if(j=="select"){var l=d.selectedIndex;if(l<0){return null}var p=[],c=d.options;var o=(e=="select-one");var q=(o?l+1:c.length);for(var h=(o?l:0);h<q;h++){var s=c[h];if(s.selected){var f=s.value;if(!f){f=(s.attributes&&s.attributes.value&&!(s.attributes.value.specified))?s.text:s.value}if(o){return f}p.push(f)}}return p}return d.value};a.fn.clearForm=function(){return this.each(function(){a("input,select,textarea",this).clearFields()})};a.fn.clearFields=a.fn.clearInputs=function(){return this.each(function(){var d=this.type,c=this.tagName.toLowerCase();if(d=="text"||d=="password"||c=="textarea"){this.value=""}else{if(d=="checkbox"||d=="radio"){this.checked=false}else{if(c=="select"){this.selectedIndex=-1}}}})};a.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};a.fn.enable=function(c){if(c==undefined){c=true}return this.each(function(){this.disabled=!c})};a.fn.selected=function(c){if(c==undefined){c=true}return this.each(function(){var e=this.type;if(e=="checkbox"||e=="radio"){this.checked=c}else{if(this.tagName.toLowerCase()=="option"){var d=a(this).parent("select");if(c&&d[0]&&d[0].type=="select-one"){d.find("option").selected(false)}this.selected=c}}})};function b(){if(a.fn.ajaxSubmit.debug){var c="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(c)}else{if(window.opera&&window.opera.postError){window.opera.postError(c)}}}}})(jQuery);if(typeof jQuery!="undefined"){(function(a){a.fn.extend({loopedSlider:function(c){var b=a.extend({},a.fn.loopedSlider.defaults,c);return this.each(function(){if(a.fn.jquery<"1.3.2"){return}var u=a(this);var s=a.metadata?a.extend({},b,u.metadata()):b;var d=0;var w=1;var n=a(s.slides,u).children().size();var z=a(s.slides,u).children().outerWidth();var x=0;var m=false;var h=0;var v=0;var y=0;var q=a("."+s.pagination+" li a",u);if(s.addPagination&&!a(q).length){var t=n;a(u).append("<ul class="+s.pagination+">");a(s.slides,u).children().each(function(){if(h<t){a("."+s.pagination,u).append("<li><a rel="+(h+1)+' href="#" >'+(h+1)+"</a></li>");h=h+1}else{h=0;return false}a("."+s.pagination+" li a:eq(0)",u).parent().addClass("active")});q=a("."+s.pagination+" li a",u)}else{a(q,u).each(function(){h=h+1;a(this).attr("rel",h);a(q.eq(0),u).parent().addClass("active")})}if(n===1){a(s.slides,u).children().css({position:"absolute",left:x,display:"block"});return}a(s.slides,u).css({width:(n*z)});a(s.slides,u).children().each(function(){a(this).css({position:"absolute",left:x,display:"block"});x=x+z});a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:-z});if(n>3){a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:-z})}if(s.autoHeight){p(w)}a(".next",u).click(function(){if(m===false){l("next",true);if(s.autoStart){if(s.restart){k()}else{clearInterval(sliderIntervalID)}}}return false});a(".previous",u).click(function(){if(m===false){l("prev",true);if(s.autoStart){if(s.restart){k()}else{clearInterval(sliderIntervalID)}}}return false});if(s.containerClick){a(s.container,u).click(function(){if(m===false){l("next",true);if(s.autoStart){if(s.restart){k()}else{clearInterval(sliderIntervalID)}}}return false})}a(q,u).click(function(){if(a(this).parent().hasClass("active")){return false}else{w=a(this).attr("rel");a(q,u).parent().siblings().removeClass("active");a(this).parent().addClass("active");l("fade",w);if(s.autoStart){if(s.restart){k()}else{clearInterval(sliderIntervalID)}}}return false});if(s.autoStart){function f(){if(m===false){l("next",true)}}function j(){sliderIntervalID=setInterval(f,s.autoStart)}u.hover(function(){clearInterval(sliderIntervalID)},j);j();function k(){if(s.restart){clearInterval(sliderIntervalID);clearInterval(v);clearTimeout(y);y=setTimeout(function(){v=setInterval(function(){l("next",true)},s.autoStart)},s.restart)}else{sliderIntervalID=setInterval(function(){if(m===false){l("next",true)}},s.autoStart)}}}function e(o){if(o===n+1){o=1}if(o===0){o=n}a(q,u).parent().siblings().removeClass("active");a(q+"[rel='"+(o)+"']",u).parent().addClass("active")}function p(o){if(o===n+1){o=1}if(o===0){o=n}var A=a(s.slides,u).children(":eq("+(o-1)+")",u).outerHeight();a(s.container,u).animate({height:A},s.autoHeight)}function l(A,o){m=true;switch(A){case"next":w=w+1;d=(-(w*z-z));e(w);if(s.autoHeight){p(w)}if(n<3){if(w===3){a(s.slides,u).children(":eq(0)").css({left:(n*z)})}if(w===2){a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:z})}}a(s.slides,u).animate({left:d},s.slidespeed,function(){if(w===n+1){w=1;a(s.slides,u).css({left:0},function(){a(s.slides,u).animate({left:d})});a(s.slides,u).children(":eq(0)").css({left:0});a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:-z})}if(w===n){a(s.slides,u).children(":eq(0)").css({left:(n*z)})}if(w===n-1){a(s.slides,u).children(":eq("+(n-1)+")").css({left:(n*z-z)})}m=false});break;case"prev":w=w-1;d=(-(w*z-z));e(w);if(s.autoHeight){p(w)}if(n<3){if(w===0){a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:(-z)})}if(w===1){a(s.slides,u).children(":eq(0)").css({position:"absolute",left:0})}}a(s.slides,u).animate({left:d},s.slidespeed,function(){if(w===0){w=n;a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:(n*z-z)});a(s.slides,u).css({left:-(n*z-z)});a(s.slides,u).children(":eq(0)").css({left:(n*z)})}if(w===2){a(s.slides,u).children(":eq(0)").css({position:"absolute",left:0})}if(w===1){a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:-z})}m=false});break;case"fade":w=[w]*1;d=(-(w*z-z));e(w);if(s.autoHeight){p(w)}a(s.slides,u).children().fadeOut(s.fadespeed,function(){a(s.slides,u).css({left:d});a(s.slides,u).children(":eq("+(n-1)+")").css({left:n*z-z});a(s.slides,u).children(":eq(0)").css({left:0});if(w===n){a(s.slides,u).children(":eq(0)").css({left:(n*z)})}if(w===1){a(s.slides,u).children(":eq("+(n-1)+")").css({position:"absolute",left:-z})}a(s.slides,u).children().fadeIn(s.fadespeed);m=false});break;default:break}}})}});a.fn.loopedSlider.defaults={container:".container",slides:".slides",pagination:"pagination",containerClick:true,autoStart:0,restart:0,slidespeed:300,fadespeed:200,autoHeight:0,addPagination:false}})(jQuery)}(function(b){b.widget("ui.formwizard",{_init:function(){var e=this;var f=this.options.formOptions.success;var a=this.options.formOptions.complete;this.options.formOptions=b.extend(this.options.formOptions,{success:function(h,d,c){if(f){f(h,d,c)}if(e.options.formOptions&&e.options.formOptions.resetForm||!e.options.formOptions){e._reset()}},complete:function(c,d){if(a){a(c,d)}e._enableNavigation()}});this.steps=this.element.find(".step").hide();this.firstStep=this.steps.first().attr("id");this.activatedSteps=new Array();this.isLastStep=false;this.previousStep=undefined;this.currentStep=this.steps.eq(0).attr("id");this.nextButton=this.element.find(this.options.next).click(function(){e._next();return false});this.nextButtonInitinalValue=this.nextButton.val();this.nextButton.val(this.options.textNext);this.backButton=this.element.find(this.options.back).click(function(){e._back();return false});this.backButtonInitinalValue=this.backButton.val();this.backButton.val(this.options.textBack);if(this.options.validationEnabled&&jQuery().validate==undefined){this.options.validationEnabled=false;alert("the validation plugin needs to be included")}else{if(this.options.validationEnabled){this.element.validate(this.options.validationOptions)}}if(this.options.formPluginEnabled&&jQuery().ajaxSubmit==undefined){this.options.formPluginEnabled=false;alert("the form plugin needs to be included")}if(this.options.disableInputFields==true){b(this.steps).find(":input").attr("disabled","disabled")}if(this.options.historyEnabled){b(window).bind("hashchange",undefined,function(d){var c=d.getState("_"+b(e.element).attr("id"))||e.firstStep;if(c!==e.currentStep){if(e.options.validationEnabled&&c===e._navigate(e.currentStep)){if(!e.element.valid()){e._updateHistory(e.currentStep);e.element.validate().focusInvalid();return false}}if(c!==e.currentStep){e._show(c)}}});this._updateHistory(this.firstStep)}this._show(undefined);return b(this)},_next:function(){if(this.options.validationEnabled){if(!this.element.valid()){this.element.validate().focusInvalid();return false}}if(this.options.remoteAjax!=undefined){var j=this.options.remoteAjax[this.currentStep];var l=this;if(j!==undefined){var a=j.success;var k=j.beforeSend;var h=j.complete;j=b.extend({},j,{success:function(c,d){if((a!==undefined&&a(c,d))||(a==undefined)){l._continueToNextStep()}},beforeSend:function(c){l._disableNavigation();if(k!==undefined){k(c)}b(l.element).trigger("before_remote_ajax",{currentStep:l.currentStep})},complete:function(c,d){if(h!==undefined){h(c,d)}b(l.element).trigger("after_remote_ajax",{currentStep:l.currentStep});l._enableNavigation()}});this.element.ajaxSubmit(j);return false}}this._continueToNextStep();return false},_back:function(){if(this.activatedSteps.length>0){if(this.options.historyEnabled){this._updateHistory(this.activatedSteps[this.activatedSteps.length-2])}else{this._show(this.activatedSteps[this.activatedSteps.length-2],true)}}return false},_continueToNextStep:function(){if(this.isLastStep){for(var a=0;a<this.activatedSteps.length;a++){this.steps.filter("#"+this.activatedSteps[a]).find(":input").removeAttr("disabled")}if(this.options.formPluginEnabled){this._disableNavigation();this.element.ajaxSubmit(this.options.formOptions);return false}this.element.submit();return false}var d=this._navigate(this.currentStep);if(d==this.currentStep){return}if(this.options.historyEnabled){this._updateHistory(d)}else{this._show(d,true)}},_updateHistory:function(a){var d={};d["_"+b(this.element).attr("id")]=a;b.bbq.pushState(d)},_disableNavigation:function(){this.nextButton.attr("disabled","disabled");this.backButton.attr("disabled","disabled")},_enableNavigation:function(){if(this.isLastStep){this.nextButton.val(this.options.textSubmit)}else{this.nextButton.val(this.options.textNext)}if(b.trim(this.currentStep)!==this.steps.eq(0).attr("id")){this.backButton.removeAttr("disabled")}this.nextButton.removeAttr("disabled")},_animate:function(a,j){this._disableNavigation();var h=this.steps.filter("#"+a);var l=this.steps.filter("#"+j);h.find(":input").attr("disabled","disabled");l.find(":input").removeAttr("disabled");var k=this;h.animate(k.options.outAnimation,k.options.outDuration,k.options.easing,function(){l.animate(k.options.inAnimation,k.options.inDuration,k.options.easing,function(){if(k.options.focusFirstInput){l.find(":input:first").focus()}k._enableNavigation()});return})},_checkIflastStep:function(a){this.isLastStep=false;if(b("#"+a).hasClass(this.options.submitStepClass)||this.steps.filter(":last").attr("id")==a){this.isLastStep=true}},_getLink:function(f){var e=undefined;var a=this.steps.filter("#"+f).find(this.options.linkClass);if(a!=undefined){if(a.filter(":radio,:checkbox").size()>0){e=a.filter(this.options.linkClass+":checked").val()}else{e=b(a).val()}}return e},_navigate:function(f){var e=this._getLink(f);if(e!=undefined){if((e!=""&&e!=null&&e!=undefined)&&this.steps.filter("#"+e).attr("id")!=undefined){return e}return this.currentStep}else{if(e==undefined&&!this.isLastStep){var a=this.steps.filter("#"+f).next().attr("id");return a}}},_show:function(d){var a=false;if(d==undefined||d==""){this.activatedSteps.pop();d=this.firstStep;this.activatedSteps.push(d)}else{if(b.inArray(d,this.activatedSteps)>-1){a=true;this.activatedSteps.pop()}else{this.activatedSteps.push(d)}}if(this.currentStep!==d||d===this.firstStep){this.previousStep=this.currentStep;this._checkIflastStep(d);this.currentStep=d;this._animate(this.previousStep,d)}b(this.element).trigger("step_shown",b.extend({isBackNavigation:a},this._state()))},_reset:function(){this.element.resetForm();b("label,:input,textarea",this).removeClass("error");for(var a=0;a<this.activatedSteps.length;a++){this.steps.filter("#"+this.activatedSteps[a]).hide().find(":input").attr("disabled","disabled")}this.activatedSteps=new Array();this.previousStep=undefined;this.isLastStep=false;if(this.options.historyEnabled){this._updateHistory(this.firstStep)}else{this._show(this.firstStep)}},_state:function(d){var a={settings:this.options,activatedSteps:this.activatedSteps,isLastStep:this.isLastStep,isFirstStep:this.currentStep===this.firstStep,previousStep:this.previousStep,currentStep:this.currentStep,backButton:this.backButton,nextButton:this.nextButton,steps:this.steps,firstStep:this.firstStep};if(d!==undefined){return a[d]}return a},show:function(a){if(this.options.historyEnabled){this._updateHistory(a)}else{this._show(a)}},state:function(a){return this._state(a)},reset:function(){this._reset()},next:function(){this._next()},back:function(){this._back()},destroy:function(){this.element.find("*").removeAttr("disabled").show();this.nextButton.unbind("click").val(this.nextButtonInitinalValue);this.backButton.unbind("click").val(this.backButtonInitinalValue);this.backButtonInitinalValue=undefined;this.nextButtonInitinalValue=undefined;this.activatedSteps=undefined;this.previousStep=undefined;this.currentStep=undefined;this.isLastStep=undefined;this.options=undefined;this.nextButton=undefined;this.backButton=undefined;this.formwizard=undefined;this.element=undefined;this.steps=undefined;this.firstStep=undefined},update_steps:function(){this.steps=this.element.find(".step");this.steps.not("#"+this.currentStep).hide()},options:{historyEnabled:false,validationEnabled:false,validationOptions:undefined,formPluginEnabled:false,linkClass:".link",submitStepClass:"submit_step",back:":reset",next:":submit",textSubmit:"Submit",textNext:"Next",textBack:"Back",remoteAjax:undefined,inAnimation:{opacity:"show"},outAnimation:{opacity:"hide"},inDuration:400,outDuration:400,easing:"swing",focusFirstInput:false,disableInputFields:true,formOptions:{reset:true,success:function(a){alert("success")}}}})})(jQuery);jQuery.ptTimeSelect={};jQuery.ptTimeSelect.options={containerClass:undefined,containerWidth:undefined,hoursLabel:"Hour",minutesLabel:"Minutes",setButtonLabel:"Set",popupImage:undefined,onFocusDisplay:true,zIndex:10,onBeforeShow:undefined,onClose:undefined};jQuery.ptTimeSelect._ptTimeSelectInit=function(){jQuery(document).ready(function(){if(!jQuery("#ptTimeSelectCntr").length){jQuery("body").append('<div id="ptTimeSelectCntr" class="">		<div class="ui-widget ui-widget-content ui-corner-all">		<div class="ui-widget-header ui-corner-all">			<div id="ptTimeSelectCloseCntr" style="float: right;">				<a href="javascript: void(0);" onclick="jQuery.ptTimeSelect.closeCntr();" 						onmouseover="jQuery(this).removeClass(\'ui-state-default\').addClass(\'ui-state-hover\');" 						onmouseout="jQuery(this).removeClass(\'ui-state-hover\').addClass(\'ui-state-default\');"						class="ui-corner-all ui-state-default">					<span class="ui-icon ui-icon-circle-close">X</span>				</a>			</div>			<div id="ptTimeSelectUserTime" style="float: left;">				<span id="ptTimeSelectUserSelHr">1</span> : 				<span id="ptTimeSelectUserSelMin">00</span> 				<span id="ptTimeSelectUserSelAmPm">AM</span>			</div>			<br style="clear: both;" /><div></div>		</div>		<div class="ui-widget-content ui-corner-all">			<div>				<div class="ptTimeSelectTimeLabelsCntr">					<div class="ptTimeSelectLeftPane" style="width: 50%; text-align: center; float: left;" class="">Hour</div>					<div class="ptTimeSelectRightPane" style="width: 50%; text-align: center; float: left;">Minutes</div>				</div>				<div>					<div style="float: left; width: 50%;">						<div class="ui-widget-content ptTimeSelectLeftPane">							<div class="ptTimeSelectHrAmPmCntr">								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);" 										style="display: block; width: 45%; float: left;">AM</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);" 										style="display: block; width: 45%; float: left;">PM</a>								<br style="clear: left;" /><div></div>							</div>							<div class="ptTimeSelectHrCntr">								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">1</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">2</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">3</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">4</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">5</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">6</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">7</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">8</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">9</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">10</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">11</a>								<a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">12</a>								<br style="clear: left;" /><div></div>							</div>						</div>					</div>					<div style="width: 50%; float: left;">						<div class="ui-widget-content ptTimeSelectRightPane">							<div class="ptTimeSelectMinCntr">								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">00</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">05</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">10</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">15</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">20</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">25</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">30</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">35</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">40</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">45</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">50</a>								<a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">55</a>								<br style="clear: left;" /><div></div>							</div>						</div>					</div>				</div>			</div>			<div style="clear: left;"></div>		</div>		<div id="ptTimeSelectSetButton">			<a href="javascript: void(0);" onclick="jQuery.ptTimeSelect.setTime()"					onmouseover="jQuery(this).removeClass(\'ui-state-default\').addClass(\'ui-state-hover\');" 						onmouseout="jQuery(this).removeClass(\'ui-state-hover\').addClass(\'ui-state-default\');"						class="ui-corner-all ui-state-default">				SET			</a>			<br style="clear: both;" /><div></div>		</div>		<!--[if lte IE 6.5]>			<iframe style="display:block; position:absolute;top: 0;left:0;z-index:-1;				filter:Alpha(Opacity=\'0\');width:3000px;height:3000px"></iframe>		<![endif]-->	</div></div>');var b=jQuery("#ptTimeSelectCntr");b.find(".ptTimeSelectMin").bind("click",function(){jQuery.ptTimeSelect.setMin($(this).text())});b.find(".ptTimeSelectHr").bind("click",function(){jQuery.ptTimeSelect.setHr($(this).text())});$(document).mousedown(jQuery.ptTimeSelect._doCheckMouseClick)}})}();jQuery.ptTimeSelect.setHr=function(b){if(b.toLowerCase()=="am"||b.toLowerCase()=="pm"){jQuery("#ptTimeSelectUserSelAmPm").empty().append(b)}else{jQuery("#ptTimeSelectUserSelHr").empty().append(b)}this.updateTime()};jQuery.ptTimeSelect.setMin=function(b){jQuery("#ptTimeSelectUserSelMin").empty().append(b);this.updateTime()};jQuery.ptTimeSelect.updateTime=function(){var b=jQuery("#ptTimeSelectUserSelHr").text()+":"+jQuery("#ptTimeSelectUserSelMin").text()+" "+jQuery("#ptTimeSelectUserSelAmPm").text();jQuery(".isPtTimeSelectActive").val(b)};jQuery.ptTimeSelect.setTime=function(){var b=jQuery("#ptTimeSelectUserSelHr").text()+":"+jQuery("#ptTimeSelectUserSelMin").text()+" "+jQuery("#ptTimeSelectUserSelAmPm").text();jQuery(".isPtTimeSelectActive").val(b);jQuery(".isPtTimeSelectActive").valid();this.closeCntr()};jQuery.ptTimeSelect.openCntr=function(n){jQuery.ptTimeSelect.closeCntr();jQuery(".isPtTimeSelectActive").removeClass("isPtTimeSelectActive");var u=jQuery("#ptTimeSelectCntr");var s=jQuery(n).eq(0).addClass("isPtTimeSelectActive");var p=s.data("ptTimeSelectOptions");var o=s.offset();o["z-index"]=p.zIndex;o.top=(o.top+s.outerHeight());if(p.containerWidth){o.width=p.containerWidth}if(p.containerClass){u.addClass(p.containerClass)}u.css(o);var v=1;var q="00";var l="PM";if(s.val()){var m=/([0-9]{1,2}).*:.*([0-9]{2}).*(PM|AM)/i;var t=m.exec(s.val());if(t){v=t[1]||1;q=t[2]||"00";l=t[3]||"PM"}}u.find("#ptTimeSelectUserSelHr").empty().append(v);u.find("#ptTimeSelectUserSelMin").empty().append(q);u.find("#ptTimeSelectUserSelAmPm").empty().append(l);u.find(".ptTimeSelectTimeLabelsCntr .ptTimeSelectLeftPane").empty().append(p.hoursLabel);u.find(".ptTimeSelectTimeLabelsCntr .ptTimeSelectRightPane").empty().append(p.minutesLabel);u.find("#ptTimeSelectSetButton a").empty().append(p.setButtonLabel);if(p.onBeforeShow){p.onBeforeShow(s,u)}u.slideDown("fast")};jQuery.ptTimeSelect.closeCntr=function(e){var f=$("#ptTimeSelectCntr");if(f.is(":visible")==true){if(jQuery.support.tbody==false){if(!(f[0].offsetWidth>0)&&!(f[0].offsetHeight>0)){return}}jQuery("#ptTimeSelectCntr").css("display","none").removeClass().css("width","");if(!e){e=$(".isPtTimeSelectActive")}if(e){var d=e.removeClass("isPtTimeSelectActive").data("ptTimeSelectOptions");if(d&&d.onClose){d.onClose(e)}}}return};jQuery.ptTimeSelect._doCheckMouseClick=function(b){if(!$("#ptTimeSelectCntr:visible").length){return}if(!jQuery(b.target).closest("#ptTimeSelectCntr").length){jQuery.ptTimeSelect.closeCntr()}};jQuery.fn.ptTimeSelect=function(b){this.each(function(){if(this.nodeName.toLowerCase()!="input"){return}var f=jQuery(this);if(f.hasClass("hasPtTimeSelect")){return this}var e={};e=$.extend(e,jQuery.ptTimeSelect.options,b);f.addClass("hasPtTimeSelect").data("ptTimeSelectOptions",e);if(e.popupImage||!e.onFocusDisplay){var a=jQuery('<span>&nbsp;</span><a href="javascript:" onclick="jQuery.ptTimeSelect.openCntr(jQuery(this).data(\'ptTimeSelectEle\'));">'+e.popupImage+"</a>").data("ptTimeSelectEle",f);f.after(a)}if(e.onFocusDisplay){f.focus(function(){jQuery.ptTimeSelect.openCntr(this)})}return this})};(function(a){a.fn.stickyPopUp=function(){var j=this;var e=j.find(".popup");var b=j.find("a:first");var d=false;var h=true;function k(){h=false;if(d){return}d=true;a(".popup:visible").not(e).each(function(){a(this).data("stickyPopUpHide")()});e.show(200,function(){e.find("input:first").focus()})}function c(){h=true}function f(){d=false;e.hide(200)}e.data("stickyPopUpHide",f);b.click(function(l){if(d){e.find("input:first").focus()}else{k()}l.preventDefault()});j.find("input").hover(k,k);j.hover(k,c);a(document).mouseup(function(){if(h){f()}})}})(jQuery);(function(a){a.jgrid={defaults:{recordtext:"View {0} - {1} of {2}",emptyrecords:"No records to view",loadtext:"Loading...",pgtext:"Page {0} of {1}"},search:{caption:"Search...",Find:"Find",Reset:"Reset",odata:["equal","not equal","less","less or equal","greater","greater or equal","begins with","does not begin with","is in","is not in","ends with","does not end with","contains","does not contain"],groupOps:[{op:"AND",text:"all"},{op:"OR",text:"any"}],matchText:" match",rulesText:" rules"},edit:{addCaption:"Add Record",editCaption:"Edit Record",bSubmit:"Submit",bCancel:"Cancel",bClose:"Close",saveData:"Data has been changed! Save changes?",bYes:"Yes",bNo:"No",bExit:"Cancel",msg:{required:"Field is required",number:"Please, enter valid number",minValue:"value must be greater than or equal to ",maxValue:"value must be less than or equal to",email:"is not a valid e-mail",integer:"Please, enter valid integer value",date:"Please, enter valid date value",url:"is not a valid URL. Prefix required ('http://' or 'https://')",nodefined:" is not defined!",novalue:" return value is required!",customarray:"Custom function should return array!",customfcheck:"Custom function should be present in case of custom checking!"}},view:{caption:"View Record",bClose:"Close"},del:{caption:"Delete",msg:"Delete selected record(s)?",bSubmit:"Delete",bCancel:"Cancel"},nav:{edittext:"",edittitle:"Edit selected row",addtext:"",addtitle:"Add new row",deltext:"",deltitle:"Delete selected row",searchtext:"",searchtitle:"Find records",refreshtext:"",refreshtitle:"Reload Grid",alertcap:"Warning",alerttext:"Please, select row",viewtext:"",viewtitle:"View selected row"},col:{caption:"Select columns",bSubmit:"Ok",bCancel:"Cancel"},errors:{errcap:"Error",nourl:"No url is set",norecords:"No records to process",model:"Length of colNames <> colModel!"},formatter:{integer:{thousandsSeparator:" ",defaultValue:"0"},number:{decimalSeparator:".",thousandsSeparator:" ",decimalPlaces:2,defaultValue:"0.00"},currency:{decimalSeparator:".",thousandsSeparator:" ",decimalPlaces:2,prefix:"",suffix:"",defaultValue:"0.00"},date:{dayNames:["Sun","Mon","Tue","Wed","Thr","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],AmPm:["am","pm","AM","PM"],S:function(b){return b<11||b>13?["st","nd","rd","th"][Math.min((b-1)%10,3)]:"th"},srcformat:"Y-m-d",newformat:"d/m/Y",masks:{ISO8601Long:"Y-m-d H:i:s",ISO8601Short:"Y-m-d",ShortDate:"n/j/Y",LongDate:"l, F d, Y",FullDateTime:"l, F d, Y g:i:s A",MonthDay:"F d",ShortTime:"g:i A",LongTime:"g:i:s A",SortableDateTime:"Y-m-d\\TH:i:s",UniversalSortableDateTime:"Y-m-d H:i:sO",YearMonth:"F, Y"},reformatAfterEdit:false},baseLinkUrl:"",showAction:"",target:"",checkbox:{disabled:true},idName:"id"}}})(jQuery);(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f&&(f=="&nbsp;"||f=="&#160;"||f.length==1&&f.charCodeAt(0)==160)){return""}return !f?f:String(f).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(f){return !f?f:String(f).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(f){var j=b.makeArray(arguments).slice(1);if(f===undefined){f=""}return f.replace(/\{(\d+)\}/g,function(h,c){return j[c]})},getCellIndex:function(f){f=b(f);if(f.is("tr")){return -1}f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie){return b.inArray(f,f.parentNode.cells)}return f.cellIndex},stripHtml:function(f){f+="";var j=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f){return(f=f.replace(j,""))&&f!=="&nbsp;"&&f!=="&#160;"?f.replace(/\"/g,"'"):""}else{return f}},stringToDoc:function(f){var j;if(typeof f!=="string"){return f}try{j=(new DOMParser).parseFromString(f,"text/xml")}catch(h){j=new ActiveXObject("Microsoft.XMLDOM");j.async=false;j.loadXML(f)}return j&&j.documentElement&&j.documentElement.tagName!="parsererror"?j:null},parse:function(f){if(f.substr(0,9)=="while(1);"){f=f.substr(9)}if(f.substr(0,2)=="/*"){f=f.substr(2,f.length-4)}f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(f):eval("("+f+")")},parseDate:function(f,j){var h={m:1,d:1,y:1970,h:0,i:0,s:0},c,g,k;c=/[\\\/:_;.,\t\T\s-]/;if(j&&j!==null&&j!==undefined){j=b.trim(j);j=j.split(c);f=f.split(c);var l=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,r=function(v,z){if(v===0){if(z==12){z=0}}else{if(z!=12){z+=12}}return z};c=0;for(g=f.length;c<g;c++){if(f[c]=="M"){k=b.inArray(j[c],l);if(k!==-1&&k<12){j[c]=k+1}}if(f[c]=="F"){k=b.inArray(j[c],l);if(k!==-1&&k>11){j[c]=k+1-12}}if(f[c]=="a"){k=b.inArray(j[c],a);if(k!==-1&&k<2&&j[c]==a[k]){j[c]=k;h.h=r(j[c],h.h)}}if(f[c]=="A"){k=b.inArray(j[c],a);if(k!==-1&&k>1&&j[c]==a[k]){j[c]=k-2;h.h=r(j[c],h.h)}}if(j[c]!==undefined){h[f[c].toLowerCase()]=parseInt(j[c],10)}}h.m=parseInt(h.m,10)-1;c=h.y;if(c>=70&&c<=99){h.y=1900+h.y}else{if(c>=0&&c<=69){h.y=2000+h.y}}}return new Date(h.y,h.m,h.d,h.h,h.i,h.s,0)},jqID:function(f){f+="";return f.replace(/([\.\:\[\]])/g,"\\$1")},guid:1,uidPref:"jqg",randId:function(f){return(f?f:b.jgrid.uidPref)+b.jgrid.guid++},getAccessor:function(f,j){var h,c,g=[],k;if(typeof j==="function"){return j(f)}h=f[j];if(h===undefined){try{if(typeof j==="string"){g=j.split(".")}if(k=g.length){for(h=f;h&&k--;){c=g.shift();h=h[c]}}}catch(l){}}return h},ajaxOptions:{},from:function(f){return new function(j,h){if(typeof j=="string"){j=b.data(j)}var c=this,g=j,k=true,l=false,a=h,r=/[\$,%]/g,v=null,z=null,E=false,P="",K=[],O=true;if(typeof j=="object"&&j.push){if(j.length>0){O=typeof j[0]!="object"?false:true}}else{throw"data provides is not an array"}this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(m){var o=[];l&&o.push("jQuery.trim(");o.push("String("+m+")");l&&o.push(")");k||o.push(".toLowerCase()");return o.join("")};this._strComp=function(m){return typeof m=="string"?".toString()":""};this._group=function(m,o){return{field:m.toString(),unique:o,items:[]}};this._toStr=function(m){if(l){m=b.trim(m)}k||(m=m.toLowerCase());return m=m.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(m){var o=[];b.each(g,function(q,B){o.push(m(B))});return o};this._append=function(m){if(a===null){a=""}else{a+=P===""?" && ":P}if(E){a+="!"}a+="("+m+")";E=false;P=""};this._setCommand=function(m,o){v=m;z=o};this._resetNegate=function(){E=false};this._repeatCommand=function(m,o){if(v===null){return c}if(m!==null&&o!==null){return v(m,o)}if(z===null){return v(m)}if(!O){return v(m)}return v(z,m)};this._equals=function(m,o){return c._compare(m,o,1)===0};this._compare=function(m,o,q){if(q===undefined){q=1}if(m===undefined){m=null}if(o===undefined){o=null}if(m===null&&o===null){return 0}if(m===null&&o!==null){return 1}if(m!==null&&o===null){return -1}if(!k&&typeof m!=="number"&&typeof o!=="number"){m=String(m).toLowerCase();o=String(o).toLowerCase()}if(m<o){return -q}if(m>o){return q}return 0};this._performSort=function(){if(K.length!==0){g=c._doSort(g,0)}};this._doSort=function(m,o){var q=K[o].by,B=K[o].dir,T=K[o].type,J=K[o].datefmt;if(o==K.length-1){return c._getOrder(m,q,B,T,J)}o++;q=c._getGroup(m,q,B,T,J);B=[];for(T=0;T<q.length;T++){J=c._doSort(q[T].items,o);for(var D=0;D<J.length;D++){B.push(J[D])}}return B};this._getOrder=function(m,o,q,B,T){var J=[],D=[],W=q=="a"?1:-1,U,ga;if(B===undefined){B="text"}ga=B=="float"||B=="number"||B=="currency"||B=="numeric"?function(S){S=parseFloat(String(S).replace(r,""));return isNaN(S)?0:S}:B=="int"||B=="integer"?function(S){return S?parseFloat(String(S).replace(r,"")):0}:B=="date"||B=="datetime"?function(S){return b.jgrid.parseDate(T,S).getTime()}:b.isFunction(B)?B:function(S){S||(S="");return b.trim(String(S).toUpperCase())};b.each(m,function(S,aa){U=o!==""?b.jgrid.getAccessor(aa,o):aa;if(U===undefined){U=""}U=ga(U,aa);D.push({vSort:U,index:S})});D.sort(function(S,aa){S=S.vSort;aa=aa.vSort;return c._compare(S,aa,W)});B=0;for(var ca=m.length;B<ca;){q=D[B].index;J.push(m[q]);B++}return J};this._getGroup=function(m,o,q,B,T){var J=[],D=null,W=null,U;b.each(c._getOrder(m,o,q,B,T),function(ga,ca){U=b.jgrid.getAccessor(ca,o);if(U===undefined){U=""}if(!c._equals(W,U)){W=U;D!==null&&J.push(D);D=c._group(o,U)}D.items.push(ca)});D!==null&&J.push(D);return J};this.ignoreCase=function(){k=false;return c};this.useCase=function(){k=true;return c};this.trim=function(){l=true;return c};this.noTrim=function(){l=false;return c};this.execute=function(){var m=a,o=[];if(m===null){return c}b.each(g,function(){eval(m)&&o.push(this)});g=o;return c};this.data=function(){return g};this.select=function(m){c._performSort();if(!c._hasData()){return[]}c.execute();if(b.isFunction(m)){var o=[];b.each(g,function(q,B){o.push(m(B))});return o}return g};this.hasMatch=function(){if(!c._hasData()){return false}c.execute();return g.length>0};this.andNot=function(m,o,q){E=!E;return c.and(m,o,q)};this.orNot=function(m,o,q){E=!E;return c.or(m,o,q)};this.not=function(m,o,q){return c.andNot(m,o,q)};this.and=function(m,o,q){P=" && ";if(m===undefined){return c}return c._repeatCommand(m,o,q)};this.or=function(m,o,q){P=" || ";if(m===undefined){return c}return c._repeatCommand(m,o,q)};this.isNot=function(m){E=!E;return c.is(m)};this.is=function(m){c._append("this."+m);c._resetNegate();return c};this._compareValues=function(m,o,q,B,T){var J;J=O?"jQuery.jgrid.getAccessor(this,'"+o+"')":"this";if(q===undefined){q=null}var D=q,W=T.stype===undefined?"text":T.stype;if(q!==null){switch(W){case"int":case"integer":D=isNaN(Number(D))||D===""?"0":D;J="parseInt("+J+",10)";D="parseInt("+D+",10)";break;case"float":case"number":case"numeric":D=String(D).replace(r,"");D=isNaN(Number(D))||D===""?"0":D;J="parseFloat("+J+")";D="parseFloat("+D+")";break;case"date":case"datetime":D=String(b.jgrid.parseDate(T.newfmt||"Y-m-d",D).getTime());J='jQuery.jgrid.parseDate("'+T.srcfmt+'",'+J+").getTime()";break;default:J=c._getStr(J);D=c._getStr('"'+c._toStr(D)+'"')}}c._append(J+" "+B+" "+D);c._setCommand(m,o);c._resetNegate();return c};this.equals=function(m,o,q){return c._compareValues(c.equals,m,o,"==",q)};this.notEquals=function(m,o,q){return c._compareValues(c.equals,m,o,"!==",q)};this.isNull=function(m,o,q){return c._compareValues(c.equals,m,null,"===",q)};this.greater=function(m,o,q){return c._compareValues(c.greater,m,o,">",q)};this.less=function(m,o,q){return c._compareValues(c.less,m,o,"<",q)};this.greaterOrEquals=function(m,o,q){return c._compareValues(c.greaterOrEquals,m,o,">=",q)};this.lessOrEquals=function(m,o,q){return c._compareValues(c.lessOrEquals,m,o,"<=",q)};this.startsWith=function(m,o){var q=o===undefined||o===null?m:o;q=l?b.trim(q.toString()).length:q.toString().length;if(O){c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+m+"')")+".substr(0,"+q+") == "+c._getStr('"'+c._toStr(o)+'"'))}else{q=l?b.trim(o.toString()).length:o.toString().length;c._append(c._getStr("this")+".substr(0,"+q+") == "+c._getStr('"'+c._toStr(m)+'"'))}c._setCommand(c.startsWith,m);c._resetNegate();return c};this.endsWith=function(m,o){var q=o===undefined||o===null?m:o;q=l?b.trim(q.toString()).length:q.toString().length;O?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+m+"')")+".substr("+c._getStr("jQuery.jgrid.getAccessor(this,'"+m+"')")+".length-"+q+","+q+') == "'+c._toStr(o)+'"'):c._append(c._getStr("this")+".substr("+c._getStr("this")+'.length-"'+c._toStr(m)+'".length,"'+c._toStr(m)+'".length) == "'+c._toStr(m)+'"');c._setCommand(c.endsWith,m);c._resetNegate();return c};this.contains=function(m,o){O?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+m+"')")+'.indexOf("'+c._toStr(o)+'",0) > -1'):c._append(c._getStr("this")+'.indexOf("'+c._toStr(m)+'",0) > -1');c._setCommand(c.contains,m);c._resetNegate();return c};this.groupBy=function(m,o,q,B){if(!c._hasData()){return null}return c._getGroup(g,m,o,q,B)};this.orderBy=function(m,o,q,B){o=o===undefined||o===null?"a":b.trim(o.toString().toLowerCase());if(q===null||q===undefined){q="text"}if(B===null||B===undefined){B="Y-m-d"}if(o=="desc"||o=="descending"){o="d"}if(o=="asc"||o=="ascending"){o="a"}K.push({by:m,dir:o,type:q,datefmt:B});return c};return c}(f,null)},extend:function(f){b.extend(b.fn.jqGrid,f);this.no_legacy_api||b.fn.extend(f)}});b.fn.jqGrid=function(f){if(typeof f=="string"){var j=b.jgrid.getAccessor(b.fn.jqGrid,f);if(!j){throw"jqGrid - No such method: "+f}var h=b.makeArray(arguments).slice(1);return j.apply(this,h)}return this.each(function(){if(!this.grid){var c=b.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{}},b.jgrid.defaults,f||{}),g={headers:[],cols:[],footers:[],dragStart:function(e,d,i){this.resizing={idx:e,startX:d.clientX,sOL:i[0]};this.hDiv.style.cursor="col-resize";this.curGbox=b("#rs_m"+b.jgrid.jqID(c.id),"#gbox_"+b.jgrid.jqID(c.id));this.curGbox.css({display:"block",left:i[0],top:i[1],height:i[2]});b.isFunction(c.resizeStart)&&c.resizeStart.call(this,d,e);document.onselectstart=function(){return false}},dragMove:function(e){if(this.resizing){var d=e.clientX-this.resizing.startX;e=this.headers[this.resizing.idx];var i=c.direction==="ltr"?e.width+d:e.width-d,n;if(i>33){this.curGbox.css({left:this.resizing.sOL+d});if(c.forceFit===true){n=this.headers[this.resizing.idx+c.nv];d=c.direction==="ltr"?n.width-d:n.width+d;if(d>33){e.newWidth=i;n.newWidth=d}}else{this.newWidth=c.direction==="ltr"?c.tblwidth+d:c.tblwidth-d;e.newWidth=i}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var e=this.resizing.idx,d=this.headers[e].newWidth||this.headers[e].width;d=parseInt(d,10);this.resizing=false;b("#rs_m"+b.jgrid.jqID(c.id)).css("display","none");c.colModel[e].width=d;this.headers[e].width=d;this.headers[e].el.style.width=d+"px";this.cols[e].style.width=d+"px";if(this.footers.length>0){this.footers[e].style.width=d+"px"}if(c.forceFit===true){d=this.headers[e+c.nv].newWidth||this.headers[e+c.nv].width;this.headers[e+c.nv].width=d;this.headers[e+c.nv].el.style.width=d+"px";this.cols[e+c.nv].style.width=d+"px";if(this.footers.length>0){this.footers[e+c.nv].style.width=d+"px"}c.colModel[e+c.nv].width=d}else{c.tblwidth=this.newWidth||c.tblwidth;b("table:first",this.bDiv).css("width",c.tblwidth+"px");b("table:first",this.hDiv).css("width",c.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(c.footerrow){b("table:first",this.sDiv).css("width",c.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(c.resizeStop)&&c.resizeStop.call(this,d,e)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var e=b(g.bDiv).height();if(e){var d=b("table:first",g.bDiv),i,n;if(d[0].rows.length){try{n=(i=d[0].rows[1])?b(i).outerHeight()||g.prevRowHeight:g.prevRowHeight}catch(p){n=g.prevRowHeight}}if(n){g.prevRowHeight=n;var A=c.rowNum;i=g.scrollTop=g.bDiv.scrollTop;var s=Math.round(d.position().top)-i,F=s+d.height();n*=A;var t,y,x;if(F<e&&s<=0&&(c.lastpage===undefined||parseInt((F+i+n-1)/n,10)<=c.lastpage)){y=parseInt((e-F+n-1)/n,10);if(F>=0||y<2||c.scroll===true){t=Math.round((F+i)/n)+1;s=-1}else{s=1}}if(s>0){t=parseInt(i/n,10)+1;y=parseInt((i+e)/n,10)+2-t;x=true}if(y){if(!(c.lastpage&&t>c.lastpage||c.lastpage==1||t===c.page&&t===c.lastpage)){if(g.hDiv.loading){g.timer=setTimeout(g.populateVisible,c.scrollTimeout)}else{c.page=t;if(x){g.selectionPreserver(d[0]);g.emptyRows(g.bDiv,false,false)}g.populate(y)}}}}}},scrollGrid:function(e){if(c.scroll){var d=g.bDiv.scrollTop;if(g.scrollTop===undefined){g.scrollTop=0}if(d!=g.scrollTop){g.scrollTop=d;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,c.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(c.footerrow){g.sDiv.scrollLeft=g.bDiv.scrollLeft}e.stopPropagation()},selectionPreserver:function(e){var d=e.p,i=d.selrow,n=d.selarrrow?b.makeArray(d.selarrrow):null,p=e.grid.bDiv.scrollLeft,A=d.gridComplete;d.gridComplete=function(){d.selrow=null;d.selarrrow=[];if(d.multiselect&&n&&n.length>0){for(var s=0;s<n.length;s++){n[s]!=i&&b(e).jqGrid("setSelection",n[s],false)}}i&&b(e).jqGrid("setSelection",i,false);e.grid.bDiv.scrollLeft=p;d.gridComplete=A;d.gridComplete&&A()}}};if(this.tagName!="TABLE"){alert("Element is not a table")}else{b(this).empty().attr("tabindex","1");this.p=c;var k,l,a;if(this.p.colNames.length===0){for(k=0;k<this.p.colModel.length;k++){this.p.colNames[k]=this.p.colModel[k].label||this.p.colModel[k].name}}if(this.p.colNames.length!==this.p.colModel.length){alert(b.jgrid.errors.model)}else{var r=b("<div class='ui-jqgrid-view'></div>"),v,z=b.browser.msie?true:false,E=b.browser.webkit||b.browser.safari?true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1){a.p.direction="ltr"}l=a.p.direction;b(r).insertBefore(this);b(this).appendTo(r).removeClass("scroll");var P=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(P).insertBefore(r).attr({id:"gbox_"+this.id,dir:l});b(r).appendTo(P).attr("id","gview_"+this.id);v=z&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(v).insertBefore(r);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(r);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var K=function(e,d){e=parseInt(e,10);return isNaN(e)?d?d:0:e},O=function(e,d,i,n,p,A){var s=a.p.colModel[e],F=s.align,t='style="',y=s.classes,x=s.name,w=[];if(F){t+="text-align:"+F+";"}if(s.hidden===true){t+="display:none;"}if(d===0){t+="width: "+g.headers[e].width+"px;"}else{if(s.cellattr&&b.isFunction(s.cellattr)){if((e=s.cellattr.call(a,p,i,n,s,A))&&typeof e==="string"){e=e.replace(/style/i,"style").replace(/title/i,"title");if(e.indexOf("title")>-1){s.title=false}if(e.indexOf("class")>-1){y=undefined}w=e.split("style");if(w.length===2){w[1]=b.trim(w[1].replace("=",""));if(w[1].indexOf("'")===0||w[1].indexOf('"')===0){w[1]=w[1].substring(1)}t+=w[1].replace(/'/gi,'"')}else{t+='"'}}}}if(!w.length){w[0]="";t+='"'}t+=(y!==undefined?' class="'+y+'"':"")+(s.title&&i?' title="'+b.jgrid.stripHtml(i)+'"':"");t+=' aria-describedby="'+a.p.id+"_"+x+'"';return t+w[0]},m=function(e){return e===undefined||e===null||e===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(e):e+""},o=function(e,d,i,n,p){var A=a.p.colModel[i];if(typeof A.formatter!=="undefined"){e={rowId:e,colModel:A,gid:a.p.id,pos:i};d=b.isFunction(A.formatter)?A.formatter.call(a,d,e,n,p):b.fmatter?b.fn.fmatter(A.formatter,d,e,n,p):m(d)}else{d=m(d)}return d},q=function(e,d,i,n,p){d=o(e,d,i,p,"add");return'<td role="gridcell" '+O(i,n,d,p,e,true)+">"+d+"</td>"},B=function(e,d,i){var n='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+e+'" class="cbox" name="jqg_'+a.p.id+"_"+e+'"/>';return'<td role="gridcell" '+O(d,i,"",null,e,true)+">"+n+"</td>"},T=function(e,d,i,n){i=(parseInt(i,10)-1)*parseInt(n,10)+1+d;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+O(e,d,i,null,d,true)+">"+i+"</td>"},J=function(e){var d,i=[],n=0,p;for(p=0;p<a.p.colModel.length;p++){d=a.p.colModel[p];if(d.name!=="cb"&&d.name!=="subgrid"&&d.name!=="rn"){i[n]=e=="local"?d.name:e=="xml"?d.xmlmap||d.name:d.jsonmap||d.name;n++}}return i},D=function(e){var d=a.p.remapColumns;if(!d||!d.length){d=b.map(a.p.colModel,function(i,n){return n})}if(e){d=b.map(d,function(i){return i<e?null:i-e})}return d},W=function(e,d,i){if(a.p.deepempty){b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:gt(0)").remove()}else{var n=b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").empty().append(n)}if(d&&a.p.scroll){b(">div:first",e).css({height:"auto"}).children("div:first").css({height:0,display:"none"});e.scrollTop=0}if(i===true){if(a.p.treeGrid===true){a.p.data=[];a.p._index={}}}},U=function(){var e=a.p.data.length,d,i,n;d=a.p.rownumbers===true?1:0;i=a.p.multiselect===true?1:0;n=a.p.subGrid===true?1:0;d=a.p.keyIndex===false||a.p.loadonce===true?a.p.localReader.id:a.p.colModel[a.p.keyIndex+i+n+d].name;for(i=0;i<e;i++){n=b.jgrid.getAccessor(a.p.data[i],d);a.p._index[n]=i}},ga=function(e,d,i,n,p){var A=new Date,s=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="xmlstring",F=a.p.datatype=="local"?"local":"xml";if(s){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(b.isXMLDoc(e)){if(a.p.treeANode===-1&&!a.p.scroll){W(d,false,true);i=1}else{i=i>1?i:1}var t,y,x=0,w,G=0,Q=0,M=0,L,N=[],Y,I={},u,C,H=[],ha=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(N=J(F));L=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(N.length>0&&!isNaN(L)){if(a.p.remapColumns&&a.p.remapColumns.length){L=b.inArray(L,a.p.remapColumns)}L=N[L]}F=(L+"").indexOf("[")===-1?N.length?function(ea,$){return b(L,ea).text()||$}:function(ea,$){return b(a.p.xmlReader.cell,ea).eq(L).text()||$}:function(ea,$){return ea.getAttribute(L.replace(/[\[\]]/g,""))||$};a.p.userData={};b(a.p.xmlReader.page,e).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,e).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined){a.p.lastpage=1}});b(a.p.xmlReader.records,e).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,e).each(function(){a.p.userData[this.getAttribute("name")]=this.textContent||this.text});(e=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,e))||(e=[]);var V=e.length,Z=0,ia={},fa;if(e&&V){fa=parseInt(a.p.rowNum,10);var ra=a.p.scroll?b.jgrid.randId():1;if(p){fa*=p+1}p=b.isFunction(a.p.afterInsertRow);var oa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true){oa=' style="display:none;"'}for(;Z<V;){u=e[Z];C=F(u,ra+Z);t=i===0?0:i+1;t=(t+Z)%2==1?ha:"";H.push("<tr"+oa+' id="'+C+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+a.p.direction+""+t+'">');if(a.p.rownumbers===true){H.push(T(0,Z,a.p.page,a.p.rowNum));M=1}if(a.p.multiselect===true){H.push(B(C,M,Z));G=1}if(a.p.subGrid===true){H.push(b(a).jqGrid("addSubGridCell",G+M,Z+i));Q=1}if(a.p.xmlReader.repeatitems){Y||(Y=D(G+Q+M));var Ba=b(a.p.xmlReader.cell,u);b.each(Y,function(ea){var $=Ba[this];if(!$){return false}w=$.textContent||$.text;I[a.p.colModel[ea+G+Q+M].name]=w;H.push(q(C,w,ea+G+Q+M,Z+i,u))})}else{for(t=0;t<N.length;t++){w=b(N[t],u).text();I[a.p.colModel[t+G+Q+M].name]=w;H.push(q(C,w,t+G+Q+M,Z+i,u))}}H.push("</tr>");if(a.p.grouping){t=a.p.groupingView.groupField.length;for(var xa=[],ya=0;ya<t;ya++){xa.push(I[a.p.groupingView.groupField[ya]])}ia=b(a).jqGrid("groupingPrepare",H,xa,ia,I);H=[]}if(s||a.p.treeGrid===true){I._id_=C;a.p.data.push(I);a.p._index[C]=a.p.data.length-1}if(a.p.gridview===false){b("tbody:first",d).append(H.join(""));p&&a.p.afterInsertRow.call(a,C,I,u);H=[]}I={};x++;Z++;if(x==fa){break}}}if(a.p.gridview===true){y=a.p.treeANode>-1?a.p.treeANode:0;if(a.p.grouping){b(a).jqGrid("groupingRender",ia,a.p.colModel.length);ia=null}else{a.p.treeGrid===true&&y>0?b(a.rows[y]).after(H.join("")):b("tbody:first",d).append(H.join(""))}}if(a.p.subGrid===true){try{b(a).jqGrid("addSubGrid",G+M)}catch(Ha){}}a.p.totaltime=new Date-A;if(x>0){if(a.p.records===0){a.p.records=V}}H=null;if(a.p.treeGrid===true){try{b(a).jqGrid("setTreeNode",y+1,x+y+1)}catch(Ia){}}if(!a.p.treeGrid&&!a.p.scroll){a.grid.bDiv.scrollTop=0}a.p.reccount=x;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(s){a.p.records=V;a.p.lastpage=Math.ceil(V/fa)}n||a.updatepager(false,true);if(s){for(;x<V;){u=e[x];C=F(u,x);if(a.p.xmlReader.repeatitems){Y||(Y=D(G+Q+M));var Ea=b(a.p.xmlReader.cell,u);b.each(Y,function(ea){var $=Ea[this];if(!$){return false}w=$.textContent||$.text;I[a.p.colModel[ea+G+Q+M].name]=w})}else{for(t=0;t<N.length;t++){w=b(N[t],u).text();I[a.p.colModel[t+G+Q+M].name]=w}}I._id_=C;a.p.data.push(I);a.p._index[C]=a.p.data.length-1;I={};x++}}}},ca=function(e,d,i,n,p){var A=new Date;if(e){if(a.p.treeANode===-1&&!a.p.scroll){W(d,false,true);i=1}else{i=i>1?i:1}var s,F=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(F){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(a.p.datatype=="local"){d=a.p.localReader;s="local"}else{d=a.p.jsonReader;s="json"}var t=0,y,x,w=[],G,Q=0,M=0,L=0,N,Y,I={},u,C,H=[],ha=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(e,d.page)||0;N=b.jgrid.getAccessor(e,d.total);a.p.lastpage=N===undefined?1:N;a.p.records=b.jgrid.getAccessor(e,d.records)||0;a.p.userData=b.jgrid.getAccessor(e,d.userdata)||{};d.repeatitems||(G=w=J(s));s=a.p.keyIndex===false?d.id:a.p.keyIndex;if(w.length>0&&!isNaN(s)){if(a.p.remapColumns&&a.p.remapColumns.length){s=b.inArray(s,a.p.remapColumns)}s=w[s]}(Y=b.jgrid.getAccessor(e,d.root))||(Y=[]);N=Y.length;e=0;var V=parseInt(a.p.rowNum,10),Z=a.p.scroll?b.jgrid.randId():1;if(p){V*=p+1}var ia=b.isFunction(a.p.afterInsertRow),fa={},ra="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true){ra=' style="display:none;"'}for(;e<N;){p=Y[e];C=b.jgrid.getAccessor(p,s);if(C===undefined){C=Z+e;if(w.length===0){if(d.cell){C=b.jgrid.getAccessor(p,d.cell)[s]||C}}}y=i===1?0:i;y=(y+e)%2==1?ha:"";H.push("<tr"+ra+' id="'+C+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+a.p.direction+""+y+'">');if(a.p.rownumbers===true){H.push(T(0,e,a.p.page,a.p.rowNum));L=1}if(a.p.multiselect){H.push(B(C,L,e));Q=1}if(a.p.subGrid){H.push(b(a).jqGrid("addSubGridCell",Q+L,e+i));M=1}if(d.repeatitems){if(d.cell){p=b.jgrid.getAccessor(p,d.cell)}G||(G=D(Q+M+L))}for(x=0;x<G.length;x++){y=b.jgrid.getAccessor(p,G[x]);H.push(q(C,y,x+Q+M+L,e+i,p));I[a.p.colModel[x+Q+M+L].name]=y}H.push("</tr>");if(a.p.grouping){y=a.p.groupingView.groupField.length;x=[];for(var oa=0;oa<y;oa++){x.push(I[a.p.groupingView.groupField[oa]])}fa=b(a).jqGrid("groupingPrepare",H,x,fa,I);H=[]}if(F||a.p.treeGrid===true){I._id_=C;a.p.data.push(I);a.p._index[C]=a.p.data.length-1}if(a.p.gridview===false){b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(H.join(""));ia&&a.p.afterInsertRow.call(a,C,I,p);H=[]}I={};t++;e++;if(t==V){break}}if(a.p.gridview===true){u=a.p.treeANode>-1?a.p.treeANode:0;if(a.p.grouping){b(a).jqGrid("groupingRender",fa,a.p.colModel.length)}else{a.p.treeGrid===true&&u>0?b(a.rows[u]).after(H.join("")):b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(H.join(""))}}if(a.p.subGrid===true){try{b(a).jqGrid("addSubGrid",Q+L)}catch(Ba){}}a.p.totaltime=new Date-A;if(t>0){if(a.p.records===0){a.p.records=N}}if(a.p.treeGrid===true){try{b(a).jqGrid("setTreeNode",u+1,t+u+1)}catch(xa){}}if(!a.p.treeGrid&&!a.p.scroll){a.grid.bDiv.scrollTop=0}a.p.reccount=t;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(F){a.p.records=N;a.p.lastpage=Math.ceil(N/V)}n||a.updatepager(false,true);if(F){for(;t<N&&Y[t];){p=Y[t];C=b.jgrid.getAccessor(p,s);if(C===undefined){C=Z+t;if(w.length===0){if(d.cell){C=b.jgrid.getAccessor(p,d.cell)[s]||C}}}if(p){if(d.repeatitems){if(d.cell){p=b.jgrid.getAccessor(p,d.cell)}G||(G=D(Q+M+L))}for(x=0;x<G.length;x++){y=b.jgrid.getAccessor(p,G[x]);I[a.p.colModel[x+Q+M+L].name]=y}I._id_=C;a.p.data.push(I);a.p._index[C]=a.p.data.length-1;I={}}t++}}}},S=function(){function e(u){var C=0,H,ha,V;if(u.groups!==undefined){for(H=0;H<u.groups.length;H++){try{e(u.groups[H])}catch(Z){alert(Z)}C++}}if(u.rules!==undefined){if(C>0){var ia=w.select();w=b.jgrid.from(ia)}try{for(H=0;H<u.rules.length;H++){V=u.rules[H];ha=u.groupOp.toString().toUpperCase();if(x[V.op]&&V.field){if(C>0&&ha&&ha==="OR"){w=w.or()}w=x[V.op](w,ha)(V.field,V.data,n[V.field])}C++}}catch(fa){alert(fa)}}}var d,i=false,n={},p=[],A=[],s,F,t;if(b.isArray(a.p.data)){var y=a.p.grouping?a.p.groupingView:false;b.each(a.p.colModel,function(){F=this.sorttype||"text";if(F=="date"||F=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){s=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat;t=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat}else{s=t=this.datefmt||"Y-m-d"}n[this.name]={stype:F,srcfmt:s,newfmt:t}}else{n[this.name]={stype:F,srcfmt:"",newfmt:""}}if(a.p.grouping&&this.name==y.groupField[0]){var u=this.name;if(typeof this.index!="undefined"){u=this.index}p[0]=n[u];A.push(u)}if(!i&&(this.index==a.p.sortname||this.name==a.p.sortname)){d=this.name;i=true}});if(a.p.treeGrid){b(a).jqGrid("SortTree",d,a.p.sortorder,n[d].stype,n[d].srcfmt)}else{var x={eq:function(u){return u.equals},ne:function(u){return u.notEquals},lt:function(u){return u.less},le:function(u){return u.lessOrEquals},gt:function(u){return u.greater},ge:function(u){return u.greaterOrEquals},cn:function(u){return u.contains},nc:function(u,C){return C==="OR"?u.orNot().contains:u.andNot().contains},bw:function(u){return u.startsWith},bn:function(u,C){return C==="OR"?u.orNot().startsWith:u.andNot().startsWith},en:function(u,C){return C==="OR"?u.orNot().endsWith:u.andNot().endsWith},ew:function(u){return u.endsWith},ni:function(u,C){return C==="OR"?u.orNot().equals:u.andNot().equals},"in":function(u){return u.equals},nu:function(u){return u.isNull},nn:function(u,C){return C==="OR"?u.orNot().isNull:u.andNot().isNull}},w=b.jgrid.from(a.p.data);if(a.p.ignoreCase){w=w.ignoreCase()}if(a.p.search===true){var G=a.p.postData.filters;if(G){if(typeof G=="string"){G=b.jgrid.parse(G)}e(G)}else{try{w=x[a.p.postData.searchOper](w)(a.p.postData.searchField,a.p.postData.searchString,n[a.p.postData.searchField])}catch(Q){}}}if(a.p.grouping){w.orderBy(A,y.groupOrder[0],p[0].stype,p[0].srcfmt);y.groupDataSorted=true}if(d&&a.p.sortorder&&i){a.p.sortorder.toUpperCase()=="DESC"?w.orderBy(a.p.sortname,"d",n[d].stype,n[d].srcfmt):w.orderBy(a.p.sortname,"a",n[d].stype,n[d].srcfmt)}G=w.select();var M=parseInt(a.p.rowNum,10),L=G.length,N=parseInt(a.p.page,10),Y=Math.ceil(L/M),I={};G=G.slice((N-1)*M,N*M);n=w=null;I[a.p.localReader.total]=Y;I[a.p.localReader.page]=N;I[a.p.localReader.records]=L;I[a.p.localReader.root]=G;G=null;return I}}},aa=function(){a.grid.hDiv.loading=true;if(!a.p.hiddengrid){switch(a.p.loadui){case"enable":b("#load_"+b.jgrid.jqID(a.p.id)).show();break;case"block":b("#lui_"+b.jgrid.jqID(a.p.id)).show();b("#load_"+b.jgrid.jqID(a.p.id)).show()}}},pa=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case"enable":b("#load_"+b.jgrid.jqID(a.p.id)).hide();break;case"block":b("#lui_"+b.jgrid.jqID(a.p.id)).hide();b("#load_"+b.jgrid.jqID(a.p.id)).hide()}},ja=function(e){if(!a.grid.hDiv.loading){var d=a.p.scroll&&e===false,i={},n,p=a.p.prmNames;if(a.p.page<=0){a.p.page=1}if(p.search!==null){i[p.search]=a.p.search}if(p.nd!==null){i[p.nd]=(new Date).getTime()}if(p.rows!==null){i[p.rows]=a.p.rowNum}if(p.page!==null){i[p.page]=a.p.page}if(p.sort!==null){i[p.sort]=a.p.sortname}if(p.order!==null){i[p.order]=a.p.sortorder}if(a.p.rowTotal!==null&&p.totalrows!==null){i[p.totalrows]=a.p.rowTotal}var A=a.p.loadComplete,s=b.isFunction(A);s||(A=null);var F=0;e=e||1;if(e>1){if(p.npage!==null){i[p.npage]=e;F=e-1;e=1}else{A=function(y){a.p.page++;a.grid.hDiv.loading=false;s&&a.p.loadComplete.call(a,y);ja(e-1)}}}else{p.npage!==null&&delete a.p.postData[p.npage]}if(a.p.grouping){b(a).jqGrid("groupingSetup");if(a.p.groupingView.groupDataSorted===true){i[p.sort]=a.p.groupingView.groupField[0]+" "+a.p.groupingView.groupOrder[0]+", "+i[p.sort]}}b.extend(a.p.postData,i);var t=!a.p.scroll?1:a.rows.length-1;if(b.isFunction(a.p.datatype)){a.p.datatype.call(a,a.p.postData,"load_"+a.p.id)}else{b.isFunction(a.p.beforeRequest)&&a.p.beforeRequest.call(a);n=a.p.datatype.toLowerCase();switch(n){case"json":case"jsonp":case"xml":case"script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:n,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(y){n==="xml"?ga(y,a.grid.bDiv,t,e>1,F):ca(y,a.grid.bDiv,t,e>1,F);A&&A.call(a,y);d&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid){a.p.datatype="local"}pa()},error:function(y,x,w){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,y,x,w);pa()},beforeSend:function(y){aa();b.isFunction(a.p.loadBeforeSend)&&a.p.loadBeforeSend.call(a,y)}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case"xmlstring":aa();i=b.jgrid.stringToDoc(a.p.datastr);ga(i,a.grid.bDiv);s&&a.p.loadComplete.call(a,i);a.p.datatype="local";a.p.datastr=null;pa();break;case"jsonstring":aa();i=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;ca(i,a.grid.bDiv);s&&a.p.loadComplete.call(a,i);a.p.datatype="local";a.p.datastr=null;pa();break;case"local":case"clientside":aa();a.p.datatype="local";i=S();ca(i,a.grid.bDiv,t,e>1,F);A&&A.call(a,i);d&&a.grid.populateVisible();pa()}}}};v=function(e,d){var i="",n="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",p="",A,s,F,t,y=function(x){var w;if(b.isFunction(a.p.onPaging)){w=a.p.onPaging.call(a,x)}a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[];if(w=="stop"){return false}return true};e=e.substr(1);A="pg_"+e;s=e+"_left";F=e+"_center";t=e+"_right";b("#"+b.jgrid.jqID(e)).append("<div id='"+A+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+s+"' align='left'></td><td id='"+F+"' align='center' style='white-space:pre;'></td><td id='"+t+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(a.p.rowList.length>0){p="<td dir='"+l+"'>";p+="<select class='ui-pg-selbox' role='listbox'>";for(s=0;s<a.p.rowList.length;s++){p+='<option role="option" value="'+a.p.rowList[s]+'"'+(a.p.rowNum==a.p.rowList[s]?' selected="selected"':"")+">"+a.p.rowList[s]+"</option>"}p+="</select></td>"}if(l=="rtl"){n+=p}if(a.p.pginput===true){i="<td dir='"+l+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>"}if(a.p.pgbuttons===true){s=["first"+d,"prev"+d,"next"+d,"last"+d];l=="rtl"&&s.reverse();n+="<td id='"+s[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";n+="<td id='"+s[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";n+=i!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+i+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"";n+="<td id='"+s[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";n+="<td id='"+s[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else{if(i!==""){n+=i}}if(l=="ltr"){n+=p}n+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+e+"_"+a.p.recordpos,"#"+A).append("<div dir='"+l+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+e+"_"+a.p.pagerpos,"#"+A).append(n);p=b(".ui-jqgrid").css("font-size")||"11px";b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+p+";visibility:hidden;' ></div>");n=b(n).clone().appendTo("#testpg").width();b("#testpg").remove();if(n>0){if(i!==""){n+=50}b("td#"+e+"_"+a.p.pagerpos,"#"+A).width(n)}a.p._nvtd=[];a.p._nvtd[0]=n?Math.floor((a.p.width-n)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;n=null;b(".ui-pg-selbox","#"+A).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=this.value;if(d){b(".ui-pg-selbox",a.p.pager).val(this.value)}else{a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value)}if(!y("records")){return false}ja();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+A).hover(function(){if(b(this).hasClass("ui-state-disabled")){this.style.cursor="default"}else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");this.style.cursor="default"}});b("#first"+d+", #prev"+d+", #next"+d+", #last"+d,"#"+e).click(function(){var x=K(a.p.page,1),w=K(a.p.lastpage,1),G=false,Q=true,M=true,L=true,N=true;if(w===0||w===1){N=L=M=Q=false}else{if(w>1&&x>=1){if(x===1){M=Q=false}else{if(!(x>1&&x<w)){if(x===w){N=L=false}}}}else{if(w>1&&x===0){N=L=false;x=w-1}}}if(this.id==="first"+d&&Q){a.p.page=1;G=true}if(this.id==="prev"+d&&M){a.p.page=x-1;G=true}if(this.id==="next"+d&&L){a.p.page=x+1;G=true}if(this.id==="last"+d&&N){a.p.page=w;G=true}if(G){if(!y(this.id)){return false}ja()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+A).keypress(function(x){if((x.charCode?x.charCode:x.keyCode?x.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!y("user")){return false}ja();return false}return this})};var Ca=function(e,d,i,n){if(a.p.colModel[d].sortable){if(!(a.p.savedRow.length>0)){if(!i){if(a.p.lastsort==d){if(a.p.sortorder=="asc"){a.p.sortorder="desc"}else{if(a.p.sortorder=="desc"){a.p.sortorder="asc"}}}else{a.p.sortorder=a.p.colModel[d].firstsortorder||"asc"}a.p.page=1}if(n){if(a.p.lastsort==d&&a.p.sortorder==n&&!i){return}else{a.p.sortorder=n}}i=b("thead:first",a.grid.hDiv).get(0);b("tr th:eq("+a.p.lastsort+") span.ui-grid-ico-sort",i).addClass("ui-state-disabled");b("tr th:eq("+a.p.lastsort+")",i).attr("aria-selected","false");b("tr th:eq("+d+") span.ui-icon-"+a.p.sortorder,i).removeClass("ui-state-disabled");b("tr th:eq("+d+")",i).attr("aria-selected","true");if(!a.p.viewsortcols[0]){if(a.p.lastsort!=d){b("tr th:eq("+a.p.lastsort+") span.s-ico",i).hide();b("tr th:eq("+d+") span.s-ico",i).show()}}e=e.substring(5);a.p.sortname=a.p.colModel[d].index||e;i=a.p.sortorder;if(b.isFunction(a.p.onSortCol)){if(a.p.onSortCol.call(a,e,d,i)=="stop"){a.p.lastsort=d;return}}if(a.p.datatype=="local"){a.p.deselectAfterSort&&b(a).jqGrid("resetSelection")}else{a.p.selrow=null;a.p.multiselect&&b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false);a.p.selarrrow=[];a.p.savedRow=[]}if(a.p.scroll){i=a.grid.bDiv.scrollLeft;W(a.grid.bDiv,true,false);a.grid.hDiv.scrollLeft=i}a.p.subGrid&&a.p.datatype=="local"&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")});ja();a.p.lastsort=d;if(a.p.sortname!=e&&d){a.p.lastsort=d}}}},Fa=function(e){var d,i={},n=E?0:a.p.cellLayout;for(d=i[0]=i[1]=i[2]=0;d<=e;d++){if(a.p.colModel[d].hidden===false){i[0]+=a.p.colModel[d].width+n}}if(a.p.direction=="rtl"){i[0]=a.p.width-i[0]}i[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible")){i[1]+=b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+parseInt(b(a.grid.cDiv).css("padding-bottom"),10)}if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both")){i[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10)}if(a.p.toppager){i[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10)}i[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return i};this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==-1){a.p.multikey=false}a.p.keyIndex=false;for(k=0;k<a.p.colModel.length;k++){a.p.colModel[k]=b.extend(true,{},a.p.cmTemplate,a.p.colModel[k].template||{},a.p.colModel[k]);if(a.p.keyIndex===false&&a.p.colModel[k].key===true){a.p.keyIndex=k}}a.p.sortorder=a.p.sortorder.toLowerCase();if(a.p.grouping===true){a.p.scroll=false;a.p.rownumbers=false;a.p.subGrid=false;a.p.treeGrid=false;a.p.gridview=true}if(this.p.treeGrid===true){try{b(this).jqGrid("setTreeGrid")}catch(Ja){}if(a.p.datatype!="local"){a.p.localReader={id:"_id_"}}}if(this.p.subGrid){try{b(a).jqGrid("setSubGrid")}catch(Ka){}}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:E?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.jsonReader);a.p.localReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.localReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}a.p.data.length&&U();var ba="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Da,ma,sa,qa,ta,X,R,na;ma=na="";if(a.p.shrinkToFit===true&&a.p.forceFit===true){for(k=a.p.colModel.length-1;k>=0;k--){if(!a.p.colModel[k].hidden){a.p.colModel[k].resizable=false;break}}}if(a.p.viewsortcols[1]=="horizontal"){na=" ui-i-asc";ma=" ui-i-desc"}Da=z?"class='ui-th-div-ie'":"";na="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+na+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+l+"'></span>";na+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ma+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+l+"'></span></span>";for(k=0;k<this.p.colNames.length;k++){ma=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[k])+'"':"";ba+="<th id='"+a.p.id+"_"+a.p.colModel[k].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+l+"'"+ma+">";ma=a.p.colModel[k].index||a.p.colModel[k].name;ba+="<div id='jqgh_"+a.p.colModel[k].name+"' "+Da+">"+a.p.colNames[k];a.p.colModel[k].width=a.p.colModel[k].width?parseInt(a.p.colModel[k].width,10):150;if(typeof a.p.colModel[k].title!=="boolean"){a.p.colModel[k].title=true}if(ma==a.p.sortname){a.p.lastsort=k}ba+=na+"</div></th>"}ba+="</tr></thead>";na=null;b(this).append(ba);b("thead tr:first th",this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var za=[],ua;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=[];if(this.checked){b(a.rows).each(function(e){if(e>0){if(!b(this).hasClass("subgrid")&&!b(this).hasClass("jqgroup")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id)).attr("checked","checked");b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow.push(this.id);a.p.selrow=this.id}}});ua=true;za=[]}else{b(a.rows).each(function(e){if(e>0){if(!b(this).hasClass("subgrid")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id)).removeAttr("checked");b(this).removeClass("ui-state-highlight").attr("aria-selected","false");za.push(this.id)}}});a.p.selrow=null;ua=false}if(b.isFunction(a.p.onSelectAll)){a.p.onSelectAll.call(a,ua?a.p.selarrrow:za,ua)}})}if(a.p.autowidth===true){ba=b(P).innerWidth();a.p.width=ba>0?ba:"nw"}(function(){var e=0,d=E?0:a.p.cellLayout,i=0,n,p=a.p.scrollOffset,A,s=false,F,t=0,y=0,x;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined"){this.hidden=false}this.widthOrg=A=K(this.width,0);if(this.hidden===false){e+=A+d;if(this.fixed){t+=A+d}else{i++}y++}});if(isNaN(a.p.width)){a.p.width=g.width=e}else{g.width=a.p.width}a.p.tblwidth=e;if(a.p.shrinkToFit===false&&a.p.forceFit===true){a.p.forceFit=false}if(a.p.shrinkToFit===true&&i>0){F=g.width-d*i-t;if(!isNaN(a.p.height)){F-=p;s=true}e=0;b.each(a.p.colModel,function(w){if(this.hidden===false&&!this.fixed){this.width=A=Math.round(F*this.width/(a.p.tblwidth-d*i-t));e+=A;n=w}});x=0;if(s){if(g.width-t-(e+d*i)!==p){x=g.width-t-(e+d*i)-p}}else{if(!s&&Math.abs(g.width-t-(e+d*i))!==1){x=g.width-t-(e+d*i)}}a.p.colModel[n].width+=x;a.p.tblwidth=e+x+d*i+t;if(a.p.tblwidth>a.p.width){a.p.colModel[n].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(P).css("width",g.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(r).css("width",g.width+"px");ba=b("thead:first",a).get(0);var va="";if(a.p.footerrow){va+="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+l+"'>"}r=b("tr:first",ba);var wa="<tr class='jqgfirstrow' role='row' style='height:auto'>";a.p.disableClick=false;b("th",r).each(function(e){sa=a.p.colModel[e].width;if(typeof a.p.colModel[e].resizable==="undefined"){a.p.colModel[e].resizable=true}if(a.p.colModel[e].resizable){qa=document.createElement("span");b(qa).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l);b.browser.opera||b(qa).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else{qa=""}b(this).css("width",sa+"px").prepend(qa);var d="";if(a.p.colModel[e].hidden){b(this).css("display","none");d="display:none;"}wa+="<td role='gridcell' style='height:0px;width:"+sa+"px;"+d+"'></td>";g.headers[e]={width:sa,el:this};ta=a.p.colModel[e].sortable;if(typeof ta!=="boolean"){ta=a.p.colModel[e].sortable=true}d=a.p.colModel[e].name;d=="cb"||d=="subgrid"||d=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(ta){if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();e==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}else{if(e==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}}}if(a.p.footerrow){va+="<td role='gridcell' "+O(e,0,"",null,"",false)+">&#160;</td>"}}).mousedown(function(e){if(b(e.target).closest("th>span.ui-jqgrid-resize").length==1){var d=b.jgrid.getCellIndex(this);if(a.p.forceFit===true){var i=a.p,n=d,p;for(p=d+1;p<a.p.colModel.length;p++){if(a.p.colModel[p].hidden!==true){n=p;break}}i.nv=n-d}g.dragStart(d,e,Fa(d));return false}}).click(function(e){if(a.p.disableClick){return a.p.disableClick=false}var d="th>div.ui-jqgrid-sortable",i,n;a.p.viewsortcols[2]||(d="th>div>span>span.ui-grid-ico-sort");e=b(e.target).closest(d);if(e.length==1){d=b.jgrid.getCellIndex(this);if(!a.p.viewsortcols[2]){i=true;n=e.attr("sort")}Ca(b("div",this)[0].id,d,i,n);return false}});if(a.p.sortable&&b.fn.sortable){try{b(a).jqGrid("sortableColumns",r)}catch(La){}}if(a.p.footerrow){va+="</tr></tbody></table>"}wa+="</tr>";this.appendChild(document.createElement("tbody"));b(this).addClass("ui-jqgrid-btable").append(wa);wa=null;r=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(ba);var da=a.p.caption&&a.p.hiddengrid===true?true:false;k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");ba=null;g.hDiv=document.createElement("div");b(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);b(k).append(r);r=null;da&&b(g.hDiv).hide();if(a.p.pager){if(typeof a.p.pager=="string"){if(a.p.pager.substr(0,1)!="#"){a.p.pager="#"+a.p.pager}}else{a.p.pager="#"+b(a.p.pager).attr("id")}b(a.p.pager).css({width:g.width+"px"}).appendTo(P).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");da&&b(a.p.pager).hide();v(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(e){R=b(e.target).closest("tr.jqgrow");b(R).attr("class")!=="subgrid"&&b(R).addClass("ui-state-hover");return false}).bind("mouseout",function(e){R=b(e.target).closest("tr.jqgrow");b(R).removeClass("ui-state-hover");return false});var ka,la;b(a).before(g.hDiv).click(function(e){X=e.target;R=b(X,a.rows).closest("tr.jqgrow");if(b(R).length===0||R[0].className.indexOf("ui-state-disabled")>-1){return this}var d=b(X).hasClass("cbox"),i=true;if(b.isFunction(a.p.beforeSelectRow)){i=a.p.beforeSelectRow.call(a,R[0].id,e)}if(X.tagName=="A"||(X.tagName=="INPUT"||X.tagName=="TEXTAREA"||X.tagName=="OPTION"||X.tagName=="SELECT")&&!d){return this}if(i===true){if(a.p.cellEdit===true){if(a.p.multiselect&&d){b(a).jqGrid("setSelection",R[0].id,true)}else{ka=R[0].rowIndex;la=b.jgrid.getCellIndex(X);try{b(a).jqGrid("editCell",ka,la,true)}catch(n){}}}else{if(a.p.multikey){if(e[a.p.multikey]){b(a).jqGrid("setSelection",R[0].id,true)}else{if(a.p.multiselect&&d){d=b("[id^=jqg_"+b.jgrid.jqID(a.p.id)+"_]").attr("checked");b("[id^=jqg_"+b.jgrid.jqID(a.p.id)+"_]").attr("checked",!d)}}}else{if(a.p.multiselect&&a.p.multiboxonly){if(!d){b(a.p.selarrrow).each(function(p,A){var s=a.rows.namedItem(A);b(s).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(A)).attr("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}}b(a).jqGrid("setSelection",R[0].id,true)}}if(b.isFunction(a.p.onCellSelect)){ka=R[0].id;la=b.jgrid.getCellIndex(X);a.p.onCellSelect.call(a,ka,la,b(X).html(),e)}e.stopPropagation()}else{return this}}).bind("reloadGrid",function(e,d){if(a.p.treeGrid===true){a.p.datatype=a.p.treedatatype}d&&d.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local"){b(a).jqGrid("resetSelection");a.p.data.length&&U()}else{if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[]}}a.p.scroll&&W(a.grid.bDiv,true,false);if(d&&d.page){var i=d.page;if(i>a.p.lastpage){i=a.p.lastpage}if(i<1){i=1}a.p.page=i;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(i-1)*a.grid.prevRowHeight*a.p.rowNum:0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else{a.grid.populate()}return false});b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(e){X=e.target;R=b(X,a.rows).closest("tr.jqgrow");if(b(R).length===0){return false}ka=R[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.ondblClickRow.call(a,b(R).attr("id"),ka,la,e);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(e){X=e.target;R=b(X,a.rows).closest("tr.jqgrow");if(b(R).length===0){return false}a.p.multiselect||b(a).jqGrid("setSelection",R[0].id,true);ka=R[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.onRightClickRow.call(a,b(R).attr("id"),ka,la,e);return false});g.bDiv=document.createElement("div");if(z){if(String(a.p.height).toLowerCase()==="auto"){a.p.height="100%"}}b(g.bDiv).append(b('<div style="position:relative;'+(z&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),width:g.width+"px"}).scroll(g.scrollGrid);b("table:first",g.bDiv).css({width:a.p.tblwidth+"px"});if(z){b("tbody",this).size()==2&&b("tbody:gt(0)",this).remove();a.p.multikey&&b(g.bDiv).bind("selectstart",function(){return false})}else{a.p.multikey&&b(g.bDiv).bind("mousedown",function(){return false})}da&&b(g.bDiv).hide();g.cDiv=document.createElement("div");var Aa=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Aa.addClass("ui-state-hover")},function(){Aa.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(l=="rtl"?"left":"right","0px"):"";b(g.cDiv).append(Aa).append("<span class='ui-jqgrid-title"+(l=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(g.cDiv).insertBefore(g.hDiv);if(a.p.toolbar[0]){g.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top"){b(g.uDiv).insertBefore(g.hDiv)}else{a.p.toolbar[1]=="bottom"&&b(g.uDiv).insertAfter(g.hDiv)}if(a.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);da&&b(g.ubDiv).hide()}else{b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id)}da&&b(g.uDiv).hide()}if(a.p.toppager){a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager";g.topDiv=b("<div id='"+a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);v(a.p.toppager,"_t")}if(a.p.footerrow){g.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0];k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");b(g.sDiv).append(k).insertAfter(g.hDiv).width(g.width);b(k).append(va);g.footers=b(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(a.p.rownumbers){g.footers[0].className="ui-state-default jqgrid-rownum"}da&&b(g.sDiv).hide()}k=null;if(a.p.caption){var Ga=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",g.cDiv).click(function(e){var d=b.isFunction(a.p.onHeaderClick),i=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",n,p=this;if(a.p.toolbar[0]===true){if(a.p.toolbar[1]=="both"){i+=", #"+b(g.ubDiv).attr("id")}i+=", #"+b(g.uDiv).attr("id")}n=b(i,"#gview_"+b.jgrid.jqID(a.p.id)).length;if(a.p.gridstate=="visible"){b(i,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){n--;if(n===0){b("span",p).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");a.p.gridstate="hidden";b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).hide();if(d){da||a.p.onHeaderClick.call(a,a.p.gridstate,e)}}})}else{a.p.gridstate=="hidden"&&b(i,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){n--;if(n===0){b("span",p).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(da){a.p.datatype=Ga;ja();da=false}a.p.gridstate="visible";b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).show();if(d){da||a.p.onHeaderClick.call(a,a.p.gridstate,e)}}})}return false});if(da){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else{b(g.cDiv).hide()}b(g.hDiv).after(g.bDiv).mousemove(function(e){if(g.resizing){g.dragMove(e);return false}});b(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});b(document).mouseup(function(){if(g.resizing){g.dragEnd();return false}return true});a.formatCol=O;a.sortData=Ca;a.updatepager=function(e,d){var i,n,p,A,s,F,t,y="";p=parseInt(a.p.page,10)-1;if(p<0){p=0}p*=parseInt(a.p.rowNum,10);s=p+a.p.reccount;if(a.p.scroll){i=b("tbody:first > tr:gt(0)",a.grid.bDiv);p=s-i.length;a.p.reccount=i.length;if(n=i.outerHeight()||a.grid.prevRowHeight){i=p*n;n*=parseInt(a.p.records,10);b(">div:first",a.grid.bDiv).css({height:n}).children("div:first").css({height:i,display:i?"":"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}y=a.p.pager?a.p.pager:"";y+=a.p.toppager?y?","+a.p.toppager:a.p.toppager:"";if(y){t=b.jgrid.formatter.integer||{};i=K(a.p.page);n=K(a.p.lastpage);b(".selbox",y).attr("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",y).val(a.p.page);b("#sp_1",y).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,t):a.p.lastpage)}if(a.p.viewrecords){if(a.p.reccount===0){b(".ui-paging-info",y).html(a.p.emptyrecords)}else{A=p+1;F=a.p.records;if(b.fmatter){A=b.fmatter.util.NumberFormat(A,t);s=b.fmatter.util.NumberFormat(s,t);F=b.fmatter.util.NumberFormat(F,t)}b(".ui-paging-info",y).html(b.jgrid.format(a.p.recordtext,A,s,F))}}if(a.p.pgbuttons===true){if(i<=0){i=n=0}if(i==1||i===0){b("#first, #prev",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first, #prev",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).removeClass("ui-state-disabled")}if(i==n||i===0){b("#next, #last",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next, #last",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).removeClass("ui-state-disabled")}}}e===true&&a.p.rownumbers===true&&b("td.jqgrid-rownum",a.rows).each(function(x){b(this).html(p+1+x)});d&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)};a.refreshIndex=U;a.formatter=function(e,d,i,n,p){return o(e,d,i,n,p)};b.extend(g,{populate:ja,emptyRows:W});this.grid=g;a.addXmlData=function(e){ga(e,a.grid.bDiv)};a.addJSONData=function(e){ca(e,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;ja();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}}})};b.jgrid.extend({getGridParam:function(f){var j=this[0];if(j&&j.grid){return f?typeof j.p[f]!="undefined"?j.p[f]:null:j.p}},setGridParam:function(f){return this.each(function(){this.grid&&typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],j=0,h,c=0;this.each(function(){if((h=this.rows.length)&&h>0){for(;j<h;){if(b(this.rows[j]).hasClass("jqgrow")){f[c]=this.rows[j].id;c++}j++}}});return f},setSelection:function(f,j){return this.each(function(){function h(a){var r=b(c.grid.bDiv)[0].clientHeight,v=b(c.grid.bDiv)[0].scrollTop,z=c.rows[a].offsetTop;a=c.rows[a].clientHeight;if(z+a>=r+v){b(c.grid.bDiv)[0].scrollTop=z-(r+v)+a+v}else{if(z<r+v){if(z<v){b(c.grid.bDiv)[0].scrollTop=z}}}}var c=this,g,k,l;if(f!==undefined){j=j===false?false:true;k=c.rows.namedItem(f+"");if(!(!k||k.className.indexOf("ui-state-disabled")>-1)){if(c.p.scrollrows===true){g=c.rows.namedItem(f).rowIndex;g>=0&&h(g)}if(c.p.multiselect){c.p.selrow=k.id;l=b.inArray(c.p.selrow,c.p.selarrrow);if(l===-1){k.className!=="ui-subgrid"&&b(k).addClass("ui-state-highlight").attr("aria-selected","true");g=true;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow)).attr("checked",g);c.p.selarrrow.push(c.p.selrow)}else{k.className!=="ui-subgrid"&&b(k).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow)).attr("checked",g);c.p.selarrrow.splice(l,1);l=c.p.selarrrow[0];c.p.selrow=l===undefined?null:l}c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,k.id,g)}else{if(k.className!=="ui-subgrid"){if(c.p.selrow!=k.id){b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"});b(k).addClass("ui-state-highlight").attr({"aria-selected":true,tabindex:"0"});g=true}else{g=false}c.p.selrow=k.id;c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,k.id,g)}}}}})},resetSelection:function(f){return this.each(function(){var j=this,h,c;if(typeof f!=="undefined"){c=f===j.p.selrow?j.p.selrow:f;b("#"+b.jgrid.jqID(j.p.id)+" tbody:first tr#"+b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");if(j.p.multiselect){b("#jqg_"+b.jgrid.jqID(j.p.id)+"_"+b.jgrid.jqID(c)).attr("checked",false);b("#cb_"+b.jgrid.jqID(j.p.id)).attr("checked",false)}c=null}else{if(j.p.multiselect){b(j.p.selarrrow).each(function(g,k){h=j.rows.namedItem(k);b(h).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(j.p.id)+"_"+b.jgrid.jqID(k)).attr("checked",false)});b("#cb_"+b.jgrid.jqID(j.p.id)).attr("checked",false);j.p.selarrrow=[]}else{if(j.p.selrow){b("#"+b.jgrid.jqID(j.p.id)+" tbody:first tr#"+b.jgrid.jqID(j.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");j.p.selrow=null}}}j.p.savedRow=[]})},getRowData:function(f){var j={},h,c=false,g,k=0;this.each(function(){var l=this,a,r;if(typeof f=="undefined"){c=true;h=[];g=l.rows.length}else{r=l.rows.namedItem(f);if(!r){return j}g=2}for(;k<g;){if(c){r=l.rows[k]}if(b(r).hasClass("jqgrow")){b("td",r).each(function(v){a=l.p.colModel[v].name;if(a!=="cb"&&a!=="subgrid"&&a!=="rn"){if(l.p.treeGrid===true&&a==l.p.ExpandColumn){j[a]=b.jgrid.htmlDecode(b("span:first",this).html())}else{try{j[a]=b.unformat(this,{rowId:r.id,colModel:l.p.colModel[v]},v)}catch(z){j[a]=b.jgrid.htmlDecode(b(this).html())}}}});if(c){h.push(j);j={}}}k++}});return h?h:j},delRowData:function(f){var j=false,h,c;this.each(function(){if(h=this.rows.namedItem(f)){b(h).remove();this.p.records--;this.p.reccount--;this.updatepager(true,false);j=true;if(this.p.multiselect){c=b.inArray(f,this.p.selarrrow);c!=-1&&this.p.selarrrow.splice(c,1)}if(f==this.p.selrow){this.p.selrow=null}}else{return false}if(this.p.datatype=="local"){var g=this.p._index[f];if(typeof g!="undefined"){this.p.data.splice(g,1);this.refreshIndex()}}if(this.p.altRows===true&&j){var k=this.p.altclass;b(this.rows).each(function(l){l%2==1?b(this).addClass(k):b(this).removeClass(k)})}});return j},setRowData:function(f,j,h){var c,g=true,k;this.each(function(){if(!this.grid){return false}var l=this,a,r,v=typeof h,z={};r=l.rows.namedItem(f);if(!r){return false}if(j){try{b(this.p.colModel).each(function(O){c=this.name;if(j[c]!==undefined){z[c]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?b.unformat.date(j[c],this):j[c];a=l.formatter(f,j[c],O,j,"edit");k=this.title?{title:b.jgrid.stripHtml(a)}:{};l.p.treeGrid===true&&c==l.p.ExpandColumn?b("td:eq("+O+") > span:first",r).html(a).attr(k):b("td:eq("+O+")",r).html(a).attr(k)}});if(l.p.datatype=="local"){var E=l.p._index[f];if(l.p.treeGrid){for(var P in l.p.treeReader){z.hasOwnProperty(l.p.treeReader[P])&&delete z[l.p.treeReader[P]]}}if(typeof E!="undefined"){l.p.data[E]=b.extend(true,l.p.data[E],z)}z=null}}catch(K){g=false}}if(g){if(v==="string"){b(r).addClass(h)}else{v==="object"&&b(r).css(h)}}});return g},addRowData:function(f,j,h,c){h||(h="last");var g=false,k,l,a,r,v,z,E,P,K="",O,m,o,q,B;if(j){if(b.isArray(j)){O=true;h="last";m=f}else{j=[j];O=false}this.each(function(){var T=j.length;v=this.p.rownumbers===true?1:0;a=this.p.multiselect===true?1:0;r=this.p.subGrid===true?1:0;if(!O){if(typeof f!="undefined"){f+=""}else{f=b.jgrid.randId();if(this.p.keyIndex!==false){m=this.p.colModel[this.p.keyIndex+a+r+v].name;if(typeof j[0][m]!="undefined"){f=j[0][m]}}}}o=this.p.altclass;for(var J=0,D="",W={},U=b.isFunction(this.p.afterInsertRow)?true:false;J<T;){q=j[J];l="";if(O){try{f=q[m]}catch(ga){f=b.jgrid.randId()}D=this.p.altRows===true?(this.rows.length-1)%2===0?o:"":""}if(v){K=this.formatCol(0,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+K+">0</td>"}if(a){P='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+f+'" class="cbox"/>';K=this.formatCol(v,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+K+">"+P+"</td>"}if(r){l+=b(this).jqGrid("addSubGridCell",a+v,1)}for(E=a+r+v;E<this.p.colModel.length;E++){B=this.p.colModel[E];k=B.name;W[k]=B.formatter&&typeof B.formatter==="string"&&B.formatter=="date"?b.unformat.date(q[k],B):q[k];P=this.formatter(f,b.jgrid.getAccessor(q,k),E,q,"edit");K=this.formatCol(E,1,P,f,q,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+k+'" '+K+">"+P+"</td>"}l='<tr id="'+f+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+D+'">'+l+"</tr>";if(this.p.subGrid===true){l=b(l)[0];b(this).jqGrid("addSubGrid",l,a+v)}if(this.rows.length===0){b("table:first",this.grid.bDiv).append(l)}else{switch(h){case"last":b(this.rows[this.rows.length-1]).after(l);break;case"first":b(this.rows[0]).after(l);break;case"after":if(z=this.rows.namedItem(c)){b(this.rows[z.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[z.rowIndex+1]).after(l):b(z).after(l)}break;case"before":if(z=this.rows.namedItem(c)){b(z).before(l);z=z.rowIndex}}}this.p.records++;this.p.reccount++;U&&this.p.afterInsertRow.call(this,f,q,q);J++;if(this.p.datatype=="local"){W[this.p.localReader.id]=f;this.p._index[f]=this.p.data.length;this.p.data.push(W);W={}}}if(this.p.altRows===true&&!O){if(h=="last"){(this.rows.length-1)%2==1&&b(this.rows[this.rows.length-1]).addClass(o)}else{b(this.rows).each(function(ca){ca%2==1?b(this).addClass(o):b(this).removeClass(o)})}}this.updatepager(true,true);g=true})}return g},footerData:function(f,j,h){function c(r){for(var v in r){if(r.hasOwnProperty(v)){return false}}return true}var g,k=false,l={},a;if(typeof f=="undefined"){f="get"}if(typeof h!="boolean"){h=true}f=f.toLowerCase();this.each(function(){var r=this,v;if(!r.grid||!r.p.footerrow){return false}if(f=="set"){if(c(j)){return false}}k=true;b(this.p.colModel).each(function(z){g=this.name;if(f=="set"){if(j[g]!==undefined){v=h?r.formatter("",j[g],z,j,"edit"):j[g];a=this.title?{title:b.jgrid.stripHtml(v)}:{};b("tr.footrow td:eq("+z+")",r.grid.sDiv).html(v).attr(a);k=true}}else{if(f=="get"){l[g]=b("tr.footrow td:eq("+z+")",r.grid.sDiv).html()}}})});return f=="get"?l:k},showHideCol:function(f,j){return this.each(function(){var h=this,c=false,g=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,k;if(h.grid){if(typeof f==="string"){f=[f]}j=j!="none"?"":"none";var l=j===""?true:false;b(this.p.colModel).each(function(a){if(b.inArray(this.name,f)!==-1&&this.hidden===l){b("tr",h.grid.hDiv).each(function(){b(this).children("th:eq("+a+")").css("display",j)});b(h.rows).each(function(){b(this).children("td:eq("+a+")").css("display",j)});h.p.footerrow&&b(h.grid.sDiv).children("td:eq("+a+")").css("display",j);k=this.widthOrg?this.widthOrg:parseInt(this.width,10);if(j==="none"){h.p.tblwidth-=k+g}else{h.p.tblwidth+=k+g}this.hidden=!l;c=true}});if(c===true){if(h.grid.width!==h.p.tblwidth){b(h).jqGrid("setGridWidth",h.p.shrinkToFit===true?h.grid.width:h.p.tblwidth,true)}}}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"")})},remapColumns:function(f,j,h){function c(l){var a;a=l.length?b.makeArray(l):b.extend({},l);b.each(f,function(r){l[r]=a[this]})}function g(l,a){b(">tr"+(a||""),l).each(function(){var r=this,v=b.makeArray(r.cells);b.each(f,function(){var z=v[this];z&&r.appendChild(z)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers);g(b("thead:first",k.grid.hDiv),h&&":not(.ui-jqgrid-labels)");j&&g(b("#"+b.jgrid.jqID(k.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");k.p.footerrow&&g(b("tbody:first",k.grid.sDiv));if(k.p.remapColumns){if(k.p.remapColumns.length){c(k.p.remapColumns)}else{k.p.remapColumns=b.makeArray(f)}}k.p.lastsort=b.inArray(k.p.lastsort,f);if(k.p.treeGrid){k.p.expColInd=b.inArray(k.p.expColInd,f)}},setGridWidth:function(f,j){return this.each(function(){if(this.grid){var h=this,c,g=0,k=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,l,a=0,r=false,v=h.p.scrollOffset,z,E=0,P=0,K;if(typeof j!="boolean"){j=h.p.shrinkToFit}if(!isNaN(f)){f=parseInt(f,10);h.grid.width=h.p.width=f;b("#gbox_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b("#gview_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b(h.grid.bDiv).css("width",f+"px");b(h.grid.hDiv).css("width",f+"px");h.p.pager&&b(h.p.pager).css("width",f+"px");h.p.toppager&&b(h.p.toppager).css("width",f+"px");if(h.p.toolbar[0]===true){b(h.grid.uDiv).css("width",f+"px");h.p.toolbar[1]=="both"&&b(h.grid.ubDiv).css("width",f+"px")}h.p.footerrow&&b(h.grid.sDiv).css("width",f+"px");if(j===false&&h.p.forceFit===true){h.p.forceFit=false}if(j===true){b.each(h.p.colModel,function(){if(this.hidden===false){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);g+=c+k;if(this.fixed){E+=c+k}else{a++}P++}});if(a!==0){h.p.tblwidth=g;z=f-k*a-E;if(!isNaN(h.p.height)){if(b(h.grid.bDiv)[0].clientHeight<b(h.grid.bDiv)[0].scrollHeight||h.rows.length===1){r=true;z-=v}}g=0;var O=h.grid.cols.length>0;b.each(h.p.colModel,function(m){if(this.hidden===false&&!this.fixed){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);c=Math.round(z*c/(h.p.tblwidth-k*a-E));if(!(c<0)){this.width=c;g+=c;h.grid.headers[m].width=c;h.grid.headers[m].el.style.width=c+"px";if(h.p.footerrow){h.grid.footers[m].style.width=c+"px"}if(O){h.grid.cols[m].style.width=c+"px"}l=m}}});K=0;if(r){if(f-E-(g+k*a)!==v){K=f-E-(g+k*a)-v}}else{if(Math.abs(f-E-(g+k*a))!==1){K=f-E-(g+k*a)}}h.p.colModel[l].width+=K;h.p.tblwidth=g+K+k*a+E;if(h.p.tblwidth>f){r=h.p.tblwidth-parseInt(f,10);h.p.tblwidth=f;c=h.p.colModel[l].width-=r}else{c=h.p.colModel[l].width}h.grid.headers[l].width=c;h.grid.headers[l].el.style.width=c+"px";if(O){h.grid.cols[l].style.width=c+"px"}b("table:first",h.grid.bDiv).css("width",h.p.tblwidth+"px");b("table:first",h.grid.hDiv).css("width",h.p.tblwidth+"px");h.grid.hDiv.scrollLeft=h.grid.bDiv.scrollLeft;if(h.p.footerrow){h.grid.footers[l].style.width=c+"px";b("table:first",h.grid.sDiv).css("width",h.p.tblwidth+"px")}}}}}})},setGridHeight:function(f){return this.each(function(){if(this.grid){b(this.grid.bDiv).css({height:f+(isNaN(f)?"":"px")});this.p.height=f;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,j,h,c){return this.each(function(){var g=-1;if(this.grid){if(isNaN(f)){b(this.p.colModel).each(function(a){if(this.name==f){g=a;return false}})}else{g=parseInt(f,10)}if(g>=0){var k=b("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(j){var l=b(".s-ico",k);b("[id^=jqgh_]",k).empty().html(j).append(l);this.p.colNames[g]=j}if(h){typeof h==="string"?b(k).addClass(h):b(k).css(h)}typeof c==="object"&&b(k).attr(c)}}})},setCell:function(f,j,h,c,g,k){return this.each(function(){var l=-1,a,r;if(this.grid){if(isNaN(j)){b(this.p.colModel).each(function(z){if(this.name==j){l=z;return false}})}else{l=parseInt(j,10)}if(l>=0){if(a=this.rows.namedItem(f)){var v=b("td:eq("+l+")",a);if(h!==""||k===true){a=this.formatter(f,h,l,a,"edit");r=this.p.colModel[l].title?{title:b.jgrid.stripHtml(a)}:{};this.p.treeGrid&&b(".tree-wrap",b(v)).length>0?b("span",b(v)).html(a).attr(r):b(v).html(a).attr(r);if(this.p.datatype=="local"){a=this.p.colModel[l];h=a.formatter&&typeof a.formatter==="string"&&a.formatter=="date"?b.unformat.date(h,a):h;r=this.p._index[f];if(typeof r!="undefined"){this.p.data[r][a.name]=h}}}if(typeof c==="string"){b(v).addClass(c)}else{c&&b(v).css(c)}typeof g==="object"&&b(v).attr(g)}}}})},getCell:function(f,j){var h=false;this.each(function(){var c=-1;if(this.grid){if(isNaN(j)){b(this.p.colModel).each(function(l){if(this.name===j){c=l;return false}})}else{c=parseInt(j,10)}if(c>=0){var g=this.rows.namedItem(f);if(g){try{h=b.unformat(b("td:eq("+c+")",g),{rowId:g.id,colModel:this.p.colModel[c]},c)}catch(k){h=b.jgrid.htmlDecode(b("td:eq("+c+")",g).html())}}}}});return h},getCol:function(f,j,h){var c=[],g,k=0,l=0,a=0,r;j=typeof j!="boolean"?false:j;if(typeof h=="undefined"){h=false}this.each(function(){var v=-1;if(this.grid){if(isNaN(f)){b(this.p.colModel).each(function(K){if(this.name===f){v=K;return false}})}else{v=parseInt(f,10)}if(v>=0){var z=this.rows.length,E=0;if(z&&z>0){for(;E<z;){if(b(this.rows[E]).hasClass("jqgrow")){try{g=b.unformat(b(this.rows[E].cells[v]),{rowId:this.rows[E].id,colModel:this.p.colModel[v]},v)}catch(P){g=b.jgrid.htmlDecode(this.rows[E].cells[v].innerHTML)}if(h){r=parseFloat(g);k+=r;l=Math.min(l,r);a=Math.max(l,r)}else{j?c.push({id:this.rows[E].id,value:g}):c.push(g)}}E++}if(h){switch(h.toLowerCase()){case"sum":c=k;break;case"avg":c=k/z;break;case"count":c=z;break;case"min":c=l;break;case"max":c=a}}}}}});return c},clearGridData:function(f){return this.each(function(){if(this.grid){if(typeof f!="boolean"){f=false}if(this.p.deepempty){b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove()}else{var j=b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(this.p.id)+" tbody:first").empty().append(j)}this.p.footerrow&&f&&b(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p_index={};this.updatepager(true,false)}})},getInd:function(f,j){var h=false,c;this.each(function(){if(c=this.rows.namedItem(f)){h=j===true?c:c.rowIndex}});return h},bindKeys:function(f){var j=b.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:true},f||{});return this.each(function(){var h=this;b("body").is("[role]")||b("body").attr("role","application");h.p.scrollrows=j.scrollingRows;b(h).keydown(function(c){var g=b(h).find("tr[tabindex=0]")[0],k,l,a,r=h.p.treeReader.expanded_field;if(g){a=h.p._index[g.id];if(c.keyCode===37||c.keyCode===38||c.keyCode===39||c.keyCode===40){if(c.keyCode===38){l=g.previousSibling;k="";if(l){if(b(l).is(":hidden")){for(;l;){l=l.previousSibling;if(!b(l).is(":hidden")&&b(l).hasClass("jqgrow")){k=l.id;break}}}else{k=l.id}}b(h).jqGrid("setSelection",k)}if(c.keyCode===40){l=g.nextSibling;k="";if(l){if(b(l).is(":hidden")){for(;l;){l=l.nextSibling;if(!b(l).is(":hidden")&&b(l).hasClass("jqgrow")){k=l.id;break}}}else{k=l.id}}b(h).jqGrid("setSelection",k)}if(c.keyCode===37){h.p.treeGrid&&h.p.data[a][r]&&b(g).find("div.treeclick").trigger("click");b.isFunction(j.onLeftKey)&&j.onLeftKey.call(h,h.p.selrow)}if(c.keyCode===39){h.p.treeGrid&&!h.p.data[a][r]&&b(g).find("div.treeclick").trigger("click");b.isFunction(j.onRightKey)&&j.onRightKey.call(h,h.p.selrow)}return false}else{if(c.keyCode===13){b.isFunction(j.onEnter)&&j.onEnter.call(h,h.p.selrow);return false}else{if(c.keyCode===32){b.isFunction(j.onSpace)&&j.onSpace.call(h,h.p.selrow);return false}}}}})})},unbindKeys:function(){return this.each(function(){b(this).unbind("keydown")})},getLocalRow:function(f){var j=false,h;this.each(function(){if(typeof f!=="undefined"){h=this.p._index[f];if(h>=0){j=this.p.data[h]}}});return j}})})(jQuery);(function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(b){return typeof b==="boolean"},isObject:function(b){return b&&(typeof b==="object"||a.isFunction(b))||false},isString:function(b){return typeof b==="string"},isNumber:function(b){return typeof b==="number"&&isFinite(b)},isNull:function(b){return b===null},isUndefined:function(b){return typeof b==="undefined"},isValue:function(b){return this.isObject(b)||this.isString(b)||this.isNumber(b)||this.isBoolean(b)},isEmpty:function(b){if(!this.isString(b)&&this.isValue(b)){return false}else{if(!this.isValue(b)){return true}}b=a.trim(b).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return b===""}});a.fn.fmatter=function(b,h,j,k,l){var m=h;j=a.extend({},a.jgrid.formatter,j);if(a.fn.fmatter[b]){m=a.fn.fmatter[b](h,j,k,l)}return m};a.fmatter.util={NumberFormat:function(m,n){a.fmatter.isNumber(m)||(m*=1);if(a.fmatter.isNumber(m)){var o=m<0,p=m+"",q=n.decimalSeparator?n.decimalSeparator:".",s;if(a.fmatter.isNumber(n.decimalPlaces)){var b=n.decimalPlaces;p=Math.pow(10,b);p=Math.round(m*p)/p+"";s=p.lastIndexOf(".");if(b>0){if(s<0){p+=q;s=p.length-1}else{if(q!=="."){p=p.replace(".",q)}}for(;p.length-1-s<b;){p+="0"}}}if(n.thousandsSeparator){b=n.thousandsSeparator;s=p.lastIndexOf(q);s=s>-1?s:p.length;q=p.substring(s);for(var k=-1,l=s;l>0;l--){k++;if(k%3===0&&l!==s&&(!o||l>1)){q=b+q}q=p.charAt(l-1)+q}p=q}p=n.prefix?n.prefix+p:p;return p=n.suffix?p+n.suffix:p}else{return m}},DateFormat:function(D,E,F,G){var H=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,I=typeof E==="string"?E.match(H):null;H=function(d,c){d=String(d);for(c=parseInt(c,10)||2;d.length<c;){d="0"+d}return d};var w={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},x=0,y,z=["i18n"];z.i18n={dayNames:G.dayNames,monthNames:G.monthNames};if(D in G.masks){D=G.masks[D]}if(E.constructor===Number){if(String(D).toLowerCase()=="u"){E*=1000}x=new Date(E)}else{if(E.constructor===Date){x=E}else{if(I!==null){x=new Date(parseInt(I[1],10));if(I[3]){D=Number(I[5])*60+Number(I[6]);D*=I[4]=="-"?1:-1;D-=x.getTimezoneOffset();x.setTime(Number(Number(x)+D*60000))}}else{E=String(E).split(/[\\\/:_;.,\t\T\s-]/);D=D.split(/[\\\/:_;.,\t\T\s-]/);I=0;for(y=D.length;I<y;I++){if(D[I]=="M"){x=a.inArray(E[I],z.i18n.monthNames);if(x!==-1&&x<12){E[I]=x+1}}if(D[I]=="F"){x=a.inArray(E[I],z.i18n.monthNames);if(x!==-1&&x>11){E[I]=x+1-12}}if(E[I]){w[D[I].toLowerCase()]=parseInt(E[I],10)}}if(w.f){w.m=w.f}if(w.m===0&&w.y===0&&w.d===0){return"&#160;"}w.m=parseInt(w.m,10)-1;x=w.y;if(x>=70&&x<=99){w.y=1900+w.y}else{if(x>=0&&x<=69){w.y=2000+w.y}}x=new Date(w.y,w.m,w.d,w.h,w.i,w.s,w.u)}}}if(F in G.masks){F=G.masks[F]}else{F||(F="Y-m-d")}D=x.getHours();E=x.getMinutes();w=x.getDate();I=x.getMonth()+1;y=x.getTimezoneOffset();var A=x.getSeconds(),C=x.getMilliseconds(),B=x.getDay(),b=x.getFullYear(),m=(B+6)%7+1,u=(new Date(b,I-1,w)-new Date(b,0,1))/86400000,v={d:H(w),D:z.i18n.dayNames[B],j:w,l:z.i18n.dayNames[B+7],N:m,S:G.S(w),w:B,z:u,W:m<5?Math.floor((u+m-1)/7)+1:Math.floor((u+m-1)/7)||(((new Date(b-1,0,1)).getDay()+6)%7<4?53:52),F:z.i18n.monthNames[I-1+12],m:H(I),M:z.i18n.monthNames[I-1],n:I,t:"?",L:"?",o:"?",Y:b,y:String(b).substring(2),a:D<12?G.AmPm[0]:G.AmPm[1],A:D<12?G.AmPm[2]:G.AmPm[3],B:"?",g:D%12||12,G:D,h:H(D%12||12),H:H(D),i:H(E),s:H(A),u:C,e:"?",I:"?",O:(y>0?"-":"+")+H(Math.floor(Math.abs(y)/60)*100+Math.abs(y)%60,4),P:"?",T:(String(x).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(x/1000)};return F.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(c){return c in v?v[c]:c.substring(1)})}};a.fn.fmatter.defaultFormat=function(b,d){return a.fmatter.isValue(b)&&b!==""?b:d.defaultValue?d.defaultValue:"&#160;"};a.fn.fmatter.email=function(b,d){return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):'<a href="mailto:'+b+'">'+b+"</a>"};a.fn.fmatter.checkbox=function(b,f){var h=a.extend({},f.checkbox),j;a.fmatter.isUndefined(f.colModel.formatoptions)||(h=a.extend({},h,f.colModel.formatoptions));j=h.disabled===true?'disabled="disabled"':"";if(a.fmatter.isEmpty(b)||a.fmatter.isUndefined(b)){b=a.fn.fmatter.defaultFormat(b,h)}b+="";b=b.toLowerCase();return'<input type="checkbox" '+(b.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+b+'" offval="no" '+j+"/>"};a.fn.fmatter.link=function(b,f){var h={target:f.target},j="";a.fmatter.isUndefined(f.colModel.formatoptions)||(h=a.extend({},h,f.colModel.formatoptions));if(h.target){j="target="+h.target}return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,f):"<a "+j+' href="'+b+'">'+b+"</a>"};a.fn.fmatter.showlink=function(b,f){var h={baseLinkUrl:f.baseLinkUrl,showAction:f.showAction,addParam:f.addParam||"",target:f.target,idName:f.idName},j="";a.fmatter.isUndefined(f.colModel.formatoptions)||(h=a.extend({},h,f.colModel.formatoptions));if(h.target){j="target="+h.target}h=h.baseLinkUrl+h.showAction+"?"+h.idName+"="+f.rowId+h.addParam;return a.fmatter.isString(b)||a.fmatter.isNumber(b)?"<a "+j+' href="'+h+'">'+b+"</a>":a.fn.fmatter.defaultFormat(b,f)};a.fn.fmatter.integer=function(b,e){var f=a.extend({},e.integer);a.fmatter.isUndefined(e.colModel.formatoptions)||(f=a.extend({},f,e.colModel.formatoptions));if(a.fmatter.isEmpty(b)){return f.defaultValue}return a.fmatter.util.NumberFormat(b,f)};a.fn.fmatter.number=function(b,e){var f=a.extend({},e.number);a.fmatter.isUndefined(e.colModel.formatoptions)||(f=a.extend({},f,e.colModel.formatoptions));if(a.fmatter.isEmpty(b)){return f.defaultValue}return a.fmatter.util.NumberFormat(b,f)};a.fn.fmatter.currency=function(b,e){var f=a.extend({},e.currency);a.fmatter.isUndefined(e.colModel.formatoptions)||(f=a.extend({},f,e.colModel.formatoptions));if(a.fmatter.isEmpty(b)){return f.defaultValue}return a.fmatter.util.NumberFormat(b,f)};a.fn.fmatter.date=function(b,f,h,j){h=a.extend({},f.date);a.fmatter.isUndefined(f.colModel.formatoptions)||(h=a.extend({},h,f.colModel.formatoptions));return !h.reformatAfterEdit&&j=="edit"?a.fn.fmatter.defaultFormat(b,f):a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,f):a.fmatter.util.DateFormat(h.srcformat,b,h.newformat,h)};a.fn.fmatter.select=function(o,p){o+="";var q=false,s=[];if(a.fmatter.isUndefined(p.colModel.formatoptions)){if(!a.fmatter.isUndefined(p.colModel.editoptions)){q=p.colModel.editoptions.value}}else{q=p.colModel.formatoptions.value}if(q){var t=p.colModel.editoptions.multiple===true?true:false,u=[],b;if(t){u=o.split(",");u=a.map(u,function(c){return a.trim(c)})}if(a.fmatter.isString(q)){for(var l=q.split(";"),m=0,n=0;n<l.length;n++){b=l[n].split(":");if(b.length>2){b[1]=jQuery.map(b,function(c,d){if(d>0){return c}}).join(":")}if(t){if(jQuery.inArray(b[0],u)>-1){s[m]=b[1];m++}}else{if(a.trim(b[0])==a.trim(o)){s[0]=b[1];break}}}}else{if(a.fmatter.isObject(q)){if(t){s=jQuery.map(u,function(c){return q[c]})}else{s[0]=q[o]||""}}}}o=s.join(", ");return o===""?a.fn.fmatter.defaultFormat(o,p):o};a.fn.fmatter.rowactions=function(b,h,j,k){var l={keys:false,editbutton:true,delbutton:true,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{}};k=a("#"+h)[0].p.colModel[k];a.fmatter.isUndefined(k.formatoptions)||(l=a.extend(l,k.formatoptions));k=function(c){l.afterSave&&l.afterSave(c);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+h).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+h).hide()};var m=function(c){l.afterRestore&&l.afterRestore(c);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+h).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+h).hide()};switch(j){case"edit":a("#"+h).jqGrid("editRow",b,l.keys,l.onEdit,l.onSuccess,l.url,l.extraparam,k,l.onError,m);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+h).hide();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+h).show();break;case"save":if(a("#"+h).jqGrid("saveRow",b,l.onSuccess,l.url,l.extraparam,k,l.onError,m)){a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+h).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+h).hide()}break;case"cancel":a("#"+h).jqGrid("restoreRow",b,m);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+h).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+h).hide();break;case"del":a("#"+h).jqGrid("delGridRow",b,l.delOptions)}};a.fn.fmatter.actions=function(b,h){var j={keys:false,editbutton:true,delbutton:true};a.fmatter.isUndefined(h.colModel.formatoptions)||(j=a.extend(j,h.colModel.formatoptions));var k=h.rowId,l="",m;if(typeof k=="undefined"||a.fmatter.isEmpty(k)){return""}if(j.editbutton){m="onclick=$.fn.fmatter.rowactions('"+k+"','"+h.gid+"','edit',"+h.pos+");";l=l+"<div style='margin-left:8px;'><div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+m+"><span class='ui-icon ui-icon-pencil'></span></div>"}if(j.delbutton){m="onclick=$.fn.fmatter.rowactions('"+k+"','"+h.gid+"','del',"+h.pos+");";l=l+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+m+"><span class='ui-icon ui-icon-trash'></span></div>"}m="onclick=$.fn.fmatter.rowactions('"+k+"','"+h.gid+"','save',"+h.pos+");";l=l+"<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+m+"></span></div>";m="onclick=$.fn.fmatter.rowactions('"+k+"','"+h.gid+"','cancel',"+h.pos+");";return l=l+"<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+m+"></span></div></div>"};a.unformat=function(m,n,o,p){var q,s=n.colModel.formatter,b=n.colModel.formatoptions||{},k=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=n.colModel.unformat||a.fn.fmatter[s]&&a.fn.fmatter[s].unformat;if(typeof l!=="undefined"&&a.isFunction(l)){q=l(a(m).text(),n,m)}else{if(!a.fmatter.isUndefined(s)&&a.fmatter.isString(s)){q=a.jgrid.formatter||{};switch(s){case"integer":b=a.extend({},q.integer,b);n=b.thousandsSeparator.replace(k,"\\$1");q=a(m).text().replace(RegExp(n,"g"),"");break;case"number":b=a.extend({},q.number,b);n=b.thousandsSeparator.replace(k,"\\$1");q=a(m).text().replace(RegExp(n,"g"),"").replace(b.decimalSeparator,".");break;case"currency":b=a.extend({},q.currency,b);n=b.thousandsSeparator.replace(k,"\\$1");q=a(m).text().replace(RegExp(n,"g"),"").replace(b.decimalSeparator,".").replace(b.prefix,"").replace(b.suffix,"");break;case"checkbox":b=n.colModel.editoptions?n.colModel.editoptions.value.split(":"):["Yes","No"];q=a("input",m).attr("checked")?b[0]:b[1];break;case"select":q=a.unformat.select(m,n,o,p);break;case"actions":return"";default:q=a(m).text()}}}return q?q:p===true?a(m).text():a.jgrid.htmlDecode(a(m).html())};a.unformat.select=function(m,n,o,p){o=[];m=a(m).text();if(p===true){return m}n=a.extend({},n.colModel.editoptions);if(n.value){var q=n.value;n=n.multiple===true?true:false;p=[];var s;if(n){p=m.split(",");p=a.map(p,function(c){return a.trim(c)})}if(a.fmatter.isString(q)){for(var b=q.split(";"),k=0,l=0;l<b.length;l++){s=b[l].split(":");if(s.length>2){s[1]=jQuery.map(s,function(c,d){if(d>0){return c}}).join(":")}if(n){if(jQuery.inArray(s[1],p)>-1){o[k]=s[0];k++}}else{if(a.trim(s[1])==a.trim(m)){o[0]=s[0];break}}}}else{if(a.fmatter.isObject(q)||a.isArray(q)){n||(p[0]=m);o=jQuery.map(p,function(c){var d;a.each(q,function(f,e){if(e==c){d=f;return false}});if(typeof d!="undefined"){return d}})}}return o.join(", ")}else{return m||""}};a.unformat.date=function(b,e){var f=a.jgrid.formatter.date||{};a.fmatter.isUndefined(e.formatoptions)||(f=a.extend({},f,e.formatoptions));return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):a.fmatter.util.DateFormat(f.newformat,b,f.srcformat,f)}})(jQuery);(function(b){b.jgrid.extend({getColProp:function(f){var a={},e=this[0];if(!e.grid){return false}e=e.p.colModel;for(var d=0;d<e.length;d++){if(e[d].name==f){a=e[d];break}}return a},setColProp:function(d,a){return this.each(function(){if(this.grid){if(a){for(var c=this.p.colModel,e=0;e<c.length;e++){if(c[e].name==d){b.extend(this.p.colModel[e],a);break}}}}})},sortGrid:function(e,a,d){return this.each(function(){var c=-1;if(this.grid){if(!e){e=this.p.sortname}for(var f=0;f<this.p.colModel.length;f++){if(this.p.colModel[f].index==e||this.p.colModel[f].name==e){c=f;break}}if(c!=-1){f=this.p.colModel[c].sortable;if(typeof f!=="boolean"){f=true}if(typeof a!=="boolean"){a=false}f&&this.sortData("jqgh_"+e,c,a,d)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&b(this.p.pager).remove();var d=this.id;try{b("#gbox_"+d).remove()}catch(a){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var d={id:b(this).attr("id"),cl:b(this).attr("class")};this.p.pager&&b(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");var a=document.createElement("table");b(a).attr({id:d.id});a.className=d.cl;d=this.id;b(a).removeClass("ui-jqgrid-btable");if(b(this.p.pager).parents("#gbox_"+d).length===1){b(a).insertBefore("#gbox_"+d).show();b(this.p.pager).insertBefore("#gbox_"+d)}else{b(a).insertBefore("#gbox_"+d).show()}b("#gbox_"+d).remove()}})},setGridState:function(a){return this.each(function(){if(this.grid){if(a=="hidden"){b(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast");this.p.pager&&b(this.p.pager).slideUp("fast");this.p.toppager&&b(this.p.toppager).slideUp("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&b(this.grid.ubDiv).slideUp("fast");b(this.grid.uDiv).slideUp("fast")}this.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast");b(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");this.p.gridstate="hidden"}else{if(a=="visible"){b(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast");this.p.pager&&b(this.p.pager).slideDown("fast");this.p.toppager&&b(this.p.toppager).slideDown("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&b(this.grid.ubDiv).slideDown("fast");b(this.grid.uDiv).slideDown("fast")}this.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast");b(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");this.p.gridstate="visible"}}}})},filterToolbar:function(a){a=b.extend({autosearch:true,searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND",defaultSearch:"bw"},a||{});return this.each(function(){function c(l,h){var k=b(l);k[0]&&jQuery.each(h,function(){this.data!==undefined?k.bind(this.type,this.data,this.fn):k.bind(this.type,this.fn)})}var e=this;if(!this.ftoolbar){var d=function(){var x={},y=0,h,w,z={},o;b.each(e.p.colModel,function(){w=this.index||this.name;switch(this.stype){case"select":o=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(h=b("#gs_"+b.jgrid.jqID(w),e.grid.hDiv).val()){x[w]=h;z[w]=o;y++}else{try{delete e.p.postData[w]}catch(k){}}break;case"text":o=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:a.defaultSearch;if(h=b("#gs_"+b.jgrid.jqID(w),e.grid.hDiv).val()){x[w]=h;z[w]=o;y++}else{try{delete e.p.postData[w]}catch(l){}}}});var t=y>0?true:false;if(a.stringResult===true||e.p.datatype=="local"){var s='{"groupOp":"'+a.groupOp+'","rules":[',u=0;b.each(x,function(k,l){if(u>0){s+=","}s+='{"field":"'+k+'",';s+='"op":"'+z[k]+'",';l+="";s+='"data":"'+l.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';u++});s+="]}";b.extend(e.p.postData,{filters:s});b.each(["searchField","searchString","searchOper"],function(k,l){e.p.postData.hasOwnProperty(l)&&delete e.p.postData[l]})}else{b.extend(e.p.postData,x)}var p;if(e.p.searchurl){p=e.p.url;b(e).jqGrid("setGridParam",{url:e.p.searchurl})}var v=false;if(b.isFunction(a.beforeSearch)){v=a.beforeSearch.call(e)}v||b(e).jqGrid("setGridParam",{search:t}).trigger("reloadGrid",[{page:1}]);p&&b(e).jqGrid("setGridParam",{url:p});b.isFunction(a.afterSearch)&&a.afterSearch()},f=b("<tr class='ui-search-toolbar' role='rowheader'></tr>"),j;b.each(e.p.colModel,function(){var u=this,v,h,t,w;h=b("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+e.p.direction+"'></th>");v=b("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===true&&b(h).css("display","none");this.search=this.search===false?false:true;if(typeof this.stype=="undefined"){this.stype="text"}t=b.extend({},this.searchoptions||{});if(this.search){switch(this.stype){case"select":if(w=this.surl||t.dataUrl){b.ajax(b.extend({url:w,dataType:"html",complete:function(k){if(t.buildSelect!==undefined){(k=t.buildSelect(k))&&b(v).append(k)}else{b(v).append(k.responseText)}t.defaultValue&&b("select",v).val(t.defaultValue);b("select",v).attr({name:u.index||u.name,id:"gs_"+u.name});t.attr&&b("select",v).attr(t.attr);b("select",v).css({width:"100%"});t.dataInit!==undefined&&t.dataInit(b("select",v)[0]);t.dataEvents!==undefined&&c(b("select",v)[0],t.dataEvents);a.autosearch===true&&b("select",v).change(function(){d();return false});k=null}},b.jgrid.ajaxOptions,e.p.ajaxSelectOptions||{}))}else{var l;if(u.searchoptions&&u.searchoptions.value){l=u.searchoptions.value}else{if(u.editoptions&&u.editoptions.value){l=u.editoptions.value}}if(l){w=document.createElement("select");w.style.width="100%";b(w).attr({name:u.index||u.name,id:"gs_"+u.name});var p,o;if(typeof l==="string"){l=l.split(";");for(var s=0;s<l.length;s++){p=l[s].split(":");o=document.createElement("option");o.value=p[0];o.innerHTML=p[1];w.appendChild(o)}}else{if(typeof l==="object"){for(p in l){if(l.hasOwnProperty(p)){o=document.createElement("option");o.value=p;o.innerHTML=l[p];w.appendChild(o)}}}}t.defaultValue&&b(w).val(t.defaultValue);t.attr&&b(w).attr(t.attr);t.dataInit!==undefined&&t.dataInit(w);t.dataEvents!==undefined&&c(w,t.dataEvents);b(v).append(w);a.autosearch===true&&b(w).change(function(){d();return false})}}break;case"text":w=t.defaultValue?t.defaultValue:"";b(v).append("<input type='text' style='width:95%;padding:0px;' name='"+(u.index||u.name)+"' id='gs_"+u.name+"' value='"+w+"'/>");t.attr&&b("input",v).attr(t.attr);t.dataInit!==undefined&&t.dataInit(b("input",v)[0]);t.dataEvents!==undefined&&c(b("input",v)[0],t.dataEvents);if(a.autosearch===true){a.searchOnEnter?b("input",v).keypress(function(k){if((k.charCode?k.charCode:k.keyCode?k.keyCode:0)==13){d();return false}return this}):b("input",v).keydown(function(k){switch(k.which){case 13:return false;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:j&&clearTimeout(j);j=setTimeout(function(){d()},500)}})}}}b(h).append(v);b(f).append(h)});b("table thead",e.grid.hDiv).append(f);this.ftoolbar=true;this.triggerToolbar=d;this.clearToolbar=function(w){var x={},h,v=0,y;w=typeof w!="boolean"?true:w;b.each(e.p.colModel,function(){h=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";y=this.index||this.name;switch(this.stype){case"select":var k;b("#gs_"+b.jgrid.jqID(y)+" option",e.grid.hDiv).each(function(n){if(n===0){this.selected=true}if(b(this).text()==h){this.selected=true;k=b(this).val();return false}});if(k){x[y]=k;v++}else{try{delete e.p.postData[y]}catch(m){}}break;case"text":b("#gs_"+b.jgrid.jqID(y),e.grid.hDiv).val(h);if(h){x[y]=h;v++}else{try{delete e.p.postData[y]}catch(l){}}}});var o=v>0?true:false;if(a.stringResult===true||e.p.datatype=="local"){var t='{"groupOp":"'+a.groupOp+'","rules":[',s=0;b.each(x,function(k,l){if(s>0){t+=","}t+='{"field":"'+k+'",';t+='"op":"eq",';l+="";t+='"data":"'+l.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';s++});t+="]}";b.extend(e.p.postData,{filters:t});b.each(["searchField","searchString","searchOper"],function(k,l){e.p.postData.hasOwnProperty(l)&&delete e.p.postData[l]})}else{b.extend(e.p.postData,x)}var u;if(e.p.searchurl){u=e.p.url;b(e).jqGrid("setGridParam",{url:e.p.searchurl})}var p=false;if(b.isFunction(a.beforeClear)){p=a.beforeClear.call(e)}p||w&&b(e).jqGrid("setGridParam",{search:o}).trigger("reloadGrid",[{page:1}]);u&&b(e).jqGrid("setGridParam",{url:u});b.isFunction(a.afterClear)&&a.afterClear()};this.toggleToolbar=function(){var h=b("tr.ui-search-toolbar",e.grid.hDiv);h.css("display")=="none"?h.show():h.hide()}}})}})})(jQuery);(function(b){b.extend(b.jgrid,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(e,h){h=b.extend({jqm:true,gb:""},h||{});if(h.onClose){var j=h.onClose(e);if(typeof j=="boolean"&&!j){return}}if(b.fn.jqm&&h.jqm===true){b(e).attr("aria-hidden","true").jqmHide()}else{if(h.gb!==""){try{b(".jqgrid-overlay:first",h.gb).hide()}catch(a){}}b(e).hide().attr("aria-hidden","true")}},findPos:function(a){var e=0,f=0;if(a.offsetParent){do{e+=a.offsetLeft;f+=a.offsetTop}while(a=a.offsetParent)}return[e,f]},createModal:function(y,z,A,C,D,p,t){var B=document.createElement("div"),u,w=this;t=b.extend({},t||{});u=b(A.gbox).attr("dir")=="rtl"?true:false;B.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";B.id=y.themodal;var s=document.createElement("div");s.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";s.id=y.modalhead;b(s).append("<span class='ui-jqdialog-title'>"+A.caption+"</span>");var a=b("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){a.addClass("ui-state-hover")},function(){a.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");b(s).append(a);if(u){B.dir="rtl";b(".ui-jqdialog-title",s).css("float","right");b(".ui-jqdialog-titlebar-close",s).css("left","0.3em")}else{B.dir="ltr";b(".ui-jqdialog-title",s).css("float","left");b(".ui-jqdialog-titlebar-close",s).css("right","0.3em")}var v=document.createElement("div");b(v).addClass("ui-jqdialog-content ui-widget-content").attr("id",y.modalcontent);b(v).append(z);B.appendChild(v);b(B).prepend(s);if(p===true){b("body").append(B)}else{typeof p=="string"?b(p).append(B):b(B).insertBefore(C)}b(B).css(t);if(typeof A.jqModal==="undefined"){A.jqModal=true}z={};if(b.fn.jqm&&A.jqModal===true){if(A.left===0&&A.top===0&&A.overlay){t=[];t=this.findPos(D);A.left=t[0]+4;A.top=t[1]+4}z.top=A.top+"px";z.left=A.left}else{if(A.left!==0||A.top!==0){z.left=A.left;z.top=A.top+"px"}}b("a.ui-jqdialog-titlebar-close",s).click(function(){var c=b("#"+y.themodal).data("onClose")||A.onClose,d=b("#"+y.themodal).data("gbox")||A.gbox;w.hideModal("#"+y.themodal,{gb:d,jqm:A.jqModal,onClose:c});return false});if(A.width===0||!A.width){A.width=300}if(A.height===0||!A.height){A.height=200}if(!A.zIndex){C=b(C).parents("*[role=dialog]").filter(":first").css("z-index");A.zIndex=C?parseInt(C,10)+1:950}C=0;if(u&&z.left&&!p){C=b(A.gbox).width()-(!isNaN(A.width)?parseInt(A.width,10):0)-8;z.left=parseInt(z.left,10)+parseInt(C,10)}if(z.left){z.left+="px"}b(B).css(b.extend({width:isNaN(A.width)?"auto":A.width+"px",height:isNaN(A.height)?"auto":A.height+"px",zIndex:A.zIndex,overflow:"hidden"},z)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":y.modalhead,"aria-hidden":"true"});if(typeof A.drag=="undefined"){A.drag=true}if(typeof A.resize=="undefined"){A.resize=true}if(A.drag){b(s).css("cursor","move");if(b.fn.jqDrag){b(B).jqDrag(s)}else{try{b(B).draggable({handle:b("#"+s.id)})}catch(x){}}}if(A.resize){if(b.fn.jqResize){b(B).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");b("#"+y.themodal).jqResize(".jqResize",y.scrollelm?"#"+y.scrollelm:false)}else{try{b(B).resizable({handles:"se, sw",alsoResize:y.scrollelm?"#"+y.scrollelm:false})}catch(o){}}}A.closeOnEscape===true&&b(B).keydown(function(c){if(c.which==27){c=b("#"+y.themodal).data("onClose")||A.onClose;w.hideModal(this,{gb:A.gbox,jqm:A.jqModal,onClose:c})}})},viewModal:function(a,e){e=b.extend({toTop:true,overlay:10,modal:false,onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true,jqM:true},e||{});if(b.fn.jqm&&e.jqm===true){e.jqM?b(a).attr("aria-hidden","false").jqm(e).jqmShow():b(a).attr("aria-hidden","false").jqmShow()}else{if(e.gbox!==""){b(".jqgrid-overlay:first",e.gbox).show();b(a).data("gbox",e.gbox)}b(a).show().attr("aria-hidden","false");try{b(":input:visible",a)[0].focus()}catch(f){}}},info_dialog:function(p,q,s,u){var v={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+p+"</b>",left:250,top:170,zIndex:1000,jqModal:true,modal:false,closeOnEscape:true,align:"center",buttonalign:"center",buttons:[]};b.extend(v,u||{});var a=v.jqModal,l=this;if(b.fn.jqm&&!a){a=false}p="";if(v.buttons.length>0){for(u=0;u<v.buttons.length;u++){if(typeof v.buttons[u].id=="undefined"){v.buttons[u].id="info_button_"+u}p+="<a href='javascript:void(0)' id='"+v.buttons[u].id+"' class='fm-button ui-state-default ui-corner-all'>"+v.buttons[u].text+"</a>"}}u=isNaN(v.dataheight)?v.dataheight:v.dataheight+"px";var t="<div id='info_id'>";t+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+u+";"+("text-align:"+v.align+";")+"'>"+q+"</div>";t+=s?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+v.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+s+"</a>"+p+"</div>":p!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+v.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+p+"</div>":"";t+="</div>";try{b("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:a});b("#info_dialog").remove()}catch(n){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},t,v,"","",true);p&&b.each(v.buttons,function(c){b("#"+this.id,"#info_id").bind("click",function(){v.buttons[c].onClick.call(b("#info_dialog"));return false})});b("#closedialog","#info_id").click(function(){l.hideModal("#info_dialog",{jqm:a});return false});b(".fm-button","#info_dialog").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});b.isFunction(v.beforeOpen)&&v.beforeOpen();this.viewModal("#info_dialog",{onHide:function(c){c.w.hide().remove();c.o&&c.o.remove()},modal:v.modal,jqm:a});b.isFunction(v.afterOpen)&&v.afterOpen();try{b("#info_dialog").focus()}catch(o){}},createEl:function(s,t,u,w,x){function a(d,c){b.isFunction(c.dataInit)&&c.dataInit(d);c.dataEvents&&b.each(c.dataEvents,function(){this.data!==undefined?b(d).bind(this.type,this.data,this.fn):b(d).bind(this.type,this.fn)});return c}function n(d,e){var c=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];b.each(e,function(f,h){b.inArray(f,c)===-1&&b(d).attr(f,h)});e.hasOwnProperty("id")||b(d).attr("id",b.jgrid.randId())}var v="";switch(s){case"textarea":v=document.createElement("textarea");if(w){t.cols||b(v).css({width:"98%"})}else{if(!t.cols){t.cols=20}}if(!t.rows){t.rows=2}if(u=="&nbsp;"||u=="&#160;"||u.length==1&&u.charCodeAt(0)==160){u=""}v.value=u;n(v,t);t=a(v,t);b(v).attr({role:"textbox",multiline:"true"});break;case"checkbox":v=document.createElement("input");v.type="checkbox";if(t.value){s=t.value.split(":");if(u===s[0]){v.checked=true;v.defaultChecked=true}v.value=s[0];b(v).attr("offval",s[1])}else{s=u.toLowerCase();if(s.search(/(false|0|no|off|undefined)/i)<0&&s!==""){v.checked=true;v.defaultChecked=true;v.value=u}else{v.value="on"}b(v).attr("offval","off")}n(v,t);t=a(v,t);b(v).attr("role","checkbox");break;case"select":v=document.createElement("select");v.setAttribute("role","select");w=[];if(t.multiple===true){s=true;v.multiple="multiple";b(v).attr("aria-multiselectable","true")}else{s=false}if(typeof t.dataUrl!="undefined"){b.ajax(b.extend({url:t.dataUrl,type:"GET",dataType:"html",context:{elem:v,options:t,vl:u},success:function(c){var d=[],h=this.elem,f=this.vl,e=b.extend({},this.options),j=e.multiple===true;if(typeof e.buildSelect!="undefined"){c=e.buildSelect(c)}if(c=b(c).html()){b(h).append(c);n(h,e);e=a(h,e);if(typeof e.size==="undefined"){e.size=j?3:1}if(j){d=f.split(",");d=b.map(d,function(k){return b.trim(k)})}else{d[0]=b.trim(f)}setTimeout(function(){b("option",h).each(function(){b(this).attr("role","option");if(b.inArray(b.trim(b(this).text()),d)>-1||b.inArray(b.trim(b(this).val()),d)>-1){this.selected="selected"}})},0)}}},x||{}))}else{if(t.value){var o;if(s){w=u.split(",");w=b.map(w,function(c){return b.trim(c)});if(typeof t.size==="undefined"){t.size=3}}else{t.size=1}if(typeof t.value==="function"){t.value=t.value()}var p,l;if(typeof t.value==="string"){p=t.value.split(";");for(o=0;o<p.length;o++){l=p[o].split(":");if(l.length>2){l[1]=b.map(l,function(d,c){if(c>0){return d}}).join(":")}x=document.createElement("option");x.setAttribute("role","option");x.value=l[0];x.innerHTML=l[1];if(!s&&(b.trim(l[0])==b.trim(u)||b.trim(l[1])==b.trim(u))){x.selected="selected"}if(s&&(b.inArray(b.trim(l[1]),w)>-1||b.inArray(b.trim(l[0]),w)>-1)){x.selected="selected"}v.appendChild(x)}}else{if(typeof t.value==="object"){p=t.value;for(o in p){if(p.hasOwnProperty(o)){x=document.createElement("option");x.setAttribute("role","option");x.value=o;x.innerHTML=p[o];if(!s&&(b.trim(o)==b.trim(u)||b.trim(p[o])==b.trim(u))){x.selected="selected"}if(s&&(b.inArray(b.trim(p[o]),w)>-1||b.inArray(b.trim(o),w)>-1)){x.selected="selected"}v.appendChild(x)}}}}n(v,t);t=a(v,t)}}break;case"text":case"password":case"button":o=s=="button"?"button":"textbox";v=document.createElement("input");v.type=s;v.value=u;n(v,t);t=a(v,t);if(s!="button"){if(w){t.size||b(v).css({width:"98%"})}else{if(!t.size){t.size=20}}}b(v).attr("role",o);break;case"image":case"file":v=document.createElement("input");v.type=s;n(v,t);t=a(v,t);break;case"custom":v=document.createElement("span");try{if(b.isFunction(t.custom_element)){if(p=t.custom_element.call(this,u,t)){p=b(p).addClass("customelement").attr({id:t.id,name:t.name});b(v).empty().append(p)}else{throw"e2"}}else{throw"e1"}}catch(y){y=="e1"&&this.info_dialog(b.jgrid.errors.errcap,"function 'custom_element' "+b.jgrid.edit.msg.nodefined,b.jgrid.edit.bClose);y=="e2"?this.info_dialog(b.jgrid.errors.errcap,"function 'custom_element' "+b.jgrid.edit.msg.novalue,b.jgrid.edit.bClose):this.info_dialog(b.jgrid.errors.errcap,typeof y==="string"?y:y.message,b.jgrid.edit.bClose)}}return v},checkDate:function(n,o){var p={},s;n=n.toLowerCase();s=n.indexOf("/")!=-1?"/":n.indexOf("-")!=-1?"-":n.indexOf(".")!=-1?".":"/";n=n.split(s);o=o.split(s);if(o.length!=3){return false}s=-1;for(var t,a=-1,l=-1,q=0;q<n.length;q++){t=isNaN(o[q])?0:parseInt(o[q],10);p[n[q]]=t;t=n[q];if(t.indexOf("y")!=-1){s=q}if(t.indexOf("m")!=-1){l=q}if(t.indexOf("d")!=-1){a=q}}t=n[s]=="y"||n[s]=="yyyy"?4:n[s]=="yy"?2:-1;q=function(d){for(var c=1;c<=d;c++){this[c]=31;if(c==4||c==6||c==9||c==11){this[c]=30}if(c==2){this[c]=29}}return this}(12);var m;if(s===-1){return false}else{m=p[n[s]].toString();if(t==2&&m.length==1){t=1}if(m.length!=t||p[n[s]]===0&&o[s]!="00"){return false}}if(l===-1){return false}else{m=p[n[l]].toString();if(m.length<1||p[n[l]]<1||p[n[l]]>12){return false}}if(a===-1){return false}else{m=p[n[a]].toString();if(m.length<1||p[n[a]]<1||p[n[a]]>31||p[n[l]]==2&&p[n[a]]>(p[n[s]]%4===0&&(p[n[s]]%100!==0||p[n[s]]%400===0)?29:28)||p[n[a]]>q[p[n[l]]]){return false}}return true},isEmpty:function(a){return a.match(/^\s+$/)||a===""?true:false},checkTime:function(a){var d=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(a)){if(a=a.match(d)){if(a[3]){if(a[1]<1||a[1]>12){return false}}else{if(a[1]>23){return false}}if(a[2]>59){return false}}else{return false}}return true},checkValues:function(l,m,n,p,q){var a,k;if(typeof p==="undefined"){if(typeof m=="string"){p=0;for(q=n.p.colModel.length;p<q;p++){if(n.p.colModel[p].name==m){a=n.p.colModel[p].editrules;m=p;try{k=n.p.colModel[p].formoptions.label}catch(o){}break}}}else{if(m>=0){a=n.p.colModel[m].editrules}}}else{a=p;k=q===undefined?"_":q}if(a){k||(k=n.p.colNames[m]);if(a.required===true){if(this.isEmpty(l)){return[false,k+": "+b.jgrid.edit.msg.required,""]}}p=a.required===false?false:true;if(a.number===true){if(!(p===false&&this.isEmpty(l))){if(isNaN(l)){return[false,k+": "+b.jgrid.edit.msg.number,""]}}}if(typeof a.minValue!="undefined"&&!isNaN(a.minValue)){if(parseFloat(l)<parseFloat(a.minValue)){return[false,k+": "+b.jgrid.edit.msg.minValue+" "+a.minValue,""]}}if(typeof a.maxValue!="undefined"&&!isNaN(a.maxValue)){if(parseFloat(l)>parseFloat(a.maxValue)){return[false,k+": "+b.jgrid.edit.msg.maxValue+" "+a.maxValue,""]}}if(a.email===true){if(!(p===false&&this.isEmpty(l))){q=/^((([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;if(!q.test(l)){return[false,k+": "+b.jgrid.edit.msg.email,""]}}}if(a.integer===true){if(!(p===false&&this.isEmpty(l))){if(isNaN(l)){return[false,k+": "+b.jgrid.edit.msg.integer,""]}if(l%1!==0||l.indexOf(".")!=-1){return[false,k+": "+b.jgrid.edit.msg.integer,""]}}}if(a.date===true){if(!(p===false&&this.isEmpty(l))){m=n.p.colModel[m].formatoptions&&n.p.colModel[m].formatoptions.newformat?n.p.colModel[m].formatoptions.newformat:n.p.colModel[m].datefmt||"Y-m-d";if(!this.checkDate(m,l)){return[false,k+": "+b.jgrid.edit.msg.date+" - "+m,""]}}}if(a.time===true){if(!(p===false&&this.isEmpty(l))){if(!this.checkTime(l)){return[false,k+": "+b.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]}}}if(a.url===true){if(!(p===false&&this.isEmpty(l))){q=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!q.test(l)){return[false,k+": "+b.jgrid.edit.msg.url,""]}}}if(a.custom===true){if(!(p===false&&this.isEmpty(l))){if(b.isFunction(a.custom_func)){l=a.custom_func.call(n,l,k);return b.isArray(l)?l:[false,b.jgrid.edit.msg.customarray,""]}else{return[false,b.jgrid.edit.msg.customfcheck,""]}}}}return[true,"",""]}})})(jQuery);(function(b){var d=null;b.jgrid.extend({searchGrid:function(a){a=b.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,multipleGroup:false,top:0,left:0,jqModal:true,modal:false,resize:false,width:450,height:"auto",dataheight:"auto",showQuery:false,errorcheck:true,sopt:null,stringResult:undefined,onClose:null,onSearch:null,onReset:null,toTop:true,overlay:10,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:false,layer:null},b.jgrid.search,a||{});return this.each(function(){function B(){if(b.isFunction(a.beforeShowSearch)){F=a.beforeShowSearch(b("#"+h));if(typeof F==="undefined"){F=true}}if(F){b.jgrid.viewModal("#"+c.themodal,{gbox:"#gbox_"+h,jqm:a.jqModal,modal:a.modal,overlay:a.overlay,toTop:a.toTop});b.isFunction(a.afterShowSearch)&&a.afterShowSearch(b("#"+h))}}var x=this;if(x.grid){var h="fbox_"+x.p.id,F=true,c={themodal:"searchmod"+h,modalhead:"searchhd"+h,modalcontent:"searchcnt"+h,scrollelm:h},G=x.p.postData[a.sFilter];if(typeof G==="string"){G=b.jgrid.parse(G)}a.recreateFilter===true&&b("#"+c.themodal).remove();if(b("#"+c.themodal).html()!==null){B()}else{var v=b("<span><div id='"+h+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+x.p.id);if(b.isFunction(a.onInitializeSearch)){a.onInitializeSearch(b("#"+h))}var y=b.extend([],x.p.colModel),j="<a href='javascript:void(0)' id='"+h+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+a.Find+"</a>",k="<a href='javascript:void(0)' id='"+h+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+a.Reset+"</a>",f="",E="",m,A=false;if(a.showQuery){f="<a href='javascript:void(0)' id='"+h+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>"}if(a.columns.length){y=a.columns}else{b.each(y,function(e,n){if(!n.label){n.label=x.p.colNames[e]}if(!A){var o=typeof n.search==="undefined"?true:n.search,l=n.hidden===true;if(n.searchoptions&&n.searchoptions.searchhidden===true&&o||o&&!l){A=true;m=n.index||n.name}}})}if(!G&&m||a.multipleSearch===false){G={groupOp:"AND",rules:[{field:m,op:"eq",data:""}]}}A=false;if(a.tmplNames&&a.tmplNames.length){A=true;E=a.tmplLabel;E+="<select class='ui-template'>";E+="<option value='default'>Default</option>";b.each(a.tmplNames,function(l,e){E+="<option value='"+l+"'>"+e+"</option>"});E+="</select>"}j="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+h+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+k+E+"</td><td class='EditButton'>"+f+j+"</td></tr></tbody></table>";b("#"+h).jqFilter({columns:y,filter:a.loadDefaults?G:null,showQuery:a.showQuery,errorcheck:a.errorcheck,sopt:a.sopt,groupButton:a.multipleGroup,_gridsopt:b.jgrid.search.odata,onChange:function(){this.p.showQuery&&b(".query",this).html(this.toUserFriendlyString())}});v.append(j);A&&a.tmplFilters&&a.tmplFilters.length&&b(".ui-template",v).bind("change",function(){var e=b(this).val();e=="default"?b("#"+h).jqFilter("addFilter",G):b("#"+h).jqFilter("addFilter",a.tmplFilters[parseInt(e,10)]);return false});if(a.multipleSearch===false){b(".add-rule","#"+h).hide();b(".delete-rule","#"+h).hide()}if(b.isFunction(a.onInitializeSearch)){a.onInitializeSearch(b("#"+h))}a.layer?b.jgrid.createModal(c,v,a,"#gview_"+x.p.id,b("#gbox_"+x.p.id)[0],"#"+a.layer,{position:"relative"}):b.jgrid.createModal(c,v,a,"#gview_"+x.p.id,b("#gbox_"+x.p.id)[0]);f&&b("#"+h+"_query").bind("click",function(){b(".queryresult",v).toggle();return false});if(a.stringResult===undefined){a.stringResult=a.multipleSearch}b("#"+h+"_search").bind("click",function(){var p=b("#"+h),l={},e,o=p.jqFilter("filterData");if(a.errorcheck){p[0].hideError();a.showQuery||p.jqFilter("toSQLString");if(p[0].p.error){p[0].showError();return false}}if(a.stringResult){try{e=xmlJsonClass.toJson(o,"","",false)}catch(n){try{e=JSON.stringify(o)}catch(q){}}if(typeof e==="string"){l[a.sFilter]=e;b.each([a.sField,a.sValue,a.sOper],function(){l[this]=""})}}else{if(a.multipleSearch){l[a.sFilter]=o;b.each([a.sField,a.sValue,a.sOper],function(){l[this]=""})}else{l[a.sField]=o.rules[0].field;l[a.sValue]=o.rules[0].data;l[a.sOper]=o.rules[0].op;l[a.sFilter]=""}}x.p.search=true;b.extend(x.p.postData,l);if(b.isFunction(a.onSearch)){a.onSearch()}b(x).trigger("reloadGrid",[{page:1}]);a.closeAfterSearch&&b.jgrid.hideModal("#"+c.themodal,{gb:"#gbox_"+x.p.id,jqm:a.jqModal,onClose:a.onClose});return false});b("#"+h+"_reset").bind("click",function(){var l={},e=b("#"+h);x.p.search=false;if(a.multipleSearch===false){l[a.sField]=l[a.sValue]=l[a.sOper]=""}else{l[a.sFilter]=""}e[0].resetFilter();A&&b(".ui-template",v).val("default");b.extend(x.p.postData,l);if(b.isFunction(a.onReset)){a.onReset()}b(x).trigger("reloadGrid",[{page:1}]);return false});B();b(".fm-button:not(.ui-state-disabled)",v).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}}})},editGridRow:function(a,c){d=c=b.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:10,drag:true,resize:true,url:null,mtype:"POST",clearAfterAdd:true,closeAfterEdit:false,reloadAfterSubmit:true,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:false,jqModal:true,closeOnEscape:false,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[false,13],navkeys:[false,38,40],checkOnSubmit:false,checkOnUpdate:false,_savedData:{},processing:false,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:true},b.jgrid.edit,c||{});return this.each(function(){function ab(){b(".FormElement","#"+ag).each(function(){var e=b(".customelement",this);if(e.length){var f=b(e[0]).attr("name");b.each(af.p.colModel,function(){if(this.name===f&&this.editoptions&&b.isFunction(this.editoptions.custom_value)){try{Z[f]=this.editoptions.custom_value(b("#"+b.jgrid.jqID(f),"#"+ag),"get");if(Z[f]===undefined){throw"e1"}}catch(j){j==="e1"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,j.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(b(this).get(0).type){case"checkbox":if(b(this).attr("checked")){Z[this.name]=b(this).val()}else{e=b(this).attr("offval");Z[this.name]=e}break;case"select-one":Z[this.name]=b("option:selected",this).val();ai[this.name]=b("option:selected",this).text();break;case"select-multiple":Z[this.name]=b(this).val();Z[this.name]=Z[this.name]?Z[this.name].join(","):"";var h=[];b("option:selected",this).each(function(j,l){h[j]=b(l).text()});ai[this.name]=h.join(",");break;case"password":case"text":case"textarea":case"button":Z[this.name]=b(this).val()}if(af.p.autoencode){Z[this.name]=b.jgrid.htmlEncode(Z[this.name])}}});return true}function M(n,o,j,h){var w,t,e,p=0,u,s,x,m=[],q=false,f="",l;for(l=1;l<=h;l++){f+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>"}if(n!="_empty"){q=b(o).jqGrid("getInd",n)}b(o.p.colModel).each(function(H){w=this.name;s=(t=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(w!=="cb"&&w!=="subgrid"&&this.editable===true&&w!=="rn"){if(q===false){u=""}else{if(w==o.p.ExpandColumn&&o.p.treeGrid===true){u=b("td:eq("+H+")",o.rows[q]).text()}else{try{u=b.unformat(b("td:eq("+H+")",o.rows[q]),{rowId:n,colModel:this},H)}catch(z){u=b("td:eq("+H+")",o.rows[q]).text()}}}var D=b.extend({},this.editoptions||{},{id:w,name:w}),G=b.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),I=parseInt(G.rowpos,10)||p+1,C=parseInt((parseInt(G.colpos,10)||1)*2,10);if(n=="_empty"&&D.defaultValue){u=b.isFunction(D.defaultValue)?D.defaultValue():D.defaultValue}if(!this.edittype){this.edittype="text"}if(af.p.autoencode){u=b.jgrid.htmlDecode(u)}x=b.jgrid.createEl(this.edittype,D,u,false,b.extend({},b.jgrid.ajaxOptions,o.p.ajaxSelectOptions||{}));if(u===""&&this.edittype=="checkbox"){u=b(x).attr("offval")}if(u===""&&this.edittype=="select"){u=b("option:eq(0)",x).text()}if(d.checkOnSubmit||d.checkOnUpdate){d._savedData[w]=u}b(x).addClass("FormElement");if(this.edittype=="text"||this.edittype=="textarea"){b(x).addClass("ui-widget-content ui-corner-all")}e=b(j).find("tr[rowpos="+I+"]");if(G.rowabove){D=b("<tr><td class='contentinfo' colspan='"+h*2+"'>"+G.rowcontent+"</td></tr>");b(j).append(D);D[0].rp=I}if(e.length===0){e=b("<tr "+s+" rowpos='"+I+"'></tr>").addClass("FormData").attr("id","tr_"+w);b(e).append(f);b(j).append(e);e[0].rp=I}b("td:eq("+(C-2)+")",e[0]).html(typeof G.label==="undefined"?o.p.colNames[H]:G.label);b("td:eq("+(C-1)+")",e[0]).append(G.elmprefix).append(x).append(G.elmsuffix);m[p]=H;p++}});if(p>0){l=b("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(h*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+o.p.id+"_id' value='"+n+"'/></td></tr>");l[0].rp=p+999;b(j).append(l);if(d.checkOnSubmit||d.checkOnUpdate){d._savedData[o.p.id+"_id"]=n}}return m}function v(e,j,s){var n,t=0,o,h,l,p,m;if(d.checkOnSubmit||d.checkOnUpdate){d._savedData={};d._savedData[j.p.id+"_id"]=e}var f=j.p.colModel;if(e=="_empty"){b(f).each(function(){n=this.name;l=b.extend({},this.editoptions||{});if((h=b("#"+b.jgrid.jqID(n),"#"+s))&&h[0]!==null){p="";if(l.defaultValue){p=b.isFunction(l.defaultValue)?l.defaultValue():l.defaultValue;if(h[0].type=="checkbox"){m=p.toLowerCase();if(m.search(/(false|0|no|off|undefined)/i)<0&&m!==""){h[0].checked=true;h[0].defaultChecked=true;h[0].value=p}else{h.attr({checked:"",defaultChecked:""})}}else{h.val(p)}}else{if(h[0].type=="checkbox"){h[0].checked=false;h[0].defaultChecked=false;p=b(h).attr("offval")}else{if(h[0].type&&h[0].type.substr(0,6)=="select"){h[0].selectedIndex=0}else{h.val(p)}}}if(d.checkOnSubmit===true||d.checkOnUpdate){d._savedData[n]=p}}});b("#id_g","#"+s).val(e)}else{var q=b(j).jqGrid("getInd",e,true);if(q){b("td",q).each(function(w){n=f[w].name;if(n!=="cb"&&n!=="subgrid"&&n!=="rn"&&f[w].editable===true){if(n==j.p.ExpandColumn&&j.p.treeGrid===true){o=b(this).text()}else{try{o=b.unformat(b(this),{rowId:e,colModel:f[w]},w)}catch(x){o=b(this).text()}}if(af.p.autoencode){o=b.jgrid.htmlDecode(o)}if(d.checkOnSubmit===true||d.checkOnUpdate){d._savedData[n]=o}n=b.jgrid.jqID(n);switch(f[w].edittype){case"password":case"text":case"button":case"image":b("#"+n,"#"+s).val(o);break;case"textarea":if(o=="&nbsp;"||o=="&#160;"||o.length==1&&o.charCodeAt(0)==160){o=""}b("#"+n,"#"+s).val(o);break;case"select":var z=o.split(",");z=b.map(z,function(C){return b.trim(C)});b("#"+n+" option","#"+s).each(function(){this.selected=!f[w].editoptions.multiple&&(z[0]==b.trim(b(this).text())||z[0]==b.trim(b(this).val()))?true:f[w].editoptions.multiple?b.inArray(b.trim(b(this).text()),z)>-1||b.inArray(b.trim(b(this).val()),z)>-1?true:false:false});break;case"checkbox":o+="";if(f[w].editoptions&&f[w].editoptions.value){if(f[w].editoptions.value.split(":")[0]==o){b("#"+n,"#"+s).attr("checked",true);b("#"+n,"#"+s).attr("defaultChecked",true)}else{b("#"+n,"#"+s).attr("checked",false);b("#"+n,"#"+s).attr("defaultChecked","")}}else{o=o.toLowerCase();if(o.search(/(false|0|no|off|undefined)/i)<0&&o!==""){b("#"+n,"#"+s).attr("checked",true);b("#"+n,"#"+s).attr("defaultChecked",true)}else{b("#"+n,"#"+s).attr("checked",false);b("#"+n,"#"+s).attr("defaultChecked","")}}break;case"custom":try{if(f[w].editoptions&&b.isFunction(f[w].editoptions.custom_value)){f[w].editoptions.custom_value(b("#"+n,"#"+s),"set",o)}else{throw"e1"}}catch(u){u=="e1"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,u.message,jQuery.jgrid.edit.bClose)}}t++}});t>0&&b("#id_g","#"+ag).val(e)}}}function E(){var e,h=[true,"",""],o={},l=af.p.prmNames,p,m,f,j;if(b.isFunction(d.beforeCheckValues)){var n=d.beforeCheckValues(Z,b("#"+ae),Z[af.p.id+"_id"]=="_empty"?l.addoper:l.editoper);if(n&&typeof n==="object"){Z=n}}for(f in Z){if(Z.hasOwnProperty(f)){h=b.jgrid.checkValues(Z[f],f,af);if(h[0]===false){break}}}if(h[0]){if(b.isFunction(d.onclickSubmit)){o=d.onclickSubmit(d,Z)||{}}if(b.isFunction(d.beforeSubmit)){h=d.beforeSubmit(Z,b("#"+ae))}}if(h[0]&&!d.processing){d.processing=true;b("#sData","#"+ag+"_2").addClass("ui-state-active");m=l.oper;p=l.id;Z[m]=b.trim(Z[af.p.id+"_id"])=="_empty"?l.addoper:l.editoper;if(Z[m]!=l.addoper){Z[p]=Z[af.p.id+"_id"]}else{if(Z[p]===undefined){Z[p]=Z[af.p.id+"_id"]}}delete Z[af.p.id+"_id"];Z=b.extend(Z,d.editData,o);if(af.p.treeGrid===true){if(Z[m]==l.addoper){j=b(af).jqGrid("getGridParam","selrow");Z[af.p.treeGridModel=="adjacency"?af.p.treeReader.parent_id_field:"parent_id"]=j}for(i in af.p.treeReader){o=af.p.treeReader[i];if(Z.hasOwnProperty(o)){Z[m]==l.addoper&&i==="parent_id_field"||delete Z[o]}}}o=b.extend({url:d.url?d.url:b(af).jqGrid("getGridParam","editurl"),type:d.mtype,data:b.isFunction(d.serializeEditData)?d.serializeEditData(Z):Z,complete:function(s,t){if(t!="success"){h[0]=false;h[1]=b.isFunction(d.errorTextFormat)?d.errorTextFormat(s):t+" Status: '"+s.statusText+"'. Error code: "+s.status}else{if(b.isFunction(d.afterSubmit)){h=d.afterSubmit(s,Z)}}if(h[0]===false){b("#FormError>td","#"+ag).html(h[1]);b("#FormError","#"+ag).show()}else{b.each(af.p.colModel,function(){if(ai[this.name]&&this.formatter&&this.formatter=="select"){try{delete ai[this.name]}catch(w){}}});Z=b.extend(Z,ai);af.p.autoencode&&b.each(Z,function(x,w){Z[x]=b.jgrid.htmlDecode(w)});d.reloadAfterSubmit=d.reloadAfterSubmit&&af.p.datatype!="local";if(Z[m]==l.addoper){h[2]||(h[2]=b.jgrid.randId());Z[p]=h[2];if(d.closeAfterAdd){if(d.reloadAfterSubmit){b(af).trigger("reloadGrid")}else{if(af.p.treeGrid===true){b(af).jqGrid("addChildNode",h[2],j,Z)}else{b(af).jqGrid("addRowData",h[2],Z,c.addedrow);b(af).jqGrid("setSelection",h[2])}}b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose})}else{if(d.clearAfterAdd){if(d.reloadAfterSubmit){b(af).trigger("reloadGrid")}else{af.p.treeGrid===true?b(af).jqGrid("addChildNode",h[2],j,Z):b(af).jqGrid("addRowData",h[2],Z,c.addedrow)}v("_empty",af,ae)}else{if(d.reloadAfterSubmit){b(af).trigger("reloadGrid")}else{af.p.treeGrid===true?b(af).jqGrid("addChildNode",h[2],j,Z):b(af).jqGrid("addRowData",h[2],Z,c.addedrow)}}}}else{if(d.reloadAfterSubmit){b(af).trigger("reloadGrid");d.closeAfterEdit||setTimeout(function(){b(af).jqGrid("setSelection",Z[p])},1000)}else{af.p.treeGrid===true?b(af).jqGrid("setTreeRow",Z[p],Z):b(af).jqGrid("setRowData",Z[p],Z)}d.closeAfterEdit&&b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose})}if(b.isFunction(d.afterComplete)){e=s;setTimeout(function(){d.afterComplete(e,Z,b("#"+ae));e=null},500)}if(d.checkOnSubmit||d.checkOnUpdate){b("#"+ae).data("disabled",false);if(d._savedData[af.p.id+"_id"]!="_empty"){for(var u in d._savedData){if(Z[u]){d._savedData[u]=Z[u]}}}}}d.processing=false;b("#sData","#"+ag+"_2").removeClass("ui-state-active");try{b(":input:visible","#"+ae)[0].focus()}catch(q){}}},b.jgrid.ajaxOptions,d.ajaxEditOptions);if(!o.url&&!d.useDataProxy){if(b.isFunction(af.p.dataProxy)){d.useDataProxy=true}else{h[0]=false;h[1]+=" "+b.jgrid.errors.nourl}}if(h[0]){d.useDataProxy?af.p.dataProxy.call(af,o,"set_"+af.p.id):b.ajax(o)}}if(h[0]===false){b("#FormError>td","#"+ag).html(h[1]);b("#FormError","#"+ag).show()}}function y(e,f){var h=false,j;for(j in e){if(e[j]!=f[j]){h=true;break}}return h}function Y(){b.each(af.p.colModel,function(e,f){if(f.editoptions&&f.editoptions.NullIfEmpty===true){if(Z.hasOwnProperty(f.name)&&Z[f.name]==""){Z[f.name]="null"}}})}function ad(){var e=true;b("#FormError","#"+ag).hide();if(d.checkOnUpdate){Z={};ai={};ab();at=b.extend({},Z,ai);if(al=y(at,d._savedData)){b("#"+ae).data("disabled",true);b(".confirm","#"+aa.themodal).show();e=false}else{Y()}}return e}function N(){if(a!=="_empty"&&typeof af.p.savedRow!=="undefined"&&af.p.savedRow.length>0&&b.isFunction(b.fn.jqGrid.restoreRow)){for(var e=0;e<af.p.savedRow.length;e++){if(af.p.savedRow[e].id==a){b(af).jqGrid("restoreRow",a);break}}}}function R(e,f){e===0?b("#pData","#"+ag+"_2").addClass("ui-state-disabled"):b("#pData","#"+ag+"_2").removeClass("ui-state-disabled");e==f?b("#nData","#"+ag+"_2").addClass("ui-state-disabled"):b("#nData","#"+ag+"_2").removeClass("ui-state-disabled")}function K(){var e=b(af).jqGrid("getDataIDs"),f=b("#id_g","#"+ag).val();return[b.inArray(f,e),e]}var af=this;if(af.grid&&a){var S=af.p.id,ae="FrmGrid_"+S,ag="TblGrid_"+S,aa={themodal:"editmod"+S,modalhead:"edithd"+S,modalcontent:"editcnt"+S,scrollelm:ae},A=b.isFunction(d.beforeShowForm)?d.beforeShowForm:false,aq=b.isFunction(d.afterShowForm)?d.afterShowForm:false,ao=b.isFunction(d.beforeInitData)?d.beforeInitData:false,ak=b.isFunction(d.onInitializeForm)?d.onInitializeForm:false,an=true,ac=1,B=0,Z,ai,at,al;if(a==="new"){a="_empty";c.caption=d.addCaption}else{c.caption=d.editCaption}c.recreateForm===true&&b("#"+aa.themodal).html()!==null&&b("#"+aa.themodal).remove();var aj=true;if(c.checkOnUpdate&&c.jqModal&&!c.modal){aj=false}if(b("#"+aa.themodal).html()!==null){if(ao){an=ao(b("#"+ae));if(typeof an=="undefined"){an=true}}if(an===false){return}N();b(".ui-jqdialog-title","#"+aa.modalhead).html(c.caption);b("#FormError","#"+ag).hide();if(d.topinfo){b(".topinfo","#"+ag+"_2").html(d.topinfo);b(".tinfo","#"+ag+"_2").show()}else{b(".tinfo","#"+ag+"_2").hide()}if(d.bottominfo){b(".bottominfo","#"+ag+"_2").html(d.bottominfo);b(".binfo","#"+ag+"_2").show()}else{b(".binfo","#"+ag+"_2").hide()}v(a,af,ae);a=="_empty"||!d.viewPagerButtons?b("#pData, #nData","#"+ag+"_2").hide():b("#pData, #nData","#"+ag+"_2").show();if(d.processing===true){d.processing=false;b("#sData","#"+ag+"_2").removeClass("ui-state-active")}if(b("#"+ae).data("disabled")===true){b(".confirm","#"+aa.themodal).hide();b("#"+ae).data("disabled",false)}A&&A(b("#"+ae));b("#"+aa.themodal).data("onClose",d.onClose);b.jgrid.viewModal("#"+aa.themodal,{gbox:"#gbox_"+S,jqm:c.jqModal,jqM:false,overlay:c.overlay,modal:c.modal});aj||b(".jqmOverlay").click(function(){if(!ad()){return false}b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose});return false});aq&&aq(b("#"+ae))}else{var ap=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px";ap=b("<form name='FormPost' id='"+ae+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+ap+";'></form>").data("disabled",false);var am=b("<table id='"+ag+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");if(ao){an=ao(b("#"+ae));if(typeof an=="undefined"){an=true}}if(an===false){return}N();b(af.p.colModel).each(function(){var e=this.formoptions;ac=Math.max(ac,e?e.colpos||0:0);B=Math.max(B,e?e.rowpos||0:0)});b(ap).append(am);ao=b("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+ac*2+"'></td></tr>");ao[0].rp=0;b(am).append(ao);ao=b("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+ac*2+"'>"+d.topinfo+"</td></tr>");ao[0].rp=0;b(am).append(ao);an=(ao=af.p.direction=="rtl"?true:false)?"nData":"pData";var ah=ao?"pData":"nData";M(a,af,am,ac);an="<a href='javascript:void(0)' id='"+an+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>";ah="<a href='javascript:void(0)' id='"+ah+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>";var ar="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>",F="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>";an="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+ag+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(ao?ah+an:an+ah)+"</td><td class='EditButton'>"+ar+F+"</td></tr>";an+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+d.bottominfo+"</td></tr>";an+="</tbody></table>";if(B>0){var U=[];b.each(b(am)[0].rows,function(e,f){U[e]=f});U.sort(function(e,f){if(e.rp>f.rp){return 1}if(e.rp<f.rp){return -1}return 0});b.each(U,function(e,f){b("tbody",am).append(f)})}c.gbox="#gbox_"+S;var k=false;if(c.closeOnEscape===true){c.closeOnEscape=false;k=true}ap=b("<span></span>").append(ap).append(an);b.jgrid.createModal(aa,ap,c,"#gview_"+af.p.id,b("#gbox_"+af.p.id)[0]);if(ao){b("#pData, #nData","#"+ag+"_2").css("float","right");b(".EditButton","#"+ag+"_2").css("text-align","left")}d.topinfo&&b(".tinfo","#"+ag+"_2").show();d.bottominfo&&b(".binfo","#"+ag+"_2").show();an=ap=null;b("#"+aa.themodal).keydown(function(e){var f=e.target;if(b("#"+ae).data("disabled")===true){return false}if(d.savekey[0]===true&&e.which==d.savekey[1]){if(f.tagName!="TEXTAREA"){b("#sData","#"+ag+"_2").trigger("click");return false}}if(e.which===27){if(!ad()){return false}k&&b.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:d.onClose});return false}if(d.navkeys[0]===true){if(b("#id_g","#"+ag).val()=="_empty"){return true}if(e.which==d.navkeys[1]){b("#pData","#"+ag+"_2").trigger("click");return false}if(e.which==d.navkeys[2]){b("#nData","#"+ag+"_2").trigger("click");return false}}});if(c.checkOnUpdate){b("a.ui-jqdialog-titlebar-close span","#"+aa.themodal).removeClass("jqmClose");b("a.ui-jqdialog-titlebar-close","#"+aa.themodal).unbind("click").click(function(){if(!ad()){return false}b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose});return false})}c.saveicon=b.extend([true,"left","ui-icon-disk"],c.saveicon);c.closeicon=b.extend([true,"left","ui-icon-close"],c.closeicon);if(c.saveicon[0]===true){b("#sData","#"+ag+"_2").addClass(c.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.saveicon[2]+"'></span>")}if(c.closeicon[0]===true){b("#cData","#"+ag+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>")}if(d.checkOnSubmit||d.checkOnUpdate){ar="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bYes+"</a>";ah="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bNo+"</a>";F="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bExit+"</a>";ap=c.zIndex||999;ap++;b("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+ap+";display:none;'>&#160;"+(b.browser.msie&&b.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(ap+1)+"'>"+c.saveData+"<br/><br/>"+ar+ah+F+"</div>").insertAfter("#"+ae);b("#sNew","#"+aa.themodal).click(function(){E();b("#"+ae).data("disabled",false);b(".confirm","#"+aa.themodal).hide();return false});b("#nNew","#"+aa.themodal).click(function(){b(".confirm","#"+aa.themodal).hide();b("#"+ae).data("disabled",false);setTimeout(function(){b(":input","#"+ae)[0].focus()},0);return false});b("#cNew","#"+aa.themodal).click(function(){b(".confirm","#"+aa.themodal).hide();b("#"+ae).data("disabled",false);b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose});return false})}ak&&ak(b("#"+ae));a=="_empty"||!d.viewPagerButtons?b("#pData,#nData","#"+ag+"_2").hide():b("#pData,#nData","#"+ag+"_2").show();A&&A(b("#"+ae));b("#"+aa.themodal).data("onClose",d.onClose);b.jgrid.viewModal("#"+aa.themodal,{gbox:"#gbox_"+S,jqm:c.jqModal,overlay:c.overlay,modal:c.modal});aj||b(".jqmOverlay").click(function(){if(!ad()){return false}b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose});return false});aq&&aq(b("#"+ae));b(".fm-button","#"+aa.themodal).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});b("#sData","#"+ag+"_2").click(function(){Z={};ai={};b("#FormError","#"+ag).hide();ab();Y();if(Z[af.p.id+"_id"]=="_empty"){E()}else{if(c.checkOnSubmit===true){at=b.extend({},Z,ai);if(al=y(at,d._savedData)){b("#"+ae).data("disabled",true);b(".confirm","#"+aa.themodal).show()}else{E()}}else{E()}}return false});b("#cData","#"+ag+"_2").click(function(){if(!ad()){return false}b.jgrid.hideModal("#"+aa.themodal,{gb:"#gbox_"+S,jqm:c.jqModal,onClose:d.onClose});return false});b("#nData","#"+ag+"_2").click(function(){if(!ad()){return false}b("#FormError","#"+ag).hide();var e=K();e[0]=parseInt(e[0],10);if(e[0]!=-1&&e[1][e[0]+1]){if(b.isFunction(c.onclickPgButtons)){c.onclickPgButtons("next",b("#"+ae),e[1][e[0]])}v(e[1][e[0]+1],af,ae);b(af).jqGrid("setSelection",e[1][e[0]+1]);b.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next",b("#"+ae),e[1][e[0]+1]);R(e[0]+1,e[1].length-1)}return false});b("#pData","#"+ag+"_2").click(function(){if(!ad()){return false}b("#FormError","#"+ag).hide();var e=K();if(e[0]!=-1&&e[1][e[0]-1]){if(b.isFunction(c.onclickPgButtons)){c.onclickPgButtons("prev",b("#"+ae),e[1][e[0]])}v(e[1][e[0]-1],af,ae);b(af).jqGrid("setSelection",e[1][e[0]-1]);b.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",b("#"+ae),e[1][e[0]-1]);R(e[0]-1,e[1].length-1)}return false})}A=K();R(A[0],A[1].length-1)}})},viewGridRow:function(a,c){c=b.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:10,drag:true,resize:true,jqModal:true,closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:true},b.jgrid.view,c||{});return this.each(function(){function K(){if(c.closeOnEscape===true||c.navkeys[0]===true){setTimeout(function(){b(".ui-jqdialog-titlebar-close","#"+v.modalhead).focus()},0)}}function x(D,e,u,s){for(var H,z,t,G=0,C,j,l=[],w=false,n="<td class='CaptionTD form-view-label ui-widget-content' width='"+c.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",o="",L=["integer","number","currency"],q=0,Y=0,p,T,I,f=1;f<=s;f++){o+=f==1?n:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>"}b(e.p.colModel).each(function(){z=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!z&&this.align==="right"){if(this.formatter&&b.inArray(this.formatter,L)!==-1){q=Math.max(q,parseInt(this.width,10))}else{Y=Math.max(Y,parseInt(this.width,10))}}});p=q!==0?q:Y!==0?Y:0;w=b(e).jqGrid("getInd",D);b(e.p.colModel).each(function(X){H=this.name;T=false;j=(z=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";I=typeof this.viewable!="boolean"?true:this.viewable;if(H!=="cb"&&H!=="subgrid"&&H!=="rn"&&I){C=w===false?"":H==e.p.ExpandColumn&&e.p.treeGrid===true?b("td:eq("+X+")",e.rows[w]).text():b("td:eq("+X+")",e.rows[w]).html();T=this.align==="right"&&p!==0?true:false;b.extend({},this.editoptions||{},{id:H,name:H});var aa=b.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),W=parseInt(aa.rowpos,10)||G+1,V=parseInt((parseInt(aa.colpos,10)||1)*2,10);if(aa.rowabove){var Z=b("<tr><td class='contentinfo' colspan='"+s*2+"'>"+aa.rowcontent+"</td></tr>");b(u).append(Z);Z[0].rp=W}t=b(u).find("tr[rowpos="+W+"]");if(t.length===0){t=b("<tr "+j+" rowpos='"+W+"'></tr>").addClass("FormData").attr("id","trv_"+H);b(t).append(o);b(u).append(t);t[0].rp=W}b("td:eq("+(V-2)+")",t[0]).html("<b>"+(typeof aa.label==="undefined"?e.p.colNames[X]:aa.label)+"</b>");b("td:eq("+(V-1)+")",t[0]).append("<span>"+C+"</span>").attr("id","v_"+H);T&&b("td:eq("+(V-1)+") span",t[0]).css({"text-align":"right",width:p+"px"});l[G]=X;G++}});if(G>0){D=b("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(s*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+D+"'/></td></tr>");D[0].rp=G+99;b(u).append(D)}return l}function S(j,f){var e,n,l=0,p,o;if(o=b(f).jqGrid("getInd",j,true)){b("td",o).each(function(q){e=f.p.colModel[q].name;n=f.p.colModel[q].editrules&&f.p.colModel[q].editrules.edithidden===true?false:f.p.colModel[q].hidden===true?true:false;if(e!=="cb"&&e!=="subgrid"&&e!=="rn"){p=e==f.p.ExpandColumn&&f.p.treeGrid===true?b(this).text():b(this).html();b.extend({},f.p.colModel[q].editoptions||{});e=b.jgrid.jqID("v_"+e);b("#"+e+" span","#"+A).html(p);n&&b("#"+e,"#"+A).parents("tr:first").hide();l++}});l>0&&b("#id_g","#"+A).val(j)}}function k(f,e){f===0?b("#pData","#"+A+"_2").addClass("ui-state-disabled"):b("#pData","#"+A+"_2").removeClass("ui-state-disabled");f==e?b("#nData","#"+A+"_2").addClass("ui-state-disabled"):b("#nData","#"+A+"_2").removeClass("ui-state-disabled")}function U(){var f=b(E).jqGrid("getDataIDs"),e=b("#id_g","#"+A).val();return[b.inArray(e,f),f]}var E=this;if(E.grid&&a){if(!c.imgpath){c.imgpath=E.p.imgpath}var N=E.p.id,y="ViewGrid_"+N,A="ViewTbl_"+N,v={themodal:"viewmod"+N,modalhead:"viewhd"+N,modalcontent:"viewcnt"+N,scrollelm:y},Q=b.isFunction(c.beforeInitData)?c.beforeInitData:false,B=true,O=1,R=0;if(b("#"+v.themodal).html()!==null){if(Q){B=Q(b("#"+y));if(typeof B=="undefined"){B=true}}if(B===false){return}b(".ui-jqdialog-title","#"+v.modalhead).html(c.caption);b("#FormError","#"+A).hide();S(a,E);b.isFunction(c.beforeShowForm)&&c.beforeShowForm(b("#"+y));b.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+N,jqm:c.jqModal,jqM:false,overlay:c.overlay,modal:c.modal});K()}else{var J=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px";J=b("<form name='FormPost' id='"+y+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+J+";'></form>");var h=b("<table id='"+A+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");if(Q){B=Q(b("#"+y));if(typeof B=="undefined"){B=true}}if(B===false){return}b(E.p.colModel).each(function(){var e=this.formoptions;O=Math.max(O,e?e.colpos||0:0);R=Math.max(R,e?e.rowpos||0:0)});b(J).append(h);x(a,E,h,O);Q=E.p.direction=="rtl"?true:false;B="<a href='javascript:void(0)' id='"+(Q?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";var P="<a href='javascript:void(0)' id='"+(Q?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",m="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bClose+"</a>";if(R>0){var F=[];b.each(b(h)[0].rows,function(f,e){F[f]=e});F.sort(function(f,e){if(f.rp>e.rp){return 1}if(f.rp<e.rp){return -1}return 0});b.each(F,function(f,e){b("tbody",h).append(e)})}c.gbox="#gbox_"+N;var M=false;if(c.closeOnEscape===true){c.closeOnEscape=false;M=true}J=b("<span></span>").append(J).append("<table border='0' class='EditTable' id='"+A+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+c.labelswidth+"'>"+(Q?P+B:B+P)+"</td><td class='EditButton'>"+m+"</td></tr></tbody></table>");b.jgrid.createModal(v,J,c,"#gview_"+E.p.id,b("#gview_"+E.p.id)[0]);if(Q){b("#pData, #nData","#"+A+"_2").css("float","right");b(".EditButton","#"+A+"_2").css("text-align","left")}c.viewPagerButtons||b("#pData, #nData","#"+A+"_2").hide();J=null;b("#"+v.themodal).keydown(function(e){if(e.which===27){M&&b.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:c.onClose});return false}if(c.navkeys[0]===true){if(e.which===c.navkeys[1]){b("#pData","#"+A+"_2").trigger("click");return false}if(e.which===c.navkeys[2]){b("#nData","#"+A+"_2").trigger("click");return false}}});c.closeicon=b.extend([true,"left","ui-icon-close"],c.closeicon);if(c.closeicon[0]===true){b("#cData","#"+A+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>")}b.isFunction(c.beforeShowForm)&&c.beforeShowForm(b("#"+y));b.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+N,jqm:c.jqModal,modal:c.modal});b(".fm-button:not(.ui-state-disabled)","#"+A+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});K();b("#cData","#"+A+"_2").click(function(){b.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+N,jqm:c.jqModal,onClose:c.onClose});return false});b("#nData","#"+A+"_2").click(function(){b("#FormError","#"+A).hide();var e=U();e[0]=parseInt(e[0],10);if(e[0]!=-1&&e[1][e[0]+1]){if(b.isFunction(c.onclickPgButtons)){c.onclickPgButtons("next",b("#"+y),e[1][e[0]])}S(e[1][e[0]+1],E);b(E).jqGrid("setSelection",e[1][e[0]+1]);b.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next",b("#"+y),e[1][e[0]+1]);k(e[0]+1,e[1].length-1)}K();return false});b("#pData","#"+A+"_2").click(function(){b("#FormError","#"+A).hide();var e=U();if(e[0]!=-1&&e[1][e[0]-1]){if(b.isFunction(c.onclickPgButtons)){c.onclickPgButtons("prev",b("#"+y),e[1][e[0]])}S(e[1][e[0]-1],E);b(E).jqGrid("setSelection",e[1][e[0]-1]);b.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",b("#"+y),e[1][e[0]-1]);k(e[0]-1,e[1].length-1)}K();return false})}J=U();k(J[0],J[1].length-1)}})},delGridRow:function(a,c){d=c=b.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,overlay:10,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:true,closeOnEscape:false,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:false,serializeDelData:null,useDataProxy:false},b.jgrid.del,c||{});return this.each(function(){var A=this;if(A.grid){if(a){var k=typeof c.beforeShowForm==="function"?true:false,H=typeof c.afterShowForm==="function"?true:false,h=b.isFunction(c.beforeInitData)?c.beforeInitData:false,I=A.p.id,y={},B=true,m="DelTbl_"+I,v,j,F,x,E={themodal:"delmod"+I,modalhead:"delhd"+I,modalcontent:"delcnt"+I,scrollelm:m};if(jQuery.isArray(a)){a=a.join()}if(b("#"+E.themodal).html()!==null){if(h){B=h(b("#"+m));if(typeof B=="undefined"){B=true}}if(B===false){return}b("#DelData>td","#"+m).text(a);b("#DelError","#"+m).hide();if(d.processing===true){d.processing=false;b("#dData","#"+m).removeClass("ui-state-active")}k&&c.beforeShowForm(b("#"+m));b.jgrid.viewModal("#"+E.themodal,{gbox:"#gbox_"+I,jqm:c.jqModal,jqM:false,overlay:c.overlay,modal:c.modal})}else{var G=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px";G="<div id='"+m+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+G+";'>";G+="<table class='DelTable'><tbody>";G+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";G+="<tr id='DelData' style='display:none'><td >"+a+"</td></tr>";G+='<tr><td class="delmsg" style="white-space:pre;">'+c.msg+"</td></tr><tr><td >&#160;</td></tr>";G+="</tbody></table></div>";G+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+m+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>")+"</td></tr></tbody></table>";c.gbox="#gbox_"+I;b.jgrid.createModal(E,G,c,"#gview_"+A.p.id,b("#gview_"+A.p.id)[0]);if(h){B=h(b("#"+m));if(typeof B=="undefined"){B=true}}if(B===false){return}b(".fm-button","#"+m+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});c.delicon=b.extend([true,"left","ui-icon-scissors"],c.delicon);c.cancelicon=b.extend([true,"left","ui-icon-cancel"],c.cancelicon);if(c.delicon[0]===true){b("#dData","#"+m+"_2").addClass(c.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.delicon[2]+"'></span>")}if(c.cancelicon[0]===true){b("#eData","#"+m+"_2").addClass(c.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.cancelicon[2]+"'></span>")}b("#dData","#"+m+"_2").click(function(){var f=[true,""];y={};var l=b("#DelData>td","#"+m).text();if(typeof c.onclickSubmit==="function"){y=c.onclickSubmit(d,l)||{}}if(typeof c.beforeSubmit==="function"){f=c.beforeSubmit(l)}if(f[0]&&!d.processing){d.processing=true;b(this).addClass("ui-state-active");F=A.p.prmNames;v=b.extend({},d.delData,y);x=F.oper;v[x]=F.deloper;j=F.id;v[j]=l;var e=b.extend({url:d.url?d.url:b(A).jqGrid("getGridParam","editurl"),type:c.mtype,data:b.isFunction(c.serializeDelData)?c.serializeDelData(v):v,complete:function(p,s){if(s!="success"){f[0]=false;f[1]=b.isFunction(d.errorTextFormat)?d.errorTextFormat(p):s+" Status: '"+p.statusText+"'. Error code: "+p.status}else{if(typeof d.afterSubmit==="function"){f=d.afterSubmit(p,v)}}if(f[0]===false){b("#DelError>td","#"+m).html(f[1]);b("#DelError","#"+m).show()}else{if(d.reloadAfterSubmit&&A.p.datatype!="local"){b(A).trigger("reloadGrid")}else{var o=[];o=l.split(",");if(A.p.treeGrid===true){try{b(A).jqGrid("delTreeNode",o[0])}catch(q){}}else{for(var n=0;n<o.length;n++){b(A).jqGrid("delRowData",o[n])}}A.p.selrow=null;A.p.selarrrow=[]}b.isFunction(d.afterComplete)&&setTimeout(function(){d.afterComplete(p,l)},500)}d.processing=false;b("#dData","#"+m+"_2").removeClass("ui-state-active");f[0]&&b.jgrid.hideModal("#"+E.themodal,{gb:"#gbox_"+I,jqm:c.jqModal,onClose:d.onClose})}},b.jgrid.ajaxOptions,c.ajaxDelOptions);if(!e.url&&!d.useDataProxy){if(b.isFunction(A.p.dataProxy)){d.useDataProxy=true}else{f[0]=false;f[1]+=" "+b.jgrid.errors.nourl}}if(f[0]){d.useDataProxy?A.p.dataProxy.call(A,e,"del_"+A.p.id):b.ajax(e)}}if(f[0]===false){b("#DelError>td","#"+m).html(f[1]);b("#DelError","#"+m).show()}return false});b("#eData","#"+m+"_2").click(function(){b.jgrid.hideModal("#"+E.themodal,{gb:"#gbox_"+I,jqm:c.jqModal,onClose:d.onClose});return false});k&&c.beforeShowForm(b("#"+m));b.jgrid.viewModal("#"+E.themodal,{gbox:"#gbox_"+I,jqm:c.jqModal,overlay:c.overlay,modal:c.modal})}H&&c.afterShowForm(b("#"+m));c.closeOnEscape===true&&setTimeout(function(){b(".ui-jqdialog-titlebar-close","#"+E.modalhead).focus()},0)}}})},navGrid:function(h,e,c,f,j,a,k){e=b.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",del:true,delicon:"ui-icon-trash",search:true,searchicon:"ui-icon-search",refresh:true,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:false,viewicon:"ui-icon-document",position:"left",closeOnEscape:true,beforeRefresh:null,afterRefresh:null,cloneToTop:false},b.jgrid.nav,e||{});return this.each(function(){if(!this.nav){var A={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},l=this,v,x,q;if(!(!l.grid||typeof h!="string")){if(b("#"+A.themodal).html()===null){if(typeof window.innerWidth!="undefined"){v=window.innerWidth;x=window.innerHeight}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0){v=document.documentElement.clientWidth;x=document.documentElement.clientHeight}else{v=1024;x=768}}b.jgrid.createModal(A,"<div>"+e.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+l.p.id,jqModal:true,drag:true,resize:true,caption:e.alertcap,top:x/2-25,left:v/2-100,width:200,height:"auto",closeOnEscape:e.closeOnEscape},"","",true)}v=1;if(e.cloneToTop&&l.p.toppager){v=2}for(x=0;x<v;x++){var z=b("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),y,m;if(x===0){y=h;m=l.p.id;if(y==l.p.toppager){m+="_top";v=1}}else{y=l.p.toppager;m=l.p.id+"_top"}l.p.direction=="rtl"&&b(z).attr("dir","rtl").css("float","right");if(e.add){f=f||{};q=b("<td class='ui-pg-button ui-corner-all'></td>");b(q).append("<div class='ui-pg-div'><span class='ui-icon "+e.addicon+"'></span>"+e.addtext+"</div>");b("tr",z).append(q);b(q,z).attr({title:e.addtitle||"",id:f.id||"add_"+m}).click(function(){b(this).hasClass("ui-state-disabled")||(typeof e.addfunc=="function"?e.addfunc():b(l).jqGrid("editGridRow","new",f));return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(e.edit){q=b("<td class='ui-pg-button ui-corner-all'></td>");c=c||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+e.editicon+"'></span>"+e.edittext+"</div>");b("tr",z).append(q);b(q,z).attr({title:e.edittitle||"",id:c.id||"edit_"+m}).click(function(){if(!b(this).hasClass("ui-state-disabled")){var n=l.p.selrow;if(n){typeof e.editfunc=="function"?e.editfunc(n):b(l).jqGrid("editGridRow",n,c)}else{b.jgrid.viewModal("#"+A.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});b("#jqg_alrt").focus()}}return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(e.view){q=b("<td class='ui-pg-button ui-corner-all'></td>");k=k||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+e.viewicon+"'></span>"+e.viewtext+"</div>");b("tr",z).append(q);b(q,z).attr({title:e.viewtitle||"",id:k.id||"view_"+m}).click(function(){if(!b(this).hasClass("ui-state-disabled")){var n=l.p.selrow;if(n){b(l).jqGrid("viewGridRow",n,k)}else{b.jgrid.viewModal("#"+A.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});b("#jqg_alrt").focus()}}return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(e.del){q=b("<td class='ui-pg-button ui-corner-all'></td>");j=j||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+e.delicon+"'></span>"+e.deltext+"</div>");b("tr",z).append(q);b(q,z).attr({title:e.deltitle||"",id:j.id||"del_"+m}).click(function(){if(!b(this).hasClass("ui-state-disabled")){var n;if(l.p.multiselect){n=l.p.selarrrow;if(n.length===0){n=null}}else{n=l.p.selrow}if(n){"function"==typeof e.delfunc?e.delfunc(n):b(l).jqGrid("delGridRow",n,j)}else{b.jgrid.viewModal("#"+A.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});b("#jqg_alrt").focus()}}return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(e.add||e.edit||e.del||e.view){b("tr",z).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>")}if(e.search){q=b("<td class='ui-pg-button ui-corner-all'></td>");a=a||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+e.searchicon+"'></span>"+e.searchtext+"</div>");b("tr",z).append(q);b(q,z).attr({title:e.searchtitle||"",id:a.id||"search_"+m}).click(function(){b(this).hasClass("ui-state-disabled")||b(l).jqGrid("searchGrid",a);return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});a.showOnLoad&&a.showOnLoad===true&&b(q,z).click();q=null}if(e.refresh){q=b("<td class='ui-pg-button ui-corner-all'></td>");b(q).append("<div class='ui-pg-div'><span class='ui-icon "+e.refreshicon+"'></span>"+e.refreshtext+"</div>");b("tr",z).append(q);b(q,z).attr({title:e.refreshtitle||"",id:"refresh_"+m}).click(function(){if(!b(this).hasClass("ui-state-disabled")){b.isFunction(e.beforeRefresh)&&e.beforeRefresh();l.p.search=false;try{var o=l.p.id;l.p.postData.filters="";b("#fbox_"+o).jqFilter("resetFilter");b.isFunction(l.clearToolbar)&&l.clearToolbar(false)}catch(n){}switch(e.refreshstate){case"firstpage":b(l).trigger("reloadGrid",[{page:1}]);break;case"current":b(l).trigger("reloadGrid",[{current:true}])}b.isFunction(e.afterRefresh)&&e.afterRefresh()}return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}q=b(".ui-jqgrid").css("font-size")||"11px";b("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+q+";visibility:hidden;' ></div>");q=b(z).clone().appendTo("#testpg2").width();b("#testpg2").remove();b(y+"_"+e.position,y).append(z);if(l.p._nvtd){if(q>l.p._nvtd[0]){b(y+"_"+e.position,y).width(q);l.p._nvtd[0]=q}l.p._nvtd[1]=q}z=q=q=null;this.nav=true}}}})},navButtonAdd:function(a,c){c=b.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},c||{});return this.each(function(){if(this.grid){if(a.indexOf("#")!==0){a="#"+a}var f=b(".navtable",a)[0],e=this;if(f){if(!(c.id&&b("#"+c.id,f).html()!==null)){var h=b("<td></td>");c.buttonicon.toString().toUpperCase()=="NONE"?b(h).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+c.caption+"</div>"):b(h).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+c.buttonicon+"'></span>"+c.caption+"</div>");c.id&&b(h).attr("id",c.id);if(c.position=="first"){f.rows[0].cells.length===0?b("tr",f).append(h):b("tr td:eq(0)",f).before(h)}else{b("tr",f).append(h)}b(h,f).attr("title",c.title||"").click(function(j){b(this).hasClass("ui-state-disabled")||b.isFunction(c.onClickButton)&&c.onClickButton.call(e,j);return false}).hover(function(){b(this).hasClass("ui-state-disabled")||b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}}}})},navSeparatorAdd:function(a,c){c=b.extend({sepclass:"ui-separator",sepcontent:""},c||{});return this.each(function(){if(this.grid){if(a.indexOf("#")!==0){a="#"+a}var e=b(".navtable",a)[0];if(e){var f="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+c.sepclass+"'></span>"+c.sepcontent+"</td>";b("tr",e).append(f)}}})},GridToForm:function(a,c){return this.each(function(){if(this.grid){var e=b(this).jqGrid("getRowData",a);if(e){for(var f in e){b("[name="+b.jgrid.jqID(f)+"]",c).is("input:radio")||b("[name="+b.jgrid.jqID(f)+"]",c).is("input:checkbox")?b("[name="+b.jgrid.jqID(f)+"]",c).each(function(){b(this).val()==e[f]?b(this).attr("checked","checked"):b(this).attr("checked","")}):b("[name="+b.jgrid.jqID(f)+"]",c).val(e[f])}}}})},FormToGrid:function(f,c,e,a){return this.each(function(){if(this.grid){e||(e="set");a||(a="first");var h=b(c).serializeArray(),j={};b.each(h,function(k,l){j[l.name]=l.value});if(e=="add"){b(this).jqGrid("addRowData",f,j,a)}else{e=="set"&&b(this).jqGrid("setRowData",f,j)}}})}})})(jQuery);(function(a){a.fn.jqFilter=function(c){if(typeof c==="string"){var d=a.fn.jqFilter[c];if(!d){throw"jqFilter - No such method: "+c}var b=a.makeArray(arguments).slice(1);return d.apply(this,b)}var e=a.extend(true,{filter:null,columns:[],onChange:null,checkValues:null,error:false,errmsg:"",errorcheck:true,showQuery:true,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc",description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:["AND","OR"],groupButton:true},c||{});return this.each(function(){if(!this.filter){this.p=e;if(this.p.filter===null||this.p.filter===undefined){this.p.filter={groupOp:this.p.groupOps[0],rules:[],groups:[]}}var l,j=this.p.columns.length,f,k=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length){for(l=0;l<this.p._gridsopt.length;l++){this.p.ops[l].description=this.p._gridsopt[l]}}this.p.initFilter=a.extend(true,{},this.p.filter);if(j){for(l=0;l<j;l++){f=this.p.columns[l];if(f.stype){f.inputtype=f.stype}else{if(!f.inputtype){f.inputtype="text"}}if(f.sorttype){f.searchtype=f.sorttype}else{if(!f.searchtype){f.searchtype="string"}}if(f.hidden===undefined){f.hidden=false}if(!f.label){f.label=f.name}if(f.index){f.name=f.index}if(!f.hasOwnProperty("searchoptions")){f.searchoptions={}}if(!f.hasOwnProperty("searchrules")){f.searchrules={}}}this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;'><tbody><tr><td class='query'></td></tr></tbody></table>");var h=function(p,m){var n=[true,""];if(a.isFunction(m.searchrules)){n=m.searchrules(p,m)}else{if(a.jgrid&&a.jgrid.checkValues){try{n=a.jgrid.checkValues(p,-1,null,m.searchrules,m.label)}catch(o){}}}if(n&&n.length&&n[0]===false){e.error=!n[0];e.errmsg=n[1]}};this.onchange=function(){this.p.error=false;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):false};this.reDraw=function(){a("table.group:first",this).remove();var m=this.createTableForGroup(e.filter,null);a(this).append(m)};this.createTableForGroup=function(u,w){var s=this,t,v=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");w===null&&a(v).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var x=a("<tr></tr>");a(v).append(x);var o=a("<th colspan='5' align='left'></th>");x.append(o);var n=a("<select class='opsel'></select>");o.append(n);x="";var p;for(t=0;t<e.groupOps.length;t++){p=u.groupOp===s.p.groupOps[t]?" selected='selected'":"";x+="<option value='"+s.p.groupOps[t]+"'"+p+">"+s.p.groupOps[t]+"</option>"}n.append(x).bind("change",function(){u.groupOp=a(n).val();s.onchange()});x="<span></span>";if(this.p.groupButton){x=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");x.bind("click",function(){if(u.groups===undefined){u.groups=[]}u.groups.push({groupOp:e.groupOps[0],rules:[],groups:[]});s.reDraw();s.onchange();return false})}o.append(x);x=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>");var q;x.bind("click",function(){if(u.rules===undefined){u.rules=[]}for(t=0;t<s.p.columns.length;t++){var m=typeof s.p.columns[t].search==="undefined"?true:s.p.columns[t].search,y=s.p.columns[t].hidden===true;if(s.p.columns[t].searchoptions.searchhidden===true&&m||m&&!y){q=s.p.columns[t];break}}u.rules.push({field:q.name,op:(q.searchoptions.sopt?q.searchoptions.sopt:s.p.sopt?s.p.sopt:q.searchtype==="string"?s.p.stropts:s.p.numopts)[0],data:""});s.reDraw();return false});o.append(x);if(w!==null){x=a("<input type='button' value='-' title='Delete group' class='delete-group'/>");o.append(x);x.bind("click",function(){for(t=0;t<w.groups.length;t++){if(w.groups[t]===u){w.groups.splice(t,1);break}}s.reDraw();s.onchange();return false})}if(u.groups!==undefined){for(t=0;t<u.groups.length;t++){o=a("<tr></tr>");v.append(o);x=a("<td class='first'></td>");o.append(x);x=a("<td colspan='4'></td>");x.append(this.createTableForGroup(u.groups[t],u));o.append(x)}}if(u.groupOp===undefined){u.groupOp=s.p.groupOps[0]}if(u.rules!==undefined){for(t=0;t<u.rules.length;t++){v.append(this.createTableRowForRule(u.rules[t],u))}}return v};this.createTableRowForRule=function(B,D){var y=this,z=a("<tr></tr>"),C,E,u,t,v="",w;z.append("<td class='first'></td>");var x=a("<td class='columns'></td>");z.append(x);var o=a("<select></select>");x.append(o);o.bind("change",function(){B.field=a(o).val();u=a(this).parents("tr:first");for(C=0;C<y.p.columns.length;C++){if(y.p.columns[C].name===B.field){t=y.p.columns[C];break}}if(t){t.searchoptions.id=a.jgrid.randId();if(k&&t.inputtype==="text"){if(!t.searchoptions.size){t.searchoptions.size=10}}var m=a.jgrid.createEl(t.inputtype,t.searchoptions,"",true,y.p.ajaxSelectOptions,true);a(m).addClass("input-elm");E=t.searchoptions.sopt?t.searchoptions.sopt:y.p.sopt?y.p.sopt:t.searchtype==="string"?y.p.stropts:y.p.numopts;var n="",s="";for(C=0;C<y.p.ops.length;C++){if(a.inArray(y.p.ops[C].name,E)!==-1){s=B.op===y.p.ops[C].name?" selected=selected":"";n+="<option value='"+y.p.ops[C].name+"'"+s+">"+y.p.ops[C].description+"</option>"}}a(".selectopts",u).empty().append(n);a(".data",u).empty().append(m);a(".input-elm",u).bind("change",function(){B.data=a(this).val();if(a.isArray(B.data)){B.data=B.data.join(",")}y.onchange()});setTimeout(function(){B.data=a(m).val();y.onchange()},0)}});for(C=x=0;C<y.p.columns.length;C++){w=typeof y.p.columns[C].search==="undefined"?true:y.p.columns[C].search;var q=y.p.columns[C].hidden===true;if(y.p.columns[C].searchoptions.searchhidden===true&&w||w&&!q){w="";if(B.field===y.p.columns[C].name){w=" selected='selected'";x=C}v+="<option value='"+y.p.columns[C].name+"'"+w+">"+y.p.columns[C].label+"</option>"}}o.append(v);v=a("<td class='operators'></td>");z.append(v);t=e.columns[x];t.searchoptions.id=a.jgrid.randId();if(k&&t.inputtype==="text"){if(!t.searchoptions.size){t.searchoptions.size=10}}x=a.jgrid.createEl(t.inputtype,t.searchoptions,B.data,true,y.p.ajaxSelectOptions,true);var p=a("<select class='selectopts'></select>");v.append(p);p.bind("change",function(){B.op=a(p).val();u=a(this).parents("tr:first");var m=a(".input-elm",u)[0];if(B.op==="nu"||B.op==="nn"){B.data="";m.value="";m.setAttribute("readonly","true");m.setAttribute("disabled","true")}else{m.removeAttribute("readonly");m.removeAttribute("disabled")}y.onchange()});E=t.searchoptions.sopt?t.searchoptions.sopt:y.p.sopt?y.p.sopt:t.searchtype==="string"?e.stropts:y.p.numopts;v="";for(C=0;C<y.p.ops.length;C++){if(a.inArray(y.p.ops[C].name,E)!==-1){w=B.op===y.p.ops[C].name?" selected='selected'":"";v+="<option value='"+y.p.ops[C].name+"'"+w+">"+y.p.ops[C].description+"</option>"}}p.append(v);v=a("<td class='data'></td>");z.append(v);v.append(x);a(x).addClass("input-elm").bind("change",function(){B.data=a(this).val();if(a.isArray(B.data)){B.data=B.data.join(",")}y.onchange()});v=a("<td></td>");z.append(v);x=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");v.append(x);x.bind("click",function(){for(C=0;C<D.rules.length;C++){if(D.rules[C]===B){D.rules.splice(C,1);break}}y.reDraw();y.onchange();return false});return z};this.getStringForGroup=function(p){var m="(",n;if(p.groups!==undefined){for(n=0;n<p.groups.length;n++){if(m.length>1){m+=" "+p.groupOp+" "}try{m+=this.getStringForGroup(p.groups[n])}catch(o){alert(o)}}}if(p.rules!==undefined){try{for(n=0;n<p.rules.length;n++){if(m.length>1){m+=" "+p.groupOp+" "}m+=this.getStringForRule(p.rules[n])}}catch(q){alert(q)}}m+=")";return m==="()"?"":m};this.getStringForRule=function(p){var m="",n="",o,q;for(o=0;o<this.p.ops.length;o++){if(this.p.ops[o].name===p.op){m=this.p.ops[o].operator;n=this.p.ops[o].name;break}}for(o=0;o<this.p.columns.length;o++){if(this.p.columns[o].name===p.field){q=this.p.columns[o];break}}o=p.data;if(n==="bw"||n==="bn"){o+="%"}if(n==="ew"||n==="en"){o="%"+o}if(n==="cn"||n==="nc"){o="%"+o+"%"}if(n==="in"||n==="ni"){o=" ("+o+")"}e.errorcheck&&h(p.data,q);return a.inArray(q.searchtype,["int","integer","float","number","currency"])!==-1||n==="nn"||n==="nu"?p.field+" "+m+" "+o:p.field+" "+m+' "'+o+'"'};this.resetFilter=function(){this.p.filter=a.extend(true,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(e.filter)};this.toString=function(){function n(q){var s="(",t;if(q.groups!==undefined){for(t=0;t<q.groups.length;t++){if(s.length>1){s+=q.groupOp==="OR"?" || ":" && "}s+=n(q.groups[t])}}if(q.rules!==undefined){for(t=0;t<q.rules.length;t++){if(s.length>1){s+=q.groupOp==="OR"?" || ":" && "}var u=q.rules[t];if(m.p.errorcheck){var p=void 0,o=void 0;for(p=0;p<m.p.columns.length;p++){if(m.p.columns[p].name===u.field){o=m.p.columns[p];break}}o&&h(u.data,o)}s+=u.op+"(item."+u.field+",'"+u.data+"')"}}s+=")";return s==="()"?"":s}var m=this;return n(this.p.filter)};this.reDraw();if(this.p.showQuery){this.onchange()}this.filter=true}}})};a.extend(a.fn.jqFilter,{toSQLString:function(){var b="";this.each(function(){b=this.toUserFriendlyString()});return b},filterData:function(){var b;this.each(function(){b=this.p.filter});return b},getParameter:function(b){if(b!==undefined){if(this.p.hasOwnProperty(b)){return this.p[b]}}return this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(b){if(typeof b==="string"){b=jQuery.jgrid.parse(b)}this.each(function(){this.p.filter=b;this.reDraw();this.onchange()})}})})(jQuery);(function(b){b.jgrid.extend({editRow:function(q,a,h,n,v,c,w,d,p){var z={keys:a||false,oneditfunc:h||null,successfunc:n||null,url:v||null,extraparam:c||{},aftersavefunc:w||null,errorfunc:d||null,afterrestorefunc:p||null,restoreAfterErorr:true},k=b.makeArray(arguments).slice(1),m;m=k[0]&&typeof k[0]=="object"&&!b.isFunction(k[0])?b.extend(z,k[0]):z;return this.each(function(){var t=this,s,j,u=0,o=null,l={},f,e;if(t.grid){f=b(t).jqGrid("getInd",q,true);if(f!==false){if((b(f).attr("editable")||"0")=="0"&&!b(f).hasClass("not-editable-row")){e=t.p.colModel;b("td",f).each(function(x){s=e[x].name;var B=t.p.treeGrid===true&&s==t.p.ExpandColumn;if(B){j=b("span:first",this).html()}else{try{j=b.unformat(this,{rowId:q,colModel:e[x]},x)}catch(C){j=b(this).html()}}if(s!="cb"&&s!="subgrid"&&s!="rn"){if(t.p.autoencode){j=b.jgrid.htmlDecode(j)}l[s]=j;if(e[x].editable===true){if(o===null){o=x}B?b("span:first",this).html(""):b(this).html("");var y=b.extend({},e[x].editoptions||{},{id:q+"_"+s,name:s});if(!e[x].edittype){e[x].edittype="text"}y=b.jgrid.createEl(e[x].edittype,y,j,true,b.extend({},b.jgrid.ajaxOptions,t.p.ajaxSelectOptions||{}));b(y).addClass("editable");B?b("span:first",this).append(y):b(this).append(y);e[x].edittype=="select"&&e[x].editoptions.multiple===true&&b.browser.msie&&b(y).width(b(y).width());u++}}});if(u>0){l.id=q;t.p.savedRow.push(l);b(f).attr("editable","1");b("td:eq("+o+") input",f).focus();m.keys===true&&b(f).bind("keydown",function(x){x.keyCode===27&&b(t).jqGrid("restoreRow",q,p);if(x.keyCode===13){if(x.target.tagName=="TEXTAREA"){return true}b(t).jqGrid("saveRow",q,m);return false}x.stopPropagation()});b.isFunction(m.oneditfunc)&&m.oneditfunc.call(t,q)}}}}})},saveRow:function(Q,a,J,B,D,n,E){var H={successfunc:a||null,url:J||null,extraparam:B||{},aftersavefunc:D||null,errorfunc:n||null,afterrestorefunc:E||null,restoreAfterErorr:true},C=b.makeArray(arguments).slice(1),R;R=C[0]&&typeof C[0]=="object"&&!b.isFunction(C[0])?b.extend(H,C[0]):H;var M=false,N=this[0],P,O={},K={},F={},z,w,I;if(!N.grid){return M}I=b(N).jqGrid("getInd",Q,true);if(I===false){return M}H=b(I).attr("editable");R.url=R.url?R.url:N.p.editurl;if(H==="1"){var S;b("td",I).each(function(f){S=N.p.colModel[f];P=S.name;if(P!="cb"&&P!="subgrid"&&S.editable===true&&P!="rn"&&!b(this).hasClass("not-editable-cell")){switch(S.edittype){case"checkbox":var d=["Yes","No"];if(S.editoptions){d=S.editoptions.value.split(":")}O[P]=b("input",this).attr("checked")?d[0]:d[1];break;case"text":case"password":case"textarea":case"button":O[P]=b("input, textarea",this).val();break;case"select":if(S.editoptions.multiple){d=b("select",this);var e=[];O[P]=b(d).val();O[P]=O[P]?O[P].join(","):"";b("select > option:selected",this).each(function(j,h){e[j]=b(h).text()});K[P]=e.join(",")}else{O[P]=b("select>option:selected",this).val();K[P]=b("select>option:selected",this).text()}if(S.formatter&&S.formatter=="select"){K={}}break;case"custom":try{if(S.editoptions&&b.isFunction(S.editoptions.custom_value)){O[P]=S.editoptions.custom_value.call(N,b(".customelement",this),"get");if(O[P]===undefined){throw"e2"}}else{throw"e1"}}catch(c){c=="e1"&&b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);c=="e2"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,c.message,jQuery.jgrid.edit.bClose)}}w=b.jgrid.checkValues(O[P],f,N);if(w[0]===false){w[1]=O[P]+" "+w[1];return false}if(N.p.autoencode){O[P]=b.jgrid.htmlEncode(O[P])}if(R.url!=="clientArray"&&S.editoptions&&S.editoptions.NullIfEmpty===true){if(O[P]==""){F[P]="null"}}}});if(w[0]===false){try{var G=b.jgrid.findPos(b("#"+b.jgrid.jqID(Q),N.grid.bDiv)[0]);b.jgrid.info_dialog(b.jgrid.errors.errcap,w[1],b.jgrid.edit.bClose,{left:G[0],top:G[1]})}catch(L){alert(w[1])}return M}if(O){H=N.p.prmNames;C=H.oper;G=H.id;O[C]=H.editoper;O[G]=Q;if(typeof N.p.inlineData=="undefined"){N.p.inlineData={}}O=b.extend({},O,N.p.inlineData,R.extraparam)}if(R.url=="clientArray"){O=b.extend({},O,K);N.p.autoencode&&b.each(O,function(c,d){O[c]=b.jgrid.htmlDecode(d)});G=b(N).jqGrid("setRowData",Q,O);b(I).attr("editable","0");for(H=0;H<N.p.savedRow.length;H++){if(N.p.savedRow[H].id==Q){z=H;break}}z>=0&&N.p.savedRow.splice(z,1);b.isFunction(R.aftersavefunc)&&R.aftersavefunc.call(N,Q,G);M=true}else{b("#lui_"+N.p.id).show();F=b.extend({},O,F);b.ajax(b.extend({url:R.url,data:b.isFunction(N.p.serializeRowData)?N.p.serializeRowData.call(N,F):F,type:"POST",async:false,complete:function(e,c){b("#lui_"+N.p.id).hide();if(c==="success"){if((b.isFunction(R.succesfunc)?R.succesfunc.call(N,e):true)===true){N.p.autoencode&&b.each(O,function(f,h){O[f]=b.jgrid.htmlDecode(h)});O=b.extend({},O,K);b(N).jqGrid("setRowData",Q,O);b(I).attr("editable","0");for(var d=0;d<N.p.savedRow.length;d++){if(N.p.savedRow[d].id==Q){z=d;break}}z>=0&&N.p.savedRow.splice(z,1);b.isFunction(R.aftersavefunc)&&R.aftersavefunc.call(N,Q,e);M=true}else{b.isFunction(R.errorfunc)&&R.errorfunc.call(N,Q,e,c);R.restoreAfterError===true&&b(N).jqGrid("restoreRow",Q,R.afterrestorefunc)}}},error:function(e,c){b("#lui_"+N.p.id).hide();if(b.isFunction(R.errorfunc)){R.errorfunc.call(N,Q,e,c)}else{try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+e.responseText+"</div>",jQuery.jgrid.edit.bClose,{buttonalign:"right"})}catch(d){alert(e.responseText)}}R.restoreAfterError===true&&b(N).jqGrid("restoreRow",Q,R.afterrestorefunc)}},b.jgrid.ajaxOptions,N.p.ajaxRowOptions||{}))}b(I).unbind("keydown")}return M},restoreRow:function(a,c){return this.each(function(){var f=this,h,k,d={};if(f.grid){k=b(f).jqGrid("getInd",a,true);if(k!==false){for(var m=0;m<f.p.savedRow.length;m++){if(f.p.savedRow[m].id==a){h=m;break}}if(h>=0){if(b.isFunction(b.fn.datepicker)){try{b("input.hasDatepicker","#"+b.jgrid.jqID(k.id)).datepicker("hide")}catch(e){}}b.each(f.p.colModel,function(){if(this.editable===true&&this.name in f.p.savedRow[h]&&!b(this).hasClass("not-editable-cell")){d[this.name]=f.p.savedRow[h][this.name]}});b(f).jqGrid("setRowData",a,d);b(k).attr("editable","0").unbind("keydown");f.p.savedRow.splice(h,1)}b.isFunction(c)&&c.call(f,a)}}})}})})(jQuery);(function(a){a.jgrid.extend({editCell:function(c,f,b){return this.each(function(){var n=this,d,o,p;if(!(!n.grid||n.p.cellEdit!==true)){f=parseInt(f,10);n.p.selrow=n.rows[c].id;n.p.knv||a(n).jqGrid("GridNav");if(n.p.savedRow.length>0){if(b===true){if(c==n.p.iRow&&f==n.p.iCol){return}}a(n).jqGrid("saveCell",n.p.savedRow[0].id,n.p.savedRow[0].ic)}else{window.setTimeout(function(){a("#"+n.p.knv).attr("tabindex","-1").focus()},0)}d=n.p.colModel[f].name;if(!(d=="subgrid"||d=="cb"||d=="rn")){p=a("td:eq("+f+")",n.rows[c]);if(n.p.colModel[f].editable===true&&b===true&&!p.hasClass("not-editable-cell")){if(parseInt(n.p.iCol,10)>=0&&parseInt(n.p.iRow,10)>=0){a("td:eq("+n.p.iCol+")",n.rows[n.p.iRow]).removeClass("edit-cell ui-state-highlight");a(n.rows[n.p.iRow]).removeClass("selected-row ui-state-hover")}a(p).addClass("edit-cell ui-state-highlight");a(n.rows[c]).addClass("selected-row ui-state-hover");try{o=a.unformat(p,{rowId:n.rows[c].id,colModel:n.p.colModel[f]},f)}catch(m){o=a(p).html()}if(n.p.autoencode){o=a.jgrid.htmlDecode(o)}if(!n.p.colModel[f].edittype){n.p.colModel[f].edittype="text"}n.p.savedRow.push({id:c,ic:f,name:d,v:o});if(a.isFunction(n.p.formatCell)){var l=n.p.formatCell.call(n,n.rows[c].id,d,o,c,f);if(l!==undefined){o=l}}l=a.extend({},n.p.colModel[f].editoptions||{},{id:c+"_"+d,name:d});var e=a.jgrid.createEl(n.p.colModel[f].edittype,l,o,true,a.extend({},a.jgrid.ajaxOptions,n.p.ajaxSelectOptions||{}));a.isFunction(n.p.beforeEditCell)&&n.p.beforeEditCell.call(n,n.rows[c].id,d,o,c,f);a(p).html("").append(e).attr("tabindex","0");window.setTimeout(function(){a(e).focus()},0);a("input, select, textarea",p).bind("keydown",function(h){if(h.keyCode===27){if(a("input.hasDatepicker",p).length>0){a(".ui-datepicker").is(":hidden")?a(n).jqGrid("restoreCell",c,f):a("input.hasDatepicker",p).datepicker("hide")}else{a(n).jqGrid("restoreCell",c,f)}}h.keyCode===13&&a(n).jqGrid("saveCell",c,f);if(h.keyCode==9){if(n.grid.hDiv.loading){return false}else{h.shiftKey?a(n).jqGrid("prevCell",c,f):a(n).jqGrid("nextCell",c,f)}}h.stopPropagation()});a.isFunction(n.p.afterEditCell)&&n.p.afterEditCell.call(n,n.rows[c].id,d,o,c,f)}else{if(parseInt(n.p.iCol,10)>=0&&parseInt(n.p.iRow,10)>=0){a("td:eq("+n.p.iCol+")",n.rows[n.p.iRow]).removeClass("edit-cell ui-state-highlight");a(n.rows[n.p.iRow]).removeClass("selected-row ui-state-hover")}p.addClass("edit-cell ui-state-highlight");a(n.rows[c]).addClass("selected-row ui-state-hover");if(a.isFunction(n.p.onSelectCell)){o=p.html().replace(/\&#160\;/ig,"");n.p.onSelectCell.call(n,n.rows[c].id,d,o,c,f)}}n.p.iCol=f;n.p.iRow=c}}})},saveCell:function(b,c){return this.each(function(){var B=this,C;if(!(!B.grid||B.p.cellEdit!==true)){C=B.p.savedRow.length>=1?0:null;if(C!==null){var s=a("td:eq("+c+")",B.rows[b]),D,E,x=B.p.colModel[c],w=x.name,v=a.jgrid.jqID(w);switch(x.edittype){case"select":if(x.editoptions.multiple){v=a("#"+b+"_"+v,B.rows[b]);var y=[];if(D=a(v).val()){D.join(",")}else{D=""}a("option:selected",v).each(function(f,h){y[f]=a(h).text()});E=y.join(",")}else{D=a("#"+b+"_"+v+">option:selected",B.rows[b]).val();E=a("#"+b+"_"+v+">option:selected",B.rows[b]).text()}if(x.formatter){E=D}break;case"checkbox":var z=["Yes","No"];if(x.editoptions){z=x.editoptions.value.split(":")}E=D=a("#"+b+"_"+v,B.rows[b]).attr("checked")?z[0]:z[1];break;case"password":case"text":case"textarea":case"button":E=D=a("#"+b+"_"+v,B.rows[b]).val();break;case"custom":try{if(x.editoptions&&a.isFunction(x.editoptions.custom_value)){D=x.editoptions.custom_value.call(B,a(".customelement",s),"get");if(D===undefined){throw"e2"}else{E=D}}else{throw"e1"}}catch(d){d=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);d=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,d.message,jQuery.jgrid.edit.bClose)}}if(E!=B.p.savedRow[C].v){if(a.isFunction(B.p.beforeSaveCell)){if(C=B.p.beforeSaveCell.call(B,B.rows[b].id,w,D,b,c)){E=D=C}}var e=a.jgrid.checkValues(D,c,B);if(e[0]===true){C={};if(a.isFunction(B.p.beforeSubmitCell)){(C=B.p.beforeSubmitCell.call(B,B.rows[b].id,w,D,b,c))||(C={})}a("input.hasDatepicker",s).length>0&&a("input.hasDatepicker",s).datepicker("hide");if(B.p.cellsubmit=="remote"){if(B.p.cellurl){var A={};if(B.p.autoencode){D=a.jgrid.htmlEncode(D)}A[w]=D;z=B.p.prmNames;x=z.id;v=z.oper;A[x]=B.rows[b].id;A[v]=z.editoper;A=a.extend(C,A);a("#lui_"+B.p.id).show();B.grid.hDiv.loading=true;a.ajax(a.extend({url:B.p.cellurl,data:a.isFunction(B.p.serializeCellData)?B.p.serializeCellData.call(B,A):A,type:"POST",complete:function(f,j){a("#lui_"+B.p.id).hide();B.grid.hDiv.loading=false;if(j=="success"){if(a.isFunction(B.p.afterSubmitCell)){var h=B.p.afterSubmitCell.call(B,f,A.id,w,D,b,c);if(h[0]===true){a(s).empty();a(B).jqGrid("setCell",B.rows[b].id,c,E,false,false,true);a(s).addClass("dirty-cell");a(B.rows[b]).addClass("edited");a.isFunction(B.p.afterSaveCell)&&B.p.afterSaveCell.call(B,B.rows[b].id,w,D,b,c);B.p.savedRow.splice(0,1)}else{a.jgrid.info_dialog(a.jgrid.errors.errcap,h[1],a.jgrid.edit.bClose);a(B).jqGrid("restoreCell",b,c)}}else{a(s).empty();a(B).jqGrid("setCell",B.rows[b].id,c,E,false,false,true);a(s).addClass("dirty-cell");a(B.rows[b]).addClass("edited");a.isFunction(B.p.afterSaveCell)&&B.p.afterSaveCell.call(B,B.rows[b].id,w,D,b,c);B.p.savedRow.splice(0,1)}}},error:function(f,h){a("#lui_"+B.p.id).hide();B.grid.hDiv.loading=false;a.isFunction(B.p.errorCell)?B.p.errorCell.call(B,f,h):a.jgrid.info_dialog(a.jgrid.errors.errcap,f.status+" : "+f.statusText+"<br/>"+h,a.jgrid.edit.bClose);a(B).jqGrid("restoreCell",b,c)}},a.jgrid.ajaxOptions,B.p.ajaxCellOptions||{}))}else{try{a.jgrid.info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose);a(B).jqGrid("restoreCell",b,c)}catch(o){}}}if(B.p.cellsubmit=="clientArray"){a(s).empty();a(B).jqGrid("setCell",B.rows[b].id,c,E,false,false,true);a(s).addClass("dirty-cell");a(B.rows[b]).addClass("edited");a.isFunction(B.p.afterSaveCell)&&B.p.afterSaveCell.call(B,B.rows[b].id,w,D,b,c);B.p.savedRow.splice(0,1)}}else{try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,D+" "+e[1],a.jgrid.edit.bClose)},100);a(B).jqGrid("restoreCell",b,c)}catch(p){}}}else{a(B).jqGrid("restoreCell",b,c)}}a.browser.opera?a("#"+B.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+B.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(b,c){return this.each(function(){var e=this,j;if(!(!e.grid||e.p.cellEdit!==true)){j=e.p.savedRow.length>=1?0:null;if(j!==null){var d=a("td:eq("+c+")",e.rows[b]);if(a.isFunction(a.fn.datepicker)){try{a("input.hasDatepicker",d).datepicker("hide")}catch(k){}}a(d).empty().attr("tabindex","-1");a(e).jqGrid("setCell",e.rows[b].id,c,e.p.savedRow[j].v,false,false,true);a.isFunction(e.p.afterRestoreCell)&&e.p.afterRestoreCell.call(e,e.rows[b].id,e.p.savedRow[j].v,b,c);e.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+e.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(b,c){return this.each(function(){var d=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var e=c+1;e<this.p.colModel.length;e++){if(this.p.colModel[e].editable===true){d=e;break}}if(d!==false){a(this).jqGrid("editCell",b,d,true)}else{this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,c)}}})},prevCell:function(b,c){return this.each(function(){var d=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var e=c-1;e>=0;e--){if(this.p.colModel[e].editable===true){d=e;break}}if(d!==false){a(this).jqGrid("editCell",b,d,true)}else{this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,c)}}})},GridNav:function(){return this.each(function(){function l(p,e,d){if(d.substr(0,1)=="v"){var c=a(j.grid.bDiv)[0].clientHeight,f=a(j.grid.bDiv)[0].scrollTop,h=j.rows[p].offsetTop+j.rows[p].clientHeight,o=j.rows[p].offsetTop;if(d=="vd"){if(h>=c){a(j.grid.bDiv)[0].scrollTop=a(j.grid.bDiv)[0].scrollTop+j.rows[p].clientHeight}}if(d=="vu"){if(o<f){a(j.grid.bDiv)[0].scrollTop=a(j.grid.bDiv)[0].scrollTop-j.rows[p].clientHeight}}}if(d=="h"){d=a(j.grid.bDiv)[0].clientWidth;c=a(j.grid.bDiv)[0].scrollLeft;f=j.rows[p].cells[e].offsetLeft;if(j.rows[p].cells[e].offsetLeft+j.rows[p].cells[e].clientWidth>=d+parseInt(c,10)){a(j.grid.bDiv)[0].scrollLeft=a(j.grid.bDiv)[0].scrollLeft+j.rows[p].cells[e].clientWidth}else{if(f<c){a(j.grid.bDiv)[0].scrollLeft=a(j.grid.bDiv)[0].scrollLeft-j.rows[p].cells[e].clientWidth}}}}function m(c,e){var d,f;if(e=="lft"){d=c+1;for(f=c;f>=0;f--){if(j.p.colModel[f].hidden!==true){d=f;break}}}if(e=="rgt"){d=c-1;for(f=c;f<j.p.colModel.length;f++){if(j.p.colModel[f].hidden!==true){d=f;break}}}return d}var j=this;if(!(!j.grid||j.p.cellEdit!==true)){j.p.knv=j.p.id+"_kn";var k=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+j.p.knv+"'></span></span>"),b,n;a(k).insertBefore(j.grid.cDiv);a("#"+j.p.knv).focus().keydown(function(c){n=c.keyCode;if(j.p.direction=="rtl"){if(n==37){n=39}else{if(n==39){n=37}}}switch(n){case 38:if(j.p.iRow-1>0){l(j.p.iRow-1,j.p.iCol,"vu");a(j).jqGrid("editCell",j.p.iRow-1,j.p.iCol,false)}break;case 40:if(j.p.iRow+1<=j.rows.length-1){l(j.p.iRow+1,j.p.iCol,"vd");a(j).jqGrid("editCell",j.p.iRow+1,j.p.iCol,false)}break;case 37:if(j.p.iCol-1>=0){b=m(j.p.iCol-1,"lft");l(j.p.iRow,b,"h");a(j).jqGrid("editCell",j.p.iRow,b,false)}break;case 39:if(j.p.iCol+1<=j.p.colModel.length-1){b=m(j.p.iCol+1,"rgt");l(j.p.iRow,b,"h");a(j).jqGrid("editCell",j.p.iRow,b,false)}break;case 13:parseInt(j.p.iCol,10)>=0&&parseInt(j.p.iRow,10)>=0&&a(j).jqGrid("editCell",j.p.iRow,j.p.iCol,true)}return false})}})},getChangedCells:function(b){var c=[];b||(b="all");this.each(function(){var d=this,e;!d.grid||d.p.cellEdit!==true||a(d.rows).each(function(j){var k={};if(a(this).hasClass("edited")){a("td",this).each(function(f){e=d.p.colModel[f].name;if(e!=="cb"&&e!=="subgrid"){if(b=="dirty"){if(a(this).hasClass("dirty-cell")){try{k[e]=a.unformat(this,{rowId:d.rows[j].id,colModel:d.p.colModel[f]},f)}catch(l){k[e]=a.jgrid.htmlDecode(a(this).html())}}}else{try{k[e]=a.unformat(this,{rowId:d.rows[j].id,colModel:d.p.colModel[f]},f)}catch(h){k[e]=a.jgrid.htmlDecode(a(this).html())}}}});k.id=this.id;c.push(k)}})});return c}})})(jQuery);(function(t){t.fn.jqm=function(b){var e={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:w,ajaxText:"",target:w,modal:w,toTop:w,onShow:w,onHide:w,onLoad:w};return this.each(function(){if(this._jqm){return a[this._jqm].c=t.extend({},a[this._jqm].c,b)}d++;this._jqm=d;a[d]={c:t.extend(e,t.jqm.params,b),a:w,w:t(this).addClass("jqmID"+d),s:d};e.trigger&&t(this).jqmAddTrigger(e.trigger)})};t.fn.jqmAddClose=function(b){return h(this,b,"jqmHide")};t.fn.jqmAddTrigger=function(b){return h(this,b,"jqmShow")};t.fn.jqmShow=function(b){return this.each(function(){t.jqm.open(this._jqm,b)})};t.fn.jqmHide=function(b){return this.each(function(){t.jqm.close(this._jqm,b)})};t.jqm={hash:{},open:function(k,o){var l=a[k],n=l.c,e="."+n.closeClass,p=parseInt(l.w.css("z-index"));p=p>0?p:3000;var b=t("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":p-1,opacity:n.overlay/100});if(l.a){return w}l.t=o;l.a=true;l.w.css("z-index",p);if(n.modal){c[0]||setTimeout(function(){m("bind")},1);c.push(k)}else{if(n.overlay>0){n.closeoverlay&&l.w.jqmAddClose(b)}else{b=w}}l.o=b?b.addClass(n.overlayClass).prependTo("body"):w;if(u){t("html,body").css({height:"100%",width:"100%"});if(b){b=b.css({position:"absolute"})[0];for(var j in {Top:1,Left:1}){b.style.setExpression(j.toLowerCase(),"(_=(document.documentElement.scroll"+j+" || document.body.scroll"+j+"))+'px'")}}}if(n.ajax){p=n.target||l.w;b=n.ajax;p=typeof p=="string"?t(p,l.w):t(p);b=b.substr(0,1)=="@"?t(o).attr(b.substring(1)):b;p.html(n.ajaxText).load(b,function(){n.onLoad&&n.onLoad.call(this,l);e&&l.w.jqmAddClose(t(e,l.w));v(l)})}else{e&&l.w.jqmAddClose(t(e,l.w))}n.toTop&&l.o&&l.w.before('<span id="jqmP'+l.w[0]._jqm+'"></span>').insertAfter(l.o);n.onShow?n.onShow(l):l.w.show();v(l);return w},close:function(b){b=a[b];if(!b.a){return w}b.a=w;if(c[0]){c.pop();c[0]||m("unbind")}b.c.toTop&&b.o&&t("#jqmP"+b.w[0]._jqm).after(b.w).remove();if(b.c.onHide){b.c.onHide(b)}else{b.w.hide();b.o&&b.o.remove()}return w},params:{}};var d=0,a=t.jqm.hash,c=[],u=t.browser.msie&&t.browser.version=="6.0",w=false,v=function(b){var e=t('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(u){if(b.o){b.o.html('<p style="width:100%;height:100%"/>').prepend(e)}else{t("iframe.jqm",b.w)[0]||b.w.prepend(e)}}x(b)},x=function(b){try{t(":input:visible",b.w)[0].focus()}catch(e){}},m=function(b){t(document)[b]("keypress",f)[b]("keydown",f)[b]("mousedown",f)},f=function(b){var e=a[c[c.length-1]];(b=!t(b.target).parents(".jqmID"+e.s)[0])&&x(e);return !b},h=function(e,b,j){return e.each(function(){var k=this._jqm;t(b).each(function(){if(!this[j]){this[j]=[];t(this).click(function(){for(var n in {jqmShow:1,jqmHide:1}){for(var l in this[n]){if(a[this[n][l]]){a[this[n][l]].w[n](this)}}}return w})}this[j].push(k)})})}})(jQuery);(function(j){j.fn.jqDrag=function(b){return h(this,b,"d")};j.fn.jqResize=function(b,c){return h(this,b,"r",c)};j.jqDnR={dnr:{},e:0,drag:function(b){if(m.k=="d"){n.css({left:m.X+b.pageX-m.pX,top:m.Y+b.pageY-m.pY})}else{n.css({width:Math.max(b.pageX-m.pX+m.W,0),height:Math.max(b.pageY-m.pY+m.H,0)});M1&&o.css({width:Math.max(b.pageX-M1.pX+M1.W,0),height:Math.max(b.pageY-M1.pY+M1.H,0)})}return false},stop:function(){j(document).unbind("mousemove",a.drag).unbind("mouseup",a.stop)}};var a=j.jqDnR,m=a.dnr,n=a.e,o,h=function(b,f,c,d){return b.each(function(){f=f?j(f,b):b;f.bind("mousedown",{e:b,k:c},function(l){var q=l.data,k={};n=q.e;o=d?j(d):false;if(n.css("position")!="relative"){try{n.position(k)}catch(s){}}m={X:k.left||e("left")||0,Y:k.top||e("top")||0,W:e("width")||n[0].scrollWidth||0,H:e("height")||n[0].scrollHeight||0,pX:l.pageX,pY:l.pageY,k:q.k};M1=o&&q.k!="d"?{X:k.left||f1("left")||0,Y:k.top||f1("top")||0,W:o[0].offsetWidth||f1("width")||0,H:o[0].offsetHeight||f1("height")||0,pX:l.pageX,pY:l.pageY,k:q.k}:false;if(j("input.hasDatepicker",n[0])[0]){try{j("input.hasDatepicker",n[0]).datepicker("hide")}catch(t){}}j(document).mousemove(j.jqDnR.drag).mouseup(j.jqDnR.stop);return false})})},e=function(b){return parseInt(n.css(b))||false};f1=function(b){return parseInt(o.css(b))||false}})(jQuery);(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var c;this.p.subGridOptions=a.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:false,delayOnLoad:50,selectOnExpand:false,reloadOnExpand:true},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:a.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,fixed:true});c=this.p.subGridModel;if(c[0]){c[0].align=a.extend([],c[0].align||[]);for(var b=0;b<c[0].name.length;b++){c[0].align[b]=c[0].align[b]||"left"}}})},addSubGridCell:function(b,d){var h="",e,c;this.each(function(){h=this.formatCol(b,d);c=this.p.id;e=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+c+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+h+"><a href='javascript:void(0);'><span class='ui-icon "+e+"'></span></a></td>"},addSubGrid:function(b){return this.each(function(){var f=this;if(f.grid){var c=function(j,l,o){l=a("<td align='"+f.p.subGridModel[0].align[o]+"'></td>").html(l);a(j).append(l)},h=function(l,q){var s,p,u,o=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),j=a("<tr></tr>");for(p=0;p<f.p.subGridModel[0].name.length;p++){s=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+f.p.direction+"'></th>");a(s).html(f.p.subGridModel[0].name[p]);a(s).width(f.p.subGridModel[0].width[p]);a(j).append(s)}a(o).append(j);if(l){u=f.p.xmlReader.subgrid;a(u.root+" "+u.row,l).each(function(){j=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(u.repeatitems===true){a(u.cell,this).each(function(w){c(j,a(this).text()||"&#160;",w)})}else{var v=f.p.subGridModel[0].mapping||f.p.subGridModel[0].name;if(v){for(p=0;p<v.length;p++){c(j,a(v[p],this).text()||"&#160;",p)}}}a(o).append(j)})}s=a("table:first",f.grid.bDiv).attr("id")+"_";a("#"+s+q).append(o);f.grid.hDiv.loading=false;a("#load_"+f.p.id).hide();return false},k=function(l,u){var v,s,z,o,j,q=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),p=a("<tr></tr>");for(s=0;s<f.p.subGridModel[0].name.length;s++){v=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+f.p.direction+"'></th>");a(v).html(f.p.subGridModel[0].name[s]);a(v).width(f.p.subGridModel[0].width[s]);a(p).append(v)}a(q).append(p);if(l){o=f.p.jsonReader.subgrid;v=l[o.root];if(typeof v!=="undefined"){for(s=0;s<v.length;s++){z=v[s];p=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(o.repeatitems===true){if(o.cell){z=z[o.cell]}for(j=0;j<z.length;j++){c(p,z[j]||"&#160;",j)}}else{var w=f.p.subGridModel[0].mapping||f.p.subGridModel[0].name;if(w.length){for(j=0;j<w.length;j++){c(p,z[w[j]]||"&#160;",j)}}}a(q).append(p)}}}s=a("table:first",f.grid.bDiv).attr("id")+"_";a("#"+s+u).append(q);f.grid.hDiv.loading=false;a("#load_"+f.p.id).hide();return false},y=function(l){var p,q,o,j;p=a(l).attr("id");q={nd_:(new Date).getTime()};q[f.p.prmNames.subgridid]=p;if(!f.p.subGridModel[0]){return false}if(f.p.subGridModel[0].params){for(j=0;j<f.p.subGridModel[0].params.length;j++){for(o=0;o<f.p.colModel.length;o++){if(f.p.colModel[o].name==f.p.subGridModel[0].params[j]){q[f.p.colModel[o].name]=a("td:eq("+o+")",l).text().replace(/\&#160\;/ig,"")}}}}if(!f.grid.hDiv.loading){f.grid.hDiv.loading=true;a("#load_"+f.p.id).show();if(!f.p.subgridtype){f.p.subgridtype=f.p.datatype}if(a.isFunction(f.p.subgridtype)){f.p.subgridtype.call(f,q)}else{f.p.subgridtype=f.p.subgridtype.toLowerCase()}switch(f.p.subgridtype){case"xml":case"json":a.ajax(a.extend({type:f.p.mtype,url:f.p.subGridUrl,dataType:f.p.subgridtype,data:a.isFunction(f.p.serializeSubGridData)?f.p.serializeSubGridData.call(f,q):q,complete:function(s){f.p.subgridtype=="xml"?h(s.responseXML,p):k(a.jgrid.parse(s.responseText),p)}},a.jgrid.ajaxOptions,f.p.ajaxSubgridOptions||{}))}}return false},d,m,t,x=0,e,n;a.each(f.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb"){x++}});a(f.rows).each(function(l){var j=this;if(a(j).hasClass("jqgrow")){a(this.cells[b]).bind("click",function(){n=j.nextSibling;if(a(this).hasClass("sgcollapsed")){m=f.p.id;d=j.id;if(f.p.subGridOptions.reloadOnExpand===true||f.p.subGridOptions.reloadOnExpand===false&&!a(n).hasClass("ui-subgrid")){t=b>=1?"<td colspan='"+b+"'>&#160;</td>":"";e=true;if(a.isFunction(f.p.subGridBeforeExpand)){e=f.p.subGridBeforeExpand.call(f,m+"_"+d,d)}if(e===false){return false}a(j).after("<tr role='row' class='ui-subgrid'>"+t+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+f.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(f.p.colNames.length-1-x,10)+"' class='ui-widget-content subgrid-data'><div id="+m+"_"+d+" class='tablediv'></div></td></tr>");a.isFunction(f.p.subGridRowExpanded)?f.p.subGridRowExpanded.call(f,m+"_"+d,d):y(j)}else{a(n).show()}a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+f.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");f.p.subGridOptions.selectOnExpand&&a(f).jqGrid("setSelection",d)}else{if(a(this).hasClass("sgexpanded")){e=true;if(a.isFunction(f.p.subGridRowColapsed)){d=j.id;e=f.p.subGridRowColapsed.call(f,m+"_"+d,d)}if(e===false){return false}if(f.p.subGridOptions.reloadOnExpand===true){a(n).remove(".ui-subgrid")}else{a(n).hasClass("ui-subgrid")&&a(n).hide()}a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+f.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}}return false});f.p.subGridOptions.expandOnLoad===true&&setTimeout(function(){a(j.cells[b]).trigger("click")},l*f.p.subGridOptions.delayOnLoad)}});f.subGridXml=function(l,j){h(l,j)};f.subGridJson=function(l,j){k(l,j)}}})},expandSubGridRow:function(b){return this.each(function(){if(this.grid||b){if(this.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){(c=a("td.sgcollapsed",c)[0])&&a(c).trigger("click")}}}})},collapseSubGridRow:function(b){return this.each(function(){if(this.grid||b){if(this.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){(c=a("td.sgexpanded",c)[0])&&a(c).trigger("click")}}}})},toggleSubGridRow:function(b){return this.each(function(){if(this.grid||b){if(this.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgcollapsed",c)[0];if(d){a(d).trigger("click")}else{(d=a("td.sgexpanded",c)[0])&&a(d).trigger("click")}}}}})}})})(jQuery);(function(a){a.jgrid.extend({groupingSetup:function(){return this.each(function(){var f=this.p.groupingView;if(f!==null&&(typeof f==="object"||a.isFunction(f))){if(f.groupField.length){if(typeof f.visibiltyOnNextGrouping=="undefined"){f.visibiltyOnNextGrouping=[]}for(var h=0;h<f.groupField.length;h++){f.groupOrder[h]||(f.groupOrder[h]="asc");f.groupText[h]||(f.groupText[h]="{0}");if(typeof f.groupColumnShow[h]!="boolean"){f.groupColumnShow[h]=true}if(typeof f.groupSummary[h]!="boolean"){f.groupSummary[h]=false}if(f.groupColumnShow[h]===true){f.visibiltyOnNextGrouping[h]=true;a(this).jqGrid("showCol",f.groupField[h])}else{f.visibiltyOnNextGrouping[h]=a("#"+this.p.id+"_"+f.groupField[h]).is(":visible");a(this).jqGrid("hideCol",f.groupField[h])}f.sortitems[h]=[];f.sortnames[h]=[];f.summaryval[h]=[];if(f.groupSummary[h]){f.summary[h]=[];for(var j=this.p.colModel,k=0,e=j.length;k<e;k++){j[k].summaryType&&f.summary[h].push({nm:j[k].name,st:j[k].summaryType,v:""})}}}this.p.scroll=false;this.p.rownumbers=false;this.p.subGrid=false;this.p.treeGrid=false;this.p.gridview=true}else{this.p.grouping=false}}else{this.p.grouping=false}})},groupingPrepare:function(e,f,h,j){this.each(function(){f[0]+="";var c=f[0].toString().split(" ").join(""),b=this.p.groupingView,d=this;if(h.hasOwnProperty(c)){h[c].push(e)}else{h[c]=[];h[c].push(e);b.sortitems[0].push(c);b.sortnames[0].push(a.trim(f[0].toString()));b.summaryval[0][c]=a.extend(true,[],b.summary[0])}b.groupSummary[0]&&a.each(b.summaryval[0][c],function(){this.v=a.isFunction(this.st)?this.st.call(d,this.v,this.nm,j):a(d).jqGrid("groupingCalculations."+this.st,this.v,this.nm,j)})});return h},groupingToggle:function(b){this.each(function(){var n=this.p.groupingView,o=b.lastIndexOf("_"),p=b.substring(0,o+1);o=parseInt(b.substring(o+1),10)+1;var s=n.minusicon,e=n.plusicon,q=a("#"+b)[0].nextSibling,j=a("#"+b+" span.tree-wrap-"+this.p.direction),m=false;if(j.hasClass(s)){if(n.showSummaryOnHide&&n.groupSummary[0]){if(q){for(;q;){if(a(q).hasClass("jqfoot")){break}a(q).hide();q=q.nextSibling}}}else{if(q){for(;q;){if(a(q).attr("id")==p+String(o)){break}a(q).hide();q=q.nextSibling}}}j.removeClass(s).addClass(e);m=true}else{if(q){for(;q;){if(a(q).attr("id")==p+String(o)){break}a(q).show();q=q.nextSibling}}j.removeClass(e).addClass(s);m=false}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,b,m)});return false},groupingRender:function(c,d){return this.each(function(){var o=this,p=o.p.groupingView,t="",b="",s,e="",j,q,n;if(!p.groupDataSorted){p.sortitems[0].sort();p.sortnames[0].sort();if(p.groupOrder[0].toLowerCase()=="desc"){p.sortitems[0].reverse();p.sortnames[0].reverse()}}e=p.groupCollapse?p.plusicon:p.minusicon;e+=" tree-wrap-"+o.p.direction;for(n=0;n<d;){if(o.p.colModel[n].name==p.groupField[0]){q=n;break}n++}a.each(p.sortitems[0],function(l,k){s=o.p.id+"ghead_"+l;b="<span style='cursor:pointer;' class='ui-icon "+e+"' onclick=\"jQuery('#"+o.p.id+"').jqGrid('groupingToggle','"+s+"');return false;\"></span>";try{j=o.formatter(s,p.sortnames[0][l],q,p.sortitems[0])}catch(A){j=p.sortnames[0][l]}t+='<tr id="'+s+'" role="row" class= "ui-widget-content jqgroup ui-row-'+o.p.direction+'"><td colspan="'+d+'">'+b+a.jgrid.format(p.groupText[0],j,c[k].length)+"</td></tr>";for(var f=0;f<c[k].length;f++){t+=c[k][f].join("")}if(p.groupSummary[0]){f="";if(p.groupCollapse&&!p.showSummaryOnHide){f=' style="display:none;"'}t+="<tr"+f+' role="row" class="ui-widget-content jqfoot ui-row-'+o.p.direction+'">';f=p.summaryval[0][k];for(var m=o.p.colModel,w,x=c[k].length,h=0;h<d;h++){var y="<td "+o.formatCol(h,1,"")+">&#160;</td>",z="{0}";a.each(f,function(){if(this.nm==m[h].name){if(m[h].summaryTpl){z=m[h].summaryTpl}if(this.st=="avg"){if(this.v&&x>0){this.v/=x}}try{w=o.formatter("",this.v,h,this)}catch(u){w=this.v}y="<td "+o.formatCol(h,1,"")+">"+a.jgrid.format(z,w)+"</td>";return false}});t+=y}t+="</tr>"}});a("#"+o.p.id+" tbody:first").append(t);t=null})},groupingGroupBy:function(c,d){return this.each(function(){if(typeof c=="string"){c=[c]}var e=this.p.groupingView;this.p.grouping=true;for(var b=0;b<e.groupField.length;b++){!e.groupColumnShow[b]&&e.visibiltyOnNextGrouping[b]&&a(this).jqGrid("showCol",e.groupField[b])}for(b=0;b<c.length;b++){e.visibiltyOnNextGrouping[b]=a("#"+this.p.id+"_"+c[b]).is(":visible")}this.p.groupingView=a.extend(this.p.groupingView,d||{});e.groupField=c;a(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){if(typeof b=="undefined"){b=true}this.p.grouping=false;if(b===true){for(var d=this.p.groupingView,e=0;e<d.groupField.length;e++){!d.groupColumnShow[e]&&d.visibiltyOnNextGrouping[e]&&a(this).jqGrid("showCol",d.groupField)}a("tr.jqgroup, tr.jqfoot","#"+this.p.id+" tbody:first").remove();a("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else{a(this).trigger("reloadGrid")}})},groupingCalculations:{sum:function(d,e,f){return parseFloat(d||0)+parseFloat(f[e]||0)},min:function(d,e,f){if(d===""){return parseFloat(f[e]||0)}return Math.min(parseFloat(d),parseFloat(f[e]||0))},max:function(d,e,f){if(d===""){return parseFloat(f[e]||0)}return Math.max(parseFloat(d),parseFloat(f[e]||0))},count:function(d,e,f){if(d===""){d=0}return f.hasOwnProperty(e)?d+1:0},avg:function(d,e,f){return parseFloat(d||0)+parseFloat(f[e]||0)}}})})(jQuery);(function(a){a.jgrid.extend({setTreeNode:function(d,e){return this.each(function(){var u=this;if(u.grid&&u.p.treeGrid){for(var v=u.p.expColInd,x=u.p.treeReader.expanded_field,b=u.p.treeReader.leaf_field,w=u.p.treeReader.level_field,p=u.p.treeReader.icon_field,c=u.p.treeReader.loaded,m,t,s,q;d<e;){q=u.p.data[u.p._index[u.rows[d].id]];if(u.p.treeGridModel=="nested"){if(!q[b]){m=parseInt(q[u.p.treeReader.left_field],10);t=parseInt(q[u.p.treeReader.right_field],10);q[b]=t===m+1?"true":"false";u.rows[d].cells[u.p._treeleafpos].innerHTML=q[b]}}m=parseInt(q[w],10);if(u.p.tree_root_level===0){s=m+1;t=m}else{s=m;t=m-1}s="<div class='tree-wrap tree-wrap-"+u.p.direction+"' style='width:"+s*18+"px;'>";s+="<div style='"+(u.p.direction=="rtl"?"right:":"left:")+t*18+"px;' class='ui-icon ";if(q[c]!==undefined){q[c]=q[c]=="true"||q[c]===true?true:false}if(q[b]=="true"||q[b]===true){s+=(q[p]!==undefined&&q[p]!==""?q[p]:u.p.treeIcons.leaf)+" tree-leaf treeclick'";q[b]=true;t="leaf"}else{q[b]=false;t=""}q[x]=(q[x]=="true"||q[x]===true?true:false)&&q[c];s+=q[x]===true?u.p.treeIcons.minus+" tree-minus treeclick'":u.p.treeIcons.plus+" tree-plus treeclick'";s+="</div></div>";a(u.rows[d].cells[v]).wrapInner("<span class='cell-wrapper"+t+"'></span>").prepend(s);if(m!==parseInt(u.p.tree_root_level,10)){(q=(q=a(u).jqGrid("getNodeParent",q))&&q.hasOwnProperty(x)?q[x]:true)||a(u.rows[d]).css("display","none")}a(u.rows[d].cells[v]).find("div.treeclick").bind("click",function(f){f=a(f.target||f.srcElement,u.rows).closest("tr.jqgrow")[0].id;f=u.p._index[f];if(!u.p.data[f][b]){if(u.p.data[f][x]){a(u).jqGrid("collapseRow",u.p.data[f]);a(u).jqGrid("collapseNode",u.p.data[f])}else{a(u).jqGrid("expandRow",u.p.data[f]);a(u).jqGrid("expandNode",u.p.data[f])}}return false});u.p.ExpandColClick===true&&a(u.rows[d].cells[v]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(h){h=a(h.target||h.srcElement,u.rows).closest("tr.jqgrow")[0].id;var f=u.p._index[h];if(!u.p.data[f][b]){if(u.p.data[f][x]){a(u).jqGrid("collapseRow",u.p.data[f]);a(u).jqGrid("collapseNode",u.p.data[f])}else{a(u).jqGrid("expandRow",u.p.data[f]);a(u).jqGrid("expandNode",u.p.data[f])}}a(u).jqGrid("setSelection",h);return false});d++}}})},setTreeGrid:function(){return this.each(function(){var k=this,l=0,j=false,m,o,d=[];if(k.p.treeGrid){k.p.treedatatype||a.extend(k.p,{treedatatype:k.p.datatype});k.p.subGrid=false;k.p.altRows=false;k.p.pgbuttons=false;k.p.pginput=false;k.p.gridview=true;k.p.multiselect=false;k.p.rowList=[];k.p.expColInd=0;k.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+(k.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},k.p.treeIcons||{});if(k.p.treeGridModel=="nested"){k.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},k.p.treeReader)}else{if(k.p.treeGridModel=="adjacency"){k.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},k.p.treeReader)}}for(o in k.p.colModel){if(k.p.colModel.hasOwnProperty(o)){m=k.p.colModel[o].name;if(m==k.p.ExpandColumn&&!j){j=true;k.p.expColInd=l}l++;for(var n in k.p.treeReader){k.p.treeReader[n]==m&&d.push(m)}}}a.each(k.p.treeReader,function(b,c){if(c&&a.inArray(c,d)===-1){if(b==="leaf_field"){k.p._treeleafpos=l}l++;k.p.colNames.push(c);k.p.colModel.push({name:c,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(c){this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){var b=a(d).jqGrid("getNodeChildren",c),f=d.p.treeReader.expanded_field;a(b).each(function(){var e=a.jgrid.getAccessor(this,d.p.localReader.id);a("#"+e,d.grid.bDiv).css("display","");this[f]&&a(d).jqGrid("expandRow",this)})}})},collapseRow:function(c){this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){var b=a(d).jqGrid("getNodeChildren",c),f=d.p.treeReader.expanded_field;a(b).each(function(){var e=a.jgrid.getAccessor(this,d.p.localReader.id);a("#"+e,d.grid.bDiv).css("display","none");this[f]&&a(d).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var c=[];this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){switch(d.p.treeGridModel){case"nested":var b=d.p.treeReader.level_field;a(d.p.data).each(function(){parseInt(this[b],10)===parseInt(d.p.tree_root_level,10)&&c.push(this)});break;case"adjacency":var f=d.p.treeReader.parent_id_field;a(d.p.data).each(function(){if(this[f]===null||String(this[f]).toLowerCase()=="null"){c.push(this)}})}}});return c},getNodeDepth:function(d){var e=null;this.each(function(){if(this.grid&&this.p.treeGrid){switch(this.p.treeGridModel){case"nested":e=parseInt(d[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case"adjacency":e=a(this).jqGrid("getNodeAncestors",d).length}}});return e},getNodeParent:function(d){var e=null;this.each(function(){if(this.grid&&this.p.treeGrid){switch(this.p.treeGridModel){case"nested":var n=this.p.treeReader.left_field,o=this.p.treeReader.right_field,q=this.p.treeReader.level_field,b=parseInt(d[n],10),p=parseInt(d[o],10),m=parseInt(d[q],10);a(this.p.data).each(function(){if(parseInt(this[q],10)===m-1&&parseInt(this[n],10)<b&&parseInt(this[o],10)>p){e=this;return false}});break;case"adjacency":var c=this.p.treeReader.parent_id_field,l=this.p.localReader.id;a(this.p.data).each(function(){if(this[l]==d[c]){e=this;return false}})}}});return e},getNodeChildren:function(d){var e=[];this.each(function(){if(this.grid&&this.p.treeGrid){switch(this.p.treeGridModel){case"nested":var n=this.p.treeReader.left_field,o=this.p.treeReader.right_field,q=this.p.treeReader.level_field,b=parseInt(d[n],10),p=parseInt(d[o],10),m=parseInt(d[q],10);a(this.p.data).each(function(){parseInt(this[q],10)===m+1&&parseInt(this[n],10)>b&&parseInt(this[o],10)<p&&e.push(this)});break;case"adjacency":var c=this.p.treeReader.parent_id_field,l=this.p.localReader.id;a(this.p.data).each(function(){this[c]==d[l]&&e.push(this)})}}});return e},getFullTreeNode:function(d){var e=[];this.each(function(){var p;if(this.grid&&this.p.treeGrid){switch(this.p.treeGridModel){case"nested":var q=this.p.treeReader.left_field,t=this.p.treeReader.right_field,b=this.p.treeReader.level_field,s=parseInt(d[q],10),m=parseInt(d[t],10),c=parseInt(d[b],10);a(this.p.data).each(function(){parseInt(this[b],10)>=c&&parseInt(this[q],10)>=s&&parseInt(this[q],10)<=m&&e.push(this)});break;case"adjacency":if(d){e.push(d);var l=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(f){p=e.length;for(f=0;f<p;f++){if(e[f][n]==this[l]){e.push(this);break}}})}}}});return e},getNodeAncestors:function(d){var e=[];this.each(function(){if(this.grid&&this.p.treeGrid){for(var b=a(this).jqGrid("getNodeParent",d);b;){e.push(b);b=a(this).jqGrid("getNodeParent",b)}}});return e},isVisibleNode:function(d){var e=true;this.each(function(){if(this.grid&&this.p.treeGrid){var b=a(this).jqGrid("getNodeAncestors",d),c=this.p.treeReader.expanded_field;a(b).each(function(){e=e&&this[c];if(!e){return false}})}});return e},isNodeLoaded:function(d){var e;this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.leaf_field;e=d!==undefined?d.loaded!==undefined?d.loaded:d[b]||a(this).jqGrid("getNodeChildren",d).length>0?true:false:false}});return e},expandNode:function(c){return this.each(function(){if(this.grid&&this.p.treeGrid){var o=this.p.treeReader.expanded_field,n=this.p.treeReader.parent_id_field,p=this.p.treeReader.loaded,s=this.p.treeReader.level_field,b=this.p.treeReader.left_field,q=this.p.treeReader.right_field;if(!c[o]){var m=a.jgrid.getAccessor(c,this.p.localReader.id),d=a("#"+m,this.grid.bDiv)[0],l=this.p._index[m];if(a(this).jqGrid("isNodeLoaded",this.p.data[l])){c[o]=true;a("div.treeclick",d).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{c[o]=true;a("div.treeclick",d).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=d.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:m,n_left:c[b],n_right:c[q],n_level:c[s]}}):a(this).jqGrid("setGridParam",{postData:{nodeid:m,parentid:c[n],n_level:c[s]}});a(this).trigger("reloadGrid");c[p]=true;this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(c){return this.each(function(){if(this.grid&&this.p.treeGrid){if(c.expanded){c.expanded=false;var b=a.jgrid.getAccessor(c,this.p.localReader.id);b=a("#"+b,this.grid.bDiv)[0];a("div.treeclick",b).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}}})},SortTree:function(f,h,d,j){return this.each(function(){if(this.grid&&this.p.treeGrid){var n,b,m,l=[],c=this,e;n=a(this).jqGrid("getRootNodes");n=a.jgrid.from(n);n.orderBy(f,h,d,j);e=n.select();n=0;for(b=e.length;n<b;n++){m=e[n];l.push(m);a(this).jqGrid("collectChildrenSortTree",l,m,f,h,d,j)}a.each(l,function(p){var k=a.jgrid.getAccessor(this,c.p.localReader.id);a("#"+c.p.id+" tbody tr:eq("+p+")").after(a("tr#"+k,c.grid.bDiv))});l=e=n=null}})},collectChildrenSortTree:function(j,k,f,l,m,d){return this.each(function(){if(this.grid&&this.p.treeGrid){var b,h,c,e;b=a(this).jqGrid("getNodeChildren",k);b=a.jgrid.from(b);b.orderBy(f,l,m,d);e=b.select();b=0;for(h=e.length;b<h;b++){c=e[b];j.push(c);a(this).jqGrid("collectChildrenSortTree",j,c,f,l,m,d)}}})},setTreeRow:function(e,f){var d=false;this.each(function(){if(this.grid&&this.p.treeGrid){d=a(this).jqGrid("setRowData",e,f)}});return d},delTreeNode:function(c){return this.each(function(){var m=this.p.localReader.id,l=this.p.treeReader.left_field,n=this.p.treeReader.right_field,p,b,o;if(this.grid&&this.p.treeGrid){var j=this.p._index[c];if(j!==undefined){p=parseInt(this.p.data[j][n],10);b=p-parseInt(this.p.data[j][l],10)+1;j=a(this).jqGrid("getFullTreeNode",this.p.data[j]);if(j.length>0){for(var d=0;d<j.length;d++){a(this).jqGrid("delRowData",j[d][m])}}if(this.p.treeGridModel==="nested"){m=a.jgrid.from(this.p.data).greater(l,p,{stype:"integer"}).select();if(m.length){for(o in m){m[o][l]=parseInt(m[o][l],10)-b}}m=a.jgrid.from(this.p.data).greater(n,p,{stype:"integer"}).select();if(m.length){for(o in m){m[o][n]=parseInt(m[o][n],10)-b}}}}}})},addChildNode:function(J,K,I){var L=this[0];if(I){var N=L.p.treeReader.expanded_field,A=L.p.treeReader.leaf_field,M=L.p.treeReader.level_field,D=L.p.treeReader.parent_id_field,B=L.p.treeReader.left_field,C=L.p.treeReader.right_field,H=L.p.treeReader.loaded,G,E,F,w,d;G=0;var x=K,y;if(!J){d=L.p.data.length-1;if(d>=0){for(;d>=0;){G=Math.max(G,parseInt(L.p.data[d][L.p.localReader.id],10));d--}}J=G+1}var z=a(L).jqGrid("getInd",K);y=false;if(K===undefined||K===null||K===""){x=K=null;G="last";w=L.p.tree_root_level;d=L.p.data.length+1}else{G="after";E=L.p._index[K];F=L.p.data[E];K=F[L.p.localReader.id];w=parseInt(F[M],10)+1;d=a(L).jqGrid("getFullTreeNode",F);if(d.length){x=d=d[d.length-1][L.p.localReader.id];d=a(L).jqGrid("getInd",x)+1}else{d=a(L).jqGrid("getInd",K)+1}if(F[A]){y=true;F[N]=true;a(L.rows[z]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(L.p.treeIcons.leaf+" tree-leaf").addClass(L.p.treeIcons.minus+" tree-minus");L.p.data[E][A]=false;F[H]=true}}E=d+1;I[N]=false;I[H]=true;I[M]=w;I[A]=true;if(L.p.treeGridModel==="adjacency"){I[D]=K}if(L.p.treeGridModel==="nested"){var v;if(K!==null){A=parseInt(F[C],10);M=a.jgrid.from(L.p.data);M=M.greaterOrEquals(C,A,{stype:"integer"});M=M.select();if(M.length){for(v in M){M[v][B]=M[v][B]>A?parseInt(M[v][B],10)+2:M[v][B];M[v][C]=M[v][C]>=A?parseInt(M[v][C],10)+2:M[v][C]}}I[B]=A;I[C]=A+1}else{A=parseInt(a(L).jqGrid("getCol",C,false,"max"),10);M=a.jgrid.from(L.p.data).greater(B,A,{stype:"integer"}).select();if(M.length){for(v in M){M[v][B]=parseInt(M[v][B],10)+2}}M=a.jgrid.from(L.p.data).greater(C,A,{stype:"integer"}).select();if(M.length){for(v in M){M[v][C]=parseInt(M[v][C],10)+2}}I[B]=A+1;I[C]=A+2}}if(K===null||a(L).jqGrid("isNodeLoaded",F)||y){a(L).jqGrid("addRowData",J,I,G,x);a(L).jqGrid("setTreeNode",d,E)}F&&!F[N]&&a(L.rows[z]).find("div.treeclick").click()}}})})(jQuery);(function(a){a.jgrid.extend({jqGridImport:function(b){b=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},b||{});return this.each(function(){var l=this,h=function(m,n){var k=a(n.xmlGrid.config,m)[0],c=a(n.xmlGrid.data,m)[0],d;if(xmlJsonClass.xml2json&&a.jgrid.parse){k=xmlJsonClass.xml2json(k," ");k=a.jgrid.parse(k);for(var j in k){if(k.hasOwnProperty(j)){d=k[j]}}if(c){c=k.grid.datatype;k.grid.datatype="xmlstring";k.grid.datastr=m;a(l).jqGrid(d).jqGrid("setGridParam",{datatype:c})}else{a(l).jqGrid(d)}}else{alert("xml2json or parse are not present")}},e=function(c,d){if(c&&typeof c=="string"){var m=a.jgrid.parse(c),k=m[d.jsonGrid.config];if(m=m[d.jsonGrid.data]){var j=k.datatype;k.datatype="jsonstring";k.datastr=m;a(l).jqGrid(k).jqGrid("setGridParam",{datatype:j})}else{a(l).jqGrid(k)}}};switch(b.imptype){case"xml":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"xml",complete:function(d,c){if(c=="success"){h(d.responseXML,b);a.isFunction(b.importComplete)&&b.importComplete(d)}}},b.ajaxOptions));break;case"xmlstring":if(b.impstring&&typeof b.impstring=="string"){var f=a.jgrid.stringToDoc(b.impstring);if(f){h(f,b);a.isFunction(b.importComplete)&&b.importComplete(f);b.impstring=null}f=null}break;case"json":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"json",complete:function(d,c){if(c=="success"){e(d.responseText,b);a.isFunction(b.importComplete)&&b.importComplete(d)}}},b.ajaxOptions));break;case"jsonstring":if(b.impstring&&typeof b.impstring=="string"){e(b.impstring,b);a.isFunction(b.importComplete)&&b.importComplete(b.impstring);b.impstring=null}}})},jqGridExport:function(b){b=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},b||{});var c=null;this.each(function(){if(this.grid){var e=a.extend({},a(this).jqGrid("getGridParam"));if(e.rownumbers){e.colNames.splice(0,1);e.colModel.splice(0,1)}if(e.multiselect){e.colNames.splice(0,1);e.colModel.splice(0,1)}if(e.subGrid){e.colNames.splice(0,1);e.colModel.splice(0,1)}e.knv=null;if(e.treeGrid){for(var d in e.treeReader){if(e.treeReader.hasOwnProperty(d)){e.colNames.splice(e.colNames.length-1);e.colModel.splice(e.colModel.length-1)}}}switch(b.exptype){case"xmlstring":c="<"+b.root+">"+xmlJsonClass.json2xml(e,b.ident)+"</"+b.root+">";break;case"jsonstring":c="{"+xmlJsonClass.toJson(e,b.root,b.ident)+"}";if(e.postData.filters!==undefined){c=c.replace(/filters":"/,'filters":');c=c.replace(/}]}"/,"}]}")}}}});return c},excelExport:function(b){b=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},b||{});return this.each(function(){if(this.grid){var c;if(b.exptype=="remote"){c=a.extend({},this.p.postData);c[b.oper]=b.tag;c=jQuery.param(c);c=b.url.indexOf("?")!=-1?b.url+"&"+c:b.url+"?"+c;window.location=c}}})}})})(jQuery);var xmlJsonClass={xml2json:function(d,e){if(d.nodeType===9){d=d.documentElement}var c=this.toJson(this.toObj(this.removeWhite(d)),d.nodeName,"\t");return"{\n"+e+(e?c.replace(/\t/g,e):c.replace(/\t|\n/g,""))+"\n}"},json2xml:function(h,j){var d=function(o,n,b){var a="",f,e;if(o instanceof Array){if(o.length===0){a+=b+"<"+n+">__EMPTY_ARRAY_</"+n+">\n"}else{f=0;for(e=o.length;f<e;f+=1){var m=b+d(o[f],n,b+"\t")+"\n";a+=m}}}else{if(typeof o==="object"){f=false;a+=b+"<"+n;for(e in o){if(o.hasOwnProperty(e)){if(e.charAt(0)==="@"){a+=" "+e.substr(1)+'="'+o[e].toString()+'"'}else{f=true}}}a+=f?">":"/>";if(f){for(e in o){if(o.hasOwnProperty(e)){if(e==="#text"){a+=o[e]}else{if(e==="#cdata"){a+="<![CDATA["+o[e]+"]]>"}else{if(e.charAt(0)!=="@"){a+=d(o[e],e,b+"\t")}}}}}a+=(a.charAt(a.length-1)==="\n"?b:"")+"</"+n+">"}}else{a+=typeof o==="function"?b+"<"+n+"><![CDATA["+o+"]]></"+n+">":o.toString()==='""'||o.toString().length===0?b+"<"+n+">__EMPTY_STRING_</"+n+">":b+"<"+n+">"+o.toString()+"</"+n+">"}}return a},k="",c;for(c in h){if(h.hasOwnProperty(c)){k+=d(h[c],c,"")}}return j?k.replace(/\t/g,j):k.replace(/\t|\n/g,"")},toObj:function(h){var j={},o=/function/i;if(h.nodeType===1){if(h.attributes.length){var m;for(m=0;m<h.attributes.length;m+=1){j["@"+h.attributes[m].nodeName]=(h.attributes[m].nodeValue||"").toString()}}if(h.firstChild){var n=m=0,l=false,k;for(k=h.firstChild;k;k=k.nextSibling){if(k.nodeType===1){l=true}else{if(k.nodeType===3&&k.nodeValue.match(/[^ \f\n\r\t\v]/)){m+=1}else{if(k.nodeType===4){n+=1}}}}if(l){if(m<2&&n<2){this.removeWhite(h);for(k=h.firstChild;k;k=k.nextSibling){if(k.nodeType===3){j["#text"]=this.escape(k.nodeValue)}else{if(k.nodeType===4){if(o.test(k.nodeValue)){j[k.nodeName]=[j[k.nodeName],k.nodeValue]}else{j["#cdata"]=this.escape(k.nodeValue)}}else{if(j[k.nodeName]){if(j[k.nodeName] instanceof Array){j[k.nodeName][j[k.nodeName].length]=this.toObj(k)}else{j[k.nodeName]=[j[k.nodeName],this.toObj(k)]}}else{j[k.nodeName]=this.toObj(k)}}}}}else{if(h.attributes.length){j["#text"]=this.escape(this.innerXml(h))}else{j=this.escape(this.innerXml(h))}}}else{if(m){if(h.attributes.length){j["#text"]=this.escape(this.innerXml(h))}else{j=this.escape(this.innerXml(h));if(j==="__EMPTY_ARRAY_"){j="[]"}else{if(j==="__EMPTY_STRING_"){j=""}}}}else{if(n){if(n>1){j=this.escape(this.innerXml(h))}else{for(k=h.firstChild;k;k=k.nextSibling){if(o.test(h.firstChild.nodeValue)){j=h.firstChild.nodeValue;break}else{j["#cdata"]=this.escape(k.nodeValue)}}}}}}}if(!h.attributes.length&&!h.firstChild){j=null}}else{if(h.nodeType===9){j=this.toObj(h.documentElement)}else{alert("unhandled node type: "+h.nodeType)}}return j},toJson:function(n,o,u,s){if(s===undefined){s=true}var t=o?'"'+o+'"':"",q="\t",p="\n";if(!s){p=q=""}if(n==="[]"){t+=o?":[]":"[]"}else{if(n instanceof Array){var l,j,m=[];j=0;for(l=n.length;j<l;j+=1){m[j]=this.toJson(n[j],"",u+q,s)}t+=(o?":[":"[")+(m.length>1?p+u+q+m.join(","+p+u+q)+p+u:m.join(""))+"]"}else{if(n===null){t+=(o&&":")+"null"}else{if(typeof n==="object"){l=[];for(j in n){if(n.hasOwnProperty(j)){l[l.length]=this.toJson(n[j],j,u+q,s)}}t+=(o?":{":"{")+(l.length>1?p+u+q+l.join(","+p+u+q)+p+u:l.join(""))+"}"}else{t+=typeof n==="string"?(o&&":")+'"'+n.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(o&&":")+'"'+n.toString()+'"'}}}}return t},innerXml:function(d){var e="";if("innerHTML" in d){e=d.innerHTML}else{var c=function(h){var a="",b;if(h.nodeType===1){a+="<"+h.nodeName;for(b=0;b<h.attributes.length;b+=1){a+=" "+h.attributes[b].nodeName+'="'+(h.attributes[b].nodeValue||"").toString()+'"'}if(h.firstChild){a+=">";for(b=h.firstChild;b;b=b.nextSibling){a+=c(b)}a+="</"+h.nodeName+">"}else{a+="/>"}}else{if(h.nodeType===3){a+=h.nodeValue}else{if(h.nodeType===4){a+="<![CDATA["+h.nodeValue+"]]>"}}}return a};for(d=d.firstChild;d;d=d.nextSibling){e+=c(d)}}return e},escape:function(b){return b.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(d){d.normalize();var e;for(e=d.firstChild;e;){if(e.nodeType===3){if(e.nodeValue.match(/[^ \f\n\r\t\v]/)){e=e.nextSibling}else{var c=e.nextSibling;d.removeChild(e);e=c}}else{e.nodeType===1&&this.removeWhite(e);e=e.nextSibling}}return d}};function tableToGrid(a,b){jQuery(a).each(function(){if(!this.grid){jQuery(this).width("99%");var m=jQuery(this).width(),p=jQuery("input[type=checkbox]:first",jQuery(this)),n=jQuery("input[type=radio]:first",jQuery(this));p=p.length>0;n=!p&&n.length>0;var k=p||n,o=[],s=[];jQuery("th",jQuery(this)).each(function(){if(o.length===0&&k){o.push({name:"__selection__",index:"__selection__",width:0,hidden:true});s.push("__selection__")}else{o.push({name:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150});s.push(jQuery(this).html())}});var q=[],e=[],j=[];jQuery("tbody > tr",jQuery(this)).each(function(){var d={},c=0;jQuery("td",jQuery(this)).each(function(){if(c===0&&k){var f=jQuery("input",jQuery(this)),h=f.attr("value");e.push(h||q.length);f.attr("checked")&&j.push(h);d[o[c].name]=f.attr("value")}else{d[o[c].name]=jQuery(this).html()}c++});c>0&&q.push(d)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:m,colNames:s,colModel:o,multiselect:p},b||{}));for(m=0;m<q.length;m++){n=null;if(e.length>0){if((n=e[m])&&n.replace){n=encodeURIComponent(n).replace(/[.\-%]/g,"_")}}if(n===null){n=m+1}jQuery(this).jqGrid("addRowData",n,q[m])}for(m=0;m<j.length;m++){jQuery(this).jqGrid("setSelection",j[m])}}})}(function(a){if(a.browser.msie&&a.browser.version==8){a.expr[":"].hidden=function(b){return b.offsetWidth===0||b.offsetHeight===0||b.style.display=="none"}}a.jgrid._multiselect=false;if(a.ui){if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var q=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,g){var c=q.call(this,b,g);if(g&&this.selectedList){var f=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(f)})}return c}}if(a.ui.multiselect.prototype.destroy){a.ui.multiselect.prototype.destroy=function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)}}a.jgrid._multiselect=true}}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function g(){c.p.disableClick=true}var c=this,f={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(h){return a(document.createElement(h[0].nodeName)).addClass(h[0].className+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(h,j){j.height(h.currentItem.innerHeight()-parseInt(h.currentItem.css("paddingTop")||0,10)-parseInt(h.currentItem.css("paddingBottom")||0,10));j.width(h.currentItem.innerWidth()-parseInt(h.currentItem.css("paddingLeft")||0,10)-parseInt(h.currentItem.css("paddingRight")||0,10))}},update:function(h,j){var i=a(j.item).parent();i=a(">th",i);var m={};a.each(c.p.colModel,function(d){m[this.name]=d});var k=[];i.each(function(){var d=a(">div",this).get(0).id.replace(/^jqgh_/,"");d in m&&k.push(m[d])});a(c).jqGrid("remapColumns",k,true,true);a.isFunction(c.p.sortable.update)&&c.p.sortable.update(k);setTimeout(function(){c.p.disableClick=false},50)}};if(c.p.sortable.options){a.extend(f,c.p.sortable.options)}else{if(a.isFunction(c.p.sortable)){c.p.sortable={update:c.p.sortable}}}if(f.start){var e=f.start;f.start=function(h,j){g();e.call(this,h,j)}}else{f.start=g}if(c.p.sortable.exclude){f.items+=":not("+c.p.sortable.exclude+")"}b.sortable(f).data("sortable").floating=true})},columnChooser:function(b){function g(d,l){if(d){if(typeof d=="string"){a.fn[d]&&a.fn[d].apply(l,a.makeArray(arguments).slice(2))}else{a.isFunction(d)&&d.apply(l,a.makeArray(arguments).slice(2))}}}var c=this;if(!a("#colchooser_"+c[0].p.id).length){var f=a('<div id="colchooser_'+c[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),e=a("select",f);b=a.extend({width:420,height:240,classname:null,done:function(d){d&&c.jqGrid("remapColumns",d,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(d){var l={};l[d.bSubmit]=function(){d.apply_perm();d.cleanup(false)};l[d.bCancel]=function(){d.cleanup(true)};return{buttons:l,close:function(){d.cleanup(true)},modal:d.modal?d.modal:false,resizable:d.resizable?d.resizable:true,width:d.width+20}},apply_perm:function(){a("option",e).each(function(){this.selected?c.jqGrid("showCol",h[this.value].name):c.jqGrid("hideCol",h[this.value].name)});var d=[];a("option[selected]",e).each(function(){d.push(parseInt(this.value,10))});a.each(d,function(){delete i[h[parseInt(this,10)].name]});a.each(i,function(){var l=parseInt(this,10);var p=d,o=l;if(o>=0){var n=p.slice(),r=n.splice(o,Math.max(p.length-o,o));if(o>p.length){o=p.length}n[o]=l;d=n.concat(r)}else{d=void 0}});b.done&&b.done.call(c,d)},cleanup:function(d){g(b.dlog,f,"destroy");g(b.msel,e,"destroy");f.remove();d&&b.done&&b.done.call(c)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui){if(a.ui.multiselect){if(b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}}}b.caption&&f.attr("title",b.caption);if(b.classname){f.addClass(b.classname);e.addClass(b.classname)}if(b.width){a(">div",f).css({width:b.width,margin:"0 auto"});e.css("width",b.width)}if(b.height){a(">div",f).css("height",b.height);e.css("height",b.height-10)}var h=c.jqGrid("getGridParam","colModel"),j=c.jqGrid("getGridParam","colNames"),i={},m=[];e.empty();a.each(h,function(d){i[this.name]=d;if(this.hidedlg){this.hidden||m.push(d)}else{e.append("<option value='"+d+"' "+(this.hidden?"":"selected='selected'")+">"+j[d]+"</option>")}});var k=a.isFunction(b.dlog_opts)?b.dlog_opts.call(c,b):b.dlog_opts;g(b.dlog,f,k);k=a.isFunction(b.msel_opts)?b.msel_opts.call(c,b):b.msel_opts;g(b.msel,e,k)}},sortableRows:function(b){return this.each(function(){var g=this;if(g.grid){if(!g.p.treeGrid){if(a.fn.sortable){b=a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{});if(b.start&&a.isFunction(b.start)){b._start_=b.start;delete b.start}else{b._start_=false}if(b.update&&a.isFunction(b.update)){b._update_=b.update;delete b.update}else{b._update_=false}b.start=function(c,f){a(f.item).css("border-width","0px");a("td",f.item).each(function(j){this.style.width=g.grid.cols[j].style.width});if(g.p.subGrid){var e=a(f.item).attr("id");try{a(g).jqGrid("collapseSubGridRow",e)}catch(h){}}b._start_&&b._start_.apply(this,[c,f])};b.update=function(c,f){a(f.item).css("border-width","");g.p.rownumbers===true&&a("td.jqgrid-rownum",g.rows).each(function(e){a(this).html(e+1)});b._update_&&b._update_.apply(this,[c,f])};a("tbody:first",g).sortable(b);a("tbody:first",g).disableSelection()}}}})},gridDnD:function(b){return this.each(function(){function g(){var e=a.data(c,"dnd");a("tr.jqgrow:not(.ui-draggable)",c).draggable(a.isFunction(e.drag)?e.drag.call(a(c),e):e.drag)}var c=this;if(c.grid){if(!c.p.treeGrid){if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof b=="string"&&b=="updateDnD"&&c.p.jqgdnd===true){g()}else{b=a.extend({drag:function(e){return a.extend({start:function(h,j){if(c.p.subGrid){var i=a(j.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",i)}catch(m){}}for(i=0;i<a.data(c,"dnd").connectWith.length;i++){a(a.data(c,"dnd").connectWith[i]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(c,"dnd").connectWith[i]).jqGrid("addRowData","jqg_empty_row",{})}j.helper.addClass("ui-state-highlight");a("td",j.helper).each(function(k){this.style.width=c.grid.headers[k].width+"px"});e.onstart&&a.isFunction(e.onstart)&&e.onstart.call(a(c),h,j)},stop:function(h,j){if(j.helper.dropped){var i=a(j.helper).attr("id");a(c).jqGrid("delRowData",i)}for(i=0;i<a.data(c,"dnd").connectWith.length;i++){a(a.data(c,"dnd").connectWith[i]).jqGrid("delRowData","jqg_empty_row")}e.onstop&&a.isFunction(e.onstop)&&e.onstop.call(a(c),h,j)}},e.drag_opts||{})},drop:function(e){return a.extend({accept:function(h){if(!a(h).hasClass("jqgrow")){return h}var j=a(h).closest("table.ui-jqgrid-btable");if(j.length>0&&a.data(j[0],"dnd")!==undefined){h=a.data(j[0],"dnd").connectWith;return a.inArray("#"+this.id,h)!=-1?true:false}return h},drop:function(h,j){if(a(j.draggable).hasClass("jqgrow")){var i=a(j.draggable).attr("id");i=j.draggable.parent().parent().jqGrid("getRowData",i);if(!e.dropbyname){var m=0,k={},d,l=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var p in i){if(i.hasOwnProperty(p)&&l[m]){d=l[m].name;k[d]=i[p]}m++}i=k}catch(o){}}j.helper.dropped=true;if(e.beforedrop&&a.isFunction(e.beforedrop)){d=e.beforedrop.call(this,h,j,i,a("#"+c.id),a(this));if(typeof d!="undefined"&&d!==null&&typeof d=="object"){i=d}}if(j.helper.dropped){var n;if(e.autoid){if(a.isFunction(e.autoid)){n=e.autoid.call(this,i)}else{n=Math.ceil(Math.random()*1000);n=e.autoidprefix+n}}a("#"+this.id).jqGrid("addRowData",n,i,e.droppos)}e.ondrop&&a.isFunction(e.ondrop)&&e.ondrop.call(this,h,j,i)}}},e.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5000},dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},b||{});if(b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(e){return a.trim(e)});a.data(c,"dnd",b);c.p.reccount!="0"&&!c.p.jqgdnd&&g();c.p.jqgdnd=true;for(var f=0;f<b.connectWith.length;f++){a(b.connectWith[f]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}}}}})},gridResize:function(b){return this.each(function(){var g=this;if(g.grid&&a.fn.resizable){b=a.extend({},b||{});if(b.alsoResize){b._alsoResize_=b.alsoResize;delete b.alsoResize}else{b._alsoResize_=false}if(b.stop&&a.isFunction(b.stop)){b._stop_=b.stop;delete b.stop}else{b._stop_=false}b.stop=function(c,f){a(g).jqGrid("setGridParam",{height:a("#gview_"+g.p.id+" .ui-jqgrid-bdiv").height()});a(g).jqGrid("setGridWidth",f.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(g,c,f)};b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+g.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+g.p.id);delete b._alsoResize_;a("#gbox_"+g.p.id).resizable(b)}})}})})(jQuery);
/*
 * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
 * http://benalman.com/projects/jquery-bbq-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function(s,A){var n,E=Array.prototype.slice,H=decodeURIComponent,b=s.param,u,v,w,h=s.bbq=s.bbq||{},a,c,F,k=s.event.special,y="hashchange",D="querystring",C="fragment",q="elemUrlAttr",f="location",j="href",x="src",l=/^.*\?|#.*$/g,I=/^.*\#/,e,d={};function z(J){return typeof J==="string"}function m(J){var K=E.call(arguments,1);return function(){return J.apply(this,K.concat(E.call(arguments)))}}function o(J){return J.replace(/^[^#]*#?(.*)$/,"$1")}function t(J){return J.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function G(S,N,M,L,P){var Q,J,R,O,K;if(L!==n){R=M.match(S?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);K=R[3]||"";if(P===2&&z(L)){J=L.replace(S?I:l,"")}else{O=v(R[2]);L=z(L)?v[S?C:D](L):L;J=P===2?L:P===1?s.extend({},L,O):s.extend({},O,L);J=b(J);if(S){J=J.replace(e,H)}}Q=R[1]+(S?"#":J||!R[1]?"?":"")+J+K}else{Q=N(M!==n?M:A[f][j])}return Q}b[D]=m(G,0,t);b[C]=u=m(G,1,o);u.noEscape=function(K){K=K||"";var J=s.map(K.split(""),encodeURIComponent);e=new RegExp(J.join("|"),"g")};u.noEscape(",/");s.deparam=v=function(K,M){var L={},J={"true":!0,"false":!1,"null":null};s.each(K.replace(/\+/g," ").split("&"),function(O,V){var Q=V.split("="),T=H(Q[0]),P,R=L,N=0,U=T.split("]["),S=U.length-1;if(/\[/.test(U[0])&&/\]$/.test(U[S])){U[S]=U[S].replace(/\]$/,"");U=U.shift().split("[").concat(U);S=U.length-1}else{S=0}if(Q.length===2){P=H(Q[1]);if(M){P=P&&!isNaN(P)?+P:P==="undefined"?n:J[P]!==n?J[P]:P}if(S){for(;N<=S;N++){T=U[N]===""?R.length:U[N];R=R[T]=N<S?R[T]||(U[N+1]&&isNaN(U[N+1])?{}:[]):P}}else{if(s.isArray(L[T])){L[T].push(P)}else{if(L[T]!==n){L[T]=[L[T],P]}else{L[T]=P}}}}else{if(T){L[T]=M?n:""}}});return L};function p(L,J,K){if(J===n||typeof J==="boolean"){K=J;J=b[L?C:D]()}else{J=z(J)?J.replace(L?I:l,""):J}return v(J,K)}v[D]=m(p,0);v[C]=w=m(p,1);s[q]||(s[q]=function(J){return s.extend(d,J)})({a:j,base:j,iframe:x,img:x,input:x,form:"action",link:j,script:x});F=s[q];function B(K,J,M,L){if(!z(M)&&typeof M!=="object"){L=M;M=J;J=n}return this.each(function(){var O=s(this),P=J||F()[(this.nodeName||"").toLowerCase()]||"",N=P&&O.attr(P)||"";O.attr(P,b[K](N,M,L))})}s.fn[D]=m(B,D);s.fn[C]=m(B,C);h.pushState=a=function(L,M){if(z(L)&&/^#/.test(L)&&M===n){M=2}var K=L!==n,J=u(A[f][j],K?L:{},K?M:2);A[f][j]=J+(/#/.test(J)?"":"#")};h.getState=c=function(J,K){return J===n||typeof J==="boolean"?w(J):w(K)[J]};h.removeState=function(J){var K={};if(J!==n){K=c();s.each(s.isArray(J)?J:arguments,function(L,M){delete K[M]})}a(K,2)};k[y]=s.extend(k[y],{add:function(J){var L;function K(N){var M=N[C]=u();N.getState=function(O,P){return O===n||typeof O==="boolean"?v(M,O):v(M,P)[O]};L.apply(this,arguments)}if(s.isFunction(J)){L=J;return K}else{L=J.handler;J.handler=K}}})})(jQuery,this);
/*
 * jQuery hashchange event - v1.2 - 2/11/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function(f,j,d){var o,h=f.event.special,n="location",b="hashchange",c="href",e=f.browser,a=document.documentMode,k=e.msie&&(a===d||a<8),m="on"+b in j&&!k;function l(p){p=p||j[n][c];return p.replace(/^[^#]*#?(.*)$/,"$1")}f[b+"Delay"]=100;h[b]=f.extend(h[b],{setup:function(){if(m){return false}f(o.start)},teardown:function(){if(m){return false}f(o.stop)}});o=(function(){var p={},s,t,v,u;function q(){v=u=function(w){return w};if(k){t=f('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;u=function(){return l(t.document[n][c])};v=function(y,x){if(y!==x){var w=t.document;w.open().close();w[n].hash="#"+y}};v(l())}}p.start=function(){if(s){return}var x=l();v||q();(function w(){var y=l(),z=u(x);if(y!==x){v(x=y,z);f(j).trigger(b)}else{if(z!==x){j[n][c]=j[n][c].replace(/#.*/,"")+"#"+z}}s=setTimeout(w,f[b+"Delay"])})()};p.stop=function(){if(!t){s&&clearTimeout(s);s=0}};return p})()})(jQuery,this);function Replace(b,a,c){while(b.indexOf(a)>-1){b=b.replace(a,c)}return b}function GetQuerystringValue(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]").toUpperCase();var c="[\\?&]"+e+"=([^&#]*)";var a=new RegExp(c);var b=a.exec(window.location.href.toUpperCase());if(b==null){return""}else{var d=b[1];while(d.indexOf("%20")>-1){d=d.replace("%20"," ")}return d}}function FormatCurrency(a){if(a!=null){a=a.toString().replace(/\$|\,/g,"");if(isNaN(a)){a="0"}sign=(a==(a=Math.abs(a)));a=Math.floor(a*100+0.50000000001);cents=a%100;a=Math.floor(a/100).toString();if(cents<10){cents="0"+cents}for(var b=0;b<Math.floor((a.length-(1+b))/3);b++){a=a.substring(0,a.length-(4*b+3))+","+a.substring(a.length-(4*b+3))}return(((sign)?"":"-")+"$"+a+"."+cents)}else{return""}}function endsWith(a,b){return a.indexOf(b,a.length-b.length)!==-1}function ajaxError(c,b,a){if(console){console.debug("Ajax Error!!");console.debug(c);console.debug(b);console.debug(a)}}(function(a){a.fn.randomize=function(b){return this.each(function(){var e=a(this);var d=e.children(b);d.sort(function(){return(Math.round(Math.random())-0.5)});e.remove(b);for(var c=0;c<d.length;c++){e.append(d[c])}})}})(jQuery);$(document).ready(function(){jQuery("#divRegister").stickyPopUp();jQuery("#divLogin").stickyPopUp();$("textarea[maxlength]").keyup(function(){var c=parseInt($(this).attr("maxlength"));var d=$(this).val();var a=d.length;if(a>c){var b=d.substr(0,c);$(this).val(b)}})});$.validator.addMethod("ValidateRegExp",function(a,d,b){console.debug("ValidateRegExp");var c=new RegExp(b);var e=c.test(a);return e});$.validator.addMethod("regExp",function(a,d,b){console.debug("regExp");var c=new RegExp(b);var e=c.test(a);return e});$(document).ready(function(){$(".toolTip").hover(function(){var a="0 = 12AM  |  1 = 1AM <br> --- <br> 22 = 10PM  |  23 = 11PM";$(this).append('<div class="toolTipWrapper" id ="D1"><div class="toolTipTop" id ="D2"></div><div class="toolTipMid" id ="D3">'+a+'</div><div class="toolTipBtm" id ="D4"></div></div>');this.width=$(this).width();$(this).find(".toolTipWrapper").css({left:this.width-50});$(".toolTipWrapper").fadeIn(300)},function(){$(".toolTipWrapper").fadeOut(100);$(".toolTipWrapper").remove()})});
