function changeEntite(a){$("#lstTarifs").html("");$("#tarifs_list").jqGrid("clearGridData",!1);url="/pages/get_exercices";lstExos=[];res="<option id=''>S\u00e9lectionner un exercice</option>";$.ajax({url:url,dataType:"html",data:"entite_id="+a,success:function(a){$.each(JSON.parse(a),function(a,c){jj=c.exeDateDebut.substr(8,2);mm=c.exeDateDebut.substr(5,2);aaaa=c.exeDateDebut.substr(0,4);dteDeb=jj+"/"+mm+"/"+aaaa;jj=c.exeDateFin.substr(8,2);mm=c.exeDateFin.substr(5,2);aaaa=c.exeDateFin.substr(0,4);
dteFin=jj+"/"+mm+"/"+aaaa;res+="<option value = "+c.exeNoEnreg+">Exercice du "+dteDeb+" au "+dteFin+"</option>"});$("#exercices").html(res)}})}function changeExercice(){res="Tarifs pour l'entite "+entite_dosNoEnreg.value+" - Exercice : "+exercices.value;url="/entites/"+entite_dosNoEnreg.value+"/exercices/"+exercices.value+"/tarifs";$("#tarifs_list").jqGrid("clearGridData",!1);jQuery("#tarifs_list").jqGrid().setGridParam({url:url}).trigger("reloadGrid")}
function getTarifsAdhesion(){res="Tarifs pour l'entite "+entite_dosNoEnreg.value+" - Exercice : "+exercices.value;url="/entites/"+entite_dosNoEnreg.value+"/exercices/"+exercices.value+"/valeursadhassurfiscales";$("#tarifs_list").jqGrid("clearGridData",!1);jQuery("#tarifs_list").jqGrid().setGridParam({url:url}).trigger("reloadGrid")}
function getCollabos(a){res="Collaborateurs pour l'\ufffdquipe "+equipe_equNoEnreg.value;url="/equipes/"+a+"/collaborateurs";$("#collaborateurs_list").jqGrid("clearGridData",!1);jQuery("#collaborateurs_list").jqGrid().setGridParam({url:url}).trigger("reloadGrid")}function addRow(a){a=new String(a);var d=new String("/post_data");a+=d;jQuery("#list").editGridRow("new",{url:encodeURI(a),width:700,closeAfterAdd:!0})}function processAddEdit(a,d){alert("test");return[!0,"",""]}
function editRow(a){a=new String(a);var d=new String("/post_data");a+=d;d=jQuery("#list").jqGrid("getGridParam","selrow");null==d?alert("Veuillez s\ufffdlectionner une ligne."):jQuery("#list").editGridRow(d,{url:encodeURI(a),closeAfterEdit:!0,width:700})}
function deleteRow(a){a=new String(a);var d=new String("/post_data");a+=d;d=jQuery("#list").jqGrid("getGridParam","selrow");null==d?alert("Veuillez s\ufffdlectionner une ligne."):jQuery("#list").delGridRow(d,{url:encodeURI(a),closeAfterEdit:!0,msg:"Suppression ?",width:300})}function search(){jQuery("#list").searchGrid({Reset:"Reinitialiser",closeAfterSearch:!0})}function refresh(){$("#list").trigger("reloadGrid")}
function addButtonsManager(){$(".groupe_boutons button:first").button({icons:{primary:"ui-icon ui-icon-plus"}}).next().button({icons:{primary:"ui-icon ui-icon-pencil"}}).next().button({icons:{primary:"ui-icon ui-icon-trash"}}).next().button({icons:{primary:"ui-icon ui-icon-refresh"}})}function addButtonsNotManager(){$(".groupe_boutons button:first").button({icons:{primary:"ui-icon ui-icon-refresh"}})}function makeTabs(a){$(a).tabs()}
function addNiceButton(a){$("input:submit, a, button",a).button()}function linkToButton(a,d){$(a).button({icons:{primary:d}})}function submitToButton(a,d){$(a+" input:submit").each(function(){$(this).replaceWith('<button type="'+$(this).attr("type")+'">'+$(this).val()+"</button>")});$(a+" button:submit").button({icons:{primary:d}})}
function checkboxToButton(a,d){$(a+" input:checkbox").each(function(){$(this).replaceWith('<button type="'+$(this).attr("type")+'">'+$(this).val()+"</button>")});$(a).button({icons:{primary:d}})}function makeButton(a,d){$(a+" button").button({icons:{primary:d}})}function goBack(){window.history.back()}
function addDatepicker(a){$(a).datepicker({dateFormat:"dd/mm/yy"});$(a).mousedown(function(){this.datepicker("hide")});$(a).keydown(function(d){if(46==d.keyCode||8==d.keyCode)$(a).val(""),$(a).datepicker("hide"),$(a).blur();d.preventDefault()})}function disableButton(a){$("input:submit, a, button",a).button("disable")}function makeDialog(a){$(a).dialog({modal:!0,resizable:!0,position:"center",buttons:{OK:function(){$(this).dialog("close")}}})}
function setAccordion(a){$(a).accordion({active:!1,collapsible:!0,autoHeight:!1,navigation:!0});$(a).accordion("option","fillSpace",!0)}function setButton(){$("input:submit, a, button",".boutons_left").button()}
(function(a,d){function b(a){var b=V[a]={},c,e;a=a.split(/\s+/);c=0;for(e=a.length;c<e;c++)b[a[c]]=!0;return b}function c(a,b,c){if(c===d&&1===a.nodeType)if(c="data-"+b.replace(ia,"-$1").toLowerCase(),c=a.getAttribute(c),"string"===typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:m.isNumeric(c)?parseFloat(c):ca.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=d;return c}function f(a){for(var b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function k(a,
b,c){var e=b+"defer",f=b+"queue",g=b+"mark",d=m._data(a,e);!d||"queue"!==c&&m._data(a,f)||"mark"!==c&&m._data(a,g)||setTimeout(function(){m._data(a,f)||m._data(a,g)||(m.removeData(a,e,!0),d.fire())},0)}function h(){return!1}function g(){return!0}function e(a,b,c){b=b||0;if(m.isFunction(b))return m.grep(a,function(a,e){return!!b.call(a,e,a)===c});if(b.nodeType)return m.grep(a,function(a,e){return a===b===c});if("string"===typeof b){var e=m.grep(a,function(a){return 1===a.nodeType});if(ka.test(b))return m.filter(b,
e,!c);b=m.filter(b,e)}return m.grep(a,function(a,e){return 0<=m.inArray(a,b)===c})}function l(a){var b=oa.split("|");a=a.createDocumentFragment();if(a.createElement)for(;b.length;)a.createElement(b.pop());return a}function n(a,b){if(1===b.nodeType&&m.hasData(a)){var c,e,f;e=m._data(a);var g=m._data(b,e),d=e.events;if(d)for(c in delete g.handle,g.events={},d)for(e=0,f=d[c].length;e<f;e++)m.event.add(b,c+(d[c][e].namespace?".":"")+d[c][e].namespace,d[c][e],d[c][e].data);g.data&&(g.data=m.extend({},
g.data))}}function p(a,b){var c;if(1===b.nodeType){b.clearAttributes&&b.clearAttributes();b.mergeAttributes&&b.mergeAttributes(a);c=b.nodeName.toLowerCase();if("object"===c)b.outerHTML=a.outerHTML;else if("input"===c&&("checkbox"===a.type||"radio"===a.type))a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);else if("option"===c)b.selected=a.defaultSelected;else if("input"===c||"textarea"===c)b.defaultValue=a.defaultValue;b.removeAttribute(m.expando)}}function q(a){return"undefined"!==
typeof a.getElementsByTagName?a.getElementsByTagName("*"):"undefined"!==typeof a.querySelectorAll?a.querySelectorAll("*"):[]}function s(a){if("checkbox"===a.type||"radio"===a.type)a.defaultChecked=a.checked}function r(a){var b=(a.nodeName||"").toLowerCase();"input"===b?s(a):"script"!==b&&"undefined"!==typeof a.getElementsByTagName&&m.grep(a.getElementsByTagName("input"),s)}function w(a,b){b.src?m.ajax({url:b.src,async:!1,dataType:"script"}):m.globalEval((b.text||b.textContent||b.innerHTML||"").replace(Ya,
"/*$0*/"));b.parentNode&&b.parentNode.removeChild(b)}function v(a,b,c){var e="width"===b?a.offsetWidth:a.offsetHeight,f="width"===b?Za:$a,g=0,d=f.length;if(0<e){if("border"!==c)for(;g<d;g++)c||(e-=parseFloat(m.css(a,"padding"+f[g]))||0),e="margin"===c?e+(parseFloat(m.css(a,c+f[g]))||0):e-(parseFloat(m.css(a,"border"+f[g]+"Width"))||0);return e+"px"}e=pa(a,b,b);if(0>e||null==e)e=a.style[b]||0;e=parseFloat(e)||0;if(c)for(;g<d;g++)e+=parseFloat(m.css(a,"padding"+f[g]))||0,"padding"!==c&&(e+=parseFloat(m.css(a,
"border"+f[g]+"Width"))||0),"margin"===c&&(e+=parseFloat(m.css(a,c+f[g]))||0);return e+"px"}function u(a){return function(b,c){"string"!==typeof b&&(c=b,b="*");if(m.isFunction(c))for(var e=b.toLowerCase().split(Ga),f=0,g=e.length,d,h;f<g;f++)d=e[f],(h=/^\+/.test(d))&&(d=d.substr(1)||"*"),d=a[d]=a[d]||[],d[h?"unshift":"push"](c)}}function x(a,b,c,e,f,g){f=f||b.dataTypes[0];g=g||{};g[f]=!0;f=a[f];for(var h=0,k=f?f.length:0,q=a===Ba,l;h<k&&(q||!l);h++)l=f[h](b,c,e),"string"===typeof l&&(!q||g[l]?l=d:
(b.dataTypes.unshift(l),l=x(a,b,c,e,l,g)));!q&&l||g["*"]||(l=x(a,b,c,e,"*",g));return l}function B(a,b){var c,e,f=m.ajaxSettings.flatOptions||{};for(c in b)b[c]!==d&&((f[c]?a:e||(e={}))[c]=b[c]);e&&m.extend(!0,a,e)}function A(a,b,c,e){if(m.isArray(b))m.each(b,function(b,f){c||ab.test(a)?e(a,f):A(a+"["+("object"===typeof f||m.isArray(f)?b:"")+"]",f,c,e)});else if(c||null==b||"object"!==typeof b)e(a,b);else for(var f in b)A(a+"["+f+"]",b[f],c,e)}function z(){try{return new a.XMLHttpRequest}catch(b){}}
function D(){setTimeout(E,0);return wa=m.now()}function E(){wa=d}function I(a,b){var c={};m.each(Ha.concat.apply([],Ha.slice(0,b)),function(){c[this]=a});return c}function F(a){if(!Ca[a]){var b=y.body,c=m("<"+a+">").appendTo(b),e=c.css("display");c.remove();if("none"===e||""===e)fa||(fa=y.createElement("iframe"),fa.frameBorder=fa.width=fa.height=0),b.appendChild(fa),qa&&fa.createElement||(qa=(fa.contentWindow||fa.contentDocument).document,qa.write(("CSS1Compat"===y.compatMode?"<!doctype html>":"")+
"<html><body>"),qa.close()),c=qa.createElement(a),qa.body.appendChild(c),e=m.css(c,"display"),b.removeChild(fa);Ca[a]=e}return Ca[a]}function C(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var y=a.document,T=a.navigator,Y=a.location,m=function(){function b(){if(!c.isReady){try{y.documentElement.doScroll("left")}catch(a){setTimeout(b,1);return}c.ready()}}var c=function(a,b){return new c.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,k=/\S/,
l=/^\s+/,q=/\s+$/,p=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,m=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,s=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,v=/(webkit)[ \/]([\w.]+)/,w=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,x=/(mozilla)(?:.*? rv:([\w.]+))?/,z=/-([a-z]|[0-9])/ig,B=/^-ms-/,S=function(a,c){return(c+"").toUpperCase()},L=T.userAgent,xa,ra,C=Object.prototype.toString,E=Object.prototype.hasOwnProperty,la=Array.prototype.push,
D=Array.prototype.slice,A=String.prototype.trim,I=Array.prototype.indexOf,F={};c.fn=c.prototype={constructor:c,init:function(a,b,e){var f;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if("body"===a&&!b&&y.body)return this.context=y,this[0]=y.body,this.selector=a,this.length=1,this;if("string"===typeof a){f="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&3<=a.length?[null,a,null]:h.exec(a);if(!f||!f[1]&&b)return!b||b.jquery?(b||e).find(a):this.constructor(b).find(a);
if(f[1])return e=(b=b instanceof c?b[0]:b)?b.ownerDocument||b:y,(a=p.exec(a))?c.isPlainObject(b)?(a=[y.createElement(a[1])],c.fn.attr.call(a,b,!0)):a=[e.createElement(a[1])]:(a=c.buildFragment([f[1]],[e]),a=(a.cacheable?c.clone(a.fragment):a.fragment).childNodes),c.merge(this,a);if((b=y.getElementById(f[2]))&&b.parentNode){if(b.id!==f[2])return e.find(a);this.length=1;this[0]=b}this.context=y;this.selector=a;return this}if(c.isFunction(a))return e.ready(a);a.selector!==d&&(this.selector=a.selector,
this.context=a.context);return c.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a,b,e){var f=this.constructor();c.isArray(a)?la.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;"find"===b?f.selector=this.selector+(this.selector?" ":"")+e:b&&(f.selector=this.selector+"."+b+"("+e+")");return f},each:function(a,
b){return c.each(this,a,b)},ready:function(a){c.bindReady();xa.add(a);return this},eq:function(a){a=+a;return-1===a?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:la,sort:[].sort,splice:[].splice};
c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a,b,e,f,g,h=arguments[0]||{},k=1,H=arguments.length,l=!1;"boolean"===typeof h&&(l=h,h=arguments[1]||{},k=2);"object"===typeof h||c.isFunction(h)||(h={});H===k&&(h=this,--k);for(;k<H;k++)if(null!=(a=arguments[k]))for(b in a)e=h[b],f=a[b],h!==f&&(l&&f&&(c.isPlainObject(f)||(g=c.isArray(f)))?(g?(g=!1,e=e&&c.isArray(e)?e:[]):e=e&&c.isPlainObject(e)?e:{},h[b]=c.extend(l,e,f)):f!==d&&(h[b]=f));return h};c.extend({noConflict:function(b){a.$===
c&&(a.$=f);b&&a.jQuery===c&&(a.jQuery=e);return c},isReady:!1,readyWait:1,holdReady:function(a){a?c.readyWait++:c.ready(!0)},ready:function(a){if(!0===a&&!--c.readyWait||!0!==a&&!c.isReady){if(!y.body)return setTimeout(c.ready,1);c.isReady=!0;!0!==a&&0<--c.readyWait||(xa.fireWith(y,[c]),c.fn.trigger&&c(y).trigger("ready").off("ready"))}},bindReady:function(){if(!xa){xa=c.Callbacks("once memory");if("complete"===y.readyState)return setTimeout(c.ready,1);if(y.addEventListener)y.addEventListener("DOMContentLoaded",
ra,!1),a.addEventListener("load",c.ready,!1);else if(y.attachEvent){y.attachEvent("onreadystatechange",ra);a.attachEvent("onload",c.ready);var e=!1;try{e=null==a.frameElement}catch(f){}y.documentElement.doScroll&&e&&b()}}},isFunction:function(a){return"function"===c.type(a)},isArray:Array.isArray||function(a){return"array"===c.type(a)},isWindow:function(a){return a&&"object"===typeof a&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==
a?String(a):F[C.call(a)]||"object"},isPlainObject:function(a){if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}for(var e in a);return e===d||E.call(a,e)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw Error(a);},parseJSON:function(b){if("string"!==typeof b||!b)return null;b=c.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);
if(n.test(b.replace(m,"@").replace(s,"]").replace(r,"")))return(new Function("return "+b))();c.error("Invalid JSON: "+b)},parseXML:function(b){var e,f;try{a.DOMParser?(f=new DOMParser,e=f.parseFromString(b,"text/xml")):(e=new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(b))}catch(g){e=d}e&&e.documentElement&&!e.getElementsByTagName("parsererror").length||c.error("Invalid XML: "+b);return e},noop:function(){},globalEval:function(b){b&&k.test(b)&&(a.execScript||function(b){a.eval.call(a,
b)})(b)},camelCase:function(a){return a.replace(B,"ms-").replace(z,S)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,e){var f,g=0,h=a.length,k=h===d||c.isFunction(a);if(e)if(k)for(f in a){if(!1===b.apply(a[f],e))break}else for(;g<h&&!1!==b.apply(a[g++],e););else if(k)for(f in a){if(!1===b.call(a[f],f,a[f]))break}else for(;g<h&&!1!==b.call(a[g],g,a[g++]););return a},trim:A?function(a){return null==a?"":A.call(a)}:function(a){return null==a?
"":a.toString().replace(l,"").replace(q,"")},makeArray:function(a,b){var e=b||[];if(null!=a){var f=c.type(a);null==a.length||"string"===f||"function"===f||"regexp"===f||c.isWindow(a)?la.call(e,a):c.merge(e,a)}return e},inArray:function(a,b,c){var e;if(b){if(I)return I.call(b,a,c);e=b.length;for(c=c?0>c?Math.max(0,e+c):c:0;c<e;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=a.length,e=0;if("number"===typeof b.length)for(var f=b.length;e<f;e++)a[c++]=b[e];else for(;b[e]!==d;)a[c++]=
b[e++];a.length=c;return a},grep:function(a,b,c){var e=[],f;c=!!c;for(var g=0,d=a.length;g<d;g++)f=!!b(a[g],g),c!==f&&e.push(a[g]);return e},map:function(a,b,e){var f,g,h=[],k=0,H=a.length;if(a instanceof c||H!==d&&"number"===typeof H&&(0<H&&a[0]&&a[H-1]||0===H||c.isArray(a)))for(;k<H;k++)f=b(a[k],k,e),null!=f&&(h[h.length]=f);else for(g in a)f=b(a[g],g,e),null!=f&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,b){if("string"===typeof b){var e=a[b];b=a;a=e}if(!c.isFunction(a))return d;
var f=D.call(arguments,2),e=function(){return a.apply(b,f.concat(D.call(arguments)))};e.guid=a.guid=a.guid||e.guid||c.guid++;return e},access:function(a,b,e,f,g,h){var k=a.length;if("object"===typeof b){for(var H in b)c.access(a,H,b[H],f,g,e);return a}if(e!==d){f=!h&&f&&c.isFunction(e);for(H=0;H<k;H++)g(a[H],b,f?e.call(a[H],H,g(a[H],b)):e,h);return a}return k?g(a[0],b):d},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();a=v.exec(a)||w.exec(a)||u.exec(a)||0>a.indexOf("compatible")&&
x.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}c.extend(!0,a,this);a.superclass=this;a.fn=a.prototype=this();a.fn.constructor=a;a.sub=this.sub;a.fn.init=function(e,f){f&&f instanceof c&&!(f instanceof a)&&(f=a(f));return c.fn.init.call(this,e,f,b)};a.fn.init.prototype=a.fn;var b=a(y);return a},browser:{}});c.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){F["[object "+b+"]"]=b.toLowerCase()});
L=c.uaMatch(L);L.browser&&(c.browser[L.browser]=!0,c.browser.version=L.version);c.browser.webkit&&(c.browser.safari=!0);k.test("\u00a0")&&(l=/^[\s\xA0]+/,q=/[\s\xA0]+$/);g=c(y);y.addEventListener?ra=function(){y.removeEventListener("DOMContentLoaded",ra,!1);c.ready()}:y.attachEvent&&(ra=function(){"complete"===y.readyState&&(y.detachEvent("onreadystatechange",ra),c.ready())});return c}(),V={};m.Callbacks=function(a){a=a?V[a]||b(a):{};var c=[],e=[],f,g,h,k,l,q=function(b){var e,f,g,d;e=0;for(f=b.length;e<
f;e++)g=b[e],d=m.type(g),"array"===d?q(g):"function"===d&&(a.unique&&n.has(g)||c.push(g))},p=function(b,d){d=d||[];f=!a.memory||[b,d];g=!0;l=h||0;h=0;for(k=c.length;c&&l<k;l++)if(!1===c[l].apply(b,d)&&a.stopOnFalse){f=!0;break}g=!1;c&&(a.once?!0===f?n.disable():c=[]:e&&e.length&&(f=e.shift(),n.fireWith(f[0],f[1])))},n={add:function(){if(c){var a=c.length;q(arguments);g?k=c.length:f&&!0!==f&&(h=a,p(f[0],f[1]))}return this},remove:function(){if(c)for(var b=arguments,e=0,f=b.length;e<f;e++)for(var d=
0;d<c.length&&(b[e]!==c[d]||(g&&d<=k&&(k--,d<=l&&l--),c.splice(d--,1),!a.unique));d++);return this},has:function(a){if(c)for(var b=0,e=c.length;b<e;b++)if(a===c[b])return!0;return!1},empty:function(){c=[];return this},disable:function(){c=e=f=d;return this},disabled:function(){return!c},lock:function(){e=d;f&&!0!==f||n.disable();return this},locked:function(){return!e},fireWith:function(b,c){e&&(g?a.once||e.push([b,c]):a.once&&f||p(b,c));return this},fire:function(){n.fireWith(this,arguments);return this},
fired:function(){return!!f}};return n};var W=[].slice;m.extend({Deferred:function(a){var b=m.Callbacks("once memory"),c=m.Callbacks("once memory"),e=m.Callbacks("memory"),f="pending",g={resolve:b,reject:c,notify:e},d={done:b.add,fail:c.add,progress:e.add,state:function(){return f},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){h.done(a).fail(b).progress(c);return this},always:function(){h.done.apply(h,arguments).fail.apply(h,arguments);return this},pipe:function(a,b,c){return m.Deferred(function(e){m.each({done:[a,
"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],f=b[1],g;if(m.isFunction(c))h[a](function(){if((g=c.apply(this,arguments))&&m.isFunction(g.promise))g.promise().then(e.resolve,e.reject,e.notify);else e[f+"With"](this===h?e:this,[g])});else h[a](e[f])})}).promise()},promise:function(a){if(null==a)a=d;else for(var b in d)a[b]=d[b];return a}},h=d.promise({}),k;for(k in g)h[k]=g[k].fire,h[k+"With"]=g[k].fireWith;h.done(function(){f="resolved"},c.disable,e.lock).fail(function(){f=
"rejected"},b.disable,e.lock);a&&a.call(h,h);return h},when:function(a){function b(a){return function(b){e[a]=1<arguments.length?W.call(arguments,0):b;--h||k.resolveWith(k,e)}}function c(a){return function(b){d[a]=1<arguments.length?W.call(arguments,0):b;k.notifyWith(l,d)}}var e=W.call(arguments,0),f=0,g=e.length,d=Array(g),h=g,k=1>=g&&a&&m.isFunction(a.promise)?a:m.Deferred(),l=k.promise();if(1<g){for(;f<g;f++)e[f]&&e[f].promise&&m.isFunction(e[f].promise)?e[f].promise().then(b(f),k.reject,c(f)):
--h;h||k.resolveWith(k,e)}else k!==a&&k.resolveWith(k,g?[a]:[]);return l}});m.support=function(){var b,c,e,f,g,d,h,k,l=y.createElement("div");l.setAttribute("className","t");l.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";c=l.getElementsByTagName("*");e=l.getElementsByTagName("a")[0];if(!c||!c.length||!e)return{};f=y.createElement("select");g=f.appendChild(y.createElement("option"));c=l.getElementsByTagName("input")[0];b={leadingWhitespace:3===
l.firstChild.nodeType,tbody:!l.getElementsByTagName("tbody").length,htmlSerialize:!!l.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:"/a"===e.getAttribute("href"),opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:"on"===c.value,optSelected:g.selected,getSetAttribute:"t"!==l.className,enctype:!!y.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,submitBubbles:!0,changeBubbles:!0,
focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0};c.checked=!0;b.noCloneChecked=c.cloneNode(!0).checked;f.disabled=!0;b.optDisabled=!g.disabled;try{delete l.test}catch(q){b.deleteExpando=!1}!l.addEventListener&&l.attachEvent&&l.fireEvent&&(l.attachEvent("onclick",function(){b.noCloneEvent=!1}),l.cloneNode(!0).fireEvent("onclick"));c=y.createElement("input");c.value="t";c.setAttribute("type","radio");b.radioValue="t"===c.value;
c.setAttribute("checked","checked");l.appendChild(c);e=y.createDocumentFragment();e.appendChild(l.lastChild);b.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked;b.appendChecked=c.checked;e.removeChild(c);e.appendChild(l);l.innerHTML="";a.getComputedStyle&&(c=y.createElement("div"),c.style.width="0",c.style.marginRight="0",l.style.width="2px",l.appendChild(c),b.reliableMarginRight=0===(parseInt((a.getComputedStyle(c,null)||{marginRight:0}).marginRight,10)||0));if(l.attachEvent)for(h in{submit:1,
change:1,focusin:1})c="on"+h,k=c in l,k||(l.setAttribute(c,"return;"),k="function"===typeof l[c]),b[h+"Bubbles"]=k;e.removeChild(l);e=f=g=c=l=c=null;m(function(){var a,c,e,f,g=y.getElementsByTagName("body")[0];g&&(a=y.createElement("div"),a.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",g.insertBefore(a,g.firstChild),l=y.createElement("div"),a.appendChild(l),l.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",
d=l.getElementsByTagName("td"),k=0===d[0].offsetHeight,d[0].style.display="",d[1].style.display="none",b.reliableHiddenOffsets=k&&0===d[0].offsetHeight,l.innerHTML="",l.style.width=l.style.paddingLeft="1px",m.boxModel=b.boxModel=2===l.offsetWidth,"undefined"!==typeof l.style.zoom&&(l.style.display="inline",l.style.zoom=1,b.inlineBlockNeedsLayout=2===l.offsetWidth,l.style.display="",l.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=2!==l.offsetWidth),l.style.cssText="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;visibility:hidden;border:0;",
l.innerHTML="<div style='position:absolute;top:0;left:0;width:1px;height:1px;margin:0;border:5px solid #000;padding:0;'><div></div></div><table style='position:absolute;top:0;left:0;width:1px;height:1px;margin:0;border:5px solid #000;padding:0;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>",c=l.firstChild,e=c.firstChild,f=c.nextSibling.firstChild.firstChild,f={doesNotAddBorder:5!==e.offsetTop,doesAddBorderForTableAndCells:5===f.offsetTop},e.style.position="fixed",e.style.top="20px",
f.fixedPosition=20===e.offsetTop||15===e.offsetTop,e.style.position=e.style.top="",c.style.overflow="hidden",c.style.position="relative",f.subtractsBorderForOverflowNotVisible=-5===e.offsetTop,f.doesNotIncludeMarginInBodyOffset=1!==g.offsetTop,g.removeChild(a),l=null,m.extend(b,f))});return b}();var ca=/^(?:\{.*\}|\[.*\])$/,ia=/([A-Z])/g;m.extend({cache:{},uuid:0,expando:"jQuery"+(m.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},
hasData:function(a){a=a.nodeType?m.cache[a[m.expando]]:a[m.expando];return!!a&&!f(a)},data:function(a,b,c,e){if(m.acceptData(a)){var f;f=m.expando;var g="string"===typeof b,h=a.nodeType,k=h?m.cache:a,l=h?a[f]:a[f]&&f,q="events"===b;if(l&&k[l]&&(q||e||k[l].data)||!g||c!==d){l||(h?a[f]=l=++m.uuid:l=f);k[l]||(k[l]={},h||(k[l].toJSON=m.noop));if("object"===typeof b||"function"===typeof b)e?k[l]=m.extend(k[l],b):k[l].data=m.extend(k[l].data,b);f=a=k[l];e||(a.data||(a.data={}),a=a.data);c!==d&&(a[m.camelCase(b)]=
c);if(q&&!a[b])return f.events;g?(c=a[b],null==c&&(c=a[m.camelCase(b)])):c=a;return c}}},removeData:function(a,b,c){if(m.acceptData(a)){var e,g,d,h=m.expando,k=a.nodeType,l=k?m.cache:a,q=k?a[h]:h;if(l[q]){if(b&&(e=c?l[q]:l[q].data)){m.isArray(b)||(b in e?b=[b]:(b=m.camelCase(b),b=b in e?[b]:b.split(" ")));g=0;for(d=b.length;g<d;g++)delete e[b[g]];if(!(c?f:m.isEmptyObject)(e))return}if(!c&&(delete l[q].data,!f(l[q])))return;m.support.deleteExpando||!l.setInterval?delete l[q]:l[q]=null;k&&(m.support.deleteExpando?
delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}}},_data:function(a,b,c){return m.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=m.noData[a.nodeName.toLowerCase()];if(b)return!(!0===b||a.getAttribute("classid")!==b)}return!0}});m.fn.extend({data:function(a,b){var e,f,g,h=null;if("undefined"===typeof a){if(this.length&&(h=m.data(this[0]),1===this[0].nodeType&&!m._data(this[0],"parsedAttrs"))){f=this[0].attributes;for(var k=0,l=f.length;k<l;k++)g=f[k].name,0===g.indexOf("data-")&&
(g=m.camelCase(g.substring(5)),c(this[0],g,h[g]));m._data(this[0],"parsedAttrs",!0)}return h}if("object"===typeof a)return this.each(function(){m.data(this,a)});e=a.split(".");e[1]=e[1]?"."+e[1]:"";return b===d?(h=this.triggerHandler("getData"+e[1]+"!",[e[0]]),h===d&&this.length&&(h=m.data(this[0],a),h=c(this[0],a,h)),h===d&&e[1]?this.data(e[0]):h):this.each(function(){var c=m(this),f=[e[0],b];c.triggerHandler("setData"+e[1]+"!",f);m.data(this,a,b);c.triggerHandler("changeData"+e[1]+"!",f)})},removeData:function(a){return this.each(function(){m.removeData(this,
a)})}});m.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",m._data(a,b,(m._data(a,b)||0)+1))},_unmark:function(a,b,c){!0!==a&&(c=b,b=a,a=!1);if(b){c=c||"fx";var e=c+"mark";(a=a?0:(m._data(b,e)||1)-1)?m._data(b,e,a):(m.removeData(b,e,!0),k(b,c,"mark"))}},queue:function(a,b,c){var e;if(a)return b=(b||"fx")+"queue",e=m._data(a,b),c&&(!e||m.isArray(c)?e=m._data(a,b,m.makeArray(c)):e.push(c)),e||[]},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),e=c.shift(),f={};"inprogress"===e&&(e=c.shift());e&&
("fx"===b&&c.unshift("inprogress"),m._data(a,b+".run",f),e.call(a,function(){m.dequeue(a,b)},f));c.length||(m.removeData(a,b+"queue "+b+".run",!0),k(a,b,"queue"))}});m.fn.extend({queue:function(a,b){"string"!==typeof a&&(b=a,a="fx");return b===d?m.queue(this[0],a):this.each(function(){var c=m.queue(this,a,b);"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},delay:function(a,b){a=m.fx?m.fx.speeds[a]||a:a;return this.queue(b||"fx",
function(b,c){var e=setTimeout(b,a);c.stop=function(){clearTimeout(e)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){function c(){--h||e.resolveWith(f,[f])}"string"!==typeof a&&(a=d);a=a||"fx";for(var e=m.Deferred(),f=this,g=f.length,h=1,k=a+"defer",l=a+"queue",q=a+"mark",p;g--;)if(p=m.data(f[g],k,d,!0)||(m.data(f[g],l,d,!0)||m.data(f[g],q,d,!0))&&m.data(f[g],k,m.Callbacks("once memory"),!0))h++,p.add(c);c();return e.promise()}});var M=/[\n\t\r]/g,O=/\s+/,J=/\r/g,
N=/^(?:button|input)$/i,X=/^(?:button|input|object|select|textarea)$/i,U=/^a(?:rea)?$/i,P=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,G=m.support.getSetAttribute,K,Q,R;m.fn.extend({attr:function(a,b){return m.access(this,a,b,!0,m.attr)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})},prop:function(a,b){return m.access(this,a,b,!0,m.prop)},removeProp:function(a){a=m.propFix[a]||a;return this.each(function(){try{this[a]=
d,delete this[a]}catch(b){}})},addClass:function(a){var b,c,e,f,g,h,d;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(a&&"string"===typeof a)for(b=a.split(O),c=0,e=this.length;c<e;c++)if(f=this[c],1===f.nodeType)if(f.className||1!==b.length){g=" "+f.className+" ";h=0;for(d=b.length;h<d;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");f.className=m.trim(g)}else f.className=a;return this},removeClass:function(a){var b,c,e,f,g,h,k;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,
b,this.className))});if(a&&"string"===typeof a||a===d)for(b=(a||"").split(O),c=0,e=this.length;c<e;c++)if(f=this[c],1===f.nodeType&&f.className)if(a){g=(" "+f.className+" ").replace(M," ");h=0;for(k=b.length;h<k;h++)g=g.replace(" "+b[h]+" "," ");f.className=m.trim(g)}else f.className="";return this},toggleClass:function(a,b){var c=typeof a,e="boolean"===typeof b;return m.isFunction(a)?this.each(function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===
c)for(var f,g=0,h=m(this),d=b,k=a.split(O);f=k[g++];)d=e?d:!h.hasClass(f),h[d?"addClass":"removeClass"](f);else if("undefined"===c||"boolean"===c)this.className&&m._data(this,"__className__",this.className),this.className=this.className||!1===a?"":m._data(this,"__className__")||""})},hasClass:function(a){a=" "+a+" ";for(var b=0,c=this.length;b<c;b++)if(1===this[b].nodeType&&-1<(" "+this[b].className+" ").replace(M," ").indexOf(a))return!0;return!1},val:function(a){var b,c,e,f=this[0];if(arguments.length)return e=
m.isFunction(a),this.each(function(c){var f=m(this);1===this.nodeType&&(c=e?a.call(this,c,f.val()):a,null==c?c="":"number"===typeof c?c+="":m.isArray(c)&&(c=m.map(c,function(a){return null==a?"":a+""})),b=m.valHooks[this.nodeName.toLowerCase()]||m.valHooks[this.type],b&&"set"in b&&b.set(this,c,"value")!==d||(this.value=c))});if(f){if((b=m.valHooks[f.nodeName.toLowerCase()]||m.valHooks[f.type])&&"get"in b&&(c=b.get(f,"value"))!==d)return c;c=f.value;return"string"===typeof c?c.replace(J,""):null==
c?"":c}}});m.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,e=a.selectedIndex,f=[],g=a.options,h="select-one"===a.type;if(0>e)return null;a=h?e:0;for(c=h?e+1:g.length;a<c;a++)if(b=g[a],b.selected&&!((m.support.optDisabled?b.disabled:null!==b.getAttribute("disabled"))||b.parentNode.disabled&&m.nodeName(b.parentNode,"optgroup"))){b=m(b).val();if(h)return b;f.push(b)}return h&&!f.length&&g.length?m(g[e]).val():
f},set:function(a,b){var c=m.makeArray(b);m(a).find("option").each(function(){this.selected=0<=m.inArray(m(this).val(),c)});c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,b,c,e){var f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h){if(e&&b in m.attrFn)return m(a)[b](c);if("undefined"===typeof a.getAttribute)return m.prop(a,b,c);if(e=1!==h||!m.isXMLDoc(a))b=b.toLowerCase(),g=m.attrHooks[b]||(P.test(b)?Q:K);if(c!==d)if(null===
c)m.removeAttr(a,b);else{if(g&&"set"in g&&e&&(f=g.set(a,c,b))!==d)return f;a.setAttribute(b,""+c);return c}else{if(g&&"get"in g&&e&&null!==(f=g.get(a,b)))return f;f=a.getAttribute(b);return null===f?d:f}}},removeAttr:function(a,b){var c,e,f,g,h=0;if(b&&1===a.nodeType)for(e=b.toLowerCase().split(O),g=e.length;h<g;h++)if(f=e[h])c=m.propFix[f]||f,m.attr(a,f,""),a.removeAttribute(G?f:c),P.test(f)&&c in a&&(a[c]=!1)},attrHooks:{type:{set:function(a,b){if(N.test(a.nodeName)&&a.parentNode)m.error("type property can't be changed");
else if(!m.support.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b);c&&(a.value=c);return b}}},value:{get:function(a,b){return K&&m.nodeName(a,"button")?K.get(a,b):b in a?a.value:null},set:function(a,b,c){if(K&&m.nodeName(a,"button"))return K.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",
frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,b,c){var e,f,g;g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g){if(g=1!==g||!m.isXMLDoc(a))b=m.propFix[b]||b,f=m.propHooks[b];return c!==d?f&&"set"in f&&(e=f.set(a,c,b))!==d?e:a[b]=c:f&&"get"in f&&null!==(e=f.get(a,b))?e:a[b]}},propHooks:{tabIndex:{get:function(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?parseInt(b.value,10):X.test(a.nodeName)||U.test(a.nodeName)&&a.href?0:d}}}});m.attrHooks.tabindex=m.propHooks.tabIndex;
Q={get:function(a,b){var c,e=m.prop(a,b);return!0===e||"boolean"!==typeof e&&(c=a.getAttributeNode(b))&&!1!==c.nodeValue?b.toLowerCase():d},set:function(a,b,c){!1===b?m.removeAttr(a,c):(b=m.propFix[c]||c,b in a&&(a[b]=!0),a.setAttribute(c,c.toLowerCase()));return c}};G||(R={name:!0,id:!0},K=m.valHooks.button={get:function(a,b){var c;return(c=a.getAttributeNode(b))&&(R[b]?""!==c.nodeValue:c.specified)?c.nodeValue:d},set:function(a,b,c){var e=a.getAttributeNode(c);e||(e=y.createAttribute(c),a.setAttributeNode(e));
return e.nodeValue=b+""}},m.attrHooks.tabindex.set=K.set,m.each(["width","height"],function(a,b){m.attrHooks[b]=m.extend(m.attrHooks[b],{set:function(a,c){if(""===c)return a.setAttribute(b,"auto"),c}})}),m.attrHooks.contenteditable={get:K.get,set:function(a,b,c){""===b&&(b="false");K.set(a,b,c)}});m.support.hrefNormalized||m.each(["href","src","width","height"],function(a,b){m.attrHooks[b]=m.extend(m.attrHooks[b],{get:function(a){a=a.getAttribute(b,2);return null===a?d:a}})});m.support.style||(m.attrHooks.style=
{get:function(a){return a.style.cssText.toLowerCase()||d},set:function(a,b){return a.style.cssText=""+b}});m.support.optSelected||(m.propHooks.selected=m.extend(m.propHooks.selected,{get:function(a){if(a=a.parentNode)a.selectedIndex,a.parentNode&&a.parentNode.selectedIndex;return null}}));m.support.enctype||(m.propFix.enctype="encoding");m.support.checkOn||m.each(["radio","checkbox"],function(){m.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}});m.each(["radio",
"checkbox"],function(){m.valHooks[this]=m.extend(m.valHooks[this],{set:function(a,b){if(m.isArray(b))return a.checked=0<=m.inArray(m(a).val(),b)}})});var Z=/^(?:textarea|input|select)$/i,da=/^([^\.]*)?(?:\.(.+))?$/,Ia=/\bhover(\.\S+)?\b/,aa=/^key/,ga=/^(?:mouse|contextmenu)|click/,ea=/^(?:focusinfocus|focusoutblur)$/,ua=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Da=function(a){if(a=ua.exec(a))a[1]=(a[1]||"").toLowerCase(),a[3]=a[3]&&RegExp("(?:^|\\s)"+a[3]+"(?:\\s|$)");return a},S=function(a){return m.event.special.hover?
a:a.replace(Ia,"mouseenter$1 mouseleave$1")};m.event={add:function(a,b,c,e,f){var g,h,k,l,q,p,n,s,r;if(3!==a.nodeType&&8!==a.nodeType&&b&&c&&(g=m._data(a))){c.handler&&(n=c,c=n.handler);c.guid||(c.guid=m.guid++);k=g.events;k||(g.events=k={});h=g.handle;h||(g.handle=h=function(a){return"undefined"===typeof m||a&&m.event.triggered===a.type?d:m.event.dispatch.apply(h.elem,arguments)},h.elem=a);b=m.trim(S(b)).split(" ");for(g=0;g<b.length;g++)l=da.exec(b[g])||[],q=l[1],p=(l[2]||"").split(".").sort(),
r=m.event.special[q]||{},q=(f?r.delegateType:r.bindType)||q,r=m.event.special[q]||{},l=m.extend({type:q,origType:l[1],data:e,handler:c,guid:c.guid,selector:f,quick:Da(f),namespace:p.join(".")},n),s=k[q],s||(s=k[q]=[],s.delegateCount=0,r.setup&&!1!==r.setup.call(a,e,p,h)||(a.addEventListener?a.addEventListener(q,h,!1):a.attachEvent&&a.attachEvent("on"+q,h))),r.add&&(r.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),f?s.splice(s.delegateCount++,0,l):s.push(l),m.event.global[q]=!0;a=null}},global:{},
remove:function(a,b,c,e,f){var g=m.hasData(a)&&m._data(a),h,d,k,l,q,p,n,s,r,v;if(g&&(n=g.events)){b=m.trim(S(b||"")).split(" ");for(h=0;h<b.length;h++)if(d=da.exec(b[h])||[],k=l=d[1],d=d[2],k){s=m.event.special[k]||{};k=(e?s.delegateType:s.bindType)||k;r=n[k]||[];q=r.length;d=d?RegExp("(^|\\.)"+d.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(p=0;p<r.length;p++)v=r[p],!f&&l!==v.origType||c&&c.guid!==v.guid||(d&&!d.test(v.namespace)||e&&!(e===v.selector||"**"===e&&v.selector))||(r.splice(p--,
1),v.selector&&r.delegateCount--,s.remove&&s.remove.call(a,v));0===r.length&&q!==r.length&&(s.teardown&&!1!==s.teardown.call(a,d)||m.removeEvent(a,k,g.handle),delete n[k])}else for(k in n)m.event.remove(a,k+b[h],c,e,!0);if(m.isEmptyObject(n)){if(b=g.handle)b.elem=null;m.removeData(a,["events","handle"],!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(b,c,e,f){if(!e||3!==e.nodeType&&8!==e.nodeType){var g=b.type||b,h=[],k,l,q,p,n;if(!ea.test(g+m.event.triggered)&&(0<=g.indexOf("!")&&
(g=g.slice(0,-1),k=!0),0<=g.indexOf(".")&&(h=g.split("."),g=h.shift(),h.sort()),e&&!m.event.customEvent[g]||m.event.global[g]))if(b="object"===typeof b?b[m.expando]?b:new m.Event(g,b):new m.Event(g),b.type=g,b.isTrigger=!0,b.exclusive=k,b.namespace=h.join("."),b.namespace_re=b.namespace?RegExp("(^|\\.)"+h.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,k=0>g.indexOf(":")?"on"+g:"",e){if(b.result=d,b.target||(b.target=e),c=null!=c?m.makeArray(c):[],c.unshift(b),q=m.event.special[g]||{},!q.trigger||!1!==q.trigger.apply(e,
c)){n=[[e,q.bindType||g]];if(!f&&!q.noBubble&&!m.isWindow(e)){p=q.delegateType||g;h=ea.test(p+g)?e:e.parentNode;for(l=null;h;h=h.parentNode)n.push([h,p]),l=h;l&&l===e.ownerDocument&&n.push([l.defaultView||l.parentWindow||a,p])}for(l=0;l<n.length&&!b.isPropagationStopped();l++)h=n[l][0],b.type=n[l][1],(p=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"))&&p.apply(h,c),(p=k&&h[k])&&m.acceptData(h)&&!1===p.apply(h,c)&&b.preventDefault();b.type=g;f||b.isDefaultPrevented()||q._default&&!1!==q._default.apply(e.ownerDocument,
c)||("click"===g&&m.nodeName(e,"a")||!m.acceptData(e)||!k||!e[g]||("focus"===g||"blur"===g)&&0===b.target.offsetWidth||m.isWindow(e))||((l=e[k])&&(e[k]=null),m.event.triggered=g,e[g](),m.event.triggered=d,l&&(e[k]=l));return b.result}}else for(l in e=m.cache,e)e[l].events&&e[l].events[g]&&m.event.trigger(b,c,e[l].handle.elem,!0)}},dispatch:function(b){b=m.event.fix(b||a.event);var c=(m._data(this,"events")||{})[b.type]||[],e=c.delegateCount,f=[].slice.call(arguments,0),g=!b.exclusive&&!b.namespace,
h=[],k,l,q,p,n,s,r;f[0]=b;b.delegateTarget=this;if(e&&!(b.target.disabled||b.button&&"click"===b.type))for(q=m(this),q.context=this.ownerDocument||this,l=b.target;l!=this;l=l.parentNode||this){n={};s=[];q[0]=l;for(k=0;k<e;k++){p=c[k];r=p.selector;if(n[r]===d){var v=n,w=r,u;if(p.quick){u=p.quick;var x=l.attributes||{};u=(!u[1]||l.nodeName.toLowerCase()===u[1])&&(!u[2]||(x.id||{}).value===u[2])&&(!u[3]||u[3].test((x["class"]||{}).value))}else u=q.is(r);v[w]=u}n[r]&&s.push(p)}s.length&&h.push({elem:l,
matches:s})}c.length>e&&h.push({elem:this,matches:c.slice(e)});for(k=0;k<h.length&&!b.isPropagationStopped();k++)for(e=h[k],b.currentTarget=e.elem,c=0;c<e.matches.length&&!b.isImmediatePropagationStopped();c++)if(p=e.matches[c],g||!b.namespace&&!p.namespace||b.namespace_re&&b.namespace_re.test(p.namespace))b.data=p.data,b.handleObj=p,p=((m.event.special[p.origType]||{}).handle||p.handler).apply(e.elem,f),p!==d&&(b.result=p,!1===p&&(b.preventDefault(),b.stopPropagation()));return b.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(a,b){null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f=b.button,g=b.fromElement;null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||y,e=c.documentElement,c=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||
c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0));!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g);a.which||f===d||(a.which=f&1?1:f&2?3:f&4?2:0);return a}},fix:function(a){if(a[m.expando])return a;var b,c,e=a,f=m.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=m.Event(e);for(b=g.length;b;)c=g[--b],a[c]=e[c];a.target||(a.target=e.srcElement||y);3===a.target.nodeType&&(a.target=a.target.parentNode);
a.metaKey===d&&(a.metaKey=a.ctrlKey);return f.filter?f.filter(a,e):a},special:{ready:{setup:m.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){m.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,e){a=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});e?m.event.trigger(a,null,b):m.event.dispatch.call(b,a);a.isDefaultPrevented()&&
c.preventDefault()}};m.event.handle=m.event.dispatch;m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)};m.Event=function(a,b){if(!(this instanceof m.Event))return new m.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||!1===a.returnValue||a.getPreventDefault&&a.getPreventDefault()?g:h):this.type=a;b&&m.extend(this,b);this.timeStamp=a&&
a.timeStamp||m.now();this[m.expando]=!0};m.Event.prototype={preventDefault:function(){this.isDefaultPrevented=g;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=g;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=g;this.stopPropagation()},isDefaultPrevented:h,isPropagationStopped:h,isImmediatePropagationStopped:h};
m.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=a.relatedTarget,e=a.handleObj,f;if(!c||c!==this&&!m.contains(this,c))a.type=e.origType,f=e.handler.apply(this,arguments),a.type=b;return f}}});m.support.submitBubbles||(m.event.special.submit={setup:function(){if(m.nodeName(this,"form"))return!1;m.event.add(this,"click._submit keypress._submit",function(a){a=a.target;(a=m.nodeName(a,"input")||m.nodeName(a,"button")?
a.form:d)&&!a._submit_attached&&(m.event.add(a,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0)}),a._submit_attached=!0)})},teardown:function(){if(m.nodeName(this,"form"))return!1;m.event.remove(this,"._submit")}});m.support.changeBubbles||(m.event.special.change={setup:function(){if(Z.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type)m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&
(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,m.event.simulate("change",this,a,!0))});return!1}m.event.add(this,"beforeactivate._change",function(a){a=a.target;Z.test(a.nodeName)&&!a._change_attached&&(m.event.add(a,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),a._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||
a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){m.event.remove(this,"._change");return Z.test(this.nodeName)}});m.support.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,e=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){0===c++&&y.addEventListener(a,e,!0)},teardown:function(){0===--c&&y.removeEventListener(a,e,!0)}}});m.fn.extend({on:function(a,b,
c,e,f){var g,k;if("object"===typeof a){"string"!==typeof b&&(c=b,b=d);for(k in a)this.on(k,b,c,a[k],f);return this}null==c&&null==e?(e=b,c=b=d):null==e&&("string"===typeof b?(e=c,c=d):(e=c,c=b,b=d));if(!1===e)e=h;else if(!e)return this;1===f&&(g=e,e=function(a){m().off(a);return g.apply(this,arguments)},e.guid=g.guid||(g.guid=m.guid++));return this.each(function(){m.event.add(this,a,e,c,b)})},one:function(a,b,c,e){return this.on.call(this,a,b,c,e,1)},off:function(a,b,c){if(a&&a.preventDefault&&a.handleObj){var e=
a.handleObj;m(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if("object"===typeof a){for(e in a)this.off(e,b,a[e]);return this}if(!1===b||"function"===typeof b)c=b,b=d;!1===c&&(c=h);return this.each(function(){m.event.remove(this,a,c,b)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){m(this.context).on(a,this.selector,b,c);return this},die:function(a,b){m(this.context).off(a,
this.selector||"**",b);return this},delegate:function(a,b,c,e){return this.on(b,a,c,e)},undelegate:function(a,b,c){return 1==arguments.length?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return m.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||m.guid++,e=0,f=function(c){var f=(m._data(this,"lastToggle"+a.guid)||0)%e;m._data(this,"lastToggle"+a.guid,f+1);c.preventDefault();
return b[f].apply(this,arguments)||!1};for(f.guid=c;e<b.length;)b[e++].guid=c;return this.click(f)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){null==c&&(c=a,a=null);return 0<arguments.length?this.on(b,null,a,c):this.trigger(b)};
m.attrFn&&(m.attrFn[b]=!0);aa.test(b)&&(m.event.fixHooks[b]=m.event.keyHooks);ga.test(b)&&(m.event.fixHooks[b]=m.event.mouseHooks)});(function(){function a(b,c,f,g,h,d){h=0;for(var k=g.length;h<k;h++){var l=g[h];if(l){for(var q=!1,l=l[b];l;){if(l[e]===f){q=g[l.sizset];break}1!==l.nodeType||d||(l[e]=f,l.sizset=h);if(l.nodeName.toLowerCase()===c){q=l;break}l=l[b]}g[h]=q}}}function b(a,c,f,g,h,d){h=0;for(var k=g.length;h<k;h++){var l=g[h];if(l){for(var q=!1,l=l[a];l;){if(l[e]===f){q=g[l.sizset];break}if(1===
l.nodeType)if(d||(l[e]=f,l.sizset=h),"string"!==typeof c){if(l===c){q=!0;break}}else if(0<n.filter(c,[l]).length){q=l;break}l=l[a]}g[h]=q}}}var c=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e="sizcache"+(Math.random()+"").replace(".",""),f=0,g=Object.prototype.toString,h=!1,k=!0,l=/\\/g,q=/\r\n/g,p=/\W/;[0,0].sort(function(){k=!1;return 0});var n=function(a,b,e,f){e=e||[];var h=b=b||y;if(1!==b.nodeType&&9!==
b.nodeType)return[];if(!a||"string"!==typeof a)return e;var d,k,l,q,p,m=!0,s=n.isXML(b),H=[],w=a;do if(c.exec(""),d=c.exec(w))if(w=d[3],H.push(d[1]),d[2]){q=d[3];break}while(d);if(1<H.length&&v.exec(a))if(2===H.length&&r.relative[H[0]])k=L(H[0]+H[1],b,f);else for(k=r.relative[H[0]]?[b]:n(H.shift(),b);H.length;)a=H.shift(),r.relative[a]&&(a+=H.shift()),k=L(a,k,f);else if(!f&&1<H.length&&(9===b.nodeType&&!s&&r.match.ID.test(H[0])&&!r.match.ID.test(H[H.length-1]))&&(d=n.find(H.shift(),b,s),b=d.expr?
n.filter(d.expr,d.set)[0]:d.set[0]),b)for(d=f?{expr:H.pop(),set:x(f)}:n.find(H.pop(),1!==H.length||"~"!==H[0]&&"+"!==H[0]||!b.parentNode?b:b.parentNode,s),k=d.expr?n.filter(d.expr,d.set):d.set,0<H.length?l=x(k):m=!1;H.length;)d=p=H.pop(),r.relative[p]?d=H.pop():p="",null==d&&(d=b),r.relative[p](l,d,s);else l=[];l||(l=k);l||n.error(p||a);if("[object Array]"===g.call(l))if(m)if(b&&1===b.nodeType)for(a=0;null!=l[a];a++)l[a]&&(!0===l[a]||1===l[a].nodeType&&n.contains(b,l[a]))&&e.push(k[a]);else for(a=
0;null!=l[a];a++)l[a]&&1===l[a].nodeType&&e.push(k[a]);else e.push.apply(e,l);else x(l,e);q&&(n(q,h,e,f),n.uniqueSort(e));return e};n.uniqueSort=function(a){if(B&&(h=k,a.sort(B),h))for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1);return a};n.matches=function(a,b){return n(a,null,null,b)};n.matchesSelector=function(a,b){return 0<n(b,null,null,[a]).length};n.find=function(a,b,c){var e,f,g,h,d,k;if(!a)return[];f=0;for(g=r.order.length;f<g;f++)if(d=r.order[f],h=r.leftMatch[d].exec(a))if(k=h[1],
h.splice(1,1),"\\"!==k.substr(k.length-1)&&(h[1]=(h[1]||"").replace(l,""),e=r.find[d](h,b,c),null!=e)){a=a.replace(r.match[d],"");break}e||(e="undefined"!==typeof b.getElementsByTagName?b.getElementsByTagName("*"):[]);return{set:e,expr:a}};n.filter=function(a,b,c,e){for(var f,g,h,k,l,q,p,m,s=a,H=[],v=b,w=b&&b[0]&&n.isXML(b[0]);a&&b.length;){for(h in r.filter)if(null!=(f=r.leftMatch[h].exec(a))&&f[2]&&(q=r.filter[h],l=f[1],g=!1,f.splice(1,1),"\\"!==l.substr(l.length-1))){v===H&&(H=[]);if(r.preFilter[h])if(f=
r.preFilter[h](f,v,c,H,e,w),!f)g=k=!0;else if(!0===f)continue;if(f)for(p=0;null!=(l=v[p]);p++)l&&(k=q(l,f,p,v),m=e^k,c&&null!=k?m?g=!0:v[p]=!1:m&&(H.push(l),g=!0));if(k!==d){c||(v=H);a=a.replace(r.match[h],"");if(!g)return[];break}}if(a===s)if(null==g)n.error(a);else break;s=a}return v};n.error=function(a){throw Error("Syntax error, unrecognized expression: "+a);};var s=n.getText=function(a){var b,c;b=a.nodeType;var e="";if(b)if(1===b||9===b){if("string"===typeof a.textContent)return a.textContent;
if("string"===typeof a.innerText)return a.innerText.replace(q,"");for(a=a.firstChild;a;a=a.nextSibling)e+=s(a)}else{if(3===b||4===b)return a.nodeValue}else for(b=0;c=a[b];b++)8!==c.nodeType&&(e+=s(c));return e},r=n.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=
"string"===typeof b,e=c&&!p.test(b),c=c&&!e;e&&(b=b.toLowerCase());for(var e=0,f=a.length,g;e<f;e++)if(g=a[e]){for(;(g=g.previousSibling)&&1!==g.nodeType;);a[e]=c||g&&g.nodeName.toLowerCase()===b?g||!1:g===b}c&&n.filter(b,a,!0)},">":function(a,b){var c,e="string"===typeof b,f=0,g=a.length;if(e&&!p.test(b))for(b=b.toLowerCase();f<g;f++){if(c=a[f])c=c.parentNode,a[f]=c.nodeName.toLowerCase()===b?c:!1}else{for(;f<g;f++)(c=a[f])&&(a[f]=e?c.parentNode:c.parentNode===b);e&&n.filter(b,a,!0)}},"":function(c,
e,g){var h,d=f++,k=b;"string"!==typeof e||p.test(e)||(h=e=e.toLowerCase(),k=a);k("parentNode",e,d,c,h,g)},"~":function(c,e,g){var h,d=f++,k=b;"string"!==typeof e||p.test(e)||(h=e=e.toLowerCase(),k=a);k("previousSibling",e,d,c,h,g)}},find:{ID:function(a,b,c){if("undefined"!==typeof b.getElementById&&!c)return(a=b.getElementById(a[1]))&&a.parentNode?[a]:[]},NAME:function(a,b){if("undefined"!==typeof b.getElementsByName){for(var c=[],e=b.getElementsByName(a[1]),f=0,g=e.length;f<g;f++)e[f].getAttribute("name")===
a[1]&&c.push(e[f]);return 0===c.length?null:c}},TAG:function(a,b){if("undefined"!==typeof b.getElementsByTagName)return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,e,f,g){a=" "+a[1].replace(l,"")+" ";if(g)return a;g=0;for(var h;null!=(h=b[g]);g++)h&&(f^(h.className&&0<=(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a))?c||e.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(l,"")},TAG:function(a,b){return a[1].replace(l,"").toLowerCase()},CHILD:function(a){if("nth"===
a[1]){a[2]||n.error(a[0]);a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even"===a[2]&&"2n"||"odd"===a[2]&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0;a[3]=b[3]-0}else a[2]&&n.error(a[0]);a[0]=f++;return a},ATTR:function(a,b,c,e,f,g){b=a[1]=a[1].replace(l,"");!g&&r.attrMap[b]&&(a[1]=r.attrMap[b]);a[4]=(a[4]||a[5]||"").replace(l,"");"~="===a[2]&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(a,b,e,f,g){if("not"===a[1])if(1<(c.exec(a[3])||"").length||
/^\w/.test(a[3]))a[3]=n(a[3],null,null,b);else return a=n.filter(a[3],b,e,1^g),e||f.push.apply(f,a),!1;else if(r.match.POS.test(a[0])||r.match.CHILD.test(a[0]))return!0;return a},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return!1===a.disabled&&"hidden"!==a.type},disabled:function(a){return!0===a.disabled},checked:function(a){return!0===a.checked},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return!0===a.selected},parent:function(a){return!!a.firstChild},
empty:function(a){return!a.firstChild},has:function(a,b,c){return!!n(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"input"===a.nodeName.toLowerCase()&&"text"===c&&(b===c||null===b)},radio:function(a){return"input"===a.nodeName.toLowerCase()&&"radio"===a.type},checkbox:function(a){return"input"===a.nodeName.toLowerCase()&&"checkbox"===a.type},file:function(a){return"input"===a.nodeName.toLowerCase()&&"file"===a.type},
password:function(a){return"input"===a.nodeName.toLowerCase()&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return("input"===b||"button"===b)&&"submit"===a.type},image:function(a){return"input"===a.nodeName.toLowerCase()&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return("input"===b||"button"===b)&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},
focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return 0===b},last:function(a,b,c,e){return b===e.length-1},even:function(a,b){return 0===b%2},odd:function(a,b){return 1===b%2},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,e){var f=b[1],g=r.filters[f];if(g)return g(a,c,b,e);if("contains"===f)return 0<=(a.textContent||a.innerText||
s([a])||"").indexOf(b[3]);if("not"===f){b=b[3];c=0;for(e=b.length;c<e;c++)if(b[c]===a)return!1;return!0}n.error(f)},CHILD:function(a,b){var c,f,g,h,d,k;c=b[1];k=a;switch(c){case "only":case "first":for(;k=k.previousSibling;)if(1===k.nodeType)return!1;if("first"===c)return!0;k=a;case "last":for(;k=k.nextSibling;)if(1===k.nodeType)return!1;return!0;case "nth":c=b[2];f=b[3];if(1===c&&0===f)return!0;g=b[0];if((h=a.parentNode)&&(h[e]!==g||!a.nodeIndex)){d=0;for(k=h.firstChild;k;k=k.nextSibling)1===k.nodeType&&
(k.nodeIndex=++d);h[e]=g}k=a.nodeIndex-f;return 0===c?0===k:0===k%c&&0<=k/c}},ID:function(a,b){return 1===a.nodeType&&a.getAttribute("id")===b},TAG:function(a,b){return"*"===b&&1===a.nodeType||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return-1<(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)},ATTR:function(a,b){var c=b[1],c=n.attr?n.attr(a,c):r.attrHandle[c]?r.attrHandle[c](a):null!=a[c]?a[c]:a.getAttribute(c),e=c+"",f=b[2],g=b[4];return null==c?"!="===f:!f&&n.attr?
null!=c:"="===f?e===g:"*="===f?0<=e.indexOf(g):"~="===f?0<=(" "+e+" ").indexOf(g):g?"!="===f?e!==g:"^="===f?0===e.indexOf(g):"$="===f?e.substr(e.length-g.length)===g:"|="===f?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&!1!==c},POS:function(a,b,c,e){var f=r.setFilters[b[2]];if(f)return f(a,c,b,e)}}},v=r.match.POS,w=function(a,b){return"\\"+(b-0+1)},u;for(u in r.match)r.match[u]=RegExp(r.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source),r.leftMatch[u]=RegExp(/(^(?:.|\r|\n)*?)/.source+r.match[u].source.replace(/\\(\d+)/g,
w));var x=function(a,b){a=Array.prototype.slice.call(a,0);return b?(b.push.apply(b,a),b):a};try{Array.prototype.slice.call(y.documentElement.childNodes,0)[0].nodeType}catch(z){x=function(a,b){var c=0,e=b||[];if("[object Array]"===g.call(a))Array.prototype.push.apply(e,a);else if("number"===typeof a.length)for(var f=a.length;c<f;c++)e.push(a[c]);else for(;a[c];c++)e.push(a[c]);return e}}var B,S;y.documentElement.compareDocumentPosition?B=function(a,b){return a===b?(h=!0,0):a.compareDocumentPosition&&
b.compareDocumentPosition?a.compareDocumentPosition(b)&4?-1:1:a.compareDocumentPosition?-1:1}:(B=function(a,b){if(a===b)return h=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,e,f=[],g=[];c=a.parentNode;e=b.parentNode;var d=c;if(c===e)return S(a,b);if(!c)return-1;if(!e)return 1;for(;d;)f.unshift(d),d=d.parentNode;for(d=e;d;)g.unshift(d),d=d.parentNode;c=f.length;e=g.length;for(d=0;d<c&&d<e;d++)if(f[d]!==g[d])return S(f[d],g[d]);return d===c?S(a,g[d],-1):S(f[d],b,1)},
S=function(a,b,c){if(a===b)return c;for(a=a.nextSibling;a;){if(a===b)return-1;a=a.nextSibling}return 1});(function(){var a=y.createElement("div"),b="script"+(new Date).getTime(),c=y.documentElement;a.innerHTML="<a name='"+b+"'/>";c.insertBefore(a,c.firstChild);y.getElementById(b)&&(r.find.ID=function(a,b,c){if("undefined"!==typeof b.getElementById&&!c)return(b=b.getElementById(a[1]))?b.id===a[1]||"undefined"!==typeof b.getAttributeNode&&b.getAttributeNode("id").nodeValue===a[1]?[b]:d:[]},r.filter.ID=
function(a,b){var c="undefined"!==typeof a.getAttributeNode&&a.getAttributeNode("id");return 1===a.nodeType&&c&&c.nodeValue===b});c.removeChild(a);c=a=null})();(function(){var a=y.createElement("div");a.appendChild(y.createComment(""));0<a.getElementsByTagName("*").length&&(r.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if("*"===a[1]){for(var e=[],f=0;c[f];f++)1===c[f].nodeType&&e.push(c[f]);c=e}return c});a.innerHTML="<a href='#'></a>";a.firstChild&&"undefined"!==typeof a.firstChild.getAttribute&&
"#"!==a.firstChild.getAttribute("href")&&(r.attrHandle.href=function(a){return a.getAttribute("href",2)});a=null})();y.querySelectorAll&&function(){var a=n,b=y.createElement("div");b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||0!==b.querySelectorAll(".TEST").length){n=function(b,c,e,f){c=c||y;if(!f&&!n.isXML(c)){var g=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(g&&(1===c.nodeType||9===c.nodeType)){if(g[1])return x(c.getElementsByTagName(b),e);if(g[2]&&r.find.CLASS&&c.getElementsByClassName)return x(c.getElementsByClassName(g[2]),
e)}if(9===c.nodeType){if("body"===b&&c.body)return x([c.body],e);if(g&&g[3]){var h=c.getElementById(g[3]);if(h&&h.parentNode){if(h.id===g[3])return x([h],e)}else return x([],e)}try{return x(c.querySelectorAll(b),e)}catch(d){}}else if(1===c.nodeType&&"object"!==c.nodeName.toLowerCase()){var g=c,k=(h=c.getAttribute("id"))||"__sizzle__",l=c.parentNode,q=/^\s*[+~]/.test(b);h?k=k.replace(/'/g,"\\$&"):c.setAttribute("id",k);q&&l&&(c=c.parentNode);try{if(!q||l)return x(c.querySelectorAll("[id='"+k+"'] "+
b),e)}catch(p){}finally{h||g.removeAttribute("id")}}}return a(b,c,e,f)};for(var c in a)n[c]=a[c];b=null}}();(function(){var a=y.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(y.createElement("div"),"div"),e=!1;try{b.call(y.documentElement,"[test!='']:sizzle")}catch(f){e=!0}n.matchesSelector=function(a,f){f=f.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!n.isXML(a))try{if(e||!r.match.PSEUDO.test(f)&&!/!=/.test(f)){var g=b.call(a,
f);if(g||!c||a.document&&11!==a.document.nodeType)return g}}catch(h){}return 0<n(f,null,null,[a]).length}}})();(function(){var a=y.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";a.getElementsByClassName&&0!==a.getElementsByClassName("e").length&&(a.lastChild.className="e",1!==a.getElementsByClassName("e").length&&(r.order.splice(1,0,"CLASS"),r.find.CLASS=function(a,b,c){if("undefined"!==typeof b.getElementsByClassName&&!c)return b.getElementsByClassName(a[1])},
a=null))})();n.contains=y.documentElement.contains?function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:y.documentElement.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:function(){return!1};n.isXML=function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?"HTML"!==a.nodeName:!1};var L=function(a,b,c){var e,f=[],g="";for(b=b.nodeType?[b]:b;e=r.match.PSEUDO.exec(a);)g+=e[0],a=a.replace(r.match.PSEUDO,"");a=r.relative[a]?a+"*":a;e=0;for(var h=b.length;e<h;e++)n(a,
b[e],f,c);return n.filter(g,f)};n.attr=m.attr;n.selectors.attrMap={};m.find=n;m.expr=n.selectors;m.expr[":"]=m.expr.filters;m.unique=n.uniqueSort;m.text=n.getText;m.isXMLDoc=n.isXML;m.contains=n.contains})();var L=/Until$/,la=/^(?:parents|prevUntil|prevAll)/,sa=/,/,ka=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,ha=m.expr.match.POS,cb={children:!0,contents:!0,next:!0,prev:!0};m.fn.extend({find:function(a){var b=this,c,e;if("string"!==typeof a)return m(a).filter(function(){c=0;for(e=b.length;c<e;c++)if(m.contains(b[c],
this))return!0});var f=this.pushStack("","find",a),g,h,d;c=0;for(e=this.length;c<e;c++)if(g=f.length,m.find(a,this[c],f),0<c)for(h=g;h<f.length;h++)for(d=0;d<g;d++)if(f[d]===f[h]){f.splice(h--,1);break}return f},has:function(a){var b=m(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(m.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(e(this,a,!1),"not",a)},filter:function(a){return this.pushStack(e(this,a,!0),"filter",a)},is:function(a){return!!a&&("string"===
typeof a?ha.test(a)?0<=m(a,this.context).index(this[0]):0<m.filter(a,this).length:0<this.filter(a).length)},closest:function(a,b){var c=[],e,f,g=this[0];if(m.isArray(a)){for(f=1;g&&g.ownerDocument&&g!==b;){for(e=0;e<a.length;e++)m(g).is(a[e])&&c.push({selector:a[e],elem:g,level:f});g=g.parentNode;f++}return c}var h=ha.test(a)||"string"!==typeof a?m(a,b||this.context):0;e=0;for(f=this.length;e<f;e++)for(g=this[e];g;)if(h?-1<h.index(g):m.find.matchesSelector(g,a)){c.push(g);break}else if(g=g.parentNode,
!g||!g.ownerDocument||g===b||11===g.nodeType)break;c=1<c.length?m.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){return a?"string"===typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c="string"===typeof a?m(a,b):m.makeArray(a&&a.nodeType?[a]:a),e=m.merge(this.get(),c);return this.pushStack(c[0]&&c[0].parentNode&&11!==c[0].parentNode.nodeType&&e[0]&&e[0].parentNode&&11!==e[0].parentNode.nodeType?
m.unique(e):e)},andSelf:function(){return this.add(this.prevObject)}});m.each({parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return m.nth(a,2,"nextSibling")},prev:function(a){return m.nth(a,2,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,
"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling(a.parentNode.firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.makeArray(a.childNodes)}},function(a,b){m.fn[a]=function(c,e){var f=m.map(this,b,c);L.test(a)||(e=c);e&&"string"===typeof e&&(f=m.filter(e,f));f=1<this.length&&!cb[a]?m.unique(f):f;(1<this.length||sa.test(e))&&
la.test(a)&&(f=f.reverse());return this.pushStack(f,a,bb.call(arguments).join(","))}});m.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return 1===b.length?m.find.matchesSelector(b[0],a)?[b[0]]:[]:m.find.matches(a,b)},dir:function(a,b,c){var e=[];for(a=a[b];a&&9!==a.nodeType&&(c===d||1!==a.nodeType||!m(a).is(c));)1===a.nodeType&&e.push(a),a=a[b];return e},nth:function(a,b,c,e){b=b||1;for(e=0;a&&(1!==a.nodeType||++e!==b);a=a[c]);return a},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===
a.nodeType&&a!==b&&c.push(a);return c}});var oa="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",db=/ jQuery\d+="(?:\d+|null)"/g,va=/^\s+/,ja=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ja=/<([\w:]+)/,eb=/<tbody/i,fb=/<|&#?\w+;/,gb=/<(?:script|style)/i,hb=/<(?:script|object|embed|option|style)/i,Ka=RegExp("<(?:"+oa+")","i"),La=/checked\s*(?:[^=]|=\s*.checked.)/i,ib=/\/(java|ecma)script/i,
Ya=/^\s*<!(?:\[CDATA\[|\-\-)/,ba={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ma=l(y);ba.optgroup=ba.option;ba.tbody=ba.tfoot=ba.colgroup=ba.caption=ba.thead;ba.th=ba.td;m.support.htmlSerialize||(ba._default=[1,"div<div>",
"</div>"]);m.fn.extend({text:function(a){return m.isFunction(a)?this.each(function(b){var c=m(this);c.text(a.call(this,b,c.text()))}):"object"!==typeof a&&a!==d?this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a)):m.text(this)},wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var a=this;a.firstChild&&
1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return m.isFunction(a)?this.each(function(b){m(this).wrapInner(a.call(this,b))}):this.each(function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()},
append:function(){return this.domManip(arguments,!0,function(a){1===this.nodeType&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1===this.nodeType&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=m.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&
this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,m.clean(arguments));return a}},remove:function(a,b){for(var c=0,e;null!=(e=this[c]);c++)if(!a||m.filter(a,[e]).length)b||1!==e.nodeType||(m.cleanData(e.getElementsByTagName("*")),m.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;null!=(b=this[a]);a++)for(1===
b.nodeType&&m.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a,b){a=null==a?!1:a;b=null==b?a:b;return this.map(function(){return m.clone(this,a,b)})},html:function(a){if(a===d)return this[0]&&1===this[0].nodeType?this[0].innerHTML.replace(db,""):null;if("string"!==typeof a||gb.test(a)||!m.support.leadingWhitespace&&va.test(a)||ba[(Ja.exec(a)||["",""])[1].toLowerCase()])m.isFunction(a)?this.each(function(b){var c=m(this);c.html(a.call(this,
b,c.html()))}):this.empty().append(a);else{a=a.replace(ja,"<$1></$2>");try{for(var b=0,c=this.length;b<c;b++)1===this[b].nodeType&&(m.cleanData(this[b].getElementsByTagName("*")),this[b].innerHTML=a)}catch(e){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(m.isFunction(a))return this.each(function(b){var c=m(this),e=c.html();c.replaceWith(a.call(this,b,e))});"string"!==typeof a&&(a=m(a).detach());return this.each(function(){var b=this.nextSibling,c=
this.parentNode;m(this).remove();b?m(b).before(a):m(c).append(a)})}return this.length?this.pushStack(m(m.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,c){var e,f,g,h=a[0],k=[];if(!m.support.checkClone&&3===arguments.length&&"string"===typeof h&&La.test(h))return this.each(function(){m(this).domManip(a,b,c,!0)});if(m.isFunction(h))return this.each(function(e){var f=m(this);a[0]=h.call(this,e,b?f.html():d);f.domManip(a,b,c)});if(this[0]){e=
h&&h.parentNode;e=m.support.parentNode&&e&&11===e.nodeType&&e.childNodes.length===this.length?{fragment:e}:m.buildFragment(a,this,k);g=e.fragment;if(f=1===g.childNodes.length?g=g.firstChild:g.firstChild){b=b&&m.nodeName(f,"tr");f=0;for(var l=this.length,q=l-1;f<l;f++)c.call(b?m.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):this[f]:this[f],e.cacheable||1<l&&f<q?m.clone(g,!0,!0):g)}k.length&&m.each(k,w)}return this}});
m.buildFragment=function(a,b,c){var e,f,g,h,d=a[0];b&&b[0]&&(h=b[0].ownerDocument||b[0]);h.createDocumentFragment||(h=y);1===a.length&&"string"===typeof d&&(512>d.length&&h===y&&"<"===d.charAt(0)&&!(hb.test(d)||!m.support.checkClone&&La.test(d)||!m.support.html5Clone&&Ka.test(d)))&&(f=!0,(g=m.fragments[d])&&1!==g&&(e=g));e||(e=h.createDocumentFragment(),m.clean(a,h,e,c));f&&(m.fragments[d]=g?e:1);return{fragment:e,cacheable:f}};m.fragments={};m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",
insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(c){var e=[];c=m(c);var f=1===this.length&&this[0].parentNode;if(f&&11===f.nodeType&&1===f.childNodes.length&&1===c.length)return c[b](this[0]),this;for(var f=0,g=c.length;f<g;f++){var h=(0<f?this.clone(!0):this).get();m(c[f])[b](h);e=e.concat(h)}return this.pushStack(e,a,c.selector)}});m.extend({clone:function(a,b,c){var e,f,g;m.support.html5Clone||!Ka.test("<"+a.nodeName)?e=a.cloneNode(!0):(e=y.createElement("div"),Ma.appendChild(e),
e.innerHTML=a.outerHTML,e=e.firstChild);var h=e;if(!(m.support.noCloneEvent&&m.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(p(a,h),e=q(a),f=q(h),g=0;e[g];++g)f[g]&&p(e[g],f[g]);if(b&&(n(a,h),c))for(e=q(a),f=q(h),g=0;e[g];++g)n(e[g],f[g]);return h},clean:function(a,b,c,e){b=b||y;"undefined"===typeof b.createElement&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||y);for(var f=[],g,h=0,d;null!=(d=a[h]);h++)if("number"===typeof d&&(d+=""),d){if("string"===typeof d)if(fb.test(d)){d=
d.replace(ja,"<$1></$2>");g=(Ja.exec(d)||["",""])[1].toLowerCase();var k=ba[g]||ba._default,q=k[0],p=b.createElement("div");b===y?Ma.appendChild(p):l(b).appendChild(p);for(p.innerHTML=k[1]+d+k[2];q--;)p=p.lastChild;if(!m.support.tbody)for(q=eb.test(d),k="table"!==g||q?"<table>"!==k[1]||q?[]:p.childNodes:p.firstChild&&p.firstChild.childNodes,g=k.length-1;0<=g;--g)m.nodeName(k[g],"tbody")&&!k[g].childNodes.length&&k[g].parentNode.removeChild(k[g]);!m.support.leadingWhitespace&&va.test(d)&&p.insertBefore(b.createTextNode(va.exec(d)[0]),
p.firstChild);d=p.childNodes}else d=b.createTextNode(d);var n;if(!m.support.appendChecked)if(d[0]&&"number"===typeof(n=d.length))for(g=0;g<n;g++)r(d[g]);else r(d);d.nodeType?f.push(d):f=m.merge(f,d)}if(c)for(a=function(a){return!a.type||ib.test(a.type)},h=0;f[h];h++)!e||!m.nodeName(f[h],"script")||f[h].type&&"text/javascript"!==f[h].type.toLowerCase()?(1===f[h].nodeType&&(b=m.grep(f[h].getElementsByTagName("script"),a),f.splice.apply(f,[h+1,0].concat(b))),c.appendChild(f[h])):e.push(f[h].parentNode?
f[h].parentNode.removeChild(f[h]):f[h]);return f},cleanData:function(a){for(var b,c,e=m.cache,f=m.event.special,g=m.support.deleteExpando,h=0,d;null!=(d=a[h]);h++)if(!d.nodeName||!m.noData[d.nodeName.toLowerCase()])if(c=d[m.expando]){if((b=e[c])&&b.events){for(var k in b.events)f[k]?m.event.remove(d,k):m.removeEvent(d,k,b.handle);b.handle&&(b.handle.elem=null)}g?delete d[m.expando]:d.removeAttribute&&d.removeAttribute(m.expando);delete e[c]}}});var Ea=/alpha\([^)]*\)/i,jb=/opacity=([^)]*)/,kb=/([A-Z]|^ms)/g,
Na=/^-?\d+(?:px)?$/i,lb=/^-?\d/,mb=/^([\-+])=([\-+.\de]+)/,nb={position:"absolute",visibility:"hidden",display:"block"},Za=["Left","Right"],$a=["Top","Bottom"],pa,Oa,Pa;m.fn.css=function(a,b){return 2===arguments.length&&b===d?this:m.access(this,a,b,!0,function(a,b,c){return c!==d?m.style(a,b,c):m.css(a,b)})};m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=pa(a,"opacity","opacity");return""===c?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,
orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":m.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g=m.camelCase(b),h=a.style,k=m.cssHooks[g];b=m.cssProps[g]||g;if(c!==d){if(e=typeof c,"string"===e&&(f=mb.exec(c))&&(c=+(f[1]+1)*+f[2]+parseFloat(m.css(a,b)),e="number"),!(null==c||"number"===e&&isNaN(c)||("number"!==e||m.cssNumber[g]||(c+="px"),k&&"set"in k&&(c=k.set(a,c))===d)))try{h[b]=c}catch(l){}}else return k&&"get"in
k&&(f=k.get(a,!1,e))!==d?f:h[b]}},css:function(a,b,c){var e,f;b=m.camelCase(b);f=m.cssHooks[b];b=m.cssProps[b]||b;"cssFloat"===b&&(b="float");if(f&&"get"in f&&(e=f.get(a,!0,c))!==d)return e;if(pa)return pa(a,b)},swap:function(a,b,c){var e={},f;for(f in b)e[f]=a.style[f],a.style[f]=b[f];c.call(a);for(f in b)a.style[f]=e[f]}});m.curCSS=m.css;m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,e){var f;if(c){if(0!==a.offsetWidth)return v(a,b,e);m.swap(a,nb,function(){f=v(a,b,e)});
return f}},set:function(a,b){if(Na.test(b)){if(b=parseFloat(b),0<=b)return b+"px"}else return b}}});m.support.opacity||(m.cssHooks.opacity={get:function(a,b){return jb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,e=a.currentStyle,f=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",g=e&&e.filter||c.filter||"";c.zoom=1;if(1<=b&&""===m.trim(g.replace(Ea,""))&&(c.removeAttribute("filter"),e&&!e.filter))return;c.filter=
Ea.test(g)?g.replace(Ea,f):g+" "+f}});m(function(){m.support.reliableMarginRight||(m.cssHooks.marginRight={get:function(a,b){var c;m.swap(a,{display:"inline-block"},function(){c=b?pa(a,"margin-right","marginRight"):a.style.marginRight});return c}})});y.defaultView&&y.defaultView.getComputedStyle&&(Oa=function(a,b){var c,e,f;b=b.replace(kb,"-$1").toLowerCase();(e=a.ownerDocument.defaultView)&&(f=e.getComputedStyle(a,null))&&(c=f.getPropertyValue(b),""!==c||m.contains(a.ownerDocument.documentElement,
a)||(c=m.style(a,b)));return c});y.documentElement.currentStyle&&(Pa=function(a,b){var c,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;null===f&&g&&(c=g[b])&&(f=c);if(!Na.test(f)&&lb.test(f)){c=g.left;if(e=a.runtimeStyle&&a.runtimeStyle.left)a.runtimeStyle.left=a.currentStyle.left;g.left="fontSize"===b?"1em":f||0;f=g.pixelLeft+"px";g.left=c;e&&(a.runtimeStyle.left=e)}return""===f?"auto":f});pa=Oa||Pa;m.expr&&m.expr.filters&&(m.expr.filters.hidden=function(a){var b=a.offsetHeight;return 0===a.offsetWidth&&
0===b||!m.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)});var ob=/%20/g,ab=/\[\]$/,Qa=/\r?\n/g,pb=/#.*$/,qb=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,rb=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,sb=/^(?:GET|HEAD)$/,tb=/^\/\//,Ra=/\?/,ub=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,vb=/^(?:select|textarea)/i,Ga=/\s+/,wb=
/([?&])_=[^&]*/,Sa=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,Ta=m.fn.load,Ba={},Ua={},ma,na,Va=["*/"]+["*"];try{ma=Y.href}catch(Cb){ma=y.createElement("a"),ma.href="",ma=ma.href}na=Sa.exec(ma.toLowerCase())||[];m.fn.extend({load:function(a,b,c){if("string"!==typeof a&&Ta)return Ta.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(0<=e){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";b&&(m.isFunction(b)?(c=b,b=d):"object"===typeof b&&(b=m.param(b,m.ajaxSettings.traditional),
e="POST"));var g=this;m.ajax({url:a,type:e,dataType:"html",data:b,complete:function(a,b,e){e=a.responseText;a.isResolved()&&(a.done(function(a){e=a}),g.html(f?m("<div>").append(e.replace(ub,"")).find(f):e));c&&g.each(c,[e,b,a])}});return this},serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?m.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||vb.test(this.nodeName)||
rb.test(this.type))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a,c){return{name:b.name,value:a.replace(Qa,"\r\n")}}):{name:b.name,value:c.replace(Qa,"\r\n")}}).get()}});m.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){m.fn[b]=function(a){return this.on(b,a)}});m.each(["get","post"],function(a,b){m[b]=function(a,c,e,f){m.isFunction(c)&&(f=f||e,e=c,c=d);return m.ajax({type:b,url:a,data:c,success:e,dataType:f})}});
m.extend({getScript:function(a,b){return m.get(a,d,b,"script")},getJSON:function(a,b,c){return m.get(a,b,c,"json")},ajaxSetup:function(a,b){b?B(a,m.ajaxSettings):(b=a,a=m.ajaxSettings);B(a,b);return a},ajaxSettings:{url:ma,isLocal:/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/.test(na[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",
"*":Va},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:u(Ba),ajaxTransport:u(Ua),ajax:function(a,b){function c(a,b,p,n){if(2!==z){z=2;w&&clearTimeout(w);v=d;s=n||"";L.readyState=0<a?4:0;var r,u,x;n=b;if(p){var H=e,S=L,E=H.contents,C=H.dataTypes,la=H.responseFields,D,y,A,I;for(y in la)y in p&&(S[la[y]]=p[y]);
for(;"*"===C[0];)C.shift(),D===d&&(D=H.mimeType||S.getResponseHeader("content-type"));if(D)for(y in E)if(E[y]&&E[y].test(D)){C.unshift(y);break}if(C[0]in p)A=C[0];else{for(y in p){if(!C[0]||H.converters[y+" "+C[0]]){A=y;break}I||(I=y)}A=A||I}A?(A!==C[0]&&C.unshift(A),p=p[A]):p=void 0}else p=d;if(200<=a&&300>a||304===a){if(e.ifModified){if(D=L.getResponseHeader("Last-Modified"))m.lastModified[q]=D;if(D=L.getResponseHeader("Etag"))m.etag[q]=D}if(304===a)n="notmodified",r=!0;else try{D=e;D.dataFilter&&
(p=D.dataFilter(p,D.dataType));var Aa=D.dataTypes;y={};var F,sa,Xa=Aa.length,J,N=Aa[0],ka,oa,G,ha,ja;for(F=1;F<Xa;F++){if(1===F)for(sa in D.converters)"string"===typeof sa&&(y[sa.toLowerCase()]=D.converters[sa]);ka=N;N=Aa[F];if("*"===N)N=ka;else if("*"!==ka&&ka!==N){oa=ka+" "+N;G=y[oa]||y["* "+N];if(!G)for(ha in ja=d,y)if(J=ha.split(" "),J[0]===ka||"*"===J[0])if(ja=y[J[1]+" "+N]){ha=y[ha];!0===ha?G=ja:!0===ja&&(G=ha);break}G||ja||m.error("No conversion from "+oa.replace(" "," to "));!0!==G&&(p=G?
G(p):ja(ha(p)))}}u=p;n="success";r=!0}catch(va){n="parsererror",x=va}}else if(x=n,!n||a)n="error",0>a&&(a=0);L.status=a;L.statusText=""+(b||n);r?h.resolveWith(f,[u,n,L]):h.rejectWith(f,[L,n,x]);L.statusCode(l);l=d;B&&g.trigger("ajax"+(r?"Success":"Error"),[L,e,r?u:x]);k.fireWith(f,[L,n]);B&&(g.trigger("ajaxComplete",[L,e]),--m.active||m.event.trigger("ajaxStop"))}}"object"===typeof a&&(b=a,a=d);b=b||{};var e=m.ajaxSetup({},b),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof m)?m(f):m.event,h=m.Deferred(),
k=m.Callbacks("once memory"),l=e.statusCode||{},q,p={},n={},s,r,v,w,u,z=0,B,S,L={readyState:0,setRequestHeader:function(a,b){if(!z){var c=a.toLowerCase();a=n[c]=n[c]||a;p[a]=b}return this},getAllResponseHeaders:function(){return 2===z?s:null},getResponseHeader:function(a){var b;if(2===z){if(!r)for(r={};b=qb.exec(s);)r[b[1].toLowerCase()]=b[2];b=r[a.toLowerCase()]}return b===d?null:b},overrideMimeType:function(a){z||(e.mimeType=a);return this},abort:function(a){a=a||"abort";v&&v.abort(a);c(0,a);return this}};
h.promise(L);L.success=L.done;L.error=L.fail;L.complete=k.add;L.statusCode=function(a){if(a){var b;if(2>z)for(b in a)l[b]=[l[b],a[b]];else b=a[L.status],L.then(b,b)}return this};e.url=((a||e.url)+"").replace(pb,"").replace(tb,na[1]+"//");e.dataTypes=m.trim(e.dataType||"*").toLowerCase().split(Ga);null==e.crossDomain&&(u=Sa.exec(e.url.toLowerCase()),e.crossDomain=!(!u||u[1]==na[1]&&u[2]==na[2]&&(u[3]||("http:"===u[1]?80:443))==(na[3]||("http:"===na[1]?80:443))));e.data&&e.processData&&"string"!==typeof e.data&&
(e.data=m.param(e.data,e.traditional));x(Ba,e,b,L);if(2===z)return!1;B=e.global;e.type=e.type.toUpperCase();e.hasContent=!sb.test(e.type);B&&0===m.active++&&m.event.trigger("ajaxStart");if(!e.hasContent&&(e.data&&(e.url+=(Ra.test(e.url)?"&":"?")+e.data,delete e.data),q=e.url,!1===e.cache)){u=m.now();var E=e.url.replace(wb,"$1_="+u);e.url=E+(E===e.url?(Ra.test(e.url)?"&":"?")+"_="+u:"")}(e.data&&e.hasContent&&!1!==e.contentType||b.contentType)&&L.setRequestHeader("Content-Type",e.contentType);e.ifModified&&
(q=q||e.url,m.lastModified[q]&&L.setRequestHeader("If-Modified-Since",m.lastModified[q]),m.etag[q]&&L.setRequestHeader("If-None-Match",m.etag[q]));L.setRequestHeader("Accept",e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+("*"!==e.dataTypes[0]?", "+Va+"; q=0.01":""):e.accepts["*"]);for(S in e.headers)L.setRequestHeader(S,e.headers[S]);if(e.beforeSend&&(!1===e.beforeSend.call(f,L,e)||2===z))return L.abort(),!1;for(S in{success:1,error:1,complete:1})L[S](e[S]);if(v=x(Ua,e,b,L)){L.readyState=
1;B&&g.trigger("ajaxSend",[L,e]);e.async&&0<e.timeout&&(w=setTimeout(function(){L.abort("timeout")},e.timeout));try{z=1,v.send(p,c)}catch(C){if(2>z)c(-1,C);else throw C;}}else c(-1,"No Transport");return L},param:function(a,b){var c=[],e=function(a,b){b=m.isFunction(b)?b():b;c[c.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};b===d&&(b=m.ajaxSettings.traditional);if(m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(var f in a)A(f,a[f],b,e);
return c.join("&").replace(ob,"+")}});m.extend({active:0,lastModified:{},etag:{}});var xb=m.now(),ya=/(\=)\?(&|$)|\?\?/i;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return m.expando+"_"+xb++}});m.ajaxPrefilter("json jsonp",function(b,c,e){c="application/x-www-form-urlencoded"===b.contentType&&"string"===typeof b.data;if("jsonp"===b.dataTypes[0]||!1!==b.jsonp&&(ya.test(b.url)||c&&ya.test(b.data))){var f,g=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=
a[g],d=b.url,k=b.data,l="$1"+g+"$2";!1!==b.jsonp&&(d=d.replace(ya,l),b.url===d&&(c&&(k=k.replace(ya,l)),b.data===k&&(d+=(/\?/.test(d)?"&":"?")+b.jsonp+"="+g)));b.url=d;b.data=k;a[g]=function(a){f=[a]};e.always(function(){a[g]=h;if(f&&m.isFunction(h))a[g](f[0])});b.converters["script json"]=function(){f||m.error(g+" was not called");return f[0]};b.dataTypes[0]="json";return"script"}});m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},
contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){m.globalEval(a);return a}}});m.ajaxPrefilter("script",function(a){a.cache===d&&(a.cache=!1);a.crossDomain&&(a.type="GET",a.global=!1)});m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||y.getElementsByTagName("head")[0]||y.documentElement;return{send:function(e,f){b=y.createElement("script");b.async="async";a.scriptCharset&&(b.charset=a.scriptCharset);b.src=a.url;b.onload=b.onreadystatechange=function(a,
e){if(e||!b.readyState||/loaded|complete/.test(b.readyState))b.onload=b.onreadystatechange=null,c&&b.parentNode&&c.removeChild(b),b=d,e||f(200,"success")};c.insertBefore(b,c.firstChild)},abort:function(){if(b)b.onload(0,1)}}}});var Fa=a.ActiveXObject?function(){for(var a in ta)ta[a](0,1)}:!1,yb=0,ta;m.ajaxSettings.xhr=a.ActiveXObject?function(){var b;if(!(b=!this.isLocal&&z()))a:{try{b=new a.ActiveXObject("Microsoft.XMLHTTP");break a}catch(c){}b=void 0}return b}:z;(function(a){m.extend(m.support,
{ajax:!!a,cors:!!a&&"withCredentials"in a})})(m.ajaxSettings.xhr());m.support.ajax&&m.ajaxTransport(function(b){if(!b.crossDomain||m.support.cors){var c;return{send:function(e,f){var g=b.xhr(),h,k;b.username?g.open(b.type,b.url,b.async,b.username,b.password):g.open(b.type,b.url,b.async);if(b.xhrFields)for(k in b.xhrFields)g[k]=b.xhrFields[k];b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType);b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");try{for(k in e)g.setRequestHeader(k,
e[k])}catch(l){}g.send(b.hasContent&&b.data||null);c=function(a,e){var k,l,q,p,n;try{if(c&&(e||4===g.readyState))if(c=d,h&&(g.onreadystatechange=m.noop,Fa&&delete ta[h]),e)4!==g.readyState&&g.abort();else{k=g.status;q=g.getAllResponseHeaders();p={};(n=g.responseXML)&&n.documentElement&&(p.xml=n);p.text=g.responseText;try{l=g.statusText}catch(s){l=""}k||!b.isLocal||b.crossDomain?1223===k&&(k=204):k=p.text?200:404}}catch(r){e||f(-1,r)}p&&f(k,l,p,q)};b.async&&4!==g.readyState?(h=++yb,Fa&&(ta||(ta={},
m(a).unload(Fa)),ta[h]=c),g.onreadystatechange=c):c()},abort:function(){c&&c(0,1)}}}});var Ca={},fa,qa,zb=/^(?:toggle|show|hide)$/,Ab=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,za,Ha=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],wa;m.fn.extend({show:function(a,b,c){if(a||0===a)return this.animate(I("show",3),a,b,c);c=0;for(var e=this.length;c<e;c++)a=this[c],a.style&&(b=a.style.display,m._data(a,"olddisplay")||
"none"!==b||(b=a.style.display=""),""===b&&"none"===m.css(a,"display")&&m._data(a,"olddisplay",F(a.nodeName)));for(c=0;c<e;c++)if(a=this[c],a.style&&(b=a.style.display,""===b||"none"===b))a.style.display=m._data(a,"olddisplay")||"";return this},hide:function(a,b,c){if(a||0===a)return this.animate(I("hide",3),a,b,c);c=0;for(var e=this.length;c<e;c++)a=this[c],a.style&&(b=m.css(a,"display"),"none"===b||m._data(a,"olddisplay")||m._data(a,"olddisplay",b));for(c=0;c<e;c++)this[c].style&&(this[c].style.display=
"none");return this},_toggle:m.fn.toggle,toggle:function(a,b,c){var e="boolean"===typeof a;m.isFunction(a)&&m.isFunction(b)?this._toggle.apply(this,arguments):null==a||e?this.each(function(){var b=e?a:m(this).is(":hidden");m(this)[b?"show":"hide"]()}):this.animate(I("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,e)},animate:function(a,b,c,e){function f(){!1===g.queue&&m._mark(this);var b=m.extend({},g),c=
1===this.nodeType,e=c&&m(this).is(":hidden"),h,d,k,l,q;b.animatedProperties={};for(k in a){h=m.camelCase(k);k!==h&&(a[h]=a[k],delete a[k]);d=a[h];m.isArray(d)?(b.animatedProperties[h]=d[1],d=a[h]=d[0]):b.animatedProperties[h]=b.specialEasing&&b.specialEasing[h]||b.easing||"swing";if("hide"===d&&e||"show"===d&&!e)return b.complete.call(this);!c||"height"!==h&&"width"!==h||(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],"inline"===m.css(this,"display")&&"none"===m.css(this,
"float")&&(m.support.inlineBlockNeedsLayout&&"inline"!==F(this.nodeName)?this.style.zoom=1:this.style.display="inline-block"))}null!=b.overflow&&(this.style.overflow="hidden");for(k in a)if(c=new m.fx(this,b,k),d=a[k],zb.test(d))if(h=m._data(this,"toggle"+k)||("toggle"===d?e?"show":"hide":0))m._data(this,"toggle"+k,"show"===h?"hide":"show"),c[h]();else c[d]();else h=Ab.exec(d),l=c.cur(),h?(d=parseFloat(h[2]),q=h[3]||(m.cssNumber[k]?"":"px"),"px"!==q&&(m.style(this,k,(d||1)+q),l*=(d||1)/c.cur(),m.style(this,
k,l+q)),h[1]&&(d=("-="===h[1]?-1:1)*d+l),c.custom(l,d,q)):c.custom(l,d,"");return!0}var g=m.speed(b,c,e);if(m.isEmptyObject(a))return this.each(g.complete,[!1]);a=m.extend({},a);return!1===g.queue?this.each(f):this.queue(g.queue,f)},stop:function(a,b,c){"string"!==typeof a&&(c=b,b=a,a=d);b&&!1!==a&&this.queue(a||"fx",[]);return this.each(function(){var b,e=!1,f=m.timers,g=m._data(this);c||m._unmark(!0,this);if(null==a)for(b in g){if(g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4){var h=g[b];m.removeData(this,
b,!0);h.stop(c)}}else g[b=a+".run"]&&g[b].stop&&(g=g[b],m.removeData(this,b,!0),g.stop(c));for(b=f.length;b--;)if(f[b].elem===this&&(null==a||f[b].queue===a)){if(c)f[b](!0);else f[b].saveState();e=!0;f.splice(b,1)}c&&e||m.dequeue(this,a)})}});m.each({slideDown:I("show",1),slideUp:I("hide",1),slideToggle:I("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,e){return this.animate(b,a,c,e)}});m.extend({speed:function(a,b,c){var e=
a&&"object"===typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};e.duration=m.fx.off?0:"number"===typeof e.duration?e.duration:e.duration in m.fx.speeds?m.fx.speeds[e.duration]:m.fx.speeds._default;if(null==e.queue||!0===e.queue)e.queue="fx";e.old=e.complete;e.complete=function(a){m.isFunction(e.old)&&e.old.call(this);e.queue?m.dequeue(this,e.queue):!1!==a&&m._unmark(this)};return e},easing:{linear:function(a,b,c,e){return c+e*a},swing:function(a,
b,c,e){return(-Math.cos(a*Math.PI)/2+0.5)*e+c}},timers:[],fx:function(a,b,c){this.options=b;this.elem=a;this.prop=c;b.orig=b.orig||{}}});m.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(m.fx.step[this.prop]||m.fx.step._default)(this)},cur:function(){if(null!=this.elem[this.prop]&&(!this.elem.style||null==this.elem.style[this.prop]))return this.elem[this.prop];var a,b=m.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?b&&"auto"!==b?b:0:a},
custom:function(a,b,c){function e(a){return f.step(a)}var f=this,g=m.fx;this.startTime=wa||D();this.end=b;this.now=this.start=a;this.pos=this.state=0;this.unit=c||this.unit||(m.cssNumber[this.prop]?"":"px");e.queue=this.options.queue;e.elem=this.elem;e.saveState=function(){f.options.hide&&m._data(f.elem,"fxshow"+f.prop)===d&&m._data(f.elem,"fxshow"+f.prop,f.start)};e()&&m.timers.push(e)&&!za&&(za=setInterval(g.tick,g.interval))},show:function(){var a=m._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=
a||m.style(this.elem,this.prop);this.options.show=!0;a!==d?this.custom(this.cur(),a):this.custom("width"===this.prop||"height"===this.prop?1:0,this.cur());m(this.elem).show()},hide:function(){this.options.orig[this.prop]=m._data(this.elem,"fxshow"+this.prop)||m.style(this.elem,this.prop);this.options.hide=!0;this.custom(this.cur(),0)},step:function(a){var b,c=wa||D(),e=!0,f=this.elem,g=this.options;if(a||c>=g.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();g.animatedProperties[this.prop]=
!0;for(b in g.animatedProperties)!0!==g.animatedProperties[b]&&(e=!1);if(e){null==g.overflow||m.support.shrinkWrapBlocks||m.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]});g.hide&&m(f).hide();if(g.hide||g.show)for(b in g.animatedProperties)m.style(f,b,g.orig[b]),m.removeData(f,"fxshow"+b,!0),m.removeData(f,"toggle"+b,!0);if(a=g.complete)g.complete=!1,a.call(f)}return!1}Infinity==g.duration?this.now=c:(a=c-this.startTime,this.state=a/g.duration,this.pos=m.easing[g.animatedProperties[this.prop]](this.state,
a,0,1,g.duration),this.now=this.start+(this.end-this.start)*this.pos);this.update();return!0}};m.extend(m.fx,{tick:function(){for(var a,b=m.timers,c=0;c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop()},interval:13,stop:function(){clearInterval(za);za=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){m.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&null!=a.elem.style[a.prop]?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}});
m.each(["width","height"],function(a,b){m.fx.step[b]=function(a){m.style(a.elem,b,Math.max(0,a.now)+a.unit)}});m.expr&&m.expr.filters&&(m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length});var Bb=/^t(?:able|d|h)$/i,Wa=/^(?:body|html)$/i;m.fn.offset="getBoundingClientRect"in y.documentElement?function(a){var b=this[0],c;if(a)return this.each(function(b){m.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return m.offset.bodyOffset(b);
try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!m.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};b=f.body;f=C(f);return{top:c.top+(f.pageYOffset||m.support.boxModel&&g.scrollTop||b.scrollTop)-(g.clientTop||b.clientTop||0),left:c.left+(f.pageXOffset||m.support.boxModel&&g.scrollLeft||b.scrollLeft)-(g.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(b){m.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;
if(b===b.ownerDocument.body)return m.offset.bodyOffset(b);var c,e=b.offsetParent,f=b.ownerDocument,g=f.documentElement,h=f.body;c=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;for(var d=b.offsetTop,k=b.offsetLeft;(b=b.parentNode)&&b!==h&&b!==g&&(!m.support.fixedPosition||"fixed"!==c.position);)c=f?f.getComputedStyle(b,null):b.currentStyle,d-=b.scrollTop,k-=b.scrollLeft,b===e&&(d+=b.offsetTop,k+=b.offsetLeft,!m.support.doesNotAddBorder||m.support.doesAddBorderForTableAndCells&&Bb.test(b.nodeName)||
(d+=parseFloat(c.borderTopWidth)||0,k+=parseFloat(c.borderLeftWidth)||0),e=b.offsetParent),m.support.subtractsBorderForOverflowNotVisible&&"visible"!==c.overflow&&(d+=parseFloat(c.borderTopWidth)||0,k+=parseFloat(c.borderLeftWidth)||0);if("relative"===c.position||"static"===c.position)d+=h.offsetTop,k+=h.offsetLeft;m.support.fixedPosition&&"fixed"===c.position&&(d+=Math.max(g.scrollTop,h.scrollTop),k+=Math.max(g.scrollLeft,h.scrollLeft));return{top:d,left:k}};m.offset={bodyOffset:function(a){var b=
a.offsetTop,c=a.offsetLeft;m.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(m.css(a,"marginTop"))||0,c+=parseFloat(m.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=m.css(a,"position");"static"===e&&(a.style.position="relative");var f=m(a),g=f.offset(),h=m.css(a,"top"),d=m.css(a,"left"),k={},l={};("absolute"===e||"fixed"===e)&&-1<m.inArray("auto",[h,d])?(l=f.position(),e=l.top,d=l.left):(e=parseFloat(h)||0,d=parseFloat(d)||0);m.isFunction(b)&&(b=b.call(a,c,
g));null!=b.top&&(k.top=b.top-g.top+e);null!=b.left&&(k.left=b.left-g.left+d);"using"in b?b.using.call(a,k):f.css(k)}};m.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=Wa.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(m.css(a,"marginTop"))||0;c.left-=parseFloat(m.css(a,"marginLeft"))||0;e.top+=parseFloat(m.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(m.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-
e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||y.body;a&&!Wa.test(a.nodeName)&&"static"===m.css(a,"position");)a=a.offsetParent;return a})}});m.each(["Left","Top"],function(a,b){var c="scroll"+b;m.fn[c]=function(b){var e,f;return b===d?(e=this[0],e?(f=C(e))?"pageXOffset"in f?f[a?"pageYOffset":"pageXOffset"]:m.support.boxModel&&f.document.documentElement[c]||f.document.body[c]:e[c]:null):this.each(function(){(f=C(this))?f.scrollTo(a?m(f).scrollLeft():b,a?b:
m(f).scrollTop()):this[c]=b})}});m.each(["Height","Width"],function(a,b){var c=b.toLowerCase();m.fn["inner"+b]=function(){var a=this[0];return a?a.style?parseFloat(m.css(a,c,"padding")):this[c]():null};m.fn["outer"+b]=function(a){var b=this[0];return b?b.style?parseFloat(m.css(b,c,a?"margin":"border")):this[c]():null};m.fn[c]=function(a){var e=this[0];if(!e)return null==a?null:this;if(m.isFunction(a))return this.each(function(b){var e=m(this);e[c](a.call(this,b,e[c]()))});if(m.isWindow(e)){var f=
e.document.documentElement["client"+b],g=e.document.body;return"CSS1Compat"===e.document.compatMode&&f||g&&g["client"+b]||f}return 9===e.nodeType?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):a===d?(e=m.css(e,c),f=parseFloat(e),m.isNumeric(f)?f:e):this.css(c,"string"===typeof a?a:a+"px")}});a.jQuery=a.$=m;"function"===typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return m})})(window);
(function(a,d){function b(b){return!a(b).parents().andSelf().filter(function(){return"hidden"===a.curCSS(this,"visibility")||a.expr.filters.hidden(this)}).length}function c(c,d){var h=c.nodeName.toLowerCase();if("area"===h){var h=c.parentNode,g=h.name;if(!c.href||!g||"map"!==h.nodeName.toLowerCase())return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&b(h)}return(/input|select|textarea|button|object/.test(h)?!c.disabled:"a"==h?c.href||d:d)&&b(c)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return"number"==typeof b?this.each(function(){var h=
this;setTimeout(function(){a(h).focus();c&&c.call(h)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,
"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(b){if(b!==d)return this.css("zIndex",b);if(this.length){b=a(this[0]);for(var c;b.length&&b[0]!==document;){c=b.css("position");if("absolute"===c||"relative"===c||"fixed"===c)if(c=parseInt(b.css("zIndex"),10),!isNaN(c)&&0!==c)return c;b=b.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(b,c){function h(b,c,e,f){a.each(g,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0;e&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0);f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var g="Width"===c?["Left","Right"]:["Top","Bottom"],e=c.toLowerCase(),l={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,
outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+c]=function(b){return b===d?l["inner"+c].call(this):this.each(function(){a(this).css(e,h(this,b)+"px")})};a.fn["outer"+c]=function(b,f){return"number"!=typeof b?l["outer"+c].call(this,b):this.each(function(){a(this).css(e,h(this,b,!0,f)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,h){return!!a.data(b,h[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),h=isNaN(d);
return(h||0<=d)&&c(b,!h)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=100===c.offsetHeight;a.support.selectstart="onselectstart"in c;b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,h){b=a.ui[b].prototype;for(var g in h)b.plugins[g]=b.plugins[g]||[],b.plugins[g].push([c,h[g]])},call:function(a,b,c){if((b=a.plugins[b])&&a.element[0].parentNode)for(var g=
0;g<b.length;g++)a.options[b[g][0]]&&b[g][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if("hidden"===a(b).css("overflow"))return!1;var h=c&&"left"===c?"scrollLeft":"scrollTop",g=!1;if(0<b[h])return!0;b[h]=1;g=0<b[h];b[h]=0;return g},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,h,g,e,d){return a.ui.isOverAxis(b,h,e)&&a.ui.isOverAxis(c,g,d)}}))})(jQuery);
(function(a,d){if(a.cleanData){var b=a.cleanData;a.cleanData=function(c){for(var d=0,h;null!=(h=c[d]);d++)try{a(h).triggerHandler("remove")}catch(g){}b(c)}}else{var c=a.fn.remove;a.fn.remove=function(b,d){return this.each(function(){d||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}});return c.call(a(this),b,d)})}}a.widget=function(b,c,h){var g=b.split(".")[0],e;b=b.split(".")[1];e=g+"-"+b;h||(h=c,c=a.Widget);a.expr[":"][e]=
function(c){return!!a.data(c,b)};a[g]=a[g]||{};a[g][b]=function(a,b){arguments.length&&this._createWidget(a,b)};c=new c;c.options=a.extend(!0,{},c.options);a[g][b].prototype=a.extend(!0,c,{namespace:g,widgetName:b,widgetEventPrefix:a[g][b].prototype.widgetEventPrefix||b,widgetBaseClass:e},h);a.widget.bridge(b,a[g][b])};a.widget.bridge=function(b,c){a.fn[b]=function(h){var g="string"==typeof h,e=Array.prototype.slice.call(arguments,1),l=this;h=!g&&e.length?a.extend.apply(null,[!0,h].concat(e)):h;if(g&&
"_"===h.charAt(0))return l;g?this.each(function(){var c=a.data(this,b),g=c&&a.isFunction(c[h])?c[h].apply(c,e):c;if(g!==c&&g!==d)return l=g,!1}):this.each(function(){var e=a.data(this,b);e?e.option(h||{})._init():a.data(this,b,new c(h,this))});return l}};a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this);this.element=a(c);this.options=a.extend(!0,
{},this.options,this._getCreateOptions(),b);var h=this;this.element.bind("remove."+this.widgetName,function(){h.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,c){var h=b;if(0===arguments.length)return a.extend({},this.options);if("string"==typeof b){if(c===d)return this.options[b];h={};h[b]=c}this._setOptions(h);return this},_setOptions:function(b){var c=this;a.each(b,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b;"disabled"===a&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
b);return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,h){var g,e=this.options[b];h=h||{};c=a.Event(c);c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();c.target=this.element[0];if(b=c.originalEvent)for(g in b)g in c||(c[g]=b[g]);this.element.trigger(c,h);return!(a.isFunction(e)&&!1===e.call(this.element[0],c,h)||c.isDefaultPrevented())}}})(jQuery);
(function(a,d){var b=!1;a(document).mouseup(function(a){b=!1});a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(f){if(!0===a.data(f.target,b.widgetName+".preventClickEvent"))return a.removeData(f.target,b.widgetName+".preventClickEvent"),f.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(c){if(!b){this._mouseStarted&&this._mouseUp(c);this._mouseDownEvent=c;var f=this,d=1==c.which,h="string"==typeof this.options.cancel&&c.target.nodeName?a(c.target).closest(this.options.cancel).length:!1;if(!d||h||!this._mouseCapture(c))return!0;(this.mouseDelayMet=!this.options.delay)||(this._mouseDelayTimer=setTimeout(function(){f.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(c)&&this._mouseDelayMet(c)&&(this._mouseStarted=!1!==this._mouseStart(c),
!this._mouseStarted))return c.preventDefault(),!0;!0===a.data(c.target,this.widgetName+".preventClickEvent")&&a.removeData(c.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(a){return f._mouseMove(a)};this._mouseUpDelegate=function(a){return f._mouseUp(a)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);c.preventDefault();return b=!0}},_mouseMove:function(b){if(a.browser.msie&&!(9<=document.documentMode||
b.button))return this._mouseUp(b);if(this._mouseStarted)return this._mouseDrag(b),b.preventDefault();this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,b),this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);this._mouseStarted&&(this._mouseStarted=!1,b.target==
this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);
(function(a,d){a.ui=a.ui||{};var b=/left|center|right/,c=/top|center|bottom/,f={},k=a.fn.position,h=a.fn.offset;a.fn.position=function(g){if(!g||!g.of)return k.apply(this,arguments);g=a.extend({},g);var e=a(g.of),h=e[0],d=(g.collision||"flip").split(" "),p=g.offset?g.offset.split(" "):[0,0],q,s,r;9===h.nodeType?(q=e.width(),s=e.height(),r={top:0,left:0}):h.setTimeout?(q=e.width(),s=e.height(),r={top:e.scrollTop(),left:e.scrollLeft()}):h.preventDefault?(g.at="left top",q=s=0,r={top:g.of.pageY,left:g.of.pageX}):
(q=e.outerWidth(),s=e.outerHeight(),r=e.offset());a.each(["my","at"],function(){var a=(g[this]||"").split(" ");1===a.length&&(a=b.test(a[0])?a.concat(["center"]):c.test(a[0])?["center"].concat(a):["center","center"]);a[0]=b.test(a[0])?a[0]:"center";a[1]=c.test(a[1])?a[1]:"center";g[this]=a});1===d.length&&(d[1]=d[0]);p[0]=parseInt(p[0],10)||0;1===p.length&&(p[1]=p[0]);p[1]=parseInt(p[1],10)||0;"right"===g.at[0]?r.left+=q:"center"===g.at[0]&&(r.left+=q/2);"bottom"===g.at[1]?r.top+=s:"center"===g.at[1]&&
(r.top+=s/2);r.left+=p[0];r.top+=p[1];return this.each(function(){var b=a(this),c=b.outerWidth(),e=b.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,k=parseInt(a.curCSS(this,"marginTop",!0))||0,l=c+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),z=e+k+(parseInt(a.curCSS(this,"marginBottom",!0))||0),D=a.extend({},r),E;"right"===g.my[0]?D.left-=c:"center"===g.my[0]&&(D.left-=c/2);"bottom"===g.my[1]?D.top-=e:"center"===g.my[1]&&(D.top-=e/2);f.fractions||(D.left=Math.round(D.left),D.top=
Math.round(D.top));E={left:D.left-h,top:D.top-k};a.each(["left","top"],function(b,f){a.ui.position[d[b]]&&a.ui.position[d[b]][f](D,{targetWidth:q,targetHeight:s,elemWidth:c,elemHeight:e,collisionPosition:E,collisionWidth:l,collisionHeight:z,offset:p,my:g.my,at:g.at})});a.fn.bgiframe&&b.bgiframe();b.offset(a.extend(D,{using:g.using}))})};a.ui.position={fit:{left:function(b,c){var f=a(window),f=c.collisionPosition.left+c.collisionWidth-f.width()-f.scrollLeft();b.left=0<f?b.left-f:Math.max(b.left-c.collisionPosition.left,
b.left)},top:function(b,c){var f=a(window),f=c.collisionPosition.top+c.collisionHeight-f.height()-f.scrollTop();b.top=0<f?b.top-f:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if("center"!==c.at[0]){var f=a(window),f=c.collisionPosition.left+c.collisionWidth-f.width()-f.scrollLeft(),h="left"===c.my[0]?-c.elemWidth:"right"===c.my[0]?c.elemWidth:0,d="left"===c.at[0]?c.targetWidth:-c.targetWidth,k=-2*c.offset[0];b.left+=0>c.collisionPosition.left?h+d+k:0<f?h+d+k:0}},top:function(b,
c){if("center"!==c.at[1]){var f=a(window),f=c.collisionPosition.top+c.collisionHeight-f.height()-f.scrollTop(),h="top"===c.my[1]?-c.elemHeight:"bottom"===c.my[1]?c.elemHeight:0,d="top"===c.at[1]?c.targetHeight:-c.targetHeight,k=-2*c.offset[1];b.top+=0>c.collisionPosition.top?h+d+k:0<f?h+d+k:0}}}};a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var f=a(b),h=f.offset(),d=parseInt(a.curCSS(b,"top",!0),10)||0,k=parseInt(a.curCSS(b,
"left",!0),10)||0,h={top:c.top-h.top+d,left:c.left-h.left+k};"using"in c?c.using.call(b,h):f.css(h)},a.fn.offset=function(b){var c=this[0];return c&&c.ownerDocument?b?this.each(function(){a.offset.setOffset(this,b)}):h.call(this):null});(function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),h,d;h=document.createElement(b?"div":"body");d={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};b&&jQuery.extend(d,{position:"absolute",left:"-1000px",
top:"-1000px"});for(var k in d)h.style[k]=d[k];h.appendChild(c);d=b||document.documentElement;d.insertBefore(h,d.firstChild);c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";c=a(c).offset(function(a,b){return b}).offset();h.innerHTML="";d.removeChild(h);b=c.top+c.left+(b?2E3:0);f.fractions=21<b&&22>b})()})(jQuery);
(function(a,d){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){"original"==this.options.helper&&!/^(?:r|a|f)/.test(this.element.css("position"))&&
(this.element[0].style.position="relative");this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable"))return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle"))return!1;
this.handle=this._getHandle(b);if(!this.handle)return!1;c.iframeFix&&a(!0===c.iframeFix?"iframe":c.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(a(this).offset()).appendTo("body")});return!0},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();a.ui.ddmanager&&(a.ui.ddmanager.current=
this);this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(b);this.originalPageX=b.pageX;
this.originalPageY=b.pageY;c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt);c.containment&&this._setContainment();if(!1===this._trigger("start",b))return this._clear(),!1;this._cacheHelperProportions();a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,!0);a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b);return!0},_mouseDrag:function(b,c){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");
if(!c){var f=this._uiHash();if(!1===this._trigger("drag",b,f))return this._mouseUp({}),!1;this.position=f.position}this.options.axis&&"y"==this.options.axis||(this.helper[0].style.left=this.position.left+"px");this.options.axis&&"x"==this.options.axis||(this.helper[0].style.top=this.position.top+"px");a.ui.ddmanager&&a.ui.ddmanager.drag(this,b);return!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b));this.dropped&&(c=this.dropped,this.dropped=
!1);if(!(this.element[0]&&this.element[0].parentNode||"original"!=this.options.helper))return!1;if("invalid"==this.options.revert&&!c||"valid"==this.options.revert&&c||!0===this.options.revert||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==f._trigger("stop",b)&&f._clear()})}else!1!==this._trigger("stop",b)&&this._clear();return!1},_mouseUp:function(b){!0===
this.options.iframeFix&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b);return a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(b){var c=this.options.handle&&a(this.options.handle,this.element).length?!1:!0;a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=
!0)});return c},_createHelper:function(b){var c=this.options;b=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):"clone"==c.helper?this.element.clone().removeAttr("id"):this.element;b.parents("body").length||b.appendTo("parent"==c.appendTo?this.element[0].parentNode:c.appendTo);b[0]!=this.element[0]&&!/(fixed|absolute)/.test(b.css("position"))&&b.css("position","absolute");return b},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" "));a.isArray(b)&&(b={left:+b[0],top:+b[1]||
0});"left"in b&&(this.offset.click.left=b.left+this.margins.left);"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left);"top"in b&&(this.offset.click.top=b.top+this.margins.top);"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();"absolute"==this.cssPosition&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],
this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var a=this.element.position();return{top:a.top-
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),
height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;"parent"==b.containment&&(b.containment=this.helper[0].parentNode);if("document"==b.containment||"window"==b.containment)this.containment=["document"==b.containment?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"==b.containment?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"==b.containment?0:a(window).scrollLeft())+a("document"==b.containment?document:
window).width()-this.helperProportions.width-this.margins.left,("document"==b.containment?0:a(window).scrollTop())+(a("document"==b.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(/^(document|window|parent)$/.test(b.containment)||b.containment.constructor==Array)b.containment.constructor==Array&&(this.containment=b.containment);else{var b=a(b.containment),c=b[0];if(c){b.offset();var f="hidden"!=a(c).css("overflow");this.containment=
[(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0),(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0),(f?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),
10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=b}}},_convertPositionTo:function(b,c){c||(c=this.position);var f="absolute"==b?1:-1,d="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(d[0].tagName);return{top:c.top+this.offset.relative.top*f+this.offset.parent.top*f-(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?
0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():h?0:d.scrollTop())*f),left:c.left+this.offset.relative.left*f+this.offset.parent.left*f-(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():h?0:d.scrollLeft())*f)}},_generatePosition:function(b){var c=this.options,f="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,
d=/(html|body)/i.test(f[0].tagName),h=b.pageX,g=b.pageY;if(this.originalPosition){var e;this.containment&&(this.relative_container?(e=this.relative_container.offset(),e=[this.containment[0]+e.left,this.containment[1]+e.top,this.containment[2]+e.left,this.containment[3]+e.top]):e=this.containment,b.pageX-this.offset.click.left<e[0]&&(h=e[0]+this.offset.click.left),b.pageY-this.offset.click.top<e[1]&&(g=e[1]+this.offset.click.top),b.pageX-this.offset.click.left>e[2]&&(h=e[2]+this.offset.click.left),
b.pageY-this.offset.click.top>e[3]&&(g=e[3]+this.offset.click.top));c.grid&&(g=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY,g=e?g-this.offset.click.top<e[1]||g-this.offset.click.top>e[3]?g-this.offset.click.top<e[1]?g+c.grid[1]:g-c.grid[1]:g:g,h=c.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/c.grid[0])*c.grid[0]:this.originalPageX,h=e?h-this.offset.click.left<e[0]||h-this.offset.click.left>e[2]?h-this.offset.click.left<e[0]?
h+c.grid[0]:h-c.grid[0]:h:h)}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():d?0:f.scrollTop()),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():d?0:f.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");
this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=!1},_trigger:function(b,c,f){f=f||this._uiHash();a.ui.plugin.call(this,b,[c,f]);"drag"==b&&(this.positionAbs=this._convertPositionTo("absolute"));return a.Widget.prototype._trigger.call(this,b,c,f)},plugins:{},_uiHash:function(a){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});a.extend(a.ui.draggable,{version:"1.8.17"});
a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var f=a(this).data("draggable"),d=f.options,h=a.extend({},c,{item:f.element});f.sortables=[];a(d.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(f.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,h))})},stop:function(b,c){var f=a(this).data("draggable"),d=a.extend({},c,{item:f.element});a.each(f.sortables,function(){this.instance.isOver?
(this.instance.isOver=0,f.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,"original"==f.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,d))})},drag:function(b,c){var f=a(this).data("draggable"),d=this;a.each(f.sortables,function(h){this.instance.positionAbs=
f.positionAbs;this.instance.helperProportions=f.helperProportions;this.instance.offset.click=f.offset.click;this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(d).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,
!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=f.offset.click.top,this.instance.offset.click.left=f.offset.click.left,this.instance.offset.parent.left-=f.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=f.offset.parent.top-this.instance.offset.parent.top,f._trigger("toSortable",b),f.dropped=this.instance.element,f.currentItem=f.element,this.instance.fromOutside=f),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&
(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),f._trigger("fromSortable",b),f.dropped=!1)})}});a.ui.plugin.add("draggable","cursor",{start:function(b,c){var f=a("body"),d=a(this).data("draggable").options;
f.css("cursor")&&(d._cursor=f.css("cursor"));f.css("cursor",d.cursor)},stop:function(b,c){var f=a(this).data("draggable").options;f._cursor&&a("body").css("cursor",f._cursor)}});a.ui.plugin.add("draggable","opacity",{start:function(b,c){var f=a(c.helper),d=a(this).data("draggable").options;f.css("opacity")&&(d._opacity=f.css("opacity"));f.css("opacity",d.opacity)},stop:function(b,c){var f=a(this).data("draggable").options;f._opacity&&a(c.helper).css("opacity",f._opacity)}});a.ui.plugin.add("draggable",
"scroll",{start:function(b,c){var f=a(this).data("draggable");f.scrollParent[0]!=document&&"HTML"!=f.scrollParent[0].tagName&&(f.overflowOffset=f.scrollParent.offset())},drag:function(b,c){var f=a(this).data("draggable"),d=f.options,h=!1;f.scrollParent[0]!=document&&"HTML"!=f.scrollParent[0].tagName?(d.axis&&"x"==d.axis||(f.overflowOffset.top+f.scrollParent[0].offsetHeight-b.pageY<d.scrollSensitivity?f.scrollParent[0].scrollTop=h=f.scrollParent[0].scrollTop+d.scrollSpeed:b.pageY-f.overflowOffset.top<
d.scrollSensitivity&&(f.scrollParent[0].scrollTop=h=f.scrollParent[0].scrollTop-d.scrollSpeed)),d.axis&&"y"==d.axis||(f.overflowOffset.left+f.scrollParent[0].offsetWidth-b.pageX<d.scrollSensitivity?f.scrollParent[0].scrollLeft=h=f.scrollParent[0].scrollLeft+d.scrollSpeed:b.pageX-f.overflowOffset.left<d.scrollSensitivity&&(f.scrollParent[0].scrollLeft=h=f.scrollParent[0].scrollLeft-d.scrollSpeed))):(d.axis&&"x"==d.axis||(b.pageY-a(document).scrollTop()<d.scrollSensitivity?h=a(document).scrollTop(a(document).scrollTop()-
d.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<d.scrollSensitivity&&(h=a(document).scrollTop(a(document).scrollTop()+d.scrollSpeed))),d.axis&&"y"==d.axis||(b.pageX-a(document).scrollLeft()<d.scrollSensitivity?h=a(document).scrollLeft(a(document).scrollLeft()-d.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<d.scrollSensitivity&&(h=a(document).scrollLeft(a(document).scrollLeft()+d.scrollSpeed))));!1!==h&&a.ui.ddmanager&&!d.dropBehaviour&&a.ui.ddmanager.prepareOffsets(f,
b)}});a.ui.plugin.add("draggable","snap",{start:function(b,c){var f=a(this).data("draggable"),d=f.options;f.snapElements=[];a(d.snap.constructor!=String?d.snap.items||":data(draggable)":d.snap).each(function(){var b=a(this),c=b.offset();this!=f.element[0]&&f.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c){for(var f=a(this).data("draggable"),d=f.options,h=d.snapTolerance,g=c.offset.left,e=g+f.helperProportions.width,l=c.offset.top,
n=l+f.helperProportions.height,p=f.snapElements.length-1;0<=p;p--){var q=f.snapElements[p].left,s=q+f.snapElements[p].width,r=f.snapElements[p].top,w=r+f.snapElements[p].height;if(q-h<g&&g<s+h&&r-h<l&&l<w+h||q-h<g&&g<s+h&&r-h<n&&n<w+h||q-h<e&&e<s+h&&r-h<l&&l<w+h||q-h<e&&e<s+h&&r-h<n&&n<w+h){if("inner"!=d.snapMode){var v=Math.abs(r-n)<=h,u=Math.abs(w-l)<=h,x=Math.abs(q-e)<=h,B=Math.abs(s-g)<=h;v&&(c.position.top=f._convertPositionTo("relative",{top:r-f.helperProportions.height,left:0}).top-f.margins.top);
u&&(c.position.top=f._convertPositionTo("relative",{top:w,left:0}).top-f.margins.top);x&&(c.position.left=f._convertPositionTo("relative",{top:0,left:q-f.helperProportions.width}).left-f.margins.left);B&&(c.position.left=f._convertPositionTo("relative",{top:0,left:s}).left-f.margins.left)}var A=v||u||x||B;"outer"!=d.snapMode&&(v=Math.abs(r-l)<=h,u=Math.abs(w-n)<=h,x=Math.abs(q-g)<=h,B=Math.abs(s-e)<=h,v&&(c.position.top=f._convertPositionTo("relative",{top:r,left:0}).top-f.margins.top),u&&(c.position.top=
f._convertPositionTo("relative",{top:w-f.helperProportions.height,left:0}).top-f.margins.top),x&&(c.position.left=f._convertPositionTo("relative",{top:0,left:q}).left-f.margins.left),B&&(c.position.left=f._convertPositionTo("relative",{top:0,left:s-f.helperProportions.width}).left-f.margins.left));!f.snapElements[p].snapping&&(v||u||x||B||A)&&f.options.snap.snap&&f.options.snap.snap.call(f.element,b,a.extend(f._uiHash(),{snapItem:f.snapElements[p].item}));f.snapElements[p].snapping=v||u||x||B||A}else f.snapElements[p].snapping&&
f.options.snap.release&&f.options.snap.release.call(f.element,b,a.extend(f._uiHash(),{snapItem:f.snapElements[p].item})),f.snapElements[p].snapping=!1}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var f=a(this).data("draggable").options,f=a.makeArray(a(f.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(f.length){var d=parseInt(f[0].style.zIndex)||0;a(f).each(function(a){this.style.zIndex=d+a});this[0].style.zIndex=d+f.length}}});
a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var f=a(c.helper),d=a(this).data("draggable").options;f.css("zIndex")&&(d._zIndex=f.css("zIndex"));f.css("zIndex",d.zIndex)},stop:function(b,c){var f=a(this).data("draggable").options;f._zIndex&&a(c.helper).css("zIndex",f._zIndex)}})})(jQuery);
(function(a,d){a.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var b=this.options,c=b.accept;this.isover=0;this.isout=1;this.accept=a.isFunction(c)?c:function(a){return a.is(c)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[];a.ui.ddmanager.droppables[b.scope].push(this);
b.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var b=a.ui.ddmanager.droppables[this.options.scope],c=0;c<b.length;c++)b[c]==this&&b.splice(c,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(b,c){"accept"==b&&(this.accept=a.isFunction(c)?c:function(a){return a.is(c)});a.Widget.prototype._setOption.apply(this,arguments)},_activate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&
this.element.addClass(this.options.activeClass);c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;c&&(c.currentItem||c.element)[0]!=this.element[0]&&this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",
b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;c&&(c.currentItem||c.element)[0]!=this.element[0]&&this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var f=c||a.ui.ddmanager.current;if(!f||(f.currentItem||f.element)[0]==this.element[0])return!1;var d=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var b=a.data(this,
"droppable");if(b.options.greedy&&!b.options.disabled&&b.options.scope==f.options.scope&&b.accept.call(b.element[0],f.currentItem||f.element)&&a.ui.intersect(f,a.extend(b,{offset:b.element.offset()}),b.options.tolerance))return d=!0,!1});return d?!1:this.accept.call(this.element[0],f.currentItem||f.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(f)),this.element):
!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});a.extend(a.ui.droppable,{version:"1.8.17"});a.ui.intersect=function(b,c,f){if(!c.offset)return!1;var d=(b.positionAbs||b.position.absolute).left,h=d+b.helperProportions.width,g=(b.positionAbs||b.position.absolute).top,e=g+b.helperProportions.height,l=c.offset.left,n=l+c.proportions.width,p=c.offset.top,q=p+c.proportions.height;switch(f){case "fit":return l<=d&&h<=n&&p<=g&&e<=q;
case "intersect":return l<d+b.helperProportions.width/2&&h-b.helperProportions.width/2<n&&p<g+b.helperProportions.height/2&&e-b.helperProportions.height/2<q;case "pointer":return a.ui.isOver((b.positionAbs||b.position.absolute).top+(b.clickOffset||b.offset.click).top,(b.positionAbs||b.position.absolute).left+(b.clickOffset||b.offset.click).left,p,l,c.proportions.height,c.proportions.width);case "touch":return(g>=p&&g<=q||e>=p&&e<=q||g<p&&e>q)&&(d>=l&&d<=n||h>=l&&h<=n||d<l&&h>n);default:return!1}};
a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var f=a.ui.ddmanager.droppables[b.options.scope]||[],d=c?c.type:null,h=(b.currentItem||b.element).find(":data(droppable)").andSelf(),g=0;a:for(;g<f.length;g++)if(!(f[g].options.disabled||b&&!f[g].accept.call(f[g].element[0],b.currentItem||b.element))){for(var e=0;e<h.length;e++)if(h[e]==f[g].element[0]){f[g].proportions.height=0;continue a}f[g].visible="none"!=f[g].element.css("display");f[g].visible&&("mousedown"==
d&&f[g]._activate.call(f[g],c),f[g].offset=f[g].element.offset(),f[g].proportions={width:f[g].element[0].offsetWidth,height:f[g].element[0].offsetHeight})}},drop:function(b,c){var f=!1;a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){!this.options||(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)&&(f=this._drop.call(this,c)||f),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=1,this.isover=
0,this._deactivate.call(this,c)))});return f},dragStart:function(b,c){b.element.parents(":not(body,html)").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c);a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var f=a.ui.intersect(b,this,this.options.tolerance);if(f=f||1!=this.isover?f&&0==this.isover?
"isover":null:"isout"){var d;if(this.options.greedy){var h=this.element.parents(":data(droppable):eq(0)");h.length&&(d=a.data(h[0],"droppable"),d.greedyChild="isover"==f?1:0)}d&&"isover"==f&&(d.isover=0,d.isout=1,d._out.call(d,c));this[f]=1;this["isout"==f?"isover":"isout"]=0;this["isover"==f?"_over":"_out"].call(this,c);d&&"isout"==f&&(d.isout=0,d.isover=1,d._over.call(d,c))}}})},dragStop:function(b,c){b.element.parents(":not(body,html)").unbind("scroll.droppable");b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,
c)}}})(jQuery);
(function(a,d){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable");a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],
_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null});this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(/relative/.test(this.element.css("position"))&&a.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"}),this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),
this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize",
"none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize());this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){"all"==
this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var g=0;g<d.length;g++){var e=a.trim(d[g]),l=a('<div class="ui-resizable-handle ui-resizable-'+e+'"></div>');/sw|se|ne|nw/.test(e)&&l.css({zIndex:++c.zIndex});"se"==e&&l.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[e]=".ui-resizable-"+e;this.element.append(l)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=
a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var e=a(this.handles[c],this.element),f=0,f=/sw|ne|nw|se|n|s/.test(c)?e.outerHeight():e.outerWidth(),e=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(e,f);this._proportionallyResize()}a(this.handles[c])}};this._renderAxis(this.element);this._handles=a(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}});c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){c.disabled||(a(this).removeClass("ui-resizable-autohide"),b._handles.show())},function(){c.disabled||b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())}));this._mouseInit()},destroy:function(){this._mouseDestroy();
var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var c=
!1,d;for(d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(c){var d=this.options,h=this.element.position(),g=this.element;this.resizing=!0;this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()};(g.is(".ui-draggable")||/absolute/.test(g.css("position")))&&g.css({position:"absolute",top:h.top,left:h.left});a.browser.opera&&/relative/.test(g.css("position"))&&g.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();
var h=b(this.helper.css("left")),e=b(this.helper.css("top"));d.containment&&(h+=a(d.containment).scrollLeft()||0,e+=a(d.containment).scrollTop()||0);this.offset=this.helper.offset();this.position={left:h,top:e};this.size=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()};this.originalSize=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()};this.originalPosition={left:h,top:e};this.sizeDiff={width:g.outerWidth()-
g.width(),height:g.outerHeight()-g.height()};this.originalMousePosition={left:c.pageX,top:c.pageY};this.aspectRatio="number"==typeof d.aspectRatio?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;d=a(".ui-resizable-"+this.axis).css("cursor");a("body").css("cursor","auto"==d?this.axis+"-resize":d);g.addClass("ui-resizable-resizing");this._propagate("start",c);return!0},_mouseDrag:function(a){var b=this.helper,c=this.originalMousePosition,g=this._change[this.axis];if(!g)return!1;c=
g.apply(this,[a,a.pageX-c.left||0,a.pageY-c.top||0]);this._updateVirtualBoundaries(a.shiftKey);if(this._aspectRatio||a.shiftKey)c=this._updateRatio(c,a);c=this._respectSize(c,a);this._propagate("resize",a);b.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",a,this.ui());return!1},_mouseStop:function(b){this.resizing=
!1;var c=this.options;if(this._helper){var d=this._proportionallyResizeElements,g=d.length&&/textarea/i.test(d[0].nodeName),d=g&&a.ui.hasScroll(d[0],"left")?0:this.sizeDiff.height,g=g?0:this.sizeDiff.width,g={width:this.helper.width()-g,height:this.helper.height()-d},d=parseInt(this.element.css("left"),10)+(this.position.left-this.originalPosition.left)||null,e=parseInt(this.element.css("top"),10)+(this.position.top-this.originalPosition.top)||null;c.animate||this.element.css(a.extend(g,{top:e,left:d}));
this.helper.height(this.size.height);this.helper.width(this.size.width);this._helper&&!c.animate&&this._proportionallyResize()}a("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return!1},_updateVirtualBoundaries:function(a){var b=this.options,d,g,e,b={minWidth:c(b.minWidth)?b.minWidth:0,maxWidth:c(b.maxWidth)?b.maxWidth:Infinity,minHeight:c(b.minHeight)?b.minHeight:0,maxHeight:c(b.maxHeight)?b.maxHeight:Infinity};
if(this._aspectRatio||a)a=b.minHeight*this.aspectRatio,g=b.minWidth/this.aspectRatio,d=b.maxHeight*this.aspectRatio,e=b.maxWidth/this.aspectRatio,a>b.minWidth&&(b.minWidth=a),g>b.minHeight&&(b.minHeight=g),d<b.maxWidth&&(b.maxWidth=d),e<b.maxHeight&&(b.maxHeight=e);this._vBoundaries=b},_updateCache:function(a){this.offset=this.helper.offset();c(a.left)&&(this.position.left=a.left);c(a.top)&&(this.position.top=a.top);c(a.height)&&(this.size.height=a.height);c(a.width)&&(this.size.width=a.width)},_updateRatio:function(a,
b){var d=this.position,g=this.size,e=this.axis;c(a.height)?a.width=a.height*this.aspectRatio:c(a.width)&&(a.height=a.width/this.aspectRatio);"sw"==e&&(a.left=d.left+(g.width-a.width),a.top=null);"nw"==e&&(a.top=d.top+(g.height-a.height),a.left=d.left+(g.width-a.width));return a},_respectSize:function(a,b){var d=this._vBoundaries,g=this.axis,e=c(a.width)&&d.maxWidth&&d.maxWidth<a.width,l=c(a.height)&&d.maxHeight&&d.maxHeight<a.height,n=c(a.width)&&d.minWidth&&d.minWidth>a.width,p=c(a.height)&&d.minHeight&&
d.minHeight>a.height;n&&(a.width=d.minWidth);p&&(a.height=d.minHeight);e&&(a.width=d.maxWidth);l&&(a.height=d.maxHeight);var q=this.originalPosition.left+this.originalSize.width,s=this.position.top+this.size.height,r=/sw|nw|w/.test(g),g=/nw|ne|n/.test(g);n&&r&&(a.left=q-d.minWidth);e&&r&&(a.left=q-d.maxWidth);p&&g&&(a.top=s-d.minHeight);l&&g&&(a.top=s-d.maxHeight);(d=!a.width&&!a.height)&&!a.left&&a.top?a.top=null:d&&!a.top&&a.left&&(a.left=null);return a},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=
this.helper||this.element,c=0;c<this._proportionallyResizeElements.length;c++){var d=this._proportionallyResizeElements[c];if(!this.borderDif){var g=[d.css("borderTopWidth"),d.css("borderRightWidth"),d.css("borderBottomWidth"),d.css("borderLeftWidth")],e=[d.css("paddingTop"),d.css("paddingRight"),d.css("paddingBottom"),d.css("paddingLeft")];this.borderDif=a.map(g,function(a,b){var c=parseInt(a,10)||0,f=parseInt(e[b],10)||0;return c+f})}a.browser.msie&&(a(b).is(":hidden")||a(b).parents(":hidden").length)||
d.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var c=a.browser.msie&&7>a.browser.version,d=c?1:0,c=c?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+c,height:this.element.outerHeight()+c,position:"absolute",left:this.elementOffset.left-
d+"px",top:this.elementOffset.top-d+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){return{left:this.originalPosition.left+b,width:this.originalSize.width-b}},n:function(a,b,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,
arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]);"resize"!=b&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,
element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});a.extend(a.ui.resizable,{version:"1.8.17"});a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable").options,g=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10),position:b.css("position")})})};
"object"!=typeof d.alsoResize||d.alsoResize.parentNode?g(d.alsoResize):d.alsoResize.length?(d.alsoResize=d.alsoResize[0],g(d.alsoResize)):a.each(d.alsoResize,function(a){g(a)})},resize:function(b,c){var d=a(this).data("resizable"),g=d.options,e=d.originalSize,l=d.originalPosition,n={height:d.size.height-e.height||0,width:d.size.width-e.width||0,top:d.position.top-l.top||0,left:d.position.left-l.left||0},p=function(b,e){a(b).each(function(){var b=a(this),f=a(this).data("resizable-alsoresize"),g={},
l=e&&e.length?e:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(l,function(a,b){var c=(f[b]||0)+(n[b]||0);c&&0<=c&&(g[b]=c||null)});a.browser.opera&&/relative/.test(b.css("position"))&&(d._revertToRelativePosition=!0,b.css({position:"absolute",top:"auto",left:"auto"}));b.css(g)})};"object"!=typeof g.alsoResize||g.alsoResize.nodeType?p(g.alsoResize):a.each(g.alsoResize,function(a,b){p(a,b)})},stop:function(b,c){var d=a(this).data("resizable"),g=d.options,
e=function(b){a(b).each(function(){var b=a(this);b.css({position:b.data("resizable-alsoresize").position})})};d._revertToRelativePosition&&(d._revertToRelativePosition=!1,"object"!=typeof g.alsoResize||g.alsoResize.nodeType?e(g.alsoResize):a.each(g.alsoResize,function(a){e(a)}));a(this).removeData("resizable-alsoresize")}});a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),g=d.options,e=d._proportionallyResizeElements,l=e.length&&/textarea/i.test(e[0].nodeName),
n=l&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,l={width:d.size.width-(l?0:d.sizeDiff.width),height:d.size.height-n},n=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,p=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(l,p&&n?{top:p,left:n}:{}),{duration:g.animateDuration,easing:g.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),
top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};e&&e.length&&a(e[0]).css({width:c.width,height:c.height});d._updateCache(c);d._propagate("resize",b)}})}});a.ui.plugin.add("resizable","containment",{start:function(c,d){var h=a(this).data("resizable"),g=h.element,e=h.options.containment;if(g=e instanceof a?e.get(0):/parent/.test(e)?g.parent().get(0):e)if(h.containerElement=a(g),/document/.test(e)||e==document)h.containerOffset={left:0,top:0},h.containerPosition={left:0,
top:0},h.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var l=a(g),n=[];a(["Top","Right","Left","Bottom"]).each(function(a,c){n[a]=b(l.css("padding"+c))});h.containerOffset=l.offset();h.containerPosition=l.position();h.containerSize={height:l.innerHeight()-n[3],width:l.innerWidth()-n[1]};var e=h.containerOffset,p=h.containerSize.height,q=h.containerSize.width,q=a.ui.hasScroll(g,"left")?g.scrollWidth:q,
p=a.ui.hasScroll(g)?g.scrollHeight:p;h.parentData={element:g,left:e.left,top:e.top,width:q,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),g=d.options,e=d.containerOffset,l=d.position,n=d._aspectRatio||b.shiftKey,p={top:0,left:0},q=d.containerElement;q[0]!=document&&/static/.test(q.css("position"))&&(p=e);l.left<(d._helper?e.left:0)&&(d.size.width+=d._helper?d.position.left-e.left:d.position.left-p.left,n&&(d.size.height=d.size.width/g.aspectRatio),d.position.left=g.helper?e.left:
0);l.top<(d._helper?e.top:0)&&(d.size.height+=d._helper?d.position.top-e.top:d.position.top,n&&(d.size.width=d.size.height*g.aspectRatio),d.position.top=d._helper?e.top:0);d.offset.left=d.parentData.left+d.position.left;d.offset.top=d.parentData.top+d.position.top;g=Math.abs(d.offset.left-p.left+d.sizeDiff.width);e=Math.abs((d._helper?d.offset.top-p.top:d.offset.top-e.top)+d.sizeDiff.height);p=d.containerElement.get(0)==d.element.parent().get(0);l=/relative|absolute/.test(d.containerElement.css("position"));
p&&l&&(g-=d.parentData.left);g+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-g,n&&(d.size.height=d.size.width/d.aspectRatio));e+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-e,n&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),g=d.options,e=d.containerOffset,l=d.containerPosition,n=d.containerElement,p=a(d.helper),q=p.offset(),s=p.outerWidth()-d.sizeDiff.width,p=p.outerHeight()-d.sizeDiff.height;d._helper&&
!g.animate&&/relative/.test(n.css("position"))&&a(this).css({left:q.left-l.left-e.left,width:s,height:p});d._helper&&!g.animate&&/static/.test(n.css("position"))&&a(this).css({left:q.left-l.left-e.left,width:s,height:p})}});a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),g=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==
typeof g.ghost?g.ghost:"");d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable");d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable");d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}});a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),g=d.options,e=d.size,l=d.originalSize,n=d.originalPosition,p=d.axis;g.grid="number"==typeof g.grid?[g.grid,
g.grid]:g.grid;var q=Math.round((e.width-l.width)/(g.grid[0]||1))*(g.grid[0]||1),g=Math.round((e.height-l.height)/(g.grid[1]||1))*(g.grid[1]||1);/^(se|s|e)$/.test(p)?(d.size.width=l.width+q,d.size.height=l.height+g):/^(ne)$/.test(p)?(d.size.width=l.width+q,d.size.height=l.height+g,d.position.top=n.top-g):/^(sw)$/.test(p)?(d.size.width=l.width+q,d.size.height=l.height+g,d.position.left=n.left-q):(d.size.width=l.width+q,d.size.height=l.height+g,d.position.top=n.top-g,d.position.left=n.left-q)}});var b=
function(a){return parseInt(a,10)||0},c=function(a){return!isNaN(parseInt(a,10))}})(jQuery);
(function(a,d){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.addClass("ui-selectee");c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,
selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(b){var c=
this;this.opos=[b.pageX,b.pageY];if(!this.options.disabled){var f=this.options;this.selectees=a(f.filter,this.element[0]);this._trigger("start",b);a(f.appendTo).append(this.helper);this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0});f.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var f=a.data(this,"selectable-item");f.startselected=!0;b.metaKey||b.ctrlKey||(f.$element.removeClass("ui-selected"),f.selected=!1,f.$element.addClass("ui-unselecting"),f.unselecting=
!0,c._trigger("unselecting",b,{unselecting:f.element}))});a(b.target).parents().andSelf().each(function(){var f=a.data(this,"selectable-item");if(f){var d=!b.metaKey&&!b.ctrlKey||!f.$element.hasClass("ui-selected");f.$element.removeClass(d?"ui-unselecting":"ui-selected").addClass(d?"ui-selecting":"ui-unselecting");f.unselecting=!d;f.selecting=d;(f.selected=d)?c._trigger("selecting",b,{selecting:f.element}):c._trigger("unselecting",b,{unselecting:f.element});return!1}})}},_mouseDrag:function(b){var c=
this;this.dragged=!0;if(!this.options.disabled){var f=this.options,d=this.opos[0],h=this.opos[1],g=b.pageX,e=b.pageY;if(d>g)var l=g,g=d,d=l;h>e&&(l=e,e=h,h=l);this.helper.css({left:d,top:h,width:g-d,height:e-h});this.selectees.each(function(){var l=a.data(this,"selectable-item");if(l&&l.element!=c.element[0]){var p=!1;"touch"==f.tolerance?p=!(l.left>g||l.right<d||l.top>e||l.bottom<h):"fit"==f.tolerance&&(p=l.left>d&&l.right<g&&l.top>h&&l.bottom<e);p?(l.selected&&(l.$element.removeClass("ui-selected"),
l.selected=!1),l.unselecting&&(l.$element.removeClass("ui-unselecting"),l.unselecting=!1),l.selecting||(l.$element.addClass("ui-selecting"),l.selecting=!0,c._trigger("selecting",b,{selecting:l.element}))):(l.selecting&&((b.metaKey||b.ctrlKey)&&l.startselected?(l.$element.removeClass("ui-selecting"),l.selecting=!1,l.$element.addClass("ui-selected"),l.selected=!0):(l.$element.removeClass("ui-selecting"),l.selecting=!1,l.startselected&&(l.$element.addClass("ui-unselecting"),l.unselecting=!0),c._trigger("unselecting",
b,{unselecting:l.element}))),l.selected&&!b.metaKey&&!b.ctrlKey&&!l.startselected&&(l.$element.removeClass("ui-selected"),l.selected=!1,l.$element.addClass("ui-unselecting"),l.unselecting=!0,c._trigger("unselecting",b,{unselecting:l.element})))}});return!1}},_mouseStop:function(b){var c=this;this.dragged=!1;a(".ui-unselecting",this.element[0]).each(function(){var f=a.data(this,"selectable-item");f.$element.removeClass("ui-unselecting");f.unselecting=!1;f.startselected=!1;c._trigger("unselected",b,
{unselected:f.element})});a(".ui-selecting",this.element[0]).each(function(){var f=a.data(this,"selectable-item");f.$element.removeClass("ui-selecting").addClass("ui-selected");f.selecting=!1;f.selected=!0;f.startselected=!0;c._trigger("selected",b,{selected:f.element})});this._trigger("stop",b);this.helper.remove();return!1}});a.extend(a.ui.selectable,{version:"1.8.17"})})(jQuery);
(function(a,d){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable");
this.refresh();this.floating=this.items.length?"x"===a.axis||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var a=this.items.length-1;0<=a;a--)this.items[a].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){"disabled"===b?(this.options[b]=c,this.widget()[c?
"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var f=this;if(this.reverting||this.options.disabled||"static"==this.options.type)return!1;this._refreshItems(b);var d=null,h=this;a(b.target).parents().each(function(){if(a.data(this,f.widgetName+"-item")==h)return d=a(this),!1});a.data(b.target,f.widgetName+"-item")==h&&(d=a(b.target));if(!d)return!1;if(this.options.handle&&!c){var g=!1;a(this.options.handle,d).find("*").andSelf().each(function(){this==
b.target&&(g=!0)});if(!g)return!1}this.currentItem=d;this._removeCurrentsFromItems();return!0},_mouseStart:function(b,c,f){c=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(b);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=
this.helper.css("position");a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();
c.containment&&this._setContainment();c.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",c.cursor));c.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",c.opacity));c.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",c.zIndex));this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());
this._trigger("start",b,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!f)for(f=this.containers.length-1;0<=f;f--)this.containers[f]._trigger("activate",b,this._uiHash(this));a.ui.ddmanager&&(a.ui.ddmanager.current=this);a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(b);return!0},_mouseDrag:function(b){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");
this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,f=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scrollParent[0].scrollTop=f=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=f=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+
this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=f=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=f=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?f=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(f=a(document).scrollTop(a(document).scrollTop()+
c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?f=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(f=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed)));!1!==f&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");this.options.axis&&"y"==this.options.axis||(this.helper[0].style.left=this.position.left+"px");
this.options.axis&&"x"==this.options.axis||(this.helper[0].style.top=this.position.top+"px");for(c=this.items.length-1;0<=c;c--){var f=this.items[c],d=f.item[0],h=this._intersectsWithPointer(f);if(h&&d!=this.currentItem[0]&&this.placeholder[1==h?"next":"prev"]()[0]!=d&&!a.ui.contains(this.placeholder[0],d)&&("semi-dynamic"==this.options.type?!a.ui.contains(this.element[0],d):1)){this.direction=1==h?"down":"up";if("pointer"==this.options.tolerance||this._intersectsWithSides(f))this._rearrange(b,f);
else break;this._trigger("change",b,this._uiHash());break}}this._contactContainers(b);a.ui.ddmanager&&a.ui.ddmanager.drag(this,b);this._trigger("sort",b,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(b,c){if(b){a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var f=this,d=f.placeholder.offset();f.reverting=!0;a(this.helper).animate({left:d.left-this.offset.parent.left-f.margins.left+(this.offsetParent[0]==document.body?
0:this.offsetParent[0].scrollLeft),top:d.top-this.offset.parent.top-f.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){f._clear(b)})}else this._clear(b,c);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});"original"==this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;0<=b;b--)this.containers[b]._trigger("deactivate",
null,this._uiHash(this)),this.containers[b].containerCache.over&&(this.containers[b]._trigger("out",null,this._uiHash(this)),this.containers[b].containerCache.over=0)}this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!=this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):
a(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),f=[];b=b||{};a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&f.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))});!f.length&&b.key&&f.push(b.key+"=");return f.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),f=[];b=b||{};c.each(function(){f.push(a(b.item||this).attr(b.attribute||
"id")||"")});return f},_intersectsWith:function(a){var c=this.positionAbs.left,f=c+this.helperProportions.width,d=this.positionAbs.top,h=d+this.helperProportions.height,g=a.left,e=g+a.width,l=a.top,n=l+a.height,p=this.offset.click.top,q=this.offset.click.left;return"pointer"==this.options.tolerance||this.options.forcePointerForContainers||"pointer"!=this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?d+p>l&&d+p<n&&c+q>g&&c+q<e:g<c+this.helperProportions.width/
2&&f-this.helperProportions.width/2<e&&l<d+this.helperProportions.height/2&&h-this.helperProportions.height/2<n},_intersectsWithPointer:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height);b=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width);c=c&&b;b=this._getDragVerticalDirection();var f=this._getDragHorizontalDirection();return c?this.floating?f&&"right"==f||"down"==b?2:1:b&&("down"==b?2:1):!1},_intersectsWithSides:function(b){var c=
a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height);b=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width);var f=this._getDragVerticalDirection(),d=this._getDragHorizontalDirection();return this.floating&&d?"right"==d&&b||"left"==d&&!b:f&&("down"==f&&c||"up"==f&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return 0!=a&&(0<a?"down":"up")},_getDragHorizontalDirection:function(){var a=
this.positionAbs.left-this.lastPositionAbs.left;return 0!=a&&(0<a?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=[],f=[],d=this._connectWith();if(d&&b)for(b=d.length-1;0<=b;b--)for(var h=a(d[b]),g=h.length-1;0<=g;g--){var e=a.data(h[g],this.widgetName);e&&e!=this&&!e.options.disabled&&f.push([a.isFunction(e.options.items)?
e.options.items.call(e.element):a(e.options.items,e.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),e])}f.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(b=f.length-1;0<=b;b--)f[b][0].each(function(){c.push(this)});return a(c)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data("+
this.widgetName+"-item)"),c=0;c<this.items.length;c++)for(var f=0;f<a.length;f++)a[f]==this.items[c].item[0]&&this.items.splice(c,1)},_refreshItems:function(b){this.items=[];this.containers=[this];var c=this.items,f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],d=this._connectWith();if(d)for(var h=d.length-1;0<=h;h--)for(var g=a(d[h]),e=g.length-1;0<=e;e--){var l=a.data(g[e],this.widgetName);l&&l!=this&&
!l.options.disabled&&(f.push([a.isFunction(l.options.items)?l.options.items.call(l.element[0],b,{item:this.currentItem}):a(l.options.items,l.element),l]),this.containers.push(l))}for(h=f.length-1;0<=h;h--)for(b=f[h][1],d=f[h][0],e=0,g=d.length;e<g;e++)l=a(d[e]),l.data(this.widgetName+"-item",b),c.push({item:l,instance:b,width:0,height:0,left:0,top:0})},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;0<=c;c--){var f=
this.items[c];if(f.instance==this.currentContainer||!this.currentContainer||f.item[0]==this.currentItem[0]){var d=this.options.toleranceElement?a(this.options.toleranceElement,f.item):f.item;b||(f.width=d.outerWidth(),f.height=d.outerHeight());d=d.offset();f.left=d.left;f.top=d.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(c=this.containers.length-1;0<=c;c--)d=this.containers[c].element.offset(),this.containers[c].containerCache.left=
d.left,this.containers[c].containerCache.top=d.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight();return this},_createPlaceholder:function(b){var c=b||this,f=c.options;if(!f.placeholder||f.placeholder.constructor==String){var d=f.placeholder;f.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(d||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];
d||(b.style.visibility="hidden");return b},update:function(a,b){if(!d||f.forcePlaceholderSize)b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(f.placeholder.element.call(c.element,c.currentItem));c.currentItem.after(c.placeholder);f.placeholder.update(c,
c.placeholder)},_contactContainers:function(b){for(var c=null,f=null,d=this.containers.length-1;0<=d;d--)a.ui.contains(this.currentItem[0],this.containers[d].element[0])||(this._intersectsWith(this.containers[d].containerCache)?c&&a.ui.contains(this.containers[d].element[0],c.element[0])||(c=this.containers[d],f=d):this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",b,this._uiHash(this)),this.containers[d].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[f]._trigger("over",
b,this._uiHash(this)),this.containers[f].containerCache.over=1;else if(this.currentContainer!=this.containers[f]){for(var c=1E4,d=null,h=this.positionAbs[this.containers[f].floating?"left":"top"],g=this.items.length-1;0<=g;g--)if(a.ui.contains(this.containers[f].element[0],this.items[g].item[0])){var e=this.items[g][this.containers[f].floating?"left":"top"];Math.abs(e-h)<c&&(c=Math.abs(e-h),d=this.items[g])}if(d||this.options.dropOnEmpty)this.currentContainer=this.containers[f],d?this._rearrange(b,
d,null,!0):this._rearrange(b,null,this.containers[f].element,!0),this._trigger("change",b,this._uiHash()),this.containers[f]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[f]._trigger("over",b,this._uiHash(this)),this.containers[f].containerCache.over=1}},_createHelper:function(b){var c=this.options;b=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):"clone"==c.helper?this.currentItem.clone():
this.currentItem;b.parents("body").length||a("parent"!=c.appendTo?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0]);b[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")});(""==b[0].style.width||c.forceHelperSize)&&b.width(this.currentItem.width());(""==b[0].style.height||c.forceHelperSize)&&b.height(this.currentItem.height());
return b},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" "));a.isArray(b)&&(b={left:+b[0],top:+b[1]||0});"left"in b&&(this.offset.click.left=b.left+this.margins.left);"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left);"top"in b&&(this.offset.click.top=b.top+this.margins.top);"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();
var b=this.offsetParent.offset();"absolute"==this.cssPosition&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions=
{width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;"parent"==b.containment&&(b.containment=this.helper[0].parentNode);if("document"==b.containment||"window"==b.containment)this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a("document"==b.containment?document:window).width()-this.helperProportions.width-this.margins.left,(a("document"==b.containment?document:window).height()||
document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],b=a(b.containment).offset(),f="hidden"!=a(c).css("overflow");this.containment=[b.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,b.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,b.left+(f?Math.max(c.scrollWidth,
c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,b.top+(f?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var f="absolute"==b?1:-1,d="absolute"!=this.cssPosition||this.scrollParent[0]!=
document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(d[0].tagName);return{top:c.top+this.offset.relative.top*f+this.offset.parent.top*f-(a.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():h?0:d.scrollTop())*f),left:c.left+this.offset.relative.left*f+this.offset.parent.left*f-(a.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():
h?0:d.scrollLeft())*f)}},_generatePosition:function(b){var c=this.options,f="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,d=/(html|body)/i.test(f[0].tagName);"relative"!=this.cssPosition||this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset());var h=b.pageX,g=b.pageY;this.originalPosition&&(this.containment&&(b.pageX-this.offset.click.left<
this.containment[0]&&(h=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(h=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top)),c.grid&&(g=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1],g=this.containment?g-this.offset.click.top<this.containment[1]||
g-this.offset.click.top>this.containment[3]?g-this.offset.click.top<this.containment[1]?g+c.grid[1]:g-c.grid[1]:g:g,h=this.originalPageX+Math.round((h-this.originalPageX)/c.grid[0])*c.grid[0],h=this.containment?h-this.offset.click.left<this.containment[0]||h-this.offset.click.left>this.containment[2]?h-this.offset.click.left<this.containment[0]?h+c.grid[0]:h-c.grid[0]:h:h));return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&"fixed"==this.cssPosition?
0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():d?0:f.scrollTop()),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():d?0:f.scrollLeft())}},_rearrange:function(a,c,f,d){f?f[0].appendChild(this.placeholder[0]):c.item[0].parentNode.insertBefore(this.placeholder[0],"down"==this.direction?c.item[0]:c.item[0].nextSibling);this.counter=this.counter?++this.counter:
1;var h=this,g=this.counter;window.setTimeout(function(){g==h.counter&&h.refreshPositions(!d)},0)},_clear:function(b,c){this.reverting=!1;var f=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var d in this._storedCSS)if("auto"==this._storedCSS[d]||"static"==this._storedCSS[d])this._storedCSS[d]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();
this.fromOutside&&!c&&f.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))});!this.fromOutside&&this.domPosition.prev==this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent==this.currentItem.parent()[0]||c||f.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0]))for(c||f.push(function(a){this._trigger("remove",a,this._uiHash())}),d=this.containers.length-1;0<=d;d--)a.ui.contains(this.containers[d].element[0],
this.currentItem[0])&&!c&&(f.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[d])),f.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[d])));for(d=this.containers.length-1;0<=d;d--)c||f.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[d])),this.containers[d].containerCache.over&&(f.push(function(a){return function(b){a._trigger("out",
b,this._uiHash(this))}}.call(this,this.containers[d])),this.containers[d].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"==this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(d=0;d<f.length;d++)f[d].call(this,b);this._trigger("stop",b,this._uiHash())}return!1}c||
this._trigger("beforeStop",b,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!c){for(d=0;d<f.length;d++)f[d].call(this,b);this._trigger("stop",b,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){!1===a.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,
originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}});a.extend(a.ui.sortable,{version:"1.8.17"})})(jQuery);
(function(a,d){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0;b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus")});b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
if(c.navigation){var f=b.element.find("a").filter(c.navigationFilter).eq(0);if(f.length){var d=f.closest(".ui-accordion-header");d.length?b.active=d:b.active=f.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");b.active.next().addClass("ui-accordion-content-active");b._createIcons();b.resize();b.element.attr("role","tablist");b.headers.attr("role","tab").bind("keydown.accordion",
function(a){return b._keydown(a)}).next().attr("role","tabpanel");b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0);a.browser.safari||b.headers.find("a").attr("tabIndex",-1);c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this);a.preventDefault()})},_createIcons:function(){var b=
this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);"active"==b&&this.activate(c);"icons"==b&&(this._destroyIcons(),
c&&this._createIcons());"disabled"==b&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,f=this.headers.length,d=this.headers.index(b.target),h=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:h=this.headers[(d+1)%f];break;case c.LEFT:case c.UP:h=this.headers[(d-1+f)%f];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return h?
(a(b.target).attr("tabIndex",-1),a(h).attr("tabIndex",0),h.focus(),!1):!0}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var f=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height();a.browser.msie&&this.element.parent().css("overflow",f);this.headers.each(function(){c-=a(this).outerHeight(!0)});this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow",
"auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(b){return b?"number"==typeof b?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):!1===b?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var f=this.options;if(!f.disabled)if(b.target){var d=a(b.currentTarget||
c),h=d[0]===this.active[0];f.active=f.collapsible&&h?!1:this.headers.index(d);if(!(this.running||!f.collapsible&&h)){var g=this.active,e=d.next(),l=this.active.next(),n={options:f,newHeader:h&&f.collapsible?a([]):d,oldHeader:this.active,newContent:h&&f.collapsible?a([]):e,oldContent:l},p=this.headers.index(this.active[0])>this.headers.index(d[0]);this.active=h?a([]):d;this._toggle(e,l,n,h,p);g.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(f.icons.headerSelected).addClass(f.icons.header);
h||(d.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(f.icons.header).addClass(f.icons.headerSelected),d.next().addClass("ui-accordion-content-active"))}}else if(f.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(f.icons.headerSelected).addClass(f.icons.header);this.active.next().addClass("ui-accordion-content-active");var l=this.active.next(),
n={options:f,newHeader:a([]),oldHeader:f.active,newContent:a([]),oldContent:l},e=this.active=a([]);this._toggle(e,l,n)}},_toggle:function(b,c,f,d,h){var g=this,e=g.options;g.toShow=b;g.toHide=c;g.data=f;var l=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=0===c.size()?b.size():c.size();if(e.animated){f={};e.collapsible&&d?f={toShow:a([]),toHide:c,complete:l,down:h,autoHeight:e.autoHeight||e.fillSpace}:f={toShow:b,toHide:c,complete:l,down:h,
autoHeight:e.autoHeight||e.fillSpace};e.proxied||(e.proxied=e.animated);e.proxiedDuration||(e.proxiedDuration=e.duration);e.animated=a.isFunction(e.proxied)?e.proxied(f):e.proxied;e.duration=a.isFunction(e.proxiedDuration)?e.proxiedDuration(f):e.proxiedDuration;d=a.ui.accordion.animations;var n=e.duration,p=e.animated;p&&!d[p]&&!a.easing[p]&&(p="slide");d[p]||(d[p]=function(a){this.slide(a,{easing:p,duration:n||700})});d[p](f)}else e.collapsible&&d?b.toggle():(c.hide(),b.show()),l(!0);c.prev().attr({"aria-expanded":"false",
"aria-selected":"false",tabIndex:-1}).blur();b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){(this.running=a?0:--this.running)||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data))}});a.extend(a.ui.accordion,{version:"1.8.17",animations:{slide:function(b,
c){b=a.extend({easing:"swing",duration:300},b,c);if(b.toHide.size())if(b.toShow.size()){var f=b.toShow.css("overflow"),d=0,h={},g={},e,l=b.toShow;e=l[0].style.width;l.width(l.parent().width()-parseFloat(l.css("paddingLeft"))-parseFloat(l.css("paddingRight"))-(parseFloat(l.css("borderLeftWidth"))||0)-(parseFloat(l.css("borderRightWidth"))||0));a.each(["height","paddingTop","paddingBottom"],function(c,e){g[e]="hide";var f=(""+a.css(b.toShow[0],e)).match(/^([\d+-.]+)(.*)$/);h[e]={value:f[1],unit:f[2]||
"px"}});b.toShow.css({height:0,overflow:"hidden"}).show();b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){"height"==c.prop&&(d=0===c.end-c.start?0:(c.now-c.start)/(c.end-c.start));b.toShow[0].style[c.prop]=d*h[c.prop].value+h[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height","");b.toShow.css({width:e,overflow:f});b.complete()}})}else b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},
b);else b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
(function(a,d){var b=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,f=this.element[0].ownerDocument,d;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(f){if(!b.options.disabled&&!b.element.propAttr("readOnly")){d=
!1;var g=a.ui.keyCode;switch(f.keyCode){case g.PAGE_UP:b._move("previousPage",f);break;case g.PAGE_DOWN:b._move("nextPage",f);break;case g.UP:b._move("previous",f);f.preventDefault();break;case g.DOWN:b._move("next",f);f.preventDefault();break;case g.ENTER:case g.NUMPAD_ENTER:b.menu.active&&(d=!0,f.preventDefault());case g.TAB:if(!b.menu.active)break;b.menu.select(f);break;case g.ESCAPE:b.element.val(b.term);b.close(f);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=
b.element.val()&&(b.selectedItem=null,b.search(null,f))},b.options.delay)}}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){b.options.disabled||(b.selectedItem=null,b.previous=b.element.val())}).bind("blur.autocomplete",function(a){b.options.disabled||(clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a);b._change(a)},150))});this._initSource();this.response=function(){return b._response.apply(b,arguments)};this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||
"body",f)[0]).mousedown(function(f){var d=b.menu.element[0];a(f.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(e){e.target!==b.element[0]&&e.target!==d&&!a.ui.contains(d,e.target)&&b.close()})},1);setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,f){var e=f.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:e})&&/^key/.test(a.originalEvent.type)&&b.element.val(e.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),
k=b.previous;b.element[0]!==f.activeElement&&(b.element.focus(),b.previous=k,setTimeout(function(){b.previous=k;b.selectedItem=e},1));!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value);b.term=b.element.val();b.close(a);b.selectedItem=e},blur:function(a,f){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");a.fn.bgiframe&&this.menu.element.bgiframe();b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")};
a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();a(window).unbind("beforeunload",this.beforeunloadHandler);a.Widget.prototype.destroy.call(this)},_setOption:function(b,f){a.Widget.prototype._setOption.apply(this,arguments);"source"===b&&this._initSource();"appendTo"===b&&this.menu.element.appendTo(a(f||
"body",this.element[0].ownerDocument)[0]);"disabled"===b&&f&&this.xhr&&this.xhr.abort()},_initSource:function(){var c=this,f,d;a.isArray(this.options.source)?(f=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(f,b.term))}):"string"==typeof this.options.source?(d=this.options.source,this.source=function(f,g){c.xhr&&c.xhr.abort();c.xhr=a.ajax({url:d,data:f,dataType:"json",autocompleteRequest:++b,success:function(a,c){this.autocompleteRequest===b&&g(a)},error:function(){this.autocompleteRequest===
b&&g([])}})}):this.source=this.options.source},search:function(a,b){a=null!=a?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(!1!==this._trigger("search",b))return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):
this.close();this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return"string"==typeof b?{label:b,value:b}:a.extend({label:b.label||
b.value,value:b.value||b.label},b)})},_suggest:function(b){var f=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(f,b);this.menu.deactivate();this.menu.refresh();f.show();this._resizeMenu();f.position(a.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,f){var d=
this;a.each(f,function(a,f){d._renderItem(b,f)})},_renderItem:function(b,f){return a("<li></li>").data("item.autocomplete",f).append(a("<a></a>").text(f.label)).appendTo(b)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a))this.element.val(this.term),this.menu.deactivate();else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&")},filter:function(b,f){var d=RegExp(a.ui.autocomplete.escapeRegex(f),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery);
(function(a){a.widget("ui.menu",{_create:function(){var d=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(b){!a(b.target).closest(".ui-menu-item a").length||(b.preventDefault(),d.select(b))});this.refresh()},refresh:function(){var d=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(b){d.activate(b,a(this).parent())}).mouseleave(function(){d.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,f=this.element.scrollTop(),k=this.element.height();0>c?this.element.scrollTop(f+c):c>=k&&this.element.scrollTop(f+c-k+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:b})},deactivate:function(){!this.active||
(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null)},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){this.active?(a=this.active[a+"All"](".ui-menu-item").eq(0),a.length?this.activate(c,
a):this.activate(c,this.element.children(b))):this.activate(c,this.element.children(b))},nextPage:function(d){if(this.hasScroll())if(!this.active||this.last())this.activate(d,this.element.children(".ui-menu-item:first"));else{var b=this.active.offset().top,c=this.element.height(),f=this.element.children(".ui-menu-item").filter(function(){var f=a(this).offset().top-b-c+a(this).height();return 10>f&&-10<f});f.length||(f=this.element.children(".ui-menu-item:last"));this.activate(d,f)}else this.activate(d,
this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(d){if(this.hasScroll())if(!this.active||this.first())this.activate(d,this.element.children(".ui-menu-item:last"));else{var b=this.active.offset().top,c=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var f=a(this).offset().top-b+c-a(this).height();return 10>f&&-10<f});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(d,
result)}else this.activate(d,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})})(jQuery);
(function(a,d){var b,c,f,k,h=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh")},1)},g=function(b){var c=b.name,f=b.form,d=a([]);c&&(f?d=a(f).find("[name='"+c+"']"):d=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form}));return d};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",h);"boolean"!=typeof this.options.disabled&&
(this.options.disabled=this.element.propAttr("disabled"));this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var e=this,d=this.options,n="checkbox"===this.type||"radio"===this.type,p="ui-state-hover"+(n?"":" ui-state-active");null===d.label&&(d.label=this.buttonElement.html());this.element.is(":disabled")&&(d.disabled=!0);this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){d.disabled||
(a(this).addClass("ui-state-hover"),this===b&&a(this).addClass("ui-state-active"))}).bind("mouseleave.button",function(){d.disabled||a(this).removeClass(p)}).bind("click.button",function(a){d.disabled&&(a.preventDefault(),a.stopImmediatePropagation())});this.element.bind("focus.button",function(){e.buttonElement.addClass("ui-state-focus")}).bind("blur.button",function(){e.buttonElement.removeClass("ui-state-focus")});n&&(this.element.bind("change.button",function(){k||e.refresh()}),this.buttonElement.bind("mousedown.button",
function(a){d.disabled||(k=!1,c=a.pageX,f=a.pageY)}).bind("mouseup.button",function(a){d.disabled||c===a.pageX&&f===a.pageY||(k=!0)}));"checkbox"===this.type?this.buttonElement.bind("click.button",function(){if(d.disabled||k)return!1;a(this).toggleClass("ui-state-active");e.buttonElement.attr("aria-pressed",e.element[0].checked)}):"radio"===this.type?this.buttonElement.bind("click.button",function(){if(d.disabled||k)return!1;a(this).addClass("ui-state-active");e.buttonElement.attr("aria-pressed",
"true");var b=e.element[0];g(b).not(b).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(d.disabled)return!1;a(this).addClass("ui-state-active");b=this;a(document).one("mouseup",function(){b=null})}).bind("mouseup.button",function(){if(d.disabled)return!1;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(b){if(d.disabled)return!1;b.keyCode!=a.ui.keyCode.SPACE&&
b.keyCode!=a.ui.keyCode.ENTER||a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click()}));this._setOption("disabled",d.disabled);this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";
if("checkbox"===this.type||"radio"===this.type){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b);this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b)));this.element.addClass("ui-helper-hidden-accessible");(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",
a)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active  ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());
this.hasTitle||this.buttonElement.removeAttr("title");a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);"disabled"===b?c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1):this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b);"radio"===this.type?g(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
"true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),
c=a("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),f=this.options.icons,d=f.primary&&f.secondary,g=[];f.primary||f.secondary?(this.options.text&&g.push("ui-button-text-icon"+(d?"s":f.primary?"-primary":"-secondary")),f.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+f.primary+"'></span>"),f.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+f.secondary+"'></span>"),this.options.text||
(g.push(d?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):g.push("ui-button-text-only");b.addClass(g.join(" "))}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){"disabled"===b&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b="rtl"===
this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");
a.Widget.prototype.destroy.call(this)}})})(jQuery);
(function(a,d){var b={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},c={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=
a(this).css(b).offset().top;0>c&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");"string"!=typeof this.originalTitle&&(this.originalTitle="");this.options.title=this.options.title||this.originalTitle;var b=this,c=b.options,f=c.title||"&#160;",e=a.ui.dialog.getTitleId(b.element),d=(b.uiDialog=a("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
c.dialogClass).css({zIndex:c.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(e){c.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===a.ui.keyCode.ESCAPE&&(b.close(e),e.preventDefault())}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(a){b.moveToTop(!1,a)});b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(d);var n=(b.uiDialogTitlebar=a("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(d),
p=a('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){p.addClass("ui-state-hover")},function(){p.removeClass("ui-state-hover")}).focus(function(){p.addClass("ui-state-focus")}).blur(function(){p.removeClass("ui-state-focus")}).click(function(a){b.close(a);return!1}).appendTo(n);(b.uiDialogTitlebarCloseText=a("<span></span>")).addClass("ui-icon ui-icon-closethick").text(c.closeText).appendTo(p);a("<span></span>").addClass("ui-dialog-title").attr("id",
e).html(f).prependTo(n);a.isFunction(c.beforeclose)&&!a.isFunction(c.beforeClose)&&(c.beforeClose=c.beforeclose);n.find("*").add(n).disableSelection();c.draggable&&a.fn.draggable&&b._makeDraggable();c.resizable&&a.fn.resizable&&b._makeResizable();b._createButtons(c.buttons);b._isOpen=!1;a.fn.bgiframe&&d.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){this.overlay&&this.overlay.destroy();this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
this.uiDialog.remove();this.originalTitle&&this.element.attr("title",this.originalTitle);return this},widget:function(){return this.uiDialog},close:function(b){var c=this,f,e;if(!1!==c._trigger("beforeClose",b))return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(f=0,a(".ui-dialog").each(function(){this!==
c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(f=Math.max(f,e)))}),a.ui.dialog.maxZ=f),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var f=this.options;if(f.modal&&!b||!f.stack&&!f.modal)return this._trigger("focus",c);f.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=f.zIndex);this.overlay&&(a.ui.dialog.maxZ+=1,this.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ));f={scrollTop:this.element.scrollTop(),scrollLeft:this.element.scrollLeft()};a.ui.dialog.maxZ+=
1;this.uiDialog.css("z-index",a.ui.dialog.maxZ);this.element.attr(f);this._trigger("focus",c);return this},open:function(){if(!this._isOpen){var b=this.options,c=this.uiDialog;this.overlay=b.modal?new a.ui.dialog.overlay(this):null;this._size();this._position(b.position);c.show(b.show);this.moveToTop(!0);b.modal&&c.bind("keydown.ui-dialog",function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(":tabbable",this),f=c.filter(":first"),c=c.filter(":last");if(b.target===c[0]&&!b.shiftKey)return f.focus(1),
!1;if(b.target===f[0]&&b.shiftKey)return c.focus(1),!1}});a(this.element.find(":tabbable").get().concat(c.find(".ui-dialog-buttonpane :tabbable").get().concat(c.get()))).eq(0).focus();this._isOpen=!0;this._trigger("open");return this}},_createButtons:function(b){var c=this,d=!1,e=a("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),l=a("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove();"object"==typeof b&&
null!==b&&a.each(b,function(){return!(d=!0)});d&&(a.each(b,function(b,e){e=a.isFunction(e)?{click:e,text:b}:e;var d=a('<button type="button"></button>').click(function(){e.click.apply(c.element[0],arguments)}).appendTo(l);a.each(e,function(a,b){"click"!==a&&(a in f?d[a](b):d.attr(a,b))});a.fn.button&&d.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function b(a){return{position:a.position,offset:a.offset}}var c=this,f=c.options,e=a(document),d;c.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
handle:".ui-dialog-titlebar",containment:"document",start:function(e,p){d="auto"===f.height?"auto":a(this).height();a(this).height(a(this).height()).addClass("ui-dialog-dragging");c._trigger("dragStart",e,b(p))},drag:function(a,e){c._trigger("drag",a,b(e))},stop:function(n,p){f.position=[p.position.left-e.scrollLeft(),p.position.top-e.scrollTop()];a(this).removeClass("ui-dialog-dragging").height(d);c._trigger("dragStop",n,b(p));a.ui.dialog.overlay.resize()}})},_makeResizable:function(b){function c(a){return{originalPosition:a.originalPosition,
originalSize:a.originalSize,position:a.position,size:a.size}}b=b===d?this.options.resizable:b;var f=this,e=f.options,l=f.uiDialog.css("position");b="string"==typeof b?b:"n,e,s,w,se,sw,ne,nw";f.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:f.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:f._minHeight(),handles:b,start:function(b,e){a(this).addClass("ui-dialog-resizing");f._trigger("resizeStart",b,c(e))},resize:function(a,b){f._trigger("resize",
a,c(b))},stop:function(b,d){a(this).removeClass("ui-dialog-resizing");e.height=a(this).height();e.width=a(this).width();f._trigger("resizeStop",b,c(d));a.ui.dialog.overlay.resize()}}).css("position",l).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return"auto"===a.height?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],f=[0,0],e;if(b){if("string"==typeof b||"object"==typeof b&&"0"in b)c=b.split?b.split(" "):
[b[0],b[1]],1===c.length&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(f[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:f.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b));e||this.uiDialog.hide()},_setOptions:function(f){var d=this,g={},e=!1;a.each(f,function(a,f){d._setOption(a,f);a in
b&&(e=!0);a in c&&(g[a]=f)});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",g)},_setOption:function(b,c){var f=this.uiDialog;switch(b){case "beforeclose":b="beforeClose";break;case "buttons":this._createButtons(c);break;case "closeText":this.uiDialogTitlebarCloseText.text(""+c);break;case "dialogClass":f.removeClass(this.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+c);break;case "disabled":c?f.addClass("ui-dialog-disabled"):
f.removeClass("ui-dialog-disabled");break;case "draggable":var e=f.is(":data(draggable)");e&&!c&&f.draggable("destroy");!e&&c&&this._makeDraggable();break;case "position":this._position(c);break;case "resizable":(e=f.is(":data(resizable)"))&&!c&&f.resizable("destroy");e&&"string"==typeof c&&f.resizable("option","handles",c);!e&&!1!==c&&this._makeResizable(c);break;case "title":a(".ui-dialog-title",this.uiDialogTitlebar).html(""+(c||"&#160;"))}a.Widget.prototype._setOption.apply(this,arguments)},_size:function(){var b=
this.options,c,f,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});b.minWidth>b.width&&(b.width=b.minWidth);c=this.uiDialog.css({height:"auto",width:b.width}).height();f=Math.max(0,b.minHeight-c);"auto"===b.height?a.support.minHeight?this.element.css({minHeight:f,height:"auto"}):(this.uiDialog.show(),b=this.element.css("height","auto").height(),e||this.uiDialog.hide(),this.element.height(Math.max(b,f))):this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&
this.uiDialog.resizable("option","minHeight",this._minHeight())}});a.extend(a.ui.dialog,{version:"1.8.17",uuid:0,maxZ:0,getTitleId:function(a){(a=a.attr("id"))||(this.uuid+=1,a=this.uuid);return"ui-dialog-title-"+a},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}});a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus mousedown mouseup keydown keypress click".split(" "),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){0===this.instances.length&&
(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()<a.ui.dialog.overlay.maxZ)return!1})},1),a(document).bind("keydown.dialog-overlay",function(c){b.options.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}),a(window).bind("resize.dialog-overlay",a.ui.dialog.overlay.resize));var c=(this.oldInstances.pop()||a("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),
height:this.height()});a.fn.bgiframe&&c.bgiframe();this.instances.push(c);return c},destroy:function(b){var c=a.inArray(b,this.instances);-1!=c&&this.oldInstances.push(this.instances.splice(c,1)[0]);0===this.instances.length&&a([document,window]).unbind(".dialog-overlay");b.remove();var f=0;a.each(this.instances,function(){f=Math.max(f,this.css("z-index"))});this.maxZ=f},height:function(){var b,c;return a.browser.msie&&7>a.browser.version?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),
c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b<c?a(window).height()+"px":b+"px"):a(document).height()+"px"},width:function(){var b,c;return a.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b<c?a(window).width()+"px":b+"px"):a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function(){b=b.add(this)});b.css({width:0,
height:0}).css({width:a.ui.dialog.overlay.width(),height:a.ui.dialog.overlay.height()})}});a.extend(a.ui.dialog.overlay.prototype,{destroy:function(){a.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
(function(a,d){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,c=this.options,f=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),d=c.values&&c.values.length||1,h=[];this._mouseSliding=this._keySliding=!1;this._animateOff=!0;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(c.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);c.range&&(!0===c.range&&(c.values||(c.values=[this._valueMin(),this._valueMin()]),c.values.length&&2!==c.values.length&&(c.values=[c.values[0],c.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+("min"===c.range||"max"===c.range?" ui-slider-range-"+c.range:"")));for(var g=f.length;g<d;g+=1)h.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
this.handles=f.add(a(h.join("")).appendTo(b.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){c.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){c.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(b){a(this).data("index.ui-slider-handle",
b)});this.handles.keydown(function(c){var f=!0,d=a(this).data("index.ui-slider-handle"),g,h,k;if(!b.options.disabled){switch(c.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(f=!1,!b._keySliding&&(b._keySliding=!0,a(this).addClass("ui-state-active"),g=b._start(c,d),!1===g))return}g=b.options.step;b.options.values&&b.options.values.length?h=k=b.values(d):
h=k=b.value();switch(c.keyCode){case a.ui.keyCode.HOME:k=b._valueMin();break;case a.ui.keyCode.END:k=b._valueMax();break;case a.ui.keyCode.PAGE_UP:k=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case a.ui.keyCode.PAGE_DOWN:k=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(h===b._valueMax())return;k=b._trimAlignValue(h+g);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(h===b._valueMin())return;k=b._trimAlignValue(h-g)}b._slide(c,
d,k);return f}}).keyup(function(c){var f=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,f),b._change(c,f),a(this).removeClass("ui-state-active"))});this._refreshValue();this._animateOff=!1},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();return this},_mouseCapture:function(b){var c=
this.options,f,d,h,g,e;if(c.disabled)return!1;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();f=this._normValueFromMouse({x:b.pageX,y:b.pageY});d=this._valueMax()-this._valueMin()+1;g=this;this.handles.each(function(b){var c=Math.abs(f-g.values(b));d>c&&(d=c,h=a(this),e=b)});!0===c.range&&this.values(1)===c.min&&(e+=1,h=a(this.handles[e]));if(!1===this._start(b,e))return!1;this._mouseSliding=!0;g._handleIndex=e;h.addClass("ui-state-active").focus();
c=h.offset();this._clickOffset=a(b.target).parents().andSelf().is(".ui-slider-handle")?{left:b.pageX-c.left-h.width()/2,top:b.pageY-c.top-h.height()/2-(parseInt(h.css("borderTopWidth"),10)||0)-(parseInt(h.css("borderBottomWidth"),10)||0)+(parseInt(h.css("marginTop"),10)||0)}:{left:0,top:0};this.handles.hasClass("ui-state-hover")||this._slide(b,e,f);return this._animateOff=!0},_mouseStart:function(a){return!0},_mouseDrag:function(a){var c=this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,
this._handleIndex,c);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=!1;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(a){var c,f;"horizontal"===this.orientation?(c=this.elementSize.width,f=a.x-this.elementOffset.left-(this._clickOffset?
this._clickOffset.left:0)):(c=this.elementSize.height,f=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0));a=f/c;1<a&&(a=1);0>a&&(a=0);"vertical"===this.orientation&&(a=1-a);c=this._valueMax()-this._valueMin();a=this._valueMin()+a*c;return this._trimAlignValue(a)},_start:function(a,c){var f={handle:this.handles[c],value:this.value()};this.options.values&&this.options.values.length&&(f.value=this.values(c),f.values=this.values());return this._trigger("start",a,f)},_slide:function(a,
c,f){var d,h,g;this.options.values&&this.options.values.length?(d=this.values(c?0:1),2===this.options.values.length&&!0===this.options.range&&(0===c&&f>d||1===c&&f<d)&&(f=d),f!==this.values(c)&&(h=this.values(),h[c]=f,g=this._trigger("slide",a,{handle:this.handles[c],value:f,values:h}),this.values(c?0:1),!1!==g&&this.values(c,f,!0))):f!==this.value()&&(g=this._trigger("slide",a,{handle:this.handles[c],value:f}),!1!==g&&this.value(f))},_stop:function(a,c){var f={handle:this.handles[c],value:this.value()};
this.options.values&&this.options.values.length&&(f.value=this.values(c),f.values=this.values());this._trigger("stop",a,f)},_change:function(a,c){if(!this._keySliding&&!this._mouseSliding){var f={handle:this.handles[c],value:this.value()};this.options.values&&this.options.values.length&&(f.value=this.values(c),f.values=this.values());this._trigger("change",a,f)}},value:function(a){if(arguments.length)this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);else return this._value()},
values:function(b,c){var f,d,h;if(1<arguments.length)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();f=this.options.values;d=arguments[0];for(h=0;h<f.length;h+=1)f[h]=this._trimAlignValue(d[h]),this._change(null,h);this._refreshValue()}},_setOption:function(b,c){var f,d=0;a.isArray(this.options.values)&&
(d=this.options.values.length);a.Widget.prototype._setOption.apply(this,arguments);switch(b){case "disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case "orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);
this._refreshValue();break;case "value":this._animateOff=!0;this._refreshValue();this._change(null,0);this._animateOff=!1;break;case "values":this._animateOff=!0;this._refreshValue();for(f=0;f<d;f+=1)this._change(null,f);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var c,f;if(arguments.length)return c=this.options.values[a],c=this._trimAlignValue(c);c=this.options.values.slice();for(f=0;f<c.length;f+=1)c[f]=this._trimAlignValue(c[f]);
return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var c=0<this.options.step?this.options.step:1,f=(a-this._valueMin())%c;a-=f;2*Math.abs(f)>=c&&(a+=0<f?c:-c);return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,f=this,d=this._animateOff?!1:c.animate,h,g={},e,l,n,p;this.options.values&&
this.options.values.length?this.handles.each(function(b,l){h=100*((f.values(b)-f._valueMin())/(f._valueMax()-f._valueMin()));g["horizontal"===f.orientation?"left":"bottom"]=h+"%";a(this).stop(1,1)[d?"animate":"css"](g,c.animate);!0===f.options.range&&("horizontal"===f.orientation?(0===b&&f.range.stop(1,1)[d?"animate":"css"]({left:h+"%"},c.animate),1===b&&f.range[d?"animate":"css"]({width:h-e+"%"},{queue:!1,duration:c.animate})):(0===b&&f.range.stop(1,1)[d?"animate":"css"]({bottom:h+"%"},c.animate),
1===b&&f.range[d?"animate":"css"]({height:h-e+"%"},{queue:!1,duration:c.animate})));e=h}):(l=this.value(),n=this._valueMin(),p=this._valueMax(),h=p!==n?100*((l-n)/(p-n)):0,g["horizontal"===f.orientation?"left":"bottom"]=h+"%",this.handle.stop(1,1)[d?"animate":"css"](g,c.animate),"min"===b&&"horizontal"===this.orientation&&this.range.stop(1,1)[d?"animate":"css"]({width:h+"%"},c.animate),"max"===b&&"horizontal"===this.orientation&&this.range[d?"animate":"css"]({width:100-h+"%"},{queue:!1,duration:c.animate}),
"min"===b&&"vertical"===this.orientation&&this.range.stop(1,1)[d?"animate":"css"]({height:h+"%"},c.animate),"max"===b&&"vertical"===this.orientation&&this.range[d?"animate":"css"]({height:100-h+"%"},{queue:!1,duration:c.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);
(function(a,d){var b=0,c=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){"selected"==a?this.options.collapsible&&b==this.options.selected||this.select(b):
(this.options[a]=b,this._tabify())},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+ ++b},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++c);return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function c(b,e){b.css("display","");!a.support.opacity&&e.opacity&&b[0].style.removeAttribute("filter")}var h=this,g=this.options,e=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=a(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);this.anchors.each(function(b,c){var f=a(c).attr("href"),d=f.split("#")[0],k;d&&(d===location.toString().split("#")[0]||
(k=a("base")[0])&&d===k.href)&&(f=c.hash,c.href=f);e.test(f)?h.panels=h.panels.add(h.element.find(h._sanitizeSelector(f))):f&&"#"!==f?(a.data(c,"href.tabs",f),a.data(c,"load.tabs",f.replace(/#.*$/,"")),f=h._tabId(c),c.href="#"+f,d=h.element.find("#"+f),d.length||(d=a(g.panelTemplate).attr("id",f).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(h.panels[b-1]||h.list),d.data("destroy.tabs",!0)),h.panels=h.panels.add(d)):g.disabled.push(b)});b?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),g.selected===d?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return g.selected=a,!1}),"number"!=typeof g.selected&&g.cookie&&(g.selected=parseInt(h._cookie(),10)),"number"!=typeof g.selected&&this.lis.filter(".ui-tabs-selected").length&&(g.selected=
this.lis.index(this.lis.filter(".ui-tabs-selected"))),g.selected=g.selected||(this.lis.length?0:-1)):null===g.selected&&(g.selected=-1),g.selected=0<=g.selected&&this.anchors[g.selected]||0>g.selected?g.selected:0,g.disabled=a.unique(g.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return h.lis.index(a)}))).sort(),-1!=a.inArray(g.selected,g.disabled)&&g.disabled.splice(a.inArray(g.selected,g.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),
0<=g.selected&&this.anchors.length&&(h.element.find(h._sanitizeSelector(h.anchors[g.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(g.selected).addClass("ui-tabs-selected ui-state-active"),h.element.queue("tabs",function(){h._trigger("show",null,h._ui(h.anchors[g.selected],h.element.find(h._sanitizeSelector(h.anchors[g.selected].hash))[0]))}),this.load(g.selected)),a(window).bind("unload",function(){h.lis.add(h.anchors).unbind(".tabs");h.lis=h.anchors=h.panels=null})):g.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
this.element[g.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");g.cookie&&this._cookie(g.selected,g.cookie);b=0;for(var l;l=this.lis[b];b++)a(l)[-1==a.inArray(b,g.disabled)||a(l).hasClass("ui-tabs-selected")?"removeClass":"addClass"]("ui-state-disabled");!1===g.cache&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if("mouseover"!==g.event){var n=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){n("hover",
a(this))});this.lis.bind("mouseout.tabs",function(){a(this).removeClass("ui-state-hover")});this.anchors.bind("focus.tabs",function(){n("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){a(this).closest("li").removeClass("ui-state-focus")})}var p,q;g.fx&&(a.isArray(g.fx)?(p=g.fx[0],q=g.fx[1]):p=q=g.fx);var s=q?function(b,e){a(b).closest("li").addClass("ui-tabs-selected ui-state-active");e.hide().removeClass("ui-tabs-hide").animate(q,q.duration||"normal",function(){c(e,q);h._trigger("show",
null,h._ui(b,e[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active");c.removeClass("ui-tabs-hide");h._trigger("show",null,h._ui(b,c[0]))},r=p?function(a,b){b.animate(p,p.duration||"normal",function(){h.lis.removeClass("ui-tabs-selected ui-state-active");b.addClass("ui-tabs-hide");c(b,p);h.element.dequeue("tabs")})}:function(a,b,c){h.lis.removeClass("ui-tabs-selected ui-state-active");b.addClass("ui-tabs-hide");h.element.dequeue("tabs")};this.anchors.bind(g.event+".tabs",
function(){var b=this,c=a(b).closest("li"),e=h.panels.filter(":not(.ui-tabs-hide)"),f=h.element.find(h._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!g.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||h.panels.filter(":animated").length||!1===h._trigger("select",null,h._ui(this,f[0])))return this.blur(),!1;g.selected=h.anchors.index(this);h.abort();if(g.collapsible){if(c.hasClass("ui-tabs-selected"))return g.selected=-1,g.cookie&&h._cookie(g.selected,
g.cookie),h.element.queue("tabs",function(){r(b,e)}).dequeue("tabs"),this.blur(),!1;if(!e.length)return g.cookie&&h._cookie(g.selected,g.cookie),h.element.queue("tabs",function(){s(b,f)}),h.load(h.anchors.index(this)),this.blur(),!1}g.cookie&&h._cookie(g.selected,g.cookie);if(f.length)e.length&&h.element.queue("tabs",function(){r(b,e)}),h.element.queue("tabs",function(){s(b,f)}),h.load(h.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()});
this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){"string"==typeof a&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var b=a.data(this,
"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
c,h){h===d&&(h=this.anchors.length);var g=this,e=this.options;c=a(e.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,c));b=b.indexOf("#")?this._tabId(a("a",c)[0]):b.replace("#","");c.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var l=g.element.find("#"+b);l.length||(l=a(e.panelTemplate).attr("id",b).data("destroy.tabs",!0));l.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");h>=this.lis.length?(c.appendTo(this.list),l.appendTo(this.list[0].parentNode)):
(c.insertBefore(this.lis[h]),l.insertBefore(this.panels[h]));e.disabled=a.map(e.disabled,function(a,b){return a>=h?++a:a});this._tabify();1==this.anchors.length&&(e.selected=0,c.addClass("ui-tabs-selected ui-state-active"),l.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){g._trigger("show",null,g._ui(g.anchors[0],g.panels[0]))}),this.load(0));this._trigger("add",null,this._ui(this.anchors[h],this.panels[h]));return this},remove:function(b){b=this._getIndex(b);var c=this.options,d=
this.lis.eq(b).remove(),g=this.panels.eq(b).remove();d.hasClass("ui-tabs-selected")&&1<this.anchors.length&&this.select(b+(b+1<this.anchors.length?1:-1));c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a});this._tabify();this._trigger("remove",null,this._ui(d.find("a")[0],g[0]));return this},enable:function(b){b=this._getIndex(b);var c=this.options;if(-1!=a.inArray(b,c.disabled))return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,
function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this.options;a!=b.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),b.disabled.push(a),b.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a])));return this},select:function(a){a=this._getIndex(a);if(-1==a)if(this.options.collapsible&&-1!=this.options.selected)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+
".tabs");return this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,g=this.anchors.eq(b)[0],e=a.data(g,"load.tabs");this.abort();if(!e||0!==this.element.queue("tabs").length&&a.data(g,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var l=a("span",g);l.data("label.tabs",l.html()).html(d.spinner)}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:e,success:function(e,l){c.element.find(c._sanitizeSelector(g.hash)).html(e);c._cleanup();
d.cache&&a.data(g,"cache.tabs",!0);c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(e,l)}catch(q){}},error:function(a,e,l){c._cleanup();c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,e,b,g)}catch(s){}}}));c.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(!1,!0);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));this.xhr&&(this.xhr.abort(),delete this.xhr);this._cleanup();
return this},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b);return this},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.8.17"});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation);c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a);b&&b.stopPropagation()}),l=c._unrotate||(c._unrotate=b?function(a){t=
d.selected;e()}:function(a){a.clientX&&c.rotate(null)});a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",l),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",l),delete this._rotate,delete this._unrotate);return this}})})(jQuery);
(function(a,d){function b(b,c){a.extend(b,c);for(var f in c)if(null==c[f]||c[f]==d)b[f]=c[f];return b}function c(b){return b.bind("mouseout",function(b){b=a(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");!b.length||b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){c=a(c.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");!a.datepicker._isDisabledDatepicker(h.inline?
b.parent()[0]:h.input[0])&&c.length&&(c.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),c.addClass("ui-state-hover"),c.hasClass("ui-datepicker-prev")&&c.addClass("ui-datepicker-prev-hover"),c.hasClass("ui-datepicker-next")&&c.addClass("ui-datepicker-next-hover"))})}function f(){this.debug=!1;this._curInst=null;this._keyEvent=!1;this._disabledInputs=[];this._inDialog=this._datepickerShowing=!1;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass=
"ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:"Janvier F&eacute;vrier Mars Avril Mai Juin Juillet Ao&ugrave;t Septembre Octobre Novembre D&eacute;cembre".split(" "),
monthNamesShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dayNames:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),dayNamesShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dayNamesMin:"Di Lu Ma Me Je Ve Sa".split(" "),weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,
navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1};a.extend(this._defaults,
this.regional[""]);this.dpDiv=c(a('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}a.extend(a.ui,{datepicker:{version:"1.8.17"}});var k=(new Date).getTime(),h;a.extend(f.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){b(this._defaults,a||{});return this},_attachDatepicker:function(b,c){var f=
null,d;for(d in this._defaults){var h=b.getAttribute("date:"+d);if(h){f=f||{};try{f[d]=eval(h)}catch(k){f[d]=h}}}d=b.nodeName.toLowerCase();h="div"==d||"span"==d;b.id||(this.uuid+=1,b.id="dp"+this.uuid);var s=this._newInst(a(b),h);s.settings=a.extend({},c||{},f||{});"input"==d?this._connectDatepicker(b,s):h&&this._inlineDatepicker(b,s)},_newInst:function(b,e){return{id:b[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:b,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:e,
dpDiv:e?c(a('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(b,c){var f=a(b);c.append=a([]);c.trigger=a([]);f.hasClass(this.markerClassName)||(this._attachments(f,c),f.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,b,f){c.settings[b]=f}).bind("getData.datepicker",function(a,b){return this._get(c,
b)}),this._autoSize(c),a.data(b,"datepicker",c),c.settings.disabled&&this._disableDatepicker(b))},_attachments:function(b,c){var f=this._get(c,"appendText"),d=this._get(c,"isRTL");c.append&&c.append.remove();f&&(c.append=a('<span class="'+this._appendClass+'">'+f+"</span>"),b[d?"before":"after"](c.append));b.unbind("focus",this._showDatepicker);c.trigger&&c.trigger.remove();f=this._get(c,"showOn");"focus"!=f&&"both"!=f||b.focus(this._showDatepicker);if("button"==f||"both"==f){var f=this._get(c,"buttonText"),
h=this._get(c,"buttonImage");c.trigger=a(this._get(c,"buttonImageOnly")?a("<img/>").addClass(this._triggerClass).attr({src:h,alt:f,title:f}):a('<button type="button"></button>').addClass(this._triggerClass).html(""==h?f:a("<img/>").attr({src:h,alt:f,title:f})));b[d?"before":"after"](c.trigger);c.trigger.click(function(){a.datepicker._datepickerShowing&&a.datepicker._lastInput==b[0]?a.datepicker._hideDatepicker():a.datepicker._showDatepicker(b[0]);return!1})}},_autoSize:function(a){if(this._get(a,
"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var f=function(a){for(var b=0,c=0,e=0;e<a.length;e++)a[e].length>b&&(b=a[e].length,c=e);return c};b.setMonth(f(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(f(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(b,c){var f=a(b);f.hasClass(this.markerClassName)||(f.addClass(this.markerClassName).append(c.dpDiv).bind("setData.datepicker",
function(a,b,f){c.settings[b]=f}).bind("getData.datepicker",function(a,b){return this._get(c,b)}),a.data(b,"datepicker",c),this._setDate(c,this._getDefaultDate(c),!0),this._updateDatepicker(c),this._updateAlternate(c),c.settings.disabled&&this._disableDatepicker(b),c.dpDiv.css("display","block"))},_dialogDatepicker:function(c,e,f,d,h){c=this._dialogInst;c||(this.uuid+=1,this._dialogInput=a('<input type="text" id="dp'+this.uuid+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),
this._dialogInput.keydown(this._doKeyDown),a("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},a.data(this._dialogInput[0],"datepicker",c));b(c.settings,d||{});e=e&&e.constructor==Date?this._formatDate(c,e):e;this._dialogInput.val(e);this._pos=h?h.length?h:[h.pageX,h.pageY]:null;this._pos||(this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/
2-150+(document.documentElement.scrollTop||document.body.scrollTop)]);this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");c.settings.onSelect=f;this._inDialog=!0;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);a.blockUI&&a.blockUI(this.dpDiv);a.data(this._dialogInput[0],"datepicker",c);return this},_destroyDatepicker:function(b){var c=a(b),f=a.data(b,"datepicker");if(c.hasClass(this.markerClassName)){var d=b.nodeName.toLowerCase();a.removeData(b,
"datepicker");"input"==d?(f.append.remove(),f.trigger.remove(),c.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"==d||"span"==d)&&c.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(b){var c=a(b),f=a.data(b,"datepicker");if(c.hasClass(this.markerClassName)){var d=b.nodeName.toLowerCase();if("input"==d)b.disabled=!1,f.trigger.filter("button").each(function(){this.disabled=
!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if("div"==d||"span"==d)c=c.children("."+this._inlineClass),c.children().removeClass("ui-state-disabled"),c.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled");this._disabledInputs=a.map(this._disabledInputs,function(a){return a==b?null:a})}},_disableDatepicker:function(b){var c=a(b),f=a.data(b,"datepicker");if(c.hasClass(this.markerClassName)){var d=b.nodeName.toLowerCase();if("input"==d)b.disabled=!0,f.trigger.filter("button").each(function(){this.disabled=
!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if("div"==d||"span"==d)c=c.children("."+this._inlineClass),c.children().addClass("ui-state-disabled"),c.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled");this._disabledInputs=a.map(this._disabledInputs,function(a){return a==b?null:a});this._disabledInputs[this._disabledInputs.length]=b}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==
a)return!0;return!1},_getInst:function(b){try{return a.data(b,"datepicker")}catch(c){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(c,e,f){var h=this._getInst(c);if(2==arguments.length&&"string"==typeof e)return"defaults"==e?a.extend({},a.datepicker._defaults):h?"all"==e?a.extend({},h.settings):this._get(h,e):null;var k=e||{};"string"==typeof e&&(k={},k[e]=f);if(h){this._curInst==h&&this._hideDatepicker();var q=this._getDateDatepicker(c,!0),s=this._getMinMaxDate(h,
"min"),r=this._getMinMaxDate(h,"max");b(h.settings,k);null!==s&&k.dateFormat!==d&&k.minDate===d&&(h.settings.minDate=this._formatDate(h,s));null!==r&&k.dateFormat!==d&&k.maxDate===d&&(h.settings.maxDate=this._formatDate(h,r));this._attachments(a(c),h);this._autoSize(h);this._setDate(h,q);this._updateAlternate(h);this._updateDatepicker(h)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,
b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);c&&!c.inline&&this._setDateFromField(c,b);return c?this._getDate(c):null},_doKeyDown:function(b){var c=a.datepicker._getInst(b.target),f=!0,d=c.dpDiv.is(".ui-datepicker-rtl");c._keyEvent=!0;if(a.datepicker._datepickerShowing)switch(b.keyCode){case 9:a.datepicker._hideDatepicker();f=!1;break;case 13:return f=a("td."+a.datepicker._dayOverClass+
":not(."+a.datepicker._currentClass+")",c.dpDiv),f[0]&&a.datepicker._selectDay(b.target,c.selectedMonth,c.selectedYear,f[0]),(b=a.datepicker._get(c,"onSelect"))?(f=a.datepicker._formatDate(c),b.apply(c.input?c.input[0]:null,[f,c])):a.datepicker._hideDatepicker(),!1;case 27:a.datepicker._hideDatepicker();break;case 33:a.datepicker._adjustDate(b.target,b.ctrlKey?-a.datepicker._get(c,"stepBigMonths"):-a.datepicker._get(c,"stepMonths"),"M");break;case 34:a.datepicker._adjustDate(b.target,b.ctrlKey?+a.datepicker._get(c,
"stepBigMonths"):+a.datepicker._get(c,"stepMonths"),"M");break;case 35:(b.ctrlKey||b.metaKey)&&a.datepicker._clearDate(b.target);f=b.ctrlKey||b.metaKey;break;case 36:(b.ctrlKey||b.metaKey)&&a.datepicker._gotoToday(b.target);f=b.ctrlKey||b.metaKey;break;case 37:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,d?1:-1,"D");f=b.ctrlKey||b.metaKey;b.originalEvent.altKey&&a.datepicker._adjustDate(b.target,b.ctrlKey?-a.datepicker._get(c,"stepBigMonths"):-a.datepicker._get(c,"stepMonths"),"M");break;
case 38:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,-7,"D");f=b.ctrlKey||b.metaKey;break;case 39:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,d?-1:1,"D");f=b.ctrlKey||b.metaKey;b.originalEvent.altKey&&a.datepicker._adjustDate(b.target,b.ctrlKey?+a.datepicker._get(c,"stepBigMonths"):+a.datepicker._get(c,"stepMonths"),"M");break;case 40:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,7,"D");f=b.ctrlKey||b.metaKey;break;default:f=!1}else 36==b.keyCode&&b.ctrlKey?
a.datepicker._showDatepicker(this):f=!1;f&&(b.preventDefault(),b.stopPropagation())},_doKeyPress:function(b){var c=a.datepicker._getInst(b.target);if(a.datepicker._get(c,"constrainInput")){var c=a.datepicker._possibleChars(a.datepicker._get(c,"dateFormat")),f=String.fromCharCode(b.charCode==d?b.keyCode:b.charCode);return b.ctrlKey||b.metaKey||" ">f||!c||-1<c.indexOf(f)}},_doKeyUp:function(b){b=a.datepicker._getInst(b.target);if(b.input.val()!=b.lastVal)try{a.datepicker.parseDate(a.datepicker._get(b,
"dateFormat"),b.input?b.input.val():null,a.datepicker._getFormatConfig(b))&&(a.datepicker._setDateFromField(b),a.datepicker._updateAlternate(b),a.datepicker._updateDatepicker(b))}catch(c){a.datepicker.log(c)}return!0},_showDatepicker:function(c){c=c.target||c;"input"!=c.nodeName.toLowerCase()&&(c=a("input",c.parentNode)[0]);if(!a.datepicker._isDisabledDatepicker(c)&&a.datepicker._lastInput!=c){var e=a.datepicker._getInst(c);a.datepicker._curInst&&a.datepicker._curInst!=e&&(a.datepicker._curInst.dpDiv.stop(!0,
!0),e&&a.datepicker._datepickerShowing&&a.datepicker._hideDatepicker(a.datepicker._curInst.input[0]));var f=a.datepicker._get(e,"beforeShow"),f=f?f.apply(c,[c,e]):{};if(!1!==f){b(e.settings,f);e.lastVal=null;a.datepicker._lastInput=c;a.datepicker._setDateFromField(e);a.datepicker._inDialog&&(c.value="");a.datepicker._pos||(a.datepicker._pos=a.datepicker._findPos(c),a.datepicker._pos[1]+=c.offsetHeight);var d=!1;a(c).parents().each(function(){d|="fixed"==a(this).css("position");return!d});d&&a.browser.opera&&
(a.datepicker._pos[0]-=document.documentElement.scrollLeft,a.datepicker._pos[1]-=document.documentElement.scrollTop);f={left:a.datepicker._pos[0],top:a.datepicker._pos[1]};a.datepicker._pos=null;e.dpDiv.empty();e.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});a.datepicker._updateDatepicker(e);f=a.datepicker._checkOffset(e,f,d);e.dpDiv.css({position:a.datepicker._inDialog&&a.blockUI?"static":d?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!e.inline){var f=a.datepicker._get(e,
"showAnim"),h=a.datepicker._get(e,"duration"),k=function(){var b=e.dpDiv.find("iframe.ui-datepicker-cover");if(b.length){var c=a.datepicker._getBorders(e.dpDiv);b.css({left:-c[0],top:-c[1],width:e.dpDiv.outerWidth(),height:e.dpDiv.outerHeight()})}};e.dpDiv.zIndex(a(c).zIndex()+1);a.datepicker._datepickerShowing=!0;a.effects&&a.effects[f]?e.dpDiv.show(f,a.datepicker._get(e,"showOptions"),h,k):e.dpDiv[f||"show"](f?h:null,k);f&&h||k();e.input.is(":visible")&&!e.input.is(":disabled")&&e.input.focus();
a.datepicker._curInst=e}}}},_updateDatepicker:function(b){this.maxRows=4;var c=a.datepicker._getBorders(b.dpDiv);h=b;b.dpDiv.empty().append(this._generateHTML(b));var f=b.dpDiv.find("iframe.ui-datepicker-cover");!f.length||f.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()});b.dpDiv.find("."+this._dayOverClass+" a").mouseover();c=this._getNumberOfMonths(b);f=c[1];b.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");1<f&&
b.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",17*f+"em");b.dpDiv[(1!=c[0]||1!=c[1]?"add":"remove")+"Class"]("ui-datepicker-multi");b.dpDiv[(this._get(b,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");b==a.datepicker._curInst&&a.datepicker._datepickerShowing&&b.input&&b.input.is(":visible")&&!b.input.is(":disabled")&&b.input[0]!=document.activeElement&&b.input.focus();if(b.yearshtml){var d=b.yearshtml;setTimeout(function(){d===b.yearshtml&&b.yearshtml&&b.dpDiv.find("select.ui-datepicker-year:first").replaceWith(b.yearshtml);
d=b.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(b,c,f){var d=b.dpDiv.outerWidth(),h=b.dpDiv.outerHeight(),k=b.input?b.input.outerWidth():0,s=b.input?b.input.outerHeight():0,r=document.documentElement.clientWidth+a(document).scrollLeft(),w=document.documentElement.clientHeight+a(document).scrollTop();c.left-=this._get(b,"isRTL")?
d-k:0;c.left-=f&&c.left==b.input.offset().left?a(document).scrollLeft():0;c.top-=f&&c.top==b.input.offset().top+s?a(document).scrollTop():0;c.left-=Math.min(c.left,c.left+d>r&&r>d?Math.abs(c.left+d-r):0);c.top-=Math.min(c.top,c.top+h>w&&w>h?Math.abs(h+s):0);return c},_findPos:function(b){for(var c=this._getInst(b),c=this._get(c,"isRTL");b&&("hidden"==b.type||1!=b.nodeType||a.expr.filters.hidden(b));)b=b[c?"previousSibling":"nextSibling"];b=a(b).offset();return[b.left,b.top]},_hideDatepicker:function(b){var c=
this._curInst;if(c&&(!b||c==a.data(b,"datepicker"))&&this._datepickerShowing){b=this._get(c,"showAnim");var f=this._get(c,"duration"),d=this,h=function(){a.datepicker._tidyDialog(c);d._curInst=null};a.effects&&a.effects[b]?c.dpDiv.hide(b,a.datepicker._get(c,"showOptions"),f,h):c.dpDiv["slideDown"==b?"slideUp":"fadeIn"==b?"fadeOut":"hide"](b?f:null,h);b||h();this._datepickerShowing=!1;(b=this._get(c,"onClose"))&&b.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._lastInput=null;this._inDialog&&
(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),a.blockUI&&(a.unblockUI(),a("body").append(this.dpDiv)));this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(b){if(a.datepicker._curInst){b=a(b.target);var c=a.datepicker._getInst(b[0]);(b[0].id!=a.datepicker._mainDivId&&0==b.parents("#"+a.datepicker._mainDivId).length&&!(b.hasClass(a.datepicker.markerClassName)||b.hasClass(a.datepicker._triggerClass)||
!a.datepicker._datepickerShowing||a.datepicker._inDialog&&a.blockUI)||b.hasClass(a.datepicker.markerClassName)&&a.datepicker._curInst!=c)&&a.datepicker._hideDatepicker()}},_adjustDate:function(b,c,f){b=a(b);var d=this._getInst(b[0]);this._isDisabledDatepicker(b[0])||(this._adjustInstDate(d,c+("M"==f?this._get(d,"showCurrentAtPos"):0),f),this._updateDatepicker(d))},_gotoToday:function(b){b=a(b);var c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=
c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var f=new Date;c.selectedDay=f.getDate();c.drawMonth=c.selectedMonth=f.getMonth();c.drawYear=c.selectedYear=f.getFullYear()}this._notifyChange(c);this._adjustDate(b)},_selectMonthYear:function(b,c,f){b=a(b);var d=this._getInst(b[0]);d["selected"+("M"==f?"Month":"Year")]=d["draw"+("M"==f?"Month":"Year")]=parseInt(c.options[c.selectedIndex].value,10);this._notifyChange(d);this._adjustDate(b)},_selectDay:function(b,c,f,d){var h=
a(b);a(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(h[0])||(h=this._getInst(h[0]),h.selectedDay=h.currentDay=a("a",d).html(),h.selectedMonth=h.currentMonth=c,h.selectedYear=h.currentYear=f,this._selectDate(b,this._formatDate(h,h.currentDay,h.currentMonth,h.currentYear)))},_clearDate:function(b){b=a(b);this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(b,c){var f=a(b),f=this._getInst(f[0]);c=null!=c?c:this._formatDate(f);f.input&&f.input.val(c);this._updateAlternate(f);
var d=this._get(f,"onSelect");d?d.apply(f.input?f.input[0]:null,[c,f]):f.input&&f.input.trigger("change");f.inline?this._updateDatepicker(f):(this._hideDatepicker(),this._lastInput=f.input[0],"object"!=typeof f.input[0]&&f.input.focus(),this._lastInput=null)},_updateAlternate:function(b){var c=this._get(b,"altField");if(c){var f=this._get(b,"altFormat")||this._get(b,"dateFormat"),d=this._getDate(b),h=this.formatDate(f,d,this._getFormatConfig(b));a(c).each(function(){a(this).val(h)})}},noWeekends:function(a){a=
a.getDay();return[0<a&&6>a,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(b,c,f){if(null==b||null==c)throw"Invalid arguments";c="object"==typeof c?c.toString():c+"";if(""==c)return null;for(var d=(f?f.shortYearCutoff:null)||this._defaults.shortYearCutoff,d="string"!=typeof d?d:(new Date).getFullYear()%100+parseInt(d,10),h=(f?f.dayNamesShort:
null)||this._defaults.dayNamesShort,k=(f?f.dayNames:null)||this._defaults.dayNames,s=(f?f.monthNamesShort:null)||this._defaults.monthNamesShort,r=(f?f.monthNames:null)||this._defaults.monthNames,w=f=-1,v=-1,u=-1,x=!1,B=function(a){(a=I+1<b.length&&b.charAt(I+1)==a)&&I++;return a},A=function(a){var b=B(a);a=RegExp("^\\d{1,"+("@"==a?14:"!"==a?20:"y"==a&&b?4:"o"==a?3:2)+"}");a=c.substring(E).match(a);if(!a)throw"Missing number at position "+E;E+=a[0].length;return parseInt(a[0],10)},z=function(b,f,d){b=
a.map(B(b)?d:f,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)});var g=-1;a.each(b,function(a,b){var f=b[1];if(c.substr(E,f.length).toLowerCase()==f.toLowerCase())return g=b[0],E+=f.length,!1});if(-1!=g)return g+1;throw"Unknown name at position "+E;},D=function(){if(c.charAt(E)!=b.charAt(I))throw"Unexpected literal at position "+E;E++},E=0,I=0;I<b.length;I++)if(x)"'"!=b.charAt(I)||B("'")?D():x=!1;else switch(b.charAt(I)){case "d":v=A("d");break;case "D":z("D",h,k);
break;case "o":u=A("o");break;case "m":w=A("m");break;case "M":w=z("M",s,r);break;case "y":f=A("y");break;case "@":var F=new Date(A("@"));f=F.getFullYear();w=F.getMonth()+1;v=F.getDate();break;case "!":F=new Date((A("!")-this._ticksTo1970)/1E4);f=F.getFullYear();w=F.getMonth()+1;v=F.getDate();break;case "'":B("'")?D():x=!0;break;default:D()}if(E<c.length)throw"Extra/unparsed characters found in date: "+c.substring(E);-1==f?f=(new Date).getFullYear():100>f&&(f+=(new Date).getFullYear()-(new Date).getFullYear()%
100+(f<=d?0:-100));if(-1<u)for(w=1,v=u;;){d=this._getDaysInMonth(f,w-1);if(v<=d)break;w++;v-=d}F=this._daylightSavingAdjust(new Date(f,w-1,v));if(F.getFullYear()!=f||F.getMonth()+1!=w||F.getDate()!=v)throw"Invalid date";return F},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864E9*(718685+Math.floor(492.5)-Math.floor(19.7)+
Math.floor(4.925)),formatDate:function(a,b,c){if(!b)return"";var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,d=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var k=function(b){(b=x+1<a.length&&a.charAt(x+1)==b)&&x++;return b},r=function(a,b,c){b=""+b;if(k(a))for(;b.length<c;)b="0"+b;return b},w=function(a,b,c,e){return k(a)?e[b]:c[b]},v="",u=!1;if(b)for(var x=0;x<a.length;x++)if(u)"'"!=
a.charAt(x)||k("'")?v+=a.charAt(x):u=!1;else switch(a.charAt(x)){case "d":v+=r("d",b.getDate(),2);break;case "D":v+=w("D",b.getDay(),f,d);break;case "o":v+=r("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":v+=r("m",b.getMonth()+1,2);break;case "M":v+=w("M",b.getMonth(),h,c);break;case "y":v+=k("y")?b.getFullYear():(10>b.getYear()%100?"0":"")+b.getYear()%100;break;case "@":v+=b.getTime();break;case "!":v+=
1E4*b.getTime()+this._ticksTo1970;break;case "'":k("'")?v+="'":u=!0;break;default:v+=a.charAt(x)}return v},_possibleChars:function(a){for(var b="",c=!1,f=function(b){(b=d+1<a.length&&a.charAt(d+1)==b)&&d++;return b},d=0;d<a.length;d++)if(c)"'"!=a.charAt(d)||f("'")?b+=a.charAt(d):c=!1;else switch(a.charAt(d)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":f("'")?b+="'":c=!0;break;default:b+=a.charAt(d)}return b},_get:function(a,b){return a.settings[b]!==
d?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),f=a.lastVal=a.input?a.input.val():null,d,h;d=h=this._getDefaultDate(a);var k=this._getFormatConfig(a);try{d=this.parseDate(c,f,k)||h}catch(r){this.log(r),f=b?"":f}a.selectedDay=d.getDate();a.drawMonth=a.selectedMonth=d.getMonth();a.drawYear=a.selectedYear=d.getFullYear();a.currentDay=f?d.getDate():0;a.currentMonth=f?d.getMonth():0;a.currentYear=f?d.getFullYear():0;this._adjustInstDate(a)}},
_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(b,c,f){var d=function(a){var b=new Date;b.setDate(b.getDate()+a);return b},h=function(c){try{return a.datepicker.parseDate(a.datepicker._get(b,"dateFormat"),c,a.datepicker._getFormatConfig(b))}catch(e){}for(var f=(c.toLowerCase().match(/^c/)?a.datepicker._getDate(b):null)||new Date,d=f.getFullYear(),h=f.getMonth(),f=f.getDate(),k=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
l=k.exec(c);l;){switch(l[2]||"d"){case "d":case "D":f+=parseInt(l[1],10);break;case "w":case "W":f+=7*parseInt(l[1],10);break;case "m":case "M":h+=parseInt(l[1],10);f=Math.min(f,a.datepicker._getDaysInMonth(d,h));break;case "y":case "Y":d+=parseInt(l[1],10),f=Math.min(f,a.datepicker._getDaysInMonth(d,h))}l=k.exec(c)}return new Date(d,h,f)};(c=(c=null==c||""===c?f:"string"==typeof c?h(c):"number"==typeof c?isNaN(c)?f:d(c):new Date(c.getTime()))&&"Invalid Date"==c.toString()?f:c)&&(c.setHours(0),c.setMinutes(0),
c.setSeconds(0),c.setMilliseconds(0));return this._daylightSavingAdjust(c)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(12<a.getHours()?a.getHours()+2:0);return a},_setDate:function(a,b,c){var f=!b,d=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();d==a.selectedMonth&&h==a.selectedYear||
c||this._notifyChange(a);this._adjustInstDate(a);a.input&&a.input.val(f?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&""==a.input.val()?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(b){var c=new Date,c=this._daylightSavingAdjust(new Date(c.getFullYear(),c.getMonth(),c.getDate())),f=this._get(b,"isRTL"),d=this._get(b,"showButtonPanel"),h=this._get(b,"hideIfNoPrevNext"),q=this._get(b,"navigationAsDateFormat"),
s=this._getNumberOfMonths(b),r=this._get(b,"showCurrentAtPos"),w=this._get(b,"stepMonths"),v=1!=s[0]||1!=s[1],u=this._daylightSavingAdjust(b.currentDay?new Date(b.currentYear,b.currentMonth,b.currentDay):new Date(9999,9,9)),x=this._getMinMaxDate(b,"min"),B=this._getMinMaxDate(b,"max"),r=b.drawMonth-r,A=b.drawYear;0>r&&(r+=12,A--);if(B)for(var z=this._daylightSavingAdjust(new Date(B.getFullYear(),B.getMonth()-s[0]*s[1]+1,B.getDate())),z=x&&z<x?x:z;this._daylightSavingAdjust(new Date(A,r,1))>z;)r--,
0>r&&(r=11,A--);b.drawMonth=r;b.drawYear=A;var z=this._get(b,"prevText"),z=q?this.formatDate(z,this._daylightSavingAdjust(new Date(A,r-w,1)),this._getFormatConfig(b)):z,z=this._canAdjustMonth(b,-1,A,r)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+k+".datepicker._adjustDate('#"+b.id+"', -"+w+", 'M');\" title=\""+z+'"><span class="ui-icon ui-icon-circle-triangle-'+(f?"e":"w")+'">'+z+"</span></a>":h?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+z+'"><span class="ui-icon ui-icon-circle-triangle-'+
(f?"e":"w")+'">'+z+"</span></a>",D=this._get(b,"nextText"),D=q?this.formatDate(D,this._daylightSavingAdjust(new Date(A,r+w,1)),this._getFormatConfig(b)):D,h=this._canAdjustMonth(b,1,A,r)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+k+".datepicker._adjustDate('#"+b.id+"', +"+w+", 'M');\" title=\""+D+'"><span class="ui-icon ui-icon-circle-triangle-'+(f?"w":"e")+'">'+D+"</span></a>":h?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+D+'"><span class="ui-icon ui-icon-circle-triangle-'+
(f?"w":"e")+'">'+D+"</span></a>",w=this._get(b,"currentText"),D=this._get(b,"gotoCurrent")&&b.currentDay?u:c,w=q?this.formatDate(w,D,this._getFormatConfig(b)):w,q=b.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+k+'.datepicker._hideDatepicker();">'+this._get(b,"closeText")+"</button>",d=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(f?q:"")+(this._isInRange(b,D)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
k+".datepicker._gotoToday('#"+b.id+"');\">"+w+"</button>":"")+(f?"":q)+"</div>":"",q=parseInt(this._get(b,"firstDay"),10),q=isNaN(q)?0:q,w=this._get(b,"showWeek"),D=this._get(b,"dayNames");this._get(b,"dayNamesShort");var E=this._get(b,"dayNamesMin"),I=this._get(b,"monthNames"),F=this._get(b,"monthNamesShort"),C=this._get(b,"beforeShowDay"),y=this._get(b,"showOtherMonths"),T=this._get(b,"selectOtherMonths");this._get(b,"calculateWeek");for(var Y=this._getDefaultDate(b),m="",V=0;V<s[0];V++){var W=
"";this.maxRows=4;for(var ca=0;ca<s[1];ca++){var ia=this._daylightSavingAdjust(new Date(A,r,b.selectedDay)),M=" ui-corner-all",O="";if(v){O+='<div class="ui-datepicker-group';if(1<s[1])switch(ca){case 0:O+=" ui-datepicker-group-first";M=" ui-corner-"+(f?"right":"left");break;case s[1]-1:O+=" ui-datepicker-group-last";M=" ui-corner-"+(f?"left":"right");break;default:O+=" ui-datepicker-group-middle",M=""}O+='">'}for(var O=O+('<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+M+'">'+
(/all|left/.test(M)&&0==V?f?h:z:"")+(/all|right/.test(M)&&0==V?f?z:h:"")+this._generateMonthYearHeader(b,r,A,x,B,0<V||0<ca,I,F)+'</div><table class="ui-datepicker-calendar"><thead><tr>'),J=w?'<th class="ui-datepicker-week-col">'+this._get(b,"weekHeader")+"</th>":"",M=0;7>M;M++)var N=(M+q)%7,J=J+("<th"+(5<=(M+q+6)%7?' class="ui-datepicker-week-end"':"")+'><span title="'+D[N]+'">'+E[N]+"</span></th>");O+=J+"</tr></thead><tbody>";J=this._getDaysInMonth(A,r);A==b.selectedYear&&r==b.selectedMonth&&(b.selectedDay=
Math.min(b.selectedDay,J));M=(this._getFirstDayOfMonth(A,r)-q+7)%7;J=Math.ceil((M+J)/7);this.maxRows=J=v?this.maxRows>J?this.maxRows:J:J;for(var N=this._daylightSavingAdjust(new Date(A,r,1-M)),X=0;X<J;X++){for(var O=O+"<tr>",U=w?'<td class="ui-datepicker-week-col">'+this._get(b,"calculateWeek")(N)+"</td>":"",M=0;7>M;M++){var P=C?C.apply(b.input?b.input[0]:null,[N]):[!0,""],G=N.getMonth()!=r,K=G&&!T||!P[0]||x&&N<x||B&&N>B,U=U+('<td class="'+(5<=(M+q+6)%7?" ui-datepicker-week-end":"")+(G?" ui-datepicker-other-month":
"")+(N.getTime()==ia.getTime()&&r==b.selectedMonth&&b._keyEvent||Y.getTime()==N.getTime()&&Y.getTime()==ia.getTime()?" "+this._dayOverClass:"")+(K?" "+this._unselectableClass+" ui-state-disabled":"")+(G&&!y?"":" "+P[1]+(N.getTime()==u.getTime()?" "+this._currentClass:"")+(N.getTime()==c.getTime()?" ui-datepicker-today":""))+'"'+(G&&!y||!P[2]?"":' title="'+P[2]+'"')+(K?"":' onclick="DP_jQuery_'+k+".datepicker._selectDay('#"+b.id+"',"+N.getMonth()+","+N.getFullYear()+', this);return false;"')+">"+(G&&
!y?"&#xa0;":K?'<span class="ui-state-default">'+N.getDate()+"</span>":'<a class="ui-state-default'+(N.getTime()==c.getTime()?" ui-state-highlight":"")+(N.getTime()==u.getTime()?" ui-state-active":"")+(G?" ui-priority-secondary":"")+'" href="#">'+N.getDate()+"</a>")+"</td>");N.setDate(N.getDate()+1);N=this._daylightSavingAdjust(N)}O+=U+"</tr>"}r++;11<r&&(r=0,A++);O+="</tbody></table>"+(v?"</div>"+(0<s[0]&&ca==s[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");W+=O}m+=W}m+=d+(a.browser.msie&&
7>parseInt(a.browser.version,10)&&!b.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");b._keyEvent=!1;return m},_generateMonthYearHeader:function(a,b,c,f,d,h,s,r){var w=this._get(a,"changeMonth"),v=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),x='<div class="ui-datepicker-title">',B="";if(h||!w)B+='<span class="ui-datepicker-month">'+s[b]+"</span>";else{s=f&&f.getFullYear()==c;for(var A=d&&d.getFullYear()==c,B=B+('<select class="ui-datepicker-month" onchange="DP_jQuery_'+
k+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >"),z=0;12>z;z++)(!s||z>=f.getMonth())&&(!A||z<=d.getMonth())&&(B+='<option value="'+z+'"'+(z==b?' selected="selected"':"")+">"+r[z]+"</option>");B+="</select>"}u||(x+=B+(!h&&w&&v?"":"&#xa0;"));if(!a.yearshtml)if(a.yearshtml="",h||!v)x+='<span class="ui-datepicker-year">'+c+"</span>";else{r=this._get(a,"yearRange").split(":");var D=(new Date).getFullYear();s=function(a){a=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?
D+parseInt(a,10):parseInt(a,10);return isNaN(a)?D:a};b=s(r[0]);r=Math.max(b,s(r[1]||""));b=f?Math.max(b,f.getFullYear()):b;r=d?Math.min(r,d.getFullYear()):r;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+k+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=r;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";x+=a.yearshtml;a.yearshtml=null}x+=this._get(a,"yearSuffix");u&&(x+=(!h&&w&&v?"":"&#xa0;")+
B);return x+"</div>"},_adjustInstDate:function(a,b,c){var f=a.drawYear+("Y"==c?b:0),d=a.drawMonth+("M"==c?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(f,d))+("D"==c?b:0);f=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(f,d,b)));a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();"M"!=c&&"Y"!=c||this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),f=this._getMinMaxDate(a,"max"),c=c&&b<c?c:
b;return f&&c>f?f:c},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return null==a?[1,1]:"number"==typeof a?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,
b,1)).getDay()},_canAdjustMonth:function(a,b,c,f){var d=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,f+(0>b?b:d[0]*d[1]),1));0>b&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),f=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!f||b.getTime()<=f.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff"),b="string"!=typeof b?b:(new Date).getFullYear()%
100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,f){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);b=b?"object"==typeof b?b:this._daylightSavingAdjust(new Date(f,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,
"dateFormat"),b,this._getFormatConfig(a))}});a.fn.datepicker=function(b){if(!this.length)return this;a.datepicker.initialized||(a(document).mousedown(a.datepicker._checkExternalClick).find("body").append(a.datepicker.dpDiv),a.datepicker.initialized=!0);var c=Array.prototype.slice.call(arguments,1);return"string"==typeof b&&("isDisabled"==b||"getDate"==b||"widget"==b)||"option"==b&&2==arguments.length&&"string"==typeof arguments[1]?a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this[0]].concat(c)):
this.each(function(){"string"==typeof b?a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this].concat(c)):a.datepicker._attachDatepicker(this,b)})};a.datepicker=new f;a.datepicker.initialized=!1;a.datepicker.uuid=(new Date).getTime();a.datepicker.version="1.8.17";window["DP_jQuery_"+k]=a})(jQuery);
(function(a,d){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=a("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
this.valueDiv.remove();a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(b,c){"value"===b&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete"));a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;"number"!=typeof a&&(a=0);return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*
this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change"));this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});a.extend(a.ui.progressbar,{version:"1.8.17"})})(jQuery);
jQuery.effects||function(a,d){function b(b){return!b||"number"==typeof b||a.fx.speeds[b]||"string"==typeof b&&!a.effects[b]?!0:!1}function c(b,c,f,e){"object"==typeof b&&(e=c,f=null,c=b,b=c.effect);a.isFunction(c)&&(e=c,f=null,c={});if("number"==typeof c||a.fx.speeds[c])e=f,f=c,c={};a.isFunction(f)&&(e=f,f=null);c=c||{};f=f||c.duration;f=a.fx.off?0:"number"==typeof f?f:f in a.fx.speeds?a.fx.speeds[f]:a.fx.speeds._default;e=e||c.complete;return[b,c,f,e]}function f(a,b){var c={_:0},f;for(f in b)a[f]!=
b[f]&&(c[f]=b[f]);return c}function k(b){var c,f;for(c in b)f=b[c],(null==f||a.isFunction(f)||c in n||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(f)))&&delete b[c];return b}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,f;if(a&&a.length&&a[0]&&a[a[0]])for(var e=a.length;e--;)c=a[e],"string"==typeof a[c]&&(f=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[f]=a[c]);else for(c in a)"string"==typeof a[c]&&(b[c]=
a[c]);return b}function g(b){var c;return b&&b.constructor==Array&&3==b.length?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[2.55*parseFloat(c[1]),2.55*parseFloat(c[2]),2.55*parseFloat(c[3])]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],
16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:/rgba\(0, 0, 0, 0\)/.exec(b)?e.transparent:e[a.trim(b).toLowerCase()]}a.effects={};a.each("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor borderColor color outlineColor".split(" "),function(b,c){a.fx.step[c]=function(b){if(!b.colorInit){var f;f=b.elem;var e=c,d;do{d=a.curCSS(f,e);if(""!=d&&"transparent"!=d||a.nodeName(f,"body"))break;
e="backgroundColor"}while(f=f.parentNode);f=g(d);b.start=f;b.end=g(b.end);b.colorInit=!0}b.elem.style[c]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,
0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,
255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},l=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,e,d){a.isFunction(e)&&(d=e,e=null);return this.queue(function(){var g=
a(this),n=g.attr("style")||" ",u=k(h.call(this)),x,B=g.attr("class");a.each(l,function(a,c){b[c]&&g[c+"Class"](b[c])});x=k(h.call(this));g.attr("class",B);g.animate(f(u,x),{queue:!1,duration:c,easing:e,complete:function(){a.each(l,function(a,c){b[c]&&g[c+"Class"](b[c])});"object"==typeof g.attr("style")?(g.attr("style").cssText="",g.attr("style").cssText=n):g.attr("style",n);d&&d.apply(this,arguments);a.dequeue(this)}})})};a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,f,e){return c?a.effects.animateClass.apply(this,
[{add:b},c,f,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,f,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,f,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(b,c,f,e,g){return"boolean"==typeof c||c===d?f?a.effects.animateClass.apply(this,[c?{add:b}:{remove:b},f,e,g]):this._toggleClass(b,c):a.effects.animateClass.apply(this,[{toggle:b},c,f,e])},switchClass:function(b,c,f,e,d){return a.effects.animateClass.apply(this,[{add:c,
remove:b},f,e,d])}});a.extend(a.effects,{version:"1.8.17",save:function(a,b){for(var c=0;c<b.length;c++)null!==b[c]&&a.data("ec.storage."+b[c],a[0].style[b[c]])},restore:function(a,b){for(var c=0;c<b.length;c++)null!==b[c]&&a.css(b[c],a.data("ec.storage."+b[c]))},setMode:function(a,b){"toggle"==b&&(b=a.is(":hidden")?"show":"hide");return b},getBaseline:function(a,b){var c,f;switch(a[0]){case "top":c=0;break;case "middle":c=0.5;break;case "bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case "left":f=
0;break;case "center":f=0.5;break;case "right":f=1;break;default:f=a[1]/b.width}return{x:f,y:c}},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),"float":b.css("float")},f=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;b.wrap(f);(b[0]===e||a.contains(b[0],e))&&a(e).focus();f=b.parent();"static"==b.css("position")?
(f.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,f){c[f]=b.css(f);isNaN(parseInt(c[f],10))&&(c[f]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return f.css(c).show()},removeWrapper:function(b){var c,f=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===f||a.contains(b[0],f))&&a(f).focus(),
c):b},setTransition:function(b,c,f,e){e=e||{};a.each(c,function(a,c){unit=b.cssUnit(c);0<unit[0]&&(e[c]=unit[0]*f+unit[1])});return e}});a.fn.extend({effect:function(b,f,e,d){var g=c.apply(this,arguments),h={options:g[1],duration:g[2],callback:g[3]},g=h.options.mode,k=a.effects[b];return a.fx.off||!k?g?this[g](h.duration,h.callback):this.each(function(){h.callback&&h.callback.call(this)}):k.call(this,h)},_show:a.fn.show,show:function(a){if(b(a))return this._show.apply(this,arguments);var f=c.apply(this,
arguments);f[1].mode="show";return this.effect.apply(this,f)},_hide:a.fn.hide,hide:function(a){if(b(a))return this._hide.apply(this,arguments);var f=c.apply(this,arguments);f[1].mode="hide";return this.effect.apply(this,f)},__toggle:a.fn.toggle,toggle:function(f){if(b(f)||"boolean"==typeof f||a.isFunction(f))return this.__toggle.apply(this,arguments);var e=c.apply(this,arguments);e[1].mode="toggle";return this.effect.apply(this,e)},cssUnit:function(b){var c=this.css(b),f=[];a.each(["em","px","%",
"pt"],function(a,b){0<c.indexOf(b)&&(f=[parseFloat(c),b])});return f}});a.easing.jswing=a.easing.swing;a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,f,e,d){return a.easing[a.easing.def](b,c,f,e,d)},easeInQuad:function(a,b,c,f,e){return f*(b/=e)*b+c},easeOutQuad:function(a,b,c,f,e){return-f*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,f,e){return 1>(b/=e/2)?f/2*b*b+c:-f/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,f,e){return f*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,f,e){return f*((b=
b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,f,e){return 1>(b/=e/2)?f/2*b*b*b+c:f/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,f,e){return f*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,f,e){return-f*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,f,e){return 1>(b/=e/2)?f/2*b*b*b*b+c:-f/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,f,e){return f*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,f,e){return f*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,f,e){return 1>(b/=e/2)?f/2*
b*b*b*b*b+c:f/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,f,e){return-f*Math.cos(b/e*(Math.PI/2))+f+c},easeOutSine:function(a,b,c,f,e){return f*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,f,e){return-f/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,f,e){return 0==b?c:f*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,f,e){return b==e?c+f:f*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,f,e){return 0==b?c:b==e?c+f:1>(b/=e/2)?f/2*Math.pow(2,10*(b-1))+c:f/
2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,f,e){return-f*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,f,e){return f*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,f,e){return 1>(b/=e/2)?-f/2*(Math.sqrt(1-b*b)-1)+c:f/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,f,e){a=1.70158;var d=0,g=f;if(0==b)return c;if(1==(b/=e))return c+f;d||(d=0.3*e);g<Math.abs(f)?(g=f,a=d/4):a=d/(2*Math.PI)*Math.asin(f/g);return-(g*Math.pow(2,10*(b-=1))*Math.sin(2*(b*e-a)*Math.PI/
d))+c},easeOutElastic:function(a,b,c,f,e){a=1.70158;var d=0,g=f;if(0==b)return c;if(1==(b/=e))return c+f;d||(d=0.3*e);g<Math.abs(f)?(g=f,a=d/4):a=d/(2*Math.PI)*Math.asin(f/g);return g*Math.pow(2,-10*b)*Math.sin(2*(b*e-a)*Math.PI/d)+f+c},easeInOutElastic:function(a,b,c,f,e){a=1.70158;var d=0,g=f;if(0==b)return c;if(2==(b/=e/2))return c+f;d||(d=1.5*0.3*e);g<Math.abs(f)?(g=f,a=d/4):a=d/(2*Math.PI)*Math.asin(f/g);return 1>b?-0.5*g*Math.pow(2,10*(b-=1))*Math.sin(2*(b*e-a)*Math.PI/d)+c:0.5*g*Math.pow(2,
-10*(b-=1))*Math.sin(2*(b*e-a)*Math.PI/d)+f+c},easeInBack:function(a,b,c,f,e,g){g==d&&(g=1.70158);return f*(b/=e)*b*((g+1)*b-g)+c},easeOutBack:function(a,b,c,f,e,g){g==d&&(g=1.70158);return f*((b=b/e-1)*b*((g+1)*b+g)+1)+c},easeInOutBack:function(a,b,c,f,e,g){g==d&&(g=1.70158);return 1>(b/=e/2)?f/2*b*b*(((g*=1.525)+1)*b-g)+c:f/2*((b-=2)*b*(((g*=1.525)+1)*b+g)+2)+c},easeInBounce:function(b,c,f,e,d){return e-a.easing.easeOutBounce(b,d-c,0,e,d)+f},easeOutBounce:function(a,b,c,f,e){return(b/=e)<1/2.75?
7.5625*f*b*b+c:b<2/2.75?f*(7.5625*(b-=1.5/2.75)*b+0.75)+c:b<2.5/2.75?f*(7.5625*(b-=2.25/2.75)*b+0.9375)+c:f*(7.5625*(b-=2.625/2.75)*b+0.984375)+c},easeInOutBounce:function(b,c,f,e,d){return c<d/2?0.5*a.easing.easeInBounce(b,2*c,0,e,d)+f:0.5*a.easing.easeOutBounce(b,2*c-d,0,e,d)+0.5*e+f}})}(jQuery);
(function(a,d){a.effects.blind=function(b){return this.queue(function(){var c=a(this),f=["position","top","bottom","left","right"],d=a.effects.setMode(c,b.options.mode||"hide"),h=b.options.direction||"vertical";a.effects.save(c,f);c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),e="vertical"==h?"height":"width",h="vertical"==h?g.height():g.width();"show"==d&&g.css(e,0);var l={};l[e]="show"==d?h:0;g.animate(l,b.duration,b.options.easing,function(){"hide"==d&&c.hide();a.effects.restore(c,
f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(c[0],arguments);c.dequeue()})})}})(jQuery);
(function(a,d){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),f=["position","top","bottom","left","right"],d=a.effects.setMode(c,b.options.mode||"effect"),h=b.options.direction||"up",g=b.options.distance||20,e=b.options.times||5,l=b.duration||250;/show|hide/.test(d)&&f.push("opacity");a.effects.save(c,f);c.show();a.effects.createWrapper(c);var n="up"==h||"down"==h?"top":"left",h="up"==h||"left"==h?"pos":"neg",g=b.options.distance||("top"==n?c.outerHeight({margin:!0})/3:c.outerWidth({margin:!0})/
3);"show"==d&&c.css("opacity",0).css(n,"pos"==h?-g:g);"hide"==d&&(g/=2*e);"hide"!=d&&e--;if("show"==d){var p={opacity:1};p[n]=("pos"==h?"+=":"-=")+g;c.animate(p,l/2,b.options.easing);g/=2;e--}for(p=0;p<e;p++){var q={},s={};q[n]=("pos"==h?"-=":"+=")+g;s[n]=("pos"==h?"+=":"-=")+g;c.animate(q,l/2,b.options.easing).animate(s,l/2,b.options.easing);g="hide"==d?2*g:g/2}"hide"==d?(p={opacity:0},p[n]=("pos"==h?"-=":"+=")+g,c.animate(p,l/2,b.options.easing,function(){c.hide();a.effects.restore(c,f);a.effects.removeWrapper(c);
b.callback&&b.callback.apply(this,arguments)})):(q={},s={},q[n]=("pos"==h?"-=":"+=")+g,s[n]=("pos"==h?"+=":"-=")+g,c.animate(q,l/2,b.options.easing).animate(s,l/2,b.options.easing,function(){a.effects.restore(c,f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(this,arguments)}));c.queue("fx",function(){c.dequeue()});c.dequeue()})}})(jQuery);
(function(a,d){a.effects.clip=function(b){return this.queue(function(){var c=a(this),f="position top bottom left right height width".split(" "),d=a.effects.setMode(c,b.options.mode||"hide"),h=b.options.direction||"vertical";a.effects.save(c,f);c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),g="IMG"==c[0].tagName?g:c,e="vertical"==h?"height":"width",l="vertical"==h?"top":"left",h="vertical"==h?g.height():g.width();"show"==d&&(g.css(e,0),g.css(l,h/2));var n={};n[e]="show"==d?h:0;
n[l]="show"==d?0:h/2;g.animate(n,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){"hide"==d&&c.hide();a.effects.restore(c,f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(c[0],arguments);c.dequeue()}})})}})(jQuery);
(function(a,d){a.effects.drop=function(b){return this.queue(function(){var c=a(this),f="position top bottom left right opacity".split(" "),d=a.effects.setMode(c,b.options.mode||"hide"),h=b.options.direction||"left";a.effects.save(c,f);c.show();a.effects.createWrapper(c);var g="up"==h||"down"==h?"top":"left",h="up"==h||"left"==h?"pos":"neg",e=b.options.distance||("top"==g?c.outerHeight({margin:!0})/2:c.outerWidth({margin:!0})/2);"show"==d&&c.css("opacity",0).css(g,"pos"==h?-e:e);var l={opacity:"show"==
d?1:0};l[g]=("show"==d?"pos"==h?"+=":"-=":"pos"==h?"-=":"+=")+e;c.animate(l,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){"hide"==d&&c.hide();a.effects.restore(c,f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
(function(a,d){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,f=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode="toggle"==b.options.mode?a(this).is(":visible")?"hide":"show":b.options.mode;var d=a(this).show().css("visibility","hidden"),h=d.offset();h.top-=parseInt(d.css("marginTop"),10)||0;h.left-=parseInt(d.css("marginLeft"),10)||0;for(var g=d.outerWidth(!0),e=d.outerHeight(!0),l=0;l<c;l++)for(var n=
0;n<f;n++)d.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-n*(g/f),top:-l*(e/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/f,height:e/c,left:h.left+n*(g/f)+("show"==b.options.mode?(n-Math.floor(f/2))*(g/f):0),top:h.top+l*(e/c)+("show"==b.options.mode?(l-Math.floor(c/2))*(e/c):0),opacity:"show"==b.options.mode?0:1}).animate({left:h.left+n*(g/f)+("show"==b.options.mode?0:(n-Math.floor(f/2))*(g/f)),top:h.top+
l*(e/c)+("show"==b.options.mode?0:(l-Math.floor(c/2))*(e/c)),opacity:"show"==b.options.mode?1:0},b.duration||500);setTimeout(function(){"show"==b.options.mode?d.css({visibility:"visible"}):d.css({visibility:"visible"}).hide();b.callback&&b.callback.apply(d[0]);d.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);
(function(a,d){a.effects.fade=function(b){return this.queue(function(){var c=a(this),f=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:f},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
(function(a,d){a.effects.fold=function(b){return this.queue(function(){var c=a(this),f=["position","top","bottom","left","right"],d=a.effects.setMode(c,b.options.mode||"hide"),h=b.options.size||15,g=!!b.options.horizFirst,e=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,f);c.show();var l=a.effects.createWrapper(c).css({overflow:"hidden"}),n="show"==d!=g,p=n?["width","height"]:["height","width"],n=n?[l.width(),l.height()]:[l.height(),l.width()],q=/([0-9]+)%/.exec(h);q&&(h=parseInt(q[1],
10)/100*n["hide"==d?0:1]);"show"==d&&l.css(g?{height:0,width:h}:{height:h,width:0});g={};q={};g[p[0]]="show"==d?n[0]:h;q[p[1]]="show"==d?n[1]:0;l.animate(g,e,b.options.easing).animate(q,e,b.options.easing,function(){"hide"==d&&c.hide();a.effects.restore(c,f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(c[0],arguments);c.dequeue()})})}})(jQuery);
(function(a,d){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),f=["backgroundImage","backgroundColor","opacity"],d=a.effects.setMode(c,b.options.mode||"show"),h={backgroundColor:c.css("backgroundColor")};"hide"==d&&(h.opacity=0);a.effects.save(c,f);c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(h,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){"hide"==d&&c.hide();a.effects.restore(c,f);"show"==d&&!a.support.opacity&&
this.style.removeAttribute("filter");b.callback&&b.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
(function(a,d){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),f=a.effects.setMode(c,b.options.mode||"show");times=2*(b.options.times||5)-1;duration=b.duration?b.duration/2:a.fx.speeds._default/2;isVisible=c.is(":visible");animateTo=0;isVisible||(c.css("opacity",0).show(),animateTo=1);("hide"==f&&isVisible||"show"==f&&!isVisible)&&times--;for(f=0;f<times;f++)c.animate({opacity:animateTo},duration,b.options.easing),animateTo=(animateTo+1)%2;c.animate({opacity:animateTo},duration,
b.options.easing,function(){0==animateTo&&c.hide();b.callback&&b.callback.apply(this,arguments)});c.queue("fx",function(){c.dequeue()}).dequeue()})}})(jQuery);
(function(a,d){a.effects.puff=function(b){return this.queue(function(){var c=a(this),f=a.effects.setMode(c,b.options.mode||"hide"),d=parseInt(b.options.percent,10)||150,h=d/100,g={height:c.height(),width:c.width()};a.extend(b.options,{fade:!0,mode:f,percent:"hide"==f?d:100,from:"hide"==f?g:{height:g.height*h,width:g.width*h}});c.effect("scale",b.options,b.duration,b.callback);c.dequeue()})};a.effects.scale=function(b){return this.queue(function(){var c=a(this),f=a.extend(!0,{},b.options),d=a.effects.setMode(c,
b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(0==parseInt(b.options.percent,10)?0:"hide"==d?0:100),g=b.options.direction||"both",e=b.options.origin;"effect"!=d&&(f.origin=e||["middle","center"],f.restore=!0);e={height:c.height(),width:c.width()};c.from=b.options.from||("show"==d?{height:0,width:0}:e);c.to={height:e.height*("horizontal"!=g?h/100:1),width:e.width*("vertical"!=g?h/100:1)};b.options.fade&&("show"==d&&(c.from.opacity=0,c.to.opacity=1),"hide"==d&&(c.from.opacity=1,c.to.opacity=
0));f.from=c.from;f.to=c.to;f.mode=d;c.effect("size",f,b.duration,b.callback);c.dequeue()})};a.effects.size=function(b){return this.queue(function(){var c=a(this),f="position top bottom left right width height overflow opacity".split(" "),d="position top bottom left right overflow opacity".split(" "),h=["width","height","overflow"],g=["fontSize"],e=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],n=a.effects.setMode(c,
b.options.mode||"effect"),p=b.options.restore||!1,q=b.options.scale||"both",s=b.options.origin,r={height:c.height(),width:c.width()};c.from=b.options.from||r;c.to=b.options.to||r;s&&(s=a.effects.getBaseline(s,r),c.from.top=(r.height-c.from.height)*s.y,c.from.left=(r.width-c.from.width)*s.x,c.to.top=(r.height-c.to.height)*s.y,c.to.left=(r.width-c.to.width)*s.x);var w=c.from.height/r.height,v=c.from.width/r.width,u=c.to.height/r.height,x=c.to.width/r.width;if("box"==q||"both"==q)w!=u&&(f=f.concat(e),
c.from=a.effects.setTransition(c,e,w,c.from),c.to=a.effects.setTransition(c,e,u,c.to)),v!=x&&(f=f.concat(l),c.from=a.effects.setTransition(c,l,v,c.from),c.to=a.effects.setTransition(c,l,x,c.to));("content"==q||"both"==q)&&w!=u&&(f=f.concat(g),c.from=a.effects.setTransition(c,g,w,c.from),c.to=a.effects.setTransition(c,g,u,c.to));a.effects.save(c,p?f:d);c.show();a.effects.createWrapper(c);c.css("overflow","hidden").css(c.from);if("content"==q||"both"==q)e=e.concat(["marginTop","marginBottom"]).concat(g),
l=l.concat(["marginLeft","marginRight"]),h=f.concat(e).concat(l),c.find("*[width]").each(function(){child=a(this);p&&a.effects.save(child,h);var c=child.height(),f=child.width();child.from={height:c*w,width:f*v};child.to={height:c*u,width:f*x};w!=u&&(child.from=a.effects.setTransition(child,e,w,child.from),child.to=a.effects.setTransition(child,e,u,child.to));v!=x&&(child.from=a.effects.setTransition(child,l,v,child.from),child.to=a.effects.setTransition(child,l,x,child.to));child.css(child.from);
child.animate(child.to,b.duration,b.options.easing,function(){p&&a.effects.restore(child,h)})});c.animate(c.to,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){0===c.to.opacity&&c.css("opacity",c.from.opacity);"hide"==n&&c.hide();a.effects.restore(c,p?f:d);a.effects.removeWrapper(c);b.callback&&b.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
(function(a,d){a.effects.shake=function(b){return this.queue(function(){var c=a(this),f=["position","top","bottom","left","right"];a.effects.setMode(c,b.options.mode||"effect");var d=b.options.direction||"left",h=b.options.distance||20,g=b.options.times||3,e=b.duration||b.options.duration||140;a.effects.save(c,f);c.show();a.effects.createWrapper(c);var l="up"==d||"down"==d?"top":"left",n="up"==d||"left"==d?"pos":"neg",d={},p={},q={};d[l]=("pos"==n?"-=":"+=")+h;p[l]=("pos"==n?"+=":"-=")+2*h;q[l]=("pos"==
n?"-=":"+=")+2*h;c.animate(d,e,b.options.easing);for(h=1;h<g;h++)c.animate(p,e,b.options.easing).animate(q,e,b.options.easing);c.animate(p,e,b.options.easing).animate(d,e/2,b.options.easing,function(){a.effects.restore(c,f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(this,arguments)});c.queue("fx",function(){c.dequeue()});c.dequeue()})}})(jQuery);
(function(a,d){a.effects.slide=function(b){return this.queue(function(){var c=a(this),f=["position","top","bottom","left","right"],d=a.effects.setMode(c,b.options.mode||"show"),h=b.options.direction||"left";a.effects.save(c,f);c.show();a.effects.createWrapper(c).css({overflow:"hidden"});var g="up"==h||"down"==h?"top":"left",h="up"==h||"left"==h?"pos":"neg",e=b.options.distance||("top"==g?c.outerHeight({margin:!0}):c.outerWidth({margin:!0}));"show"==d&&c.css(g,"pos"==h?isNaN(e)?"-"+e:-e:e);var l={};
l[g]=("show"==d?"pos"==h?"+=":"-=":"pos"==h?"-=":"+=")+e;c.animate(l,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){"hide"==d&&c.hide();a.effects.restore(c,f);a.effects.removeWrapper(c);b.callback&&b.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
(function(a,d){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),f=a(b.options.to),d=f.offset(),f={top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth()},d=c.offset(),h=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove();b.callback&&b.callback.apply(c[0],arguments);
c.dequeue()})})}})(jQuery);
(function(a){a.jgrid={defaults:{recordtext:"Enregistrements {0} - {1} sur {2}",emptyrecords:"Aucun enregistrement \u00e0 afficher",loadtext:"Chargement...",pgtext:"Page {0} sur {1}"},search:{caption:"Recherche...",Find:"Chercher",Reset:"Annuler",odata:"\u00e9gal;diff\u00e9rent;inf\u00e9rieur;inf\u00e9rieur ou \u00e9gal;sup\u00e9rieur;sup\u00e9rieur ou \u00e9gal;commence par;ne commence pas par;est dans;n'est pas dans;finit par;ne finit pas par;contient;ne contient pas".split(";"),groupOps:[{op:"AND",
text:"tous"},{op:"OR",text:"aucun"}],matchText:" correspondance",rulesText:" r\u00e8gles"},edit:{addCaption:"Ajouter",editCaption:"Editer",bSubmit:"Valider",bCancel:"Annuler",bClose:"Fermer",saveData:"Les donn\u00e9es ont chang\u00e9 ! Enregistrer les modifications ?",bYes:"Oui",bNo:"Non",bExit:"Annuler",msg:{required:"Champ obligatoire",number:"Saisissez un nombre correct",minValue:"La valeur doit \u00eatre sup\u00e9rieure ou \u00e9gale \u00e0 0",maxValue:"La valeur doit \u00eatre inf\u00e9rieure ou \u00e9gale \u00e0 0",
email:"n'est pas un email correct",integer:"Saisissez un entier correct",url:"n'est pas une adresse correcte. Pr\u00e9fixe requis ('http://' or 'https://')",nodefined:" n'est pas d\u00e9fini!",novalue:" la valeur de retour est requise!",customarray:"Une fonction personnalis\u00e9e devrait retourner un tableau (array)!",customfcheck:"Une fonction personnalis\u00e9e devrait \u00eatre pr\u00e9sente dans le cas d'une v\u00e9rification personnalis\u00e9e!"}},view:{caption:"Voir les enregistrement",bClose:"Fermer"},
del:{caption:"Supprimer",msg:"Supprimer les enregistrements s\u00e9lectionn\u00e9s ?",bSubmit:"Supprimer",bCancel:"Annuler"},nav:{edittext:" ",edittitle:"Editer la ligne s\u00e9lectionn\u00e9e",addtext:" ",addtitle:"Ajouter une ligne",deltext:" ",deltitle:"Supprimer la ligne s\u00e9lectionn\u00e9e",searchtext:" ",searchtitle:"Chercher un enregistrement",refreshtext:"",refreshtitle:"Recharger le tableau",alertcap:"Avertissement",alerttext:"Veuillez s\u00e9lectionner une ligne",viewtext:"",viewtitle:"Afficher la ligne s\u00e9lectionn\u00e9e"},
col:{caption:"Afficher/Masquer les colonnes",bSubmit:"Valider",bCancel:"Annuler"},errors:{errcap:"Erreur",nourl:"Aucune adresse n'est param\u00e9tr\u00e9e",norecords:"Aucun enregistrement \u00e0 traiter",model:"Nombre de titres (colNames) <> Nombre de donn\u00e9es (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:"Dim Lun Mar Mer Jeu Ven Sam Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi".split(" "),monthNames:"Jan F\u00e9v Mar Avr Mai Jui Jul Aou Sep Oct Nov D\u00e9c Janvier F\u00e9vrier Mars Avril Mai Juin Juillet Aout Septembre Octobre Novembre D\u00e9cembre".split(" "),AmPm:["am","pm","AM","PM"],S:function(a){return 1==a?"er":"e"},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:!1},baseLinkUrl:"",showAction:"",target:"",checkbox:{disabled:!0},idName:"id"}}})(jQuery);
(function(a,d){function b(b,d){var h=b.nodeName.toLowerCase();if("area"===h){var h=b.parentNode,g=h.name;if(!b.href||!g||"map"!==h.nodeName.toLowerCase())return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&c(h)}return(/input|select|textarea|button|object/.test(h)?!b.disabled:"a"==h?b.href||d:d)&&c(b)}function c(b){return!a(b).parents().andSelf().filter(function(){return"hidden"===a.curCSS(this,"visibility")||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return"number"===typeof b?this.each(function(){var d=
this;setTimeout(function(){a(d).focus();c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;b=a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,
"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(b){if(b!==d)return this.css("zIndex",b);if(this.length){b=a(this[0]);for(var c;b.length&&b[0]!==document;){c=b.css("position");if("absolute"===c||"relative"===c||"fixed"===c)if(c=parseInt(b.css("zIndex"),10),!isNaN(c)&&0!==c)return c;b=b.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(b,c){function h(b,c,f,e){a.each(g,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0;f&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0);e&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var g="Width"===c?["Left","Right"]:["Top","Bottom"],e=c.toLowerCase(),l={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,
outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+c]=function(b){return b===d?l["inner"+c].call(this):this.each(function(){a(this).css(e,h(this,b)+"px")})};a.fn["outer"+c]=function(b,f){return"number"!==typeof b?l["outer"+c].call(this,b):this.each(function(){a(this).css(e,h(this,b,!0,f)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(c){return b(c,!isNaN(a.attr(c,"tabindex")))},tabbable:function(c){var d=a.attr(c,"tabindex"),h=isNaN(d);
return(h||0<=d)&&b(c,!h)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=100===c.offsetHeight;a.support.selectstart="onselectstart"in c;b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){b=a.ui[b].prototype;for(var g in d)b.plugins[g]=b.plugins[g]||[],b.plugins[g].push([c,d[g]])},call:function(a,b,c){if((b=a.plugins[b])&&a.element[0].parentNode)for(var d=
0;d<b.length;d++)a.options[b[d][0]]&&b[d][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if("hidden"===a(b).css("overflow"))return!1;var d=c&&"left"===c?"scrollLeft":"scrollTop",g=!1;if(0<b[d])return!0;b[d]=1;g=0<b[d];b[d]=0;return g},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,g,e,l){return a.ui.isOverAxis(b,d,e)&&a.ui.isOverAxis(c,g,l)}}))})(jQuery);
(function(a,d){if(a.cleanData){var b=a.cleanData;a.cleanData=function(c){for(var d=0,h;null!=(h=c[d]);d++)try{a(h).triggerHandler("remove")}catch(g){}b(c)}}else{var c=a.fn.remove;a.fn.remove=function(b,d){return this.each(function(){d||b&&!a.filter(b,[this]).length||a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}});return c.call(a(this),b,d)})}}a.widget=function(b,c,d){var g=b.split(".")[0],e;b=b.split(".")[1];e=g+"-"+b;d||(d=c,c=a.Widget);a.expr[":"][e]=function(c){return!!a.data(c,
b)};a[g]=a[g]||{};a[g][b]=function(a,b){arguments.length&&this._createWidget(a,b)};c=new c;c.options=a.extend(!0,{},c.options);a[g][b].prototype=a.extend(!0,c,{namespace:g,widgetName:b,widgetEventPrefix:a[g][b].prototype.widgetEventPrefix||b,widgetBaseClass:e},d);a.widget.bridge(b,a[g][b])};a.widget.bridge=function(b,c){a.fn[b]=function(h){var g="string"===typeof h,e=Array.prototype.slice.call(arguments,1),l=this;h=!g&&e.length?a.extend.apply(null,[!0,h].concat(e)):h;if(g&&"_"===h.charAt(0))return l;
g?this.each(function(){var c=a.data(this,b),g=c&&a.isFunction(c[h])?c[h].apply(c,e):c;if(g!==c&&g!==d)return l=g,!1}):this.each(function(){var e=a.data(this,b);e?e.option(h||{})._init():a.data(this,b,new c(h,this))});return l}};a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this);this.element=a(c);this.options=a.extend(!0,{},this.options,this._getCreateOptions(),
b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},
option:function(b,c){var h=b;if(0===arguments.length)return a.extend({},this.options);if("string"===typeof b){if(c===d)return this.options[b];h={};h[b]=c}this._setOptions(h);return this},_setOptions:function(b){var c=this;a.each(b,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b;"disabled"===a&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",b);return this},enable:function(){return this._setOption("disabled",
!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var g,e=this.options[b];d=d||{};c=a.Event(c);c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();c.target=this.element[0];if(b=c.originalEvent)for(g in b)g in c||(c[g]=b[g]);this.element.trigger(c,d);return!(a.isFunction(e)&&!1===e.call(this.element[0],c,d)||c.isDefaultPrevented())}}})(jQuery);
(function(a,d){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0;b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus")});b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
if(c.navigation){var f=b.element.find("a").filter(c.navigationFilter).eq(0);if(f.length){var d=f.closest(".ui-accordion-header");b.active=d.length?d:f.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");b.active.next().addClass("ui-accordion-content-active");b._createIcons();b.resize();b.element.attr("role","tablist");b.headers.attr("role","tab").bind("keydown.accordion",
function(a){return b._keydown(a)}).next().attr("role","tabpanel");b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0);a.browser.safari||b.headers.find("a").attr("tabIndex",-1);c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this);a.preventDefault()})},_createIcons:function(){var b=
this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);"active"==b&&this.activate(c);"icons"==b&&(this._destroyIcons(),
c&&this._createIcons());if("disabled"==b)this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,f=this.headers.length,d=this.headers.index(b.target),h=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:h=this.headers[(d+1)%f];break;case c.LEFT:case c.UP:h=this.headers[(d-1+f)%f];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return h?
(a(b.target).attr("tabIndex",-1),a(h).attr("tabIndex",0),h.focus(),!1):!0}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var f=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height();a.browser.msie&&this.element.parent().css("overflow",f);this.headers.each(function(){c-=a(this).outerHeight(!0)});this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow",
"auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(b){return b?"number"===typeof b?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):!1===b?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var f=this.options;if(!f.disabled)if(b.target){var d=a(b.currentTarget||
c),h=d[0]===this.active[0];f.active=f.collapsible&&h?!1:this.headers.index(d);if(!(this.running||!f.collapsible&&h)){var g=this.active,e=d.next(),l=this.active.next(),n={options:f,newHeader:h&&f.collapsible?a([]):d,oldHeader:this.active,newContent:h&&f.collapsible?a([]):e,oldContent:l},p=this.headers.index(this.active[0])>this.headers.index(d[0]);this.active=h?a([]):d;this._toggle(e,l,n,h,p);g.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(f.icons.headerSelected).addClass(f.icons.header);
h||(d.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(f.icons.header).addClass(f.icons.headerSelected),d.next().addClass("ui-accordion-content-active"))}}else if(f.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(f.icons.headerSelected).addClass(f.icons.header);this.active.next().addClass("ui-accordion-content-active");var l=this.active.next(),
n={options:f,newHeader:a([]),oldHeader:f.active,newContent:a([]),oldContent:l},e=this.active=a([]);this._toggle(e,l,n)}},_toggle:function(b,c,f,d,h){var g=this,e=g.options;g.toShow=b;g.toHide=c;g.data=f;var l=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=0===c.size()?b.size():c.size();if(e.animated){f={};f=e.collapsible&&d?{toShow:a([]),toHide:c,complete:l,down:h,autoHeight:e.autoHeight||e.fillSpace}:{toShow:b,toHide:c,complete:l,down:h,autoHeight:e.autoHeight||
e.fillSpace};e.proxied||(e.proxied=e.animated);e.proxiedDuration||(e.proxiedDuration=e.duration);e.animated=a.isFunction(e.proxied)?e.proxied(f):e.proxied;e.duration=a.isFunction(e.proxiedDuration)?e.proxiedDuration(f):e.proxiedDuration;d=a.ui.accordion.animations;var n=e.duration,p=e.animated;!p||d[p]||a.easing[p]||(p="slide");d[p]||(d[p]=function(a){this.slide(a,{easing:p,duration:n||700})});d[p](f)}else e.collapsible&&d?b.toggle():(c.hide(),b.show()),l(!0);c.prev().attr({"aria-expanded":"false",
"aria-selected":"false",tabIndex:-1}).blur();b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data))}});a.extend(a.ui.accordion,{version:"1.8.17",
animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(b.toHide.size())if(b.toShow.size()){var d=b.toShow.css("overflow"),k=0,h={},g={},e,l=b.toShow;e=l[0].style.width;l.width(l.parent().width()-parseFloat(l.css("paddingLeft"))-parseFloat(l.css("paddingRight"))-(parseFloat(l.css("borderLeftWidth"))||0)-(parseFloat(l.css("borderRightWidth"))||0));a.each(["height","paddingTop","paddingBottom"],function(c,e){g[e]="hide";var d=(""+a.css(b.toShow[0],e)).match(/^([\d+-.]+)(.*)$/);
h[e]={value:d[1],unit:d[2]||"px"}});b.toShow.css({height:0,overflow:"hidden"}).show();b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){"height"==c.prop&&(k=0===c.end-c.start?0:(c.now-c.start)/(c.end-c.start));b.toShow[0].style[c.prop]=k*h[c.prop].value+h[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height","");b.toShow.css({width:e,overflow:d});b.complete()}})}else b.toHide.animate({height:"hide",
paddingTop:"hide",paddingBottom:"hide"},b);else b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
(function(a){a.widget("ui.multiselect",{options:{sortable:!0,searchable:!0,doubleClickable:!0,animated:"fast",show:"slideDown",hide:"slideUp",dividerLocation:0.6,availableFirst:!1,nodeComparator:function(a,b){var c=a.text(),f=b.text();return c==f?0:c<f?-1:1}},_create:function(){this.element.hide();this.id=this.element.attr("id");this.container=a('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);this.count=0;this.selectedContainer=a('<div class="selected"></div>').appendTo(this.container);
this.availableContainer=a('<div class="available"></div>')[this.options.availableFirst?"prependTo":"appendTo"](this.container);this.selectedActions=a('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+a.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+a.ui.multiselect.locale.removeAll+"</a></div>").appendTo(this.selectedContainer);this.availableActions=a('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+
a.ui.multiselect.locale.addAll+"</a></div>").appendTo(this.availableContainer);this.selectedList=a('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return!1}).appendTo(this.selectedContainer);this.availableList=a('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return!1}).appendTo(this.availableContainer);var d=this;this.container.width(this.element.width()+
1);this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));this.options.animated||(this.options.show="show",this.options.hide="hide");this._populateLists(this.element.find("option"));this.options.sortable&&
this.selectedList.sortable({placeholder:"ui-state-highlight",axis:"y",update:function(b,c){d.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(d.element)})},receive:function(b,c){c.item.data("optionLink").attr("selected",!0);d.count+=1;d._updateCount();d.selectedList.children(".ui-draggable").each(function(){a(this).removeClass("ui-draggable");a(this).data("optionLink",c.item.data("optionLink"));a(this).data("idx",c.item.data("idx"));
d._applyItemState(a(this),!0)});setTimeout(function(){c.item.remove()},1)}});this.options.searchable?this._registerSearchEvents(this.availableContainer.find("input.search")):a(".search").hide();this.container.find(".remove-all").click(function(){d._populateLists(d.element.find("option").removeAttr("selected"));return!1});this.container.find(".add-all").click(function(){var b=d.element.find("option").not(":selected");1<d.availableList.children("li:hidden").length?d.availableList.children("li").each(function(c){a(this).is(":visible")&&
a(b[c-1]).attr("selected","selected")}):b.attr("selected","selected");d._populateLists(d.element.find("option"));return!1})},destroy:function(){this.element.show();this.container.remove();a.Widget.prototype.destroy.apply(this,arguments)},_populateLists:function(d){this.selectedList.children(".ui-element").remove();this.availableList.children(".ui-element").remove();this.count=0;var b=this;a(d.map(function(a){var d=b._getOptionNode(this).appendTo(this.selected?b.selectedList:b.availableList).show();
this.selected&&(b.count+=1);b._applyItemState(d,this.selected);d.data("idx",a);return d[0]}));this._updateCount();b._filter.apply(this.availableContainer.find("input.search"),[b.availableList])},_updateCount:function(){this.element.trigger("change");this.selectedContainer.find("span.count").text(this.count+" "+a.ui.multiselect.locale.itemsCount)},_getOptionNode:function(d){d=a(d);var b=a('<li class="ui-state-default ui-element" title="'+d.text()+'"><span class="ui-icon"/>'+d.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
b.data("optionLink",d);return b},_cloneWithData:function(a){var b=a.clone(!1,!1);b.data("optionLink",a.data("optionLink"));b.data("idx",a.data("idx"));return b},_setSelected:function(d,b){d.data("optionLink").attr("selected",b);if(b){var c=this._cloneWithData(d);d[this.options.hide](this.options.animated,function(){a(this).remove()});c.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(c,!0);return c}var f=this.availableList.find("li"),k=this.options.nodeComparator,
c=null,h=d.data("idx"),g=k(d,a(f[h]));if(g)for(;0<=h&&h<f.length;){if(0<g?h++:h--,g!=k(d,a(f[h]))){c=f[0<g?h:h+1];break}}else c=f[h];f=this._cloneWithData(d);c?f.insertBefore(a(c)):f.appendTo(this.availableList);d[this.options.hide](this.options.animated,function(){a(this).remove()});f.hide()[this.options.show](this.options.animated);this._applyItemState(f,!1);return f},_applyItemState:function(a,b){b?(this.options.sortable?a.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon"):
a.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),a.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus"),this._registerRemoveEvents(a.find("a.action"))):(a.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),a.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus"),this._registerAddEvents(a.find("a.action")));this._registerDoubleClickEvents(a);
this._registerHoverEvents(a)},_filter:function(d){var b=a(this),c=d.children("li");d=c.map(function(){return a(this).text().toLowerCase()});var f=a.trim(b.val().toLowerCase()),k=[];f?(c.hide(),d.each(function(a){-1<this.indexOf(f)&&k.push(a)}),a.each(k,function(){a(c[this]).show()})):c.show()},_registerDoubleClickEvents:function(d){this.options.doubleClickable&&d.dblclick(function(b){0===a(b.target).closest(".action").length&&d.find("a.action").click()})},_registerHoverEvents:function(d){d.removeClass("ui-state-hover");
d.mouseover(function(){a(this).addClass("ui-state-hover")});d.mouseout(function(){a(this).removeClass("ui-state-hover")})},_registerAddEvents:function(d){var b=this;d.click(function(){b._setSelected(a(this).parent(),!0);b.count+=1;b._updateCount();return!1});this.options.sortable&&d.each(function(){a(this).parent().draggable({connectToSortable:b.selectedList,helper:function(){var c=b._cloneWithData(a(this)).width(a(this).width()-50);c.width(a(this).width());return c},appendTo:b.container,containment:b.container,
revert:"invalid"})})},_registerRemoveEvents:function(d){var b=this;d.click(function(){b._setSelected(a(this).parent(),!1);b.count-=1;b._updateCount();return!1})},_registerSearchEvents:function(d){var b=this;d.focus(function(){a(this).addClass("ui-state-active")}).blur(function(){a(this).removeClass("ui-state-active")}).keypress(function(a){if(13==a.keyCode)return!1}).keyup(function(){b._filter.apply(this,[b.availableList])})}});a.extend(a.ui.multiselect,{locale:{addAll:"Add all",removeAll:"Remove all",
itemsCount:"items selected"}})})(jQuery);
(function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(a){return a&&("&nbsp;"==a||"&#160;"==a||1==a.length&&160==a.charCodeAt(0))?"":a?String(a).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"'):a},htmlEncode:function(a){return a?String(a).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;"):a},format:function(d){var b=a.makeArray(arguments).slice(1);void 0===d&&(d="");return d.replace(/\{(\d+)\}/g,function(a,
f){return b[f]})},getCellIndex:function(d){d=a(d);if(d.is("tr"))return-1;d=(d.is("td")||d.is("th")?d:d.closest("td,th"))[0];return a.browser.msie?a.inArray(d,d.parentNode.cells):d.cellIndex},stripHtml:function(a){a+="";var b=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return a?(a=a.replace(b,""))&&"&nbsp;"!==a&&"&#160;"!==a?a.replace(/\"/g,"'"):"":a},stringToDoc:function(a){var b;if("string"!==typeof a)return a;try{b=(new DOMParser).parseFromString(a,"text/xml")}catch(c){b=new ActiveXObject("Microsoft.XMLDOM"),
b.async=!1,b.loadXML(a)}return b&&b.documentElement&&"parsererror"!=b.documentElement.tagName?b:null},parse:function(d){"while(1);"==d.substr(0,9)&&(d=d.substr(9));"/*"==d.substr(0,2)&&(d=d.substr(2,d.length-4));d||(d="{}");return!0===a.jgrid.useJSON&&"object"===typeof JSON&&"function"===typeof JSON.parse?JSON.parse(d):eval("("+d+")")},parseDate:function(d,b){var c={m:1,d:1,y:1970,h:0,i:0,s:0},f,k,h;f=/[\\\/:_;.,\t\T\s-]/;if(b&&null!==b&&void 0!==b){b=a.trim(b);b=b.split(f);d=d.split(f);var g=a.jgrid.formatter.date.monthNames,
e=a.jgrid.formatter.date.AmPm,l=function(a,b){0===a?12==b&&(b=0):12!=b&&(b+=12);return b};f=0;for(k=d.length;f<k;f++)"M"==d[f]&&(h=a.inArray(b[f],g),-1!==h&&12>h&&(b[f]=h+1)),"F"==d[f]&&(h=a.inArray(b[f],g),-1!==h&&11<h&&(b[f]=h+1-12)),"a"==d[f]&&(h=a.inArray(b[f],e),-1!==h&&2>h&&b[f]==e[h]&&(b[f]=h,c.h=l(b[f],c.h))),"A"==d[f]&&(h=a.inArray(b[f],e),-1!==h&&1<h&&b[f]==e[h]&&(b[f]=h-2,c.h=l(b[f],c.h))),void 0!==b[f]&&(c[d[f].toLowerCase()]=parseInt(b[f],10));c.m=parseInt(c.m,10)-1;f=c.y;70<=f&&99>=
f?c.y=1900+c.y:0<=f&&69>=f&&(c.y=2E3+c.y)}return new Date(c.y,c.m,c.d,c.h,c.i,c.s,0)},jqID:function(a){return String(a).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(d){return(d?d:a.jgrid.uidPref)+a.jgrid.guid++},getAccessor:function(a,b){var c,f,k=[],h;if("function"===typeof b)return b(a);c=a[b];if(void 0===c)try{if("string"===typeof b&&(k=b.split(".")),h=k.length)for(c=a;c&&h--;)f=k.shift(),c=c[f]}catch(g){}return c},ajaxOptions:{},from:function(d){return new function(b,
c){"string"==typeof b&&(b=a.data(b));var f=this,d=b,h=!0,g=!1,e=c,l=/[\$,%]/g,n=null,p=null,q=!1,s="",r=[],w=!0;if("object"==typeof b&&b.push)0<b.length&&(w="object"!=typeof b[0]?!1:!0);else throw"data provides is not an array";this._hasData=function(){return null===d?!1:0===d.length?!1:!0};this._getStr=function(a){var b=[];g&&b.push("jQuery.trim(");b.push("String("+a+")");g&&b.push(")");h||b.push(".toLowerCase()");return b.join("")};this._strComp=function(a){return"string"==typeof a?".toString()":
""};this._group=function(a,b){return{field:a.toString(),unique:b,items:[]}};this._toStr=function(b){g&&(b=a.trim(b));h||(b=b.toLowerCase());return b.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(b){var c=[];a.each(d,function(a,e){c.push(b(e))});return c};this._append=function(a){e=null===e?"":e+(""===s?" && ":s);q&&(e+="!");e+="("+a+")";q=!1;s=""};this._setCommand=function(a,b){n=a;p=b};this._resetNegate=function(){q=!1};this._repeatCommand=function(a,b){return null===
n?f:null!==a&&null!==b?n(a,b):null!==p&&w?n(p,a):n(a)};this._equals=function(a,b){return 0===f._compare(a,b,1)};this._compare=function(a,b,c){void 0===c&&(c=1);void 0===a&&(a=null);void 0===b&&(b=null);if(null===a&&null===b)return 0;if(null===a&&null!==b)return 1;if(null!==a&&null===b)return-1;h||"number"===typeof a||"number"===typeof b||(a=String(a).toLowerCase(),b=String(b).toLowerCase());return a<b?-c:a>b?c:0};this._performSort=function(){0!==r.length&&(d=f._doSort(d,0))};this._doSort=function(a,
b){var c=r[b].by,e=r[b].dir,d=r[b].type,g=r[b].datefmt;if(b==r.length-1)return f._getOrder(a,c,e,d,g);b++;c=f._getGroup(a,c,e,d,g);e=[];for(d=0;d<c.length;d++)for(var g=f._doSort(c[d].items,b),h=0;h<g.length;h++)e.push(g[h]);return e};this._getOrder=function(b,c,e,d,g){var h=[],k=[],n="a"==e?1:-1,q,p;void 0===d&&(d="text");p="float"==d||"number"==d||"currency"==d||"numeric"==d?function(a){a=parseFloat(String(a).replace(l,""));return isNaN(a)?0:a}:"int"==d||"integer"==d?function(a){return a?parseFloat(String(a).replace(l,
"")):0}:"date"==d||"datetime"==d?function(b){return a.jgrid.parseDate(g,b).getTime()}:a.isFunction(d)?d:function(b){b||(b="");return a.trim(String(b).toUpperCase())};a.each(b,function(b,e){q=""!==c?a.jgrid.getAccessor(e,c):e;void 0===q&&(q="");q=p(q,e);k.push({vSort:q,index:b})});k.sort(function(a,b){a=a.vSort;b=b.vSort;return f._compare(a,b,n)});d=0;for(var r=b.length;d<r;)e=k[d].index,h.push(b[e]),d++;return h};this._getGroup=function(b,c,e,d,g){var h=[],k=null,l=null,n;a.each(f._getOrder(b,c,e,
d,g),function(b,e){n=a.jgrid.getAccessor(e,c);void 0===n&&(n="");f._equals(l,n)||(l=n,null!==k&&h.push(k),k=f._group(c,n));k.items.push(e)});null!==k&&h.push(k);return h};this.ignoreCase=function(){h=!1;return f};this.useCase=function(){h=!0;return f};this.trim=function(){g=!0;return f};this.noTrim=function(){g=!1;return f};this.execute=function(){var b=e,c=[];if(null===b)return f;a.each(d,function(){eval(b)&&c.push(this)});d=c;return f};this.data=function(){return d};this.select=function(b){f._performSort();
if(!f._hasData())return[];f.execute();if(a.isFunction(b)){var c=[];a.each(d,function(a,e){c.push(b(e))});return c}return d};this.hasMatch=function(){if(!f._hasData())return!1;f.execute();return 0<d.length};this.andNot=function(a,b,c){q=!q;return f.and(a,b,c)};this.orNot=function(a,b,c){q=!q;return f.or(a,b,c)};this.not=function(a,b,c){return f.andNot(a,b,c)};this.and=function(a,b,c){s=" && ";return void 0===a?f:f._repeatCommand(a,b,c)};this.or=function(a,b,c){s=" || ";return void 0===a?f:f._repeatCommand(a,
b,c)};this.isNot=function(a){q=!q;return f.is(a)};this.is=function(a){f._append("this."+a);f._resetNegate();return f};this._compareValues=function(b,c,e,d,g){var h;h=w?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";void 0===e&&(e=null);var k=e,n=void 0===g.stype?"text":g.stype;if(null!==e)switch(n){case "int":case "integer":k=isNaN(Number(k))||""===k?"0":k;h="parseInt("+h+",10)";k="parseInt("+k+",10)";break;case "float":case "number":case "numeric":k=String(k).replace(l,"");k=isNaN(Number(k))||""===
k?"0":k;h="parseFloat("+h+")";k="parseFloat("+k+")";break;case "date":case "datetime":k=String(a.jgrid.parseDate(g.newfmt||"Y-m-d",k).getTime());h='jQuery.jgrid.parseDate("'+g.srcfmt+'",'+h+").getTime()";break;default:h=f._getStr(h),k=f._getStr('"'+f._toStr(k)+'"')}f._append(h+" "+d+" "+k);f._setCommand(b,c);f._resetNegate();return f};this.equals=function(a,b,c){return f._compareValues(f.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return f._compareValues(f.equals,a,b,"!==",c)};this.isNull=
function(a,b,c){return f._compareValues(f.equals,a,null,"===",c)};this.greater=function(a,b,c){return f._compareValues(f.greater,a,b,">",c)};this.less=function(a,b,c){return f._compareValues(f.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return f._compareValues(f.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return f._compareValues(f.lessOrEquals,a,b,"<=",c)};this.startsWith=function(b,c){var e=void 0===c||null===c?b:c,e=g?a.trim(e.toString()).length:e.toString().length;
w?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(c)+'"')):(e=g?a.trim(c.toString()).length:c.toString().length,f._append(f._getStr("this")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(b)+'"')));f._setCommand(f.startsWith,b);f._resetNegate();return f};this.endsWith=function(b,c){var e=void 0===c||null===c?b:c,e=g?a.trim(e.toString()).length:e.toString().length;w?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr("+f._getStr("jQuery.jgrid.getAccessor(this,'"+
b+"')")+".length-"+e+","+e+') == "'+f._toStr(c)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(b)+'".length,"'+f._toStr(b)+'".length) == "'+f._toStr(b)+'"');f._setCommand(f.endsWith,b);f._resetNegate();return f};this.contains=function(a,b){w?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+'.indexOf("'+f._toStr(b)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(a)+'",0) > -1');f._setCommand(f.contains,a);f._resetNegate();return f};this.groupBy=
function(a,b,c,e){return f._hasData()?f._getGroup(d,a,b,c,e):null};this.orderBy=function(b,c,e,d){c=void 0===c||null===c?"a":a.trim(c.toString().toLowerCase());if(null===e||void 0===e)e="text";if(null===d||void 0===d)d="Y-m-d";if("desc"==c||"descending"==c)c="d";if("asc"==c||"ascending"==c)c="a";r.push({by:b,dir:c,type:e,datefmt:d});return f};return f}(d,null)},extend:function(d){a.extend(a.fn.jqGrid,d);this.no_legacy_api||a.fn.extend(d)}});a.fn.jqGrid=function(d){if("string"==typeof d){var b=a.jgrid.getAccessor(a.fn.jqGrid,
d);if(!b)throw"jqGrid - No such method: "+d;var c=a.makeArray(arguments).slice(1);return b.apply(this,c)}return this.each(function(){if(!this.grid){var b=a.extend(!0,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:!0,pginput:!0,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:!1,selarrrow:[],savedRow:[],shrinkToFit:!0,xmlReader:{},jsonReader:{},subGrid:!1,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:!1,loadonce:!1,multiselect:!1,multikey:!1,editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,postData:{},userData:{},treeGrid:!1,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:!1,gridstate:"visible",cellEdit:!1,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[!1,""],scroll:!1,multiboxonly:!1,deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:!1,rownumWidth:25,rownumbers:!1,pagerpos:"center",recordpos:"right",footerrow:!1,userDataOnFooter:!1,
hoverrows:!0,altclass:"ui-priority-secondary",viewsortcols:[!1,"vertical",!0],resizeclass:"",autoencode:!1,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:!1,headertitles:!1,scrollTimeout:40,data:[],_index:{},grouping:!1,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,sortitems:[],sortnames:[],groupDataSorted:!1,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:!1,
cmTemplate:{}},a.jgrid.defaults,d||{}),c={headers:[],cols:[],footers:[],dragStart:function(c,e,d){this.resizing={idx:c,startX:e.clientX,sOL:d[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+a.jgrid.jqID(b.id),"#gbox_"+a.jgrid.jqID(b.id));this.curGbox.css({display:"block",left:d[0],top:d[1],height:d[2]});a.isFunction(b.resizeStart)&&b.resizeStart.call(this,e,c);document.onselectstart=function(){return!1}},dragMove:function(a){if(this.resizing){var c=a.clientX-this.resizing.startX;a=
this.headers[this.resizing.idx];var e="ltr"===b.direction?a.width+c:a.width-c,d;33<e&&(this.curGbox.css({left:this.resizing.sOL+c}),!0===b.forceFit?(d=this.headers[this.resizing.idx+b.nv],c="ltr"===b.direction?d.width-c:d.width+c,33<c&&(a.newWidth=e,d.newWidth=c)):(this.newWidth="ltr"===b.direction?b.tblwidth+c:b.tblwidth-c,a.newWidth=e))}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,e=this.headers[c].newWidth||this.headers[c].width,e=parseInt(e,10);
this.resizing=!1;a("#rs_m"+a.jgrid.jqID(b.id)).css("display","none");b.colModel[c].width=e;this.headers[c].width=e;this.headers[c].el.style.width=e+"px";this.cols[c].style.width=e+"px";0<this.footers.length&&(this.footers[c].style.width=e+"px");!0===b.forceFit?(e=this.headers[c+b.nv].newWidth||this.headers[c+b.nv].width,this.headers[c+b.nv].width=e,this.headers[c+b.nv].el.style.width=e+"px",this.cols[c+b.nv].style.width=e+"px",0<this.footers.length&&(this.footers[c+b.nv].style.width=e+"px"),b.colModel[c+
b.nv].width=e):(b.tblwidth=this.newWidth||b.tblwidth,a("table:first",this.bDiv).css("width",b.tblwidth+"px"),a("table:first",this.hDiv).css("width",b.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,b.footerrow&&(a("table:first",this.sDiv).css("width",b.tblwidth+"px"),this.sDiv.scrollLeft=this.bDiv.scrollLeft));a.isFunction(b.resizeStop)&&b.resizeStop.call(this,e,c)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){c.timer&&clearTimeout(c.timer);c.timer=
null;var e=a(c.bDiv).height();if(e){var d=a("table:first",c.bDiv),g,h;if(d[0].rows.length)try{h=(g=d[0].rows[1])?a(g).outerHeight()||c.prevRowHeight:c.prevRowHeight}catch(l){h=c.prevRowHeight}if(h){c.prevRowHeight=h;var m=b.rowNum;g=c.scrollTop=c.bDiv.scrollTop;var n=Math.round(d.position().top)-g,q=n+d.height();h*=m;var p,r,s;q<e&&0>=n&&(void 0===b.lastpage||parseInt((q+g+h-1)/h,10)<=b.lastpage)&&(r=parseInt((e-q+h-1)/h,10),0<=q||2>r||!0===b.scroll?(p=Math.round((q+g)/h)+1,n=-1):n=1);0<n&&(p=parseInt(g/
h,10)+1,r=parseInt((g+e)/h,10)+2-p,s=!0);!r||b.lastpage&&p>b.lastpage||(1==b.lastpage||p===b.page&&p===b.lastpage)||(c.hDiv.loading?c.timer=setTimeout(c.populateVisible,b.scrollTimeout):(b.page=p,s&&(c.selectionPreserver(d[0]),c.emptyRows(c.bDiv,!1,!1)),c.populate(r)))}}},scrollGrid:function(a){if(b.scroll){var e=c.bDiv.scrollTop;void 0===c.scrollTop&&(c.scrollTop=0);e!=c.scrollTop&&(c.scrollTop=e,c.timer&&clearTimeout(c.timer),c.timer=setTimeout(c.populateVisible,b.scrollTimeout))}c.hDiv.scrollLeft=
c.bDiv.scrollLeft;b.footerrow&&(c.sDiv.scrollLeft=c.bDiv.scrollLeft);a&&a.stopPropagation()},selectionPreserver:function(b){var c=b.p,e=c.selrow,d=c.selarrrow?a.makeArray(c.selarrrow):null,f=b.grid.bDiv.scrollLeft,g=c.gridComplete;c.gridComplete=function(){c.selrow=null;c.selarrrow=[];if(c.multiselect&&d&&0<d.length)for(var h=0;h<d.length;h++)d[h]!=e&&a(b).jqGrid("setSelection",d[h],!1);e&&a(b).jqGrid("setSelection",e,!1);b.grid.bDiv.scrollLeft=f;c.gridComplete=g;c.gridComplete&&g()}}};if("TABLE"!=
this.tagName.toUpperCase())alert("Element is not a table");else{a(this).empty().attr("tabindex","1");this.p=b;var h,g,e;if(0===this.p.colNames.length)for(h=0;h<this.p.colModel.length;h++)this.p.colNames[h]=this.p.colModel[h].label||this.p.colModel[h].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var l=a("<div class='ui-jqgrid-view'></div>"),n,p=a.browser.msie?!0:!1,q=a.browser.webkit||a.browser.safari?!0:!1;e=this;e.p.direction=a.trim(e.p.direction.toLowerCase());
-1==a.inArray(e.p.direction,["ltr","rtl"])&&(e.p.direction="ltr");g=e.p.direction;a(l).insertBefore(this);a(this).appendTo(l).removeClass("scroll");var s=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(s).insertBefore(l).attr({id:"gbox_"+this.id,dir:g});a(l).appendTo(s).attr("id","gview_"+this.id);n=p&&6>=a.browser.version?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+
this.id+"'></div>").append(n).insertBefore(l);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(l);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var r=function(a,b){a=parseInt(a,10);return isNaN(a)?b?b:0:a},w=function(b,d,f,g,h,l){var m=e.p.colModel[b],n=m.align,q='style="',p=m.classes,r=m.name,s=[];n&&(q+="text-align:"+n+";");
!0===m.hidden&&(q+="display:none;");if(0===d)q+="width: "+c.headers[b].width+"px;";else if(m.cellattr&&a.isFunction(m.cellattr)&&(b=m.cellattr.call(e,h,f,g,m,l))&&"string"===typeof b)if(b=b.replace(/style/i,"style").replace(/title/i,"title"),-1<b.indexOf("title")&&(m.title=!1),-1<b.indexOf("class")&&(p=void 0),s=b.split("style"),2===s.length){s[1]=a.trim(s[1].replace("=",""));if(0===s[1].indexOf("'")||0===s[1].indexOf('"'))s[1]=s[1].substring(1);q+=s[1].replace(/'/gi,'"')}else q+='"';s.length||(s[0]=
"",q+='"');q+=(void 0!==p?' class="'+p+'"':"")+(m.title&&f?' title="'+a.jgrid.stripHtml(f)+'"':"");q+=' aria-describedby="'+e.p.id+"_"+r+'"';return q+s[0]},v=function(b){return void 0===b||null===b||""===b?"&#160;":e.p.autoencode?a.jgrid.htmlEncode(b):b+""},u=function(b,c,d,f,g){var h=e.p.colModel[d];"undefined"!==typeof h.formatter?(b={rowId:b,colModel:h,gid:e.p.id,pos:d},c=a.isFunction(h.formatter)?h.formatter.call(e,c,b,f,g):a.fmatter?a.fn.fmatter(h.formatter,c,b,f,g):v(c)):c=v(c);return c},x=
function(a,b,c,e,d){b=u(a,b,c,d,"add");return'<td role="gridcell" '+w(c,e,b,d,a,!0)+">"+b+"</td>"},B=function(a,b,c){var d='<input role="checkbox" type="checkbox" id="jqg_'+e.p.id+"_"+a+'" class="cbox" name="jqg_'+e.p.id+"_"+a+'"/>';return'<td role="gridcell" '+w(b,c,"",null,a,!0)+">"+d+"</td>"},A=function(a,b,c,e){c=(parseInt(c,10)-1)*parseInt(e,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+w(a,b,c,null,b,!0)+">"+c+"</td>"},z=function(a){var b,c=[],d=0,f;for(f=0;f<e.p.colModel.length;f++)b=
e.p.colModel[f],"cb"!==b.name&&"subgrid"!==b.name&&"rn"!==b.name&&(c[d]="local"==a?b.name:"xml"==a?b.xmlmap||b.name:b.jsonmap||b.name,d++);return c},D=function(b){var c=e.p.remapColumns;c&&c.length||(c=a.map(e.p.colModel,function(a,b){return b}));b&&(c=a.map(c,function(a){return a<b?null:a-b}));return c},E=function(b,c,d){if(e.p.deepempty)a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:gt(0)").remove();else{var f=a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").empty().append(f)}c&&
e.p.scroll&&(a(">div:first",b).css({height:"auto"}).children("div:first").css({height:0,display:"none"}),b.scrollTop=0);!0===d&&!0===e.p.treeGrid&&(e.p.data=[],e.p._index={})},I=function(){var b=e.p.data.length,c,d,f;c=!0===e.p.rownumbers?1:0;d=!0===e.p.multiselect?1:0;f=!0===e.p.subGrid?1:0;c=!1===e.p.keyIndex||!0===e.p.loadonce?e.p.localReader.id:e.p.colModel[e.p.keyIndex+d+f+c].name;for(d=0;d<b;d++)f=a.jgrid.getAccessor(e.p.data[d],c),e.p._index[f]=d},F=function(b,c,d,f,g){var h=new Date,k="local"!=
e.p.datatype&&e.p.loadonce||"xmlstring"==e.p.datatype,l="local"==e.p.datatype?"local":"xml";k&&(e.p.data=[],e.p._index={},e.p.localReader.id="_id_");e.p.reccount=0;if(a.isXMLDoc(b)){-1!==e.p.treeANode||e.p.scroll?d=1<d?d:1:(E(c,!1,!0),d=1);var m,q,n=0,p,r=0,s=0,v=0,u,w=[],y,C={},I,F,J=[],N=!0===e.p.altRows?" "+e.p.altclass:"";e.p.xmlReader.repeatitems||(w=z(l));u=!1===e.p.keyIndex?e.p.xmlReader.id:e.p.keyIndex;0<w.length&&!isNaN(u)&&(e.p.remapColumns&&e.p.remapColumns.length&&(u=a.inArray(u,e.p.remapColumns)),
u=w[u]);l=-1===(u+"").indexOf("[")?w.length?function(b,c){return a(u,b).text()||c}:function(b,c){return a(e.p.xmlReader.cell,b).eq(u).text()||c}:function(a,b){return a.getAttribute(u.replace(/[\[\]]/g,""))||b};e.p.userData={};a(e.p.xmlReader.page,b).each(function(){e.p.page=this.textContent||this.text||0});a(e.p.xmlReader.total,b).each(function(){e.p.lastpage=this.textContent||this.text;void 0===e.p.lastpage&&(e.p.lastpage=1)});a(e.p.xmlReader.records,b).each(function(){e.p.records=this.textContent||
this.text||0});a(e.p.xmlReader.userdata,b).each(function(){e.p.userData[this.getAttribute("name")]=this.textContent||this.text});(b=a(e.p.xmlReader.root+" "+e.p.xmlReader.row,b))||(b=[]);var G=b.length,K=0,U={},Q;if(b&&G){Q=parseInt(e.p.rowNum,10);var P=e.p.scroll?a.jgrid.randId():1;g&&(Q*=g+1);g=a.isFunction(e.p.afterInsertRow);var T="";for(e.p.grouping&&!0===e.p.groupingView.groupCollapse&&(T=' style="display:none;"');K<G;){I=b[K];F=l(I,P+K);m=0===d?0:d+1;m=1==(m+K)%2?N:"";J.push("<tr"+T+' id="'+
F+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+e.p.direction+""+m+'">');!0===e.p.rownumbers&&(J.push(A(0,K,e.p.page,e.p.rowNum)),v=1);!0===e.p.multiselect&&(J.push(B(F,v,K)),r=1);!0===e.p.subGrid&&(J.push(a(e).jqGrid("addSubGridCell",r+v,K+d)),s=1);if(e.p.xmlReader.repeatitems){y||(y=D(r+s+v));var da=a(e.p.xmlReader.cell,I);a.each(y,function(a){var b=da[this];if(!b)return!1;p=b.textContent||b.text;C[e.p.colModel[a+r+s+v].name]=p;J.push(x(F,p,a+r+s+v,K+d,I))})}else for(m=0;m<
w.length;m++)p=a(w[m],I).text(),C[e.p.colModel[m+r+s+v].name]=p,J.push(x(F,p,m+r+s+v,K+d,I));J.push("</tr>");if(e.p.grouping){m=e.p.groupingView.groupField.length;for(var X=[],R=0;R<m;R++)X.push(C[e.p.groupingView.groupField[R]]);U=a(e).jqGrid("groupingPrepare",J,X,U,C);J=[]}if(k||!0===e.p.treeGrid)C._id_=F,e.p.data.push(C),e.p._index[F]=e.p.data.length-1;!1===e.p.gridview&&(a("tbody:first",c).append(J.join("")),g&&e.p.afterInsertRow.call(e,F,C,I),J=[]);C={};n++;K++;if(n==Q)break}}!0===e.p.gridview&&
(q=-1<e.p.treeANode?e.p.treeANode:0,e.p.grouping?(a(e).jqGrid("groupingRender",U,e.p.colModel.length),U=null):!0===e.p.treeGrid&&0<q?a(e.rows[q]).after(J.join("")):a("tbody:first",c).append(J.join("")));if(!0===e.p.subGrid)try{a(e).jqGrid("addSubGrid",r+v)}catch(M){}e.p.totaltime=new Date-h;0<n&&0===e.p.records&&(e.p.records=G);J=null;if(!0===e.p.treeGrid)try{a(e).jqGrid("setTreeNode",q+1,n+q+1)}catch(Y){}e.p.treeGrid||e.p.scroll||(e.grid.bDiv.scrollTop=0);e.p.reccount=n;e.p.treeANode=-1;e.p.userDataOnFooter&&
a(e).jqGrid("footerData","set",e.p.userData,!0);k&&(e.p.records=G,e.p.lastpage=Math.ceil(G/Q));f||e.updatepager(!1,!0);if(k)for(;n<G;){I=b[n];F=l(I,n);if(e.p.xmlReader.repeatitems){y||(y=D(r+s+v));var O=a(e.p.xmlReader.cell,I);a.each(y,function(a){var b=O[this];if(!b)return!1;p=b.textContent||b.text;C[e.p.colModel[a+r+s+v].name]=p})}else for(m=0;m<w.length;m++)p=a(w[m],I).text(),C[e.p.colModel[m+r+s+v].name]=p;C._id_=F;e.p.data.push(C);e.p._index[F]=e.p.data.length-1;C={};n++}}},C=function(b,c,d,
f,g){var h=new Date;if(b){-1!==e.p.treeANode||e.p.scroll?d=1<d?d:1:(E(c,!1,!0),d=1);var k,l="local"!=e.p.datatype&&e.p.loadonce||"jsonstring"==e.p.datatype;l&&(e.p.data=[],e.p._index={},e.p.localReader.id="_id_");e.p.reccount=0;"local"==e.p.datatype?(c=e.p.localReader,k="local"):(c=e.p.jsonReader,k="json");var m=0,n,q,p=[],r,s=0,v=0,u=0,w,C,y={},I,F,J=[],N=!0===e.p.altRows?" "+e.p.altclass:"";e.p.page=a.jgrid.getAccessor(b,c.page)||0;w=a.jgrid.getAccessor(b,c.total);e.p.lastpage=void 0===w?1:w;e.p.records=
a.jgrid.getAccessor(b,c.records)||0;e.p.userData=a.jgrid.getAccessor(b,c.userdata)||{};c.repeatitems||(r=p=z(k));k=!1===e.p.keyIndex?c.id:e.p.keyIndex;0<p.length&&!isNaN(k)&&(e.p.remapColumns&&e.p.remapColumns.length&&(k=a.inArray(k,e.p.remapColumns)),k=p[k]);(C=a.jgrid.getAccessor(b,c.root))||(C=[]);w=C.length;b=0;var G=parseInt(e.p.rowNum,10),K=e.p.scroll?a.jgrid.randId():1;g&&(G*=g+1);var U=a.isFunction(e.p.afterInsertRow),Q={},T="";for(e.p.grouping&&!0===e.p.groupingView.groupCollapse&&(T=' style="display:none;"');b<
w;){g=C[b];F=a.jgrid.getAccessor(g,k);void 0===F&&(F=K+b,0===p.length&&c.cell&&(F=a.jgrid.getAccessor(g,c.cell)[k]||F));n=1===d?0:d;n=1==(n+b)%2?N:"";J.push("<tr"+T+' id="'+F+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+e.p.direction+""+n+'">');!0===e.p.rownumbers&&(J.push(A(0,b,e.p.page,e.p.rowNum)),u=1);e.p.multiselect&&(J.push(B(F,u,b)),s=1);e.p.subGrid&&(J.push(a(e).jqGrid("addSubGridCell",s+u,b+d)),v=1);c.repeatitems&&(c.cell&&(g=a.jgrid.getAccessor(g,c.cell)),r||(r=
D(s+v+u)));for(q=0;q<r.length;q++)n=a.jgrid.getAccessor(g,r[q]),J.push(x(F,n,q+s+v+u,b+d,g)),y[e.p.colModel[q+s+v+u].name]=n;J.push("</tr>");if(e.p.grouping){n=e.p.groupingView.groupField.length;q=[];for(var P=0;P<n;P++)q.push(y[e.p.groupingView.groupField[P]]);Q=a(e).jqGrid("groupingPrepare",J,q,Q,y);J=[]}if(l||!0===e.p.treeGrid)y._id_=F,e.p.data.push(y),e.p._index[F]=e.p.data.length-1;!1===e.p.gridview&&(a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(J.join("")),U&&e.p.afterInsertRow.call(e,
F,y,g),J=[]);y={};m++;b++;if(m==G)break}!0===e.p.gridview&&(I=-1<e.p.treeANode?e.p.treeANode:0,e.p.grouping?a(e).jqGrid("groupingRender",Q,e.p.colModel.length):!0===e.p.treeGrid&&0<I?a(e.rows[I]).after(J.join("")):a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(J.join("")));if(!0===e.p.subGrid)try{a(e).jqGrid("addSubGrid",s+u)}catch(X){}e.p.totaltime=new Date-h;0<m&&0===e.p.records&&(e.p.records=w);if(!0===e.p.treeGrid)try{a(e).jqGrid("setTreeNode",I+1,m+I+1)}catch(da){}e.p.treeGrid||e.p.scroll||
(e.grid.bDiv.scrollTop=0);e.p.reccount=m;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,!0);l&&(e.p.records=w,e.p.lastpage=Math.ceil(w/G));f||e.updatepager(!1,!0);if(l)for(;m<w&&C[m];){g=C[m];F=a.jgrid.getAccessor(g,k);void 0===F&&(F=K+m,0===p.length&&c.cell&&(F=a.jgrid.getAccessor(g,c.cell)[k]||F));if(g){c.repeatitems&&(c.cell&&(g=a.jgrid.getAccessor(g,c.cell)),r||(r=D(s+v+u)));for(q=0;q<r.length;q++)n=a.jgrid.getAccessor(g,r[q]),y[e.p.colModel[q+s+v+u].name]=
n;y._id_=F;e.p.data.push(y);e.p._index[F]=e.p.data.length-1;y={}}m++}}},y=function(){function b(c){var e=0,d,g,h;if(void 0!==c.groups)for(d=0;d<c.groups.length;d++){try{b(c.groups[d])}catch(k){alert(k)}e++}if(void 0!==c.rules){if(0<e){var l=p.select();p=a.jgrid.from(l)}try{for(d=0;d<c.rules.length;d++)h=c.rules[d],g=c.groupOp.toString().toUpperCase(),n[h.op]&&h.field&&(0<e&&g&&"OR"===g&&(p=p.or()),p=n[h.op](p,g)(h.field,h.data,f[h.field])),e++}catch(m){alert(m)}}}var c,d=!1,f={},g=[],h=[],k,l,m;if(a.isArray(e.p.data)){var q=
e.p.grouping?e.p.groupingView:!1;a.each(e.p.colModel,function(){l=this.sorttype||"text";"date"==l||"datetime"==l?(this.formatter&&"string"===typeof this.formatter&&"date"==this.formatter?(k=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat,m=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat):k=m=this.datefmt||"Y-m-d",f[this.name]={stype:l,srcfmt:k,newfmt:m}):f[this.name]={stype:l,
srcfmt:"",newfmt:""};if(e.p.grouping&&this.name==q.groupField[0]){var b=this.name;"undefined"!=typeof this.index&&(b=this.index);g[0]=f[b];h.push(b)}d||this.index!=e.p.sortname&&this.name!=e.p.sortname||(c=this.name,d=!0)});if(e.p.treeGrid)a(e).jqGrid("SortTree",c,e.p.sortorder,f[c].stype,f[c].srcfmt);else{var n={eq:function(a){return a.equals},ne:function(a){return a.notEquals},lt:function(a){return a.less},le:function(a){return a.lessOrEquals},gt:function(a){return a.greater},ge:function(a){return a.greaterOrEquals},
cn:function(a){return a.contains},nc:function(a,b){return"OR"===b?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return"OR"===b?a.orNot().startsWith:a.andNot().startsWith},en:function(a,b){return"OR"===b?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return"OR"===b?a.orNot().equals:a.andNot().equals},"in":function(a){return a.equals},nu:function(a){return a.isNull},nn:function(a,b){return"OR"===b?a.orNot().isNull:
a.andNot().isNull}},p=a.jgrid.from(e.p.data);e.p.ignoreCase&&(p=p.ignoreCase());if(!0===e.p.search){var r=e.p.postData.filters;if(r)"string"==typeof r&&(r=a.jgrid.parse(r)),b(r);else try{p=n[e.p.postData.searchOper](p)(e.p.postData.searchField,e.p.postData.searchString,f[e.p.postData.searchField])}catch(s){}}e.p.grouping&&(p.orderBy(h,q.groupOrder[0],g[0].stype,g[0].srcfmt),q.groupDataSorted=!0);c&&e.p.sortorder&&d&&("DESC"==e.p.sortorder.toUpperCase()?p.orderBy(e.p.sortname,"d",f[c].stype,f[c].srcfmt):
p.orderBy(e.p.sortname,"a",f[c].stype,f[c].srcfmt));var r=p.select(),v=parseInt(e.p.rowNum,10),u=r.length,w=parseInt(e.p.page,10),x=Math.ceil(u/v),z={},r=r.slice((w-1)*v,w*v),f=p=null;z[e.p.localReader.total]=x;z[e.p.localReader.page]=w;z[e.p.localReader.records]=u;z[e.p.localReader.root]=r;r=null;return z}}},T=function(){e.grid.hDiv.loading=!0;if(!e.p.hiddengrid)switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).show();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).show(),a("#load_"+
a.jgrid.jqID(e.p.id)).show()}},Y=function(){e.grid.hDiv.loading=!1;switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).hide();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).hide(),a("#load_"+a.jgrid.jqID(e.p.id)).hide()}},m=function(b){if(!e.grid.hDiv.loading){var c=e.p.scroll&&!1===b,d={},f,g=e.p.prmNames;0>=e.p.page&&(e.p.page=1);null!==g.search&&(d[g.search]=e.p.search);null!==g.nd&&(d[g.nd]=(new Date).getTime());null!==g.rows&&(d[g.rows]=e.p.rowNum);null!==g.page&&(d[g.page]=
e.p.page);null!==g.sort&&(d[g.sort]=e.p.sortname);null!==g.order&&(d[g.order]=e.p.sortorder);null!==e.p.rowTotal&&null!==g.totalrows&&(d[g.totalrows]=e.p.rowTotal);var h=e.p.loadComplete,k=a.isFunction(h);k||(h=null);var l=0;b=b||1;1<b?null!==g.npage?(d[g.npage]=b,l=b-1,b=1):h=function(a){e.p.page++;e.grid.hDiv.loading=!1;k&&e.p.loadComplete.call(e,a);m(b-1)}:null!==g.npage&&delete e.p.postData[g.npage];e.p.grouping&&(a(e).jqGrid("groupingSetup"),!0===e.p.groupingView.groupDataSorted&&(d[g.sort]=
e.p.groupingView.groupField[0]+" "+e.p.groupingView.groupOrder[0]+", "+d[g.sort]));a.extend(e.p.postData,d);var q=e.p.scroll?e.rows.length-1:1;if(a.isFunction(e.p.datatype))e.p.datatype.call(e,e.p.postData,"load_"+e.p.id);else switch(a.isFunction(e.p.beforeRequest)&&e.p.beforeRequest.call(e),f=e.p.datatype.toLowerCase(),f){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:e.p.url,type:e.p.mtype,dataType:f,data:a.isFunction(e.p.serializeGridData)?e.p.serializeGridData.call(e,e.p.postData):
e.p.postData,success:function(a){"xml"===f?F(a,e.grid.bDiv,q,1<b,l):C(a,e.grid.bDiv,q,1<b,l);h&&h.call(e,a);c&&e.grid.populateVisible();if(e.p.loadonce||e.p.treeGrid)e.p.datatype="local";Y()},error:function(b,c,d){a.isFunction(e.p.loadError)&&e.p.loadError.call(e,b,c,d);Y()},beforeSend:function(b){T();a.isFunction(e.p.loadBeforeSend)&&e.p.loadBeforeSend.call(e,b)}},a.jgrid.ajaxOptions,e.p.ajaxGridOptions));break;case "xmlstring":T();d=a.jgrid.stringToDoc(e.p.datastr);F(d,e.grid.bDiv);k&&e.p.loadComplete.call(e,
d);e.p.datatype="local";e.p.datastr=null;Y();break;case "jsonstring":T();d="string"==typeof e.p.datastr?a.jgrid.parse(e.p.datastr):e.p.datastr;C(d,e.grid.bDiv);k&&e.p.loadComplete.call(e,d);e.p.datatype="local";e.p.datastr=null;Y();break;case "local":case "clientside":T(),e.p.datatype="local",d=y(),C(d,e.grid.bDiv,q,1<b,l),h&&h.call(e,d),c&&e.grid.populateVisible(),Y()}}};n=function(b,c){var d="",f="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
h="",k,l,q,n,p=function(b){var c;a.isFunction(e.p.onPaging)&&(c=e.p.onPaging.call(e,b));e.p.selrow=null;e.p.multiselect&&(e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1));e.p.savedRow=[];return"stop"==c?!1:!0};b=b.substr(1);c+="_"+b;k="pg_"+b;l=b+"_left";q=b+"_center";n=b+"_right";a("#"+a.jgrid.jqID(b)).append("<div id='"+k+"' 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='"+
l+"' align='left'></td><td id='"+q+"' align='center' style='white-space:pre;'></td><td id='"+n+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(0<e.p.rowList.length){h="<td dir='"+g+"'>";h+="<select class='ui-pg-selbox' role='listbox'>";for(l=0;l<e.p.rowList.length;l++)h+='<option role="option" value="'+e.p.rowList[l]+'"'+(e.p.rowNum==e.p.rowList[l]?' selected="selected"':"")+">"+e.p.rowList[l]+"</option>";h+="</select></td>"}"rtl"==g&&(f+=h);!0===e.p.pginput&&(d="<td dir='"+
g+"'>"+a.jgrid.format(e.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+a.jgrid.jqID(b)+"'></span>")+"</td>");!0===e.p.pgbuttons?(l=["first"+c,"prev"+c,"next"+c,"last"+c],"rtl"==g&&l.reverse(),f+="<td id='"+l[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>",f+="<td id='"+l[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>",f=f+(""!==d?
"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+d+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"")+("<td id='"+l[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>"),f+="<td id='"+l[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"):""!==d&&(f+=d);"ltr"==g&&(f+=h);f+="</tr></tbody></table>";!0===e.p.viewrecords&&
a("td#"+b+"_"+e.p.recordpos,"#"+k).append("<div dir='"+g+"' style='text-align:"+e.p.recordpos+"' class='ui-paging-info'></div>");a("td#"+b+"_"+e.p.pagerpos,"#"+k).append(f);h=a(".ui-jqgrid").css("font-size")||"11px";a(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+h+";visibility:hidden;' ></div>");f=a(f).clone().appendTo("#testpg").width();a("#testpg").remove();0<f&&(""!==d&&(f+=50),a("td#"+b+"_"+e.p.pagerpos,"#"+k).width(f));e.p._nvtd=[];
e.p._nvtd[0]=f?Math.floor((e.p.width-f)/2):Math.floor(e.p.width/3);e.p._nvtd[1]=0;f=null;a(".ui-pg-selbox","#"+k).bind("change",function(){e.p.page=Math.round(e.p.rowNum*(e.p.page-1)/this.value-0.5)+1;e.p.rowNum=this.value;c?a(".ui-pg-selbox",e.p.pager).val(this.value):e.p.toppager&&a(".ui-pg-selbox",e.p.toppager).val(this.value);if(!p("records"))return!1;m();return!1});!0===e.p.pgbuttons&&(a(".ui-pg-button","#"+k).hover(function(){a(this).hasClass("ui-state-disabled")?this.style.cursor="default":
(a(this).addClass("ui-state-hover"),this.style.cursor="pointer")},function(){a(this).hasClass("ui-state-disabled")||(a(this).removeClass("ui-state-hover"),this.style.cursor="default")}),a("#first"+a.jgrid.jqID(c)+", #prev"+a.jgrid.jqID(c)+", #next"+a.jgrid.jqID(c)+", #last"+a.jgrid.jqID(c)).click(function(){var a=r(e.p.page,1),b=r(e.p.lastpage,1),d=!1,f=!0,g=!0,h=!0,k=!0;0===b||1===b?k=h=g=f=!1:1<b&&1<=a?1===a?g=f=!1:1<a&&a<b||a===b&&(k=h=!1):1<b&&0===a&&(k=h=!1,a=b-1);this.id==="first"+c&&f&&(e.p.page=
1,d=!0);this.id==="prev"+c&&g&&(e.p.page=a-1,d=!0);this.id==="next"+c&&h&&(e.p.page=a+1,d=!0);this.id==="last"+c&&k&&(e.p.page=b,d=!0);if(d){if(!p(this.id))return!1;m()}return!1}));!0===e.p.pginput&&a("input.ui-pg-input","#"+k).keypress(function(b){if(13==(b.charCode?b.charCode:b.keyCode?b.keyCode:0)){e.p.page=0<a(this).val()?a(this).val():e.p.page;if(!p("user"))return!1;m();return!1}return this})};var V=function(b,c,d,f){if(e.p.colModel[c].sortable&&!(0<e.p.savedRow.length)){d||(e.p.lastsort==c?
"asc"==e.p.sortorder?e.p.sortorder="desc":"desc"==e.p.sortorder&&(e.p.sortorder="asc"):e.p.sortorder=e.p.colModel[c].firstsortorder||"asc",e.p.page=1);if(f)if(e.p.lastsort!=c||e.p.sortorder!=f||d)e.p.sortorder=f;else return;d=a("thead:first",e.grid.hDiv).get(0);a("tr th:eq("+e.p.lastsort+") span.ui-grid-ico-sort",d).addClass("ui-state-disabled");a("tr th:eq("+e.p.lastsort+")",d).attr("aria-selected","false");a("tr th:eq("+c+") span.ui-icon-"+e.p.sortorder,d).removeClass("ui-state-disabled");a("tr th:eq("+
c+")",d).attr("aria-selected","true");e.p.viewsortcols[0]||e.p.lastsort==c||(a("tr th:eq("+e.p.lastsort+") span.s-ico",d).hide(),a("tr th:eq("+c+") span.s-ico",d).show());b=b.substring(5);e.p.sortname=e.p.colModel[c].index||b;d=e.p.sortorder;a.isFunction(e.p.onSortCol)&&"stop"==e.p.onSortCol.call(e,b,c,d)?e.p.lastsort=c:("local"==e.p.datatype?e.p.deselectAfterSort&&a(e).jqGrid("resetSelection"):(e.p.selrow=null,e.p.multiselect&&a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1),e.p.selarrrow=
[],e.p.savedRow=[]),e.p.scroll&&(d=e.grid.bDiv.scrollLeft,E(e.grid.bDiv,!0,!1),e.grid.hDiv.scrollLeft=d),e.p.subGrid&&"local"==e.p.datatype&&a("td.sgexpanded","#"+a.jgrid.jqID(e.p.id)).each(function(){a(this).trigger("click")}),m(),e.p.lastsort=c,e.p.sortname!=b&&c&&(e.p.lastsort=c))}},W=function(b){var c,d={},f=q?0:e.p.cellLayout;for(c=d[0]=d[1]=d[2]=0;c<=b;c++)!1===e.p.colModel[c].hidden&&(d[0]+=e.p.colModel[c].width+f);"rtl"==e.p.direction&&(d[0]=e.p.width-d[0]);d[0]-=e.grid.bDiv.scrollLeft;a(e.grid.cDiv).is(":visible")&&
(d[1]+=a(e.grid.cDiv).height()+parseInt(a(e.grid.cDiv).css("padding-top"),10)+parseInt(a(e.grid.cDiv).css("padding-bottom"),10));!0!==e.p.toolbar[0]||"top"!=e.p.toolbar[1]&&"both"!=e.p.toolbar[1]||(d[1]+=a(e.grid.uDiv).height()+parseInt(a(e.grid.uDiv).css("border-top-width"),10)+parseInt(a(e.grid.uDiv).css("border-bottom-width"),10));e.p.toppager&&(d[1]+=a(e.grid.topDiv).height()+parseInt(a(e.grid.topDiv).css("border-bottom-width"),10));d[2]+=a(e.grid.bDiv).height()+a(e.grid.hDiv).height();return d};
this.p.id=this.id;-1==a.inArray(e.p.multikey,["shiftKey","altKey","ctrlKey"])&&(e.p.multikey=!1);e.p.keyIndex=!1;for(h=0;h<e.p.colModel.length;h++)e.p.colModel[h]=a.extend(!0,{},e.p.cmTemplate,e.p.colModel[h].template||{},e.p.colModel[h]),!1===e.p.keyIndex&&!0===e.p.colModel[h].key&&(e.p.keyIndex=h);e.p.sortorder=e.p.sortorder.toLowerCase();!0===e.p.grouping&&(e.p.scroll=!1,e.p.rownumbers=!1,e.p.subGrid=!1,e.p.treeGrid=!1,e.p.gridview=!0);if(!0===this.p.treeGrid){try{a(this).jqGrid("setTreeGrid")}catch(ca){}"local"!=
e.p.datatype&&(e.p.localReader={id:"_id_"})}if(this.p.subGrid)try{a(e).jqGrid("setSubGrid")}catch(ia){}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:q?e.p.multiselectWidth+e.p.cellLayout:e.p.multiselectWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));this.p.rownumbers&&(this.p.colNames.unshift(""),this.p.colModel.unshift({name:"rn",width:e.p.rownumWidth,
sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));e.p.xmlReader=a.extend(!0,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:!0,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:!0,cell:"cell"}},e.p.xmlReader);e.p.jsonReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!0,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},
e.p.jsonReader);e.p.localReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!1,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},e.p.localReader);e.p.scroll&&(e.p.pgbuttons=!1,e.p.pginput=!1,e.p.rowList=[]);e.p.data.length&&I();var M="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",O,J,N,X,U,P,G,K;J=K="";if(!0===e.p.shrinkToFit&&!0===e.p.forceFit)for(h=e.p.colModel.length-1;0<=h;h--)if(!e.p.colModel[h].hidden){e.p.colModel[h].resizable=
!1;break}"horizontal"==e.p.viewsortcols[1]&&(K=" ui-i-asc",J=" ui-i-desc");O=p?"class='ui-th-div-ie'":"";K="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+K+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+g+"'></span>"+("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+J+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+g+"'></span></span>");for(h=0;h<this.p.colNames.length;h++)J=e.p.headertitles?' title="'+a.jgrid.stripHtml(e.p.colNames[h])+
'"':"",M+="<th id='"+e.p.id+"_"+e.p.colModel[h].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+g+"'"+J+">",J=e.p.colModel[h].index||e.p.colModel[h].name,M+="<div id='jqgh_"+e.p.id+"_"+e.p.colModel[h].name+"' "+O+">"+e.p.colNames[h],e.p.colModel[h].width=e.p.colModel[h].width?parseInt(e.p.colModel[h].width,10):150,"boolean"!==typeof e.p.colModel[h].title&&(e.p.colModel[h].title=!0),J==e.p.sortname&&(e.p.lastsort=h),M+=K+"</div></th>";M+="</tr></thead>";K=null;a(this).append(M);
a("thead tr:first th",this).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});if(this.p.multiselect){var Q=[],R;a("#cb_"+a.jgrid.jqID(e.p.id),this).bind("click",function(){e.p.selarrrow=[];this.checked?(a(e.rows).each(function(b){0<b&&!a(this).hasClass("subgrid")&&(!a(this).hasClass("jqgroup")&&!a(this).hasClass("ui-state-disabled"))&&(a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).attr("checked","checked"),a(this).addClass("ui-state-highlight").attr("aria-selected",
"true"),e.p.selarrrow.push(this.id),e.p.selrow=this.id)}),R=!0,Q=[]):(a(e.rows).each(function(b){0<b&&!a(this).hasClass("subgrid")&&!a(this).hasClass("ui-state-disabled")&&(a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).removeAttr("checked"),a(this).removeClass("ui-state-highlight").attr("aria-selected","false"),Q.push(this.id))}),e.p.selrow=null,R=!1);a.isFunction(e.p.onSelectAll)&&e.p.onSelectAll.call(e,R?e.p.selarrrow:Q,R)})}!0===e.p.autowidth&&(M=a(s).innerWidth(),e.p.width=0<M?M:"nw");
(function(){var b=0,d=q?0:e.p.cellLayout,f=0,g,h=e.p.scrollOffset,l,m=!1,n,p=0,s=0,v;a.each(e.p.colModel,function(){"undefined"===typeof this.hidden&&(this.hidden=!1);this.widthOrg=l=r(this.width,0);!1===this.hidden&&(b+=l+d,this.fixed?p+=l+d:f++,s++)});isNaN(e.p.width)?e.p.width=c.width=b:c.width=e.p.width;e.p.tblwidth=b;!1===e.p.shrinkToFit&&!0===e.p.forceFit&&(e.p.forceFit=!1);!0===e.p.shrinkToFit&&0<f&&(n=c.width-d*f-p,isNaN(e.p.height)||(n-=h,m=!0),b=0,a.each(e.p.colModel,function(a){!1!==this.hidden||
this.fixed||(this.width=l=Math.round(n*this.width/(e.p.tblwidth-d*f-p)),b+=l,g=a)}),v=0,m?c.width-p-(b+d*f)!==h&&(v=c.width-p-(b+d*f)-h):m||1===Math.abs(c.width-p-(b+d*f))||(v=c.width-p-(b+d*f)),e.p.colModel[g].width+=v,e.p.tblwidth=b+v+d*f+p,e.p.tblwidth>e.p.width&&(e.p.colModel[g].width-=e.p.tblwidth-parseInt(e.p.width,10),e.p.tblwidth=e.p.width))})();a(s).css("width",c.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+e.p.id+"'>&#160;</div>");a(l).css("width",c.width+"px");var M=
a("thead:first",e).get(0),Z="";e.p.footerrow&&(Z+="<table role='grid' style='width:"+e.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+g+"'>");var l=a("tr:first",M),da="<tr class='jqgfirstrow' role='row' style='height:auto'>";e.p.disableClick=!1;a("th",l).each(function(b){N=e.p.colModel[b].width;"undefined"===typeof e.p.colModel[b].resizable&&(e.p.colModel[b].resizable=!0);e.p.colModel[b].resizable?
(X=document.createElement("span"),a(X).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+g),a.browser.opera||a(X).css("cursor","col-resize"),a(this).addClass(e.p.resizeclass)):X="";a(this).css("width",N+"px").prepend(X);var d="";e.p.colModel[b].hidden&&(a(this).css("display","none"),d="display:none;");da+="<td role='gridcell' style='height:0px;width:"+N+"px;"+d+"'></td>";c.headers[b]={width:N,el:this};U=e.p.colModel[b].sortable;"boolean"!==typeof U&&(U=e.p.colModel[b].sortable=!0);d=e.p.colModel[b].name;
"cb"==d||"subgrid"==d||"rn"==d||e.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");U&&(e.p.viewsortcols[0]?(a("div span.s-ico",this).show(),b==e.p.lastsort&&a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")):b==e.p.lastsort&&(a("div span.s-ico",this).show(),a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")));e.p.footerrow&&(Z+="<td role='gridcell' "+w(b,0,"",null,"",!1)+">&#160;</td>")}).mousedown(function(b){if(1==a(b.target).closest("th>span.ui-jqgrid-resize").length){var d=
a.jgrid.getCellIndex(this);if(!0===e.p.forceFit){var f=e.p,g=d,h;for(h=d+1;h<e.p.colModel.length;h++)if(!0!==e.p.colModel[h].hidden){g=h;break}f.nv=g-d}c.dragStart(d,b,W(d));return!1}}).click(function(b){if(e.p.disableClick)return e.p.disableClick=!1;var c="th>div.ui-jqgrid-sortable",d,f;e.p.viewsortcols[2]||(c="th>div>span>span.ui-grid-ico-sort");b=a(b.target).closest(c);if(1==b.length)return c=a.jgrid.getCellIndex(this),e.p.viewsortcols[2]||(d=!0,f=b.attr("sort")),V(a("div",this)[0].id,c,d,f),!1});
if(e.p.sortable&&a.fn.sortable)try{a(e).jqGrid("sortableColumns",l)}catch(Ia){}e.p.footerrow&&(Z+="</tr></tbody></table>");da+="</tr>";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable").append(da);var da=null,l=a("<table class='ui-jqgrid-htable' style='width:"+e.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(M),aa=e.p.caption&&!0===e.p.hiddengrid?!0:!1;h=a("<div class='ui-jqgrid-hbox"+
("rtl"==g?"-rtl":"")+"'></div>");M=null;c.hDiv=document.createElement("div");a(c.hDiv).css({width:c.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(h);a(h).append(l);l=null;aa&&a(c.hDiv).hide();e.p.pager&&("string"==typeof e.p.pager?"#"!=e.p.pager.substr(0,1)&&(e.p.pager="#"+e.p.pager):e.p.pager="#"+a(e.p.pager).attr("id"),a(e.p.pager).css({width:c.width+"px"}).appendTo(s).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom"),aa&&a(e.p.pager).hide(),n(e.p.pager,""));!1===e.p.cellEdit&&
!0===e.p.hoverrows&&a(e).bind("mouseover",function(b){G=a(b.target).closest("tr.jqgrow");"subgrid"!==a(G).attr("class")&&a(G).addClass("ui-state-hover");return!1}).bind("mouseout",function(b){G=a(b.target).closest("tr.jqgrow");a(G).removeClass("ui-state-hover");return!1});var ga,ea;a(e).before(c.hDiv).click(function(b){P=b.target;G=a(P,e.rows).closest("tr.jqgrow");if(0===a(G).length||-1<G[0].className.indexOf("ui-state-disabled"))return this;var c=a(P).hasClass("cbox"),d=!0;a.isFunction(e.p.beforeSelectRow)&&
(d=e.p.beforeSelectRow.call(e,G[0].id,b));if("A"==P.tagName||("INPUT"==P.tagName||"TEXTAREA"==P.tagName||"OPTION"==P.tagName||"SELECT"==P.tagName)&&!c)return this;if(!0===d){if(!0===e.p.cellEdit)if(e.p.multiselect&&c)a(e).jqGrid("setSelection",G[0].id,!0);else{ga=G[0].rowIndex;ea=a.jgrid.getCellIndex(P);try{a(e).jqGrid("editCell",ga,ea,!0)}catch(f){}}else e.p.multikey?b[e.p.multikey]?a(e).jqGrid("setSelection",G[0].id,!0):e.p.multiselect&&c&&(c=a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+G[0].id).attr("checked"),
a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+G[0].id).attr("checked",!c)):(e.p.multiselect&&e.p.multiboxonly&&!c&&(a(e.p.selarrrow).each(function(b,c){var d=e.rows.namedItem(c);a(d).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c)).attr("checked",!1)}),e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1)),a(e).jqGrid("setSelection",G[0].id,!0));a.isFunction(e.p.onCellSelect)&&(ga=G[0].id,ea=a.jgrid.getCellIndex(P),e.p.onCellSelect.call(e,ga,ea,a(P).html(),
b))}return this}).bind("reloadGrid",function(b,c){!0===e.p.treeGrid&&(e.p.datatype=e.p.treedatatype);c&&c.current&&e.grid.selectionPreserver(e);"local"==e.p.datatype?(a(e).jqGrid("resetSelection"),e.p.data.length&&I()):e.p.treeGrid||(e.p.selrow=null,e.p.multiselect&&(e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1)),e.p.savedRow=[]);e.p.scroll&&E(e.grid.bDiv,!0,!1);if(c&&c.page){var d=c.page;d>e.p.lastpage&&(d=e.p.lastpage);1>d&&(d=1);e.p.page=d;e.grid.bDiv.scrollTop=
e.grid.prevRowHeight?(d-1)*e.grid.prevRowHeight*e.p.rowNum:0}e.grid.prevRowHeight&&e.p.scroll?(delete e.p.lastpage,e.grid.populateVisible()):e.grid.populate();return!1});a.isFunction(this.p.ondblClickRow)&&a(this).dblclick(function(b){P=b.target;G=a(P,e.rows).closest("tr.jqgrow");if(0===a(G).length)return!1;ga=G[0].rowIndex;ea=a.jgrid.getCellIndex(P);e.p.ondblClickRow.call(e,a(G).attr("id"),ga,ea,b);return!1});a.isFunction(this.p.onRightClickRow)&&a(this).bind("contextmenu",function(b){P=b.target;
G=a(P,e.rows).closest("tr.jqgrow");if(0===a(G).length)return!1;e.p.multiselect||a(e).jqGrid("setSelection",G[0].id,!0);ga=G[0].rowIndex;ea=a.jgrid.getCellIndex(P);e.p.onRightClickRow.call(e,a(G).attr("id"),ga,ea,b);return!1});c.bDiv=document.createElement("div");p&&"auto"===String(e.p.height).toLowerCase()&&(e.p.height="100%");a(c.bDiv).append(a('<div style="position:relative;'+(p&&8>a.browser.version?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:e.p.height+
(isNaN(e.p.height)?"":"px"),width:c.width+"px"}).scroll(c.scrollGrid);a("table:first",c.bDiv).css({width:e.p.tblwidth+"px"});p?(2==a("tbody",this).size()&&a("tbody:gt(0)",this).remove(),e.p.multikey&&a(c.bDiv).bind("selectstart",function(){return!1})):e.p.multikey&&a(c.bDiv).bind("mousedown",function(){return!1});aa&&a(c.bDiv).hide();c.cDiv=document.createElement("div");var ua=!0===e.p.hidegrid?a("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){ua.addClass("ui-state-hover")},
function(){ua.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl"==g?"left":"right","0px"):"";a(c.cDiv).append(ua).append("<span class='ui-jqgrid-title"+("rtl"==g?"-rtl":"")+"'>"+e.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(c.cDiv).insertBefore(c.hDiv);e.p.toolbar[0]&&(c.uDiv=document.createElement("div"),"top"==e.p.toolbar[1]?a(c.uDiv).insertBefore(c.hDiv):"bottom"==e.p.toolbar[1]&&
a(c.uDiv).insertAfter(c.hDiv),"both"==e.p.toolbar[1]?(c.ubDiv=document.createElement("div"),a(c.uDiv).insertBefore(c.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),a(c.ubDiv).insertAfter(c.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id),aa&&a(c.ubDiv).hide()):a(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),aa&&a(c.uDiv).hide());e.p.toppager&&(e.p.toppager=a.jgrid.jqID(e.p.id)+"_toppager",c.topDiv=a("<div id='"+
e.p.toppager+"'></div>")[0],e.p.toppager="#"+e.p.toppager,a(c.topDiv).insertBefore(c.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width),n(e.p.toppager,"_t"));e.p.footerrow&&(c.sDiv=a("<div class='ui-jqgrid-sdiv'></div>")[0],h=a("<div class='ui-jqgrid-hbox"+("rtl"==g?"-rtl":"")+"'></div>"),a(c.sDiv).append(h).insertAfter(c.hDiv).width(c.width),a(h).append(Z),c.footers=a(".ui-jqgrid-ftable",c.sDiv)[0].rows[0].cells,e.p.rownumbers&&(c.footers[0].className="ui-state-default jqgrid-rownum"),
aa&&a(c.sDiv).hide());h=null;if(e.p.caption){var Da=e.p.datatype;!0===e.p.hidegrid&&(a(".ui-jqgrid-titlebar-close",c.cDiv).click(function(b){var d=a.isFunction(e.p.onHeaderClick),f=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",g,h=this;!0===e.p.toolbar[0]&&("both"==e.p.toolbar[1]&&(f+=", #"+a(c.ubDiv).attr("id")),f+=", #"+a(c.uDiv).attr("id"));g=a(f,"#gview_"+a.jgrid.jqID(e.p.id)).length;"visible"==e.p.gridstate?a(f,"#gbox_"+a.jgrid.jqID(e.p.id)).slideUp("fast",function(){g--;
0===g&&(a("span",h).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),e.p.gridstate="hidden",a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).hide(),d&&(aa||e.p.onHeaderClick.call(e,e.p.gridstate,b)))}):"hidden"==e.p.gridstate&&a(f,"#gbox_"+a.jgrid.jqID(e.p.id)).slideDown("fast",function(){g--;0===g&&(a("span",h).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),aa&&(e.p.datatype=
Da,m(),aa=!1),e.p.gridstate="visible",a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).show(),d&&(aa||e.p.onHeaderClick.call(e,e.p.gridstate,b)))});return!1}),aa&&(e.p.datatype="local",a(".ui-jqgrid-titlebar-close",c.cDiv).trigger("click")))}else a(c.cDiv).hide();a(c.hDiv).after(c.bDiv).mousemove(function(a){if(c.resizing)return c.dragMove(a),!1});a(".ui-jqgrid-labels",c.hDiv).bind("selectstart",function(){return!1});a(document).mouseup(function(){return c.resizing?
(c.dragEnd(),!1):!0});e.formatCol=w;e.sortData=V;e.updatepager=function(b,c){var d,f,g,h,k,l,m,q="",n=e.p.pager?"_"+a.jgrid.jqID(e.p.pager.substr(1)):"",p=e.p.toppager?"_"+e.p.toppager.substr(1):"";g=parseInt(e.p.page,10)-1;0>g&&(g=0);g*=parseInt(e.p.rowNum,10);k=g+e.p.reccount;if(e.p.scroll){d=a("tbody:first > tr:gt(0)",e.grid.bDiv);g=k-d.length;e.p.reccount=d.length;if(f=d.outerHeight()||e.grid.prevRowHeight)d=g*f,f*=parseInt(e.p.records,10),a(">div:first",e.grid.bDiv).css({height:f}).children("div:first").css({height:d,
display:d?"":"none"});e.grid.bDiv.scrollLeft=e.grid.hDiv.scrollLeft}q=e.p.pager?e.p.pager:"";if(q+=e.p.toppager?q?","+e.p.toppager:e.p.toppager:"")m=a.jgrid.formatter.integer||{},d=r(e.p.page),f=r(e.p.lastpage),a(".selbox",q).attr("disabled",!1),!0===e.p.pginput&&(a(".ui-pg-input",q).val(e.p.page),h=e.p.toppager?"#sp_1"+n+",#sp_1"+p:"#sp_1"+n,a(h).html(a.fmatter?a.fmatter.util.NumberFormat(e.p.lastpage,m):e.p.lastpage)),e.p.viewrecords&&(0===e.p.reccount?a(".ui-paging-info",q).html(e.p.emptyrecords):
(h=g+1,l=e.p.records,a.fmatter&&(h=a.fmatter.util.NumberFormat(h,m),k=a.fmatter.util.NumberFormat(k,m),l=a.fmatter.util.NumberFormat(l,m)),a(".ui-paging-info",q).html(a.jgrid.format(e.p.recordtext,h,k,l)))),!0===e.p.pgbuttons&&(0>=d&&(d=f=0),1==d||0===d?(a("#first"+n+", #prev"+n).addClass("ui-state-disabled").removeClass("ui-state-hover"),e.p.toppager&&a("#first_t"+p+", #prev_t"+p).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#first"+n+", #prev"+n).removeClass("ui-state-disabled"),
e.p.toppager&&a("#first_t"+p+", #prev_t"+p).removeClass("ui-state-disabled")),d==f||0===d?(a("#next"+n+", #last"+n).addClass("ui-state-disabled").removeClass("ui-state-hover"),e.p.toppager&&a("#next_t"+p+", #last_t"+p).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#next"+n+", #last"+n).removeClass("ui-state-disabled"),e.p.toppager&&a("#next_t"+p+", #last_t"+p).removeClass("ui-state-disabled")));!0===b&&!0===e.p.rownumbers&&a("td.jqgrid-rownum",e.rows).each(function(b){a(this).html(g+
1+b)});c&&e.p.jqgdnd&&a(e).jqGrid("gridDnD","updateDnD");a.isFunction(e.p.gridComplete)&&e.p.gridComplete.call(e)};e.refreshIndex=I;e.formatter=function(a,b,c,d,e){return u(a,b,c,d,e)};a.extend(c,{populate:m,emptyRows:E});this.grid=c;e.addXmlData=function(a){F(a,e.grid.bDiv)};e.addJSONData=function(a){C(a,e.grid.bDiv)};this.grid.cols=this.rows[0].cells;m();e.p.hiddengrid=!1;a(window).unload(function(){e=null})}}}})};a.jgrid.extend({getGridParam:function(a){var b=this[0];if(b&&b.grid)return a?"undefined"!=
typeof b.p[a]?b.p[a]:null:b.p},setGridParam:function(d){return this.each(function(){this.grid&&"object"===typeof d&&a.extend(!0,this.p,d)})},getDataIDs:function(){var d=[],b=0,c,f=0;this.each(function(){if((c=this.rows.length)&&0<c)for(;b<c;)a(this.rows[b]).hasClass("jqgrow")&&(d[f]=this.rows[b].id,f++),b++});return d},setSelection:function(d,b){return this.each(function(){var c,f,k;if(void 0!==d&&(b=!1===b?!1:!0,(f=this.rows.namedItem(d+""))&&!(-1<f.className.indexOf("ui-state-disabled")))){if(!0===
this.p.scrollrows&&(c=this.rows.namedItem(d).rowIndex,0<=c)){k=a(this.grid.bDiv)[0].clientHeight;var h=a(this.grid.bDiv)[0].scrollTop,g=this.rows[c].offsetTop;c=this.rows[c].clientHeight;g+c>=k+h?a(this.grid.bDiv)[0].scrollTop=g-(k+h)+c+h:g<k+h&&g<h&&(a(this.grid.bDiv)[0].scrollTop=g)}this.p.multiselect?(this.p.selrow=f.id,k=a.inArray(this.p.selrow,this.p.selarrrow),-1===k?("ui-subgrid"!==f.className&&a(f).addClass("ui-state-highlight").attr("aria-selected","true"),c=!0,a("#jqg_"+a.jgrid.jqID(this.p.id)+
"_"+a.jgrid.jqID(this.p.selrow)).attr("checked",c),this.p.selarrrow.push(this.p.selrow)):("ui-subgrid"!==f.className&&a(f).removeClass("ui-state-highlight").attr("aria-selected","false"),c=!1,a("#jqg_"+a.jgrid.jqID(this.p.id)+"_"+a.jgrid.jqID(this.p.selrow)).attr("checked",c),this.p.selarrrow.splice(k,1),k=this.p.selarrrow[0],this.p.selrow=void 0===k?null:k),this.p.onSelectRow&&b&&this.p.onSelectRow.call(this,f.id,c)):"ui-subgrid"!==f.className&&(this.p.selrow!=f.id?(a(this.rows.namedItem(this.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",
tabindex:"-1"}),a(f).addClass("ui-state-highlight").attr({"aria-selected":!0,tabindex:"0"}),c=!0):c=!1,this.p.selrow=f.id,this.p.onSelectRow&&b&&this.p.onSelectRow.call(this,f.id,c))}})},resetSelection:function(d){return this.each(function(){var b=this,c,f;"undefined"!==typeof d?(f=d===b.p.selrow?b.p.selrow:d,a("#"+a.jgrid.jqID(b.p.id)+" tbody:first tr#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight").attr("aria-selected","false"),b.p.multiselect&&(a("#jqg_"+a.jgrid.jqID(b.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",
!1),a("#cb_"+a.jgrid.jqID(b.p.id)).attr("checked",!1)),f=null):b.p.multiselect?(a(b.p.selarrrow).each(function(d,f){c=b.rows.namedItem(f);a(c).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(b.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",!1)}),a("#cb_"+a.jgrid.jqID(b.p.id)).attr("checked",!1),b.p.selarrrow=[]):b.p.selrow&&(a("#"+a.jgrid.jqID(b.p.id)+" tbody:first tr#"+a.jgrid.jqID(b.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),b.p.selrow=
null);b.p.savedRow=[]})},getRowData:function(d){var b={},c,f=!1,k,h=0;this.each(function(){var g=this,e,l;if("undefined"==typeof d)f=!0,c=[],k=g.rows.length;else{l=g.rows.namedItem(d);if(!l)return b;k=2}for(;h<k;)f&&(l=g.rows[h]),a(l).hasClass("jqgrow")&&(a("td",l).each(function(c){e=g.p.colModel[c].name;if("cb"!==e&&"subgrid"!==e&&"rn"!==e)if(!0===g.p.treeGrid&&e==g.p.ExpandColumn)b[e]=a.jgrid.htmlDecode(a("span:first",this).html());else try{b[e]=a.unformat(this,{rowId:l.id,colModel:g.p.colModel[c]},
c)}catch(d){b[e]=a.jgrid.htmlDecode(a(this).html())}}),f&&(c.push(b),b={})),h++});return c?c:b},delRowData:function(d){var b=!1,c,f;this.each(function(){if(c=this.rows.namedItem(d))a(c).remove(),this.p.records--,this.p.reccount--,this.updatepager(!0,!1),b=!0,this.p.multiselect&&(f=a.inArray(d,this.p.selarrrow),-1!=f&&this.p.selarrrow.splice(f,1)),d==this.p.selrow&&(this.p.selrow=null);else return!1;if("local"==this.p.datatype){var k=this.p._index[d];"undefined"!=typeof k&&(this.p.data.splice(k,1),
this.refreshIndex())}if(!0===this.p.altRows&&b){var h=this.p.altclass;a(this.rows).each(function(b){1==b%2?a(this).addClass(h):a(this).removeClass(h)})}});return b},setRowData:function(d,b,c){var f,k=!0,h;this.each(function(){if(!this.grid)return!1;var g=this,e,l,n=typeof c,p={};l=g.rows.namedItem(d);if(!l)return!1;if(b)try{if(a(this.p.colModel).each(function(c){f=this.name;void 0!==b[f]&&(p[f]=this.formatter&&"string"===typeof this.formatter&&"date"==this.formatter?a.unformat.date(b[f],this):b[f],
e=g.formatter(d,b[f],c,b,"edit"),h=this.title?{title:a.jgrid.stripHtml(e)}:{},!0===g.p.treeGrid&&f==g.p.ExpandColumn?a("td:eq("+c+") > span:first",l).html(e).attr(h):a("td:eq("+c+")",l).html(e).attr(h))}),"local"==g.p.datatype){var q=g.p._index[d];if(g.p.treeGrid)for(var s in g.p.treeReader)p.hasOwnProperty(g.p.treeReader[s])&&delete p[g.p.treeReader[s]];"undefined"!=typeof q&&(g.p.data[q]=a.extend(!0,g.p.data[q],p));p=null}}catch(r){k=!1}k&&("string"===n?a(l).addClass(c):"object"===n&&a(l).css(c))});
return k},addRowData:function(d,b,c,f){c||(c="last");var k=!1,h,g,e,l,n,p,q,s,r="",w,v,u,x,B;b&&(a.isArray(b)?(w=!0,c="last",v=d):(b=[b],w=!1),this.each(function(){var A=b.length;n=!0===this.p.rownumbers?1:0;e=!0===this.p.multiselect?1:0;l=!0===this.p.subGrid?1:0;w||("undefined"!=typeof d?d+="":(d=a.jgrid.randId(),!1!==this.p.keyIndex&&(v=this.p.colModel[this.p.keyIndex+e+l+n].name,"undefined"!=typeof b[0][v]&&(d=b[0][v]))));u=this.p.altclass;for(var z=0,D="",E={},I=a.isFunction(this.p.afterInsertRow)?
!0:!1;z<A;){x=b[z];g="";if(w){try{d=x[v]}catch(F){d=a.jgrid.randId()}D=!0===this.p.altRows?0===(this.rows.length-1)%2?u:"":""}n&&(r=this.formatCol(0,1,"",null,d,!0),g+='<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+r+">0</td>");e&&(s='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+d+'" class="cbox"/>',r=this.formatCol(n,1,"",null,d,!0),g+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+r+">"+s+"</td>");l&&(g+=a(this).jqGrid("addSubGridCell",
e+n,1));for(q=e+l+n;q<this.p.colModel.length;q++)B=this.p.colModel[q],h=B.name,E[h]=B.formatter&&"string"===typeof B.formatter&&"date"==B.formatter?a.unformat.date(x[h],B):x[h],s=this.formatter(d,a.jgrid.getAccessor(x,h),q,x,"edit"),r=this.formatCol(q,1,s,d,x,!0),g+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+h+'" '+r+">"+s+"</td>";g='<tr id="'+d+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+D+'">'+g+"</tr>";if(0===this.rows.length)a("table:first",
this.grid.bDiv).append(g);else switch(c){case "last":a(this.rows[this.rows.length-1]).after(g);p=this.rows.length-1;break;case "first":a(this.rows[0]).after(g);p=1;break;case "after":if(p=this.rows.namedItem(f))a(this.rows[p.rowIndex+1]).hasClass("ui-subgrid")?a(this.rows[p.rowIndex+1]).after(g):a(p).after(g);p++;break;case "before":if(p=this.rows.namedItem(f))a(p).before(g),p=p.rowIndex;p--}!0===this.p.subGrid&&a(this).jqGrid("addSubGrid",e+n,p);this.p.records++;this.p.reccount++;I&&this.p.afterInsertRow.call(this,
d,x,x);z++;"local"==this.p.datatype&&(E[this.p.localReader.id]=d,this.p._index[d]=this.p.data.length,this.p.data.push(E),E={})}!0!==this.p.altRows||w||("last"==c?1==(this.rows.length-1)%2&&a(this.rows[this.rows.length-1]).addClass(u):a(this.rows).each(function(b){1==b%2?a(this).addClass(u):a(this).removeClass(u)}));this.updatepager(!0,!0);k=!0}));return k},footerData:function(d,b,c){function f(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var k,h=!1,g={},e;"undefined"==typeof d&&(d="get");
"boolean"!=typeof c&&(c=!0);d=d.toLowerCase();this.each(function(){var l=this,n;if(!l.grid||!l.p.footerrow||"set"==d&&f(b))return!1;h=!0;a(this.p.colModel).each(function(f){k=this.name;"set"==d?void 0!==b[k]&&(n=c?l.formatter("",b[k],f,b,"edit"):b[k],e=this.title?{title:a.jgrid.stripHtml(n)}:{},a("tr.footrow td:eq("+f+")",l.grid.sDiv).html(n).attr(e),h=!0):"get"==d&&(g[k]=a("tr.footrow td:eq("+f+")",l.grid.sDiv).html())})});return"get"==d?g:h},showHideCol:function(d,b){return this.each(function(){var c=
this,f=!1,k=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,h;if(c.grid){"string"===typeof d&&(d=[d]);b="none"!=b?"":"none";var g=""===b?!0:!1;a(this.p.colModel).each(function(e){-1!==a.inArray(this.name,d)&&this.hidden===g&&(a("tr",c.grid.hDiv).each(function(){a(this).children("th:eq("+e+")").css("display",b)}),a(c.rows).each(function(){a(this).children("td:eq("+e+")").css("display",b)}),c.p.footerrow&&a("tr.footrow td:eq("+e+")",c.grid.sDiv).css("display",b),h=this.widthOrg?this.widthOrg:parseInt(this.width,
10),c.p.tblwidth="none"===b?c.p.tblwidth-(h+k):c.p.tblwidth+(h+k),this.hidden=!g,f=!0)});!0===f&&(!1===c.p.shrinkToFit?a(c).jqGrid("setGridWidth",c.grid.width):c.grid.width!==c.p.tblwidth&&a(c).jqGrid("setGridWidth",c.p.tblwidth))}})},hideCol:function(d){return this.each(function(){a(this).jqGrid("showHideCol",d,"none")})},showCol:function(d){return this.each(function(){a(this).jqGrid("showHideCol",d,"")})},remapColumns:function(d,b,c){function f(b){var c;c=b.length?a.makeArray(b):a.extend({},b);
a.each(d,function(a){b[a]=c[this]})}function k(b,c){a(">tr"+(c||""),b).each(function(){var b=this,c=a.makeArray(b.cells);a.each(d,function(){var a=c[this];a&&b.appendChild(a)})})}var h=this.get(0);f(h.p.colModel);f(h.p.colNames);f(h.grid.headers);k(a("thead:first",h.grid.hDiv),c&&":not(.ui-jqgrid-labels)");b&&k(a("#"+a.jgrid.jqID(h.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");h.p.footerrow&&k(a("tbody:first",h.grid.sDiv));h.p.remapColumns&&(h.p.remapColumns.length?f(h.p.remapColumns):
h.p.remapColumns=a.makeArray(d));h.p.lastsort=a.inArray(h.p.lastsort,d);h.p.treeGrid&&(h.p.expColInd=a.inArray(h.p.expColInd,d))},setGridWidth:function(d,b){return this.each(function(){if(this.grid){var c=this,f,k=0,h=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,g,e=0,l=!1,n=c.p.scrollOffset,p,q=0,s=0,r;"boolean"!=typeof b&&(b=c.p.shrinkToFit);if(!isNaN(d)){d=parseInt(d,10);c.grid.width=c.p.width=d;a("#gbox_"+a.jgrid.jqID(c.p.id)).css("width",d+"px");a("#gview_"+a.jgrid.jqID(c.p.id)).css("width",
d+"px");a(c.grid.bDiv).css("width",d+"px");a(c.grid.hDiv).css("width",d+"px");c.p.pager&&a(c.p.pager).css("width",d+"px");c.p.toppager&&a(c.p.toppager).css("width",d+"px");!0===c.p.toolbar[0]&&(a(c.grid.uDiv).css("width",d+"px"),"both"==c.p.toolbar[1]&&a(c.grid.ubDiv).css("width",d+"px"));c.p.footerrow&&a(c.grid.sDiv).css("width",d+"px");!1===b&&!0===c.p.forceFit&&(c.p.forceFit=!1);if(!0===b){a.each(c.p.colModel,function(){!1===this.hidden&&(f=this.widthOrg?this.widthOrg:parseInt(this.width,10),k+=
f+h,this.fixed?q+=f+h:e++,s++)});if(0===e)return;c.p.tblwidth=k;p=d-h*e-q;!isNaN(c.p.height)&&(a(c.grid.bDiv)[0].clientHeight<a(c.grid.bDiv)[0].scrollHeight||1===c.rows.length)&&(l=!0,p-=n);var k=0,w=0<c.grid.cols.length;a.each(c.p.colModel,function(a){!1!==this.hidden||this.fixed||(f=this.widthOrg?this.widthOrg:parseInt(this.width,10),f=Math.round(p*f/(c.p.tblwidth-h*e-q)),0>f||(this.width=f,k+=f,c.grid.headers[a].width=f,c.grid.headers[a].el.style.width=f+"px",c.p.footerrow&&(c.grid.footers[a].style.width=
f+"px"),w&&(c.grid.cols[a].style.width=f+"px"),g=a))});r=0;l?d-q-(k+h*e)!==n&&(r=d-q-(k+h*e)-n):1!==Math.abs(d-q-(k+h*e))&&(r=d-q-(k+h*e));c.p.colModel[g].width+=r;c.p.tblwidth=k+r+h*e+q;c.p.tblwidth>d?(l=c.p.tblwidth-parseInt(d,10),c.p.tblwidth=d,f=c.p.colModel[g].width-=l):f=c.p.colModel[g].width;c.grid.headers[g].width=f;c.grid.headers[g].el.style.width=f+"px";w&&(c.grid.cols[g].style.width=f+"px");c.p.footerrow&&(c.grid.footers[g].style.width=f+"px")}c.p.tblwidth&&(a("table:first",c.grid.bDiv).css("width",
c.p.tblwidth+"px"),a("table:first",c.grid.hDiv).css("width",c.p.tblwidth+"px"),c.grid.hDiv.scrollLeft=c.grid.bDiv.scrollLeft,c.p.footerrow&&a("table:first",c.grid.sDiv).css("width",c.p.tblwidth+"px"))}}})},setGridHeight:function(d){return this.each(function(){this.grid&&(a(this.grid.bDiv).css({height:d+(isNaN(d)?"":"px")}),this.p.height=d,this.p.scroll&&this.grid.populateVisible())})},setCaption:function(d){return this.each(function(){this.p.caption=d;a("span.ui-jqgrid-title",this.grid.cDiv).html(d);
a(this.grid.cDiv).show()})},setLabel:function(d,b,c,f){return this.each(function(){var k=-1;if(this.grid&&"undefined"!=typeof d&&(a(this.p.colModel).each(function(a){if(this.name==d)return k=a,!1}),0<=k)){var h=a("tr.ui-jqgrid-labels th:eq("+k+")",this.grid.hDiv);if(b){var g=a(".s-ico",h);a("[id^=jqgh_]",h).empty().html(b).append(g);this.p.colNames[k]=b}c&&("string"===typeof c?a(h).addClass(c):a(h).css(c));"object"===typeof f&&a(h).attr(f)}})},setCell:function(d,b,c,f,k,h){return this.each(function(){var g=
-1,e,l;if(this.grid&&(isNaN(b)?a(this.p.colModel).each(function(a){if(this.name==b)return g=a,!1}):g=parseInt(b,10),0<=g&&(e=this.rows.namedItem(d)))){var n=a("td:eq("+g+")",e);if(""!==c||!0===h)e=this.formatter(d,c,g,e,"edit"),l=this.p.colModel[g].title?{title:a.jgrid.stripHtml(e)}:{},this.p.treeGrid&&0<a(".tree-wrap",a(n)).length?a("span",a(n)).html(e).attr(l):a(n).html(e).attr(l),"local"==this.p.datatype&&(e=this.p.colModel[g],c=e.formatter&&"string"===typeof e.formatter&&"date"==e.formatter?a.unformat.date(c,
e):c,l=this.p._index[d],"undefined"!=typeof l&&(this.p.data[l][e.name]=c));"string"===typeof f?a(n).addClass(f):f&&a(n).css(f);"object"===typeof k&&a(n).attr(k)}})},getCell:function(d,b){var c=!1;this.each(function(){var f=-1;if(this.grid&&(isNaN(b)?a(this.p.colModel).each(function(a){if(this.name===b)return f=a,!1}):f=parseInt(b,10),0<=f)){var k=this.rows.namedItem(d);if(k)try{c=a.unformat(a("td:eq("+f+")",k),{rowId:k.id,colModel:this.p.colModel[f]},f)}catch(h){c=a.jgrid.htmlDecode(a("td:eq("+f+
")",k).html())}}});return c},getCol:function(d,b,c){var f=[],k,h=0,g=0,e=0,l;b="boolean"!=typeof b?!1:b;"undefined"==typeof c&&(c=!1);this.each(function(){var n=-1;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name===d)return n=a,!1}):n=parseInt(d,10),0<=n)){var p=this.rows.length,q=0;if(p&&0<p){for(;q<p;){if(a(this.rows[q]).hasClass("jqgrow")){try{k=a.unformat(a(this.rows[q].cells[n]),{rowId:this.rows[q].id,colModel:this.p.colModel[n]},n)}catch(s){k=a.jgrid.htmlDecode(this.rows[q].cells[n].innerHTML)}c?
(l=parseFloat(k),h+=l,g=Math.min(g,l),e=Math.max(g,l)):b?f.push({id:this.rows[q].id,value:k}):f.push(k)}q++}if(c)switch(c.toLowerCase()){case "sum":f=h;break;case "avg":f=h/p;break;case "count":f=p;break;case "min":f=g;break;case "max":f=e}}}});return f},clearGridData:function(d){return this.each(function(){if(this.grid){"boolean"!=typeof d&&(d=!1);if(this.p.deepempty)a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var b=a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];
a("#"+a.jgrid.jqID(this.p.id)+" tbody:first").empty().append(b)}this.p.footerrow&&d&&a(".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(!0,!1)}})},getInd:function(a,b){var c=!1,f;this.each(function(){if(f=this.rows.namedItem(a))c=!0===b?f:f.rowIndex});return c},bindKeys:function(d){var b=a.extend({onEnter:null,onSpace:null,
onLeftKey:null,onRightKey:null,scrollingRows:!0},d||{});return this.each(function(){var c=this;a("body").is("[role]")||a("body").attr("role","application");c.p.scrollrows=b.scrollingRows;a(c).keydown(function(d){var k=a(c).find("tr[tabindex=0]")[0],h,g,e,l=c.p.treeReader.expanded_field;if(k){e=c.p._index[k.id];if(37===d.keyCode||38===d.keyCode||39===d.keyCode||40===d.keyCode){if(38===d.keyCode){g=k.previousSibling;h="";if(g)if(a(g).is(":hidden"))for(;g;){if(g=g.previousSibling,!a(g).is(":hidden")&&
a(g).hasClass("jqgrow")){h=g.id;break}}else h=g.id;a(c).jqGrid("setSelection",h)}if(40===d.keyCode){g=k.nextSibling;h="";if(g)if(a(g).is(":hidden"))for(;g;){if(g=g.nextSibling,!a(g).is(":hidden")&&a(g).hasClass("jqgrow")){h=g.id;break}}else h=g.id;a(c).jqGrid("setSelection",h)}37===d.keyCode&&(c.p.treeGrid&&c.p.data[e][l]&&a(k).find("div.treeclick").trigger("click"),a.isFunction(b.onLeftKey)&&b.onLeftKey.call(c,c.p.selrow));39===d.keyCode&&(c.p.treeGrid&&!c.p.data[e][l]&&a(k).find("div.treeclick").trigger("click"),
a.isFunction(b.onRightKey)&&b.onRightKey.call(c,c.p.selrow));return!1}if(13===d.keyCode)return a.isFunction(b.onEnter)&&b.onEnter.call(c,c.p.selrow),!1;if(32===d.keyCode)return a.isFunction(b.onSpace)&&b.onSpace.call(c,c.p.selrow),!1}})})},unbindKeys:function(){return this.each(function(){a(this).unbind("keydown")})},getLocalRow:function(a){var b=!1,c;this.each(function(){"undefined"!==typeof a&&(c=this.p._index[a],0<=c&&(b=this.p.data[c]))});return b}})})(jQuery);
(function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return"boolean"===typeof a},isObject:function(d){return d&&("object"===typeof d||a.isFunction(d))||!1},isString:function(a){return"string"===typeof a},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isNull:function(a){return null===a},isUndefined:function(a){return"undefined"===typeof a},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(d){if(!this.isString(d)&&
this.isValue(d))return!1;if(!this.isValue(d))return!0;d=a.trim(d).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return""===d}});a.fn.fmatter=function(d,b,c,f,k){var h=b;c=a.extend({},a.jgrid.formatter,c);a.fn.fmatter[d]&&(h=a.fn.fmatter[d](b,c,f,k));return h};a.fmatter.util={NumberFormat:function(d,b){a.fmatter.isNumber(d)||(d*=1);if(a.fmatter.isNumber(d)){var c=0>d,f=d+"",k=b.decimalSeparator?b.decimalSeparator:".",h;if(a.fmatter.isNumber(b.decimalPlaces)){var g=b.decimalPlaces,f=Math.pow(10,
g),f=Math.round(d*f)/f+"";h=f.lastIndexOf(".");if(0<g)for(0>h?(f+=k,h=f.length-1):"."!==k&&(f=f.replace(".",k));f.length-1-h<g;)f+="0"}if(b.thousandsSeparator){g=b.thousandsSeparator;h=f.lastIndexOf(k);h=-1<h?h:f.length;for(var k=f.substring(h),e=-1,l=h;0<l;l--)e++,0===e%3&&l!==h&&(!c||1<l)&&(k=g+k),k=f.charAt(l-1)+k;f=k}f=b.prefix?b.prefix+f:f;return b.suffix?f+b.suffix:f}return d},DateFormat:function(d,b,c,f){var k=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,h="string"===typeof b?
b.match(k):null,k=function(a,b){a=String(a);for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},g={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},e=0,l,n=["i18n"];n.i18n={dayNames:f.dayNames,monthNames:f.monthNames};d in f.masks&&(d=f.masks[d]);if(b.constructor===Number)"u"==String(d).toLowerCase()&&(b*=1E3),e=new Date(b);else if(b.constructor===Date)e=b;else if(null!==h)e=new Date(parseInt(h[1],10)),h[3]&&(d=60*Number(h[5])+Number(h[6]),d*="-"==h[4]?1:-1,d-=e.getTimezoneOffset(),e.setTime(Number(Number(e)+6E4*
d)));else{b=String(b).split(/[\\\/:_;.,\t\T\s-]/);d=d.split(/[\\\/:_;.,\t\T\s-]/);h=0;for(l=d.length;h<l;h++)"M"==d[h]&&(e=a.inArray(b[h],n.i18n.monthNames),-1!==e&&12>e&&(b[h]=e+1)),"F"==d[h]&&(e=a.inArray(b[h],n.i18n.monthNames),-1!==e&&11<e&&(b[h]=e+1-12)),b[h]&&(g[d[h].toLowerCase()]=parseInt(b[h],10));g.f&&(g.m=g.f);if(0===g.m&&0===g.y&&0===g.d)return"&#160;";g.m=parseInt(g.m,10)-1;e=g.y;70<=e&&99>=e?g.y=1900+g.y:0<=e&&69>=e&&(g.y=2E3+g.y);e=new Date(g.y,g.m,g.d,g.h,g.i,g.s,g.u)}c in f.masks?
c=f.masks[c]:c||(c="Y-m-d");d=e.getHours();b=e.getMinutes();g=e.getDate();h=e.getMonth()+1;l=e.getTimezoneOffset();var p=e.getSeconds(),q=e.getMilliseconds(),s=e.getDay(),r=e.getFullYear(),w=(s+6)%7+1,v=(new Date(r,h-1,g)-new Date(r,0,1))/864E5,u={d:k(g),D:n.i18n.dayNames[s],j:g,l:n.i18n.dayNames[s+7],N:w,S:f.S(g),w:s,z:v,W:5>w?Math.floor((v+w-1)/7)+1:Math.floor((v+w-1)/7)||(4>((new Date(r-1,0,1)).getDay()+6)%7?53:52),F:n.i18n.monthNames[h-1+12],m:k(h),M:n.i18n.monthNames[h-1],n:h,t:"?",L:"?",o:"?",
Y:r,y:String(r).substring(2),a:12>d?f.AmPm[0]:f.AmPm[1],A:12>d?f.AmPm[2]:f.AmPm[3],B:"?",g:d%12||12,G:d,h:k(d%12||12),H:k(d),i:k(b),s:k(p),u:q,e:"?",I:"?",O:(0<l?"-":"+")+k(100*Math.floor(Math.abs(l)/60)+Math.abs(l)%60,4),P:"?",T:(String(e).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(e/1E3)};return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
function(a){return a in u?u[a]:a.substring(1)})}};a.fn.fmatter.defaultFormat=function(d,b){return a.fmatter.isValue(d)&&""!==d?d:b.defaultValue?b.defaultValue:"&#160;"};a.fn.fmatter.email=function(d,b){return a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,b):'<a href="mailto:'+d+'">'+d+"</a>"};a.fn.fmatter.checkbox=function(d,b){var c=a.extend({},b.checkbox),f;a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));f=!0===c.disabled?'disabled="disabled"':"";
if(a.fmatter.isEmpty(d)||a.fmatter.isUndefined(d))d=a.fn.fmatter.defaultFormat(d,c);d=(d+"").toLowerCase();return'<input type="checkbox" '+(0>d.search(/(false|0|no|off)/i)?" checked='checked' ":"")+' value="'+d+'" offval="no" '+f+"/>"};a.fn.fmatter.link=function(d,b){var c={target:b.target},f="";a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));c.target&&(f="target="+c.target);return a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,b):"<a "+f+' href="'+
d+'">'+d+"</a>"};a.fn.fmatter.showlink=function(d,b){var c={baseLinkUrl:b.baseLinkUrl,showAction:b.showAction,addParam:b.addParam||"",target:b.target,idName:b.idName},f="";a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));c.target&&(f="target="+c.target);c=c.baseLinkUrl+c.showAction+"?"+c.idName+"="+b.rowId+c.addParam;return a.fmatter.isString(d)||a.fmatter.isNumber(d)?"<a "+f+' href="'+c+'">'+d+"</a>":a.fn.fmatter.defaultFormat(d,b)};a.fn.fmatter.integer=
function(d,b){var c=a.extend({},b.integer);a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));return a.fmatter.isEmpty(d)?c.defaultValue:a.fmatter.util.NumberFormat(d,c)};a.fn.fmatter.number=function(d,b){var c=a.extend({},b.number);a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));return a.fmatter.isEmpty(d)?c.defaultValue:a.fmatter.util.NumberFormat(d,c)};a.fn.fmatter.currency=function(d,b){var c=a.extend({},b.currency);
a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));return a.fmatter.isEmpty(d)?c.defaultValue:a.fmatter.util.NumberFormat(d,c)};a.fn.fmatter.date=function(d,b,c,f){c=a.extend({},b.date);a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend({},c,b.colModel.formatoptions));return c.reformatAfterEdit||"edit"!=f?a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,b):a.fmatter.util.DateFormat(c.srcformat,d,c.newformat,c):a.fn.fmatter.defaultFormat(d,b)};a.fn.fmatter.select=
function(d,b){d+="";var c=!1,f=[];a.fmatter.isUndefined(b.colModel.formatoptions)?a.fmatter.isUndefined(b.colModel.editoptions)||(c=b.colModel.editoptions.value):c=b.colModel.formatoptions.value;if(c){var k=!0===b.colModel.editoptions.multiple?!0:!1,h=[],g;k&&(h=d.split(","),h=a.map(h,function(b){return a.trim(b)}));if(a.fmatter.isString(c))for(var e=c.split(";"),l=0,n=0;n<e.length;n++)if(g=e[n].split(":"),2<g.length&&(g[1]=jQuery.map(g,function(a,b){if(0<b)return a}).join(":")),k)-1<jQuery.inArray(g[0],
h)&&(f[l]=g[1],l++);else{if(a.trim(g[0])==a.trim(d)){f[0]=g[1];break}}else a.fmatter.isObject(c)&&(k?f=jQuery.map(h,function(a){return c[a]}):f[0]=c[d]||"")}d=f.join(", ");return""===d?a.fn.fmatter.defaultFormat(d,b):d};a.fn.fmatter.rowactions=function(d,b,c,f){var k={keys:!1,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}};d=a.jgrid.jqID(d);b=a.jgrid.jqID(b);f=a("#"+b)[0].p.colModel[f];a.fmatter.isUndefined(f.formatoptions)||
(k=a.extend(k,f.formatoptions));a.fmatter.isUndefined(a("#"+b)[0].p.editOptions)||(k.editOptions=a("#"+b)[0].p.editOptions);a.fmatter.isUndefined(a("#"+b)[0].p.delOptions)||(k.delOptions=a("#"+b)[0].p.delOptions);f=function(c){k.afterSave&&k.afterSave(c);a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+b+".ui-jqgrid-btable:first").show();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+b+".ui-jqgrid-btable:first").hide()};var h=function(c){k.afterRestore&&k.afterRestore(c);
a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+b+".ui-jqgrid-btable:first").show();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+b+".ui-jqgrid-btable:first").hide()};switch(c){case "edit":a("#"+b).jqGrid("editRow",d,k.keys,k.onEdit,k.onSuccess,k.url,k.extraparam,f,k.onError,h);a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+b+".ui-jqgrid-btable:first").hide();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+b+".ui-jqgrid-btable:first").show();
break;case "save":a("#"+b).jqGrid("saveRow",d,k.onSuccess,k.url,k.extraparam,f,k.onError,h)&&(a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+b+".ui-jqgrid-btable:first").show(),a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+b+".ui-jqgrid-btable:first").hide());break;case "cancel":a("#"+b).jqGrid("restoreRow",d,h);a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+b+".ui-jqgrid-btable:first").show();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel",
"#"+b+".ui-jqgrid-btable:first").hide();break;case "del":a("#"+b).jqGrid("delGridRow",d,k.delOptions);break;case "formedit":a("#"+b).jqGrid("setSelection",d),a("#"+b).jqGrid("editGridRow",d,k.editOptions)}};a.fn.fmatter.actions=function(d,b){var c={keys:!1,editbutton:!0,delbutton:!0,editformbutton:!1};a.fmatter.isUndefined(b.colModel.formatoptions)||(c=a.extend(c,b.colModel.formatoptions));var f=b.rowId,k="",h;if("undefined"==typeof f||a.fmatter.isEmpty(f))return"";c.editformbutton?(h="onclick=$.fn.fmatter.rowactions('"+
f+"','"+b.gid+"','formedit',"+b.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ",k=k+"<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+h+"><span class='ui-icon ui-icon-pencil'></span></div>"):c.editbutton&&(h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','edit',"+b.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ",
k=k+"<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+h+"><span class='ui-icon ui-icon-pencil'></span></div>");c.delbutton&&(h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','del',"+b.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ",k=k+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+h+"><span class='ui-icon ui-icon-trash'></span></div>");
h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','save',"+b.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";k=k+"<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+h+"><span class='ui-icon ui-icon-disk'></span></div>";h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','cancel',"+b.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
k=k+"<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+h+"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+k+"</div>"};a.unformat=function(d,b,c,f){var k,h=b.colModel.formatter,g=b.colModel.formatoptions||{},e=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=b.colModel.unformat||a.fn.fmatter[h]&&a.fn.fmatter[h].unformat;if("undefined"!==typeof l&&a.isFunction(l))k=l(a(d).text(),b,d);else if(!a.fmatter.isUndefined(h)&&
a.fmatter.isString(h))switch(k=a.jgrid.formatter||{},h){case "integer":g=a.extend({},k.integer,g);b=g.thousandsSeparator.replace(e,"\\$1");k=a(d).text().replace(RegExp(b,"g"),"");break;case "number":g=a.extend({},k.number,g);b=g.thousandsSeparator.replace(e,"\\$1");k=a(d).text().replace(RegExp(b,"g"),"").replace(g.decimalSeparator,".");break;case "currency":g=a.extend({},k.currency,g);b=g.thousandsSeparator.replace(e,"\\$1");k=a(d).text().replace(RegExp(b,"g"),"").replace(g.decimalSeparator,".").replace(g.prefix,
"").replace(g.suffix,"");break;case "checkbox":g=b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes","No"];k=a("input",d).attr("checked")?g[0]:g[1];break;case "select":k=a.unformat.select(d,b,c,f);break;case "actions":return"";default:k=a(d).text()}return void 0!==k?k:!0===f?a(d).text():a.jgrid.htmlDecode(a(d).html())};a.unformat.select=function(d,b,c,f){c=[];d=a(d).text();if(!0===f)return d;b=a.extend({},b.colModel.editoptions);if(b.value){var k=b.value;b=!0===b.multiple?!0:!1;
f=[];var h;b&&(f=d.split(","),f=a.map(f,function(b){return a.trim(b)}));if(a.fmatter.isString(k))for(var g=k.split(";"),e=0,l=0;l<g.length;l++)if(h=g[l].split(":"),2<h.length&&(h[1]=jQuery.map(h,function(a,b){if(0<b)return a}).join(":")),b)-1<jQuery.inArray(h[1],f)&&(c[e]=h[0],e++);else{if(a.trim(h[1])==a.trim(d)){c[0]=h[0];break}}else if(a.fmatter.isObject(k)||a.isArray(k))b||(f[0]=d),c=jQuery.map(f,function(b){var c;a.each(k,function(a,d){if(d==b)return c=a,!1});if("undefined"!=typeof c)return c});
return c.join(", ")}return d||""};a.unformat.date=function(d,b){var c=a.jgrid.formatter.date||{};a.fmatter.isUndefined(b.formatoptions)||(c=a.extend({},c,b.formatoptions));return a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,b):a.fmatter.util.DateFormat(c.newformat,d,c.srcformat,c)}})(jQuery);
(function(a){a.jgrid.extend({getColProp:function(a){var b={},c=this[0];if(!c.grid)return!1;for(var c=c.p.colModel,f=0;f<c.length;f++)if(c[f].name==a){b=c[f];break}return b},setColProp:function(d,b){return this.each(function(){if(this.grid&&b)for(var c=this.p.colModel,f=0;f<c.length;f++)if(c[f].name==d){a.extend(this.p.colModel[f],b);break}})},sortGrid:function(a,b,c){return this.each(function(){var f=-1;if(this.grid){a||(a=this.p.sortname);for(var k=0;k<this.p.colModel.length;k++)if(this.p.colModel[k].index==
a||this.p.colModel[k].name==a){f=k;break}-1!=f&&(k=this.p.colModel[f].sortable,"boolean"!==typeof k&&(k=!0),"boolean"!==typeof b&&(b=!1),k&&this.sortData("jqgh_"+this.p.id+"_"+a,f,b,c))}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var d=this.id;try{a("#gbox_"+d).remove()}catch(b){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var d={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
var b=document.createElement("table");a(b).attr({id:d.id});b.className=d.cl;d=this.id;a(b).removeClass("ui-jqgrid-btable");1===a(this.p.pager).parents("#gbox_"+d).length?(a(b).insertBefore("#gbox_"+d).show(),a(this.p.pager).insertBefore("#gbox_"+d)):a(b).insertBefore("#gbox_"+d).show();a("#gbox_"+d).remove()}})},setGridState:function(d){return this.each(function(){this.grid&&("hidden"==d?(a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast"),this.p.pager&&a(this.p.pager).slideUp("fast"),
this.p.toppager&&a(this.p.toppager).slideUp("fast"),!0===this.p.toolbar[0]&&("both"==this.p.toolbar[1]&&a(this.grid.ubDiv).slideUp("fast"),a(this.grid.uDiv).slideUp("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),this.p.gridstate="hidden"):"visible"==d&&(a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast"),this.p.pager&&
a(this.p.pager).slideDown("fast"),this.p.toppager&&a(this.p.toppager).slideDown("fast"),!0===this.p.toolbar[0]&&("both"==this.p.toolbar[1]&&a(this.grid.ubDiv).slideDown("fast"),a(this.grid.uDiv).slideDown("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast"),a(".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(d){d=a.extend({autosearch:!0,
searchOnEnter:!0,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw"},d||{});return this.each(function(){function b(b,c){var d=a(b);d[0]&&jQuery.each(c,function(){void 0!==this.data?d.bind(this.type,this.data,this.fn):d.bind(this.type,this.fn)})}var c=this;if(!this.ftoolbar){var f=function(){var b={},e=0,f,h,k={},q;a.each(c.p.colModel,function(){h=this.index||this.name;switch(this.stype){case "select":q=this.searchoptions&&
this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(f=a("#gs_"+a.jgrid.jqID(this.name),c.grid.hDiv).val())b[h]=f,k[h]=q,e++;else try{delete c.p.postData[h]}catch(r){}break;case "text":if(q=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:d.defaultSearch,f=a("#gs_"+a.jgrid.jqID(this.name),c.grid.hDiv).val())b[h]=f,k[h]=q,e++;else try{delete c.p.postData[h]}catch(s){}}});var s=0<e?!0:!1;if(!0===d.stringResult||"local"==c.p.datatype){var r='{"groupOp":"'+d.groupOp+'","rules":[',
w=0;a.each(b,function(a,b){0<w&&(r+=",");r+='{"field":"'+a+'",';r+='"op":"'+k[a]+'",';r+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';w++});r+="]}";a.extend(c.p.postData,{filters:r});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,b);var v;c.p.searchurl&&(v=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl}));var u=!1;a.isFunction(d.beforeSearch)&&(u=d.beforeSearch.call(c));
u||a(c).jqGrid("setGridParam",{search:s}).trigger("reloadGrid",[{page:1}]);v&&a(c).jqGrid("setGridParam",{url:v});a.isFunction(d.afterSearch)&&d.afterSearch()},k=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),h;a.each(c.p.colModel,function(){var g=this,e,l,n,p;l=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+c.p.direction+"'></th>");e=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");!0===this.hidden&&a(l).css("display","none");
this.search=!1===this.search?!1:!0;"undefined"==typeof this.stype&&(this.stype="text");n=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(p=this.surl||n.dataUrl)a.ajax(a.extend({url:p,dataType:"html",complete:function(c){void 0!==n.buildSelect?(c=n.buildSelect(c))&&a(e).append(c):a(e).append(c.responseText);n.defaultValue&&a("select",e).val(n.defaultValue);a("select",e).attr({name:g.index||g.name,id:"gs_"+g.name});n.attr&&a("select",e).attr(n.attr);a("select",
e).css({width:"100%"});void 0!==n.dataInit&&n.dataInit(a("select",e)[0]);void 0!==n.dataEvents&&b(a("select",e)[0],n.dataEvents);!0===d.autosearch&&a("select",e).change(function(){f();return!1});c=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var q;g.searchoptions&&g.searchoptions.value?q=g.searchoptions.value:g.editoptions&&g.editoptions.value&&(q=g.editoptions.value);if(q){p=document.createElement("select");p.style.width="100%";a(p).attr({name:g.index||g.name,id:"gs_"+g.name});var s,
r;if("string"===typeof q){q=q.split(";");for(var w=0;w<q.length;w++)s=q[w].split(":"),r=document.createElement("option"),r.value=s[0],r.innerHTML=s[1],p.appendChild(r)}else if("object"===typeof q)for(s in q)q.hasOwnProperty(s)&&(r=document.createElement("option"),r.value=s,r.innerHTML=q[s],p.appendChild(r));n.defaultValue&&a(p).val(n.defaultValue);n.attr&&a(p).attr(n.attr);void 0!==n.dataInit&&n.dataInit(p);void 0!==n.dataEvents&&b(p,n.dataEvents);a(e).append(p);!0===d.autosearch&&a(p).change(function(){f();
return!1})}}break;case "text":p=n.defaultValue?n.defaultValue:"",a(e).append("<input type='text' style='width:95%;padding:0px;' name='"+(g.index||g.name)+"' id='gs_"+g.name+"' value='"+p+"'/>"),n.attr&&a("input",e).attr(n.attr),void 0!==n.dataInit&&n.dataInit(a("input",e)[0]),void 0!==n.dataEvents&&b(a("input",e)[0],n.dataEvents),!0===d.autosearch&&(d.searchOnEnter?a("input",e).keypress(function(a){return 13==(a.charCode?a.charCode:a.keyCode?a.keyCode:0)?(f(),!1):this}):a("input",e).keydown(function(a){switch(a.which){case 13:return!1;
case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:h&&clearTimeout(h),h=setTimeout(function(){f()},500)}}))}a(l).append(e);a(k).append(l)});a("table thead",c.grid.hDiv).append(k);this.ftoolbar=!0;this.triggerToolbar=f;this.clearToolbar=function(b){var e={},f,h=0,k;b="boolean"!=typeof b?!0:b;a.each(c.p.colModel,function(){f=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";k=this.index||this.name;switch(this.stype){case "select":var b;a("#gs_"+
a.jgrid.jqID(k)+" option",c.grid.hDiv).each(function(c){0===c&&(this.selected=!0);if(a(this).text()==f)return this.selected=!0,b=a(this).val(),!1});if(b)e[k]=b,h++;else try{delete c.p.postData[k]}catch(d){}break;case "text":if(a("#gs_"+a.jgrid.jqID(k),c.grid.hDiv).val(f),f)e[k]=f,h++;else try{delete c.p.postData[k]}catch(g){}}});var q=0<h?!0:!1;if(!0===d.stringResult||"local"==c.p.datatype){var s='{"groupOp":"'+d.groupOp+'","rules":[',r=0;a.each(e,function(a,b){0<r&&(s+=",");s+='{"field":"'+a+'",';
s+='"op":"eq",';s+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';r++});s+="]}";a.extend(c.p.postData,{filters:s});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,e);var w;c.p.searchurl&&(w=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl}));var v=!1;a.isFunction(d.beforeClear)&&(v=d.beforeClear.call(c));v||b&&a(c).jqGrid("setGridParam",{search:q}).trigger("reloadGrid",[{page:1}]);
w&&a(c).jqGrid("setGridParam",{url:w});a.isFunction(d.afterClear)&&d.afterClear()};this.toggleToolbar=function(){var b=a("tr.ui-search-toolbar",c.grid.hDiv);"none"==b.css("display")?b.show():b.hide()}}})}})})(jQuery);
(function(a){a.extend(a.jgrid,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(d,b){b=a.extend({jqm:!0,gb:""},b||{});if(b.onClose){var c=b.onClose(d);if("boolean"==typeof c&&!c)return}if(a.fn.jqm&&!0===b.jqm)a(d).attr("aria-hidden","true").jqmHide();else{if(""!==b.gb)try{a(".jqgrid-overlay:first",b.gb).hide()}catch(f){}a(d).hide().attr("aria-hidden","true")}},findPos:function(a){var b=0,c=0;if(a.offsetParent){do b+=
a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent)}return[b,c]},createModal:function(d,b,c,f,k,h,g){var e=document.createElement("div"),l,n=this;g=a.extend({},g||{});l="rtl"==a(c.gbox).attr("dir")?!0:!1;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=d.themodal;var p=document.createElement("div");p.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";p.id=d.modalhead;a(p).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var q=a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){q.addClass("ui-state-hover")},
function(){q.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(p).append(q);l?(e.dir="rtl",a(".ui-jqdialog-title",p).css("float","right"),a(".ui-jqdialog-titlebar-close",p).css("left","0.3em")):(e.dir="ltr",a(".ui-jqdialog-title",p).css("float","left"),a(".ui-jqdialog-titlebar-close",p).css("right","0.3em"));var s=document.createElement("div");a(s).addClass("ui-jqdialog-content ui-widget-content").attr("id",d.modalcontent);a(s).append(b);e.appendChild(s);
a(e).prepend(p);!0===h?a("body").append(e):"string"==typeof h?a(h).append(e):a(e).insertBefore(f);a(e).css(g);"undefined"===typeof c.jqModal&&(c.jqModal=!0);b={};if(a.fn.jqm&&!0===c.jqModal)0===c.left&&0===c.top&&c.overlay&&(g=[],g=this.findPos(k),c.left=g[0]+4,c.top=g[1]+4),b.top=c.top+"px",b.left=c.left;else if(0!==c.left||0!==c.top)b.left=c.left,b.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",p).click(function(){var b=a("#"+d.themodal).data("onClose")||c.onClose,e=a("#"+d.themodal).data("gbox")||
c.gbox;n.hideModal("#"+d.themodal,{gb:e,jqm:c.jqModal,onClose:b});return!1});0!==c.width&&c.width||(c.width=300);0!==c.height&&c.height||(c.height=200);c.zIndex||(f=a(f).parents("*[role=dialog]").filter(":first").css("z-index"),c.zIndex=f?parseInt(f,10)+1:950);f=0;l&&b.left&&!h&&(f=a(c.gbox).width()-(isNaN(c.width)?0:parseInt(c.width,10))-8,b.left=parseInt(b.left,10)+parseInt(f,10));b.left&&(b.left+="px");a(e).css(a.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":c.height+
"px",zIndex:c.zIndex,overflow:"hidden"},b)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":d.modalhead,"aria-hidden":"true"});"undefined"==typeof c.drag&&(c.drag=!0);"undefined"==typeof c.resize&&(c.resize=!0);if(c.drag)if(a(p).css("cursor","move"),a.fn.jqDrag)a(e).jqDrag(p);else try{a(e).draggable({handle:a("#"+p.id)})}catch(r){}if(c.resize)if(a.fn.jqResize)a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"),
a("#"+d.themodal).jqResize(".jqResize",d.scrollelm?"#"+d.scrollelm:!1);else try{a(e).resizable({handles:"se, sw",alsoResize:d.scrollelm?"#"+d.scrollelm:!1})}catch(w){}!0===c.closeOnEscape&&a(e).keydown(function(b){27==b.which&&(b=a("#"+d.themodal).data("onClose")||c.onClose,n.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:b}))})},viewModal:function(d,b){b=a.extend({toTop:!0,overlay:10,modal:!1,onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:!0,jqM:!0},b||{});if(a.fn.jqm&&!0===b.jqm)b.jqM?
a(d).attr("aria-hidden","false").jqm(b).jqmShow():a(d).attr("aria-hidden","false").jqmShow();else{""!==b.gbox&&(a(".jqgrid-overlay:first",b.gbox).show(),a(d).data("gbox",b.gbox));a(d).show().attr("aria-hidden","false");try{a(":input:visible",d)[0].focus()}catch(c){}}},info_dialog:function(d,b,c,f){var k={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,caption:"<b>"+d+"</b>",left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};
a.extend(k,f||{});var h=k.jqModal,g=this;a.fn.jqm&&!h&&(h=!1);d="";if(0<k.buttons.length)for(f=0;f<k.buttons.length;f++)"undefined"==typeof k.buttons[f].id&&(k.buttons[f].id="info_button_"+f),d+="<a href='javascript:void(0)' id='"+k.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+k.buttons[f].text+"</a>";f=isNaN(k.dataheight)?k.dataheight:k.dataheight+"px";b="<div id='info_id'>"+("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
f+";"+("text-align:"+k.align+";")+"'>"+b+"</div>");b+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+k.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'>"+c+"</a>"+d+"</div>":""!==d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+k.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
d+"</div>":"";b+="</div>";try{"false"==a("#info_dialog").attr("aria-hidden")&&this.hideModal("#info_dialog",{jqm:h}),a("#info_dialog").remove()}catch(e){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},b,k,"","",!0);d&&a.each(k.buttons,function(b){a("#"+this.id,"#info_id").bind("click",function(){k.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){g.hideModal("#info_dialog",{jqm:h});
return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(k.beforeOpen)&&k.beforeOpen();this.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:k.modal,jqm:h});a.isFunction(k.afterOpen)&&k.afterOpen();try{a("#info_dialog").focus()}catch(l){}},createEl:function(d,b,c,f,k){function h(b,c){a.isFunction(c.dataInit)&&c.dataInit(b);c.dataEvents&&a.each(c.dataEvents,
function(){void 0!==this.data?a(b).bind(this.type,this.data,this.fn):a(b).bind(this.type,this.fn)});return c}function g(b,c,d){var e="dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr".split(" ");"undefined"!=typeof d&&a.isArray(d)&&(e=a.extend(e,d));a.each(c,function(c,d){-1===a.inArray(c,e)&&a(b).attr(c,d)});c.hasOwnProperty("id")||a(b).attr("id",a.jgrid.randId())}var e="";switch(d){case "textarea":e=document.createElement("textarea");f?b.cols||a(e).css({width:"98%"}):
b.cols||(b.cols=20);b.rows||(b.rows=2);if("&nbsp;"==c||"&#160;"==c||1==c.length&&160==c.charCodeAt(0))c="";e.value=c;g(e,b);b=h(e,b);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";b.value?(d=b.value.split(":"),c===d[0]&&(e.checked=!0,e.defaultChecked=!0),e.value=d[0],a(e).attr("offval",d[1])):(d=c.toLowerCase(),0>d.search(/(false|0|no|off|undefined)/i)&&""!==d?(e.checked=!0,e.defaultChecked=!0,e.value=c):e.value="on",a(e).attr("offval",
"off"));g(e,b,["value"]);b=h(e,b);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];!0===b.multiple?(d=!0,e.multiple="multiple",a(e).attr("aria-multiselectable","true")):d=!1;if("undefined"!=typeof b.dataUrl)a.ajax(a.extend({url:b.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:b,vl:c},success:function(b){var c=[],d=this.elem,e=this.vl,f=a.extend({},this.options),k=!0===f.multiple;"undefined"!=typeof f.buildSelect&&
(b=f.buildSelect(b));if(b=a(b).html())a(d).append(b),g(d,f),f=h(d,f),"undefined"===typeof f.size&&(f.size=k?3:1),k?(c=e.split(","),c=a.map(c,function(b){return a.trim(b)})):c[0]=a.trim(e),setTimeout(function(){a("option",d).each(function(){a(this).attr("role","option");if(-1<a.inArray(a.trim(a(this).text()),c)||-1<a.inArray(a.trim(a(this).val()),c))this.selected="selected"})},0)}},k||{}));else if(b.value){var l;d?(f=c.split(","),f=a.map(f,function(b){return a.trim(b)}),"undefined"===typeof b.size&&
(b.size=3)):b.size=1;"function"===typeof b.value&&(b.value=b.value());var n,p;if("string"===typeof b.value)for(n=b.value.split(";"),l=0;l<n.length;l++)p=n[l].split(":"),2<p.length&&(p[1]=a.map(p,function(a,b){if(0<b)return a}).join(":")),k=document.createElement("option"),k.setAttribute("role","option"),k.value=p[0],k.innerHTML=p[1],d||a.trim(p[0])!=a.trim(c)&&a.trim(p[1])!=a.trim(c)||(k.selected="selected"),d&&(-1<a.inArray(a.trim(p[1]),f)||-1<a.inArray(a.trim(p[0]),f))&&(k.selected="selected"),
e.appendChild(k);else if("object"===typeof b.value)for(l in n=b.value,n)n.hasOwnProperty(l)&&(k=document.createElement("option"),k.setAttribute("role","option"),k.value=l,k.innerHTML=n[l],d||a.trim(l)!=a.trim(c)&&a.trim(n[l])!=a.trim(c)||(k.selected="selected"),d&&(-1<a.inArray(a.trim(n[l]),f)||-1<a.inArray(a.trim(l),f))&&(k.selected="selected"),e.appendChild(k));g(e,b,["value"]);b=h(e,b)}break;case "text":case "password":case "button":l="button"==d?"button":"textbox";e=document.createElement("input");
e.type=d;e.value=c;g(e,b);b=h(e,b);"button"!=d&&(f?b.size||a(e).css({width:"98%"}):b.size||(b.size=20));a(e).attr("role",l);break;case "image":case "file":e=document.createElement("input");e.type=d;g(e,b);b=h(e,b);break;case "custom":e=document.createElement("span");try{if(a.isFunction(b.custom_element))if(n=b.custom_element.call(this,c,b))n=a(n).addClass("customelement").attr({id:b.id,name:b.name}),a(e).empty().append(n);else throw"e2";else throw"e1";}catch(q){"e1"==q&&this.info_dialog(a.jgrid.errors.errcap,
"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"==q?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,"string"===typeof q?q:q.message,a.jgrid.edit.bClose)}}return e},checkDate:function(a,b){var c={},f;a=a.toLowerCase();f=-1!=a.indexOf("/")?"/":-1!=a.indexOf("-")?"-":-1!=a.indexOf(".")?".":"/";a=a.split(f);b=b.split(f);if(3!=b.length)return!1;f=-1;for(var k,h=-1,g=
-1,e=0;e<a.length;e++)k=isNaN(b[e])?0:parseInt(b[e],10),c[a[e]]=k,k=a[e],-1!=k.indexOf("y")&&(f=e),-1!=k.indexOf("m")&&(g=e),-1!=k.indexOf("d")&&(h=e);k="y"==a[f]||"yyyy"==a[f]?4:"yy"==a[f]?2:-1;var e=function(a){for(var b=1;b<=a;b++){this[b]=31;if(4==b||6==b||9==b||11==b)this[b]=30;2==b&&(this[b]=29)}return this}(12),l;if(-1===f)return!1;l=c[a[f]].toString();2==k&&1==l.length&&(k=1);if(l.length!=k||0===c[a[f]]&&"00"!=b[f]||-1===g)return!1;l=c[a[g]].toString();if(1>l.length||1>c[a[g]]||12<c[a[g]]||
-1===h)return!1;l=c[a[h]].toString();return 1>l.length||1>c[a[h]]||31<c[a[h]]||2==c[a[g]]&&c[a[h]]>(0!==c[a[f]]%4||0===c[a[f]]%100&&0!==c[a[f]]%400?28:29)||c[a[h]]>e[c[a[g]]]?!1:!0},isEmpty:function(a){return a.match(/^\s+$/)||""===a?!0:!1},checkTime:function(a){var b=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(a))if(a=a.match(b)){if(a[3]){if(1>a[1]||12<a[1])return!1}else if(23<a[1])return!1;if(59<a[2])return!1}else return!1;return!0},checkValues:function(d,b,c,f,k){var h,g;if("undefined"===typeof f)if("string"==
typeof b)for(f=0,k=c.p.colModel.length;f<k;f++){if(c.p.colModel[f].name==b){h=c.p.colModel[f].editrules;b=f;try{g=c.p.colModel[f].formoptions.label}catch(e){}break}}else 0<=b&&(h=c.p.colModel[b].editrules);else h=f,g=void 0===k?"_":k;if(h){g||(g=c.p.colNames[b]);if(!0===h.required&&this.isEmpty(d))return[!1,g+": "+a.jgrid.edit.msg.required,""];f=!1===h.required?!1:!0;if(!0===h.number&&(!1!==f||!this.isEmpty(d))&&isNaN(d))return[!1,g+": "+a.jgrid.edit.msg.number,""];if("undefined"!=typeof h.minValue&&
!isNaN(h.minValue)&&parseFloat(d)<parseFloat(h.minValue))return[!1,g+": "+a.jgrid.edit.msg.minValue+" "+h.minValue,""];if("undefined"!=typeof h.maxValue&&!isNaN(h.maxValue)&&parseFloat(d)>parseFloat(h.maxValue))return[!1,g+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(!(!0!==h.email||!1===f&&this.isEmpty(d)||(k=/^((([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,
k.test(d))))return[!1,g+": "+a.jgrid.edit.msg.email,""];if(!(!0!==h.integer||!1===f&&this.isEmpty(d)||!isNaN(d)&&0===d%1&&-1==d.indexOf(".")))return[!1,g+": "+a.jgrid.edit.msg.integer,""];if(!(!0!==h.date||!1===f&&this.isEmpty(d)||(b=c.p.colModel[b].formatoptions&&c.p.colModel[b].formatoptions.newformat?c.p.colModel[b].formatoptions.newformat:c.p.colModel[b].datefmt||"Y-m-d",this.checkDate(b,d))))return[!1,g+": "+a.jgrid.edit.msg.date+" - "+b,""];if(!0===h.time&&!(!1===f&&this.isEmpty(d)||this.checkTime(d)))return[!1,
g+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(!(!0!==h.url||!1===f&&this.isEmpty(d)||(k=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,k.test(d))))return[!1,g+": "+a.jgrid.edit.msg.url,""];if(!0===h.custom&&(!1!==f||!this.isEmpty(d)))return a.isFunction(h.custom_func)?(d=h.custom_func.call(c,d,g),a.isArray(d)?d:[!1,a.jgrid.edit.msg.customarray,""]):[!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(jQuery);
(function(a){a.jgrid.extend({searchGrid:function(d){d=a.extend({recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!1,width:450,height:"auto",dataheight:"auto",showQuery:!1,errorcheck:!0,sopt:null,stringResult:void 0,
onClose:null,onSearch:null,onReset:null,toTop:!0,overlay:10,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null},a.jgrid.search,d||{});return this.each(function(){function b(){a.isFunction(d.beforeShowSearch)&&(k=d.beforeShowSearch(a("#"+f)),"undefined"===typeof k&&(k=!0));k&&(a.jgrid.viewModal("#"+h.themodal,{gbox:"#gbox_"+f,jqm:d.jqModal,modal:d.modal,overlay:d.overlay,toTop:d.toTop}),a.isFunction(d.afterShowSearch)&&d.afterShowSearch(a("#"+f)))}var c=this;
if(c.grid){var f="fbox_"+c.p.id,k=!0,h={themodal:"searchmod"+f,modalhead:"searchhd"+f,modalcontent:"searchcnt"+f,scrollelm:f},g=c.p.postData[d.sFilter];"string"===typeof g&&(g=a.jgrid.parse(g));!0===d.recreateFilter&&a("#"+h.themodal).remove();if(null!==a("#"+h.themodal).html())b();else{var e=a("<span><div id='"+f+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+c.p.id);if(a.isFunction(d.onInitializeSearch))d.onInitializeSearch(a("#"+f));var l=a.extend([],c.p.colModel),
n="<a href='javascript:void(0)' id='"+f+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+d.Find+"</a>",p="<a href='javascript:void(0)' id='"+f+"_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>"+d.Reset+"</a>",q="",s="",r,w=!1,v=-1;d.showQuery&&(q="<a href='javascript:void(0)' id='"+f+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");
d.columns.length?l=d.columns:a.each(l,function(a,b){b.label||(b.label=c.p.colNames[a]);if(!w){var d="undefined"===typeof b.search?!0:b.search,e=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&d||d&&!e)w=!0,r=b.index||b.name,v=a}});if(!g&&r||!1===d.multipleSearch){var u="eq";0<=v&&l[v].searchoptions&&l[v].searchoptions.sopt?u=l[v].searchoptions.sopt[0]:d.sopt&&d.sopt.length&&(u=d.sopt[0]);g={groupOp:"AND",rules:[{field:r,op:u,data:""}]}}w=!1;d.tmplNames&&d.tmplNames.length&&(w=
!0,s=d.tmplLabel,s+="<select class='ui-template'>",s+="<option value='default'>Default</option>",a.each(d.tmplNames,function(a,b){s+="<option value='"+a+"'>"+b+"</option>"}),s+="</select>");n="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+f+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+p+s+"</td><td class='EditButton'>"+q+n+"</td></tr></tbody></table>";a("#"+f).jqFilter({columns:l,
filter:d.loadDefaults?g:null,showQuery:d.showQuery,errorcheck:d.errorcheck,sopt:d.sopt,groupButton:d.multipleGroup,ruleButtons:d.multipleSearch,afterRedraw:d.afterRedraw,_gridsopt:a.jgrid.search.odata,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())}});e.append(n);w&&d.tmplFilters&&d.tmplFilters.length&&a(".ui-template",e).bind("change",function(){var b=a(this).val();"default"==b?a("#"+f).jqFilter("addFilter",g):a("#"+f).jqFilter("addFilter",d.tmplFilters[parseInt(b,
10)]);return!1});!0===d.multipleGroup&&(d.multipleSearch=!0);if(a.isFunction(d.onInitializeSearch))d.onInitializeSearch(a("#"+f));d.layer?a.jgrid.createModal(h,e,d,"#gview_"+c.p.id,a("#gbox_"+c.p.id)[0],"#"+d.layer,{position:"relative"}):a.jgrid.createModal(h,e,d,"#gview_"+c.p.id,a("#gbox_"+c.p.id)[0]);q&&a("#"+f+"_query").bind("click",function(){a(".queryresult",e).toggle();return!1});void 0===d.stringResult&&(d.stringResult=d.multipleSearch);a("#"+f+"_search").bind("click",function(){var b=a("#"+
f),e={},g,k=b.jqFilter("filterData");if(d.errorcheck&&(b[0].hideError(),d.showQuery||b.jqFilter("toSQLString"),b[0].p.error))return b[0].showError(),!1;if(d.stringResult){try{g=xmlJsonClass.toJson(k,"","",!1)}catch(l){try{g=JSON.stringify(k)}catch(q){}}"string"===typeof g&&(e[d.sFilter]=g,a.each([d.sField,d.sValue,d.sOper],function(){e[this]=""}))}else d.multipleSearch?(e[d.sFilter]=k,a.each([d.sField,d.sValue,d.sOper],function(){e[this]=""})):(e[d.sField]=k.rules[0].field,e[d.sValue]=k.rules[0].data,
e[d.sOper]=k.rules[0].op,e[d.sFilter]="");c.p.search=!0;a.extend(c.p.postData,e);if(a.isFunction(d.onSearch))d.onSearch();a(c).trigger("reloadGrid",[{page:1}]);d.closeAfterSearch&&a.jgrid.hideModal("#"+h.themodal,{gb:"#gbox_"+c.p.id,jqm:d.jqModal,onClose:d.onClose});return!1});a("#"+f+"_reset").bind("click",function(){var b={},g=a("#"+f);c.p.search=!1;!1===d.multipleSearch?b[d.sField]=b[d.sValue]=b[d.sOper]="":b[d.sFilter]="";g[0].resetFilter();w&&a(".ui-template",e).val("default");a.extend(c.p.postData,
b);if(a.isFunction(d.onReset))d.onReset();a(c).trigger("reloadGrid",[{page:1}]);return!1});b();a(".fm-button:not(.ui-state-disabled)",e).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(d,b){var c=b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,onInitializeForm:null,beforeInitData:null,
beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,closeOnEscape:!1,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0},a.jgrid.edit,b||{});return this.each(function(){function f(){a("#"+
u+" > tbody > tr > td > .FormElement").each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(r.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(C[c]=this.editoptions.custom_value(a("#"+a.jgrid.jqID(c),"#"+u),"get"),void 0===C[c])throw"e1";}catch(b){"e1"===b?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,
b.message,jQuery.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).attr("checked")?C[this.name]=a(this).val():(b=a(this).attr("offval"),C[this.name]=b);break;case "select-one":C[this.name]=a("option:selected",this).val();y[this.name]=a("option:selected",this).text();break;case "select-multiple":C[this.name]=a(this).val();C[this.name]=C[this.name]?C[this.name].join(","):"";var d=[];a("option:selected",this).each(function(b,c){d[b]=a(c).text()});y[this.name]=d.join(",");
break;case "password":case "text":case "textarea":case "button":C[this.name]=a(this).val()}r.p.autoencode&&(C[this.name]=a.jgrid.htmlEncode(C[this.name]))}});return!0}function k(b,d,e,f){var g,h,k=0,l,m,q,n=[],p=!1,s="",v;for(v=1;v<=f;v++)s+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";"_empty"!=b&&(p=a(d).jqGrid("getInd",b));a(d.p.colModel).each(function(v){g=this.name;m=(this.editrules&&!0===this.editrules.edithidden?0:!0===this.hidden)?"style='display:none'":"";if("cb"!==g&&
"subgrid"!==g&&!0===this.editable&&"rn"!==g){if(!1===p)l="";else if(g==d.p.ExpandColumn&&!0===d.p.treeGrid)l=a("td:eq("+v+")",d.rows[p]).text();else{try{l=a.unformat(a("td:eq("+v+")",d.rows[p]),{rowId:b,colModel:this},v)}catch(u){l=this.edittype&&"textarea"==this.edittype?a("td:eq("+v+")",d.rows[p]).text():a("td:eq("+v+")",d.rows[p]).html()}if(!l||"&nbsp;"==l||"&#160;"==l||1==l.length&&160==l.charCodeAt(0))l=""}var w=a.extend({},this.editoptions||{},{id:g,name:g}),z=a.extend({},{elmprefix:"",elmsuffix:"",
rowabove:!1,rowcontent:""},this.formoptions||{}),x=parseInt(z.rowpos,10)||k+1,y=parseInt(2*(parseInt(z.colpos,10)||1),10);"_empty"==b&&w.defaultValue&&(l=a.isFunction(w.defaultValue)?w.defaultValue():w.defaultValue);this.edittype||(this.edittype="text");r.p.autoencode&&(l=a.jgrid.htmlDecode(l));q=a.jgrid.createEl(this.edittype,w,l,!1,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));""===l&&"checkbox"==this.edittype&&(l=a(q).attr("offval"));""===l&&"select"==this.edittype&&(l=a("option:eq(0)",
q).text());if(c.checkOnSubmit||c.checkOnUpdate)c._savedData[g]=l;a(q).addClass("FormElement");"text"!=this.edittype&&"textarea"!=this.edittype||a(q).addClass("ui-widget-content ui-corner-all");h=a(e).find("tr[rowpos="+x+"]");z.rowabove&&(w=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+z.rowcontent+"</td></tr>"),a(e).append(w),w[0].rp=x);0===h.length&&(h=a("<tr "+m+" rowpos='"+x+"'></tr>").addClass("FormData").attr("id","tr_"+g),a(h).append(s),a(e).append(h),h[0].rp=x);a("td:eq("+(y-2)+")",h[0]).html("undefined"===
typeof z.label?d.p.colNames[v]:z.label);a("td:eq("+(y-1)+")",h[0]).append(z.elmprefix).append(q).append(z.elmsuffix);n[k]=v;k++}});0<k&&(v=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+d.p.id+"_id' value='"+b+"'/></td></tr>"),v[0].rp=k+999,a(e).append(v),c.checkOnSubmit||c.checkOnUpdate)&&(c._savedData[d.p.id+"_id"]=b);return n}function h(b,d,e){var f,g=0,h,k,l,m,q;if(c.checkOnSubmit||
c.checkOnUpdate)c._savedData={},c._savedData[d.p.id+"_id"]=b;var n=d.p.colModel;if("_empty"==b)a(n).each(function(){f=this.name;l=a.extend({},this.editoptions||{});(k=a("#"+a.jgrid.jqID(f),"#"+e))&&k.length&&null!==k[0]&&(m="",l.defaultValue?(m=a.isFunction(l.defaultValue)?l.defaultValue():l.defaultValue,"checkbox"==k[0].type?(q=m.toLowerCase(),0>q.search(/(false|0|no|off|undefined)/i)&&""!==q?(k[0].checked=!0,k[0].defaultChecked=!0,k[0].value=m):k.attr({checked:"",defaultChecked:""})):k.val(m)):
"checkbox"==k[0].type?(k[0].checked=!1,k[0].defaultChecked=!1,m=a(k).attr("offval")):k[0].type&&"select"==k[0].type.substr(0,6)?k[0].selectedIndex=0:k.val(m),!0===c.checkOnSubmit||c.checkOnUpdate)&&(c._savedData[f]=m)}),a("#id_g","#"+e).val(b);else{var p=a(d).jqGrid("getInd",b,!0);p&&(a("td",p).each(function(k){f=n[k].name;if("cb"!==f&&"subgrid"!==f&&"rn"!==f&&!0===n[k].editable){if(f==d.p.ExpandColumn&&!0===d.p.treeGrid)h=a(this).text();else try{h=a.unformat(a(this),{rowId:b,colModel:n[k]},k)}catch(l){h=
"textarea"==n[k].edittype?a(this).text():a(this).html()}r.p.autoencode&&(h=a.jgrid.htmlDecode(h));if(!0===c.checkOnSubmit||c.checkOnUpdate)c._savedData[f]=h;f=a.jgrid.jqID(f);switch(n[k].edittype){case "password":case "text":case "button":case "image":case "textarea":if("&nbsp;"==h||"&#160;"==h||1==h.length&&160==h.charCodeAt(0))h="";a("#"+f,"#"+e).val(h);break;case "select":var m=h.split(","),m=a.map(m,function(b){return a.trim(b)});a("#"+f+" option","#"+e).each(function(){this.selected=n[k].editoptions.multiple||
m[0]!=a.trim(a(this).text())&&m[0]!=a.trim(a(this).val())?n[k].editoptions.multiple?-1<a.inArray(a.trim(a(this).text()),m)||-1<a.inArray(a.trim(a(this).val()),m)?!0:!1:!1:!0});break;case "checkbox":h+="";n[k].editoptions&&n[k].editoptions.value?n[k].editoptions.value.split(":")[0]==h?(a("#"+f,"#"+e).attr("checked",!0),a("#"+f,"#"+e).attr("defaultChecked",!0)):(a("#"+f,"#"+e).attr("checked",!1),a("#"+f,"#"+e).attr("defaultChecked","")):(h=h.toLowerCase(),0>h.search(/(false|0|no|off|undefined)/i)&&
""!==h?(a("#"+f,"#"+e).attr("checked",!0),a("#"+f,"#"+e).attr("defaultChecked",!0)):(a("#"+f,"#"+e).attr("checked",!1),a("#"+f,"#"+e).attr("defaultChecked","")));break;case "custom":try{if(n[k].editoptions&&a.isFunction(n[k].editoptions.custom_value))n[k].editoptions.custom_value(a("#"+f,"#"+e),"set",h);else throw"e1";}catch(q){"e1"==q?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,
q.message,jQuery.jgrid.edit.bClose)}}g++}}),0<g&&a("#id_g","#"+u).val(b))}}function g(){var d,e=[!0,"",""],f={},g=r.p.prmNames,k,l,m,q;if(a.isFunction(c.beforeCheckValues)){var n=c.beforeCheckValues(C,a("#"+v),"_empty"==C[r.p.id+"_id"]?g.addoper:g.editoper);n&&"object"===typeof n&&(C=n)}for(m in C)if(C.hasOwnProperty(m)&&(e=a.jgrid.checkValues(C[m],m,r),!1===e[0]))break;e[0]&&(a.isFunction(c.onclickSubmit)&&(f=c.onclickSubmit(c,C)||{}),a.isFunction(c.beforeSubmit)&&(e=c.beforeSubmit(C,a("#"+v))));
if(e[0]&&!c.processing){c.processing=!0;a("#sData","#"+u+"_2").addClass("ui-state-active");l=g.oper;k=g.id;C[l]="_empty"==a.trim(C[r.p.id+"_id"])?g.addoper:g.editoper;C[l]!=g.addoper?C[k]=C[r.p.id+"_id"]:void 0===C[k]&&(C[k]=C[r.p.id+"_id"]);delete C[r.p.id+"_id"];C=a.extend(C,c.editData,f);if(!0===r.p.treeGrid)for(i in C[l]==g.addoper&&(q=a(r).jqGrid("getGridParam","selrow"),C["adjacency"==r.p.treeGridModel?r.p.treeReader.parent_id_field:"parent_id"]=q),r.p.treeReader)f=r.p.treeReader[i],C.hasOwnProperty(f)&&
(C[l]==g.addoper&&"parent_id_field"===i||delete C[f]);f=a.extend({url:c.url?c.url:a(r).jqGrid("getGridParam","editurl"),type:c.mtype,data:a.isFunction(c.serializeEditData)?c.serializeEditData(C):C,complete:function(f,m){"success"!=m?(e[0]=!1,e[1]=a.isFunction(c.errorTextFormat)?c.errorTextFormat(f):m+" Status: '"+f.statusText+"'. Error code: "+f.status):a.isFunction(c.afterSubmit)&&(e=c.afterSubmit(f,C));if(!1===e[0])a("#FormError>td","#"+u).html(e[1]),a("#FormError","#"+u).show();else if(a.each(r.p.colModel,
function(){if(y[this.name]&&this.formatter&&"select"==this.formatter)try{delete y[this.name]}catch(a){}}),C=a.extend(C,y),r.p.autoencode&&a.each(C,function(b,c){C[b]=a.jgrid.htmlDecode(c)}),c.reloadAfterSubmit=c.reloadAfterSubmit&&"local"!=r.p.datatype,C[l]==g.addoper?(e[2]||(e[2]=a.jgrid.randId()),C[k]=e[2],c.closeAfterAdd?(c.reloadAfterSubmit?a(r).trigger("reloadGrid"):!0===r.p.treeGrid?a(r).jqGrid("addChildNode",e[2],q,C):(a(r).jqGrid("addRowData",e[2],C,b.addedrow),a(r).jqGrid("setSelection",
e[2])),a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose})):c.clearAfterAdd?(c.reloadAfterSubmit?a(r).trigger("reloadGrid"):!0===r.p.treeGrid?a(r).jqGrid("addChildNode",e[2],q,C):a(r).jqGrid("addRowData",e[2],C,b.addedrow),h("_empty",r,v)):c.reloadAfterSubmit?a(r).trigger("reloadGrid"):!0===r.p.treeGrid?a(r).jqGrid("addChildNode",e[2],q,C):a(r).jqGrid("addRowData",e[2],C,b.addedrow)):(c.reloadAfterSubmit?(a(r).trigger("reloadGrid"),c.closeAfterEdit||setTimeout(function(){a(r).jqGrid("setSelection",
C[k])},1E3)):!0===r.p.treeGrid?a(r).jqGrid("setTreeRow",C[k],C):a(r).jqGrid("setRowData",C[k],C),c.closeAfterEdit&&a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose})),a.isFunction(c.afterComplete)&&(d=f,setTimeout(function(){c.afterComplete(d,C,a("#"+v));d=null},500)),c.checkOnSubmit||c.checkOnUpdate)if(a("#"+v).data("disabled",!1),"_empty"!=c._savedData[r.p.id+"_id"])for(var n in c._savedData)C[n]&&(c._savedData[n]=C[n]);c.processing=!1;a("#sData","#"+u+"_2").removeClass("ui-state-active");
try{a(":input:visible","#"+v)[0].focus()}catch(p){}}},a.jgrid.ajaxOptions,c.ajaxEditOptions);f.url||c.useDataProxy||(a.isFunction(r.p.dataProxy)?c.useDataProxy=!0:(e[0]=!1,e[1]+=" "+a.jgrid.errors.nourl));e[0]&&(c.useDataProxy?r.p.dataProxy.call(r,f,"set_"+r.p.id):a.ajax(f))}!1===e[0]&&(a("#FormError>td","#"+u).html(e[1]),a("#FormError","#"+u).show())}function e(a,b){var c=!1,d;for(d in a)if(a[d]!=b[d]){c=!0;break}return c}function l(){a.each(r.p.colModel,function(a,b){b.editoptions&&!0===b.editoptions.NullIfEmpty&&
C.hasOwnProperty(b.name)&&""==C[b.name]&&(C[b.name]="null")})}function n(){var b=!0;a("#FormError","#"+u).hide();c.checkOnUpdate&&(C={},y={},f(),T=a.extend({},C,y),e(T,c._savedData)?(a("#"+v).data("disabled",!0),a(".confirm","#"+x.themodal).show(),b=!1):l());return b}function p(){if("_empty"!==d&&"undefined"!==typeof r.p.savedRow&&0<r.p.savedRow.length&&a.isFunction(a.fn.jqGrid.restoreRow))for(var b=0;b<r.p.savedRow.length;b++)if(r.p.savedRow[b].id==d){a(r).jqGrid("restoreRow",d);break}}function q(b,
c){0===b?a("#pData","#"+u+"_2").addClass("ui-state-disabled"):a("#pData","#"+u+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+u+"_2").addClass("ui-state-disabled"):a("#nData","#"+u+"_2").removeClass("ui-state-disabled")}function s(){var b=a(r).jqGrid("getDataIDs"),c=a("#id_g","#"+u).val();return[a.inArray(c,b),b]}var r=this;if(r.grid&&d){var w=r.p.id,v="FrmGrid_"+w,u="TblGrid_"+w,x={themodal:"editmod"+w,modalhead:"edithd"+w,modalcontent:"editcnt"+w,scrollelm:v},B=a.isFunction(c.beforeShowForm)?
c.beforeShowForm:!1,A=a.isFunction(c.afterShowForm)?c.afterShowForm:!1,z=a.isFunction(c.beforeInitData)?c.beforeInitData:!1,D=a.isFunction(c.onInitializeForm)?c.onInitializeForm:!1,E=!0,I=1,F=0,C,y,T;"new"===d?(d="_empty",b.caption=c.addCaption):b.caption=c.editCaption;!0===b.recreateForm&&null!==a("#"+x.themodal).html()&&a("#"+x.themodal).remove();var Y=!0;b.checkOnUpdate&&b.jqModal&&!b.modal&&(Y=!1);if(null!==a("#"+x.themodal).html()){z&&(E=z(a("#"+v)),"undefined"==typeof E&&(E=!0));if(!1===E)return;
p();a(".ui-jqdialog-title","#"+x.modalhead).html(b.caption);a("#FormError","#"+u).hide();c.topinfo?(a(".topinfo","#"+u+"_2").html(c.topinfo),a(".tinfo","#"+u+"_2").show()):a(".tinfo","#"+u+"_2").hide();c.bottominfo?(a(".bottominfo","#"+u+"_2").html(c.bottominfo),a(".binfo","#"+u+"_2").show()):a(".binfo","#"+u+"_2").hide();h(d,r,v);"_empty"!=d&&c.viewPagerButtons?a("#pData, #nData","#"+u+"_2").show():a("#pData, #nData","#"+u+"_2").hide();!0===c.processing&&(c.processing=!1,a("#sData","#"+u+"_2").removeClass("ui-state-active"));
!0===a("#"+v).data("disabled")&&(a(".confirm","#"+x.themodal).hide(),a("#"+v).data("disabled",!1));B&&B(a("#"+v));a("#"+x.themodal).data("onClose",c.onClose);a.jgrid.viewModal("#"+x.themodal,{gbox:"#gbox_"+w,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal});Y||a(".jqmOverlay").click(function(){if(!n())return!1;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose});return!1});A&&A(a("#"+v))}else{var m=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",m=a("<form name='FormPost' id='"+
v+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+m+";'></form>").data("disabled",!1),V=a("<table id='"+u+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");z&&(E=z(a("#"+v)),"undefined"==typeof E&&(E=!0));if(!1===E)return;p();a(r.p.colModel).each(function(){var a=this.formoptions;I=Math.max(I,a?a.colpos||0:0);F=Math.max(F,a?a.rowpos||0:0)});a(m).append(V);z=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+
2*I+"'></td></tr>");z[0].rp=0;a(V).append(z);z=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+2*I+"'>"+c.topinfo+"</td></tr>");z[0].rp=0;a(V).append(z);var E=(z="rtl"==r.p.direction?!0:!1)?"nData":"pData",W=z?"pData":"nData";k(d,r,V,I);var E="<a href='javascript:void(0)' id='"+E+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",W="<a href='javascript:void(0)' id='"+W+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
ca="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",ia="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>",E="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+u+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(z?W+E:E+W)+"</td><td class='EditButton'>"+ca+ia+"</td></tr>"+
("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+c.bottominfo+"</td></tr>"),E=E+"</tbody></table>";if(0<F){var M=[];a.each(a(V)[0].rows,function(a,b){M[a]=b});M.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(M,function(b,c){a("tbody",V).append(c)})}b.gbox="#gbox_"+w;var O=!1;!0===b.closeOnEscape&&(b.closeOnEscape=!1,O=!0);m=a("<span></span>").append(m).append(E);a.jgrid.createModal(x,m,b,"#gview_"+r.p.id,a("#gbox_"+r.p.id)[0]);z&&(a("#pData, #nData","#"+
u+"_2").css("float","right"),a(".EditButton","#"+u+"_2").css("text-align","left"));c.topinfo&&a(".tinfo","#"+u+"_2").show();c.bottominfo&&a(".binfo","#"+u+"_2").show();E=m=null;a("#"+x.themodal).keydown(function(d){var e=d.target;if(!0===a("#"+v).data("disabled"))return!1;if(!0===c.savekey[0]&&d.which==c.savekey[1]&&"TEXTAREA"!=e.tagName)return a("#sData","#"+u+"_2").trigger("click"),!1;if(27===d.which){if(!n())return!1;O&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:c.onClose});return!1}if(!0===
c.navkeys[0]){if("_empty"==a("#id_g","#"+u).val())return!0;if(d.which==c.navkeys[1])return a("#pData","#"+u+"_2").trigger("click"),!1;if(d.which==c.navkeys[2])return a("#nData","#"+u+"_2").trigger("click"),!1}});b.checkOnUpdate&&(a("a.ui-jqdialog-titlebar-close span","#"+x.themodal).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+x.themodal).unbind("click").click(function(){if(!n())return!1;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose});return!1}));
b.saveicon=a.extend([!0,"left","ui-icon-disk"],b.saveicon);b.closeicon=a.extend([!0,"left","ui-icon-close"],b.closeicon);!0===b.saveicon[0]&&a("#sData","#"+u+"_2").addClass("right"==b.saveicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");!0===b.closeicon[0]&&a("#cData","#"+u+"_2").addClass("right"==b.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");if(c.checkOnSubmit||
c.checkOnUpdate)ca="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bYes+"</a>",W="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bNo+"</a>",ia="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bExit+"</a>",m=b.zIndex||999,m++,a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+m+";display:none;'>&#160;"+
(a.browser.msie&&6==a.browser.version?'<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:"+(m+1)+"'>"+b.saveData+"<br/><br/>"+ca+W+ia+"</div>").insertAfter("#"+v),a("#sNew","#"+x.themodal).click(function(){g();a("#"+v).data("disabled",!1);a(".confirm","#"+x.themodal).hide();return!1}),a("#nNew","#"+x.themodal).click(function(){a(".confirm","#"+x.themodal).hide();
a("#"+v).data("disabled",!1);setTimeout(function(){a(":input","#"+v)[0].focus()},0);return!1}),a("#cNew","#"+x.themodal).click(function(){a(".confirm","#"+x.themodal).hide();a("#"+v).data("disabled",!1);a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose});return!1});D&&D(a("#"+v));"_empty"!=d&&c.viewPagerButtons?a("#pData,#nData","#"+u+"_2").show():a("#pData,#nData","#"+u+"_2").hide();B&&B(a("#"+v));a("#"+x.themodal).data("onClose",c.onClose);a.jgrid.viewModal("#"+x.themodal,
{gbox:"#gbox_"+w,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});Y||a(".jqmOverlay").click(function(){if(!n())return!1;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose});return!1});A&&A(a("#"+v));a(".fm-button","#"+x.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+u+"_2").click(function(){C={};y={};a("#FormError","#"+u).hide();f();l();"_empty"==C[r.p.id+"_id"]?g():!0===b.checkOnSubmit?(T=
a.extend({},C,y),e(T,c._savedData)?(a("#"+v).data("disabled",!0),a(".confirm","#"+x.themodal).show()):g()):g();return!1});a("#cData","#"+u+"_2").click(function(){if(!n())return!1;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+w,jqm:b.jqModal,onClose:c.onClose});return!1});a("#nData","#"+u+"_2").click(function(){if(!n())return!1;a("#FormError","#"+u).hide();var c=s();c[0]=parseInt(c[0],10);if(-1!=c[0]&&c[1][c[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+v),c[1][c[0]]);
h(c[1][c[0]+1],r,v);a(r).jqGrid("setSelection",c[1][c[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+v),c[1][c[0]+1]);q(c[0]+1,c[1].length-1)}return!1});a("#pData","#"+u+"_2").click(function(){if(!n())return!1;a("#FormError","#"+u).hide();var c=s();if(-1!=c[0]&&c[1][c[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+v),c[1][c[0]]);h(c[1][c[0]-1],r,v);a(r).jqGrid("setSelection",c[1][c[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",
a("#"+v),c[1][c[0]-1]);q(c[0]-1,c[1].length-1)}return!1})}B=s();q(B[0],B[1].length-1)}})},viewGridRow:function(d,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,jqModal:!0,closeOnEscape:!1,labelswidth:"30%",closeicon:[],navkeys:[!1,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:!0},a.jgrid.view,b||{});return this.each(function(){function c(){!0!==b.closeOnEscape&&!0!==b.navkeys[0]||setTimeout(function(){a(".ui-jqdialog-titlebar-close",
"#"+q.modalhead).focus()},0)}function f(c,d,e,f){for(var g,h,k,l=0,q,n,p=[],r=!1,s="<td class='CaptionTD form-view-label ui-widget-content' width='"+b.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",v="",w=["integer","number","currency"],u=0,z=0,x,D,B,A=1;A<=f;A++)v+=1==A?s:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(d.p.colModel).each(function(){(h=
this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)||"right"!==this.align||(this.formatter&&-1!==a.inArray(this.formatter,w)?u=Math.max(u,parseInt(this.width,10)):z=Math.max(z,parseInt(this.width,10)))});x=0!==u?u:0!==z?z:0;r=a(d).jqGrid("getInd",c);a(d.p.colModel).each(function(b){g=this.name;D=!1;n=(h=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";B="boolean"!=typeof this.viewable?!0:this.viewable;if("cb"!==g&&"subgrid"!==
g&&"rn"!==g&&B){q=!1===r?"":g==d.p.ExpandColumn&&!0===d.p.treeGrid?a("td:eq("+b+")",d.rows[r]).text():a("td:eq("+b+")",d.rows[r]).html();D="right"===this.align&&0!==x?!0:!1;a.extend({},this.editoptions||{},{id:g,name:g});var c=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),s=parseInt(c.rowpos,10)||l+1,w=parseInt(2*(parseInt(c.colpos,10)||1),10);if(c.rowabove){var u=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+c.rowcontent+"</td></tr>");a(e).append(u);u[0].rp=s}k=a(e).find("tr[rowpos="+
s+"]");0===k.length&&(k=a("<tr "+n+" rowpos='"+s+"'></tr>").addClass("FormData").attr("id","trv_"+g),a(k).append(v),a(e).append(k),k[0].rp=s);a("td:eq("+(w-2)+")",k[0]).html("<b>"+("undefined"===typeof c.label?d.p.colNames[b]:c.label)+"</b>");a("td:eq("+(w-1)+")",k[0]).append("<span>"+q+"</span>").attr("id","v_"+g);D&&a("td:eq("+(w-1)+") span",k[0]).css({"text-align":"right",width:x+"px"});p[l]=b;l++}});0<l&&(c=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+
(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+c+"'/></td></tr>"),c[0].rp=l+99,a(e).append(c));return p}function k(b,c){var d,e,f=0,g,h;if(h=a(c).jqGrid("getInd",b,!0))a("td",h).each(function(b){d=c.p.colModel[b].name;e=c.p.colModel[b].editrules&&!0===c.p.colModel[b].editrules.edithidden?!1:!0===c.p.colModel[b].hidden?!0:!1;"cb"!==d&&"subgrid"!==d&&"rn"!==d&&(g=d==c.p.ExpandColumn&&!0===c.p.treeGrid?a(this).text():a(this).html(),a.extend({},c.p.colModel[b].editoptions||
{}),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+p).html(g),e&&a("#"+d,"#"+p).parents("tr:first").hide(),f++)}),0<f&&a("#id_g","#"+p).val(b)}function h(b,c){0===b?a("#pData","#"+p+"_2").addClass("ui-state-disabled"):a("#pData","#"+p+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+p+"_2").addClass("ui-state-disabled"):a("#nData","#"+p+"_2").removeClass("ui-state-disabled")}function g(){var b=a(e).jqGrid("getDataIDs"),c=a("#id_g","#"+p).val();return[a.inArray(c,b),b]}var e=this;if(e.grid&&
d){b.imgpath||(b.imgpath=e.p.imgpath);var l=e.p.id,n="ViewGrid_"+l,p="ViewTbl_"+l,q={themodal:"viewmod"+l,modalhead:"viewhd"+l,modalcontent:"viewcnt"+l,scrollelm:n},s=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,r=!0,w=1,v=0;if(null!==a("#"+q.themodal).html()){s&&(r=s(a("#"+n)),"undefined"==typeof r&&(r=!0));if(!1===r)return;a(".ui-jqdialog-title","#"+q.modalhead).html(b.caption);a("#FormError","#"+p).hide();k(d,e);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+
q.themodal,{gbox:"#gbox_"+l,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal});c()}else{var u=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",u=a("<form name='FormPost' id='"+n+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+u+";'></form>"),x=a("<table id='"+p+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");s&&(r=s(a("#"+n)),"undefined"==typeof r&&(r=!0));if(!1===r)return;a(e.p.colModel).each(function(){var a=
this.formoptions;w=Math.max(w,a?a.colpos||0:0);v=Math.max(v,a?a.rowpos||0:0)});a(u).append(x);f(d,e,x,w);var s="rtl"==e.p.direction?!0:!1,r="<a href='javascript:void(0)' id='"+(s?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",B="<a href='javascript:void(0)' id='"+(s?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",A="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+
b.bClose+"</a>";if(0<v){var z=[];a.each(a(x)[0].rows,function(a,b){z[a]=b});z.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(z,function(b,c){a("tbody",x).append(c)})}b.gbox="#gbox_"+l;var D=!1;!0===b.closeOnEscape&&(b.closeOnEscape=!1,D=!0);u=a("<span></span>").append(u).append("<table border='0' class='EditTable' id='"+p+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+b.labelswidth+"'>"+(s?B+r:r+B)+"</td><td class='EditButton'>"+A+"</td></tr></tbody></table>");a.jgrid.createModal(q,
u,b,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);s&&(a("#pData, #nData","#"+p+"_2").css("float","right"),a(".EditButton","#"+p+"_2").css("text-align","left"));b.viewPagerButtons||a("#pData, #nData","#"+p+"_2").hide();u=null;a("#"+q.themodal).keydown(function(c){if(27===c.which)return D&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose}),!1;if(!0===b.navkeys[0]){if(c.which===b.navkeys[1])return a("#pData","#"+p+"_2").trigger("click"),!1;if(c.which===b.navkeys[2])return a("#nData","#"+
p+"_2").trigger("click"),!1}});b.closeicon=a.extend([!0,"left","ui-icon-close"],b.closeicon);!0===b.closeicon[0]&&a("#cData","#"+p+"_2").addClass("right"==b.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+l,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+p+"_2").hover(function(){a(this).addClass("ui-state-hover")},
function(){a(this).removeClass("ui-state-hover")});c();a("#cData","#"+p+"_2").click(function(){a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:b.onClose});return!1});a("#nData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var d=g();d[0]=parseInt(d[0],10);if(-1!=d[0]&&d[1][d[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+n),d[1][d[0]]);k(d[1][d[0]+1],e);a(e).jqGrid("setSelection",d[1][d[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",
a("#"+n),d[1][d[0]+1]);h(d[0]+1,d[1].length-1)}c();return!1});a("#pData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var d=g();if(-1!=d[0]&&d[1][d[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+n),d[1][d[0]]);k(d[1][d[0]-1],e);a(e).jqGrid("setSelection",d[1][d[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+n),d[1][d[0]-1]);h(d[0]-1,d[1].length-1)}c();return!1})}u=g();h(u[0],u[1].length-1)}})},delGridRow:function(d,b){var c=
b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,url:"",mtype:"POST",reloadAfterSubmit:!0,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:!0,closeOnEscape:!1,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:!1,serializeDelData:null,useDataProxy:!1},a.jgrid.del,b||{});return this.each(function(){var f=this;if(f.grid&&d){var k=a.isFunction(b.beforeShowForm),
h=a.isFunction(b.afterShowForm),g=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,e=f.p.id,l={},n=!0,p="DelTbl_"+e,q,s,r,w,v={themodal:"delmod"+e,modalhead:"delhd"+e,modalcontent:"delcnt"+e,scrollelm:p};jQuery.isArray(d)&&(d=d.join());if(null!==a("#"+v.themodal).html()){g&&(n=g(a("#"+p)),"undefined"==typeof n&&(n=!0));if(!1===n)return;a("#DelData>td","#"+p).text(d);a("#DelError","#"+p).hide();!0===c.processing&&(c.processing=!1,a("#dData","#"+p).removeClass("ui-state-active"));k&&b.beforeShowForm(a("#"+
p));a.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+e,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal})}else{var u=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",u="<div id='"+p+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+u+";'><table class='DelTable'><tbody>",u=u+"<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",u=u+("<tr id='DelData' style='display:none'><td >"+d+"</td></tr>"),u=u+('<tr><td class="delmsg" style="white-space:pre;">'+
b.msg+"</td></tr><tr><td >&#160;</td></tr>"),u=u+"</tbody></table></div>",u=u+("<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+p+"_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'>"+b.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+
"</a>")+"</td></tr></tbody></table>");b.gbox="#gbox_"+e;a.jgrid.createModal(v,u,b,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);g&&(n=g(a("#"+p)),"undefined"==typeof n&&(n=!0));if(!1===n)return;a(".fm-button","#"+p+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([!0,"left","ui-icon-scissors"],b.delicon);b.cancelicon=a.extend([!0,"left","ui-icon-cancel"],b.cancelicon);!0===b.delicon[0]&&a("#dData","#"+p+"_2").addClass("right"==
b.delicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.delicon[2]+"'></span>");!0===b.cancelicon[0]&&a("#eData","#"+p+"_2").addClass("right"==b.cancelicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.cancelicon[2]+"'></span>");a("#dData","#"+p+"_2").click(function(){var d=[!0,""];l={};var g=a("#DelData>td","#"+p).text();a.isFunction(b.onclickSubmit)&&(l=b.onclickSubmit(c,g)||{});a.isFunction(b.beforeSubmit)&&(d=b.beforeSubmit(g));
if(d[0]&&!c.processing){c.processing=!0;a(this).addClass("ui-state-active");r=f.p.prmNames;q=a.extend({},c.delData,l);w=r.oper;q[w]=r.deloper;s=r.id;q[s]=g;var h=a.extend({url:c.url?c.url:a(f).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeDelData)?b.serializeDelData(q):q,complete:function(h,k){"success"!=k?(d[0]=!1,d[1]=a.isFunction(c.errorTextFormat)?c.errorTextFormat(h):k+" Status: '"+h.statusText+"'. Error code: "+h.status):a.isFunction(c.afterSubmit)&&(d=c.afterSubmit(h,
q));if(!1===d[0])a("#DelError>td","#"+p).html(d[1]),a("#DelError","#"+p).show();else{if(c.reloadAfterSubmit&&"local"!=f.p.datatype)a(f).trigger("reloadGrid");else{var l=[],l=g.split(",");if(!0===f.p.treeGrid)try{a(f).jqGrid("delTreeNode",l[0])}catch(n){}else for(var r=0;r<l.length;r++)a(f).jqGrid("delRowData",l[r]);f.p.selrow=null;f.p.selarrrow=[]}a.isFunction(c.afterComplete)&&setTimeout(function(){c.afterComplete(h,g)},500)}c.processing=!1;a("#dData","#"+p+"_2").removeClass("ui-state-active");d[0]&&
a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+e,jqm:b.jqModal,onClose:c.onClose})}},a.jgrid.ajaxOptions,b.ajaxDelOptions);h.url||c.useDataProxy||(a.isFunction(f.p.dataProxy)?c.useDataProxy=!0:(d[0]=!1,d[1]+=" "+a.jgrid.errors.nourl));d[0]&&(c.useDataProxy?f.p.dataProxy.call(f,h,"del_"+f.p.id):a.ajax(h))}!1===d[0]&&(a("#DelError>td","#"+p).html(d[1]),a("#DelError","#"+p).show());return!1});a("#eData","#"+p+"_2").click(function(){a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+e,jqm:b.jqModal,onClose:c.onClose});
return!1});k&&b.beforeShowForm(a("#"+p));a.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+e,jqm:b.jqModal,overlay:b.overlay,modal:b.modal})}h&&b.afterShowForm(a("#"+p));!0===b.closeOnEscape&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+v.modalhead).focus()},0)}})},navGrid:function(d,b,c,f,k,h,g){b=a.extend({edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",del:!0,delicon:"ui-icon-trash",search:!0,searchicon:"ui-icon-search",refresh:!0,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",
view:!1,viewicon:"ui-icon-document",position:"left",closeOnEscape:!0,beforeRefresh:null,afterRefresh:null,cloneToTop:!1},a.jgrid.nav,b||{});return this.each(function(){if(!this.nav){var e={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},l=this,n,p,q;if(l.grid&&"string"==typeof d)for(null===a("#"+e.themodal).html()&&("undefined"!=typeof window.innerWidth?(n=window.innerWidth,p=window.innerHeight):"undefined"!=typeof document.documentElement&&"undefined"!=typeof document.documentElement.clientWidth&&
0!==document.documentElement.clientWidth?(n=document.documentElement.clientWidth,p=document.documentElement.clientHeight):(n=1024,p=768),a.jgrid.createModal(e,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+l.p.id,jqModal:!0,drag:!0,resize:!0,caption:b.alertcap,top:p/2-25,left:n/2-100,width:200,height:"auto",closeOnEscape:b.closeOnEscape},"","",!0)),n=1,b.cloneToTop&&l.p.toppager&&(n=2),p=0;p<n;p++){var s=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
r,w;0===p?(r=d,w=l.p.id,r==l.p.toppager&&(w+="_top",n=1)):(r=l.p.toppager,w=l.p.id+"_top");"rtl"==l.p.direction&&a(s).attr("dir","rtl").css("float","right");b.add&&(f=f||{},q=a("<td class='ui-pg-button ui-corner-all'></td>"),a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.addtitle||"",id:f.id||"add_"+w}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(b.addfunc)?b.addfunc():a(l).jqGrid("editGridRow",
"new",f));return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),q=null);b.edit&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),c=c||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.editicon+"'></span>"+b.edittext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.edittitle||"",id:c.id||"edit_"+w}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var d=l.p.selrow;d?a.isFunction(b.editfunc)?
b.editfunc(d):a(l).jqGrid("editGridRow",d,c):(a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+l.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),q=null);b.view&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),g=g||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.viewtitle||
"",id:g.id||"view_"+w}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var c=l.p.selrow;c?a.isFunction(b.viewfunc)?b.viewfunc(c):a(l).jqGrid("viewGridRow",c,g):(a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+l.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),q=null);b.del&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),k=k||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+
b.delicon+"'></span>"+b.deltext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.deltitle||"",id:k.id||"del_"+w}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var c;l.p.multiselect?(c=l.p.selarrrow,0===c.length&&(c=null)):c=l.p.selrow;c?"function"==typeof b.delfunc?b.delfunc(c):a(l).jqGrid("delGridRow",c,k):(a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+l.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},
function(){a(this).removeClass("ui-state-hover")}),q=null);(b.add||b.edit||b.del||b.view)&&a("tr",s).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");b.search&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),h=h||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+"'></span>"+b.searchtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.searchtitle||"",id:h.id||"search_"+w}).click(function(){a(this).hasClass("ui-state-disabled")||
a(l).jqGrid("searchGrid",h);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),h.showOnLoad&&!0===h.showOnLoad&&a(q,s).click(),q=null);b.refresh&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.refreshicon+"'></span>"+b.refreshtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.refreshtitle||"",id:"refresh_"+w}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&
b.beforeRefresh();l.p.search=!1;try{var c=l.p.id;l.p.postData.filters="";a("#fbox_"+c).jqFilter("resetFilter");a.isFunction(l.clearToolbar)&&l.clearToolbar(!1)}catch(d){}switch(b.refreshstate){case "firstpage":a(l).trigger("reloadGrid",[{page:1}]);break;case "current":a(l).trigger("reloadGrid",[{current:!0}])}a.isFunction(b.afterRefresh)&&b.afterRefresh()}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),
q=null);q=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+q+";visibility:hidden;' ></div>");q=a(s).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(r+"_"+b.position,r).append(s);l.p._nvtd&&(q>l.p._nvtd[0]&&(a(r+"_"+b.position,r).width(q),l.p._nvtd[0]=q),l.p._nvtd[1]=q);s=q=q=null;this.nav=!0}}})},navButtonAdd:function(d,b){b=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",
onClickButton:null,position:"last",cursor:"pointer"},b||{});return this.each(function(){if(this.grid){0!==d.indexOf("#")&&(d="#"+d);var c=a(".navtable",d)[0],f=this;if(c&&(!b.id||null===a("#"+b.id,c).html())){var k=a("<td></td>");"NONE"==b.buttonicon.toString().toUpperCase()?a(k).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+b.caption+"</div>"):a(k).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+b.buttonicon+"'></span>"+b.caption+
"</div>");b.id&&a(k).attr("id",b.id);"first"==b.position?0===c.rows[0].cells.length?a("tr",c).append(k):a("tr td:eq(0)",c).before(k):a("tr",c).append(k);a(k,c).attr("title",b.title||"").click(function(c){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(f,c);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(d,b){b=a.extend({sepclass:"ui-separator",
sepcontent:""},b||{});return this.each(function(){if(this.grid){0!==d.indexOf("#")&&(d="#"+d);var c=a(".navtable",d)[0];if(c){var f="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+"'></span>"+b.sepcontent+"</td>";a("tr",c).append(f)}}})},GridToForm:function(d,b){return this.each(function(){if(this.grid){var c=a(this).jqGrid("getRowData",d);if(c)for(var f in c)a("[name="+a.jgrid.jqID(f)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(f)+"]",b).is("input:checkbox")?
a("[name="+a.jgrid.jqID(f)+"]",b).each(function(){a(this).val()==c[f]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+a.jgrid.jqID(f)+"]",b).val(c[f])}})},FormToGrid:function(d,b,c,f){return this.each(function(){if(this.grid){c||(c="set");f||(f="first");var k=a(b).serializeArray(),h={};a.each(k,function(a,b){h[b.name]=b.value});"add"==c?a(this).jqGrid("addRowData",d,h,f):"set"==c&&a(this).jqGrid("setRowData",d,h)}})}})})(jQuery);
(function(a){a.fn.jqFilter=function(d){if("string"===typeof d){var b=a.fn.jqFilter[d];if(!b)throw"jqFilter - No such method: "+d;var c=a.makeArray(arguments).slice(1);return b.apply(this,c)}var f=a.extend(!0,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:!1,errmsg:"",errorcheck:!0,showQuery:!0,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".split(" "),stropts:"eq ne bw bn ew en cn nc nu nn in ni".split(" "),_gridsopt:[],groupOps:["AND","OR"],groupButton:!0,ruleButtons:!0},d||{});return this.each(function(){if(!this.filter){this.p=f;if(null===this.p.filter||void 0===this.p.filter)this.p.filter={groupOp:this.p.groupOps[0],rules:[],
groups:[]};var b,c=this.p.columns.length,d,e=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(b=0;b<this.p._gridsopt.length;b++)this.p.ops[b].description=this.p._gridsopt[b];this.p.initFilter=a.extend(!0,{},this.p.filter);if(c){for(b=0;b<c;b++)d=this.p.columns[b],d.stype?d.inputtype=d.stype:d.inputtype||(d.inputtype="text"),d.sorttype?d.searchtype=d.sorttype:d.searchtype||(d.searchtype="string"),void 0===d.hidden&&(d.hidden=!1),d.label||(d.label=d.name),d.index&&(d.name=
d.index),d.hasOwnProperty("searchoptions")||(d.searchoptions={}),d.hasOwnProperty("searchrules")||(d.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 l=function(b,c){var d=[!0,""];if(a.isFunction(c.searchrules))d=c.searchrules(b,c);else if(a.jgrid&&a.jgrid.checkValues)try{d=a.jgrid.checkValues(b,-1,null,c.searchrules,c.label)}catch(e){}d&&
d.length&&!1===d[0]&&(f.error=!d[0],f.errmsg=d[1])};this.onchange=function(){this.p.error=!1;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):!1};this.reDraw=function(){a("table.group:first",this).remove();var b=this.createTableForGroup(f.filter,null);a(this).append(b);a.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};this.createTableForGroup=function(b,c){var d=this,e,g=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");
null===c&&a(g).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var h=a("<tr></tr>");a(g).append(h);var k=a("<th colspan='5' align='left'></th>");h.append(k);if(!0===this.p.ruleButtons){var l=a("<select class='opsel'></select>");k.append(l);var h="",x;for(e=0;e<f.groupOps.length;e++)x=b.groupOp===d.p.groupOps[e]?" selected='selected'":"",h+="<option value='"+d.p.groupOps[e]+"'"+x+">"+d.p.groupOps[e]+"</option>";l.append(h).bind("change",
function(){b.groupOp=a(l).val();d.onchange()})}h="<span></span>";this.p.groupButton&&(h=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),h.bind("click",function(){void 0===b.groups&&(b.groups=[]);b.groups.push({groupOp:f.groupOps[0],rules:[],groups:[]});d.reDraw();d.onchange();return!1}));k.append(h);if(!0===this.p.ruleButtons){var h=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),B;h.bind("click",function(){void 0===b.rules&&(b.rules=
[]);for(e=0;e<d.p.columns.length;e++){var a="undefined"===typeof d.p.columns[e].search?!0:d.p.columns[e].search,c=!0===d.p.columns[e].hidden;if(!0===d.p.columns[e].searchoptions.searchhidden&&a||a&&!c){B=d.p.columns[e];break}}b.rules.push({field:B.name,op:(B.searchoptions.sopt?B.searchoptions.sopt:d.p.sopt?d.p.sopt:"string"===B.searchtype?d.p.stropts:d.p.numopts)[0],data:""});d.reDraw();return!1});k.append(h)}null!==c&&(h=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),
k.append(h),h.bind("click",function(){for(e=0;e<c.groups.length;e++)if(c.groups[e]===b){c.groups.splice(e,1);break}d.reDraw();d.onchange();return!1}));if(void 0!==b.groups)for(e=0;e<b.groups.length;e++)k=a("<tr></tr>"),g.append(k),h=a("<td class='first'></td>"),k.append(h),h=a("<td colspan='4'></td>"),h.append(this.createTableForGroup(b.groups[e],b)),k.append(h);void 0===b.groupOp&&(b.groupOp=d.p.groupOps[0]);if(void 0!==b.rules)for(e=0;e<b.rules.length;e++)g.append(this.createTableRowForRule(b.rules[e],
b));return g};this.createTableRowForRule=function(b,c){var d=this,g=a("<tr></tr>"),h,k,l,u,x="",B;g.append("<td class='first'></td>");var A=a("<td class='columns'></td>");g.append(A);var z=a("<select></select>"),D,E=[];A.append(z);z.bind("change",function(){b.field=a(z).val();l=a(this).parents("tr:first");for(h=0;h<d.p.columns.length;h++)if(d.p.columns[h].name===b.field){u=d.p.columns[h];break}if(u){u.searchoptions.id=a.jgrid.randId();e&&"text"===u.inputtype&&!u.searchoptions.size&&(u.searchoptions.size=
10);var c=a.jgrid.createEl(u.inputtype,u.searchoptions,"",!0,d.p.ajaxSelectOptions,!0);a(c).addClass("input-elm");k=u.searchoptions.sopt?u.searchoptions.sopt:d.p.sopt?d.p.sopt:"string"===u.searchtype?d.p.stropts:d.p.numopts;var f="",g="";E=[];a.each(d.p.ops,function(){E.push(this.name)});for(h=0;h<k.length;h++)D=a.inArray(k[h],E),-1!==D&&(g="",0===h&&(b.op=d.p.ops[D].name,g=" selected='selected'"),f+="<option value='"+d.p.ops[D].name+"'"+g+">"+d.p.ops[D].description+"</option>");a(".selectopts",l).empty().append(f);
a(".data",l).empty().append(c);a(".input-elm",l).bind("change",function(){b.data=a(this).val();d.onchange()});setTimeout(function(){b.data=a(c).val();d.onchange()},0)}});for(h=A=0;h<d.p.columns.length;h++){B="undefined"===typeof d.p.columns[h].search?!0:d.p.columns[h].search;var I=!0===d.p.columns[h].hidden;if(!0===d.p.columns[h].searchoptions.searchhidden&&B||B&&!I)B="",b.field===d.p.columns[h].name&&(B=" selected='selected'",A=h),x+="<option value='"+d.p.columns[h].name+"'"+B+">"+d.p.columns[h].label+
"</option>"}z.append(x);x=a("<td class='operators'></td>");g.append(x);u=f.columns[A];u.searchoptions.id=a.jgrid.randId();e&&"text"===u.inputtype&&!u.searchoptions.size&&(u.searchoptions.size=10);var A=a.jgrid.createEl(u.inputtype,u.searchoptions,b.data,!0,d.p.ajaxSelectOptions,!0),F=a("<select class='selectopts'></select>");x.append(F);F.bind("change",function(){b.op=a(F).val();l=a(this).parents("tr:first");var c=a(".input-elm",l)[0];"nu"===b.op||"nn"===b.op?(b.data="",c.value="",c.setAttribute("readonly",
"true"),c.setAttribute("disabled","true")):(c.removeAttribute("readonly"),c.removeAttribute("disabled"));d.onchange()});k=u.searchoptions.sopt?u.searchoptions.sopt:d.p.sopt?d.p.sopt:"string"===u.searchtype?f.stropts:d.p.numopts;x="";a.each(d.p.ops,function(){E.push(this.name)});for(h=0;h<k.length;h++)D=a.inArray(k[h],E),-1!==D&&(B=b.op===d.p.ops[D].name?" selected='selected'":"",x+="<option value='"+d.p.ops[D].name+"'"+B+">"+d.p.ops[D].description+"</option>");F.append(x);x=a("<td class='data'></td>");
g.append(x);x.append(A);a(A).addClass("input-elm").bind("change",function(){b.data=a(this).val();d.onchange()});x=a("<td></td>");g.append(x);!0===this.p.ruleButtons&&(A=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"),x.append(A),A.bind("click",function(){for(h=0;h<c.rules.length;h++)if(c.rules[h]===b){c.rules.splice(h,1);break}d.reDraw();d.onchange();return!1}));return g};this.getStringForGroup=function(a){var b="(",c;if(void 0!==a.groups)for(c=0;c<a.groups.length;c++){1<
b.length&&(b+=" "+a.groupOp+" ");try{b+=this.getStringForGroup(a.groups[c])}catch(d){alert(d)}}if(void 0!==a.rules)try{for(c=0;c<a.rules.length;c++)1<b.length&&(b+=" "+a.groupOp+" "),b+=this.getStringForRule(a.rules[c])}catch(e){alert(e)}b+=")";return"()"===b?"":b};this.getStringForRule=function(b){var c="",d="",e,g;for(e=0;e<this.p.ops.length;e++)if(this.p.ops[e].name===b.op){c=this.p.ops[e].operator;d=this.p.ops[e].name;break}for(e=0;e<this.p.columns.length;e++)if(this.p.columns[e].name===b.field){g=
this.p.columns[e];break}e=b.data;if("bw"===d||"bn"===d)e+="%";if("ew"===d||"en"===d)e="%"+e;if("cn"===d||"nc"===d)e="%"+e+"%";if("in"===d||"ni"===d)e=" ("+e+")";f.errorcheck&&l(b.data,g);return-1!==a.inArray(g.searchtype,["int","integer","float","number","currency"])||"nn"===d||"nu"===d?b.field+" "+c+" "+e:b.field+" "+c+' "'+e+'"'};this.resetFilter=function(){this.p.filter=a.extend(!0,{},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(f.filter)};this.toString=function(){function a(c){var d="(",e;if(void 0!==c.groups)for(e=0;e<c.groups.length;e++)1<d.length&&(d+="OR"===c.groupOp?" || ":" && "),d+=a(c.groups[e]);if(void 0!==c.rules)for(e=0;e<c.rules.length;e++){1<d.length&&(d+="OR"===c.groupOp?" || ":" && ");var f=c.rules[e];if(b.p.errorcheck){for(var g=
void 0,h=void 0,g=0;g<b.p.columns.length;g++)if(b.p.columns[g].name===f.field){h=b.p.columns[g];break}h&&l(f.data,h)}d+=f.op+"(item."+f.field+",'"+f.data+"')"}d+=")";return"()"===d?"":d}var b=this;return a(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=!0}}})};a.extend(a.fn.jqFilter,{toSQLString:function(){var a="";this.each(function(){a=this.toUserFriendlyString()});return a},filterData:function(){var a;this.each(function(){a=this.p.filter});return a},getParameter:function(a){return void 0!==
a&&this.p.hasOwnProperty(a)?this.p[a]:this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(a){"string"===typeof a&&(a=jQuery.jgrid.parse(a));this.each(function(){this.p.filter=a;this.reDraw();this.onchange()})}})})(jQuery);
(function(a){a.jgrid.extend({editRow:function(d,b,c,f,k,h,g,e,l){var n={keys:b||!1,oneditfunc:c||null,successfunc:f||null,url:k||null,extraparam:h||{},aftersavefunc:g||null,errorfunc:e||null,afterrestorefunc:l||null,restoreAfterErorr:!0},p=a.makeArray(arguments).slice(1),q;q=p[0]&&"object"==typeof p[0]&&!a.isFunction(p[0])?a.extend(n,p[0]):n;return this.each(function(){var b=this,c,e,f=0,g=null,h={},k,n;b.grid&&(k=a(b).jqGrid("getInd",d,!0),!1===k||"0"!=(a(k).attr("editable")||"0")||a(k).hasClass("not-editable-row")||
(n=b.p.colModel,a("td",k).each(function(k){c=n[k].name;var l=!0===b.p.treeGrid&&c==b.p.ExpandColumn;if(l)e=a("span:first",this).html();else try{e=a.unformat(this,{rowId:d,colModel:n[k]},k)}catch(q){e=n[k].edittype&&"textarea"==n[k].edittype?a(this).text():a(this).html()}if("cb"!=c&&"subgrid"!=c&&"rn"!=c&&(b.p.autoencode&&(e=a.jgrid.htmlDecode(e)),h[c]=e,!0===n[k].editable)){null===g&&(g=k);l?a("span:first",this).html(""):a(this).html("");var p=a.extend({},n[k].editoptions||{},{id:d+"_"+c,name:c});
n[k].edittype||(n[k].edittype="text");if("&nbsp;"==e||"&#160;"==e||1==e.length&&160==e.charCodeAt(0))e="";p=a.jgrid.createEl(n[k].edittype,p,e,!0,a.extend({},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));a(p).addClass("editable");l?a("span:first",this).append(p):a(this).append(p);"select"==n[k].edittype&&!0===n[k].editoptions.multiple&&a.browser.msie&&a(p).width(a(p).width());f++}}),0<f&&(h.id=d,b.p.savedRow.push(h),a(k).attr("editable","1"),a("td:eq("+g+") input",k).focus(),!0===q.keys&&a(k).bind("keydown",
function(c){27===c.keyCode&&a(b).jqGrid("restoreRow",d,l);if(13===c.keyCode){if("TEXTAREA"==c.target.tagName)return!0;a(b).jqGrid("saveRow",d,q);return!1}c.stopPropagation()}),a.isFunction(q.oneditfunc)&&q.oneditfunc.call(b,d))))})},saveRow:function(d,b,c,f,k,h,g){var e={successfunc:b||null,url:c||null,extraparam:f||{},aftersavefunc:k||null,errorfunc:h||null,afterrestorefunc:g||null,restoreAfterErorr:!0},l=a.makeArray(arguments).slice(1),n;n=l[0]&&"object"==typeof l[0]&&!a.isFunction(l[0])?a.extend(e,
l[0]):e;var p=!1,q=this[0],s,r={},w={},v={},u,x,B;if(!q.grid)return p;B=a(q).jqGrid("getInd",d,!0);if(!1===B)return p;e=a(B).attr("editable");n.url=n.url?n.url:q.p.editurl;if("1"===e){var A;a("td",B).each(function(b){A=q.p.colModel[b];s=A.name;if("cb"!=s&&"subgrid"!=s&&!0===A.editable&&"rn"!=s&&!a(this).hasClass("not-editable-cell")){switch(A.edittype){case "checkbox":var c=["Yes","No"];A.editoptions&&(c=A.editoptions.value.split(":"));r[s]=a("input",this).attr("checked")?c[0]:c[1];break;case "text":case "password":case "textarea":case "button":r[s]=
a("input, textarea",this).val();break;case "select":if(A.editoptions.multiple){var c=a("select",this),d=[];r[s]=a(c).val();r[s]=r[s]?r[s].join(","):"";a("select > option:selected",this).each(function(b,c){d[b]=a(c).text()});w[s]=d.join(",")}else r[s]=a("select>option:selected",this).val(),w[s]=a("select>option:selected",this).text();A.formatter&&"select"==A.formatter&&(w={});break;case "custom":try{if(A.editoptions&&a.isFunction(A.editoptions.custom_value)){if(r[s]=A.editoptions.custom_value.call(q,
a(".customelement",this),"get"),void 0===r[s])throw"e2";}else throw"e1";}catch(e){"e1"==e&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose),"e2"==e?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,e.message,jQuery.jgrid.edit.bClose)}}x=a.jgrid.checkValues(r[s],b,q);if(!1===x[0])return x[1]=r[s]+" "+
x[1],!1;q.p.autoencode&&(r[s]=a.jgrid.htmlEncode(r[s]));"clientArray"!==n.url&&A.editoptions&&!0===A.editoptions.NullIfEmpty&&""==r[s]&&(v[s]="null")}});if(!1===x[0]){try{var z=a.jgrid.findPos(a("#"+a.jgrid.jqID(d),q.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,x[1],a.jgrid.edit.bClose,{left:z[0],top:z[1]})}catch(D){alert(x[1])}return p}r&&(e=q.p.prmNames,l=e.oper,z=e.id,r[l]=e.editoper,r[z]=d,"undefined"==typeof q.p.inlineData&&(q.p.inlineData={}),r=a.extend({},r,q.p.inlineData,n.extraparam));
if("clientArray"==n.url){r=a.extend({},r,w);q.p.autoencode&&a.each(r,function(b,c){r[b]=a.jgrid.htmlDecode(c)});z=a(q).jqGrid("setRowData",d,r);a(B).attr("editable","0");for(e=0;e<q.p.savedRow.length;e++)if(q.p.savedRow[e].id==d){u=e;break}0<=u&&q.p.savedRow.splice(u,1);a.isFunction(n.aftersavefunc)&&n.aftersavefunc.call(q,d,z);p=!0}else a("#lui_"+q.p.id).show(),v=a.extend({},r,v),a.ajax(a.extend({url:n.url,data:a.isFunction(q.p.serializeRowData)?q.p.serializeRowData.call(q,v):v,type:"POST",async:!1,
complete:function(b,c){a("#lui_"+q.p.id).hide();if("success"===c)if(!0===(a.isFunction(n.successfunc)?n.successfunc.call(q,b):!0)){q.p.autoencode&&a.each(r,function(b,c){r[b]=a.jgrid.htmlDecode(c)});r=a.extend({},r,w);a(q).jqGrid("setRowData",d,r);a(B).attr("editable","0");for(var e=0;e<q.p.savedRow.length;e++)if(q.p.savedRow[e].id==d){u=e;break}0<=u&&q.p.savedRow.splice(u,1);a.isFunction(n.aftersavefunc)&&n.aftersavefunc.call(q,d,b);p=!0}else a.isFunction(n.errorfunc)&&n.errorfunc.call(q,d,b,c),
!0===n.restoreAfterError&&a(q).jqGrid("restoreRow",d,n.afterrestorefunc)},error:function(b,c){a("#lui_"+q.p.id).hide();if(a.isFunction(n.errorfunc))n.errorfunc.call(q,d,b,c);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+b.responseText+"</div>",jQuery.jgrid.edit.bClose,{buttonalign:"right"})}catch(e){alert(b.responseText)}!0===n.restoreAfterError&&a(q).jqGrid("restoreRow",d,n.afterrestorefunc)}},a.jgrid.ajaxOptions,q.p.ajaxRowOptions||{}));a(B).unbind("keydown")}return p},
restoreRow:function(d,b){return this.each(function(){var c=this,f,k,h={};if(c.grid&&(k=a(c).jqGrid("getInd",d,!0),!1!==k)){for(var g=0;g<c.p.savedRow.length;g++)if(c.p.savedRow[g].id==d){f=g;break}if(0<=f){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(k.id)).datepicker("hide")}catch(e){}a.each(c.p.colModel,function(){!0===this.editable&&this.name in c.p.savedRow[f]&&!a(this).hasClass("not-editable-cell")&&(h[this.name]=c.p.savedRow[f][this.name])});a(c).jqGrid("setRowData",
d,h);a(k).attr("editable","0").unbind("keydown");c.p.savedRow.splice(f,1)}a.isFunction(b)&&b.call(c,d)}})}})})(jQuery);
(function(a){a.jgrid.extend({editCell:function(d,b,c){return this.each(function(){var f=this,k,h,g,e;if(f.grid&&!0===f.p.cellEdit){b=parseInt(b,10);f.p.selrow=f.rows[d].id;f.p.knv||a(f).jqGrid("GridNav");if(0<f.p.savedRow.length){if(!0===c&&d==f.p.iRow&&b==f.p.iCol)return;a(f).jqGrid("saveCell",f.p.savedRow[0].id,f.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+f.p.knv).attr("tabindex","-1").focus()},0);e=f.p.colModel[b];k=e.name;if("subgrid"!=k&&"cb"!=k&&"rn"!=k){g=a("td:eq("+b+")",f.rows[d]);
if(!0!==e.editable||!0!==c||g.hasClass("not-editable-cell"))0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")),g.addClass("edit-cell ui-state-highlight"),a(f.rows[d]).addClass("selected-row ui-state-hover"),a.isFunction(f.p.onSelectCell)&&(h=g.html().replace(/\&#160\;/ig,""),f.p.onSelectCell.call(f,f.rows[d].id,k,h,d,b));else{0<=parseInt(f.p.iCol,
10)&&0<=parseInt(f.p.iRow,10)&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));a(g).addClass("edit-cell ui-state-highlight");a(f.rows[d]).addClass("selected-row ui-state-hover");try{h=a.unformat(g,{rowId:f.rows[d].id,colModel:e},b)}catch(l){h=e.edittype&&"textarea"==e.edittype?a(g).text():a(g).html()}f.p.autoencode&&(h=a.jgrid.htmlDecode(h));e.edittype||(e.edittype="text");f.p.savedRow.push({id:d,
ic:b,name:k,v:h});if("&nbsp;"==h||"&#160;"==h||1==h.length&&160==h.charCodeAt(0))h="";if(a.isFunction(f.p.formatCell)){var n=f.p.formatCell.call(f,f.rows[d].id,k,h,d,b);void 0!==n&&(h=n)}var n=a.extend({},e.editoptions||{},{id:d+"_"+k,name:k}),p=a.jgrid.createEl(e.edittype,n,h,!0,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[d].id,k,h,d,b);a(g).html("").append(p).attr("tabindex","0");window.setTimeout(function(){a(p).focus()},
0);a("input, select, textarea",g).bind("keydown",function(c){27===c.keyCode&&(0<a("input.hasDatepicker",g).length?a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",d,b):a("input.hasDatepicker",g).datepicker("hide"):a(f).jqGrid("restoreCell",d,b));13===c.keyCode&&a(f).jqGrid("saveCell",d,b);if(9==c.keyCode){if(f.grid.hDiv.loading)return!1;c.shiftKey?a(f).jqGrid("prevCell",d,b):a(f).jqGrid("nextCell",d,b)}c.stopPropagation()});a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[d].id,
k,h,d,b)}f.p.iCol=b;f.p.iRow=d}}})},saveCell:function(d,b){return this.each(function(){var c=this,f;if(c.grid&&!0===c.p.cellEdit){f=1<=c.p.savedRow.length?0:null;if(null!==f){var k=a("td:eq("+b+")",c.rows[d]),h,g,e=c.p.colModel[b],l=e.name,n=a.jgrid.jqID(l);switch(e.edittype){case "select":if(e.editoptions.multiple){var n=a("#"+d+"_"+n,c.rows[d]),p=[];(h=a(n).val())?h.join(","):h="";a("option:selected",n).each(function(b,c){p[b]=a(c).text()});g=p.join(",")}else h=a("#"+d+"_"+n+">option:selected",
c.rows[d]).val(),g=a("#"+d+"_"+n+">option:selected",c.rows[d]).text();e.formatter&&(g=h);break;case "checkbox":var q=["Yes","No"];e.editoptions&&(q=e.editoptions.value.split(":"));g=h=a("#"+d+"_"+n,c.rows[d]).attr("checked")?q[0]:q[1];break;case "password":case "text":case "textarea":case "button":g=h=a("#"+d+"_"+n,c.rows[d]).val();break;case "custom":try{if(e.editoptions&&a.isFunction(e.editoptions.custom_value)){h=e.editoptions.custom_value.call(c,a(".customelement",k),"get");if(void 0===h)throw"e2";
g=h}else throw"e1";}catch(s){"e1"==s&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose),"e2"==s?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,s.message,jQuery.jgrid.edit.bClose)}}if(g!==c.p.savedRow[f].v){a.isFunction(c.p.beforeSaveCell)&&(f=c.p.beforeSaveCell.call(c,c.rows[d].id,l,h,d,b))&&(g=h=f);
var r=a.jgrid.checkValues(h,b,c);if(!0===r[0]){f={};a.isFunction(c.p.beforeSubmitCell)&&((f=c.p.beforeSubmitCell.call(c,c.rows[d].id,l,h,d,b))||(f={}));0<a("input.hasDatepicker",k).length&&a("input.hasDatepicker",k).datepicker("hide");if("remote"==c.p.cellsubmit)if(c.p.cellurl){var w={};c.p.autoencode&&(h=a.jgrid.htmlEncode(h));w[l]=h;q=c.p.prmNames;e=q.id;n=q.oper;w[e]=c.rows[d].id;w[n]=q.editoper;w=a.extend(f,w);a("#lui_"+c.p.id).show();c.grid.hDiv.loading=!0;a.ajax(a.extend({url:c.p.cellurl,data:a.isFunction(c.p.serializeCellData)?
c.p.serializeCellData.call(c,w):w,type:"POST",complete:function(e,f){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=!1;if("success"==f)if(a.isFunction(c.p.afterSubmitCell)){var n=c.p.afterSubmitCell.call(c,e,w.id,l,h,d,b);!0===n[0]?(a(k).empty(),a(c).jqGrid("setCell",c.rows[d].id,b,g,!1,!1,!0),a(k).addClass("dirty-cell"),a(c.rows[d]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[d].id,l,h,d,b),c.p.savedRow.splice(0,1)):(a.jgrid.info_dialog(a.jgrid.errors.errcap,
n[1],a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",d,b))}else a(k).empty(),a(c).jqGrid("setCell",c.rows[d].id,b,g,!1,!1,!0),a(k).addClass("dirty-cell"),a(c.rows[d]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[d].id,l,h,d,b),c.p.savedRow.splice(0,1)},error:function(e,f){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=!1;a.isFunction(c.p.errorCell)?c.p.errorCell.call(c,e,f):a.jgrid.info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+f,a.jgrid.edit.bClose);
a(c).jqGrid("restoreCell",d,b)}},a.jgrid.ajaxOptions,c.p.ajaxCellOptions||{}))}else try{a.jgrid.info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",d,b)}catch(v){}"clientArray"==c.p.cellsubmit&&(a(k).empty(),a(c).jqGrid("setCell",c.rows[d].id,b,g,!1,!1,!0),a(k).addClass("dirty-cell"),a(c.rows[d]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[d].id,l,h,d,b),c.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,
h+" "+r[1],a.jgrid.edit.bClose)},100),a(c).jqGrid("restoreCell",d,b)}catch(u){}}else a(c).jqGrid("restoreCell",d,b)}a.browser.opera?a("#"+c.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,b){return this.each(function(){var c=this,f;if(c.grid&&!0===c.p.cellEdit){f=1<=c.p.savedRow.length?0:null;if(null!==f){var k=a("td:eq("+b+")",c.rows[d]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",k).datepicker("hide")}catch(h){}a(k).empty().attr("tabindex",
"-1");a(c).jqGrid("setCell",c.rows[d].id,b,c.p.savedRow[f].v,!1,!1,!0);a.isFunction(c.p.afterRestoreCell)&&c.p.afterRestoreCell.call(c,c.rows[d].id,c.p.savedRow[f].v,d,b);c.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(d,b){return this.each(function(){var c=!1;if(this.grid&&!0===this.p.cellEdit){for(var f=b+1;f<this.p.colModel.length;f++)if(!0===this.p.colModel[f].editable){c=f;break}!1!==c?a(this).jqGrid("editCell",d,c,
!0):0<this.p.savedRow.length&&a(this).jqGrid("saveCell",d,b)}})},prevCell:function(d,b){return this.each(function(){var c=!1;if(this.grid&&!0===this.p.cellEdit){for(var f=b-1;0<=f;f--)if(!0===this.p.colModel[f].editable){c=f;break}!1!==c?a(this).jqGrid("editCell",d,c,!0):0<this.p.savedRow.length&&a(this).jqGrid("saveCell",d,b)}})},GridNav:function(){return this.each(function(){function d(b,d,f){if("v"==f.substr(0,1)){var h=a(c.grid.bDiv)[0].clientHeight,k=a(c.grid.bDiv)[0].scrollTop,q=c.rows[b].offsetTop+
c.rows[b].clientHeight,s=c.rows[b].offsetTop;"vd"==f&&q>=h&&(a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop+c.rows[b].clientHeight);"vu"==f&&s<k&&(a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop-c.rows[b].clientHeight)}"h"==f&&(f=a(c.grid.bDiv)[0].clientWidth,h=a(c.grid.bDiv)[0].scrollLeft,k=c.rows[b].cells[d].offsetLeft,c.rows[b].cells[d].offsetLeft+c.rows[b].cells[d].clientWidth>=f+parseInt(h,10)?a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft+c.rows[b].cells[d].clientWidth:
k<h&&(a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft-c.rows[b].cells[d].clientWidth))}function b(a,b){var d,f;if("lft"==b)for(d=a+1,f=a;0<=f;f--)if(!0!==c.p.colModel[f].hidden){d=f;break}if("rgt"==b)for(d=a-1,f=a;f<c.p.colModel.length;f++)if(!0!==c.p.colModel[f].hidden){d=f;break}return d}var c=this;if(c.grid&&!0===c.p.cellEdit){c.p.knv=c.p.id+"_kn";var f=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+
c.p.knv+"'></span></span>"),k,h;a(f).insertBefore(c.grid.cDiv);a("#"+c.p.knv).focus().keydown(function(f){h=f.keyCode;"rtl"==c.p.direction&&(37==h?h=39:39==h&&(h=37));switch(h){case 38:0<c.p.iRow-1&&(d(c.p.iRow-1,c.p.iCol,"vu"),a(c).jqGrid("editCell",c.p.iRow-1,c.p.iCol,!1));break;case 40:c.p.iRow+1<=c.rows.length-1&&(d(c.p.iRow+1,c.p.iCol,"vd"),a(c).jqGrid("editCell",c.p.iRow+1,c.p.iCol,!1));break;case 37:0<=c.p.iCol-1&&(k=b(c.p.iCol-1,"lft"),d(c.p.iRow,k,"h"),a(c).jqGrid("editCell",c.p.iRow,k,!1));
break;case 39:c.p.iCol+1<=c.p.colModel.length-1&&(k=b(c.p.iCol+1,"rgt"),d(c.p.iRow,k,"h"),a(c).jqGrid("editCell",c.p.iRow,k,!1));break;case 13:0<=parseInt(c.p.iCol,10)&&0<=parseInt(c.p.iRow,10)&&a(c).jqGrid("editCell",c.p.iRow,c.p.iCol,!0)}return!1})}})},getChangedCells:function(d){var b=[];d||(d="all");this.each(function(){var c=this,f;!c.grid||!0!==c.p.cellEdit||a(c.rows).each(function(k){var h={};a(this).hasClass("edited")&&(a("td",this).each(function(b){f=c.p.colModel[b].name;if("cb"!==f&&"subgrid"!==
f)if("dirty"==d){if(a(this).hasClass("dirty-cell"))try{h[f]=a.unformat(this,{rowId:c.rows[k].id,colModel:c.p.colModel[b]},b)}catch(e){h[f]=a.jgrid.htmlDecode(a(this).html())}}else try{h[f]=a.unformat(this,{rowId:c.rows[k].id,colModel:c.p.colModel[b]},b)}catch(l){h[f]=a.jgrid.htmlDecode(a(this).html())}}),h.id=this.id,b.push(h))})});return b}})})(jQuery);
(function(a){a.fn.jqm=function(c){var e={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:k,ajaxText:"",target:k,modal:k,toTop:k,onShow:k,onHide:k,onLoad:k};return this.each(function(){if(this._jqm)return b[this._jqm].c=a.extend({},b[this._jqm].c,c);d++;this._jqm=d;b[d]={c:a.extend(e,a.jqm.params,c),a:k,w:a(this).addClass("jqmID"+d),s:d};e.trigger&&a(this).jqmAddTrigger(e.trigger)})};a.fn.jqmAddClose=function(a){return n(this,a,"jqmHide")};a.fn.jqmAddTrigger=
function(a){return n(this,a,"jqmShow")};a.fn.jqmShow=function(b){return this.each(function(){a.jqm.open(this._jqm,b)})};a.fn.jqmHide=function(b){return this.each(function(){a.jqm.close(this._jqm,b)})};a.jqm={hash:{},open:function(d,g){var l=b[d],n=l.c,w="."+n.closeClass,v=parseInt(l.w.css("z-index")),v=0<v?v:3E3,u=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":v-1,opacity:n.overlay/100});if(l.a)return k;l.t=g;l.a=!0;l.w.css("z-index",v);n.modal?(c[0]||setTimeout(function(){e("bind")},
1),c.push(d)):0<n.overlay?n.closeoverlay&&l.w.jqmAddClose(u):u=k;l.o=u?u.addClass(n.overlayClass).prependTo("body"):k;if(f&&(a("html,body").css({height:"100%",width:"100%"}),u)){var u=u.css({position:"absolute"})[0],x;for(x in{Top:1,Left:1})u.style.setExpression(x.toLowerCase(),"(_=(document.documentElement.scroll"+x+" || document.body.scroll"+x+"))+'px'")}n.ajax?(v=n.target||l.w,u=n.ajax,v="string"==typeof v?a(v,l.w):a(v),u="@"==u.substr(0,1)?a(g).attr(u.substring(1)):u,v.html(n.ajaxText).load(u,
function(){n.onLoad&&n.onLoad.call(this,l);w&&l.w.jqmAddClose(a(w,l.w));h(l)})):w&&l.w.jqmAddClose(a(w,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();h(l);return k},close:function(d){d=b[d];if(!d.a)return k;d.a=k;c[0]&&(c.pop(),c[0]||e("unbind"));d.c.toTop&&d.o&&a("#jqmP"+d.w[0]._jqm).after(d.w).remove();if(d.c.onHide)d.c.onHide(d);else d.w.hide(),d.o&&d.o.remove();return k},params:{}};var d=0,b=a.jqm.hash,c=[],f=a.browser.msie&&
"6.0"==a.browser.version,k=!1,h=function(b){var c=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});f&&(b.o?b.o.html('<p style="width:100%;height:100%"/>').prepend(c):a("iframe.jqm",b.w)[0]||b.w.prepend(c));g(b)},g=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},e=function(b){a(document)[b]("keypress",l)[b]("keydown",l)[b]("mousedown",l)},l=function(d){var e=b[c[c.length-1]];(d=!a(d.target).parents(".jqmID"+e.s)[0])&&g(e);return!d},n=function(c,
d,e){return c.each(function(){var c=this._jqm;a(d).each(function(){this[e]||(this[e]=[],a(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var c in this[a])if(b[this[a][c]])b[this[a][c]].w[a](this);return k}));this[e].push(c)})})}})(jQuery);
(function(a){a.fn.jqDrag=function(a){return k(this,a,"d")};a.fn.jqResize=function(a,b){return k(this,a,"r",b)};a.jqDnR={dnr:{},e:0,drag:function(a){"d"==b.k?c.css({left:b.X+a.pageX-b.pX,top:b.Y+a.pageY-b.pY}):(c.css({width:Math.max(a.pageX-b.pX+b.W,0),height:Math.max(a.pageY-b.pY+b.H,0)}),M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)}));return!1},stop:function(){a(document).unbind("mousemove",d.drag).unbind("mouseup",d.stop)}};var d=a.jqDnR,b=d.dnr,c=d.e,f,
k=function(d,g,e,k){return d.each(function(){g=g?a(g,d):d;g.bind("mousedown",{e:d,k:e},function(d){var e=d.data,g={};c=e.e;f=k?a(k):!1;if("relative"!=c.css("position"))try{c.position(g)}catch(h){}b={X:g.left||parseInt(c.css("left"))||!1||0,Y:g.top||parseInt(c.css("top"))||!1||0,W:parseInt(c.css("width"))||!1||c[0].scrollWidth||0,H:parseInt(c.css("height"))||!1||c[0].scrollHeight||0,pX:d.pageX,pY:d.pageY,k:e.k};M1=f&&"d"!=e.k?{X:g.left||f1("left")||0,Y:g.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||
0,H:f[0].offsetHeight||f1("height")||0,pX:d.pageX,pY:d.pageY,k:e.k}:!1;if(a("input.hasDatepicker",c[0])[0])try{a("input.hasDatepicker",c[0]).datepicker("hide")}catch(r){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return!1})})};f1=function(a){return parseInt(f.css(a))||!1}})(jQuery);
(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var d;this.p.subGridOptions=a.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:!1,delayOnLoad:50,selectOnExpand:!1,reloadOnExpand:!0},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:!1,resizable:!1,hidedlg:!0,search:!1,fixed:!0});d=this.p.subGridModel;
if(d[0]){d[0].align=a.extend([],d[0].align||[]);for(var b=0;b<d[0].name.length;b++)d[0].align[b]=d[0].align[b]||"left"}})},addSubGridCell:function(a,b){var c="",f,k;this.each(function(){c=this.formatCol(a,b);k=this.p.id;f=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+k+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+c+"><a href='javascript:void(0);'><span class='ui-icon "+f+"'></span></a></td>"},addSubGrid:function(d,b){return this.each(function(){var c=this;if(c.grid){var f=
function(b,d,e){d=a("<td align='"+c.p.subGridModel[0].align[e]+"'></td>").html(d);a(b).append(d)},k=function(b,d){var e,g,h,k=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),l=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)e=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(e).html(c.p.subGridModel[0].name[g]),a(e).width(c.p.subGridModel[0].width[g]),a(l).append(e);a(k).append(l);b&&(h=c.p.xmlReader.subgrid,a(h.root+
" "+h.row,b).each(function(){l=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===h.repeatitems)a(h.cell,this).each(function(b){f(l,a(this).text()||"&#160;",b)});else{var b=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(b)for(g=0;g<b.length;g++)f(l,a(b[g],this).text()||"&#160;",g)}a(k).append(l)}));e=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+e+d).append(k);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},h=function(b,d){var e,g,h,k,l,n=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
q=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)e=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(e).html(c.p.subGridModel[0].name[g]),a(e).width(c.p.subGridModel[0].width[g]),a(q).append(e);a(n).append(q);if(b&&(k=c.p.jsonReader.subgrid,e=b[k.root],"undefined"!==typeof e))for(g=0;g<e.length;g++){h=e[g];q=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===k.repeatitems)for(k.cell&&(h=h[k.cell]),l=0;l<h.length;l++)f(q,h[l]||"&#160;",
l);else{var p=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(p.length)for(l=0;l<p.length;l++)f(q,h[p[l]]||"&#160;",l)}a(n).append(q)}g=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+g+d).append(n);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},g=function(b){var d,e,f,g;d=a(b).attr("id");e={nd_:(new Date).getTime()};e[c.p.prmNames.subgridid]=d;if(!c.p.subGridModel[0])return!1;if(c.p.subGridModel[0].params)for(g=0;g<c.p.subGridModel[0].params.length;g++)for(f=0;f<c.p.colModel.length;f++)c.p.colModel[f].name==
c.p.subGridModel[0].params[g]&&(e[c.p.colModel[f].name]=a("td:eq("+f+")",b).text().replace(/\&#160\;/ig,""));if(!c.grid.hDiv.loading)switch(c.grid.hDiv.loading=!0,a("#load_"+c.p.id).show(),c.p.subgridtype||(c.p.subgridtype=c.p.datatype),a.isFunction(c.p.subgridtype)?c.p.subgridtype.call(c,e):c.p.subgridtype=c.p.subgridtype.toLowerCase(),c.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:c.p.mtype,url:c.p.subGridUrl,dataType:c.p.subgridtype,data:a.isFunction(c.p.serializeSubGridData)?c.p.serializeSubGridData.call(c,
e):e,complete:function(b){"xml"==c.p.subgridtype?k(b.responseXML,d):h(a.jgrid.parse(b.responseText),d)}},a.jgrid.ajaxOptions,c.p.ajaxSubgridOptions||{}))}return!1},e,l,n,p=0,q,s;a.each(c.p.colModel,function(){!0!==this.hidden&&"rn"!=this.name&&"cb"!=this.name||p++});var r=c.rows.length,w=1;void 0!==b&&0<b&&(w=b,r=b+1);for(;w<r;)a(c.rows[w]).hasClass("jqgrow")&&a(c.rows[w].cells[d]).bind("click",function(){var b=a(this).parent("tr")[0];s=b.nextSibling;if(a(this).hasClass("sgcollapsed")){l=c.p.id;e=
b.id;if(!0===c.p.subGridOptions.reloadOnExpand||!1===c.p.subGridOptions.reloadOnExpand&&!a(s).hasClass("ui-subgrid")){n=1<=d?"<td colspan='"+d+"'>&#160;</td>":"";q=!0;a.isFunction(c.p.subGridBeforeExpand)&&(q=c.p.subGridBeforeExpand.call(c,l+"_"+e,e));if(!1===q)return!1;a(b).after("<tr role='row' class='ui-subgrid'>"+n+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+c.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(c.p.colNames.length-1-p,10)+"' class='ui-widget-content subgrid-data'><div id="+
l+"_"+e+" class='tablediv'></div></td></tr>");a.isFunction(c.p.subGridRowExpanded)?c.p.subGridRowExpanded.call(c,l+"_"+e,e):g(b)}else a(s).show();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");c.p.subGridOptions.selectOnExpand&&a(c).jqGrid("setSelection",e)}else if(a(this).hasClass("sgexpanded")){q=!0;a.isFunction(c.p.subGridRowColapsed)&&(e=b.id,q=c.p.subGridRowColapsed.call(c,l+"_"+
e,e));if(!1===q)return!1;!0===c.p.subGridOptions.reloadOnExpand?a(s).remove(".ui-subgrid"):a(s).hasClass("ui-subgrid")&&a(s).hide();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return!1}),!0===c.p.subGridOptions.expandOnLoad&&a(c.rows[w].cells[d]).trigger("click"),w++;c.subGridXml=function(a,b){k(a,b)};c.subGridJson=function(a,b){h(a,b)}}})},expandSubGridRow:function(d){return this.each(function(){if((this.grid||
d)&&!0===this.p.subGrid){var b=a(this).jqGrid("getInd",d,!0);b&&(b=a("td.sgcollapsed",b)[0])&&a(b).trigger("click")}})},collapseSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var b=a(this).jqGrid("getInd",d,!0);b&&(b=a("td.sgexpanded",b)[0])&&a(b).trigger("click")}})},toggleSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var b=a(this).jqGrid("getInd",d,!0);if(b){var c=a("td.sgcollapsed",b)[0];c?a(c).trigger("click"):
(c=a("td.sgexpanded",b)[0])&&a(c).trigger("click")}}})}})})(jQuery);
(function(a){a.jgrid.extend({groupingSetup:function(){return this.each(function(){var d=this.p.groupingView;if(null===d||"object"!==typeof d&&!a.isFunction(d))this.p.grouping=!1;else if(d.groupField.length){"undefined"==typeof d.visibiltyOnNextGrouping&&(d.visibiltyOnNextGrouping=[]);for(var b=0;b<d.groupField.length;b++)if(d.groupOrder[b]||(d.groupOrder[b]="asc"),d.groupText[b]||(d.groupText[b]="{0}"),"boolean"!=typeof d.groupColumnShow[b]&&(d.groupColumnShow[b]=!0),"boolean"!=typeof d.groupSummary[b]&&
(d.groupSummary[b]=!1),!0===d.groupColumnShow[b]?(d.visibiltyOnNextGrouping[b]=!0,a(this).jqGrid("showCol",d.groupField[b])):(d.visibiltyOnNextGrouping[b]=a("#"+this.p.id+"_"+d.groupField[b]).is(":visible"),a(this).jqGrid("hideCol",d.groupField[b])),d.sortitems[b]=[],d.sortnames[b]=[],d.summaryval[b]=[],d.groupSummary[b]){d.summary[b]=[];for(var c=this.p.colModel,f=0,k=c.length;f<k;f++)c[f].summaryType&&d.summary[b].push({nm:c[f].name,st:c[f].summaryType,v:""})}this.p.scroll=!1;this.p.rownumbers=
!1;this.p.subGrid=!1;this.p.treeGrid=!1;this.p.gridview=!0}else this.p.grouping=!1})},groupingPrepare:function(d,b,c,f){this.each(function(){b[0]+="";var k=b[0].toString().split(" ").join(""),h=this.p.groupingView,g=this;c.hasOwnProperty(k)?c[k].push(d):(c[k]=[],c[k].push(d),h.sortitems[0].push(k),h.sortnames[0].push(a.trim(b[0].toString())),h.summaryval[0][k]=a.extend(!0,[],h.summary[0]));h.groupSummary[0]&&a.each(h.summaryval[0][k],function(){this.v=a.isFunction(this.st)?this.st.call(g,this.v,this.nm,
f):a(g).jqGrid("groupingCalculations."+this.st,this.v,this.nm,f)})});return c},groupingToggle:function(d){this.each(function(){var b=this.p.groupingView,c=d.lastIndexOf("_"),f=d.substring(0,c+1),c=parseInt(d.substring(c+1),10)+1,k=b.minusicon,h=b.plusicon,g=a("#"+d)[0].nextSibling,e=a("#"+d+" span.tree-wrap-"+this.p.direction),l=!1;if(e.hasClass(k)){if(b.showSummaryOnHide&&b.groupSummary[0]){if(g)for(;g&&!a(g).hasClass("jqfoot");)a(g).hide(),g=g.nextSibling}else if(g)for(;g&&a(g).attr("id")!=f+String(c);)a(g).hide(),
g=g.nextSibling;e.removeClass(k).addClass(h);l=!0}else{if(g)for(;g&&a(g).attr("id")!=f+String(c);)a(g).show(),g=g.nextSibling;e.removeClass(h).addClass(k);l=!1}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,d,l)});return!1},groupingRender:function(d,b){return this.each(function(){var c=this,f=c.p.groupingView,k="",h="",g,e="",l,n,p;f.groupDataSorted||(f.sortitems[0].sort(),f.sortnames[0].sort(),"desc"==f.groupOrder[0].toLowerCase()&&(f.sortitems[0].reverse(),f.sortnames[0].reverse()));
e=f.groupCollapse?f.plusicon:f.minusicon;e+=" tree-wrap-"+c.p.direction;for(p=0;p<b;){if(c.p.colModel[p].name==f.groupField[0]){n=p;break}p++}a.each(f.sortitems[0],function(q,p){g=c.p.id+"ghead_"+q;h="<span style='cursor:pointer;' class='ui-icon "+e+"' onclick=\"jQuery('#"+c.p.id+"').jqGrid('groupingToggle','"+g+"');return false;\"></span>";try{l=c.formatter(g,f.sortnames[0][q],n,f.sortitems[0])}catch(r){l=f.sortnames[0][q]}k+='<tr id="'+g+'" role="row" class= "ui-widget-content jqgroup ui-row-'+
c.p.direction+'"><td colspan="'+b+'">'+h+a.jgrid.format(f.groupText[0],l,d[p].length)+"</td></tr>";for(var w=0;w<d[p].length;w++)k+=d[p][w].join("");if(f.groupSummary[0]){w="";f.groupCollapse&&!f.showSummaryOnHide&&(w=' style="display:none;"');k+="<tr"+w+' role="row" class="ui-widget-content jqfoot ui-row-'+c.p.direction+'">';for(var w=f.summaryval[0][p],v=c.p.colModel,u,x=d[p].length,B=0;B<b;B++){var A="<td "+c.formatCol(B,1,"")+">&#160;</td>",z="{0}";a.each(w,function(){if(this.nm==v[B].name){v[B].summaryTpl&&
(z=v[B].summaryTpl);"avg"==this.st&&this.v&&0<x&&(this.v/=x);try{u=c.formatter("",this.v,B,this)}catch(b){u=this.v}A="<td "+c.formatCol(B,1,"")+">"+a.jgrid.format(z,u)+"</td>";return!1}});k+=A}k+="</tr>"}});a("#"+c.p.id+" tbody:first").append(k);k=null})},groupingGroupBy:function(d,b){return this.each(function(){"string"==typeof d&&(d=[d]);var c=this.p.groupingView;this.p.grouping=!0;for(var f=0;f<c.groupField.length;f++)!c.groupColumnShow[f]&&c.visibiltyOnNextGrouping[f]&&a(this).jqGrid("showCol",
c.groupField[f]);for(f=0;f<d.length;f++)c.visibiltyOnNextGrouping[f]=a("#"+this.p.id+"_"+d[f]).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,b||{});c.groupField=d;a(this).trigger("reloadGrid")})},groupingRemove:function(d){return this.each(function(){"undefined"==typeof d&&(d=!0);this.p.grouping=!1;if(!0===d){for(var b=this.p.groupingView,c=0;c<b.groupField.length;c++)!b.groupColumnShow[c]&&b.visibiltyOnNextGrouping[c]&&a(this).jqGrid("showCol",b.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(a,b,c){return parseFloat(a||0)+parseFloat(c[b]||0)},min:function(a,b,c){return""===a?parseFloat(c[b]||0):Math.min(parseFloat(a),parseFloat(c[b]||0))},max:function(a,b,c){return""===a?parseFloat(c[b]||0):Math.max(parseFloat(a),parseFloat(c[b]||0))},count:function(a,b,c){""===a&&(a=0);return c.hasOwnProperty(b)?a+1:0},avg:function(a,
b,c){return parseFloat(a||0)+parseFloat(c[b]||0)}}})})(jQuery);
(function(a){a.jgrid.extend({setTreeNode:function(d,b){return this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)for(var f=c.p.expColInd,k=c.p.treeReader.expanded_field,h=c.p.treeReader.leaf_field,g=c.p.treeReader.level_field,e=c.p.treeReader.icon_field,l=c.p.treeReader.loaded,n,p,q,s;d<b;)s=c.p.data[c.p._index[c.rows[d].id]],"nested"!=c.p.treeGridModel||s[h]||(n=parseInt(s[c.p.treeReader.left_field],10),p=parseInt(s[c.p.treeReader.right_field],10),s[h]=p===n+1?"true":"false",c.rows[d].cells[c.p._treeleafpos].innerHTML=
s[h]),n=parseInt(s[g],10),0===c.p.tree_root_level?(q=n+1,p=n):(q=n,p=n-1),q="<div class='tree-wrap tree-wrap-"+c.p.direction+"' style='width:"+18*q+"px;'>",q+="<div style='"+("rtl"==c.p.direction?"right:":"left:")+18*p+"px;' class='ui-icon ",void 0!==s[l]&&(s[l]="true"==s[l]||!0===s[l]?!0:!1),"true"==s[h]||!0===s[h]?(q+=(void 0!==s[e]&&""!==s[e]?s[e]:c.p.treeIcons.leaf)+" tree-leaf treeclick'",s[h]=!0,p="leaf"):(s[h]=!1,p=""),s[k]=("true"==s[k]||!0===s[k]?!0:!1)&&s[l],q+=!0===s[k]?c.p.treeIcons.minus+
" tree-minus treeclick'":c.p.treeIcons.plus+" tree-plus treeclick'",q+="</div></div>",a(c.rows[d].cells[f]).wrapInner("<span class='cell-wrapper"+p+"'></span>").prepend(q),n!==parseInt(c.p.tree_root_level,10)&&((s=(s=a(c).jqGrid("getNodeParent",s))&&s.hasOwnProperty(k)?s[k]:!0)||a(c.rows[d]).css("display","none")),a(c.rows[d].cells[f]).find("div.treeclick").bind("click",function(b){b=a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id;b=c.p._index[b];c.p.data[b][h]||(c.p.data[b][k]?(a(c).jqGrid("collapseRow",
c.p.data[b]),a(c).jqGrid("collapseNode",c.p.data[b])):(a(c).jqGrid("expandRow",c.p.data[b]),a(c).jqGrid("expandNode",c.p.data[b])));return!1}),!0===c.p.ExpandColClick&&a(c.rows[d].cells[f]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(b){b=a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id;var d=c.p._index[b];c.p.data[d][h]||(c.p.data[d][k]?(a(c).jqGrid("collapseRow",c.p.data[d]),a(c).jqGrid("collapseNode",c.p.data[d])):(a(c).jqGrid("expandRow",c.p.data[d]),a(c).jqGrid("expandNode",
c.p.data[d])));a(c).jqGrid("setSelection",b);return!1}),d++})},setTreeGrid:function(){return this.each(function(){var d=this,b=0,c=!1,f,k,h=[];if(d.p.treeGrid){d.p.treedatatype||a.extend(d.p,{treedatatype:d.p.datatype});d.p.subGrid=!1;d.p.altRows=!1;d.p.pgbuttons=!1;d.p.pginput=!1;d.p.gridview=!0;d.p.multiselect=!1;d.p.rowList=[];d.p.expColInd=0;d.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+("rtl"==d.p.direction?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},d.p.treeIcons||{});
"nested"==d.p.treeGridModel?d.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},d.p.treeReader):"adjacency"==d.p.treeGridModel&&(d.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},d.p.treeReader));for(k in d.p.colModel)if(d.p.colModel.hasOwnProperty(k)){f=d.p.colModel[k].name;f!=d.p.ExpandColumn||
c||(c=!0,d.p.expColInd=b);b++;for(var g in d.p.treeReader)d.p.treeReader[g]==f&&h.push(f)}a.each(d.p.treeReader,function(c,f){f&&-1===a.inArray(f,h)&&("leaf_field"===c&&(d.p._treeleafpos=b),b++,d.p.colNames.push(f),d.p.colModel.push({name:f,width:1,hidden:!0,sortable:!1,resizable:!1,hidedlg:!0,editable:!0,search:!1}))})}})},expandRow:function(d){this.each(function(){var b=this;if(b.grid&&b.p.treeGrid){var c=a(b).jqGrid("getNodeChildren",d),f=b.p.treeReader.expanded_field;a(c).each(function(){var c=
a.jgrid.getAccessor(this,b.p.localReader.id);a("#"+c,b.grid.bDiv).css("display","");this[f]&&a(b).jqGrid("expandRow",this)})}})},collapseRow:function(d){this.each(function(){var b=this;if(b.grid&&b.p.treeGrid){var c=a(b).jqGrid("getNodeChildren",d),f=b.p.treeReader.expanded_field;a(c).each(function(){var c=a.jgrid.getAccessor(this,b.p.localReader.id);a("#"+c,b.grid.bDiv).css("display","none");this[f]&&a(b).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var d=[];this.each(function(){var b=
this;if(b.grid&&b.p.treeGrid)switch(b.p.treeGridModel){case "nested":var c=b.p.treeReader.level_field;a(b.p.data).each(function(){parseInt(this[c],10)===parseInt(b.p.tree_root_level,10)&&d.push(this)});break;case "adjacency":var f=b.p.treeReader.parent_id_field;a(b.p.data).each(function(){null!==this[f]&&"null"!=String(this[f]).toLowerCase()||d.push(this)})}});return d},getNodeDepth:function(d){var b=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":b=
parseInt(d[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":b=a(this).jqGrid("getNodeAncestors",d).length}});return b},getNodeParent:function(d){var b=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,k=this.p.treeReader.level_field,h=parseInt(d[c],10),g=parseInt(d[f],10),e=parseInt(d[k],10);a(this.p.data).each(function(){if(parseInt(this[k],
10)===e-1&&parseInt(this[c],10)<h&&parseInt(this[f],10)>g)return b=this,!1});break;case "adjacency":var l=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(){if(this[n]==d[l])return b=this,!1})}});return b},getNodeChildren:function(d){var b=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,k=this.p.treeReader.level_field,h=parseInt(d[c],10),g=parseInt(d[f],
10),e=parseInt(d[k],10);a(this.p.data).each(function(){parseInt(this[k],10)===e+1&&parseInt(this[c],10)>h&&parseInt(this[f],10)<g&&b.push(this)});break;case "adjacency":var l=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(){this[l]==d[n]&&b.push(this)})}});return b},getFullTreeNode:function(d){var b=[];this.each(function(){var c;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var f=this.p.treeReader.left_field,k=this.p.treeReader.right_field,
h=this.p.treeReader.level_field,g=parseInt(d[f],10),e=parseInt(d[k],10),l=parseInt(d[h],10);a(this.p.data).each(function(){parseInt(this[h],10)>=l&&parseInt(this[f],10)>=g&&parseInt(this[f],10)<=e&&b.push(this)});break;case "adjacency":if(d){b.push(d);var n=this.p.treeReader.parent_id_field,p=this.p.localReader.id;a(this.p.data).each(function(a){c=b.length;for(a=0;a<c;a++)if(b[a][p]==this[n]){b.push(this);break}})}}});return b},getNodeAncestors:function(d){var b=[];this.each(function(){if(this.grid&&
this.p.treeGrid)for(var c=a(this).jqGrid("getNodeParent",d);c;)b.push(c),c=a(this).jqGrid("getNodeParent",c)});return b},isVisibleNode:function(d){var b=!0;this.each(function(){if(this.grid&&this.p.treeGrid){var c=a(this).jqGrid("getNodeAncestors",d),f=this.p.treeReader.expanded_field;a(c).each(function(){b=b&&this[f];if(!b)return!1})}});return b},isNodeLoaded:function(d){var b;this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.leaf_field;b=void 0!==d?void 0!==d.loaded?d.loaded:
d[c]||0<a(this).jqGrid("getNodeChildren",d).length?!0:!1:!1}});return b},expandNode:function(d){return this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.expanded_field,c=this.p.treeReader.parent_id_field,f=this.p.treeReader.loaded,k=this.p.treeReader.level_field,h=this.p.treeReader.left_field,g=this.p.treeReader.right_field;if(!d[b]){var e=a.jgrid.getAccessor(d,this.p.localReader.id),l=a("#"+e,this.grid.bDiv)[0],n=this.p._index[e];a(this).jqGrid("isNodeLoaded",this.p.data[n])?
(d[b]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):(d[b]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=l.rowIndex,this.p.datatype=this.p.treedatatype,"nested"==this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:e,n_left:d[h],n_right:d[g],n_level:d[k]}}):a(this).jqGrid("setGridParam",{postData:{nodeid:e,parentid:d[c],
n_level:d[k]}}),a(this).trigger("reloadGrid"),d[f]=!0,"nested"==this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}}))}}})},collapseNode:function(d){return this.each(function(){if(this.grid&&this.p.treeGrid&&d.expanded){d.expanded=!1;var b=a.jgrid.getAccessor(d,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(d,b,c,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var k,h,g,e=[],l=this,n;k=a(this).jqGrid("getRootNodes");k=a.jgrid.from(k);k.orderBy(d,b,c,f);n=k.select();k=0;for(h=n.length;k<h;k++)g=n[k],e.push(g),a(this).jqGrid("collectChildrenSortTree",e,g,d,b,c,f);a.each(e,function(b){var c=a.jgrid.getAccessor(this,l.p.localReader.id);a("#"+l.p.id+" tbody tr:eq("+b+")").after(a("tr#"+c,l.grid.bDiv))});e=n=k=null}})},collectChildrenSortTree:function(d,b,
c,f,k,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,e,l,n;g=a(this).jqGrid("getNodeChildren",b);g=a.jgrid.from(g);g.orderBy(c,f,k,h);n=g.select();g=0;for(e=n.length;g<e;g++)l=n[g],d.push(l),a(this).jqGrid("collectChildrenSortTree",d,l,c,f,k,h)}})},setTreeRow:function(d,b){var c=!1;this.each(function(){this.grid&&this.p.treeGrid&&(c=a(this).jqGrid("setRowData",d,b))});return c},delTreeNode:function(d){return this.each(function(){var b=this.p.localReader.id,c=this.p.treeReader.left_field,
f=this.p.treeReader.right_field,k,h,g;if(this.grid&&this.p.treeGrid){var e=this.p._index[d];if(void 0!==e){k=parseInt(this.p.data[e][f],10);h=k-parseInt(this.p.data[e][c],10)+1;e=a(this).jqGrid("getFullTreeNode",this.p.data[e]);if(0<e.length)for(var l=0;l<e.length;l++)a(this).jqGrid("delRowData",e[l][b]);if("nested"===this.p.treeGridModel){b=a.jgrid.from(this.p.data).greater(c,k,{stype:"integer"}).select();if(b.length)for(g in b)b[g][c]=parseInt(b[g][c],10)-h;b=a.jgrid.from(this.p.data).greater(f,
k,{stype:"integer"}).select();if(b.length)for(g in b)b[g][f]=parseInt(b[g][f],10)-h}}}})},addChildNode:function(d,b,c){var f=this[0];if(c){var k=f.p.treeReader.expanded_field,h=f.p.treeReader.leaf_field,g=f.p.treeReader.level_field,e=f.p.treeReader.parent_id_field,l=f.p.treeReader.left_field,n=f.p.treeReader.right_field,p=f.p.treeReader.loaded,q,s,r,w,v;q=0;var u=b,x;if(!d){v=f.p.data.length-1;if(0<=v)for(;0<=v;)q=Math.max(q,parseInt(f.p.data[v][f.p.localReader.id],10)),v--;d=q+1}var B=a(f).jqGrid("getInd",
b);x=!1;void 0===b||null===b||""===b?(u=b=null,q="last",w=f.p.tree_root_level,v=f.p.data.length+1):(q="after",s=f.p._index[b],r=f.p.data[s],b=r[f.p.localReader.id],w=parseInt(r[g],10)+1,v=a(f).jqGrid("getFullTreeNode",r),v.length?(u=v[v.length-1][f.p.localReader.id],v=a(f).jqGrid("getInd",u)+1):v=a(f).jqGrid("getInd",b)+1,r[h]&&(x=!0,r[k]=!0,a(f.rows[B]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(f.p.treeIcons.leaf+
" tree-leaf").addClass(f.p.treeIcons.minus+" tree-minus"),f.p.data[s][h]=!1,r[p]=!0));s=v+1;c[k]=!1;c[p]=!0;c[g]=w;c[h]=!0;"adjacency"===f.p.treeGridModel&&(c[e]=b);if("nested"===f.p.treeGridModel){var A;if(null!==b){h=parseInt(r[n],10);g=a.jgrid.from(f.p.data);g=g.greaterOrEquals(n,h,{stype:"integer"});g=g.select();if(g.length)for(A in g)g[A][l]=g[A][l]>h?parseInt(g[A][l],10)+2:g[A][l],g[A][n]=g[A][n]>=h?parseInt(g[A][n],10)+2:g[A][n];c[l]=h;c[n]=h+1}else{h=parseInt(a(f).jqGrid("getCol",n,!1,"max"),
10);g=a.jgrid.from(f.p.data).greater(l,h,{stype:"integer"}).select();if(g.length)for(A in g)g[A][l]=parseInt(g[A][l],10)+2;g=a.jgrid.from(f.p.data).greater(n,h,{stype:"integer"}).select();if(g.length)for(A in g)g[A][n]=parseInt(g[A][n],10)+2;c[l]=h+1;c[n]=h+2}}if(null===b||a(f).jqGrid("isNodeLoaded",r)||x)a(f).jqGrid("addRowData",d,c,q,u),a(f).jqGrid("setTreeNode",v,s);r&&!r[k]&&a(f.rows[B]).find("div.treeclick").click()}}})})(jQuery);
(function(a){a.jgrid.extend({jqGridImport:function(d){d=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},d||{});return this.each(function(){var b=this,c=function(c,d){var e=a(d.xmlGrid.config,c)[0],f=a(d.xmlGrid.data,c)[0],k;if(xmlJsonClass.xml2json&&a.jgrid.parse){var e=xmlJsonClass.xml2json(e," "),e=a.jgrid.parse(e),p;for(p in e)e.hasOwnProperty(p)&&(k=e[p]);f?(f=e.grid.datatype,
e.grid.datatype="xmlstring",e.grid.datastr=c,a(b).jqGrid(k).jqGrid("setGridParam",{datatype:f})):a(b).jqGrid(k)}else alert("xml2json or parse are not present")},f=function(c,d){if(c&&"string"==typeof c){var e=a.jgrid.parse(c),f=e[d.jsonGrid.config];if(e=e[d.jsonGrid.data]){var k=f.datatype;f.datatype="jsonstring";f.datastr=e;a(b).jqGrid(f).jqGrid("setGridParam",{datatype:k})}else a(b).jqGrid(f)}};switch(d.imptype){case "xml":a.ajax(a.extend({url:d.impurl,type:d.mtype,data:d.impData,dataType:"xml",
complete:function(b,f){"success"==f&&(c(b.responseXML,d),a.isFunction(d.importComplete)&&d.importComplete(b))}},d.ajaxOptions));break;case "xmlstring":if(d.impstring&&"string"==typeof d.impstring){var k=a.jgrid.stringToDoc(d.impstring);k&&(c(k,d),a.isFunction(d.importComplete)&&d.importComplete(k),d.impstring=null);k=null}break;case "json":a.ajax(a.extend({url:d.impurl,type:d.mtype,data:d.impData,dataType:"json",complete:function(b,c){"success"==c&&(f(b.responseText,d),a.isFunction(d.importComplete)&&
d.importComplete(b))}},d.ajaxOptions));break;case "jsonstring":d.impstring&&"string"==typeof d.impstring&&(f(d.impstring,d),a.isFunction(d.importComplete)&&d.importComplete(d.impstring),d.impstring=null)}})},jqGridExport:function(d){d=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},d||{});var b=null;this.each(function(){if(this.grid){var c=a.extend({},a(this).jqGrid("getGridParam"));c.rownumbers&&(c.colNames.splice(0,1),c.colModel.splice(0,1));c.multiselect&&(c.colNames.splice(0,1),c.colModel.splice(0,
1));c.subGrid&&(c.colNames.splice(0,1),c.colModel.splice(0,1));c.knv=null;if(c.treeGrid)for(var f in c.treeReader)c.treeReader.hasOwnProperty(f)&&(c.colNames.splice(c.colNames.length-1),c.colModel.splice(c.colModel.length-1));switch(d.exptype){case "xmlstring":b="<"+d.root+">"+xmlJsonClass.json2xml(c,d.ident)+"</"+d.root+">";break;case "jsonstring":b="{"+xmlJsonClass.toJson(c,d.root,d.ident,!1)+"}",void 0!==c.postData.filters&&(b=b.replace(/filters":"/,'filters":'),b=b.replace(/}]}"/,"}]}"))}}});
return b},excelExport:function(d){d=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},d||{});return this.each(function(){if(this.grid){var b;"remote"==d.exptype&&(b=a.extend({},this.p.postData),b[d.oper]=d.tag,b=jQuery.param(b),b=-1!=d.url.indexOf("?")?d.url+"&"+b:d.url+"?"+b,window.location=b)}})}})})(jQuery);
var xmlJsonClass={xml2json:function(a,d){9===a.nodeType&&(a=a.documentElement);var b=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+d+(d?b.replace(/\t/g,d):b.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,d){var b=function(a,c,d){var e="",f,n;if(a instanceof Array)if(0===a.length)e+=d+"<"+c+">__EMPTY_ARRAY_</"+c+">\n";else for(f=0,n=a.length;f<n;f+=1)var p=d+b(a[f],c,d+"\t")+"\n",e=e+p;else if("object"===typeof a){f=!1;e+=d+"<"+c;for(n in a)a.hasOwnProperty(n)&&("@"===
n.charAt(0)?e+=" "+n.substr(1)+'="'+a[n].toString()+'"':f=!0);e+=f?">":"/>";if(f){for(n in a)a.hasOwnProperty(n)&&("#text"===n?e+=a[n]:"#cdata"===n?e+="<![CDATA["+a[n]+"]]\x3e":"@"!==n.charAt(0)&&(e+=b(a[n],n,d+"\t")));e+=("\n"===e.charAt(e.length-1)?d:"")+"</"+c+">"}}else e+="function"===typeof a?d+"<"+c+"><![CDATA["+a+"]]\x3e</"+c+">":'""'===a.toString()||0===a.toString().length?d+"<"+c+">__EMPTY_STRING_</"+c+">":d+"<"+c+">"+a.toString()+"</"+c+">";return e},c="",f;for(f in a)a.hasOwnProperty(f)&&
(c+=b(a[f],f,""));return d?c.replace(/\t/g,d):c.replace(/\t|\n/g,"")},toObj:function(a){var d={},b=/function/i;if(1===a.nodeType){if(a.attributes.length){var c;for(c=0;c<a.attributes.length;c+=1)d["@"+a.attributes[c].nodeName]=(a.attributes[c].nodeValue||"").toString()}if(a.firstChild){var f=c=0,k=!1,h;for(h=a.firstChild;h;h=h.nextSibling)1===h.nodeType?k=!0:3===h.nodeType&&h.nodeValue.match(/[^ \f\n\r\t\v]/)?c+=1:4===h.nodeType&&(f+=1);if(k)if(2>c&&2>f)for(this.removeWhite(a),h=a.firstChild;h;h=
h.nextSibling)3===h.nodeType?d["#text"]=this.escape(h.nodeValue):4===h.nodeType?b.test(h.nodeValue)?d[h.nodeName]=[d[h.nodeName],h.nodeValue]:d["#cdata"]=this.escape(h.nodeValue):d[h.nodeName]?d[h.nodeName]instanceof Array?d[h.nodeName][d[h.nodeName].length]=this.toObj(h):d[h.nodeName]=[d[h.nodeName],this.toObj(h)]:d[h.nodeName]=this.toObj(h);else a.attributes.length?d["#text"]=this.escape(this.innerXml(a)):d=this.escape(this.innerXml(a));else if(c)a.attributes.length?d["#text"]=this.escape(this.innerXml(a)):
(d=this.escape(this.innerXml(a)),"__EMPTY_ARRAY_"===d?d="[]":"__EMPTY_STRING_"===d&&(d=""));else if(f)if(1<f)d=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(b.test(a.firstChild.nodeValue)){d=a.firstChild.nodeValue;break}else d["#cdata"]=this.escape(h.nodeValue)}a.attributes.length||a.firstChild||(d=null)}else 9===a.nodeType?d=this.toObj(a.documentElement):alert("unhandled node type: "+a.nodeType);return d},toJson:function(a,d,b,c){void 0===c&&(c=!0);var f=d?'"'+d+'"':
"",k="\t",h="\n";c||(h=k="");if("[]"===a)f+=d?":[]":"[]";else if(a instanceof Array){var g,e,l=[];e=0;for(g=a.length;e<g;e+=1)l[e]=this.toJson(a[e],"",b+k,c);f+=(d?":[":"[")+(1<l.length?h+b+k+l.join(","+h+b+k)+h+b:l.join(""))+"]"}else if(null===a)f+=(d&&":")+"null";else if("object"===typeof a){g=[];for(e in a)a.hasOwnProperty(e)&&(g[g.length]=this.toJson(a[e],e,b+k,c));f+=(d?":{":"{")+(1<g.length?h+b+k+g.join(","+h+b+k)+h+b:g.join(""))+"}"}else f+="string"===typeof a?(d&&":")+'"'+a.replace(/\\/g,
"\\\\").replace(/\"/g,'\\"')+'"':(d&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var d="";if("innerHTML"in a)d=a.innerHTML;else{var b=function(a){var d="",k;if(1===a.nodeType){d+="<"+a.nodeName;for(k=0;k<a.attributes.length;k+=1)d+=" "+a.attributes[k].nodeName+'="'+(a.attributes[k].nodeValue||"").toString()+'"';if(a.firstChild){d+=">";for(k=a.firstChild;k;k=k.nextSibling)d+=b(k);d+="</"+a.nodeName+">"}else d+="/>"}else 3===a.nodeType?d+=a.nodeValue:4===a.nodeType&&(d+="<![CDATA["+a.nodeValue+
"]]\x3e");return d};for(a=a.firstChild;a;a=a.nextSibling)d+=b(a)}return d},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var d;for(d=a.firstChild;d;)if(3===d.nodeType)if(d.nodeValue.match(/[^ \f\n\r\t\v]/))d=d.nextSibling;else{var b=d.nextSibling;a.removeChild(d);d=b}else 1===d.nodeType&&this.removeWhite(d),d=d.nextSibling;return a}};
function tableToGrid(a,d){jQuery(a).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),c=jQuery("input[type=checkbox]:first",jQuery(this)),f=jQuery("input[type=radio]:first",jQuery(this)),c=0<c.length,f=!c&&0<f.length,k=c||f,h=[],g=[];jQuery("th",jQuery(this)).each(function(){0===h.length&&k?(h.push({name:"__selection__",index:"__selection__",width:0,hidden:!0}),g.push("__selection__")):(h.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}),g.push(jQuery(this).html()))});var e=[],l=[],n=[];jQuery("tbody > tr",jQuery(this)).each(function(){var a={},b=0;jQuery("td",jQuery(this)).each(function(){if(0===b&&k){var c=jQuery("input",jQuery(this)),d=c.attr("value");l.push(d||e.length);c.attr("checked")&&n.push(d);a[h[b].name]=c.attr("value")}else a[h[b].name]=jQuery(this).html();b++});0<b&&e.push(a)});
jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:g,colModel:h,multiselect:c},d||{}));for(a=0;a<e.length;a++)f=null,0<l.length&&(f=l[a])&&f.replace&&(f=encodeURIComponent(f).replace(/[.\-%]/g,"_")),null===f&&(f=a+1),jQuery(this).jqGrid("addRowData",f,e[a]);for(a=0;a<n.length;a++)jQuery(this).jqGrid("setSelection",n[a])}})}
(function(a){a.browser.msie&&8==a.browser.version&&(a.expr[":"].hidden=function(a){return 0===a.offsetWidth||0===a.offsetHeight||"none"==a.style.display});a.jgrid._multiselect=!1;if(a.ui&&a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var d=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,c){var f=d.call(this,b,c);if(c&&this.selectedList){var k=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(k)})}return f}}a.ui.multiselect.prototype.destroy&&
(a.ui.multiselect.prototype.destroy=function(){this.element.show();this.container.remove();void 0===a.Widget?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)});a.jgrid._multiselect=!0}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function c(){d.p.disableClick=!0}var d=this,k=d.p.id,k={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+k+"_cb,#jqgh_"+k+"_rn,#jqgh_"+k+"_subgrid),:hidden)",placeholder:{element:function(b){return a(document.createElement(b[0].nodeName)).addClass(b[0].className+
" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(a,b){b.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10));b.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||0,10))}},update:function(b,c){var h=a(c.item).parent(),h=a(">th",h),k={},p=d.p.id+"_";a.each(d.p.colModel,function(a){k[this.name]=
a});var q=[];h.each(function(){var b=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(p,"");b in k&&q.push(k[b])});a(d).jqGrid("remapColumns",q,!0,!0);a.isFunction(d.p.sortable.update)&&d.p.sortable.update(q);setTimeout(function(){d.p.disableClick=!1},50)}};d.p.sortable.options?a.extend(k,d.p.sortable.options):a.isFunction(d.p.sortable)&&(d.p.sortable={update:d.p.sortable});if(k.start){var h=k.start;k.start=function(a,b){c();h.call(this,a,b)}}else k.start=c;d.p.sortable.exclude&&(k.items+=":not("+
d.p.sortable.exclude+")");b.sortable(k).data("sortable").floating=!0})},columnChooser:function(b){function c(b,c){b&&("string"==typeof b?a.fn[b]&&a.fn[b].apply(c,a.makeArray(arguments).slice(2)):a.isFunction(b)&&b.apply(c,a.makeArray(arguments).slice(2)))}var d=this;if(!a("#colchooser_"+d[0].p.id).length){var k=a('<div id="colchooser_'+d[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),h=a("select",k);b=a.extend({width:420,height:240,classname:null,
done:function(a){a&&d.jqGrid("remapColumns",a,!0)},msel:"multiselect",dlog:"dialog",dlog_opts:function(a){var b={};b[a.bSubmit]=function(){a.apply_perm();a.cleanup(!1)};b[a.bCancel]=function(){a.cleanup(!0)};return{buttons:b,close:function(){a.cleanup(!0)},modal:a.modal?a.modal:!1,resizable:a.resizable?a.resizable:!0,width:a.width+20}},apply_perm:function(){a("option",h).each(function(){this.selected?d.jqGrid("showCol",g[this.value].name):d.jqGrid("hideCol",g[this.value].name)});var c=[];a("option[selected]",
h).each(function(){c.push(parseInt(this.value,10))});a.each(c,function(){delete l[g[parseInt(this,10)].name]});a.each(l,function(){var a=parseInt(this,10),b=c,d=a;if(0<=d){var e=b.slice(),f=e.splice(d,Math.max(b.length-d,d));d>b.length&&(d=b.length);e[d]=a;c=e.concat(f)}else c=void 0});b.done&&b.done.call(d,c)},cleanup:function(a){c(b.dlog,k,"destroy");c(b.msel,h,"destroy");k.remove();a&&b.done&&b.done.call(d)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui&&a.ui.multiselect&&"multiselect"==b.msel){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&&k.attr("title",b.caption);b.classname&&(k.addClass(b.classname),h.addClass(b.classname));b.width&&(a(">div",k).css({width:b.width,margin:"0 auto"}),h.css("width",b.width));b.height&&(a(">div",k).css("height",b.height),h.css("height",b.height-10));var g=d.jqGrid("getGridParam","colModel"),e=d.jqGrid("getGridParam","colNames"),l={},n=[];h.empty();a.each(g,function(a){l[this.name]=a;this.hidedlg?this.hidden||n.push(a):h.append("<option value='"+
a+"' "+(this.hidden?"":"selected='selected'")+">"+e[a]+"</option>")});var p=a.isFunction(b.dlog_opts)?b.dlog_opts.call(d,b):b.dlog_opts;c(b.dlog,k,p);p=a.isFunction(b.msel_opts)?b.msel_opts.call(d,b):b.msel_opts;c(b.msel,h,p)}},sortableRows:function(b){return this.each(function(){var c=this;c.grid&&!c.p.treeGrid&&a.fn.sortable&&(b=a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{}),b.start&&a.isFunction(b.start)?(b._start_=b.start,delete b.start):b._start_=!1,b.update&&a.isFunction(b.update)?
(b._update_=b.update,delete b.update):b._update_=!1,b.start=function(d,k){a(k.item).css("border-width","0px");a("td",k.item).each(function(a){this.style.width=c.grid.cols[a].style.width});if(c.p.subGrid){var h=a(k.item).attr("id");try{a(c).jqGrid("collapseSubGridRow",h)}catch(g){}}b._start_&&b._start_.apply(this,[d,k])},b.update=function(d,k){a(k.item).css("border-width","");!0===c.p.rownumbers&&a("td.jqgrid-rownum",c.rows).each(function(b){a(this).html(b+1)});b._update_&&b._update_.apply(this,[d,
k])},a("tbody:first",c).sortable(b),a("tbody:first",c).disableSelection())})},gridDnD:function(b){return this.each(function(){function c(){var b=a.data(d,"dnd");a("tr.jqgrow:not(.ui-draggable)",d).draggable(a.isFunction(b.drag)?b.drag.call(a(d),b):b.drag)}var d=this;if(d.grid&&!d.p.treeGrid&&a.fn.draggable&&a.fn.droppable)if(null===a("#jqgrid_dnd").html()&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),"string"==typeof b&&"updateDnD"==b&&!0===d.p.jqgdnd)c();else if(b=a.extend({drag:function(b){return a.extend({start:function(c,
e){if(d.p.subGrid){var k=a(e.helper).attr("id");try{a(d).jqGrid("collapseSubGridRow",k)}catch(n){}}for(k=0;k<a.data(d,"dnd").connectWith.length;k++)"0"==a(a.data(d,"dnd").connectWith[k]).jqGrid("getGridParam","reccount")&&a(a.data(d,"dnd").connectWith[k]).jqGrid("addRowData","jqg_empty_row",{});e.helper.addClass("ui-state-highlight");a("td",e.helper).each(function(a){this.style.width=d.grid.headers[a].width+"px"});b.onstart&&a.isFunction(b.onstart)&&b.onstart.call(a(d),c,e)},stop:function(c,e){if(e.helper.dropped){var k=
a(e.helper).attr("id");a(d).jqGrid("delRowData",k)}for(k=0;k<a.data(d,"dnd").connectWith.length;k++)a(a.data(d,"dnd").connectWith[k]).jqGrid("delRowData","jqg_empty_row");b.onstop&&a.isFunction(b.onstop)&&b.onstop.call(a(d),c,e)}},b.drag_opts||{})},drop:function(b){return a.extend({accept:function(b){if(!a(b).hasClass("jqgrow"))return b;var c=a(b).closest("table.ui-jqgrid-btable");return 0<c.length&&void 0!==a.data(c[0],"dnd")?(b=a.data(c[0],"dnd").connectWith,-1!=a.inArray("#"+this.id,b)?!0:!1):
b},drop:function(c,e){if(a(e.draggable).hasClass("jqgrow")){var k=a(e.draggable).attr("id"),k=e.draggable.parent().parent().jqGrid("getRowData",k);if(!b.dropbyname){var n=0,p={},q,s=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var r in k)k.hasOwnProperty(r)&&s[n]&&(q=s[n].name,p[q]=k[r]),n++;k=p}catch(w){}}e.helper.dropped=!0;b.beforedrop&&a.isFunction(b.beforedrop)&&(q=b.beforedrop.call(this,c,e,k,a("#"+d.id),a(this)),"undefined"!=typeof q&&null!==q&&"object"==typeof q&&(k=q));if(e.helper.dropped){var v;
b.autoid&&(a.isFunction(b.autoid)?v=b.autoid.call(this,k):(v=Math.ceil(1E3*Math.random()),v=b.autoidprefix+v));a("#"+this.id).jqGrid("addRowData",v,k,b.droppos)}b.ondrop&&a.isFunction(b.ondrop)&&b.ondrop.call(this,c,e,k)}}},b.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:5E3},dropbyname:!1,droppos:"first",autoid:!0,autoidprefix:"dnd_"},
b||{}),b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(b){return a.trim(b)});a.data(d,"dnd",b);"0"!=d.p.reccount&&!d.p.jqgdnd&&c();d.p.jqgdnd=!0;for(var k=0;k<b.connectWith.length;k++)a(b.connectWith[k]).droppable(a.isFunction(b.drop)?b.drop.call(a(d),b):b.drop)}})},gridResize:function(b){return this.each(function(){var c=this;c.grid&&a.fn.resizable&&(b=a.extend({},b||{}),b.alsoResize?(b._alsoResize_=b.alsoResize,delete b.alsoResize):b._alsoResize_=
!1,b.stop&&a.isFunction(b.stop)?(b._stop_=b.stop,delete b.stop):b._stop_=!1,b.stop=function(d,k){a(c).jqGrid("setGridParam",{height:a("#gview_"+c.p.id+" .ui-jqgrid-bdiv").height()});a(c).jqGrid("setGridWidth",k.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(c,d,k)},b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+c.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+c.p.id),delete b._alsoResize_,a("#gbox_"+c.p.id).resizable(b))})}})})(jQuery);
jQuery.extend(jQuery.jgrid.defaults,{rowNum:25,rowList:[10,25,50,"Tous"],rownumbers:!0,rownumWidth:20,viewrecords:!0,forceFit:!1,shrinkToFit:!0,autowidth:!0,height:"auto",search:!0,datatype:"json",ajaxGridOptions:{contentType:"application/json"},ajaxRowOptions:{contentType:"application/json",type:"PUT"},jsonReader:{root:"$resources",total:function(a){return Math.ceil(a.$totalResults/a.$itemsPerPage)},page:function(a){return Math.ceil(a.$startIndex/a.$itemsPerPage)},records:function(a){return a.$totalResults},
repeatitems:!1},prmNames:{rows:"count",page:"page",sort:"orderBy",order:"sord",nd:null},serializeGridData:function(a){a=$.extend({},a);if(a.filters){var d=eval("("+a.filters+")");void 0!=d&&(""!=d.rules&&(a.where=(a.where?a.where+" and ":"")+$(this).serializeSdataSearchFilters(a.filters)),delete a.filters,delete a.searchField,delete a.searchString,delete a.searchOper)}a.orderBy&&""!=a.orderBy?a.sord&&(a.orderBy+=" "+a.sord,delete a.sord):(delete a.orderBy,delete a.sord);delete a["null"];"Tous"==a.count&&
($(this).jqGrid("setGridParam",{rowNum:1E4}),a.count=1E4);isNaN(a.page)&&(a.page=1);a.startIndex=(a.page-1)*a.count+1;return a},serializeRowData:function(a){return JSON.stringify(a)},serializeEditData:function(a){return JSON.stringify(a)}});$.extend($.jgrid.edit,{ajaxEditOptions:{contentType:"application/json"},serializeEditData:function(a){return JSON.stringify(a)}});$.extend($.jgrid.del,{ajaxDelOptions:{contentType:"application/json"},mtype:"DELETE"});
$.jgrid.extend({serializeSdataSearchFilters:function(a){var d="";a=eval("("+a+")");for(var b=a.groupOp,c,f=0;f<a.rules.length;f++){0<f&&(d+=" "+b.toLowerCase()+" ");var k;c=$(this)[0].p.colModel;for(var h=0;h<c.length;h++)if(c[h].jsonmap==a.rules[f].field){k=c[h].formatter;break}c="date"==k?!0:!1;var h=a.rules[f].field,g=a.rules[f].data;"rolesPredefinis"==h&&(g="|"+g+"|");d+=$(this)[0].p.ignoreCase?"lower("+h+")":h;d+=" ";d+=$(this).serializeSdataSearchOp(a.rules[f].op,$(this)[0].p.ignoreCase?g.toLowerCase():
g,c)}return d},serializeSdataSearchOp:function(a,d,b){var c=!1;0<=d.indexOf("'")&&(c=!0);b?(b="@",d=Date.parse(d,"dd/mm/yy").toString("yyyy-MM-dd")):b=c?'"':"'";switch(a){case "eq":return"eq "+b+d+b;case "ne":return"ne "+b+d+b;case "lt":return"lt "+b+d+b;case "le":return"le "+b+d+b;case "gt":return"gt "+b+d+b;case "ge":return"ge "+b+d+b;case "in":return"in ("+b+d+b+")";case "ni":return"not in ("+b+d+b+")";case "cn":return"like "+b+"%"+d+"%"+b;case "nc":return"not like "+b+"%"+d+"%"+b;case "bw":return"like "+
b+"%"+d+"%"+b;case "bn":return"not like "+b+"%"+d+"%"+b;case "ew":return"like "+b+"%"+d+b;case "en":return"not like "+b+"%"+d+b}}});
jQuery(function(a){a.datepicker.regional.fr={closeText:"Fermer",prevText:"&#x3c;Pr\u00e9c",nextText:"Suiv&#x3e;",currentText:"Courant",monthNames:"Janvier F\u00e9vrier Mars Avril Mai Juin Juillet Ao\u00fbt Septembre Octobre Novembre D\u00e9cembre".split(" "),monthNamesShort:"Jan F\u00e9v Mar Avr Mai Jun Jul Ao\u00fb Sep Oct Nov D\u00e9c".split(" "),dayNames:"Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi".split(" "),dayNamesShort:"Dim Lun Mar Mer Jeu Ven Sam".split(" "),dayNamesMin:"Di Lu Ma Me Je Ve Sa".split(" "),
weekHeader:"Sm",dateFormat:"dd/mm/yy",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""};a.datepicker.setDefaults(a.datepicker.regional.fr)});var Mustache="undefined"!==typeof module&&module.exports||{};
(function(a){function d(a){return String(a).replace(/&(?!\w+;)|[<>"']/g,function(a){return B[a]||a})}function b(a,b,c,d){d=d||"<template>";for(var e=b.split("\n"),f=Math.max(c-3,0),g=Math.min(e.length,c+3),e=e.slice(f,g),h=0,k=e.length;h<k;++h)g=h+f+1,e[h]=(g===c?" >> ":"    ")+e[h];a.template=b;a.line=c;a.file=d;a.message=[d+":"+c,e.join("\n"),"",a.message].join("\n");return a}function c(a,b,c){if("."===a)return b[b.length-1];a=a.split(".");for(var d=a.length-1,e=a[d],f,g,h=b.length,k,l;h;){l=b.slice(0);
g=b[--h];for(k=0;k<d;){g=g[a[k++]];if(null==g)break;l.push(g)}if(g&&"object"===typeof g&&e in g){f=g[e];break}}"function"===typeof f&&(f=f.call(l[l.length-1]));return null==f?c:f}function f(a,b,d,f){var g="";a=c(a,b);if(f){if(null==a||!1===a||s(a)&&0===a.length)g+=d()}else if(s(a))r(a,function(a){b.push(a);g+=d();b.pop()});else if("object"===typeof a)b.push(a),g+=d(),b.pop();else if("function"===typeof a)var h=b[b.length-1],g=g+(a.call(h,d(),function(a){return e(a,h)})||"");else a&&(g+=d());return g}
function k(c,d){d=d||{};for(var e=d.tags||a.tags,f=e[0],g=e[e.length-1],h=['var buffer = "";',"\nvar line = 1;","\ntry {",'\nbuffer += "'],k=[],l=!1,n=!1,m=function(){if(!l||n||d.space)k=[];else for(;k.length;)h.splice(k.pop(),1);n=l=!1},p=[],q,r,s,u=function(a){e=v(a).split(/\s+/);r=e[0];s=e[e.length-1]},x=function(a){h.push('";',q,'\nvar partial = partials["'+v(a)+'"];',"\nif (partial) {","\n  buffer += render(partial,stack[stack.length - 1],partials);","\n}",'\nbuffer += "')},A=function(a,e){var f=
v(a);if(""===f)throw b(Error("Section name may not be empty"),c,G,d.file);p.push({name:f,inverted:e});h.push('";',q,'\nvar name = "'+f+'";',"\nvar callback = (function () {","\n  return function () {",'\n    var buffer = "";','\nbuffer += "')},B=function(a){A(a,!0)},X=function(a){a=v(a);var e=0!=p.length&&p[p.length-1].name;if(!e||a!=e)throw b(Error('Section named "'+a+'" was never opened'),c,G,d.file);a=p.pop();h.push('";',"\n    return buffer;","\n  };","\n})();");a.inverted?h.push("\nbuffer += renderSection(name,stack,callback,true);"):
h.push("\nbuffer += renderSection(name,stack,callback);");h.push('\nbuffer += "')},U=function(a){h.push('";',q,'\nbuffer += lookup("'+v(a)+'",stack,"");','\nbuffer += "')},P=function(a){h.push('";',q,'\nbuffer += escapeHTML(lookup("'+v(a)+'",stack,""));','\nbuffer += "')},G=1,K,Q,R=0,Z=c.length;R<Z;++R)if(c.slice(R,R+f.length)===f){R+=f.length;K=c.substr(R,1);q="\nline = "+G+";";r=f;s=g;l=!0;switch(K){case "!":R++;Q=null;break;case "=":R++;g="="+g;Q=u;break;case ">":R++;Q=x;break;case "#":R++;Q=A;
break;case "^":R++;Q=B;break;case "/":R++;Q=X;break;case "{":g="}"+g;case "&":R++;n=!0;Q=U;break;default:n=!0,Q=P}K=c.indexOf(g,R);if(-1===K)throw b(Error('Tag "'+f+'" was not closed properly'),c,G,d.file);f=c.substring(R,K);Q&&Q(f);for(Q=0;~(Q=f.indexOf("\n",Q));)G++,Q++;R=K+g.length-1;f=r;g=s}else switch(K=c.substr(R,1),K){case '"':case "\\":n=!0;h.push("\\"+K);break;case "\r":break;case "\n":k.push(h.length);h.push("\\n");m();G++;break;default:w.test(K)?k.push(h.length):n=!0,h.push(K)}if(0!=p.length)throw b(Error('Section "'+
p[p.length-1].name+'" was not closed properly'),c,G,d.file);m();h.push('";',"\nreturn buffer;","\n} catch (e) { throw {error: e, line: line}; }");g=h.join("").replace(/buffer \+= "";\n/g,"");d.debug&&("undefined"!=typeof console&&console.log?console.log(g):"function"===typeof print&&print(g));return g}function h(a,g){var h=k(a,g),l=new Function("view,partials,stack,lookup,escapeHTML,renderSection,render",h);return function(h,k){k=k||{};var n=[h];try{return l(h,k,n,c,d,f,e)}catch(p){throw b(p.error,
a,p.line,g.file);}}}function g(a,b){b=b||{};return!1!==b.cache?(A[a]||(A[a]=h(a,b)),A[a]):h(a,b)}function e(a,b,c){return g(a)(b,c)}a.name="mustache.js";a.version="0.5.0-dev";a.tags=["{{","}}"];a.parse=k;a.compile=g;a.render=e;a.clearCache=function(){A={}};a.to_html=function(a,b,c,d){a=e(a,b,c);if("function"===typeof d)d(a);else return a};var l=Object.prototype.toString,n=Array.isArray,p=Array.prototype.forEach,q=String.prototype.trim,s;s=n?n:function(a){return"[object Array]"===l.call(a)};var r;
r=p?function(a,b,c){return p.call(a,b,c)}:function(a,b,c){for(var d=0,e=a.length;d<e;++d)b.call(c,a[d],d,a)};var w=/^\s*$/,v;if(q)v=function(a){return null==a?"":q.call(a)};else{var u,x;w.test("\u00a0")?(u=/^\s+/,x=/\s+$/):(u=/^[\s\xA0]+/,x=/[\s\xA0]+$/);v=function(a){return null==a?"":String(a).replace(u,"").replace(x,"")}}var B={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},A={}})(Mustache);this.JSON||(this.JSON={});
(function(){function a(a){return 10>a?"0"+a:a}function d(a){f.lastIndex=0;return f.test(a)?'"'+a.replace(f,function(a){var b=g[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function b(a,c){var f,g,s,r,w=k,v,u=c[a];u&&"object"===typeof u&&"function"===typeof u.toJSON&&(u=u.toJSON(a));"function"===typeof e&&(u=e.call(c,a,u));switch(typeof u){case "string":return d(u);case "number":return isFinite(u)?String(u):"null";case "boolean":case "null":return String(u);
case "object":if(!u)return"null";k+=h;v=[];if("[object Array]"===Object.prototype.toString.apply(u)){r=u.length;for(f=0;f<r;f+=1)v[f]=b(f,u)||"null";s=0===v.length?"[]":k?"[\n"+k+v.join(",\n"+k)+"\n"+w+"]":"["+v.join(",")+"]";k=w;return s}if(e&&"object"===typeof e)for(r=e.length,f=0;f<r;f+=1)g=e[f],"string"===typeof g&&(s=b(g,u))&&v.push(d(g)+(k?": ":":")+s);else for(g in u)Object.hasOwnProperty.call(u,g)&&(s=b(g,u))&&v.push(d(g)+(k?": ":":")+s);s=0===v.length?"{}":k?"{\n"+k+v.join(",\n"+k)+"\n"+
w+"}":"{"+v.join(",")+"}";k=w;return s}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(b){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var c=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k,h,g={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,c,d){var f;h=k="";if("number"===typeof d)for(f=0;f<d;f+=1)h+=" ";else"string"===typeof d&&(h=d);if((e=c)&&"function"!==typeof c&&("object"!==typeof c||"number"!==typeof c.length))throw Error("JSON.stringify");return b("",{"":a})});
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function d(a,c){var e,f,g=a[c];if(g&&"object"===typeof g)for(e in g)Object.hasOwnProperty.call(g,e)&&(f=d(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,c,g)}var e;a=String(a);c.lastIndex=0;c.test(a)&&(a=a.replace(c,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?d({"":e},""):e;throw new SyntaxError("JSON.parse");})})();
(function(a){var d,b=function(){var a=document.createElement("input");return a.setAttribute("onpaste",""),"function"==typeof a.onpaste?"paste":"input"}()+".mask",c=navigator.userAgent,f=/iphone/i.test(c),k=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"};a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,
b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1E5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var e,l,n,p,q,s;return!c&&0<this.length?(e=a(this[0]),
e.data(a.mask.dataName)()):(g=a.extend({placeholder:a.mask.placeholder,completed:null},g),l=a.mask.definitions,n=[],p=s=c.length,q=null,a.each(c.split(""),function(a,b){"?"==b?(s--,p=a):l[b]?(n.push(RegExp(l[b])),null===q&&(q=n.length-1)):n.push(null)}),this.trigger("unmask").each(function(){function e(a){for(;s>++a&&!n[a];);return a}function w(a,b){var c,d;if(!(0>a)){c=a;for(d=e(b);s>c;c++)if(n[c]){if(!(s>d&&n[c].test(D[d])))break;D[c]=D[d];D[d]=g.placeholder;d=e(d)}B();z.caret(Math.max(q,a))}}function v(a){var b,
c,d=a.which;if(8===d||46===d||f&&127===d){b=z.caret();c=b.begin;b=b.end;if(0===b-c){if(46!==d)for(;0<=--c&&!n[c];);else c=b=e(c-1);b=46===d?e(b):b}x(c,b);w(c,b-1);a.preventDefault()}else 27==d&&(z.val(E),z.caret(0,A()),a.preventDefault())}function u(b){var c,d,f;d=b.which;c=z.caret();if(!(b.ctrlKey||b.altKey||b.metaKey||32>d||!d)){0!==c.end-c.begin&&(x(c.begin,c.end),w(c.begin,c.end-1));c=e(c.begin-1);if(s>c&&(d=String.fromCharCode(d),n[c].test(d))){var h,l,m;h=c;for(l=g.placeholder;s>h;h++)if(n[h]){if(f=
e(h),m=D[h],D[h]=l,!(s>f&&n[f].test(m)))break;l=m}D[c]=d;B();f=e(c);k?setTimeout(a.proxy(a.fn.caret,z,f),0):z.caret(f);g.completed&&f>=s&&g.completed.call(z)}b.preventDefault()}}function x(a,b){var c;for(c=a;b>c&&s>c;c++)n[c]&&(D[c]=g.placeholder)}function B(){z.val(D.join(""))}function A(a){var b,c,d=z.val(),e=-1;for(pos=b=0;s>b;b++)if(n[b]){for(D[b]=g.placeholder;pos++<d.length;)if(c=d.charAt(pos-1),n[b].test(c)){D[b]=c;e=b;break}if(pos>d.length)break}else D[b]===d.charAt(pos)&&b!==p&&(pos++,e=
b);return a?B():p>e+1?(z.val(""),x(0,s)):(B(),z.val(z.val().substring(0,e+1))),p?b:q}var z=a(this),D=a.map(c.split(""),function(a){return"?"!=a?l[a]?g.placeholder:a:void 0}),E=z.val();z.data(a.mask.dataName,function(){return a.map(D,function(a,b){return n[b]&&a!=g.placeholder?a:null}).join("")});z.attr("readonly")||z.one("unmask",function(){z.unbind(".mask").removeData(a.mask.dataName)}).bind("focus.mask",function(){clearTimeout(d);var a;E=z.val();a=A();d=setTimeout(function(){B();a==c.length?z.caret(0,
a):z.caret(a)},10)}).bind("blur.mask",function(){A();z.val()!=E&&z.change()}).bind("keydown.mask",v).bind("keypress.mask",u).bind(b,function(){setTimeout(function(){var a=A(!0);z.caret(a);g.completed&&a==z.val().length&&g.completed.call(z)},0)});A()}))}})})(jQuery);
function duplContact(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");1!=a.length?alert("Traitement impossible, il faut s\u00e9lectionner un seul contact..."):window.chrome.webview.hostObjects.sync.external&&(a=grilleContacts.jqGrid("getCell",a[0],"_id"),a=window.chrome.webview.hostObjects.sync.external.execCmd("dupliquerContactWeb",a),""!=a&&modifContact(a,!0,!1,!0),location.assign(location.href))}
function returnContact(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");1!=a.length?alert("Traitement impossible, il faut s\u00e9lectionner un seul contact..."):window.chrome.webview.hostObjects.sync.external&&(a=grilleContacts.jqGrid("getCell",a[0],"_id"),window.chrome.webview.hostObjects.sync.external.execCmd("modifierPersonneARolesWeb",a))}
function returnDossiers(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");if(1>a.length)alert("Traitement impossible, il faut s\u00e9lectionner au moins un dossier...");else{for(var d="",b=a.length-1;0<=b;b--)d+=grilleContacts.jqGrid("getCell",a[b],"_id")+",";alert(d)}}
function initListeDossiersPourVoirRoles(a){var d=null;$.ajax({url:"/mongo/Role?where=personne eq '"+a+"'&filters=idEtablissement&pageable=true",type:"GET",dataType:"json",username:urlParams.codeCollabo,password:urlParams.mdpCollabo,cache:!1,async:!1,success:function(a){d=a.$totalResults;lstDossiers=a.$resources},error:function(){alert("Erreur initListeDossiersPourVoirRoles")}});return d}
function voirRoles(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");if(1!=a.length)alert("Traitement impossible, il faut s\u00e9lectionner un seul contact...");else{var d=grilleContacts.jqGrid("getCell",a[0],"_id"),b=grilleContacts.jqGrid("getCell",a[0],"fullName"),a=grilleContacts.jqGrid("getCell",a[0],"raisonSociale");initListeDossiersPourVoirRoles("/mongo/Personne/"+d);$("#dialog-roles").dialog("option","idPersonne",d);ouvrirDialogueRoles();$("#dialog-roles").dialog({title:"R\u00f4les du contact "+
b+"("+a+")"});$("#dialog-roles").dialog("open")}}function voirUnRole(a){$("#dialog-roles").dialog("option","idPersonne",a);ouvrirDialogueRoles();$("#dialog-roles").dialog({title:"R\u00f4les du contact"});$("#dialog-roles").dialog("open")}
function ouvrirDialogueRoles(){initDicoDossiers();var a=$("#dialog-roles").dialog("option","idPersonne");urlRoles="../../../mongo/Role?where=personne eq '/mongo/Personne/"+a+"'&pageable=true";whereDefaultRoles="personne eq '/mongo/Personne/"+a+"'";$("#RolesGrid").jqGrid("clearGridData",!1);null!=whereDefaultRoles&&""!=whereDefaultRoles?$("#RolesGrid").jqGrid("setGridParam",{url:urlRoles,postData:{where:whereDefaultRoles},datatype:"json",page:1}).trigger("reloadGrid"):$("#RolesGrid").jqGrid("setGridParam",
{url:urlRoles,datatype:"json"}).trigger("reloadGrid");$("#RolesGrid").jqGrid({url:urlRoles,jsonReader:{},datatype:"json",rowNum:1E4,rownumbers:!1,colNames:["R\u00f4le","Nom Complet","Date","personneDossier"],colModel:[{name:"type",index:"type",width:200,sortable:!0},{name:"fullName",index:"fullName",width:200,sortable:!0},{name:"_historyDate",index:"_historyDate",width:150,sortable:!0},{name:"idEtablissement",index:"idEtablissement",width:200,hidden:!0,sortable:!0}],altRows:!0,autowidth:!1,shrinkToFit:!0,
autoheight:!0,gridview:!0,viewrecords:!1,sortname:"fullName",ignoreCase:!0,search:!1,loadonce:!0,gridComplete:function(){var a;a=$("#RolesGrid").getGridParam("records");$("#RolesGrid").jqGrid("setCaption","Liste des r\u00f4les ("+a+")");for(var b=$("#RolesGrid").getRowData(),c=0;c<=b.length;c++)a=jQuery("#RolesGrid").jqGrid("getCell",c,"idEtablissement"),$("#RolesGrid").jqGrid("setRowData",c,{fullName:dicoDossiers[a]})},ajaxGridOptions:{beforeSend:function(a,b){var c=urlParams.mdpCollabo;a.setRequestHeader("username",
urlParams.codeCollabo);a.setRequestHeader("password",c);a.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}},caption:"Liste des r\u00f4les"});$("#RolesGrid").jqGrid("navGrid","#pagerRoles",{view:!1,edit:!1,add:!1,del:!1,search:!1,refresh:!1},{},{},{},{multipleSearch:!1,multipleGroup:!1,showQuery:!1});$("#RolesGrid").jqGrid("filterToolbar",{searchOnEnter:!0,stringResult:!0,enableClear:!0,beforeSearch:function(){var a=$("#RolesGrid").jqGrid("getGridParam","postData");""!=whereDefaultRoles&&
(a.where=whereDefaultRoles);return!1},afterSearch:function(){var a=$("#RolesGrid").jqGrid("getGridParam","postData");a.where&&delete a.where}})}
function initDicoDossiers(){for(var a="guidDossierOuEtablissement in (",d=0;d<lstDossiers.length;d++)a+="'"+lstDossiers[d].idEtablissement+"'",d!=lstDossiers.length-1&&(a+=",");$.ajax({url:"/mongo/getDossiersDepuisGuids?filters=raisonSociale,guidDossierOuEtablissement,fullName,nomDossier",type:"POST",data:a+")",dataType:"json",contentType:"application/json; charset=utf-8",username:urlParams.codeCollabo,password:urlParams.mdpCollabo,cache:!1,async:!1,success:function(a){$.each(a,function(a,b){var d;
d=b.guidDossierOuEtablissement;null!=b.raisonSociale&&""!=b.raisonSociale?dicoDossiers[d]=b.raisonSociale:null!=b.fullName&&""!=b.fullName?dicoDossiers[d]=b.fullName:null!=b.nomDossier&&""!=b.nomDossier&&(dicoDossiers[d]=b.nomDossier)})}})}
function affectationDossiers(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");if(1!=a.length)alert("Traitement impossible, il faut s\u00e9lectionner un seul contact...");else{var d=grilleContacts.jqGrid("getCell",a[0],"rolesPredefinis");if(null==d||""==d||"|Dossier|"!=d&&"|Etablissement|"!=d&&"|Collaborateur|"!=d){var b=grilleContacts.jqGrid("getCell",a[0],"_id"),c=grilleContacts.jqGrid("getCell",a[0],"fullName"),a=grilleContacts.jqGrid("getCell",a[0],"raisonSociale");ouvrirDialogueDossier(d);
$("#dialog-form").dialog({title:"Affectation du contact "+c+"("+a+")"});$("#dialog-form").dialog("option","idPersonne",b);$("#dialog-form").dialog("open")}else alert("Il est impossible d'affecter un contact de type dossier, \u00e9tablissement ou collaborateur. Traitement annul\u00e9.")}}
function addContact(){window.chrome.webview.hostObjects.sync.external&&(0<whereDefault.length&&null!=whereDefault.toLowerCase().match("estuncontactsocial eq true")?window.chrome.webview.hostObjects.sync.external.execCmd("creerContactWeb","true"):window.chrome.webview.hostObjects.sync.external.execCmd("creerContactWeb",""))}
function editContact(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");1!=a.length?alert("Traitement impossible, il faut s\u00e9lectionner un seul contact..."):(a=grilleContacts.jqGrid("getCell",a[0],"_id"),modifContact(a,!0,!1,!0),location.assign(location.href))}
function modifContact(a,d,b,c){a="/html/contacts/show.html?req=/mongo/Personne/"+a+"&date="+urlParams.date+"&codeCollabo="+urlParams.codeCollabo+"&mdpCollabo="+urlParams.mdpCollabo;a=a+("&persEditable="+c)+("&aGE="+urlParams.aGE);null!=urlParams.reqRole&&(a+="&reqRole="+urlParams.reqRole,null!=urlParams.dateRole&&(a+="&dateRole="+urlParams.dateRole));!0==b&&(a+="&mode=create");"aLesDroitsCertificats"in urlParams&&"true"==urlParams.aLesDroitsCertificats&&(a+="&aLesDroitsCertificats=true");d?window.showModalDialog(encodeURI(a),
self,"resizable:yes;dialogWidth:800px;dialogHeight:800px;status:no;center:yes;titlebar=no;toolbar=no"):window.location.href=encodeURI(a)}function selectContact(a){window.chrome.webview.hostObjects.sync.external&&window.chrome.webview.hostObjects.sync.external.execCmd("getContactSelectionne",a)}function importCodeNaf(){try{window.chrome.webview.hostObjects.sync.external&&(window.chrome.webview.hostObjects.sync.external.execCmd("importCodeNafWeb"),location.assign(location.href))}catch(a){}}
function exportGridContacts(a,d,b){var c=jQuery("#ContactsGrid").jqGrid("getGridParam","url"),f=jQuery("#ContactsGrid").jqGrid("getGridParam","postData"),c=c.replace(RegExp("(/mongo/Personne)","g"),"/mongoExport/Personne/Personne.csv"),k=!1;null!=f.filters&&(k=!0,c+="&where="+jQuery("#ContactsGrid").serializeSdataSearchFilters(f.filters));""!=b&&(c=!0==k?c+(" and "+encodeURI(b)):c+("&where="+encodeURI(b)));f.orderBy&&""!=f.orderBy&&(c+="&orderBy="+f.orderBy+" "+f.sord);c+="&format=text/csv";b=jQuery("#ContactsGrid").jqGrid("getGridParam",
"colModel");null!=b&&(c+="&filters=",first=!0,$.each(b,function(a,b){first?b.hidden||"cb"==b.name||"nbUtil"==b.name||(first=!1,c+=b.name):b.hidden||"cb"==b.name||"nbUtil"==b.name||(c+=","+b.name)}));c+="&count="+f.count+"&startIndex="+((f.page-1)*f.count+1);$.ajax({url:document.getElementById("iframehidden").src=c,type:"GET",dataType:"text/csv",username:a,password:d,cache:!1,async:!1})}
function delContact(){$("#dialog-confirm").dialog({resizable:!1,height:200,width:400,modal:!0,title:"Suppression(s) de contact(s)",buttons:{OK:function(){try{for(var a=grilleContacts.jqGrid("getGridParam","selarrrow"),d=a.length-1;0<=d;d--){var b=grilleContacts.jqGrid("getCell",a[d],"_id");window.chrome.webview.hostObjects.sync.external&&window.chrome.webview.hostObjects.sync.external.execCmd("supprimerContactWeb",b)}location.assign(location.href)}catch(c){}},Annuler:function(){$(this).dialog("close")}},
open:function(){$(".ui-dialog-buttonpane button:eq(1)").focus()}})}
function fusContact(){var a=grilleContacts.jqGrid("getGridParam","selarrrow");$.each(a,function(d,b){$("#jqg_ContactsGrid_"+b).attr("checked")||(a=$.grep(a,function(a){return a!=b}))});2>a.length?alert("Traitement impossible, il faut s\u00e9lectionner au moins deux contacts pour faire une fusion..."):($("#dialog-confirm-fusion").html(""),$("#dialog-confirm-fusion").append("<p>Attention, la fusion des contacts s\u00e9lectionn\u00e9s est irr\u00e9versible. </p><p><BR>A la fin de ce traitement, vous pourrez modifier le contact fusionn\u00e9.</p><p><BR>Souhaitez-vous continuer?</p>"),$("#dialog-confirm-fusion").append("<p><br/><br/>Contacts concern\u00e9s :</p>"),
$.each(a,function(a,b){$("#dialog-confirm-fusion").append("<p><br/>- "+grilleContacts.getCell(b,"fullName")+"</p>")}),$("#dialog-confirm-fusion").dialog({resizable:!0,height:400,width:600,modal:!0,title:"Fusion de contacts",buttons:{OK:function(){var d="";try{for(var b="",c="",f,k,h,g=!1,e,l=!0,n=!0,p,q,s=a.length-1;0<=s;s--)f=grilleContacts.jqGrid("getCell",a[s],"estUnContactSocial"),k=grilleContacts.jqGrid("getCell",a[s],"rolesPredefinis"),l?(e=k,p=getEstExclusif(e),l=!1):(e!=k&&p&&(q=e,n=!1),p=
getEstExclusif(k)),h=0<=grilleContacts.jqGrid("getCell",a[s],"ref").indexOf("ui-icon ui-icon-star"),"true"!=f&&"|Dossier|"!=k?(h?c=grilleContacts.jqGrid("getCell",a[s],"_id"):d+=grilleContacts.jqGrid("getCell",a[s],"_id")+",",$("#"+a[s]).addClass("contactBarre")):g=!0,$("#jqg_ContactsGrid_"+a[s]).attr("disabled","disabled");n?g?alert("Il est impossible de fusionner des contacts dossier ou sociaux"):""!=c?(d+=c+",Ref",window.chrome.webview.hostObjects.sync.external&&(b=window.chrome.webview.hostObjects.sync.external.execCmd("fusionnerContactsWeb",
d)),""!=b&&modifContact(b,!0,!1,!0),grilleContacts.jqGrid("resetSelection")):alert("Il faut s\u00e9lectionner un contact de r\u00e9f\u00e9rence. Pour ce faire, cliquez sur la colonne R\u00e9f. du tableau."):alert("Vous voulez fusionner un contact ayant pour r\u00f4le exclusif "+q+" avec des contacts ayant  des r\u00f4les diff\u00e9rents.\n\nAction impossible : \nDans le cas de contact exclusif, il n'est possible de fusionner que des contacts ayant le m\u00eame r\u00f4le.\n\nListe des r\u00f4les exclusifs :\nAga, AGIRC, ARRCO, ASSEDIC, ASSEDICInter,\nASSUREUR, Banque, CCPBTP, CCVRP, Centre des imp\u00f4ts,\nCFE, Cga, CRPCEN, ENIM, Greffe,\nGROUPE, M\u00e9decine du travail, MSA, MUTUELLE, PREVOYANCE,\nRecette des imp\u00f4ts, Service de tiers d\u00e9clarants, Soci\u00e9t\u00e9 int\u00e9grante, URSSAF");
$(this).dialog("close")}catch(r){alert("Erreur : "+r+" - "+a+" - "+d)}},Annuler:function(){$(this).dialog("close")}},open:function(){$(".ui-dialog-buttonpane button:eq(1)").focus()}}))}function getEstExclusif(a){var d=!1;$.each(lstRoles,function(b,c){0<a.indexOf(c.libelle)&&(d=c.estExclusif)});return d}function getContacts(){lstContacts=[];if(""==requeteContacts||void 0==requeteContacts)requeteContacts="/mongo/Personne";var a=encodeURI(requeteContacts);refreshContacts(a)}
function refreshContacts(a){null!=whereDefault&&""!=whereDefault?grilleContacts.jqGrid("setGridParam",{url:a,postData:{where:whereDefault},datatype:"json",page:1}).trigger("reloadGrid"):grilleContacts.jqGrid("setGridParam",{url:a,datatype:"json",page:1}).trigger("reloadGrid");grilleContacts.jqGrid("filterToolbar",{stringResult:!0,defaultSearch:"cn",autosearch:!0})}
function MapReduceContact(a){var d={Collection:"Role"};d.Map="function() {var mark = {};var o = this;while(o != null){if (o.personne != null && o.personne == '"+a+'\'){if (mark[o.personne] != "1"){emit(o.personne, 1);mark[o.personne] = "1";}}o = o._old;}}';d.Reduce="function(k, values){var n = 0; var i; for (i = 0; i < values.length; i++) {n += values[i];}return n;}";d.TargetClass="MapReduce";JSONstring=JSON.stringify(d);$.ajax({url:"/mongoMapReduce",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",
username:urlParams.codeCollabo,password:urlParams.mdpCollabo,data:JSONstring,cache:!1,async:!1,success:function(a){$.each(a,function(a,b){1<=parseInt(b.value)&&(dicoContacts[b._id]=parseInt(b.value))})}})}
function MapReduce(a){JSONstring=JSON.stringify({Collection:"Role",Map:'function() {var mark = {};var o = this;while(o != null){if (o.personne != null){if (mark[o.personne] != "1"){emit(o.personne, 1);mark[o.personne] = "1";}}o = null;}}',Reduce:"function(k, values){var n = 0; var i; for (i = 0; i < values.length; i++) {n += values[i];}return n;}",TargetClass:"MapReduce"});$.ajax({url:"/mongoMapReduce",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",username:urlParams.codeCollabo,
password:urlParams.mdpCollabo,data:JSONstring,cache:!1,async:!1,success:function(a){$.each(a,function(a,c){1<=parseInt(c.value)&&(dicoContacts[c._id]=parseInt(c.value))})},error:function(){alert("Erreur")}})}
function getFormDescription(a,d,b,c,f,k,h,g){var e="",l=!1,n="",p=!1,q=urlParams.reqRole,s="tni"===c.toLowerCase();$.ajax({url:a,type:"GET",dataType:"json",username:c,password:f,cache:!1,async:!1,success:function(a){a.rolesPredefinis&&(e=a.rolesPredefinis);a.estGlobal&&(l=a.estGlobal);a.sharedId&&(n=a.sharedId);a.contactCertifie&&(p=!0==a.contactCertifie)}});void 0!=d&&$.ajax({url:d,type:"GET",dataType:"json",username:c,password:f,cache:!1,async:!1,success:function(a){a.type&&(e=a.type)}});b=!(l&&
""!=n)&&"r"!=myCrud;!g&&p&&(b=!1);l&&""!=n&&$("#modif").hide();"jissdo"==c&&"untrucquinaniqueuenitete"==f&&(b=!0);null!=e&&(a+="&roleParDefaut="+encodeURI(e.split("|").join("")));myForms=[];myForms.push({title:!0==k?"Contact":"Identification",type:"Personne",group:"Identification",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:"c"==myCrud},{title:!0==k?"Contact":"Adresse",type:"Personne",
group:"Adresse",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1},{title:!0==k?"Contact":"Communication",type:"Personne",group:"Communication",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1});if(e.toLowerCase().contains("recette des imp\u00f4ts")||"sie"==
e.toLowerCase()||"|sie|"==e.toLowerCase())myForms.push({title:!0==k?"Contact":"Service des imp\u00f4ts des entreprises",type:"Personne",lastPost:!0,group:"Service des imp\u00f4ts des entreprises",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"SIE",type:"Role",group:"Recette des Imp\u00f4ts",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",
getObject:d,postObject:d,editable:!0,open:!1});if(e.toLowerCase().contains("aga")||e.toLowerCase().contains("cga"))myForms.push({title:!0==k?"Contact":"AGA-CGA (non modifiable)",type:"Personne",group:"AGA-CGA",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"AGA-CGA",type:"Role",group:"AGA-CGA",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("allocations familiales")&&void 0!=d&&myForms.push({title:"Allocations familiales",type:"Role",group:"Allocations familiales",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("autre caisse ch\u00f4mage")&&void 0!=d&&myForms.push({title:"Autres caisses de ch\u00f4mage",
type:"Role",group:"Autres caisses de ch\u00f4mage",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});(e.toLowerCase().contains("commissaire aux comptes")||e.toLowerCase().contains("commissaire aux comptes suppl\u00e9ant"))&&void 0!=d&&myForms.push({title:"Commissaire aux comptes",type:"Role",group:"Commissaire aux comptes",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",
getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("maladie travailleur ind\u00e9pendant")&&void 0!=d&&myForms.push({title:"Maladie travailleur ind\u00e9pendant",type:"Role",group:"Maladie travailleur ind\u00e9pendant",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("m\u00e9decine du travail")&&(myForms.push({title:!0==k?"Contact":"M\u00e9decine du travail (non modifiable)",
type:"Personne",group:"M\u00e9decine du travail",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"M\u00e9decine du travail",type:"Role",group:"M\u00e9decine du travail",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("urssaf")&&
(myForms.push({title:!0==k?"Contact":"URSSAF (non modifiable)",type:"Personne",group:"URSSAF",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"URSSAF",type:"Role",group:"URSSAF",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));"assedic"==
e.toLowerCase()&&(myForms.push({title:!0==k?"Contact":"ASSEDIC (non modifiable)",type:"Personne",group:"ASSEDIC",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"ASSEDIC",type:"Role",group:"ASSEDIC",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,
open:!1}));e.toLowerCase().contains("assedicinter")&&myForms.push({title:!0==k?"Contact":"ASSEDICInter (non modifiable)",type:"Personne",group:"ASSEDICInter",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1});e.toLowerCase().contains("groupe")&&(myForms.push({title:!0==k?"Contact":"GROUPE (non modifiable)",type:"Personne",group:"GROUPE",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"GROUPE",type:"Role",group:"GROUPE",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("arrco")&&(myForms.push({title:!0==k?"Contact":"ARRCO (non modifiable)",type:"Personne",group:"ARRCO",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"ARRCO",type:"Role",group:"ARRCO",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("agirc")&&(myForms.push({title:!0==k?"Contact":"AGIRC (non modifiable)",type:"Personne",group:"AGIRC",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"AGIRC",type:"Role",group:"AGIRC",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("prevoyance")&&(myForms.push({title:!0==k?"Contact":"PREVOYANCE (non modifiable)",type:"Personne",group:"PREVOYANCE",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"PREVOYANCE",type:"Role",group:"PREVOYANCE",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("mutuelle")&&(myForms.push({title:!0==k?"Contact":"MUTUELLE (non modifiable)",type:"Personne",group:"MUTUELLE",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"MUTUELLE",type:"Role",group:"MUTUELLE",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("assureur")&&(myForms.push({title:!0==k?"Contact":"ASSUREUR (non modifiable)",type:"Personne",group:"ASSUREUR",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"ASSUREUR",type:"Role",group:"ASSUREUR",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("msa")&&(myForms.push({title:!0==k?"Contact":"MSA (non modifiable)",type:"Personne",group:"MSA",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"MSA",type:"Role",group:"MSA",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("ccvrp")&&(myForms.push({title:!0==k?"Contact":"CCVRP (non modifiable)",type:"Personne",group:"CCVRP",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"CCVRP",type:"Role",group:"CCVRP",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("crpcen")&&(myForms.push({title:!0==k?"Contact":"CRPCEN (non modifiable)",type:"Personne",group:"CRPCEN",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"CRPCEN",type:"Role",group:"CRPCEN",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("enim")&&(myForms.push({title:!0==k?"Contact":"ENIM (non modifiable)",type:"Personne",group:"ENIM",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"ENIM",type:"Role",group:"ENIM",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("cfe")&&(myForms.push({title:!0==k?"Contact":"CFE (non modifiable)",type:"Personne",group:"CFE",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"CFE",type:"Role",group:"CFE",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("assedicinter")&&void 0!=d&&myForms.push({title:"ASSEDICInter",type:"Role",group:"ASSEDICInter",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("ccpbtp")&&(myForms.push({title:!0==k?"Contact":"CCPBTP (non modifiable)",type:"Personne",group:"CCPBTP",lastPost:!0,autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:b,open:!1}),void 0!=d&&myForms.push({title:"CCPBTP",type:"Role",group:"CCPBTP",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("pr\u00e9voyance cadre")&&void 0!=d&&myForms.push({title:"Pr\u00e9voyance cadre",type:"Role",group:"Pr\u00e9voyance cadre",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("pr\u00e9voyance non cadre")&&void 0!=d&&myForms.push({title:"Pr\u00e9voyance non cadre",
type:"Role",group:"Pr\u00e9voyance non cadre",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("retraite cadre")&&void 0!=d&&myForms.push({title:"Retraite cadre",type:"Role",group:"Retraite cadre",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("retraite non cadre")&&
void 0!=d&&myForms.push({title:"Retraite non cadre",type:"Role",group:"Retraite non cadre",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("retraite travailleur ind\u00e9pendant")&&void 0!=d&&myForms.push({title:"Retraite travailleur ind\u00e9pendant",type:"Role",group:"Retraite travailleur ind\u00e9pendant",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("avocat")&&void 0!=d&&myForms.push({title:"Avocat",type:"Role",group:"Avocat",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("banque")&&void 0!=d&&myForms.push({title:"Banque",type:"Role",group:"Banque",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("notaire")&&void 0!=d&&myForms.push({title:"Notaire",type:"Role",group:"Notaire",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("associe")&&void 0!=d&&myForms.push({title:"Associ\u00e9",type:"Role",group:"Associ\u00e9",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});if("dossier"==e.toLowerCase()||"etablissement"==e.toLowerCase())void 0!=d&&myForms.push({title:"DOSSIER/ETABLISSEMENT",type:"Role",group:"DOSSIER/ETABLISSEMENT",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}),"dossier"==e.toLowerCase()&&(myForms.push({title:"Informations juridiques",
type:"Role",group:"Informations juridiques",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}),myForms.push({title:"Relations Clients",type:"Role",group:"Relations Clients",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,htmlIfEmpty:htmlIfEmptyLinkup,open:!1}),myForms.push({title:"Connecteur GE",
type:"Role",group:"Connecteur GE",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1}));e.toLowerCase().contains("soci\u00e9t\u00e9 int\u00e9grante")&&void 0!=d&&myForms.push({title:"SOCIETE INTEGRANTE",type:"Role",group:"SOCIETE INTEGRANTE",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,
open:!1});"Collaborateur"==e&&void 0!=d&&(myForms.push({title:"Collaborateur",type:"Role",group:"Collaborateur",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!0}),myForms.push({title:"Cloud",type:"Role",group:"Collaborateurs",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:isLinkUpEditable(),
open:!0}),s&&myForms.push({title:"Maintenance Cloud",type:"Personne",lastPost:!0,group:"Identification.",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:a,postObject:a,editable:!0,open:!0}));"Collaborateur Cabinet"==e&&void 0!=d&&myForms.push({title:"Sage LinkUp Experts",type:"Role",group:"Collaborateur Cabinet",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",
getObject:d,postObject:d,editable:isLinkUpEditable(),open:!0});"Administrateur Pme"==e&&void 0!=d&&myForms.push({title:"Sage LinkUp Experts",type:"Role",group:"Administrateur Pme",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:isLinkUpEditable(),open:!0});"Utilisateur Pme"==e&&void 0!=d&&(myForms.push({title:"Utilisateur Pme",type:"Role",group:"Collaborateur Cabinet",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",
historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!0}),myForms.push({title:"Utilisateur Pme",type:"Role",group:"Utilisateur Pme",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!0}));e.toLowerCase().contains("repr\u00e9sentant l\u00e9gal")&&void 0!=d&&myForms.push({title:"Repr\u00e9sentant l\u00e9gal",type:"Role",group:"Repr\u00e9sentant l\u00e9gal",
autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});e.toLowerCase().contains("chef d'entreprise")&&void 0!=d&&myForms.push({title:"Chef d'entreprise",type:"Role",group:"Chef d'entreprise",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!1});void 0!=d&&myForms.push({title:"Informations sp\u00e9cifiques",
type:"Role",group:"Informations sp\u00e9cifiques",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!0,open:!0});e.toLowerCase().contains("lieu g\u00e9ographique")&&void 0!=d&&myForms.push({title:"Lieu g\u00e9ographique de travail",type:"Role",group:"Lieu g\u00e9ographique de travail",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,
postObject:d,editable:!0,open:!1});void 0!=d&&h&&myForms.push({title:"Maintenance "+q,type:"Role",group:"Maintenance",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",getObject:d,postObject:d,editable:!1,open:!1});myForms.push({title:!0==k?"Contact":"V\u00e9rification",type:"Personne",lastPost:!0,group:"V\u00e9rification",autoCompletePost:"/mongo/{{classe}}/{{_id}}?date={{date}}",historic:"/mongo/{{classe}}/{{_id}}/values('{{name}}')",
getObject:a,postObject:a,editable:g,open:!0});return myForms}
function isLinkUpEditable(){var a=urlParams.codeCollabo;if(1==urlParams.modeDeconnecte)return!1;if("tni"===a.toLowerCase())return!0;var d=!1,b;$.ajax({type:"GET",url:"/mongo/Role?where=type eq 'Collaborateur' and estAdministrateurCabinet eq true&include=personne",username:a,password:urlParams.mdpCollabo,postData:{format:"application/json",pageable:!0},dataType:"json",cache:!1,async:!1,success:function(a){d=!0;b=a}});if(!d)return!1;for(var c=0,f;c<b.length;){f=b[c].personne;if(null!=f&&null!=f.codeCollaborateur&&
f.codeCollaborateur.toUpperCase()==a.toUpperCase())return!0;c+=1}return!1}
(function(a){"function"===typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],a):a(jQuery)})(function(a){function d(a){return a}function b(a){return decodeURIComponent(a.replace(f," "))}function c(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return k.json?JSON.parse(a):a}catch(b){}}var f=/\+/g,k=a.cookie=function(f,g,e){if(void 0!==g){e=a.extend({},k.defaults,e);if("number"===typeof e.expires){var l=e.expires,n=e.expires=new Date;n.setDate(n.getDate()+
l)}g=k.json?JSON.stringify(g):String(g);return document.cookie=[encodeURIComponent(f),"=",k.raw?g:encodeURIComponent(g),e.expires?"; expires="+e.expires.toUTCString():"",e.path?"; path="+e.path:"",e.domain?"; domain="+e.domain:"",e.secure?"; secure":""].join("")}g=k.raw?d:b;e=document.cookie.split("; ");for(var l=f?void 0:{},n=0,p=e.length;n<p;n++){var q=e[n].split("="),s=g(q.shift()),q=g(q.join("="));if(f&&f===s){l=c(q);break}f||(l[s]=c(q))}return l};k.defaults={};a.removeCookie=function(b,c){return void 0!==
a.cookie(b)?(a.cookie(b,"",a.extend(c,{expires:-1})),!0):!1}});(function($){var BOOL=0;var ENUM=1;var GROUP=2;var INTEGER=3;var NUMBER=4;var STRING=5;var TABLE=6;var DATE=7;var URL=8;var leContact=null;$.loader=function(callback,inst){this.counter=0;this.callback=callback;this.inst=inst;this.nbAll=inst.schemas.length()+inst.objects.length();this.load()};$.extend($.loader,{prototype:{counter:0,nbAll:0,callback:null,inst:null,finished:function(){this.callback.call(this.inst)},loaded:function(){++this.counter==this.nbAll?this.finished():this.load()},load:function(){if(this.counter<
this.inst.schemas.length()){var obj=this.inst.schemas.get(this.counter);var url=obj.getClass;if(!url){var date="@"+(new Date).formatForURL()+"@";var role=null;if(obj.getObject.split("?").length>1){var resReg=obj.getObject.split("?")[1].match(new RegExp("date=@.*@"));if(resReg)date=resReg[0].replace("date=","");resReg=obj.getObject.split("?")[1].match("roleParDefaut=.*");if(resReg)role=resReg[0].replace("roleParDefaut=","")}obj.getClass="/sdata/coala/classes('"+obj.type+"')?format=application/json&date="+
date;if(role!=null)obj.getClass+="&role='"+role+"'"}this.get(obj.getClass,obj)}else{var num=this.counter-this.inst.schemas.length();var obj=this.inst.objects.get(num);var url=obj.getObject;if(url)if(obj["getObjectAuth"])this.get(url,obj,obj.getObjectAuth["username"],obj.getObjectAuth["password"]);else this.get(url,obj);else{obj.obj=new $.jsonObject;obj.description={};obj.status="loaded";obj.getObject="new_"+num;this.loaded()}}},get:function(url,obj,usr,pwd){var self=this;$.ajax({url:url,cache:false,
type:"GET",dataType:"json",beforeSend:function(xhr){if(usr&&pwd){var base64Credentials="";if(typeof btoa==="undefined")base64Credentials=(usr+":"+pwd).btoa();else base64Credentials=btoa(usr+":"+pwd);xhr.setRequestHeader("Authorization","Basic "+base64Credentials)}},success:function(data){if(data!=null){obj.obj=new $.jsonObject(data);obj.description=data;obj.status="loaded";self.loaded()}}})}}});$.jsonObject=function(data){$.extend(this,data||{})};$.extend($.jsonObject,{prototype:{eval:function(condition){try{return eval(condition)}catch(err){return true}}}});
var protoListe={get:function(index){if(index>=0&&index<this.liste.length)return this.liste[index];return null},length:function(){return this.liste.length},last:function(){return this.liste[this.liste.length-1]},set:function(index,val){for(var i in val)this.liste[index][i]=val[i]},setObj:function(index,val){for(var i in val)this.liste[index].obj[i]=val[i]},value:function(index,name){return this.liste[index].obj[name]==null?"":this.liste[index].obj[name]}};$.schemas=function(){this.liste=new Array;
$.extend(this,{},protoListe)};$.extend($.schemas,{liste:[],prototype:{add:function(form){if(!this.liste.exists({"type":form.type}))this.liste.push($.extend({},form||{},{"status":"toLoad"}))}}});$.objects=function(){this.liste=new Array;$.extend(this,{},protoListe)};$.extend($.objects,{liste:[],prototype:{id:function(index){if(index>=0&&index<this.liste.length)return this.liste[index].getObject;return""},add:function(form,indexSchema){if(!this.liste.exists({"getObject":form.getObject,"type":form.type}))this.liste.push($.extend({},
{"status":"toLoad","startIndex":1,"indexSchema":indexSchema},form||{}))},schemaOfGroup:function(obj,group){if(obj.properties!=null){if(group==null||group=="")return obj.properties;if(!$.isArray(obj.properties))for(var i in obj.properties){var res=null;if(i==group)res=obj.properties[i].properties;else if(obj.properties[i].type=="group")res=this.schemaOfGroup(obj.properties[i],group);if(res!=null)return res}else for(i=0;i<obj.properties.length;i++){var res=null;if(obj.properties[i].name==group)res=
obj.properties[i].properties;else if(obj.properties[i].type=="group")res=this.schemaOfGroup(obj.properties[i],group);if(res!=null)return res}}return null},propertiesOfGroup:function(obj,group){if(obj.properties!=null){if(group==null||group=="")return null;if(!$.isArray(obj.properties))for(var i in obj.properties){var res=null;if(i==group)res=obj.properties[i];else if(obj.properties[i].type=="group")res=this.schemaOfGroup(obj.properties[i],group);if(res!=null)return res}else for(i=0;i<obj.properties.length;i++){var res=
null;if(obj.properties[i].name==group)res=obj.properties[i];else if(obj.properties[i].type=="group")res=this.schemaOfGroup(obj.properties[i],group);if(res!=null)return res}}return null},isModified:function(i){var ret=false;for(var o in this.liste[i].obj)if(!$.isFunction(this.liste[i].obj[o])&&(this.liste[i].description[o]!=null||this.liste[i].obj[o]!="")&&o!="timestamp")if($.isArray(this.liste[i].obj[o])){if(!this.liste[i].obj[o].isLike(this.liste[i].description[o]))ret=true}else if(this.liste[i].obj[o]!=
this.liste[i].description[o])ret=true;for(var o in this.liste[i].description)if(this.liste[i].obj[o]==null&&o!="timestamp")ret=true;return ret},writeNewDesc:function(i,postDiff,fields){var newDesc={};for(var o in this.liste[i].obj)if(!$.isFunction(this.liste[i].obj[o])&&(this.liste[i].description[o]!=null||this.liste[i].obj[o]!="")&&o!="timestamp"&&o!="_fields")if(!postDiff||this.liste[i].obj[o]!=this.liste[i].description[o]){newDesc[o]=this.liste[i].obj[o];if(!postDiff&&($.isArray(this.liste[i].obj[o])&&
!this.liste[i].obj[o].isLike(this.liste[i].description[o])||!$.isArray(this.liste[i].obj[o])&&this.liste[i].obj[o]!=this.liste[i].description[o]))if(o.substring(0,1)!="_"&&fields===true)if(newDesc["_fields"]==null||newDesc["_fields"]=="")newDesc["_fields"]=o;else newDesc["_fields"]+=","+o}for(var o in this.liste[i].description)if(this.liste[i].obj[o]==null&&o!="timestamp"&&o!="_fields"){newDesc[o]=null;if(o.substring(0,1)!="_"&&fields===true)if(newDesc["_fields"]==null||newDesc["_fields"]=="")newDesc["_fields"]=
o;else newDesc["_fields"]+=","+o}if(newDesc!={})newDesc["timestamp"]=(new Date).format();return newDesc}}});$.wizard=function(){};$.extend($.wizard,{prototype:{inst:null,init:function(inst){var self=this;this.inst=inst;$("#wizard_"+inst.id).append(this.html());$("#wizardButtonPrec_"+inst.id).click(function(){self.wizardPrec()});$("#wizardButtonSuiv_"+inst.id).click(function(){self.wizardSuiv()});$("#wizardButtonFirst_"+inst.id).click(function(){self.wizardFirst()});$("#wizardButtonLast_"+inst.id).click(function(){self.wizardLast()});
$("button").button();for(var i=0;i<inst.tabNb();i++)$("#ul"+i+"_"+inst.id+" a").click(function(event){if(!self.inst.areValidAllAttributes(self.inst.tabActive()))event.stopImmediatePropagation()});if(this.inst.config.submitbtn!==false){var submitBtn=$(this.inst.config.submitbtn);if(!submitBtn.hasClass("ui-button"))submitBtn.button({icons:{primary:"ui-icon "+this.inst.config.submiticon}});submitBtn.click(function(){self.inst.submit(true)})}if(this.inst.config.cancelbtn!==false){var cancelBtn=$(this.inst.config.cancelbtn);
if(!cancelBtn.hasClass("ui-button"))cancelBtn.button({icons:{primary:"ui-icon "+this.inst.config.cancelicon}});cancelBtn.click(function(){self.inst.cancel()})}if(!this.inst.isEditable()){if(this.inst.config.submitbtn!==false)$(this.inst.config.submitbtn).hide();if(this.inst.config.cancelbtn!==false)$(this.inst.config.cancelbtn).hide()}if(this.inst.isUpdateOnChange()&&this.inst.config.cancelbtn!==false)$(this.inst.config.cancelbtn).hide()},html:function(){var html="<table class='width100'><tr>";html+=
"<td class='left'>";if(this.inst.isWizard()){html+="<button id='wizardButtonFirst_"+this.inst.id+"'><<</button>";html+="<button id='wizardButtonPrec_"+this.inst.id+"'><</button><button id='wizardButtonSuiv_"+this.inst.id+"'>></button>";html+="<button id='wizardButtonLast_"+this.inst.id+"'>>></button>"}html+="</td>";html+="<td class='center'><div id='title_"+this.inst.id+"' class='center menu_title'>"+this.inst.config.titleFixed+"</div></td>";html+="<td class='right'><div id='wizardButtons_"+this.inst.id+
"'>";var btnTable="<table class='width100'><tr><td class='right'>";this.inst.config.submittext="Terminer";if(this.inst.config.cancelbtn==null||this.inst.config.cancelbtn===true){this.inst.config.cancelbtn="#cancel_"+this.inst.id;btnTable+="<button id='cancel_"+this.inst.id+"'>"+this.inst.config.canceltext+"</button>"}if(this.inst.config.submitbtn==null||this.inst.config.submitbtn===true){this.inst.config.submitbtn="#submit_"+this.inst.id;btnTable+="<button id='submit_"+this.inst.id+"'>"+this.inst.config.submittext+
"</button>"}btnTable+="</td></tr></table>";html+=btnTable+"</div></td>";if(this.inst.config.photoDiv)html+="<td class='right'><div id='"+this.inst.config.photoDiv+"'></div></td>";html+="</tr></table>";return html},wizardFirst:function(){for(var i=this.inst.tabActive();i>0;i--)if(!this.inst.areValidAllAttributes(i)){try{$("#tabs_"+this.inst.id).tabs("select",i)}catch(e){$("#tabs_"+this.inst.id).tabs("option","active",i)}return false}try{$("#tabs_"+this.inst.id).tabs("select",0)}catch(e){$("#tabs_"+
this.inst.id).tabs("option","active",0)}},wizardPrec:function(){if(this.inst.tabActive()>0&&this.inst.areValidAllAttributes(this.inst.tabActive()))try{$("#tabs_"+this.inst.id).tabs("select",this.inst.tabActive()-1)}catch(e){$("#tabs_"+this.inst.id).tabs("option","active",this.inst.tabActive()-1)}},wizardSuiv:function(){if(this.inst.tabActive()<this.inst.tabNb()&&this.inst.areValidAllAttributes(this.inst.tabActive()))try{$("#tabs_"+this.inst.id).tabs("select",this.inst.tabActive()+1)}catch(e){$("#tabs_"+
this.inst.id).tabs("option","active",this.inst.tabActive()+1)}},wizardLast:function(){for(var i=this.inst.tabActive();i<this.inst.tabNb()-1;i++)if(!this.inst.areValidAllAttributes(i)){try{$("#tabs_"+this.inst.id).tabs("select",i)}catch(e){$("#tabs_"+this.inst.id).tabs("option","active",i)}return false}try{$("#tabs_"+this.inst.id).tabs("select",this.inst.tabNb()-1)}catch(e){$("#tabs_"+this.inst.id).tabs("option","active",this.inst.tabNb()-1)}},manage:function(indexTab){indexTab<=0?$("#wizardButtonFirst_"+
this.inst.id).button({disabled:true}):$("#wizardButtonFirst_"+this.inst.id).button({disabled:false});indexTab<=0?$("#wizardButtonPrec_"+this.inst.id).button({disabled:true}):$("#wizardButtonPrec_"+this.inst.id).button({disabled:false});indexTab>=this.inst.tabNb()-1?$("#wizardButtonSuiv_"+this.inst.id).button({disabled:true}):$("#wizardButtonSuiv_"+this.inst.id).button({disabled:false});indexTab>=this.inst.tabNb()-1?$("#wizardButtonLast_"+this.inst.id).button({disabled:true}):$("#wizardButtonLast_"+
this.inst.id).button({disabled:false})}}});$.interval=function(interval){this.interval=interval.split("U")};$.extend($.interval,{prototype:{interval:null,contains:function(val){for(var i=0;i<this.interval.length;i++){var splitter=this.interval[i].split(",");if(splitter.length==2&&this.isInInf(val,splitter[0])&&this.isInSup(val,splitter[1]))return true}return false},isInInf:function(val,interval){var sens=interval[0];var borneInf=interval.substring(1);return borneInf=="-inf"||val>parseInt(borneInf)||
sens=="["&&val==parseInt(borneInf)},isInSup:function(val,interval){var sens=interval[interval.length-1];var borneSup=interval.substring(0,interval.length-1);return borneSup=="inf"||val<parseInt(borneSup)||sens=="]"&&val==parseInt(borneSup)}}});$.erreur=function(){this.list=new Array};$.extend($.erreur,{prototype:{list:[],widget:null,widgetError:null,msg:"",init:function(widget,widgetError){this.widget=widget;this.widgetError=widgetError},add:function(f,msg,id){this.list.push({"func":f,"msg":msg,"id":id})},
remove:function(id){for(var i=0;i<this.list.length;)if(this.list[i].id==id)this.list.splice(i,1);else i++},manage:function(){for(var i=0;i<this.list.length;i++)this.list[i].res=this.list[i].func();for(var i=0;i<this.list.length;i++)if(!this.list[i].res){$(this.widget).addClass("cadrerouge");$(this.widgetError).text(this.list[i].msg).show();return false}$(this.widget).removeClass("cadrerouge");$(this.widgetError).hide();return true}}});$.attrTable=function(data){this.values=new Array;this.lastsel=
null;$.extend(this,data,protoTable)};var protoTable={getType:function(){return TABLE},getClass:function(){return this.type.substring(1,this.type.length-1)},empty:function(){$(this.widget).clearGridData()},getVal:function(){return null},hasVal:function(){return this.values!=null&&this.values!=""},setVal:function(val,except){var self=this;self.values=val;$(self.widget).clearGridData();if($.isArray(val))for(var j=0;j<val.length;j++)$(this.widget).addRowData(j,val[j],"last");else $.each(val,function(index,
value){$(self.widget).addRowData(index,value,"last")})},getObjectFromTable:function(){var self=this;var rowsId=$(this.widget).jqGrid("getDataIDs");var rows=new Array;for(var cRows=0;cRows<rowsId.length;cRows++){var myId=rowsId[cRows];rows.push($(self.widget).jqGrid("getRowData",myId));rows[rows.length-1]["classe"]=self.getClass()}return rows},saveTable:function(dontSubmit){var self=this;var rowsId=$(this.widget).jqGrid("getDataIDs");self.lastsel=null;self.values=new Array;for(var cRows=0;cRows<rowsId.length;cRows++)self.values.push($(self.widget).jqGrid("getRowData",
rowsId[cRows]));var newObjTable=self.getObjectFromTable();self.docWidget.objects.get(self.indexObject).obj[self.name]=newObjTable;self.docWidget.spreadValue(self.name,self.indexObject,newObjTable);if(self.docWidget.isUpdateOnChange()&&dontSubmit!=true)self.docWidget.submit(false)},saveTableSync:function(){var ret=true;var rowsId=$(this.widget).jqGrid("getDataIDs");for(var cRows=0;cRows<rowsId.length;cRows++)ret&=saveRowSync.call($(this.widget),rowsId[cRows]);return ret},isValid:function(){var self=
this;var ret=self.saveTableSync();if(ret)self.saveTable(true);return ret},deleteEditingLines:function(){var self=this;var toDelete=new Array;for(var i=0;i<self.values.length;i++){var editable=false;$.each(self.values[i],function(k,v){if(v.match(new RegExp("^<input.*>$")))editable|=true});if(editable)toDelete.push(i)}for(var i=0;i<toDelete.length;i++)self.values.splice(toDelete[i],1);if(toDelete.length>0){self.setVal(self.values,null);ret=self.saveTable()}},construct:function(colNames,colModel){var self=
this;for(var i=0;i<self.variables.length;i++){if(self.variables[i].title!=null&&self.variables[i].title!="")colNames.push(self.variables[i].title);else colNames.push(self.variables[i].name);var obj1={"edittype":"text"};obj1["sortable"]=false;var basics=["name","width","editable"];for(var p=0;p<basics.length;p++)if(self.variables[i][basics[p]]!=null)obj1[basics[p]]=self.variables[i][basics[p]];if(obj1.width!=null&&obj1.width=="0")obj1["hidden"]=true;if(self.variables[i].validator!=null){var obj=new Object;
var objToEval='obj[self.index+"_"+i] = function(value,colName) {';objToEval+="var ret = new Array();";objToEval+="ret[0] = (value.length==0 || value.match("+new RegExp(self.variables[i].validator)+"))?true:false;";objToEval+='ret[1] = self.validatorError?self.validatorError:"La saisie "+colName+" est incorrecte.";';objToEval+="return ret;}";eval(objToEval);$.extend(self,obj);obj1["editrules"]={custom:true,custom_func:self[self.index+"_"+i]}}if(self.variables[i].type=="bool"){obj1["edittype"]="checkbox";
obj1["editoptions"]={value:"true:false",defaultValue:false};obj1["formatter"]="checkbox";obj1["align"]="center"}else if(self.variables[i].type=="number"||self.variables[i].type=="integer"){obj1["align"]="right";obj1["formatter"]=self.variables[i].type;var obj=new Object;var objToEval='obj[self.index+"_"+i] = function(value,colName) {';objToEval+="var ret = new Array(); ret[0]=true;";if(self.variables[i].interval!=null){objToEval+='var interval = new $.interval("'+self.variables[i].interval+'");';
objToEval+="ret[0] = (value=='' || value=='0.00' || interval.contains(value))?true:false;";objToEval+="if(!ret[0]) { ";if(self.variables[i].intervalError)objToEval+='msg = "'+self.variables[i].intervalError+'";';else objToEval+="msg=\" n'est pas compris dans "+self.variables[i].interval+'";';objToEval+="ret[1] = msg; return ret;}"}if(self.variables[i].type=="number"){var mask={nbUnit:50,nbDec:3};if(self.variables[i].format!=null){var sep="";for(var j=0;j<self.variables[i].format.length;j++)if(self.variables[i].format[j]!=
"0")sep=self.variables[i].format[j];var split=self.variables[i].format.split(sep);if(split.length==2)mask.nbDec=split[1].length}objToEval+="ret[0] = (value=='' || (!isNaN(parseFloat(value)) && value==parseFloat(value)))?true:false;";objToEval+='if(!ret[0]) { ret[1] = " n\'est pas un nombre."; return ret;}';objToEval+="ret[0] = (value=='' || parseFloat(value)<Math.pow(10,"+mask.nbUnit+"))?true:false;";objToEval+='if(!ret[0]) { ret[1] = " ne correspond pas au masque pr\u00e9vu."; return ret;}'}objToEval+=
"return ret;}";eval(objToEval);$.extend(self,obj);obj1["editrules"]={custom:true,custom_func:self[self.index+"_"+i]}}else if(self.variables[i].type=="string"&&self.variables[i].extendedType=="enum"){obj1["edittype"]="select";obj1["formatter"]="select";obj1["editoptions"]={};obj1["editoptions"]["value"]={"":""};$.each(self.variables[i].values,function(attr,value){obj1["editoptions"]["value"][value]=value})}else if(self.variables[i].type=="string"&&self.variables[i].extendedType=="date"){obj1["formatter"]=
"date";obj1["editoptions"]={size:10,maxlengh:10,dataInit:function(element){$(element).datepicker({changeYear:true,changeMonth:true,yearRange:"-100:+10"})}}}colModel.push(obj1)}},getUniqueId:function(){var max=0;$.each($("#input"+this.index+"_"+this.docWidget.id).getDataIDs(),function(index,value){max=Math.max(parseInt(value),max)});return max+1},draw:function(val){var self=this;self.values=val;this.nbRecords=val.length;this.widget="#input"+this.index+"_"+this.docWidget.id;var html='<tr name="'+this.name+
'" input="input'+this.index+"_"+this.docWidget.id+"\" class='form-group'><td colspan='4'><table class='myjqgrid' id='input"+self.index+"_"+self.docWidget.id+"'></table>";html+="<div id='pager"+self.index+"_"+self.docWidget.id+"'></div>";html+="<div id='dialog-confirm"+self.index+"_"+self.docWidget.id+"' title='Suppression' style='height: 35px;'><p><span class='ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>Etes-vous s\u00fbr de vouloir supprimer la ligne s\u00e9lectionn\u00e9e ?</p></div>";
html+="<div id='dialog-no-select"+self.index+"_"+self.docWidget.id+"' title='Attention' style='height: 35px;'><p><span class='ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>Aucune ligne n'est s\u00e9lectionn\u00e9e</p></div>";html+="</td></tr>";var func=function(){$("#dialog-confirm"+self.index+"_"+self.docWidget.id).hide();$("#dialog-no-select"+self.index+"_"+self.docWidget.id).hide();var colNames=new Array;var colModel=new Array;self.construct(colNames,colModel);var namepager="#pager"+
self.index+"_"+self.docWidget.id;var options={datastr:"",datatype:"jsonstring",colNames:colNames,colModel:colModel,rowNum:10,rowList:[10,20,30],pager:namepager,viewrecords:true,onSelectRow:function(id){if(self.docWidget.isEditableForm(self.indexTab)&&self.docWidget.isEditable()&&self.isAtLeastOneColumnEditable()&&id!=null&&id!=self.lastsel){var res=true;if(self.lastsel!=null)res=$("#input"+self.index+"_"+self.docWidget.id).saveRow(self.lastsel,null,"","",function(){self.saveTable()});if(res){$("#input"+
self.index+"_"+self.docWidget.id).editRow(id,true,null,null,"","",function(){self.saveTable()});self.lastsel=id}}else self.lastsel=null},editurl:"clientArray",caption:self.title,shrinkToFit:false,ajaxSubgridOptions:{async:false},width:$(self.docWidget.element).width()-self.niveau*5-70,height:"auto",rownumbers:false,hidegrid:false};if(this.pageable==null||!this.pageable)$.extend(options,{"rowList":[],"pgbuttons":false,"pgtext":null,"viewrecords":false});$("#input"+self.index+"_"+self.docWidget.id).jqGrid(options);
$("#gview_"+$.jgrid.jqID($("#input"+self.index+"_"+self.docWidget.id)[0].id)+" .ui-jqgrid-titlebar>span").removeClass("ui-jqgrid-title").addClass("form-group-title").attr("style","margin-left:6px").before("<span id='mask_"+self.index+"_"+self.docWidget.id+"' class='form-group-titlebar-close ui-icon ui-icon-triangle-1-s'></span></a>");$("#gview_"+$.jgrid.jqID($("#input"+self.index+"_"+self.docWidget.id)[0].id)+" .ui-jqgrid-titlebar").removeClass("ui-jqgrid-titlebar").addClass("form-group-titlebar");
$("#mask_"+self.index+"_"+self.docWidget.id).click(function(event){if(!self.hidden){$("#pager"+self.index+"_"+self.docWidget.id).hide();$("#gview_input"+self.index+"_"+self.docWidget.id+" .ui-jqgrid-bdiv").hide();$("#gview_input"+self.index+"_"+self.docWidget.id+" .ui-jqgrid-hdiv").hide();$("#mask_"+self.index+"_"+self.docWidget.id).removeClass("ui-icon ui-icon-triangle-1-s").addClass("ui-icon ui-icon-triangle-1-e")}else{$("#pager"+self.index+"_"+self.docWidget.id).show();$("#gview_input"+self.index+
"_"+self.docWidget.id+" .ui-jqgrid-bdiv").show();$("#gview_input"+self.index+"_"+self.docWidget.id+" .ui-jqgrid-hdiv").show();$("#mask_"+self.index+"_"+self.docWidget.id).removeClass("ui-icon ui-icon-triangle-1-e").addClass("ui-icon ui-icon-triangle-1-s")}self.hidden=!self.hidden});$("#"+self.docWidget.id+" .ui-pg-selbox").hide();$(window).bind("resize",function(){$("#input"+self.index+"_"+self.docWidget.id).setGridWidth($(self.docWidget.element).width()-self.niveau*5-70)}).trigger("resize");$("#input"+
self.index+"_"+self.docWidget.id).navGrid(namepager,{refresh:false,view:false,del:false,add:false,edit:false,search:false});if(self.docWidget.isEditableForm(self.indexTab)&&self.docWidget.isEditable()&&self.isAtLeastOneColumnEditable()){$("#input"+self.index+"_"+self.docWidget.id).navButtonAdd(namepager,{caption:"",buttonicon:"ui-icon-circle-plus",onClickButton:function(id){var res=true;if(self.lastsel!=null)res=$("#input"+self.index+"_"+self.docWidget.id).saveRow(self.lastsel);if(res===true){var newId=
self.getUniqueId();var added=$(self.widget).addRowData(newId,{},"first");if(added===true){$(self.widget).editRow(newId,true,null,null,"","",function(){self.saveTable()});self.lastsel=newId}}},title:"Ajouter une ligne",position:"last"});$(self.widget).navButtonAdd(namepager,{caption:"",buttonicon:"ui-icon-trash",onClickButton:function(id){if(self.lastsel!=null)$("#dialog-confirm"+self.index+"_"+self.docWidget.id).dialog({resizable:false,height:200,modal:true,buttons:{"Oui":function(){$(self.widget).delRowData($("#input"+
self.index+"_"+self.docWidget.id).getGridParam("selrow"));self.saveTable();$(this).dialog("close")},"Non":function(){$(this).dialog("close")}}});else $("#dialog-no-select"+self.index+"_"+self.docWidget.id).dialog({resizable:false,height:200,modal:true,buttons:{"Ok":function(){$(this).dialog("close")}}})},title:"Supprimer une ligne",position:"last"})}self.setVal(self.values);if(self.condition!=null)self.addCodeForCondition()};this.funcs.push(func);return html},isAtLeastOneColumnEditable:function(){if(this.disableJS&&
$.isFunction(this.disableJS))return!(this.disableJSValue===true);else{for(var i=0;i<this.variables.length;i++)if(this.variables[i].editable===true)return true;return false}},disable:function(){$(this.widget).attr("readonly","readonly");$(this.widget).find("*").addClass("disabled")},enable:function(){$(this.widget).removeAttr("readonly");$(this.widget).find("*").removeClass("disabled")}};$.attrEnum=function(data){$.extend(this,data,protoEnum)};var protoEnum={getType:function(){return ENUM},empty:function(){$(this.widget+
' option[value=""]').attr("selected",true)},setVal:function(val){$(this.widget+' option[value="'+val+'"]').attr("selected",true)},drawInput:function(val){if(this.listableJS){if($.isFunction(this.listableJS)){if(this.values===null)this.values=new Array;var callBackError=function(newObj){};var callBackSuccess=function(newObj){};this.listableJS(this,callBackError,callBackSuccess,self)}var html="<td><div class=ui-widget>";html+="<select class='inputStyleSelect' id='input"+this.index+"_"+this.docWidget.id+
"'>";html+="<option value='' selected='selected'>&nbsp;</option>";$.each(this.values,function(i){if(this.split("/")){var res=this.split("/");var myText=res[0];var myId=res[1];html+='<option value="'+myId+'"';html+=myId==val?" selected='selected'":"";html+=">"+myText+"</option>"}else{html+='<option value="'+this+'"';html+=this==val?" selected='selected'":"";html+=">"+this+"</option>"}});return html+"</select></div></td>"}else{var html="<td><div class=ui-widget>";html+="<select class='inputStyleSelect' id='input"+
this.index+"_"+this.docWidget.id+"'>";html+="<option value='' selected='selected'>&nbsp;</option>";$.each(this.values,function(i){html+='<option value="'+this+'"';html+=this==val?" selected='selected'":"";html+=">"+this+"</option>"});return html+"</select></div></td>"}},disable:function(){$(this.widget).attr("disabled",true);$(this.widget).addClass("disabled")},enable:function(){$(this.widget).removeAttr("disabled");$(this.widget).removeClass("disabled")}};$.attrGroup=function(data){$.extend(this,
data,protoGroup)};var protoGroup={getType:function(){return GROUP},empty:function(){if(this.coche&&$(this.widgetCoche))$(this.widgetCoche).attr("checked",false)},setVal:function(val,except){if(this.coche&&$(this.widgetCoche)){$(this.widgetCoche).attr("checked",val===true);if(!val&&this.index!=except&&$(this.widgetLegend)){$("#sub"+this.index+"_"+this.docWidget.id).hide();$("span.ui-icon",$(this.widgetLegend)).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e")}}},getVal:function(){return this.coche?
$(this.widgetCoche).is(":checked")?true:false:null},hasVal:function(){return this.coche&&$(this.widgetCoche).is(":checked")},drawAttribute:function(val,drawContent){var self=this;var tr=$('<tr name="'+this.name+"\" class='form-group'></tr>");var td=$("<td colspan='4' ></td>");tr.append(td);var fs=$("<fieldset id='input"+this.index+"_"+this.docWidget.id+"'></fieldset>");td.append(fs);var tb=$("<div class='form-group-titlebar ui-widget-header ui-corner-top ui-helper-clearfix' id='legend"+this.index+
"_"+this.docWidget.id+"'></div>").hover(function(){tb.addClass("ui-state-hover")},function(){tb.removeClass("ui-state-hover")});this.widgetLegend="#legend"+this.index+"_"+this.docWidget.id;var coche=$("<a class='form-group-titlebar-close' role='link'></a>").append("<input type='checkbox' id='coche"+this.index+"_"+this.docWidget.id+"' />");this.widgetCoche="#coche"+this.index+"_"+this.docWidget.id;var arf=$("<a class='form-group-titlebar-close' role='link'></a>").append('<span class="ui-icon ui-icon-triangle-1-e"></span>');
if(this.coche){tb.append(coche).append('<span class="form-group-title" style="padding-left:16px">&nbsp;</span>');if(val)this.funcs.push(function(){$("#coche"+self.index+"_"+self.docWidget.id).attr("checked",true)})}tb.append(arf).append('<span class="form-group-title" style="padding-left:16px">'+this.name+"</span>");fs.append(tb);var content=$("<div class='form-group-content' id='sub"+this.index+"_"+this.docWidget.id+"'></div>");fs.append(content);if(this.open||this.transparent===true)this.funcs.push(function(){if(self.open){self.folded=
false;$("#legend"+self.index+"_"+self.docWidget.id).click()}else if(!self.isEmptyGroupTransparent()){self.folded=true;$("#legend"+self.index+"_"+self.docWidget.id).click()}});if(drawContent==null||drawContent)content.append(this.docWidget.drawFormContent(this.indexObject,this.name,this.indexTab,this.niveau+1,this.widget));if(this.margin)fs.wrap("<div class='marginLeft5'></div>");return tr},isEmptyGroupTransparent:function(){var self=this;var empty=true;if(this.transparent!=true)return true;$.each(self.getAllChildren(),
function(){var attr=self.docWidget.listOfAttributes[self.docWidget.getAttribute(this)];if(attr.getType()==GROUP)empty&=attr.isEmptyGroupTransparent();else empty&=!(attr.hasVal()||attr.mandatory)});return empty},getAllChildren:function(){var self=this;var list=[];$.each($("#sub"+self.index+"_"+self.docWidget.id).find("tr"),function(){if($($(this).parents("div").get(0)).attr("id")=="sub"+self.index+"_"+self.docWidget.id)if($(this).hasClass("form-group")&&$(this).attr("input")==null)list.push($($(this).find("fieldset").get(0)).attr("id"));
else if($(this).attr("input"))list.push($(this).attr("input"))});return list},addCodeSpec:function(){var self=this;var myfunc=function(){$("#legend"+self.index+"_"+self.docWidget.id).click(function(){if(self.coche&&!$("#coche"+self.index+"_"+self.docWidget.id).is(":checked")){$("#sub"+self.index+"_"+self.docWidget.id+":visible").slideUp();$("span.ui-icon",this).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e");return}if(self.transparent===true)if(!self.isEmptyGroupTransparent()){$("#sub"+
self.index+"_"+self.docWidget.id+":hidden").slideDown();$.each(self.getAllChildren(),function(){var attr=self.docWidget.listOfAttributes[self.docWidget.getAttribute(this)];if(attr.getType()==GROUP){if(!attr.isEmptyGroupTransparent())self.docWidget.foldOut(self.docWidget.getAttribute(this))}else if(self.folded===true&&!(attr.hasVal()||attr.mandatory))$('tr[input="'+attr.widget.substring(1)+'"]').each(function(){$(this).hide()});else $('tr[input="'+attr.widget.substring(1)+'"]').each(function(){$(this).show()})});
if(self.folded===true)$("span.ui-icon",this).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e");else $("span.ui-icon",this).removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-se");self.folded=!self.folded}else{var hiddens=$("#sub"+self.index+"_"+self.docWidget.id+":visible").slideUp();var visibles=null;if(hiddens==null||hiddens.length==0)visibles=$("#sub"+self.index+"_"+self.docWidget.id+":hidden").slideDown();$.each(self.getAllChildren(),function(){var attr=self.docWidget.listOfAttributes[self.docWidget.getAttribute(this)];
if(attr.getType()==GROUP){if(!attr.isEmptyGroupTransparent())self.docWidget.foldOut(self.docWidget.getAttribute(this))}else if(visibles!=null&&visibles.length>0||attr.hasVal())$('tr[input="'+attr.widget.substring(1)+'"]').each(function(){$(this).show()});else $('tr[input="'+attr.widget.substring(1)+'"]').each(function(){$(this).hide()})});if(visibles!=null&&visibles.length>0)$("span.ui-icon",this).removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-se");else $("span.ui-icon",this).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e")}else{var hiddens=
$("#sub"+self.index+"_"+self.docWidget.id+":visible").slideUp();var visibles=null;if(hiddens==null||hiddens.length==0)visibles=$("#sub"+self.index+"_"+self.docWidget.id+":hidden").slideDown();if(visibles!=null&&visibles.length>0)$("span.ui-icon",this).removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-se");else $("span.ui-icon",this).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e")}$.each(self.docWidget.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()})})};
this.funcs.push(myfunc);if(this.coche){var myfunc2=function(){$("#coche"+self.index+"_"+self.docWidget.id).change(function(event){self.docWidget.objects.get(self.indexObject).obj[self.name]=$("#coche"+self.index+"_"+self.docWidget.id).is(":checked")?true:false;$.each(self.docWidget.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()});self.docWidget.spreadValue(self.name,self.indexObject,$("#coche"+self.index+"_"+self.docWidget.id).is(":checked")?true:false,
self.index);self.docWidget.verify(self,self.docWidget.isUpdateOnChange()?self.docWidget.submit:null)})};this.funcs.push(myfunc2)}},formatInputVal:function(val){return val==""?false:val}};$.attrBool=function(data){$.extend(this,data,protoBool)};var protoBool={getType:function(){return BOOL},empty:function(){$(this.widget).attr("checked",false)},setVal:function(val){$(this.widget).attr("checked",val===true)},hasVal:function(val){$(this.widget).attr("checked")},getVal:function(){return $(this.widget).is(":checked")?
true:false},disable:function(){$(this.widget).attr("disabled",true);$(this.widget).addClass("disabled")},enable:function(){$(this.widget).removeAttr("disabled");$(this.widget).removeClass("disabled")},drawInput:function(val){var html="<td><input type='checkbox' id='input"+this.index+"_"+this.docWidget.id+"' ";if(val)html+="CHECKED";return html+" /></td>"}};$.attrString=function(data){$.extend(this,data,protoString)};var protoString={getType:function(){return STRING},formatInputVal:function(val){return this.lines!=
null?val:val!=""?'"'+val.replace(/\"/g,"&quot;")+'"':""},drawInputMultilines:function(val){return"<td><div class=ui-widget><textarea class='inputStyle' style='resize:none' rows="+this.lines+" id='input"+this.index+"_"+this.docWidget.id+"'>"+val+"</textarea></div></td>"}};$.attrDate=function(data){$.extend(this,data,protoDate)};var protoDate={getType:function(){return DATE},addCodeSpec:function(){var self=this;this.funcs.push(function(){if(!$(self.widget).hasClass("disabled"))$(self.widget).datepicker({changeYear:true,
changeMonth:true,yearRange:"-100:+10",firstDay:1,showOn:"button",buttonText:"",buttonImage:"../stylesheets/images/calendar.png",buttonImageOnly:true})});var validation=function(){if($(self.widget).val().length==0)return true;return isValidDate($(self.widget).val())};this.erreur.add(validation,"La saisie est incorrecte.");this.funcs.push(function(){if(!$(self.widget).hasClass("disabled"))$(self.widget).mask("99/99/9999")})},formatInputVal:function(val){return val!=""?'"'+val+'"':""}};$.attrUrl=function(data){$.extend(this,
data,protoUrl)};var protoUrl={getType:function(){return ENUM},formatInputVal:function(val){return val!=""?'"'+val+'"':""}};$.attrInteger=function(data){$.extend(this,data,protoInteger)};var protoInteger={getType:function(){return INTEGER},addCodeSpec:function(){var self=this;var validation=function(){return $(self.widget).val()==""||!isNaN(parseInt($(self.widget).val(),10))&&parseInt($(self.widget).val(),10)==$(self.widget).val()};this.erreur.add(validation,"La valeur n'est pas un entier.")}};$.attrNumber=
function(data){$.extend(this,data,protoNumber);this.initMask()};var protoNumber={getType:function(){return NUMBER},initMask:function(){this.mask={nbUnit:50,nbDec:3};if(this.format!=null){var sep="";for(var i=0;i<this.format.length;i++)if(this.format[i]!="0")sep=this.format[i];var split=this.format.split(sep);if(split.length==2)this.mask.nbDec=split[1].length}},addCodeSpec:function(){var self=this;var validation=function(){return $(self.widget).val()==""||!isNaN(parseFloat($(self.widget).val()))&&
$(self.widget).val()==parseFloat($(self.widget).val())};this.erreur.add(validation,"La valeur n'est pas un nombre.");var validation2=function(){return $(self.widget).val()==""||parseFloat($(self.widget).val())<Math.pow(10,self.mask.nbUnit)};this.erreur.add(validation2,"La valeur ne correspond pas au masque pr\u00e9vu.")},formatInputVal:function(val){return val!=""?parseFloat(val).toFixed(this.mask.nbDec):val}};function attrType(attr){if(attr.type=="bool")return BOOL;if(attr.type=="string"&&attr.extendedType==
"enum")return ENUM;if(attr.type=="string"&&attr.extendedType=="date")return DATE;if(attr.type=="string"&&attr.extendedType=="url")return URL;if(attr.type=="group")return GROUP;if(attr.type=="integer")return INTEGER;if(attr.type=="number")return NUMBER;if(attr.type.substring(0,1)=="["&&attr.type.substring(attr.type.length-1,attr.type.length)=="]")return TABLE;return STRING}$.attribute=function(inst,json,index,indexObj,indexTab,niveau,parent){this.docWidget=inst;this.index=index;this.widget="#input"+
index+"_"+inst.id;this.indexObject=indexObj;this.indexTab=indexTab;$.extend(this,{},$.attribute.defaults);$.extend(this,json||{});this.title=json.title!=null?json.title:json.name;this.open=json.open!=null?json.open:false;this.funcs=new Array;this.conditions=new Array;this.niveau=niveau;this.erreur=new $.erreur(this);this.parent=parent;this.checkableJS=inst.isFunction_Modif(inst.objects.get(indexObj).type,this.name);this.listableJS=inst.isFunction_Liste(inst.objects.get(indexObj).type,this.name);this.disableJS=
inst.isFunction_Gris(inst.objects.get(indexObj).type,this.name);if(this.disableJS)this.disableJSValue=this.disableJS(this.docWidget.objects.get(this.indexObject).obj,null,this);this.hoverJS=inst.isFunction_Bulle(inst.objects.get(indexObj).type,this.name);if(this.hoverJS)this.hoverJSValue=this.hoverJS(this.docWidget.objects.get(this.indexObject).obj,null,this);leContact=inst.objects.get(indexObj).description};$.extend($.attribute,{docWidget:null,index:0,indexObject:0,indexTab:0,title:null,erreur:null,
open:false,funcs:[],niveau:0,conditions:null,checkableJS:null,listableJS:null,disableJS:null,widget:null,devise:null,defaults:{editable:true,autoComplete:"",autoCompleteMode:"replace",autoCompleteModel:""},prototype:{addCode:function(){var self=this;if(this.condition!=null)this.addCodeForCondition();if(!this.editable)this.funcs.push(function(){self.disable()});if($.isFunction(this.disableJS)&&this.disableJSValue===true)this.funcs.push(function(){self.disable()});if(this.autoComplete!=""&&this.autoCompleteModel!=
"")this.addCodeForAutoComplete();if(this.calcul!=null)this.addCodeForCalcul();if(this.validator!=null)this.addCodeForValidator();if(this.interval!=null)this.addCodeForInterval();if(this.getType()!=TABLE&&this.getType()!=GROUP)this.addCodeForInputChange();this.funcs.push(function(){$(self.widget).keyup(function(){self.erreur.manage()})});if($.isFunction(this.addCodeSpec))this.addCodeSpec()},empty:function(){$(this.widget).val("")},setVal:function(val){$(this.widget).val(val)},getVal:function(){return $(this.widget).val()},
hasVal:function(){return $(this.widget).val()!=""},isValid:function(){if($(this.widget).attr("readonly")=="readonly"||$(this.widget).attr("disabled")||$(this.widget).is(":hidden"))return true;return this.erreur.manage()},disable:function(){$(this.widget).attr("readonly","readonly");$(this.widget).addClass("disabled");if($(this.widget).hasClass("datepicker"))$(this.widget).datepicker("disable")},enable:function(){$(this.widget).removeAttr("readonly");$(this.widget).removeClass("disabled");if($(this.widget).hasClass("datepicker"))$(this.widget).datepicker("enable")},
draw:function(val,content){this.erreur.init(this.widget,"#errorinput"+this.index+"_"+this.docWidget.id);this.addCode();return this.drawAttribute(this.formatInputVal(val),content)},formatInputVal:function(val){return val},drawAttribute:function(val){var html=this.drawLibelle();html+="<td style='width:33%'><table><tr id='hover"+this.index+"_"+this.docWidget.id+"'>";html+=this.drawInput(val);html+=this.drawMenu();html+=this.drawAnnulAutoComplete();html+="</tr></table></td>";html+=this.drawError();return html},
drawMenu:function(){var self=this;var htmlHisto=self.drawHisto();var htmlNullable=self.drawNullable();if(htmlHisto+htmlNullable){this.funcs.push(function(){$("#menu"+self.index+"_"+self.docWidget.id).click(function(event){var widgetDg="#dialog-menu"+self.index+"_"+self.docWidget.id;if($(widgetDg).is(":visible"))$(widgetDg).empty().remove();else{var position=$("#menu"+self.index+"_"+self.docWidget.id).position();$(widgetDg).empty();$(self.docWidget.element).append("<div id='dialog-menu"+self.index+
"_"+self.docWidget.id+"'></div>");$(widgetDg).append('<ul class="ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" style="position: absolute; z-index: 1; top: '+(position.top+60)+"px; left: "+(position.left-10)+'px; display: block; min-width: 200px;" id="dialog-menu-ul'+self.index+"_"+self.docWidget.id+'"></ul>');var widgetDgUl="#dialog-menu-ul"+self.index+"_"+self.docWidget.id;if(htmlHisto){$(widgetDgUl).append(htmlHisto);self.addCodeHisto()}if(htmlNullable){$(widgetDgUl).append(htmlNullable);
self.addCodeNullable()}$(widgetDg).hover(null,function(){$(widgetDg).empty().remove()})}})});return"<td><span class='ui-icon ui-icon-circle-triangle-s' id='menu"+self.index+"_"+self.docWidget.id+"'></span></td>"}return""},drawLibelle:function(){var html='<tr name="'+this.name+"\" input='input"+this.index+"_"+this.docWidget.id+"'><td style='width:33%' class='form_subtitle' id='label"+this.index+"_"+this.docWidget.id+"' title=\"";var msgtooltip="";if(this.hoverJS)msgtooltip=this.hoverJSValue.replace(/\"/g,
"&quot;");else if(this.comment)msgtooltip=this.comment.replace(/\"/g,"&quot;");else msgtooltip=this.name.replace(/\"/g,"&quot;");html+=msgtooltip+'">'+this.title;var condReq=this.conditionRequired!="undefined"&&this.conditionRequired!=null&&this.conditionRequired!="";if(condReq){var arrayOfStrings=this.conditionRequired.split("==");this.required=this.docWidget.isRequiredField(arrayOfStrings[0],arrayOfStrings[1])}if(this.required){html+=" <p>*</p>";this.addCodeForRequired()}var lst=["NumTVAIntra",
"JourLimite","QualiteRepresentantLegal","TitulaireCompte","CodeBanque","CodeGuichet","NumeroCompte","CleIBAN","CleRIB","IBAN","CodeBIC","NumAdhes","numeroNational","codeInseeCommune"];if(this.mandatoryEdi||lst.indexOf(this.name)>-1)html+=" <p style='color:green'>*</p>";if(this.mandatory)html+=" *";return html+"</td>"},drawInput:function(val){if(this.getType()==STRING&&this.lines!=null)return this.drawInputMultilines(val);var html="<td><div class=ui-widget><input type='text' class='inputStyle";if(this.getType()==
INTEGER||this.getType()==NUMBER)html+=" right";if(this.getType()==DATE)html+=" datepicker";html+="' id='input"+this.index+"_"+this.docWidget.id+"' ";if(val)html+="value="+val;return html+" /></div></td>"},drawHisto:function(){var self=this;if(!this.historical||!this.docWidget.objects.get(this.indexObject).historic)return"";return'<li class="ui-menu-item" role="menuitem" id=\'histo'+self.index+"_"+self.docWidget.id+'\'><a class="ui-corner-all" tabindex="-1"><table><tr><td><span class=\'ui-icon ui-icon-bookmark\'></span></td><td>Historique</td></tr></table></a></li>'},
addCodeHisto:function(){var self=this;var widget="#histo"+self.index+"_"+self.docWidget.id;$(widget).hover(function(){$(widget+" a").addClass("ui-state-hover")},function(){$(widget+" a").removeClass("ui-state-hover")});$(widget+" a").click(function(event){var temp=$.extend(true,{},self,self.docWidget.objects.get(self.indexObject).obj||{});$.each(temp,function(attr,value){temp[attr]=encodeURIComponent(value).replace(/'/,"%27")});var url=Mustache.render(self.docWidget.objects.get(self.indexObject).historic,
temp);$.get(url,function(data){if(data!=null&&data.length>0){var widgetDg="#dialog-histo"+self.index+"_"+self.docWidget.id;$(widgetDg).empty();$(self.docWidget.element).append("<div id='dialog-histo"+self.index+"_"+self.docWidget.id+"' title=\"Historique - "+self.title+"\" style='display:none'><p><span class='ui-icon-clock' style='float:left; margin:0 7px 20px 0;'></span></p></div>");var liste="<ul>";for(var i=0;i<data.length;i++)liste+="<li>"+data[i].date+" : "+data[i].value+"</li>";liste+="</ul>";
$(widgetDg).append(liste).dialog({resizable:false,height:"auto",width:"auto",modal:true})}},"json")})},drawNullable:function(){var self=this;if(!this.editable||!this.docWidget.isEditable()||!this.docWidget.isEditableForm(this.indexTab)||$.isFunction(this.disableJS)&&this.disableJSValue===true)return"";return'<li class="ui-menu-item" role="menuitem" id=\'nullable'+self.index+"_"+self.docWidget.id+'\'><a class="ui-corner-all" tabindex="-1"><table><tr><td><span class=\'ui-icon ui-icon-help\'></span></td><td>Rendre ind\u00e9fini</td></tr></table></a></li>'},
addCodeNullable:function(){var self=this;var widget="#nullable"+self.index+"_"+self.docWidget.id;$(widget).hover(function(){$(widget+" a").addClass("ui-state-hover")},function(){$(widget+" a").removeClass("ui-state-hover")});$(widget+" a").click(function(event){delete self.docWidget.objects.get(self.indexObject).obj[self.name];$.each(self.docWidget.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()});self.docWidget.spreadValueNull(self.name,self.indexObject);
var callBackSuccess=function(){if($.isFunction(self.docWidget.config.submitNull))self.docWidget.config.submitNull();else{var obj=self.docWidget.objects.get(self.indexObject);if($.isFunction(obj.postNull))obj.postNull();else{self.docWidget.submit();$("#dialog-menu"+self.index+"_"+self.docWidget.id).empty();$("#dialog-menu"+self.index+"_"+self.docWidget.id).remove()}}};self.docWidget.verify(self,callBackSuccess)})},drawAnnulAutoComplete:function(){if(this.autoComplete==""||this.autoCompleteModel==""||
this.autoCompleteMode!="replace"||!this.docWidget.isEditable()||!this.docWidget.isEditableForm(this.indexTab)||$.isFunction(this.disableJS)&&this.disableJSValue===true)return"";var self=this;this.funcs.push(function(){$("#annulAutoComplete"+self.index+"_"+self.docWidget.id).hide();$("#annulAutoComplete"+self.index+"_"+self.docWidget.id).click(function(event){self.docWidget.emptyObject(self.indexObject);if(self.autoCompleteMode==="replace")self.docWidget.hideAllAnnulAutoComplete()})});return"<td><span class='ui-icon ui-icon-circle-close' id='annulAutoComplete"+
self.index+"_"+self.docWidget.id+"'></span></td>"},drawError:function(){return"<td><div style='display:none;width:31%' id='errorinput"+this.index+"_"+this.docWidget.id+"' class='errorstyle'>La saisie est incorrecte.</div></td></tr>"},setFieldRequired:function(){var condReq=this.conditionRequired!="undefined"&&this.conditionRequired!=null&&this.conditionRequired!="";if(condReq){var arrayOfStrings=this.conditionRequired.split("==");if(this.docWidget.isRequiredField(arrayOfStrings[0],arrayOfStrings[1])){this.required=
true;this.addCodeForRequired();$("#label"+this.index+"_"+this.docWidget.id).html(this.title+" <p>*<p>")}else{this.required=false;this.removeCodeForRequired();$("#label"+this.index+"_"+this.docWidget.id).html(this.title)}}},addCodeForRequired:function(){var self=this;var id="label"+this.index+"_"+this.docWidget.id;var validation=function(){return $(self.widget).val().length>0};this.erreur.add(validation,"Ce champ est requis.",id)},removeCodeForRequired:function(){var self=this;var id="label"+this.index+
"_"+this.docWidget.id;this.erreur.remove(id)},forceclose:function(){var self=this;self.docWidget.objects.get(self.indexObject).obj[self.name]=self.getVal();$.each(self.docWidget.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()});self.docWidget.spreadValue(self.name,self.indexObject,self.getVal())},addCodeForAutoComplete:function(){var self=this;if((this.autoCompleteMode==="update"||this.docWidget.isAutoComplete())&&this.docWidget.isEditable()&&this.docWidget.isEditableForm(this.indexTab)&&
(!$.isFunction(this.disableJS)||!(this.disableJSValue===true))){var func=function(){$("#input"+self.index+"_"+self.docWidget.id).addClass("autocomplete");$("#input"+self.index+"_"+self.docWidget.id).autocomplete({select:function(event,ui){if(ui.item.type=="button"){var newCount=1;if(ui.item.sens==0)newCount=Math.max(1,self.docWidget.objects.get(self.indexObject).startIndex-Math.max($("#input"+self.index+"_"+self.docWidget.id).autocomplete("option","counter"),1));else newCount=self.docWidget.objects.get(self.indexObject).startIndex+
$("#input"+self.index+"_"+self.docWidget.id).autocomplete("option","counter");self.docWidget.objects.set(self.indexObject,{"startIndex":newCount});event.preventDefault();event.stopPropagation();$("#input"+self.index+"_"+self.docWidget.id).autocomplete("search")}else{self.docWidget.loadObject(ui.item,self.indexObject,self.autoCompleteMode==="replace");self.docWidget.verify(self,self.docWidget.isUpdateOnChange()?self.docWidget.submit:null);if(self.autoCompleteMode==="replace")self.docWidget.showAllAnnulAutoComplete();
self.erreur.manage();$("#input"+self.index+"_"+self.docWidget.id).blur()}},search:function(event,ui){if(event.originalEvent&&event.originalEvent.type=="keydown")self.docWidget.objects.set(self.indexObject,{"startIndex":1})},change:function(){self.docWidget.objects.get(self.indexObject).obj[self.name]=self.getVal();$.each(self.docWidget.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]();this.setFieldRequired()});self.docWidget.spreadValue(self.name,self.indexObject,
self.getVal());self.docWidget.verify(self,self.docWidget.isUpdateOnChange()?self.docWidget.submit:null)},source:function(request,response){var objectToMustache=new Object;$.extend(objectToMustache,{},self.docWidget.objects.get(self.indexObject),self.docWidget.objects.get(self.indexObject).obj);if(self.docWidget.objects.get(self.indexObject).postObject.split("?").length>1){var resReg=self.docWidget.objects.get(self.indexObject).postObject.split("?")[1].match(new RegExp("date=@.*@"));if(resReg)$.extend(objectToMustache,
{date:resReg[0].replace("date=","")});else $.extend(objectToMustache,{date:"@"+(new Date).formatForURL()+"@"})}else $.extend(objectToMustache,{date:"@"+(new Date).formatForURL()+"@"});var objectToMustacheEncode=new Object;$.each(objectToMustache,function(attr,value){objectToMustacheEncode[attr]=encodeURIComponent(value).replace(/'/,"%27")});var url=Mustache.render(self.autoComplete,objectToMustacheEncode).replace("_this_",encodeURIComponent(self.getVal().toLowerCase()).replace(/'/,"%27"));$.get(url,
function(data){if(data!=null){$("#input"+self.index+"_"+self.docWidget.id).autocomplete("option","counter",data.length);if(objectToMustacheEncode.startIndex>1)data.unshift({type:"button",sens:0});for(var v in data)data[v].value=eval("data[v]."+self.name);if(data.length>1||objectToMustacheEncode.startIndex<=1&&data.length>0)data.push({type:"button",sens:1});response(data)}},"json")},minLength:2});var designFunction=function(ul,item){if(item.type!="button")return $("<li></li>").data("item.autocomplete",
item).append($("<a></a>").html(Mustache.render(self.autoCompleteModel,item))).appendTo(ul);else{var image=item.sens==0?"ui-icon-triangle-1-n":"ui-icon-triangle-1-s";return $("<li></li>").data("item.autocomplete",item).append($("<a></a>").html("<div><span class='ui-icon "+image+"' style='margin-left:140px'></span></div>")).appendTo(ul)}};if($("#input"+self.index+"_"+self.docWidget.id).data("uiAutocomplete"))$("#input"+self.index+"_"+self.docWidget.id).data("uiAutocomplete")._renderItem=designFunction;
else $("#input"+self.index+"_"+self.docWidget.id).data("autocomplete")._renderItem=designFunction};this.funcs.push(func)}},addCodeForInterval:function(){var self=this;var nameErrorInput="#errorinput"+this.index+"_"+this.docWidget.id;var nameInput="#input"+self.index+"_"+self.docWidget.id;var interval=new $.interval(self.interval);var validation=function(){return $(nameInput).val()==""||interval.contains($(nameInput).val())};this.erreur.add(validation,this.intervalError?this.intervalError:"La valeur doit \u00eatre comprise dans "+
this.interval)},addCodeForValidator:function(){var self=this;if(this.devise==null){var validation=function(){if($(self.widget)==null)return true;return $(self.widget).val().length==0||$(self.widget).val().match(new RegExp(self.validator))};this.erreur.add(validation,self.validatorError?self.validatorError:"La saisie est incorrecte.")}else this.erreur.list=new Array},addCodeForCondition:function(){var self=this;var myfunc=function(){if(self.docWidget.objects.get(self.indexObject).obj.eval(self.condition)){var parent=
self.docWidget.listOfAttributes[self.docWidget.getAttribute(self.parent)];if(parent&&parent.transparent===true){if(parent.folded||self.getVal()!="")self.docWidget.show(self.name)}else self.docWidget.show(self.name)}else self.docWidget.hide(self.name)};this.conditions.push(myfunc)},addCodeForCalcul:function(){var self=this;this.editable=false;var myfunc=function(){self.docWidget.objects.get(self.indexObject).obj[self.name]=self.docWidget.objects.get(self.indexObject).obj.eval(self.calcul);self.docWidget.spreadValue(self.name,
self.indexObject,self.docWidget.objects.get(self.indexObject).obj[self.name])};this.conditions.push(myfunc);this.funcs.push(function(){self.disable()})},addCodeForInputChange:function(){var self=this;var func=function(){$("#input"+self.index+"_"+self.docWidget.id).change(function(){self.erreur.manage();self.docWidget.areValidAllAttributes();if(self.autoComplete!=""&&self.autoCompleteModel!=""&&(self.docWidget.isAutoComplete()||self.autoCompleteMode==="update")&&self.docWidget.isEditable()&&self.docWidget.isEditableForm(self.indexTab)&&
(!$.isFunction(this.disableJS)||!(this.disableJSValue===true)))return;self.docWidget.objects.get(self.indexObject).obj[self.name]=self.getVal();$.each(self.docWidget.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]();this.setFieldRequired()});self.docWidget.spreadValue(self.name,self.indexObject,self.getVal());self.docWidget.verify(self,self.docWidget.isUpdateOnChange()?self.docWidget.submit:null)})};this.funcs.push(func);var func2=function(){$("#input"+self.index+
"_"+self.docWidget.id).keydown(function(e){if(e.keyCode==13||self.getType()!=ENUM&&!$(self.widget).hasClass("autocomplete")&&(e.keyCode==38||e.keyCode==40)){e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();e.preventDefault()}var fields=$($("#"+self.docWidget.id).find("input,textarea,select").filter(":visible").filter(":enabled").filter(":not([readonly='readonly'])").toArray().sort(function(a,b){return(a.tabIndex>0?a.tabIndex:1E3)-(b.tabIndex>0?b.tabIndex:1E3)}));if($(self.widget).hasClass("datepicker"))$(self.widget).datepicker("hide");
if(e.keyCode==13||e.keyCode==40)$(fields.eq((fields.index($(self.widget))+1)%fields.length)).focus();else $(fields.eq((fields.index($(self.widget))-1)%fields.length)).focus();self.docWidget.spreadValue(self.name,self.indexObject,self.getVal());self.docWidget.verify(self,self.docWidget.isUpdateOnChange()?self.docWidget.submit:null)}})};this.funcs.push(func2)}}});$.docWidget=function(element,options){this.initConfig(options);this.initElement(element);this.load()};$.extend($.docWidget,{defaults:{loadui:"enable",
loadtext:"Chargement",loadimg:"../stylesheets/images/ajax-loader.gif",submitbtn:null,submittext:"Sauvegarder",submiticon:"ui-icon-disk",cancelbtn:null,canceltext:"Annuler",cancelicon:"ui-icon-cancel",wizard:false,updateOnChange:false,editable:true,autoComplete:true,postDiff:false,config:null,element:null,objects:null,schemas:null,photoDiv:"",titleFixed:"",informationHtmlText:"",counter:0,margin:0,forms:[],listOfAttributes:[]},prototype:{initElement:function(element){this.id=element.id;this.element=
element;$(element).addClass("form");if(this.config.loadui==="enable"||this.config.loadui===true||this.config.loadui==="block"){$(element).append("<div class='ui-widget-overlay' id='lui_"+this.id+"' style='display: none;'></div>");$(element).append("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"' style='display: none;z-index:2;position:relative'>"+(this.config.loadimg?"<img src='"+this.config.loadimg+"' />":"")+this.config.loadtext+"</div>")}$(element).append("<div id='errorGlobal_"+
this.id+"' class='errorGlobal'></div>");if(this.config.popup===true){$(element).append("<div id='wizard_"+this.id+"' class='wizardPopup'></div>");$(element).append("<div id='tabs_"+this.id+"' style='display:none;top:"+this.config.margin+"px'><ul id='ul_"+this.id+"' class='ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'></ul></div>")}else{$(element).append("<div id='wizard_"+this.id+"' style='top:"+this.config.margin+"px' class='wizard'></div>");$(element).append("<div id='tabs_"+
this.id+"' style='display:none;top:"+(71+this.config.margin)+"px'><ul id='ul_"+this.id+"' class='ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'></ul></div>")}},initConfig:function(options){this.config=$.extend(true,{},$.docWidget.defaults,options||{});this.genereFuncs();this.objects=new $.objects;this.schemas=new $.schemas;this.forms=new Array;this.listOfAttributes=new Array},beginLoad:function(){if(this.config.loadui==="disable"||this.config.loadui===false)return;
else if(this.config.loadui==="enable"||this.config.loadui===true)$("#load_"+this.id).show();else if(this.config.loadui==="block"){$("#lui_"+this.id).show();$("#load_"+this.id).show()}else if(typeof this.config.loadui==="string")$(this.config.loadui).show()},endLoad:function(){var self=this;if(this.config.loadui==="disable"||this.config.loadui===false)return;else if(this.config.loadui==="enable"||this.config.loadui===true)$("#load_"+this.id).hide();else if(this.config.loadui==="block"){$("#lui_"+this.id).hide();
$("#load_"+this.id).hide()}else if(typeof this.config.loadui==="string")$(this.config.loadui).hide();TesterDevise(leContact.pays==undefined||leContact.pays=="RE"||leContact.pays=="GP"||leContact.pays=="MQ"||leContact.pays=="GF"||leContact.pays=="YT"?"FR":leContact.pays,self);window.onbeforeunload=function(e){self.saveAllAttributes();if(!self.isUpdateOnChange()&&self.occurModifications()){if($.isFunction(self.config.quit))self.config.quit();return}else if(self.isUpdateOnChange()&&!self.submit(true))return;
else if($.isFunction(self.config.quit))self.config.quit()}},avertQuit:function(e){e=e||window.event;if(e)e.returnValue="Si vous quittez la page, vos donn\u00e9es ne seront pas enregistr\u00e9es.";return"Si vous quittez la page, vos donn\u00e9es ne seront pas enregistr\u00e9es."},load:function(){var self=this;this.beginLoad();document.title=this.config.title;$.each(this.config.forms,function(){self.schemas.add(this);self.objects.add(this,self.schemas.length()-1)});new $.loader(this.afterLoad,this)},
afterLoad:function(){var self=this;$("#tabs_"+this.id).show();var counter=0;$.each(this.config.forms,function(){$.extend(this,$.extend(true,{},{group:"",editable:true},this));var indexObject=self.objects.liste.getExisting({"getObject":this.getObject,"type":this.type});if(!self.forms.exists({"title":this.title})){var li=$("<li id='ul"+counter+"_"+self.id+"' numero="+counter+" onmousedown='return false;'></li>").addClass("form-tab").addClass("ui-state-default").addClass("ui-corner-top");var a=$("<a href='#tabs_"+
self.id+"-"+counter+"'></a>");var span=$("<span>"+this.title+"</span>").addClass("form-group-title").addClass("object"+this.type).css("display","inline");a.append(span);li.append(a);var span2=$("<span id='verrou"+counter+"_"+self.id+"'>&nbsp;</span>").addClass("form-tab-icon").addClass("ui-icon").addClass("ui-icon-locked").addClass("imgcle").css("display","inline").css("padding-left","15px");a.append(span2);if(this.editable&&self.isEditable())span2.hide();$("#tabs_"+self.id+" ul").append(li);var div=
$("<div id='tabs_"+self.id+"-"+counter+"'></div>");var div2=$("<div id='errorGlobal_"+self.id+"-"+counter+"'></div>").addClass("errorGlobal");var div3=$("<div id='informationGlobal_"+self.id+"-"+counter+"'></div>");div.append(div2);div.append(div3);$("#tabs_"+self.id).append(div);self.forms.push(self.newForm(this,counter,indexObject));counter++}else self.forms.push(self.newForm(this,self.forms[self.forms.getExisting({"title":this.title})].tab,indexObject));if($.isFunction(this.afterLoadObject))this.afterLoadObject(self.objects.get(indexObject).obj,
indexObject)});this.drawForms();this.initWizard();this.wizard.manage(0);if($.isFunction(this.config.afterLoad))this.config.afterLoad();this.endLoad()},tabNb:function(){return $("#ul_"+this.id+" li").length},tabActive:function(){var active=0;$("#tabs_"+this.id+" li").each(function(){if($(this).hasClass("ui-state-active"))active=$(this).attr("numero")});return parseInt(active,10)},initWizard:function(){var self=this;this.wizard=new $.wizard;this.wizard.init(this);$("#tabs_"+this.id).tabs({beforeActivate:function(event,
ui){self.wizard.manage(ui.newTab.index())},show:function(event,ui){self.wizard.manage(ui.index)}})},foldOut:function(input){this.foldOutChildren($(this.listOfAttributes[input].widget),$("#tabs_"+this.id+"-"+this.listOfAttributes[input].indexTab),{"res":false},this.listOfAttributes[input].indexTab)},foldOutChildren:function(input,inputParent,res,indexTab){var self=this;var all=inputParent.children();all.each(function(){if($(this).attr("id")==input.attr("id")){res.res=true;return false}else self.foldOutChildren(input,
$(this),res,indexTab);if(res.res){if(indexTab!=self.tabActive())try{$("#tabs_"+this.id).tabs("select",indexTab)}catch(e){$("#tabs_"+this.id).tabs("option","active",indexTab)}if(this.nodeName=="FIELDSET"&&!$(this).children(".form-group-content").is(":visible"))$(this).children(".form-group-titlebar").click();return false}})},getAttribute:function(id){var ret=null;$.each(this.listOfAttributes,function(i){if(this.widget=="#"+id||this.widget==id){ret=i;return false}});return ret},isRequiredField:function(field,
value){var ret=true;$.each(this.listOfAttributes,function(i){if(this.name==field){ret=value==$(this.widget).val();return false}});return ret},newForm:function(form,tab,indexObj){return $.extend({"tab":tab,"index":indexObj},form||{})},howManyGroupInForm:function(tab){return this.forms.where(function(f){return f.tab==tab}).length},genereFuncs:function(){var self=this;for(var key in this.config)if(typeof this.config[key]=="boolean"){var obj=new Object;var objToEval="obj['is"+key.charAt(0).toUpperCase()+
key.substring(1)+"'] = function(){return self.config['"+key+"'];}";eval(objToEval);$.extend(this,obj)}},isEditableForm:function(tab){return this.forms.where(function(f){return f.tab==tab})[0].editable},drawForms:function(){var self=this;for(var u=0;u<this.forms.length;u++)this.drawForm(this.forms[u],u);$.each(this.listOfAttributes,function(){if(!self.isEditable()||!self.isEditableForm(this.indexTab))this.disable()});$.each(this.listOfAttributes,function(){for(var j=0;j<this.funcs.length;j++)this.funcs[j]()});
$.each(this.listOfAttributes,function(){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()});this.areValidAllAttributes()},drawForm:function(form,u){var currentCounter=this.counter;if(form.group!=null&&form.group!=""&&this.howManyGroupInForm(form.tab)>1){var mySchema=this.objects.propertiesOfGroup(this.schemas.get(this.objects.get(form.index).indexSchema).obj,form.group);if(mySchema==null)return;if(form.open===true)mySchema.open=true;var attrTmp=new $.attribute(this,mySchema,this.listOfAttributes.length+
1,form.index,form.tab,0,"");this.listOfAttributes.push(new $.attrGroup(attrTmp));var tb=$("<table></table>").addClass("form-tab-content-table");tb.append(this.listOfAttributes.last().draw(this.objects.value(form.index,attrTmp.name),false));$("#tabs_"+this.id+"-"+form.tab).append(tb)}else{var attrTmp=new $.attribute(this,new Object({"type":"group","title":form.group,"name":"group"+this.listOfAttributes.length+1,"index":this.listOfAttributes.length+1}),this.listOfAttributes.length+1,form.index,form.tab,
0,"");this.listOfAttributes.push(new $.attrGroup(attrTmp));$("#tabs_"+this.id+"-"+form.tab).append("<div id='sub"+this.listOfAttributes.length+"_"+this.id+"'></div>")}var divSub="sub"+this.listOfAttributes.length+"_"+this.id;$("#"+divSub).addClass("form-tab-content").append(this.drawFormContent(form.index,form.group,form.tab,1,this.listOfAttributes[this.listOfAttributes.length-1].widget));if($("#"+divSub+" table").length>0&&$("#"+divSub+" table tr").length===0&&form.htmlIfEmpty!=null)$("#"+divSub+
" table").append("<tr><td>"+form.htmlIfEmpty+"</td></tr>")},drawFormContent:function(index,group,indexTab,niveau,parent){var mySchema=this.objects.schemaOfGroup(this.schemas.get(this.objects.get(index).indexSchema).obj,group);var html=$("<table></table>").addClass("form-tab-content-table");for(var p in mySchema)if(!$.isFunction(mySchema[p]))html.append(this.drawAttribute(mySchema[p],index,indexTab,niveau,parent));return html},drawAttribute:function(attr,indexObj,indexTab,niveau,parent){var attrTmp=
new $.attribute(this,attr,this.listOfAttributes.length+1,indexObj,indexTab,niveau,parent);switch(attrType(attr)){case TABLE:this.listOfAttributes.push(new $.attrTable(attrTmp));break;case ENUM:this.listOfAttributes.push(new $.attrEnum(attrTmp));break;case BOOL:this.listOfAttributes.push(new $.attrBool(attrTmp));break;case STRING:this.listOfAttributes.push(new $.attrString(attrTmp));break;case DATE:this.listOfAttributes.push(new $.attrDate(attrTmp));break;case URL:this.listOfAttributes.push(new $.attrUrl(attrTmp));
break;case INTEGER:this.listOfAttributes.push(new $.attrInteger(attrTmp));break;case NUMBER:this.listOfAttributes.push(new $.attrNumber(attrTmp));break;case GROUP:this.listOfAttributes.push(new $.attrGroup(attrTmp));break;default:this.listOfAttributes.push(attrTmp);break}return this.listOfAttributes.last().draw(this.objects.value(indexObj,attr.name))},spreadValue:function(name,indexObj,val,except){$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj&&this.name==name)if(val!=null)this.setVal(val,
except);else this.empty()})},spreadValueNull:function(name,indexObj){$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj&&this.name==name)this.empty()})},loadObject:function(obj,indexObj,verrou){var self=this;var objToLoad=this.objects.get(indexObj);if(verrou===true){this.objects.get(indexObj).obj=new $.jsonObject;var urlAutoComp=this.objects.get(indexObj).autoCompletePost;if(urlAutoComp&&urlAutoComp!=""){var date="@"+(new Date).formatForURL()+"@";if(this.objects.get(indexObj).getObject.split("?").length>
1){var resReg=this.objects.get(indexObj).getObject.split("?")[1].match(new RegExp("date=@.*@"));if(resReg)date=resReg[0].replace("date=","")}$.extend(obj,{"date":date});var url=Mustache.render(urlAutoComp,obj);this.objects.set(indexObj,{"savePostObject":this.objects.get(indexObj).postObject});var resReg2=url.split("?")[1].match(new RegExp("date=@.*@"));var newUrl=url;if(resReg2){newUrl=url.replace(resReg2[0],"");if($.trim(newUrl.split("?")[1])=="")newUrl=newUrl.split("?")[0]}this.objects.set(indexObj,
{"postObject":newUrl});if(this.objects.get(indexObj).lastPost===true)$(this.element).data("lastPost",url)}}$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj)if(verrou===true){this.disable();$("#verrou"+this.indexTab+"_"+self.id).show();this.empty()}});$.each(obj,function(attr,value){if(attr!="value"&&attr!="label"){objToLoad.obj[attr]=value;self.spreadValue(attr,indexObj,value)}});$.each(this.objects.get(indexObj).description,function(attr,value){if(obj[attr]===undefined)self.spreadValue(attr,
indexObj,null);if(attr!="value"&&attr!="label"&&attr!="timestamp"&&obj[attr]==null)self.spreadValue(attr,indexObj,value)});if(verrou==true)$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj&&this.getType()==GROUP&&this.transparent===true&&!this.isEmptyGroupTransparent()){this.folded=true;$("#legend"+this.index+"_"+self.id).click()}});$.each(this.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()})},emptyObject:function(indexObj,verrou){var self=
this;$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj)this.empty()});this.objects.get(indexObj).obj=new $.jsonObject;for(var o in this.objects.get(indexObj).description)if(!$.isFunction(this.objects.get(indexObj).obj)){self.objects.get(indexObj).obj[o]=self.objects.get(indexObj).description[o]?self.objects.get(indexObj).description[o]:"";self.spreadValue(o,indexObj,self.objects.get(indexObj).obj[o])}this.objects.set(indexObj,{"postObject":this.objects.get(indexObj).savePostObject});
if(this.objects.get(indexObj).lastPost===true)$(this.element).data("lastPost",this.objects.get(indexObj).postObject);if(self.isEditable())$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj&&self.isEditableForm(this.indexTab)){$("#verrou"+this.indexTab+"_"+self.id).hide();if(this.editable&&(!$.isFunction(this.disableJS)||!(this.disableJSValue===true)))this.enable()}});$.each(this.listOfAttributes,function(){if(this.indexObject==indexObj&&this.getType()==GROUP&&this.transparent===
true){this.folded=true;$("#legend"+this.index+"_"+self.id).click()}});$.each(this.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()})},hideAllAnnulAutoComplete:function(){var self=this;$.each(this.listOfAttributes,function(){if($("#annulAutoComplete"+this.index+"_"+self.id).Exists())$("#annulAutoComplete"+this.index+"_"+self.id).hide()})},showAllAnnulAutoComplete:function(){var self=this;$.each(this.listOfAttributes,function(){if($("#annulAutoComplete"+this.index+
"_"+self.id).Exists())$("#annulAutoComplete"+this.index+"_"+self.id).show()})},hide:function(name){$('tr[name="'+name+'"]').each(function(){$(this).hide()})},show:function(name){$('tr[name="'+name+'"]').each(function(){$(this).show()})},areValidAllAttributesAllOnglet:function(){var self=this;var indexTab=this.tabActive();var fieldError=!this.areValidAllAttributes(indexTab);if(!fieldError){var i=indexTab+1;while(i<this.tabNb()&&!fieldError){$.each(this.listOfAttributes,function(j){self.foldOut(j);
if(this.required&&$(this.widget).val()==""&&this.indexTab==i){fieldError=true;indexTab=i}});i++}}if(fieldError){try{$("#tabs_"+this.id).tabs("select",indexTab)}catch(e){$("#tabs_"+this.id).tabs("option","active",indexTab)}return false}return!fieldError},areValidAllAttributes:function(tab){var self=this;var text="";$.each(this.listOfAttributes,function(i){if((tab==null||this.indexTab==tab)&&!this.isValid()){self.foldOut(i);if(text=="")$(this.widget).focus();text+="<li>"+this.title+"</li>"}});if(text!=
"")text="<div>Champ(s) de saisie incorrect(s) :<ul>"+text+"</ul></div>";var infor=this.config.informationHtmlText;self.information(infor,tab?tab:self.tabActive());self.error(text,tab?tab:self.tabActive());return text==""},cancel:function(){if($.isFunction(this.config.cancel)){for(var i=0;i<this.objects.length();i++)if(this.objects.isModified(i)){if(confirm("Si vous quittez la page, vos donn\u00e9es ne seront pas enregistr\u00e9es. Etes-vous s\u00fbr de vouloir quitter ?"))this.config.cancel();return false}this.config.cancel()}},
occurModifications:function(){for(var i=0;i<this.objects.length();i++)if(this.objects.isModified(i))return true;return false},saveAllAttributes:function(){var self=this;var ref=null;if($("input:focus").length!=0)ref=$("input:focus");else if($("textarea:focus").length!=0)ref=$("textarea:focus");if(ref!=null){$.each(this.listOfAttributes,function(i){if(this.widget=="#"+ref.attr("id")){self.objects.get(this.indexObject).obj[this.name]=this.getVal();self.spreadValue(this.name,this.indexObject,this.getVal())}});
$.each(this.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()})}else $.each(this.listOfAttributes,function(i){if($(this.widget).hasClass("autocomplete"))this.forceclose()})},submit:function(quit){var self=this;if($.isFunction(this.config.submit))return this.config.submit();else{this.saveAllAttributes();$.each(self.listOfAttributes,function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()});var validContact=false;if(quit==true&&this.config.submitbtn!=
"")validContact=this.areValidAllAttributesAllOnglet();else validContact=this.areValidAllAttributes();if(validContact==true){res=true;$.each(this.listOfAttributes,function(i){if(this.getType()==TABLE)this.deleteEditingLines()});for(var i=0;i<this.objects.length();i++)if(this.objects.isModified(i)){var obj=this.objects.get(i);if($.isFunction(obj.post))obj.post();else $.ajax({url:self.objects.get(i).postObject,async:false,cache:false,data:JSON.stringify(self.objects.writeNewDesc(i,self.isPostDiff(),
true)),type:obj.ajaxType?obj.ajaxType:"POST",contentType:"json",beforeSend:function(xhr){if(self.config.put===true)xhr.setRequestHeader("X-HTTP-Method-Override","PUT")},error:function(jqXHR,textStatus,errorThrown){$("#errorGlobal_"+self.id).text(textStatus)},success:function(){self.objects.set(i,{"description":self.objects.writeNewDesc(i,false)});if($.isFunction(self.config.afterCommit))self.config.afterCommit();if(quit!=null&&quit&&i==self.objects.length()-1)if($.isFunction(self.config.quit))self.config.quit()}})}else if(quit!=
null&&quit&&i==self.objects.length()-1)if($.isFunction(self.config.quit))self.config.quit();return true}}return false},verify:function(attr,callback){var self=this;if(attr.checkable){this.saveAllAttributes();var urlAvant=self.objects.get(attr.indexObject).postObject.split("?")[0];var urlApres=self.objects.get(attr.indexObject).postObject.split("?")[1];if(urlApres==null)urlFinale=urlAvant+"/$service/check?check="+attr.name;else urlFinale=urlAvant+"/$service/check?check="+attr.name+"&"+urlApres;$.ajax({url:urlFinale,
async:false,cache:false,data:JSON.stringify(self.objects.writeNewDesc(attr.indexObject,false,true)),type:"POST",contentType:"json",success:function(data){var res=data;if(res.errorMessage!=null&&res.errorMessage!=""){$("#"+self.id).append("<div id='dialog_"+self.id+"' title='Attention'><p style='color:#000'>"+res.errorMessage+"</p></div>");$("#dialog_"+self.id).dialog({modal:true,autoOpen:false});$("#dialog_"+self.id).dialog("option","buttons",{"Ok":function(){$(this).dialog("close");$(this).remove()}});
$("#dialog_"+self.id).dialog("open")}if(res.object!=null)self.loadObject(res.object,attr.indexObject);if($.isFunction(callback))callback.call(self)},error:function(data){if(data.responseText)try{var res=JSON.parse(data.responseText);if(attr.getType()==BOOL){self.objects.get(attr.indexObject).obj[attr.name]=self.objects.get(attr.indexObject).description[attr.name]===true?true:false;self.spreadValue(attr.name,attr.indexObject,self.objects.get(attr.indexObject).obj[attr.name])}else{self.objects.get(attr.indexObject).obj[attr.name]=
self.objects.get(attr.indexObject).description[attr.name]?self.objects.get(attr.indexObject).description[attr.name]:"";self.spreadValue(attr.name,attr.indexObject,self.objects.get(attr.indexObject).obj[attr.name])}if(res.errorMessage!=null&&res.errorMessage!=""){$("#"+self.id).append("<div id='dialog_"+self.id+"' title='Erreur'><p>"+res.errorMessage+"</p></div>");$("#dialog_"+self.id).dialog({modal:true,autoOpen:false});$("#dialog_"+self.id).dialog("option","buttons",{"Ok":function(){$(this).dialog("close");
$(this).remove();$(attr.widget).focus()}});$("#dialog_"+self.id).dialog("open")}else $(attr.widget).focus()}catch(e){alert("Erreur au niveau de la donn\u00e9e saisie.");self.objects.get(attr.indexObject).obj[attr.name]=self.objects.get(attr.indexObject).description[attr.name]?self.objects.get(attr.indexObject).description[attr.name]:"";self.spreadValue(attr.name,attr.indexObject,self.objects.get(attr.indexObject).obj[attr.name])}}})}else if(attr.checkableJS&&$.isFunction(attr.checkableJS)){var callBackError=
function(){if(attr.getType()==BOOL){self.objects.get(attr.indexObject).obj[attr.name]=self.objects.get(attr.indexObject).description[attr.name]===true?true:false;self.spreadValue(attr.name,attr.indexObject,self.objects.get(attr.indexObject).obj[attr.name])}else{self.objects.get(attr.indexObject).obj[attr.name]=self.objects.get(attr.indexObject).description[attr.name]?self.objects.get(attr.indexObject).description[attr.name]:"";self.spreadValue(attr.name,attr.indexObject,self.objects.get(attr.indexObject).obj[attr.name])}$.each(self.listOfAttributes,
function(i){for(var j=0;j<this.conditions.length;j++)this.conditions[j]()})};var callBackSuccess=function(newObj){var self=this;if(newObj!=null)self.loadObject(newObj,attr.indexObject);else self.loadObject(self.objects.get(attr.indexObject).obj,attr.indexObject);if($.isFunction(callback))callback.call(self)};attr.checkableJS(self.objects.get(attr.indexObject).obj,callBackError,callBackSuccess,self)}else if($.isFunction(callback))callback.call(self)},isFunction_Modif:function(classname,attrname){var fn=
$coala[classname+"_"+attrname+"_MODIF"];if($.isFunction(fn))return fn},isFunction_Gris:function(classname,attrname){var fn=$coala[classname+"_"+attrname+"_GRIS"];if($.isFunction(fn))return fn},isFunction_Bulle:function(classname,attrname){var fn=$coala[classname+"_"+attrname+"_BULLE"];if($.isFunction(fn))return fn},isFunction_Liste:function(classname,attrname){var fn=$coala[classname+"_"+attrname+"_LISTE"];if($.isFunction(fn))return fn},error:function(msg,indexTab){for(var i=0;i<this.tabNb();i++)$("#errorGlobal_"+
this.id+"-"+i).empty();$("#errorGlobal_"+this.id+"-"+indexTab).html(msg)},information:function(msg,indexTab){$("#informationGlobal_"+this.id+"-"+indexTab).html(msg)}}});$.fn.extend({widget:function(options,value){if(typeof options=="string")if(value!=null&&typeof value=="string"){$(this).empty();return this.each(function(){var optionsMod=$(this).data("optionsDocWidget");optionsMod[options]=value;var docWidget=new $.docWidget(this,optionsMod);$(this).data("docWidget",docWidget);$(this).data("optionsDocWidget",
optionsMod)})}return this.each(function(){if($(this).data("docWidget"))return;var docWidget=new $.docWidget(this,options);$(this).data("docWidget",docWidget);$(this).data("optionsDocWidget",options)})}});String.prototype.contains=function(it){if(this!="")return this.indexOf(it)!=-1;else return 0};String.prototype.btoa=function(){var output="";var _keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=this.utf8_encode();while(i<
input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2))enc3=enc4=64;else if(isNaN(chr3))enc4=64;output=output+_keyStr.charAt(enc1)+_keyStr.charAt(enc2)+_keyStr.charAt(enc3)+_keyStr.charAt(enc4)}return output};String.prototype.utf8_encode=function(){var string=this.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128)utftext+=
String.fromCharCode(c);else if(c>127&&c<2048){utftext+=String.fromCharCode(c>>6|192);utftext+=String.fromCharCode(c&63|128)}else{utftext+=String.fromCharCode(c>>12|224);utftext+=String.fromCharCode(c>>6&63|128);utftext+=String.fromCharCode(c&63|128)}}return utftext};Array.prototype.last=function(){return this[this.length-1]};Array.prototype.isLike=function(array){var ret=true;if(array==null||this.length!=array.length)return false;else for(var i=0;i<this.length;i++)for(var o in this[i])if(this[i][o]!=
array[i][o])ret=false;return ret};Array.prototype.exists=function(obj){for(var i=0;i<this.length;i++){var res=true;for(var cle in obj)res&=this[i][cle]==obj[cle];if(res)return true}return false};Array.prototype.getExisting=function(obj){for(var i=0;i<this.length;i++){var res=true;for(var cle in obj)res&=this[i][cle]==obj[cle];if(res)return i}return-1};Array.prototype.where=function(predicate){var derivedArray=[];for(i=0;i<this.length;i+=1)if(predicate(this[i]))derivedArray.push(this[i]);return derivedArray};
Date.prototype.format=function(){return this.getFullYear()+"-"+pad2(this.getMonth()+1)+"-"+pad2(this.getDate())+"T"+pad2(this.getHours())+":"+pad2(this.getMinutes())+":"+pad2(this.getSeconds())+"Z"};Date.prototype.formatForURL=function(){return this.getFullYear()+"-"+(this.getMonth()+1)+"-"+this.getDate()};function isValidDate(date){if(date=="__/__/____")return true;var bits=date.split("/");var d=new Date(bits[2],bits[1]-1,bits[0]);return d&&d.getMonth()+1==bits[1]&&d.getDate()==Number(bits[0])}$.fn.Exists=
function(){return this.length};function pad2(n){return(n<10?"0":"")+n}$.extend($.jgrid.ajaxOptions,{async:false});function saveRowSync(rowid,successfunc,url,extraparam,aftersavefunc,errorfunc,afterrestorefunc){var args=$.makeArray(arguments).slice(1),o={};if($.type(args[0])==="object")o=args[0];else{if($.isFunction(successfunc))o.successfunc=successfunc;if(typeof url!=="undefined")o.url=url;if(typeof extraparam!=="undefined")o.extraparam=extraparam;if($.isFunction(aftersavefunc))o.aftersavefunc=aftersavefunc;
if($.isFunction(errorfunc))o.errorfunc=errorfunc;if($.isFunction(afterrestorefunc))o.afterrestorefunc=afterrestorefunc}o=$.extend(true,{successfunc:null,url:null,extraparam:{},aftersavefunc:null,errorfunc:null,afterrestorefunc:null,restoreAfterError:true,mtype:"POST"},$.jgrid.inlineEdit,o);var success=false;var $t=this[0],nm,tmp={},tmp2={},tmp3={},editable,fr,cv,ind;if(!$t.grid)return success;ind=$($t).jqGrid("getInd",rowid,true);if(ind===false)return success;editable=$(ind).attr("editable");o.url=
o.url?o.url:$t.p.editurl;if(editable==="1"){var cm;$('td[role="gridcell"]',ind).each(function(i){cm=$t.p.colModel[i];nm=cm.name;if(nm!="cb"&&nm!="subgrid"&&cm.editable===true&&nm!="rn"&&!$(this).hasClass("not-editable-cell")){switch(cm.edittype){case "checkbox":var cbv=["Yes","No"];if(cm.editoptions)cbv=cm.editoptions.value.split(":");tmp[nm]=$("input",this).is(":checked")?cbv[0]:cbv[1];break;case "text":case "password":case "textarea":case "button":tmp[nm]=$("input, textarea",this).val();break;case "select":if(!cm.editoptions.multiple){tmp[nm]=
$("select option:selected",this).val();tmp2[nm]=$("select option:selected",this).text()}else{var sel=$("select",this),selectedText=[];tmp[nm]=$(sel).val();if(tmp[nm])tmp[nm]=tmp[nm].join(",");else tmp[nm]="";$("select option:selected",this).each(function(i,selected){selectedText[i]=$(selected).text()});tmp2[nm]=selectedText.join(",")}if(cm.formatter&&cm.formatter=="select")tmp2={};break;case "custom":try{if(cm.editoptions&&$.isFunction(cm.editoptions.custom_value)){tmp[nm]=cm.editoptions.custom_value.call($t,
$(".customelement",this),"get");if(tmp[nm]===undefined)throw"e2";}else throw"e1";}catch(e){if(e=="e1")$.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,$.jgrid.edit.bClose);if(e=="e2")$.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);else $.jgrid.info_dialog($.jgrid.errors.errcap,e.message,$.jgrid.edit.bClose)}break}cv=$.jgrid.checkValues(tmp[nm],i,$t);if(cv[0]===false){cv[1]=tmp[nm]+" "+
cv[1];return false}if($t.p.autoencode)tmp[nm]=$.jgrid.htmlEncode(tmp[nm]);if(o.url!=="clientArray"&&cm.editoptions&&cm.editoptions.NullIfEmpty===true)if(tmp[nm]==="")tmp3[nm]="null"}});if(cv[0]===false){try{var positions=$.jgrid.findPos($("#"+$.jgrid.jqID(rowid),$t.grid.bDiv)[0]);$.jgrid.info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]})}catch(e){alert(cv[1])}return success}var idname,opers,oper;opers=$t.p.prmNames;oper=opers.oper;idname=opers.id;if(tmp){tmp[oper]=
opers.editoper;tmp[idname]=rowid;if(typeof $t.p.inlineData=="undefined")$t.p.inlineData={};tmp=$.extend({},tmp,$t.p.inlineData,o.extraparam)}if(o.url=="clientArray"){tmp=$.extend({},tmp,tmp2);if($t.p.autoencode)$.each(tmp,function(n,v){tmp[n]=$.jgrid.htmlDecode(v)});var resp=$($t).jqGrid("setRowData",rowid,tmp);$(ind).attr("editable","0");for(var k=0;k<$t.p.savedRow.length;k++)if($t.p.savedRow[k].id==rowid){fr=k;break}if(fr>=0)$t.p.savedRow.splice(fr,1);$($t).triggerHandler("jqGridInlineAfterSaveRow",
[rowid,resp,tmp,o]);if($.isFunction(o.aftersavefunc))o.aftersavefunc.call($t,rowid,resp);success=true;$(ind).unbind("keydown")}else{$("#lui_"+$.jgrid.jqID($t.p.id)).show();tmp3=$.extend({},tmp,tmp3);tmp3[idname]=$.jgrid.stripPref($t.p.idPrefix,tmp3[idname]);$.ajax($.extend({url:o.url,data:$.isFunction($t.p.serializeRowData)?$t.p.serializeRowData.call($t,tmp3):tmp3,type:o.mtype,async:false,complete:function(res,stat){$("#lui_"+$.jgrid.jqID($t.p.id)).hide();if(stat==="success"){var ret=true,sucret;
sucret=$($t).triggerHandler("jqGridInlineSuccessSaveRow",[res,rowid,o]);if(!$.isArray(sucret))sucret=[true,tmp];if(sucret[0]&&$.isFunction(o.successfunc))sucret=o.successfunc.call($t,res);if($.isArray(sucret)){ret=sucret[0];tmp=sucret[1]?sucret[1]:tmp}else ret=sucret;if(ret===true){if($t.p.autoencode)$.each(tmp,function(n,v){tmp[n]=$.jgrid.htmlDecode(v)});tmp=$.extend({},tmp,tmp2);$($t).jqGrid("setRowData",rowid,tmp);$(ind).attr("editable","0");for(var k=0;k<$t.p.savedRow.length;k++)if($t.p.savedRow[k].id==
rowid){fr=k;break}if(fr>=0)$t.p.savedRow.splice(fr,1);$($t).triggerHandler("jqGridInlineAfterSaveRow",[rowid,res,tmp,o]);if($.isFunction(o.aftersavefunc))o.aftersavefunc.call($t,rowid,res);success=true;$(ind).unbind("keydown")}else{$($t).triggerHandler("jqGridInlineErrorSaveRow",[rowid,res,stat,null,o]);if($.isFunction(o.errorfunc))o.errorfunc.call($t,rowid,res,stat,null);if(o.restoreAfterError===true)$($t).jqGrid("restoreRow",rowid,o.afterrestorefunc)}}},error:function(res,stat,err){$("#lui_"+$.jgrid.jqID($t.p.id)).hide();
$($t).triggerHandler("jqGridInlineErrorSaveRow",[rowid,res,stat,err,o]);if($.isFunction(o.errorfunc))o.errorfunc.call($t,rowid,res,stat,err);else try{$.jgrid.info_dialog($.jgrid.errors.errcap,'<div class="ui-state-error">'+res.responseText+"</div>",$.jgrid.edit.bClose,{buttonalign:"right"})}catch(e){alert(res.responseText)}if(o.restoreAfterError===true)$($t).jqGrid("restoreRow",rowid,o.afterrestorefunc)}},$.jgrid.ajaxOptions,$t.p.ajaxRowOptions||{}))}}else return true;return success}$coala={}})(jQuery);$.isAValidSiren=function(siren){var r;if(siren.length==9&&siren.match(/^(\d){9}$/)){var sum=0;var i_char,oddsum;for(var i=0;i<siren.length;i++){i_char=parseInt(siren[i]);if((i+1)%2==0){oddsum=(2*i_char).toString();for(var j=0;j<oddsum.length;j++)sum+=parseInt(oddsum[j])}else sum+=i_char}sum%10==0?r=true:r=false}else r=false;return r};
$.isValidSiren=function(siren,isOperatingCompany,sirenOrganisation){var r;var toControl=true;if(typeof siren==="undefined")r=false;else{if(isOperatingCompany&&typeof sirenOrganisation==="undefined"){r=false;return r}if(isOperatingCompany&&sirenOrganisation.indexOf("ORG")>=0)if(siren.indexOf("OPE")>=0){toControl=false;r=true}else{toControl=false;r=false}else if(!isOperatingCompany&&siren.indexOf("ORG")>=0){toControl=false;r=true}}if(typeof siren!=="undefined"&&toControl)r=$.isAValidSiren(siren);return r};
$.isValidSiret=function(siret){if(siret==null||siret=="")return false;return siret.length==14};
$.isValidDate=function(date){var r=true;if(date.length!=10)r=false;else{var i_day=date.substring(0,2);var i_month=date.substring(3,5);var i_year=date.substring(6,11);var leap=(new Date(i_year,1,1)).getMonth()==(new Date(i_year,1,29)).getMonth()?1:0;if(i_year!="")if(i_year<1900)r=false;else if(leap==0)switch(i_month){case "02":if(i_day<1||i_day>28)r=false;break;case "04":case "06":case "09":case "11":if(i_day<1||i_day>30)r=false;break;case "01":case "03":case "05":case "07":case "08":case "10":case "12":if(i_day<
1||i_day>31)r=false;break;default:r=false;break}else switch(i_month){case "02":if(i_day<1||i_day>29)r=false;break;case "04":case "06":case "09":case "11":if(i_day<1||i_day>30)r=false;break;case "01":case "03":case "05":case "07":case "08":case "10":case "12":if(i_day<1||i_day>31)r=false;break;default:r=false;break}}return r};
$.convertJSDateObjectToHumanizedDateObject=function(js_date){var m=js_date.getMonth()+1;if(m<10)m="0"+m;var day=js_date.getDate();if(day<10)day="0"+day;var h=js_date.getHours();if(h<10)h="0"+h;var min=js_date.getMinutes();if(min<10)min="0"+min;var sec=js_date.getSeconds();if(sec<10)sec="0"+sec;return{year:js_date.getFullYear(),month:m,day:day,hour:h,min:min,sec:sec}};
$.convertISO8601DateToHumanizedDateObject=function(iso8601_date){return $.convertJSDateObjectToHumanizedDateObject(new Date(iso8601_date.substring(0,4),parseInt(iso8601_date.substring(5,7),10)-1,parseInt(iso8601_date.substring(8,10),10),iso8601_date.substring(11,13),iso8601_date.substring(14,16),iso8601_date.substring(17,19)))};
function GetObjetMongo(id,username,pw){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=_id eq '"+id+"'&include=personne"),username:username,password:pw,async:false,cache:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]});return res}
function GetAssociatedRole(personneId,username,pw,type){var r={};var url;if(type===undefined)url=encodeURI("/mongo/Role?where=personne eq '/mongo/Personne/"+personneId+"'&include=personne");else url=encodeURI("/mongo/Role?where=personne eq '/mongo/Personne/"+personneId+"' and type eq '"+type+"'&include=personne");$.ajax({type:"GET",url:url,username:username,password:pw,async:false,cache:false,postData:{format:"application/json",pageable:true,include:"personne"},success:function(data){r.status=true;
if(data!=null&&typeof data[0]!=="undefined")r.data=data[0]},error:function(jqXHR,textStatus,errorThrow){r.status=false;r.error="Une erreur s'est produite lors de la r\u00e9cup\u00e9ration du r\u00f4le (GET). "+"<br/> Signature de la m\u00e9thode : GetAssociatedRole(id, username, pw) "+"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText}});return r}$coala.Personne_codeCaisse_GRIS=function(obj,callback,plugin){return false};
$coala.Personne_pays_MODIF=function(obj,callback,plugin){TesterDevise(obj.pays=="RE"||obj.pays=="GP"||obj.pays=="MQ"||obj.pays=="GF"||obj.pays=="YT"?"FR":obj.pays,this.docWidget);return true};$coala.Personne_nomPays_MODIF=function(obj,callback,plugin){TesterDevise(obj.nomPays=="FRANCE"||obj.nomPays=="REUNION"||obj.nomPays=="GUADELOUPE"||obj.nomPays=="MARTINIQUE"||obj.nomPays=="GUYANE FRANCAISE"||obj.nomPays=="MAYOTTE"?"FR":obj.nomPays,this.docWidget);return true};
function TesterDevise(val,context){var elems=getListeOfNonValidatorItems(context);$.each(elems,function(key,value){value.devise=val=="FR"||val==""?null:val;value.addCodeForValidator();value.erreur.manage();context.areValidAllAttributes()})}
function getListeOfNonValidatorItems(context){var elems=new Array;var lst=["telephone","telephoneEtranger","mobile","fax","codePostal"];var i=0;for(i;i<context.listOfAttributes.length;i++)if(lst.indexOf(context.listOfAttributes[i].name)>-1)elems.push(context.listOfAttributes[i]);return elems}function isValidatorlessField(aField){var lst=["telephone","telephoneEtranger","mobile","fax","codePostal"];if(aField.indexOf())if(lst.indexOf(aField.name)>-1)return true;return false}
function hasValueInArrayOfObjects(array,key,value){if(typeof array!=="object"||array==null)return false;return $.grep(array,function(v){return typeof v==="object"&&v!=null&&v[key]==value}).length!=0}
$coala.Role_CodeBIC_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(obj.CodeBIC!=null&&obj.CodeBIC!=""){obj.CodeBIC=obj.CodeBIC.toUpperCase();if(obj.CodeBIC.length!=8&&obj.CodeBIC.length!=11){msg="Le Code BIC "+obj.CodeBIC+" est invalide. La longueur doit \u00eatre de 8 ou de 11 caract\u00e8res.";$("#div_dialogAlert").failDialog("Erreur",msg);callbackError.call(plugin)}}else obj.CodeBIC="";callbackSuccess.call(plugin,obj)};
$coala.Role_abIBANEtranger_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(obj.abIBANEtranger===true){msg="Si la case 'IBAN \u00e9tranger' est coch\u00e9e, vous ne pouvez pas renseigner les zones suivantes :<br/> <br/>'Code banque', 'Code guichet', 'Num\u00e9ro de compte', 'Cl\u00e9 RIB', 'Cl\u00e9 IBAN'";$("#div_dialogWarning").warningDialog("Information",msg,600);delete obj["CodeBanque"];delete obj["CodeGuichet"];delete obj["NumeroCompte"];delete obj["CleRIB"];callbackSuccess.call(plugin,
obj)}else callbackSuccess.call(plugin,obj)};$coala.Personne_contactCertifie_GRIS=function(obj,callbackError,callbackSuccess,plugin){$("#imgCertified").hide();if(obj.contactCertifie)$("#imgCertified").show();estUnContactCertifie=obj.contactCertifie;if("aLesDroitsCertificats"in urlParams){var aLesDroitsCertificats=urlParams["aLesDroitsCertificats"]=="true";if(aLesDroitsCertificats)return false}return true};
$coala.Personne_contactCertifie_MODIF=function(obj,callbackError,callbackSuccess,plugin){var now=new Date;var day=("0"+now.getDate()).slice(-2);var month=("0"+(now.getMonth()+1)).slice(-2);var hours=("0"+now.getHours()).slice(-2);var minutes=("0"+now.getMinutes()).slice(-2);var today=day+"/"+month+"/"+now.getFullYear()+" - "+hours+":"+minutes;if("codeCollabo"in urlParams)codeCollabo=urlParams["codeCollabo"];obj.contactCertifieLe=""+today;obj.contactCertifiePar=""+codeCollabo;$("#imgCertified").hide();
if(obj.contactCertifie)$("#imgCertified").show();else{obj.contactCertifieLe=" ";obj.contactCertifiePar=" ";obj.contactPartiellementCertifie=false;obj.contactPartiellementCertifieRaison=" "}callbackSuccess.call(plugin,obj)};
function GetObjetVille(codePostal,ville){var res=null;$.ajax({url:encodeURI("/mongo/Ville?where=codePostal eq '"+codePostal+"' and ville eq '"+ville+"'"),username:urlParams["codeCollabo"],password:urlParams["mdpCollabo"],async:false,cache:false,postData:{format:"application/json"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]});return res}
$coala.Personne_codePostal_MODIF=function(obj,callbackError,callbackSuccess,plugin){var res=GetObjetVille(obj.codePostal,obj.ville);if(res!=null){obj.codeInseeCommune=res.codeInsee;if(obj.codeInseeCommune.length==0){msg="Pas de correspondance code insee de commune pour le couple code postal/ville.";$("#div_dialogAlert").failDialog("Erreur",msg);callbackError.call(plugin)}callbackSuccess.call(plugin,obj)}};
$coala.Personne_ville_MODIF=function(obj,callbackError,callbackSuccess,plugin){var res=GetObjetVille(obj.codePostal,obj.ville);if(res!=null){obj.codeInseeCommune=res.codeInsee;if(obj.codeInseeCommune.length==0){msg="Pas de correspondance code insee de commune pour le couple code postal/ville.";$("#div_dialogAlert").failDialog("Erreur",msg);callbackError.call(plugin)}callbackSuccess.call(plugin,obj)}};
function GetBanquesDossier(idEtab){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=idEtablissement eq '"+idEtab+"' and type eq 'Banque'&include=personne"),username:urlParams["codeCollabo"],password:urlParams["mdpCollabo"],async:false,cache:false,postData:{format:"application/json"},type:"GET"}).success(function(data){if(data!=null)res=data});return res}
function GetEtablissementsDossier(idEtab,externalId){lst=new Array;if(window.chrome.webview.hostObjects.sync.external){var str=window.chrome.webview.hostObjects.sync.external.execCmd("GetEtablissementsDossier",externalId);var obj=$.parseJSON(str);for(ielt in obj){var key="nomEtb";var elt=obj[ielt];if(elt!=null&&elt!==undefined&&elt[key]!==undefined)lst.push(elt[key])}}return lst}
function GetIdEtablissement(idRole){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=_id eq '"+idRole+"'&include=personne"),username:urlParams["codeCollabo"],password:urlParams["mdpCollabo"],async:false,cache:false,postData:{format:"application/json"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]});return res}
function GetRoleDossier(idRole){var res=null;var type="Dossier";$.ajax({url:encodeURI("/mongo/Role?where=idEtablissement eq '"+idRole+"' and type eq '"+type+"'&include=personne"),username:urlParams["codeCollabo"],password:urlParams["mdpCollabo"],async:false,cache:false,postData:{format:"application/json"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]});return res}
getEtablissement=function(idEtablissement){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=idEtablissement eq '"+idEtablissement+"' and type eq 'Etablissement'"),username:urlParams["codeCollabo"],password:urlParams["mdpCollabo"],async:false,cache:false,postData:{format:"application/json"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]}).fail(function(un,deux,trois){alert("erreur ajax")});return res};
$coala.Role_contactBanque_LISTE=function(obj,callbackError,callbackSuccess,plugin){var roleObjectId=urlParams.reqRole;roleObjectId=roleObjectId.replace("/mongo/Role/","");var roleObject=GetIdEtablissement(roleObjectId);if(roleObject!=null){var res=GetBanquesDossier(roleObject.idEtablissement);if(res!=null)$.each(res,function(key,value){if(value.personne!==null&&value.personne!==undefined)if(value.nomAffiche!==undefined&&value.nomAffiche!==null)obj.values.push(value.nomAffiche+"/"+value._id);else if(typeof value.personne.fullName!==
undefined&&value.personne.fullName!==null)obj.values.push(value.personne.fullName+"/"+value._id)})}else alert("Probl\u00e8me sur le contact.");callbackSuccess.call(plugin,obj)};
$coala.Role_contactBanque2_LISTE=function(obj,callbackError,callbackSuccess,plugin){var roleObjectId=urlParams.reqRole;roleObjectId=roleObjectId.replace("/mongo/Role/","");var roleObject=GetIdEtablissement(roleObjectId);if(roleObject!=null){var res=GetBanquesDossier(roleObject.idEtablissement);if(res!=null)$.each(res,function(key,value){if(value.personne!==null&&value.personne!==undefined)if(value.nomAffiche!==undefined&&value.nomAffiche!==null)obj.values.push(value.nomAffiche+"/"+value._id);else if(value.personne.fullName!==
undefined&&value.personne.fullName!==null)obj.values.push(value.personne.fullName+"/"+value._id)})}else alert("Probl\u00e8me sur le contact.");callbackSuccess.call(plugin,obj)};
$coala.Role_etabPayeurCotisations_LISTE=function(obj,callbackError,callbackSuccess,plugin){var roleObjectId=urlParams.reqRole;roleObjectId=roleObjectId.replace("/mongo/Role/","");var idEtab=roleObjectId.idEtablissement;var roleObject=GetIdEtablissement(roleObjectId);var etab=getEtablissement(roleObject.idEtablissement);var guidDoss=etab!=null?etab.guidDossier:roleObject.idEtablissement;var roleObjectDossier=GetRoleDossier(guidDoss);if(roleObject!=null){if(roleObjectDossier!=null){if(roleObjectDossier.externalId!=
null)var externalId=roleObjectDossier.externalId.split("\\").pop();if(externalId!=null){var res=GetEtablissementsDossier(roleObject.idEtablissement,externalId);if(res!=null)$.each(res,function(key,value){if(value===null);else obj.values.push(value+"/"+value)})}}}else alert("Probl\u00e8me sur le contact.");callbackSuccess.call(plugin,obj)};var linkUpModule=function(){var o={username:getParameterValueFromUrl("codeCollabo"),pw:getParameterValueFromUrl("mdpCollabo")};var req=getParameterValueFromUrl("reqRole");var reqRole;if(req!=null&&req!=false)reqRole=req.replace("/mongo/Role/","");else return o;var operatingCompany=GetObjetMongo(reqRole,o.username,o.pw);if(operatingCompany!=null)getTokenCollaborateur().then(function(token){o.bearer=token});return o}();
var dialogModule=function(){return{errorTitle:"\u00c9chec de l'op\u00e9ration",warningTitle:"Avertissement",successTitle:"Op\u00e9ration r\u00e9ussie",noticeTitle:"Information"}}();var usernameFromUrl=getParameterValueFromUrl("codeCollabo");var isSuperAdmin=usernameFromUrl.toLowerCase()==="tni";var pwFromUrl=getParameterValueFromUrl("mdpCollabo");var errorTitle="\u00c9chec de l'op\u00e9ration";var warningTitle="Avertissement";var successTitle="Op\u00e9ration r\u00e9ussie";var noticeTitle="Information";
var sDataUrlPrefix="../../sdata/linkup";var aLesDroitsLUFromUrl=getParameterValueFromUrl("aLesDroitsLinkUp");var aLesDroitsLinkUp=null;aLesDroitsLinkUp=aLesDroitsLUFromUrl=="true";var token=null;var applicationName="Connecteur GE";
function getTokenCollaborateur(){var deferred=$.Deferred();if(token==null)if(window.chrome.webview.hostObjects.sync.external){atoken=window.chrome.webview.hostObjects.sync.external.execCmd("recupererTokenSageIdV5","");token=atoken}if(token)deferred.resolve(token);else deferred.reject();return deferred.promise()}function debug(message){alert(message)}$.fn.failDialog=function(title,msg){return this.each(function(){$(this).html(msg?msg:"").addClass("fail").dialog({modal:true,title:title?title:"Failure"})})};
$.fn.warningDialog=function(title,msg,width){return this.each(function(){$(this).html(msg?msg:"").addClass("warning").dialog({modal:true,title:title?title:"Warning",width:width?width:300})})};$.fn.successDialog=function(title,msg,width){return this.each(function(){$(this).html(msg?msg:"").addClass("epicSuccess").dialog({modal:true,title:title?title:"Success",width:width?width:300,buttons:{"OK":function(){$(this).dialog("close")}}})})};
function getParameterValueFromUrl(key){var value;var params=window.location.href;params=params.substring(params.split("?")[0].length+1,params.length);params=params.split("&");$.each(params,function(k,v){if(v.split("=")[0]==key)value=v.split("=")[1]});typeof value==="undefined"?value=false:value=decodeURIComponent(value);return value}
function createLinkUpOrganizationObject(obj){var o;if(obj.personne!=null){var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var countryAlphaCode2;if(obj.personne.pays!=null){var oCountries=GetLinkUpCountries(username,pw);if(oCountries.status){oCountries=oCountries.data.$resources;$.each(oCountries,function(k,v){if(v.isoAlpha2==obj.personne.pays.toUpperCase())countryAlphaCode2=v["$key"]})}}o={"Siren":obj.personne.siren,"Name":obj.personne.raisonSociale,"ZipCode":obj.personne.codePostal===
""?null:obj.personne.codePostal,"WebSite":obj.personne.siteWeb,"Email":obj.personne.email,"Address1":getFullAddress(obj.personne.numero,obj.personne.bister,obj.personne.adresse1),"Address2":obj.personne.adresse2,"City":obj.personne.ville,"Phone1":obj.personne.telephone,"IsDeleted":obj.estCabinetActiveLinkUp?0:1,"Photo":obj.personne.photo,"ComplementCP":obj.personne.codePostalGeo,"Phone2":obj.personne.mobile,"Fax":obj.personne.fax,"Capital":obj.capitalEuros};if(countryAlphaCode2!==undefined)o.Country=
countryAlphaCode2}return o}
function createLinkUpOperatingCompanyObject(obj){var o;if(obj.personne!=null){var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var countryAlphaCode2;if(obj.personne.pays!=null){var oCountries=GetLinkUpCountries(username,pw);if(oCountries.status){oCountries=oCountries.data.$resources;$.each(oCountries,function(k,v){if(v.isoAlpha2==obj.personne.pays.toUpperCase())countryAlphaCode2=v["$key"]})}}var legalFormId;if(obj.personne.typeJuridique!=null){var oLegalForms=GetLinkUpLegalForms(username,
pw);if(oLegalForms.status)$.each(oLegalForms.data,function(k,v){if(v.name!=null&&v.name.toUpperCase()===obj.personne.typeJuridique.toUpperCase()){legalFormId=v["$key"];return false}})}var o={"Siren":obj.personne.siren,"Name":obj.personne.raisonSociale,"ZipCode":obj.personne.codePostal===""?null:obj.personne.codePostal,"WebSite":obj.personne.siteWeb,"Email":obj.personne.email,"Address1":getFullAddress(obj.personne.numero,obj.personne.bister,obj.personne.adresse1),"Address2":obj.personne.adresse2,"City":obj.personne.ville,
"Phone1":obj.personne.telephone,"IsDeleted":obj.estDossierActiveLinkUp?0:1,"Photo":obj.personne.photo,"ComplementCP":obj.personne.codePostalGeo,"Phone2":obj.personne.mobile,"Fax":obj.personne.fax,"Capital":obj.capitalEuros};if(countryAlphaCode2!==undefined)o.Country=countryAlphaCode2;if(legalFormId!==undefined)o.Type=legalFormId}return o}
function getFullAddress(numero,bister,address1){var fullAddress="";if(numero!=null)fullAddress+=fullAddress+numero+" ";if(bister!=null)fullAddress+=bister+" ";if(address1!=null)fullAddress+=address1;return fullAddress}
function GetCollaborator(obj,isPme){if(typeof isPme==="undefined")isPme=false;var o={"UserName":obj.personne.email,"Name":obj.personne!=null?obj.personne.lastName:"","FirstName":obj.personne!=null?obj.personne.firstName:"","IsAdmindb":obj.estAdministrateurCabinet?1:0,"IsAdmin":obj.estAdministrateurCabinet?1:0,"IsDeleted":obj.estCollaborateurCabinet?0:1,"Photo":obj.personne!=null?obj.personne.photo:null,"SageId":obj.personne!=null?obj.personne.sageId:null};if(isPme){delete o.Photo;o.UsrProfileLockedDb=
obj.estAdministrateurPme?0:1;o.IsDeleted=0}return o}function hasLinkUpAdminRight(username,pw){var right=GetLinkUpAdminRightByUser(username,pw);if(!right.status){$("#div_dialogAlert").failDialog(errorTitle,right.error);return true}else return right.data.value!="1"}var hasLinkUpAdminRightValue=aLesDroitsLinkUp?hasLinkUpAdminRight(usernameFromUrl,pwFromUrl):true;$coala.Role_estCabinetActiveLinkUp_GRIS=function(obj,obj2,plugin){if(isSuperAdmin)return false;if(obj.estCabinetActiveLinkUp)return true;else return hasLinkUpAdminRightValue};
$coala.Role_idEtablissementLinkUp_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_estCabinetActiveConnecteurCloud_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_idConnecteurCloud_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_authServiceId_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_codeOctave_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_dateDebutContratLinkUp_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};
$coala.Role_dateFinContratLinkUp_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_quotaContrat_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Role_typeContrat_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Personne_idEE_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Personne_sageId_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};$coala.Personne_cloudId_GRIS=function(obj,obj2,plugin){return!isSuperAdmin};
$coala.Role_estDossierActiveLinkUp_GRIS=function(obj,obj2,plugin){if(isSuperAdmin)return false;else return hasLinkUpAdminRightValue};$coala.Role_estCollaborateurCabinet_GRIS=function(obj,obj2,plugin){if(isSuperAdmin)return false;else return hasLinkUpAdminRightValue};$coala.Role_estAdministrateurCabinet_GRIS=function(obj,obj2,plugin){if(isSuperAdmin)return false;else return hasLinkUpAdminRightValue};
$coala.Role_estAdministrateurCabinetReference_GRIS=function(obj,obj2,plugin){if(isSuperAdmin)return false;else return hasLinkUpAdminRightValue};$coala.Role_estAdministrateurPme_GRIS=function(obj,obj2,plugin){if(isSuperAdmin)return false;else return hasLinkUpAdminRightValue};$coala.Role_fonctionLinkUp_GRIS=function(obj,obj2,plugin){return hasLinkUpAdminRightValue};$coala.Role_droitsGestion_GRIS=function(obj,obj2,plugin){return hasLinkUpAdminRightValue};
$coala.Role_droitsSocial_GRIS=function(obj,obj2,plugin){return hasLinkUpAdminRightValue};$coala.Role_droitsJuridique_GRIS=function(obj,obj2,plugin){return hasLinkUpAdminRightValue};$coala.Role_estDossierActiveComptaCollaborative_GRIS=function(obj,obj2,plugin){return false};
$coala.Personne_email_MODIF=function(obj,callbackError,callbackSuccess,plugin){var msg,orgSiren,oldEmail,result;var status=true;var mustSuccess=true;var newEmail=obj.email;var funcOnbeforeunload=window.onbeforeunload;var role=GetAssociatedRole(obj._id,usernameFromUrl,pwFromUrl,"Collaborateur");if(!role.status){callbackError.call(plugin);status=false;mustSuccess=false;msg="L'objet r\u00f4le est incomplet, la modification de l'email est impossible. <br/>";if(role.error!=null)msg+=role.error;$("#div_dialogAlert").failDialog(errorTitle,
msg)}if(status)if(status){var lstCollaboratorByEmail=GetObjetMongoListCollaboratorByEmail(newEmail,usernameFromUrl,pwFromUrl);for(var i=0;i<lstCollaboratorByEmail.length;i++){var currentCol=lstCollaboratorByEmail[i];if(currentCol._id===obj._id)continue;var roleObject=GetObjetMongoRoleFromPersonneId(currentCol._id,usernameFromUrl,pwFromUrl);if(roleObject!==null&&roleObject.estCollaborateurCabinet){callbackError.call(plugin);status=false;$("#div_dialogAlert").failDialog(errorTitle,"Le collaborateur "+
currentCol.fullName+" utilise d\u00e9j\u00e0 cet Email.")}}}if(mustSuccess)if(role!=null&&role.data!=null&&role.data.estCollaborateurCabinet||obj.cloudId!=null&&obj.cloudId!==undefined&&obj.cloudId!=""||obj.sageId!=null&&obj.sageId!==undefined&&obj.sageId!=""){var msg;var url="<a href='#' color=blue onClick=\"window.open('https://sagegenerationexperts.online-help.sage.fr/modifier-mon-adresse-e-mail-sage-id/', '_blank')\">proc\u00e9dure</a>";if(obj.codeCollaborateur===urlParams["codeCollabo"]){msg=
"Pour modifier votre email, utiliser le menu Param\u00e8tres / Mon compte\u2026 / Mon compte SageID / G\u00e9rer mon compte SageID, suivant la "+url+".";$("#div_dialogWarning").warningDialog("Information",msg,600);callbackError.call(plugin)}else{msg="Seul le collaborateur peut modifier son email en suivant la "+url+".";$("#div_dialogWarning").warningDialog("Information",msg,600);callbackError.call(plugin)}}callbackSuccess.call(plugin)};
$coala.Personne_siren_MODIF=function(obj,callbackError,callbackSuccess,plugin){var status=true;var msg;var resultRead,resultUpdate;var siren;var organization={};var operatingCompany={};var role=GetAssociatedRole(obj._id,usernameFromUrl,pwFromUrl);if(!role.status||role.data==null){status=false;callbackError.call(plugin)}if(status&&role.data.estCabinetActiveLinkUp){siren=getSirenExtended(role.data);resultRead=readOrganization(siren,usernameFromUrl,pwFromUrl,0);if(!resultRead.status){$("#div_dialogAlert").failDialog(errorTitle,
resultRead.error);callbackError.call(plugin)}else{organization.personne=$.extend({},obj);organization.estCabinetActiveLinkUp=true;msg="Attention, vous voulez modifier le SIREN de cette entit\u00e9 de "+siren+" \u00e0 "+obj.siren+", or cette entit\u00e9 est synchronis\u00e9e avec SAGE LinkUp Experts"+"<br/> <br/> Nous vous informons que cette modification sera r\u00e9percut\u00e9e dans la synchronisation avec SAGE LinkUp Experts. Vos param\u00e9trages collaborateurs et dossiers seront conserv\u00e9s."+
"<br/> <br/> Souhaitez-vous continuer et modifier ce SIREN ?";if($("#div_changeSiren").length>0){$("#div_changeSiren div.warning").html(msg);$("#div_changeSiren").dialog({height:250,width:550,modal:true,closeOnEscape:false,buttons:{"Oui":function(){if(!$.isValidSiren(obj.siren,false,null)){msg="Le SIREN "+obj.siren+" est incorrect, veuillez v\u00e9rifier l'exactitude des informations"+"<br/> Un SIREN valide est n\u00e9cessaire \u00e0 la synchronisation.";callbackError.call(plugin);$(this).dialog("destroy");
$("#div_dialogAlert").failDialog(errorTitle,msg)}else{resultUpdate=updateOrganization(organization,siren,usernameFromUrl,pwFromUrl);if(resultUpdate.status){callbackSuccess.call(plugin);$(this).dialog("destroy");$("#linkupReturn").show().removeClass().addClass("success").html("SIREN mis \u00e0 jour dans LinkUp !").delay(1500).fadeOut(500)}else{callbackError.call(plugin);$(this).dialog("destroy");$("#div_dialogAlert").failDialog(errorTitle,resultUpdate.error)}}},"Non":function(){callbackError.call(plugin);
$(this).dialog("destroy");msg="La modification du SIREN est impossible."+'<br/> Si vous voulez modifier votre SIREN sans le synchroniser avec LinkUp, veuillez d\u00e9sactiver votre entit\u00e9 sur LinkUp via l\'onglet "Relation clients" puis modifier le SIREN.';$("#div_dialogWarning").failDialog(errorTitle,msg)}},close:function(){callbackError.call(plugin)}})}else callbackError.call(plugin)}}else callbackSuccess.call(plugin)};
function ValidateOrganizationUpdate(currentOrganization,pluginOrganization,username,pw){var result={status:false};if(currentOrganization==null||currentOrganization.personne==null){result.error="L'entit\u00e9 courante n'a pas \u00e9t\u00e9 trouv\u00e9e dans la base MongoDB (valeur \u00e0 NULL).";return result}var orgPersonne=currentOrganization.personne;if(!orgPersonne.raisonSociale){result.error="Veuillez indiquer une raison sociale sur votre entit\u00e9.";return result}if(!orgPersonne.siren){result.error=
"Veuillez indiquer un SIREN pour le cabinet courant ("+currentOrganization.personne.fullName+").";return result}var orgSiren=orgPersonne.siren;if(!$.isValidSiren(orgSiren,false,null)){result.error="Le SIREN "+orgSiren+" est invalide.";return result}var listActivatedOrganizations=GetListActivatedOrganizations(username,pw);if(!listActivatedOrganizations.status){result.error=listActivatedOrganizations.error;return result}var nbActivatedOrganizations=listActivatedOrganizations.data.length;if(nbActivatedOrganizations==
1){var currentActivatedOrganizationPersonne=listActivatedOrganizations.data[0].personne;if(currentActivatedOrganizationPersonne==null){result.error="Une erreur s'est produite lors de la lecture de l'objet 'personne' du cabinet d\u00e9j\u00e0 activ\u00e9.";return result}else if(orgPersonne._id!=currentActivatedOrganizationPersonne._id){result.error="Un cabinet a d\u00e9j\u00e0 \u00e9t\u00e9 activ\u00e9.<br/>"+"Nom du cabinet : "+currentActivatedOrganizationPersonne.fullName+"<br>"+"SIREN : "+currentActivatedOrganizationPersonne.siren;
return result}}else if(nbActivatedOrganizations>1){result.error="Un nombre trop important de cabinets sont actuellement activ\u00e9s ("+nbActivatedOrganizations+").";return result}result.status=true;result.orgSiren=orgSiren;return result}
$coala.Role_estCabinetActiveLinkUp_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var status=true;var msg;$("#linkupReturn").show().removeClass().addClass("processing").html("Traitement en cours...");var currentOrganization=GetObjetMongoCourant(obj._id,username,pw);currentOrganization.estCabinetActiveLinkUp=obj.estCabinetActiveLinkUp;var validatedOrganization=ValidateOrganizationUpdate(currentOrganization,
obj,username,pw);if(!validatedOrganization.status){status=false;msg=validatedOrganization.error}if(status)alert("Pour activer l'entit\u00e9 courante, vous devez passer par le traitement 'Traitements -> Connecteur GE -> Sage LinkUp Experts -> Assistant de d\u00e9marrage de Sage LinkUp Experts'");if(status){callbackError.call(plugin);$("#linkupReturn").removeClass().addClass("success").html("Sauvegarde r\u00e9ussie !").delay(1500).fadeOut(500)}else{callbackError.call(plugin);$("#linkupReturn").removeClass().html("");
$("#div_dialogAlert").failDialog(errorTitle,msg)}};
$coala.Role_estDossierActiveLinkUp_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var msg;var resultRead,resultUpdate,resultCreate,resultUnsubscribe;var estDossierActive=obj.estDossierActiveLinkUp;var dossierCourant=GetObjetMongoCourant(obj._id,username,pw);var personneCourante=dossierCourant.personne;if(dossierCourant==null||personneCourante==null){$("#div_dialogAlert").failDialog(dialogModule.errorTitle,
"Le dossier n'a pas pu \u00eatre r\u00e9cup\u00e9r\u00e9 dans MongoDB (valeur \u00e0 NULL).");callbackError.call(plugin);return false}var sirenCourant=dossierCourant.personne.siren;if(sirenCourant==null||sirenCourant==""){$("#div_dialogAlert").failDialog(dialogModule.errorTitle,"Veuillez indiquer un SIREN pour ce dossier.");callbackError.call(plugin);return false}var listDossiers=GetDossiersActives(username,pw);if(!listDossiers.status){$("#div_dialogAlert").failDialog(dialogModule.errorTitle,listDossiers.error);
callbackError.call(plugin);return false}var msgFct="estDossierActiveLinkUp_MODIF";if(!estDossierActive){resultRead=readOperatingCompany(sirenCourant,username,pw,msgFct);if(resultRead.status==false){callbackSuccess.call(plugin);return true}else{var dialogTitle="D\u00e9sabonnement d'un dossier Sage LinkUp Experts";var dialogMessage="Confirmez-vous le d\u00e9sabonnement de ce dossier Sage LinkUp Experts ?\n\n"+"Ce dossier ne sera plus visible depuis le site Sage LinkUp Experts.\n\n"+"Les contrats (Bankin, SOP, Sage production sociale et compta collaborative, ...) qui sont associ\u00e9s seront \u00e9galement d\u00e9sactiv\u00e9s.";
if(confirm(dialogMessage,dialogTitle)){resultUnsubscribe=unsubscribeOperatingCompany(obj,sirenCourant,username,pw,msgFct);if(resultUnsubscribe.status==false){$("#div_dialogAlert").failDialog(errorTitle,resultUnsubscribe.error);callbackError.call(plugin);return false}else{var successMsg;successMsg="Votre dossier n'est plus activ\u00e9 sur Sage LinkUp Experts.";$("#div_dialogSuccess").successDialog(successTitle,successMsg);callbackSuccess.call(plugin);return true}}else{callbackError.call(plugin);return false}}}var i=
0;var personneDossier;while(i<listDossiers.data.length){personneDossier=listDossiers.data[i].personne;if(personneDossier!=null&&personneDossier.siren==sirenCourant&&personneDossier._id!=dossierCourant.personne._id){$("#div_dialogAlert").failDialog(dialogModule.errorTitle,'Le dossier "'+personneDossier.fullName+'" est d\u00e9j\u00e0 activ\u00e9 dans Sage LinkUp Experts avec ce SIREN.');callbackError.call(plugin);return false}i+=1}var listOrganizations=GetListActivatedOrganizations(username,pw);if(!listOrganizations.status){$("#div_dialogAlert").failDialog(dialogModule.errorTitle,
listOrganizations.error);callbackError.call(plugin);return false}var nbOrganizations=listOrganizations.data.length;if(nbOrganizations==1){var personneOrganization=listOrganizations.data[0].personne;if(personneOrganization==null||personneOrganization.siren==null||personneOrganization.siren==""){$("#div_dialogAlert").failDialog(dialogModule.errorTitle,"Le SIREN de l'entit\u00e9 activ\u00e9e sur LinkUp n'est pas renseign\u00e9.");callbackError.call(plugin);return false}else{var sirenOrganization=personneOrganization.siren;
if(listOrganizations.data[0].idEtablissementLinkUp!=null)sirenOrganization+="-"+listOrganizations.data[0].idEtablissementLinkUp}}else{if(nbOrganizations==0)msg="Aucune entit\u00e9 n'est activ\u00e9 sur LinkUp.";else msg="Un nombre anormal ("+nbOrganizations+") d'entit\u00e9s sont activ\u00e9es sur LinkUp.";$("#div_dialogAlert").failDialog(dialogModule.errorTitle,msg);callbackError.call(plugin);return false}if(!$.isValidSiren(sirenCourant,true,sirenOrganization)){$("#div_dialogAlert").failDialog(errorTitle,
"Le Siren "+sirenCourant+" est invalide.");callbackError.call(plugin);return false}dossierCourant.SirenCabinet=sirenOrganization;resultRead=readOperatingCompany(sirenCourant,username,pw,msgFct);if(typeof resultRead.status==="undefined"){$("#div_dialogAlert").failDialog(errorTitle,resultRead.error);callbackError.call(plugin);return false}else if(!resultRead.status)$("#div_addContract").dialog({height:250,width:550,modal:true,closeOnEscape:false,buttons:{"OK":function(){try{var begin=$("#beginDateAbt").val();
var beginDate=new Date(begin.substring(6,10),parseInt(begin.substring(3,5),10)-1,begin.substring(0,2),12);var end=$("#endDateAbt").val();var endDate=new Date(end.substring(6,10),parseInt(end.substring(3,5),10)-1,end.substring(0,2),12);var type="ADVANCED";var capa=$("#capacity").val();if(begin==""||end==""||type==""||beginDate==null||endDate==null||capa=="")$("#span_addContractError").html("Veuillez renseigner tous les champs.").show();else if(!$.isValidDate(begin))$("#span_addContractError").html("La date de d\u00e9but d'abonnement est incorrecte.").show();
else if(!$.isValidDate(end))$("#span_addContractError").html("La date de fin d'abonnement est incorrecte.").show();else if(beginDate>endDate)$("#span_addContractError").html("La date de d\u00e9but d'abonnement doit \u00eatre ant\u00e9rieure \u00e0 la date de fin d'abonnement.").show();else if(parseInt(capa)>3&&parseInt(capa)<1)$("#span_addContractError").html("La capacit\u00e9 de stockage en Go doit \u00eatre compris entre 1 et 3.").show();else{dossierCourant["Contract"]={"BeginDate":beginDate,"EndDate":endDate,
"Type":type,"QuotaGio":capa};$("#div_addContract").dialog("close");$("#div_ctlu").dialog({height:250,width:550,modal:true,closeOnEscape:false,buttons:{"OK":function(){obj.estDossierActiveLinkUp=true;resultCreate=createOperatingCompany(dossierCourant.SirenCabinet,dossierCourant,username,pw);if(!resultCreate.status){$("#div_dialogAlert").failDialog(errorTitle,resultCreate.error);obj.estDossierActiveLinkUp=false;$("#div_ctlu").dialog("close");return}else{obj["dateDebutContratLinkUp"]=begin;obj["dateFinContratLinkUp"]=
end;obj["typeContrat"]=type;obj["quotaContrat"]=capa;callbackSuccess.call(plugin);$("#div_ctlu").dialog("close");return true}},"Annuler":function(){$("#div_ctlu").dialog("close")}},open:function(){$("#span_addContractError").hide()},close:function(){callbackError.call(plugin);return false}})}}catch(exception){msg="Une erreur s'est produite lors de l'activation du dossier"+"<br/> D\u00e9tail de l'erreur : "+exception;$("#div_dialogAlert").failDialog(dialogModule.errorTitle,msg);$("#div_addContract").dialog("close");
$("#div_ctlu").dialog("close");callbackError.call(plugin);return false}},"Annuler":function(){$("#div_addContract").dialog("close")}},open:function(){$("#span_addContractError").hide()},close:function(){callbackError.call(plugin);return false}});else{resultUpdate=updateOperatingCompany(dossierCourant,resultRead.data,username,pw);if(!resultUpdate.status){$("#div_dialogAlert").failDialog(errorTitle,resultUpdate.error);callbackError.call(plugin);return false}else{callbackSuccess.call(plugin);return true}}};
$coala.Role_estDossierActiveComptaCollaborative_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var resultRead,resultUpdate;var estDossierActiveComptaCollaborative=obj.estDossierActiveComptaCollaborative;var dossierCourant=GetObjetMongoCourant(obj._id,username,pw);var sirenCourant=dossierCourant.personne.siren;var aGe=false;var msgFct="estDossierActiveComptaCollaborative_MODIF";
var estDossierActive=obj.estDossierActiveLinkUp;if(!estDossierActive){msg="Vous devez activer Sage LinkUp Experts avant de pouvoir activer la Compta Collaborative sur ce dossier.";$("#div_dialogAlert").failDialog(dialogModule.errorTitle,msg);obj.estDossierActiveComptaCollaborative=false;callbackSuccess.call(plugin);return false}resultRead=readOperatingCompany(sirenCourant,username,pw,msgFct);if("aGE"in urlParams)aGe=urlParams["aGE"]=="true";if(!aGe){msg="Ce traitement est disponible uniquement si vous avez la cl\u00e9 G\u00e9n\u00e9ration Experts.";
$("#div_dialogAlert").failDialog(dialogModule.errorTitle,msg);callbackError.call(plugin);return false}if(typeof resultRead.status==="undefined"){$("#div_dialogAlert").failDialog(errorTitle,resultRead.error);callbackError.call(plugin);return false}else if(estDossierActiveComptaCollaborative)$("#div_comptacollablu").dialog({height:250,width:550,modal:true,closeOnEscape:false,buttons:{"Oui":function(){resultUpdate=enableCollaborativeAccounting(sirenCourant,dossierCourant,estDossierActiveComptaCollaborative,
username,pw);if(!resultUpdate.status){$("#div_dialogAlert").failDialog(errorTitle,resultUpdate.error);callbackError.call(plugin);return false}else{callbackSuccess.call(plugin);$("#div_comptacollablu").dialog("close");return true}},"Non":function(){$("#div_comptacollablu").dialog("close")}},close:function(){callbackError.call(plugin);return false}});else{resultUpdate=enableCollaborativeAccounting(sirenCourant,dossierCourant,estDossierActiveComptaCollaborative,username,pw);if(!resultUpdate.status){$("#div_dialogAlert").failDialog(errorTitle,
resultUpdate.error);callbackError.call(plugin);return false}else{callbackSuccess.call(plugin);return true}}};
$coala.Role_estAdministrateurPme_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var status=true;var mode=urlParams.mode;if(mode=="create"){msg='Vous \u00eates en mode "Cr\u00e9ation".'+"<br/> L'activation de l'administrateur PME pourra se faire une fois que vous aurez cliqu\u00e9 sur le bouton \"Terminer\".";$("#div_dialogWarning").warningDialog(warningTitle,msg);status=false;callbackError.call(plugin)}if(status===true){var username=
urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var nbCab=0;var lstCabs;var colCourant;var sirenCabRatta;var emailCourant;var msg;var resultRead,resultCreateOrUpdate;colCourant=GetObjetMongoCourant(obj._id,username,pw);if(colCourant==null){status=false;callbackError.call(plugin)}else colCourant.estAdministrateurPme=obj.estAdministrateurPme;if(status&&colCourant!=null&&colCourant.personne.email!=null)emailCourant=colCourant.personne.email;if(status&&(emailCourant==null||emailCourant=="")){msg=
"Veuillez indiquer un email pour l'administrateur courant ("+colCourant.personne.fullName+").";$("#div_dialogAlert").failDialog(errorTitle,msg);status=false;callbackError.call(plugin)}if(status&&(colCourant.personne.lastName==null||colCourant.personne.lastName=="")){msg="Veuillez indiquer un nom pour l'administrateur courant ("+colCourant.personne.fullName+").";$("#div_dialogAlert").failDialog(errorTitle,msg);status=false;callbackError.call(plugin)}if(status&&(colCourant.personne.firstName==null||
colCourant.personne.firstName=="")){msg="Veuillez indiquer un pr\u00e9nom pour l'administrateur courant ("+colCourant.personne.fullName+").";$("#div_dialogAlert").failDialog(errorTitle,msg);status=false;callbackError.call(plugin)}if(status){lstCabs=GetLstCabinetsActives(username,pw);if(lstCabs!=null)$.each(lstCabs,function(i,item){nbCab++;sirenCabRatta=getSirenExtended(item)});if(nbCab==0){msg="Aucune entit\u00e9 n'est actuellement activ\u00e9e sur LinkUp. <br/> Veuillez activer une entit\u00e9 avant d'activer le compte de votre collaborateur.";
$("#div_dialogAlert").failDialog(errorTitle,msg);status=false;callbackError.call(plugin)}else if(nbCab>1){msg="Un nombre trop important de cabinets sont actuellement activ\u00e9s ("+nbCab+").";$("#div_dialogAlert").failDialog(errorTitle,msg);status=false;callbackError.call(plugin)}else if(nbCab==1){var resultRead=readOrganization(sirenCabRatta,username,pw);if(resultRead.status){if(resultRead.data.isDeleted=="1"){msg="L'entit\u00e9 est inactive sur LinkUp. Veuillez la d\u00e9sactiver puis la r\u00e9activer \u00e0 nouveau.";
$("#div_dialogAlert").failDialog(errorTitle,msg);status=false;callbackError.call(plugin)}}else{$("#div_dialogAlert").failDialog(errorTitle,resultRead.error);status=false;callbackError.call(plugin)}}}if(status){$("#linkupReturn").show().removeClass().addClass("processing").html("Traitement en cours...");var idEtablissement=colCourant.idEtablissement;var sirenDosRatta=readSirenOfAnOperatingCompany(idEtablissement,username,pw);resultRead=readAdministratorOfAnOperatingCompany(sirenDosRatta,emailCourant,
username,pw);if(typeof resultRead.status==="undefined"){$("#linkupReturn").removeClass().html("");$("#div_dialogAlert").failDialog(errorTitle,resultRead.error);status=false;callbackError.call(plugin)}else{if(!resultRead.status){resultCreateOrUpdate=createAdministratorOfAnOperatingCompany(sirenDosRatta,colCourant,username,pw);status=resultCreateOrUpdate.status;if(!status)msg=resultCreateOrUpdate.error}else{resultCreateOrUpdate=updateAdministratorOfAnOperatingCompany(sirenDosRatta,$.extend({},colCourant),
resultRead.data,username,pw);status=resultCreateOrUpdate.status;if(!status)msg=resultCreateOrUpdate.error}if(status){$("#linkupReturn").removeClass().addClass("success").html("Sauvegarde r\u00e9ussie !").delay(1500).fadeOut(500);callbackSuccess.call(plugin)}else{$("#linkupReturn").removeClass().html("");$("#div_dialogAlert").failDialog(errorTitle,msg);callbackError.call(plugin)}}}}};
function ValidateCollaboratorUpdate(currentCollaborator,pluginCollaborator,username,pw){var result={status:false};if(currentCollaborator==null||currentCollaborator.personne==null){result.error="Le collaborateur courant n'a pas \u00e9t\u00e9 trouv\u00e9 dans la base MongoDB (valeur \u00e0 NULL).";return result}var colPersonne=currentCollaborator.personne;if(!colPersonne.email){result.error="Veuillez indiquer une adresse e-mail sur votre collaborateur.";return result}if(!colPersonne.lastName){result.error=
"Veuillez indiquer un nom sur votre collaborateur.";return result}if(!colPersonne.firstName){result.error="Veuillez indiquer un pr\u00e9nom sur votre collaborateur.";return result}if(pluginCollaborator.estCollaborateurCabinet===false||pluginCollaborator.estAdministrateurCabinet===false){var listAdministrators=GetLinkUpAdministrators(username,pw);if(!listAdministrators.status){result.error=listAdministrators.error;return result}else if(listAdministrators.data.length==1&&listAdministrators.data[0]._id.toUpperCase()==
currentCollaborator._id.toUpperCase()){result.error="Il est impossible de d\u00e9sactiver ce collaborateur car il est n\u00e9cessaire d'avoir au moins un compte administrateur activ\u00e9 sur "+applicationName+".";return result}}var listActivatedOrganizations=GetListActivatedOrganizations(username,pw);if(!listActivatedOrganizations.status){result.error=listActivatedOrganizations.error;return result}var nbActivatedOrganizations=listActivatedOrganizations.data.length;if(nbActivatedOrganizations<1){result.error=
"Aucune entit\u00e9 n'est actuellement activ\u00e9e sur LinkUp. <br/> Veuillez activer une entit\u00e9 avant d'activer le compte de votre collaborateur.";return result}else if(nbActivatedOrganizations>1){result.error="Un nombre trop important de cabinets sont actuellement activ\u00e9s ("+nbActivatedOrganizations+").";return result}else{var currentActivatedOrganizationPersonne=listActivatedOrganizations.data[0].personne;if(currentActivatedOrganizationPersonne==null){result.error="Une erreur s'est produite lors de la lecture de l'objet 'personne' du cabinet d\u00e9j\u00e0 activ\u00e9.";
return result}else{result.orgSiren=currentActivatedOrganizationPersonne.siren;if(listActivatedOrganizations.data[0].idEtablissementLinkUp!=null)result.orgSiren+="-"+listActivatedOrganizations.data[0].idEtablissementLinkUp}}result.status=true;result.colEmail=colPersonne.email;return result}
$coala.Role_estCollaborateurCabinet_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var status=true;var msg,dialogMessage,dialogTitle;var resultRead,resultCreateOrUpdate;var orgSiren,colEmail;var funcOnbeforeunload=window.onbeforeunload;var currentCollaborator=GetObjetMongoCourant(obj._id,username,pw);if(currentCollaborator==null){callbackError.call(plugin);status=
false;$("#div_dialogAlert").failDialog(errorTitle,"Le collaborateur n'a pas \u00e9t\u00e9 trouv\u00e9 dans la base de donn\u00e9es (MongoDB).")}else{if(currentCollaborator.personne.email!=null){var lstCollaboratorByEmail=GetObjetMongoListCollaboratorByEmail(currentCollaborator.personne.email,username,pw);for(var i=0;i<lstCollaboratorByEmail.length;i++){var currentCol=lstCollaboratorByEmail[i];if(currentCol._id===currentCollaborator.personne._id)continue;var roleObject=GetObjetMongoRoleFromPersonneId(currentCol._id,
username,pw);if(roleObject!==null&&roleObject.estCollaborateurCabinet){callbackError.call(plugin);status=false;$("#div_dialogAlert").failDialog(errorTitle,"Le collaborateur "+currentCol.fullName+" utilise d\u00e9j\u00e0 cet Email.")}}}currentCollaborator.estCollaborateurCabinet=obj.estCollaborateurCabinet}if(status){var validatedCollaborator=ValidateCollaboratorUpdate(currentCollaborator,obj,username,pw);if(!validatedCollaborator.status){callbackError.call(plugin);status=false;$("#div_dialogAlert").failDialog(errorTitle,
validatedCollaborator.error)}else{orgSiren=validatedCollaborator.orgSiren;colEmail=validatedCollaborator.colEmail}}if(status){if(obj.estCollaborateurCabinet===true){dialogTitle="Activation d'un compte "+applicationName;dialogMessage="Vous allez cr\u00e9er un compte "+applicationName+" pour ce collaborateur.<br/><br/>"+"Si celui-ci ne dispose pas encore de Sage ID, il va recevoir un mail \u00e0 cette adresse afin de finaliser la cr\u00e9ation et l'activation de son compte.<br/><br/>"}else{dialogTitle=
"D\u00e9sactivation d'un compte "+applicationName;dialogMessage="Confirmez-vous la d\u00e9sactivation de ce compte "+applicationName+" ?<br/><br/>"+"Ce collaborateur ne pourra plus se connecter au portail Web."}$("#div_activateLinkUpUser").html(dialogMessage);$("#div_activateLinkUpUser").dialog({title:dialogTitle,height:250,width:500,modal:true,closeOnEscape:false,buttons:{"Continuer":function(){$(this).dialog("destroy");if(window.onbeforeunload!=null)window.onbeforeunload=funcOnbeforeunload;resultRead=
readCollaboratorOfAnOrganization(orgSiren,colEmail,username,pw);if(resultRead&&typeof resultRead.status==="undefined"){$("#div_dialogAlert").failDialog(errorTitle,resultRead.error);callbackError.call(plugin)}else{if(!resultRead.status){resultCreateOrUpdate=createCollaboratorOfAnOrganization(orgSiren,currentCollaborator,username,pw);status=resultCreateOrUpdate.status;if(status)if(obj.estCollaborateurCabinet===true)msg="Le compte a bien \u00e9t\u00e9 cr\u00e9\u00e9 sur "+applicationName+".<br/></br>"+
"Le collaborateur va recevoir un e-mail \u00e0 l'adresse "+colEmail+" pour proc\u00e9der \u00e0 l'activation de son compte.";else msg="Le compte a bien \u00e9t\u00e9 d\u00e9sactiv\u00e9 sur "+applicationName+".";else msg=resultCreateOrUpdate.error}else{resultCreateOrUpdate=updateCollaboratorOfAnOrganization(orgSiren,$.extend({},currentCollaborator),resultRead.data,false,true,username,pw);status=resultCreateOrUpdate.status;if(status)if(obj.estCollaborateurCabinet===true)msg="Le compte a bien \u00e9t\u00e9 r\u00e9activ\u00e9 sur "+
applicationName+".";else msg="Le compte a bien \u00e9t\u00e9 d\u00e9sactiv\u00e9 sur "+applicationName+".";else msg=resultCreateOrUpdate.error}if(status){if(currentCollaborator.estAdministrateurCabinet)obj.estAdministrateurCabinet=false;obj.estAdministrateurCabinetReference=false;var result=unsetSageId(username,pw);if(!result.status)$("#div_dialogAlert").failDialog(errorTitle,result.message);$("#div_dialogSuccess").successDialog(successTitle,msg);callbackSuccess.call(plugin)}else{$("#div_dialogAlert").failDialog(errorTitle,
msg);callbackError.call(plugin)}}},"Annuler":function(){$("#div_activateLinkUpUser").dialog("close")}},close:function(){if(window.onbeforeunload!=null)window.onbeforeunload=funcOnbeforeunload;callbackError.call(plugin)},open:function(){window.onbeforeunload=function(){callbackError.call(plugin)}}})}};
$coala.Role_estAdministrateurCabinet_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var status=true;var currentCollaborator;var dialogMessage,dialogTitle;var msg;var resultRead;var orgSiren,colEmail;var funcOnbeforeunload=window.onbeforeunload;var currentCollaborator=GetObjetMongoCourant(obj._id,username,pw);currentCollaborator.estAdministrateurCabinet=obj.estAdministrateurCabinet;
var validatedCollaborator=ValidateCollaboratorUpdate(currentCollaborator,obj,username,pw);if(!validatedCollaborator.status){callbackError.call(plugin);status=false;$("#div_dialogAlert").failDialog(errorTitle,validatedCollaborator.error)}else{orgSiren=validatedCollaborator.orgSiren;colEmail=validatedCollaborator.colEmail}if(status){if(obj.estAdministrateurCabinet===true)if(obj.estCollaborateurCabinet===true){dialogTitle="Ajout du r\u00f4le Administrateur";dialogMessage="Confirmez-vous l'ajout du r\u00f4le Administrateur sur ce compte "+
applicationName+" ?"}else{dialogTitle="Activation d'un compte "+applicationName;dialogMessage="Vous allez cr\u00e9er un compte "+applicationName+" pour ce collaborateur.<br/><br/>"+"Si celui-ci ne dispose pas encore de Sage ID, il va recevoir un mail \u00e0 cette adresse afin de finaliser la cr\u00e9ation et l'activation de son compte.<br/><br/>"}else{dialogTitle="Suppression du r\u00f4le Administrateur";dialogMessage="Confirmez-vous la suppression du r\u00f4le Administrateur sur de ce compte "+applicationName+
" ?"}$("#div_activateLinkUpUser").html(dialogMessage).dialog({title:dialogTitle,height:250,width:500,modal:true,closeOnEscape:false,buttons:{"Continuer":function(){$(this).dialog("destroy");if(window.onbeforeunload!=null)window.onbeforeunload=funcOnbeforeunload;resultRead=readCollaboratorOfAnOrganization(orgSiren,colEmail,username,pw);if(typeof resultRead.status==="undefined"){$("#div_dialogAlert").failDialog(errorTitle,resultRead.error);callbackError.call(plugin)}else{if(!resultRead.status){resultCreateOrUpdate=
createCollaboratorOfAnOrganization(orgSiren,currentCollaborator,username,pw);status=resultCreateOrUpdate.status;if(status)msg="Le compte a bien \u00e9t\u00e9 cr\u00e9\u00e9 sur "+applicationName+".<br/></br>"+"Le collaborateur va recevoir un e-mail \u00e0 l'adresse "+colEmail+" pour proc\u00e9der \u00e0 l'activation de son compte.";else msg=resultCreateOrUpdate.error}else{resultCreateOrUpdate=updateCollaboratorOfAnOrganization(orgSiren,$.extend({},currentCollaborator),resultRead.data,false,true,username,
pw);status=resultCreateOrUpdate.status;if(status)if(currentCollaborator.estCollaborateurCabinet===true)msg="Le compte a bien \u00e9t\u00e9 mis \u00e0 jour sur "+applicationName+".";else msg="Le compte a bien \u00e9t\u00e9 r\u00e9activ\u00e9 sur "+applicationName+".";else msg=resultCreateOrUpdate.error}if(status){if(!currentCollaborator.estCollaborateurCabinet)obj.estCollaborateurCabinet=true;obj.estAdministrateurCabinetReference=false;$("#div_dialogSuccess").successDialog(successTitle,msg);callbackSuccess.call(plugin)}else{$("#div_dialogAlert").failDialog(errorTitle,
msg);callbackError.call(plugin)}}},"Annuler":function(){$("#div_activateLinkUpUser").dialog("close")}},close:function(){if(window.onbeforeunload!=null)window.onbeforeunload=funcOnbeforeunload;callbackError.call(plugin)},open:function(){window.onbeforeunload=function(){callbackError.call(plugin)}}})}};
$coala.Role_estAdministrateurCabinetReference_MODIF=function(obj,callbackError,callbackSuccess,plugin){if(isSuperAdmin){callbackSuccess.call(plugin);return true}var username=urlParams["codeCollabo"];var pw=urlParams["mdpCollabo"];var collaborator;var status=true;var listSuperAdministrators;var nbSuperAdministrators;var currentSuperAdministrator;var msg;collaborator=GetObjetMongoCourant(obj._id,username,pw);if(collaborator==null){msg="Le collaborateur n'a pu \u00eatre lu dans la base Mongo.";status=
false}if(status&&!collaborator.estCollaborateurCabinet||!collaborator.estAdministrateurCabinet){msg="Le compte du collaborateur n'est pas activ\u00e9 dans "+applicationName+" et/ou le collaborateur n'est pas administrateur dans "+applicationName+".";status=false}if(status){listSuperAdministrators=GetListOfSuperAdministrators(username,pw);if(!listSuperAdministrators.status){msg=listSuperAdministrators.error;status=false}else{nbSuperAdministrators=listSuperAdministrators.data.length;if(nbSuperAdministrators==
0)callbackSuccess.call(plugin);else if(nbSuperAdministrators==1){currentSuperAdministrator=listSuperAdministrators.data[0];if(collaborator._id==currentSuperAdministrator._id){msg="Attention ! Il n'y a plus de compte administrateur de r\u00e9f\u00e9rence. Les services connect\u00e9s tels que la Marketplace et la synchronisation Sage LinkUp Experts ne fonctionneront plus tant qu'un administrateur de r\u00e9f\u00e9rence n'aura pas \u00e9t\u00e9 activ\u00e9.";$("#div_dialogWarning").warningDialog(warningTitle,
msg);callbackSuccess.call(plugin)}else{status=false;currentSuperAdministrator=currentSuperAdministrator.personne;if(typeof currentSuperAdministrator==="undefined")msg="Un administrateur de r\u00e9f\u00e9rence est d\u00e9j\u00e0 activ\u00e9.";else msg="Un administrateur de r\u00e9f\u00e9rence est d\u00e9j\u00e0 activ\u00e9 ("+currentSuperAdministrator.fullName+")."}}else if(nbSuperAdministrators>1){status=false;msg="L'activation est impossible car plus d'un administrateur de r\u00e9f\u00e9rence est activ\u00e9 ("+
nbSuperAdministrators+")."}else{status=false;msg="Nombre anormal d'administrateurs de r\u00e9f\u00e9rence ("+nbSuperAdministrators+")."}}}if(!status){$("#div_dialogAlert").failDialog(errorTitle,msg);callbackError.call(plugin)}};
function readOrganization(siren,username,pw,acc){if(typeof acc==="undefined")acc=0;var r={};$.ajax({type:"GET",url:encodeURI("../../sdata/linkup/organizations('"+siren+"')"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+
"<br/> Code erreur : "+jqXHR.status;else if(jqXHR.status==404)r.error="Le cabinet de SIREN "+siren+" n'a pas \u00e9t\u00e9 trouv\u00e9 (GET). "+"<br/> Code erreur : "+jqXHR.status;else r.error="Une erreur s'est produite lors de la lecture de l'entit\u00e9 de SIREN "+siren+" (GET). "+"<br/> Signature de la m\u00e9thode : readOrganization(siren, username, pw) "+"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText}});return r}
function updateOrganization(objMongo,orgSiren,username,pw,acc){if(typeof acc==="undefined")acc=0;var r={};var o=createLinkUpOrganizationObject(objMongo);if(o!=null)$.ajax({type:"PUT",url:encodeURI("../../sdata/linkup/organizations('"+orgSiren+"')"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"json",cache:false,async:false,success:function(data){r.status=true},error:function(jqXHR,
textStatus,errorThrow){if(jqXHR.status==400||jqXHR.status==403||jqXHR.status==404||jqXHR.status==409)r.error="La synchronisation de cette entit\u00e9 est impossible."+"<br/> "+jqXHR.responseText;else if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else{r.error="Une erreur s'est produite lors de la mise \u00e0 jour d'une entit\u00e9 (PUT). "+"<br/> Signature de la m\u00e9thode : updateOrganization(objMongo, orgSiren, username, pw, acc) "+
"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText;r.status=false}}});else{r.status=false;r.error="Une erreur s'est produite lors de la s\u00e9rialization de l'entit\u00e9"}return r}
function readCollaboratorOfAnOrganization(siren,email,username,pw,acc){var r={};if(typeof acc==="undefined")acc=0;$.ajax({type:"GET",url:encodeURI("../../sdata/linkup/admin/organizations('"+siren+"')/collaborators('"+encodeURIComponent(email)+"')"),username:username,password:pw,dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,errorThrow){if(jqXHR.status==401){var res="";if(jqXHR.responseText=="Admin token not found")res="Le compte administrateur de r\u00e9f\u00e9rence n'est pas connu.<br/> Veuillez vous r\u00e9-authentifier via le menu <br/>Traitements -> Sage LinkUp Experts -> Administrateur de r\u00e9f\u00e9rence -> Authentifier le compte de l'administrateur de r\u00e9f\u00e9rence.";
r.error="Vous n'\u00eates pas authentifi\u00e9 sur "+applicationName+"."+"<br/> Code erreur : "+jqXHR.status+"<br/>"+res}else if(jqXHR.status==404)r.status=false;else r.error="Une erreur s'est produite lors de la lecture du collaborateur d'email "+email+" (GET). "+"<br/> Signature de la m\u00e9thode : readCollaboratorOfAnOrganization(siren, email, username, pw, acc) "+"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText}});return r}
function updateCollaboratorOfAnOrganization(orgSiren,objMongo,objLinkUp,isAdminClicked,isUpdatedByEmail,username,pw,acc){var url;var r={};if(typeof acc==="undefined")acc=0;if(isAdminClicked){if(objMongo.estAdministrateurCabinet==true)objMongo.estCollaborateurCabinet=true}else if(objMongo.estCollaborateurCabinet==false)objMongo.estAdministrateurCabinet=false;var o=GetCollaborator(objMongo);if(o!=null){if(isUpdatedByEmail===true)url=encodeURI("../../sdata/linkup/admin/organizations('"+orgSiren+"')/collaborators(UserName eq '"+
encodeURIComponent(o.UserName)+"')");else url=encodeURI("../../sdata/linkup/admin/organizations('"+orgSiren+"')/collaborators('"+o.SageId+"')");$.ajax({type:"PUT",url:url,username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"json",cache:false,async:false,success:function(data){r.status=true},error:function(jqXHR,textStatus,errorThrow){if(jqXHR.status==400||jqXHR.status==409)r.error="Une erreur s'est produite lors de la mise \u00e0 jour du collaborateur sur "+
applicationName+"."+"<br/> "+jqXHR.responseText;else if(jqXHR.status==401){var res="";if(jqXHR.responseText=="Admin token not found")res="Le compte administrateur de r\u00e9f\u00e9rence n'est pas connu.<br/> Veuillez vous r\u00e9-authentifier via le menu <br/>Traitements -> Sage LinkUp Experts -> Administrateur de r\u00e9f\u00e9rence -> Authentifier le compte de l'administrateur de r\u00e9f\u00e9rence.";r.error="Vous n'\u00eates pas authentifi\u00e9 sur "+applicationName+"."+"<br/> Code erreur : "+
jqXHR.status+"<br/>"+res}else if(jqXHR.status==403)r.error="Vous n'\u00eates pas administrateur du cabinet sur "+applicationName+", vous n'\u00eates pas autoris\u00e9 \u00e0 effectuer ce traitement ("+jqXHR.status+").";else r.error="Une erreur s'est produite lors de la mise \u00e0 jour d'un collaborateur (PUT). "+"<br/> Signature de la m\u00e9thode : updateCollaboratorOfAnOrganization(orgSiren, objMongo, objLinkUp, isAdminClicked, isUpdatedByEmail, username, pw, acc) "+"<br/> Code erreur : "+jqXHR.status+
"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText;r.status=false}})}else{r.status=false;r.error="Une erreur s'est produite lors de la s\u00e9rialization du collaborateur"}return r}
function createCollaboratorOfAnOrganization(orgSiren,objMongo,username,pw,acc){var r={};if(typeof acc==="undefined")acc=0;var o=GetCollaborator(objMongo);if(o!=null){o.IsDeleted=0;$.ajax({type:"POST",url:encodeURI("../../sdata/linkup/admin/organizations('"+orgSiren+"')/collaborators"),username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,
errorThrow){if(jqXHR.status==401){var res="";if(jqXHR.responseText=="Admin token not found")res="Le compte administrateur de r\u00e9f\u00e9rence n'est pas connu.<br/> Veuillez vous r\u00e9-authentifier via le menu <br/>Traitements -> Sage LinkUp Experts -> Administrateur de r\u00e9f\u00e9rence -> Authentifier le compte de l'administrateur de r\u00e9f\u00e9rence.";r.error="Vous n'\u00eates pas authentifi\u00e9 sur "+applicationName+"."+"<br/> Code erreur : "+jqXHR.status+"<br/>"+res}else r.error="Une erreur s'est produite lors de la cr\u00e9ation du collaborateur sur "+
applicationName+". (POST)"+"<br/> Signature de la m\u00e9thode : createCollaboratorOfAnOrganization(orgSiren, objMongo, username, pw, acc) "+"<br/> <span style='font-weight:bold;'>Code erreur : </span> "+jqXHR.status+"<br/> <span style='font-weight:bold;'>D\u00e9tail de l'erreur : </span> "+jqXHR.responseText;r.status=false}})}else{r.status=false;r.error="Une erreur s'est produite lors de la s\u00e9rialization du collaborateur."}return r}
function readAdministratorOfAnOperatingCompany(siren,email,username,pw,acc){if(typeof acc===undefined)acc=0;var r={};$.ajax({type:"GET",url:encodeURI("../../sdata/linkup/operatingCompanies('"+siren+"')/collaborators('"+encodeURIComponent(email)+"')"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,errorThrow){if(jqXHR.status==401)r.error=
"Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else if(jqXHR.status==404)r.status=false;else r.error="Une erreur s'est produite lors de la lecture de l'administrateur d'email "+email+" (GET). "+"<br/> Signature de la m\u00e9thode : readAdministratorOfAnOperatingCompany(siren, email, username, pw, acc) "+"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText}});return r}
function updateAdministratorOfAnOperatingCompany(orgSiren,objMongo,objLinkUp,username,pw,acc){var r={};var o=GetCollaborator(objMongo,true);if(o!=null)$.ajax({type:"PUT",url:encodeURI("../../sdata/linkup/operatingCompanies('"+orgSiren+"')/collaborators('"+encodeURIComponent(o.UserName)+"')"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"html",cache:false,async:false,success:function(data){r.status=
true},error:function(jqXHR,textStatus,errorThrow){if(jqXHR.status==400||jqXHR.status==404||jqXHR.status==300||jqXHR.status==409)r.error="Une erreur s'est produite lors de la mise \u00e0 jour de l'administrateur sur LinkUp."+"<br/> "+jqXHR.responseText+jqXHR.status;else if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else r.error="Une erreur s'est produite lors de la mise \u00e0 jour d'un collaborateur (PUT). "+"<br/> Signature de la m\u00e9thode : updateAdministratorOfAnOperatingCompany(orgSiren, objMongo, objLinkUp, username, pw, acc) "+
"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText;r.status=false}});else{r.status=false;r.error="Une erreur s'est produite lors de la s\u00e9rialization du collaborateur"}return r}
function createAdministratorOfAnOperatingCompany(orgSiren,objMongo,username,pw,acc){if(typeof acc==="undefined")acc=0;var r={};var o=GetCollaborator(objMongo,true);if(o!=null){o.IsDeleted=0;$.ajax({type:"POST",url:encodeURI("../../sdata/linkup/operatingCompanies('"+orgSiren+"')/collaborators"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"text",cache:false,async:false,
success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,errorThrow){if(jqXHR.status==400||jqXHR.status==404||jqXHR.status==300||jqXHR.status==409)r.error="Vous ne pouvez pas cr\u00e9er ce compte."+"<br/> "+jqXHR.responseText;else if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else r.error="Une erreur s'est produite lors de la cr\u00e9ation de l'administrateur sur LinkUp. (POST)"+"<br/> Signature de la m\u00e9thode : createAdministratorOfAnOperatingCompany(orgSiren, objMongo, username, pw, acc) "+
"<br/> <span style='font-weight:bold;'>Code erreur : </span> "+jqXHR.status+"<br/> <span style='font-weight:bold;'>D\u00e9tail de l'erreur : </span> "+jqXHR.responseText;r.status=false}})}else{r.status=false;r.error="Une erreur s'est produite lors de la s\u00e9rialization du collaborateur."}return r}
function readOperatingCompany(siren,username,pw,msg,acc){if(typeof acc==="undefined")acc=0;var r={};if(token==null)getTokenCollaborateur().then(function(token){linkUpModule.bearer=token});$.ajax({type:"GET",url:encodeURI("../../sdata/linkup/checkSirenFree('"+siren+"')"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=data==false;if(data==false)r.error="Une erreur s'est produite lors de la cr\u00e9ation du dossier de Siren "+
siren+" sur LinkUp."+"<br/> D\u00e9tail de l'erreur : Ce siren existe d\u00e9j\u00e0.</span> "},error:function(jqXHR,textStatus,errorThrow){if(jqXHR.status==401)if(msg=="estDossierActiveLinkUp_MODIF")r.error="Vous n\u2019avez pas les droits pour activer le dossier dans Sage LinkUp,"+"<br/> veuillez contacter l\u2019administrateur.";else if(msg=="estDossierActiveComptaCollaborative_MODIF")r.error="Vous n\u2019avez pas les droits pour activer la compta collaborative,"+"<br/> Veuillez contacter l\u2019administrateur";
else r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else if(jqXHR.status==404)r.status=false;else r.error="Une erreur s'est produite lors de la cr\u00e9ation du dossier de Siren "+siren+" sur LinkUp. (GET)"+"<br/> Signature de la m\u00e9thode : readOperatingCompany(siren, username, pw, msg, acc) "+"<br/> Code erreur : </span> "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : </span> "+jqXHR.responseText}});return r}
function unsubscribeOperatingCompany(dossierCourant,siren,username,pw,msg){var r={"status":false};var o=null;$.ajax({type:"POST",url:encodeURI("../../sdata/linkup/organizations('"+siren+"')/unsubscribe"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=true;dossierCourant.dateDebutContratLinkUp="";
dossierCourant.dateFinContratLinkUp="";dossierCourant.typeContrat="";dossierCourant.quotaContrat=0;dossierCourant.estDossierActiveComptaCollaborative=false;dossierCourant.estDossierActiveLinkUp=false},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else if(jqXHR.status==403)r.error="Vous n'\u00eates pas administrateur du cabinet sur LinkUp. Vous ne pouvez pas d\u00e9sabonner de dossier."+
"<br/> Code erreur : "+jqXHR.status;else if($.inArray(jqXHR.status,[400,404,409])>=0)r.error="Erreur : "+"<br/> <br/>"+jqXHR.responseText;else r.error="Une erreur s'est produite lors du d\u00e9sabonnement du dossier sur LinkUp. (POST)"+"<br/> Signature de la m\u00e9thode : unsubscribeOperatingCompany(companySiren, username, pw, acc) "+"<br/> <span style='font-weight:bold;'>Code erreur : </span> "+jqXHR.status+"<br/> <span style='font-weight:bold;'>D\u00e9tail de l'erreur : </span> "+jqXHR.responseText}});
return r}
function updateOperatingCompany(objMongo,objLinkUp,username,pw,acc){if(typeof acc==="undefined")acc=0;var isDeleted=true;var r={};if(objLinkUp.isDeleted!=null)isDeleted=objLinkUp.isDeleted==0?false:true;objMongo.estDossierActiveLinkUp=isDeleted;var o=createLinkUpOperatingCompanyObject(objMongo);if(o!=null)$.ajax({type:"PUT",url:encodeURI("../../sdata/linkup/operatingCompanies('"+o.Siren+"')"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,contentType:"application/json; charset=UTF-8",
data:JSON.stringify(o),dataType:"json",cache:false,async:false,success:function(data){r.status=true},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Cette action de synchronisation a \u00e9chou\u00e9. <br/> <br/> Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else if($.inArray(jqXHR.status,[400,403,404,409])>=0)r.error="Cette action de synchronisation a \u00e9chou\u00e9."+"<br/> <br/>"+jqXHR.responseText;else r.error=
"Cette action de synchronisation a \u00e9chou\u00e9. <br/> <br/> Une erreur s'est produite lors de la mise \u00e0 jour d'un dossier (PUT). "+"<br/> Signature de la m\u00e9thode : updateOperatingCompany(objMongo, objLinkUp, username, pw, acc) "+"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText}});return r}
function createOperatingCompany(sirenCabinet,objMongo,username,pw,acc){if(typeof acc==="undefined")acc=0;var r={"status":false};var copyObjet=null;if(objMongo["Contract"]!=null)copyObjet=objMongo;var o=createLinkUpOperatingCompanyObject(objMongo);o["IsDeleted"]=0;if(o!=null){if(copyObjet!=null)o["Contract"]=copyObjet["Contract"];$.ajax({type:"POST",url:encodeURI("../../sdata/linkup/organizations('"+sirenCabinet+"')/operatingCompanies"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},
username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"json",cache:false,async:false,success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else if(jqXHR.status==403)r.error="Vous n'\u00eates pas administrateur du cabinet sur LinkUp. Vous ne pouvez pas cr\u00e9er de dossier."+
"<br/> Code erreur : "+jqXHR.status;else if($.inArray(jqXHR.status,[400,404,409])>=0)r.error="Il est impossible de publier ce dossier."+"<br/> <br/>"+jqXHR.responseText;else r.error="Une erreur s'est produite lors de la cr\u00e9ation du dossier sur LinkUp. (POST)"+"<br/> Signature de la m\u00e9thode : createOperatingCompany(sirenCabinet, objMongo, username, pw, acc) "+"<br/> <span style='font-weight:bold;'>Code erreur : </span> "+jqXHR.status+"<br/> <span style='font-weight:bold;'>D\u00e9tail de l'erreur : </span> "+
jqXHR.responseText;if(objMongo["dateDebutContratLinkUp"]!=null&&objMongo["dateDebutContratLinkUp"]!="")objMongo["dateDebutContratLinkUp"]=null;if(objMongo["dateFinContratLinkUp"]!=null&&objMongo["dateFinContratLinkUp"]!="")objMongo["dateFinContratLinkUp"]=null;if(objMongo["typeContrat"]!=null&&objMongo["typeContrat"]!="")objMongo["typeContrat"]=null;if(objMongo["quotaContrat"]!=null&&objMongo["quotaContrat"]!="")objMongo["quotaContrat"]=null}})}else r.status=false;return r}
function enableCollaborativeAccounting(siren,objMongo,isActiv,username,pw,acc){if(typeof acc==="undefined")acc=0;var r={"status":false};var o=createLinkUpOperatingCompanyObject(objMongo);o["IsDeleted"]=0;if(o!=null)$.ajax({type:"POST",url:encodeURI("../../sdata/linkup/organizations('"+siren+"')/UpdateSharedAccounting/"+isActiv),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,contentType:"application/json; charset=UTF-8",data:JSON.stringify(o),dataType:"json",
cache:false,async:false,success:function(data){r.data=data;r.status=true},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;else if(jqXHR.status==403)r.error="Vous n'\u00eates pas administrateur sur LinkUp. Vous ne pouvez pas cr\u00e9er de dossier."+"<br/> Code erreur : "+jqXHR.status;else if($.inArray(jqXHR.status,[400,404,409])>=0)r.error="Il est impossible de publier ce dossier."+
"<br/> <br/>"+jqXHR.responseText;else r.error="Une erreur s'est produite lors de la cr\u00e9ation du dossier sur LinkUp. (POST)"+"<br/> Signature de la m\u00e9thode : createLinkUpOperatingCompanyObject(siren, objMongo, isActiv, username, pw, acc) "+"<br/> <span style='font-weight:bold;'>Code erreur : </span> "+jqXHR.status+"<br/> <span style='font-weight:bold;'>D\u00e9tail de l'erreur : </span> "+jqXHR.responseText}});else r.status=false;return r}
function getOperatingCompanyLastContract(orgSiren,opeSiren,username,pw,acc){if(typeof acc==="undefined")acc=0;var r={};$.ajax({type:"GET",url:encodeURI("../../sdata/linkup/organizations('"+orgSiren+"')/operatingCompanies('"+opeSiren+"')/contracts?orderBy=endDate desc"),headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,dataType:"json",cache:false,async:false,success:function(data){if(data.$resources==null||data.$resources.length==0)r.data=null;else r.data=
data.$resources[0];r.status=true},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status;if(jqXHR.status==403)r.error="Vous n'\u00eates pas autoris\u00e9 \u00e0 mettre  \u00e0 jour le contrat depuis LinkUp."+"<br/> Code erreur : "+jqXHR.status}});return r}
function GetLinkUpCountries(username,pw,acc){if(typeof acc==="undefined")acc=0;var r={};$.ajax({type:"GET",url:encodeURI(sDataUrlPrefix+"/countries"),cache:true,headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,dataType:"json",async:false,success:function(data){r.status=true;r.data=data},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+jqXHR.status}});
return r}
function GetLinkUpLegalForms(username,pw,acc){if(typeof acc==="undefined")acc=0;var r={};$.ajax({type:"GET",url:encodeURI(sDataUrlPrefix+"/legalForms"),cache:true,headers:{"AuthorizationSageIdBearer":"Bearer "+linkUpModule.bearer},username:username,password:pw,dataType:"json",async:false,success:function(data){if(data.$resources==null)r.status=false;else{r.status=true;r.data=data.$resources}},error:function(jqXHR,textStatus,errorThrow){r.status=false;if(jqXHR.status==401)r.error="Vous n'\u00eates pas authentifi\u00e9 sur LinkUp."+"<br/> Code erreur : "+
jqXHR.status}});return r}function GetObjetMongoCourant(id,username,pw){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=_id eq '"+id+"'&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]});return res}
function GetObjetMongoListCollaboratorByEmail(email,username,pw){var res=null;$.ajax({url:encodeURI("/mongo/Personne?where=email eq '"+email+"'"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true},type:"GET"}).success(function(data){res=data});return res}
function GetObjetMongoRoleFromPersonneId(id,username,pw){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=personne eq '/mongo/Personne/"+id+"' and type eq 'Collaborateur'&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0]});return res}
function GetLstCabinetsActives(username,pw){var res=null;$.ajax({url:encodeURI("/mongo/Role?where=type eq 'Dossier' and estEntite eq true and estCabinetActiveLinkUp eq true&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET"}).success(function(data){res=data});return res}
function GetDossiersActives(username,pw){var result={status:false};$.ajax({url:encodeURI("/mongo/Role?where=type eq 'Dossier' and estDossierActiveLinkUp eq true&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET",success:function(data){result.status=true;result.data=data},error:function(jqXHR,textStatus,errorThrow){result.error="Une erreur s'est produite lors de la r\u00e9cup\u00e9ration des dossiers activ\u00e9s sur Sage LinkUp Experts. (GET)"+
"<br/><br/> Signature de la m\u00e9thode : GetDossiersActives(username, pw) "+"<br/> Code erreur : "+jqXHR.status+"<br/><br/> D\u00e9tail de l'erreur : <br/>"+jqXHR.responseText}});return result}
function GetLinkUpAdministrators(username,pw){var result={status:false};$.ajax({type:"GET",url:encodeURI("/mongo/Role?where=type eq 'Collaborateur' and estAdministrateurCabinet eq true"),username:username,password:pw,postData:{format:"application/json",pageable:true},dataType:"json",cache:false,async:false,success:function(data){result.status=true;result.data=data},error:function(jqXHR,textStatus,errorThrow){result.error="Une erreur s'est produite lors de la r\u00e9cup\u00e9ration des administrateurs activ\u00e9s sur Sage LinkUp Experts. (GET)"+
"<br/><br/> Signature de la m\u00e9thode : GetLinkUpAdministrators(username, pw) "+"<br/> Code erreur : "+jqXHR.status+"<br/><br/> D\u00e9tail de l'erreur : <br/>"+jqXHR.responseText}});return result}
function GetListActivatedOrganizations(username,pw){var r={};$.ajax({url:encodeURI("/mongo/Role?where=type eq 'Dossier' and estEntite eq true and estCabinetActiveLinkUp eq true&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET",success:function(data){r.status=true;r.data=data},error:function(jqXHR,textStatus,errorThrow){r.status=false;r.error="Une erreur s'est produite lors de la r\u00e9cup\u00e9ration des entit\u00e9s activ\u00e9es. (GET)"+
"<br/> Signature de la m\u00e9thode : GetListActivatedOrganizations(username, pw) "+"<br/> Code erreur : </span> "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : </span> "+jqXHR.responseText}});return r}
function GetListOfSuperAdministrators(username,pw){var r={};$.ajax({url:encodeURI("/mongo/Role?where=type eq 'Collaborateur' and estCollaborateurCabinet eq true and estAdministrateurCabinet eq true and estAdministrateurCabinetReference eq true&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET",success:function(data){r.status=true;r.data=data},error:function(jqXHR,textStatus,errorThrow){r.status=
false;r.error="Une erreur s'est produite lors de la r\u00e9cup\u00e9ration des administrateurs de r\u00e9f\u00e9rence. (GET)"+"<br/> Signature de la m\u00e9thode : GetListOfSuperAdministrators(username, pw) "+"<br/> Code erreur : </span> "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : </span> "+jqXHR.responseText}});return r}
function GetLinkUpAdminRightByUser(username,pw){var r={};$.ajax({type:"GET",url:encodeURI("/sdata/coala/collaborateurs('"+username+"')/droits('Administrer LinkUp')"),dataType:"json",username:username,password:pw,cache:false,async:false,postData:{format:"application/json"},success:function(data){r.status=true;r.data=data},error:function(jqXHR,textStatus,errorThrow){r.status=false;r.error="Une erreur s'est produite lors de la r\u00e9cup\u00e9ration des droits de l'utilisateur "+username+". (GET)"+"<br/> Signature de la m\u00e9thode : GetUserRights(username, pw) "+
"<br/> Code erreur : </span> "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : </span> "+jqXHR.responseText}});return r}
function readSirenOfAnOperatingCompany(idEtablissement,username,pw){var res=null;$.ajax({url:encodeURI("/mongo/Role?where= idEtablissement eq '"+idEtablissement+"' and type eq 'Dossier'&include=personne"),username:username,password:pw,dataType:"json",cache:false,async:false,postData:{format:"application/json",pageable:true,include:"personne"},type:"GET"}).success(function(data){if(data!=null&&data[0]!==undefined)res=data[0].personne.siren});return res}
function unsetSageId(user,mdp){var roleObjectId=getParameterValueFromUrl("reqRole");var result={status:false};if(/\/mongo\/Role\/\w*/.test(roleObjectId)){roleObjectId=roleObjectId.replace("/mongo/Role/","");var roleObject=GetObjetMongoCourant(roleObjectId,user,mdp);if(roleObject!=null&&roleObject.personne!=null&&typeof roleObject.personne.sageId!=="undefined"){var newPersonne=$.extend({},roleObject.personne);delete newPersonne.sageId;$.ajax({url:encodeURI(urlParams.req+"?"+urlParams.date+"&propagation=true"),
type:"POST",username:user,password:mdp,async:false,cache:false,contentType:"application/json; charset=utf-8",data:JSON.stringify(newPersonne),success:function(){result.status=true},error:function(jqXHR,textStatus,errorThrown){result.message="Le Sage Id n'a pu \u00eatre mis \u00e0 jour"+"<br/> Code erreur : "+jqXHR.status+"<br/> D\u00e9tail de l'erreur : "+jqXHR.responseText}})}else result.status=true}else result.message="Le Sage Id n'a pu \u00eatre mis \u00e0 jour"+"<br/> L'ID du role n'a pu etre lu dans l'URL";
return result}function getSirenExtended(aRoleAndAPerson){if(aRoleAndAPerson==null)return null;var siren=aRoleAndAPerson.personne.siren;if(aRoleAndAPerson.idEtablissementLinkUp!=null)siren+="-"+aRoleAndAPerson.idEtablissementLinkUp;return siren};$coala.Role_dateDebutContratLinkUp_BULLE=function(obj,plugin){return"Les conditions du contrat sont \u00e0 modifier dans le BackOffice du site Sage LinkUp Experts"};$coala.Role_dateFinContratLinkUp_BULLE=function(obj,plugin){return"Les conditions du contrat sont \u00e0 modifier dans le BackOffice du site Sage LinkUp Experts"};$coala.Role_typeContrat_BULLE=function(obj,plugin){return"Les conditions du contrat sont \u00e0 modifier dans le BackOffice du site Sage LinkUp Experts"};
$coala.Role_quotaContrat_BULLE=function(obj,plugin){return"Les conditions du contrat sont \u00e0 modifier dans le BackOffice du site Sage LinkUp Experts"};
