Array.prototype.distinct=function(){for(var b=[],a=0;a<this.length;a++)$.inArray(this[a],b)==-1&&b.push(this[a]);return b};(function(){window.InstallColumnCalculation=function(b,a){for(var f=b.attr("data-calculation"),c=0;c<a.length;c++){var d=a[c],i=e(d.Index);if(f.indexOf(i)==-1)continue;$("#"+d.Id).change(function(){g()})}g();function g(){var m="var ",i=[];if(a.length>0)var p=$("#"+a[0].Id).closest(".answer-grid");for(var j=0;j<a.length;j++){var l=a[j],k=$("#"+l.Id);h(k,p);var g=e(l.Index);if(f.indexOf(g)==-1)continue;g+=" = ";var d=k.val();if(d==null||d=="")d=0;g+=d;i.push(g)}var m="";if(i.length>0)m="var "+i.join(", ")+";";var o=m+b.attr("data-calculation"),c;try{c=eval(o);if(c!=undefined&&isNaN(c))c="ERROR";else c=c.toFixed(2)}catch(q){c="ERROR"}var n=b.val();if(n!=c){b.val(c);b.change()}b.blur()}function h(a,c){if(a.attr("data-val-currency")!==undefined){a.addClass("format-currency");var b=c.find("td[data-sum-column-index='"+a.attr("data-column-index")+"']");b.attr("data-sum-format","currency")}}function e(a){var b=typeof a;if(b!="number")throw"The column index was not a numeric index, but rather ["+b+"]. The index must be number between 0-11";if(a>=12)throw"The column index is restricted to 0-11. Attempted to convert index ["+a+"] to a cell letter.";var c=String.fromCharCode(a+65);return c}}})();var JSON;if(!JSON)JSON={};(function(){"use strict";function c(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var h=/[\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,a,d,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},b;function g(a){f.lastIndex=0;return f.test(a)?'"'+a.replace(f,function(a){var b=i[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(m,n){var h,j,i,k,l=a,f,c=n[m];if(c&&typeof c==="object"&&typeof c.toJSON==="function")c=c.toJSON(m);if(typeof b==="function")c=b.call(n,m,c);switch(typeof c){case"string":return g(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";a+=d;f=[];if(Object.prototype.toString.apply(c)==="[object Array]"){k=c.length;for(h=0;h<k;h+=1)f[h]=e(h,c)||"null";i=f.length===0?"[]":a?"[\n"+a+f.join(",\n"+a)+"\n"+l+"]":"["+f.join(",")+"]";a=l;return i}if(b&&typeof b==="object"){k=b.length;for(h=0;h<k;h+=1)if(typeof b[h]==="string"){j=b[h];i=e(j,c);i&&f.push(g(j)+(a?": ":":")+i)}}else for(j in c)if(Object.prototype.hasOwnProperty.call(c,j)){i=e(j,c);i&&f.push(g(j)+(a?": ":":")+i)}i=f.length===0?"{}":a?"{\n"+a+f.join(",\n"+a)+"\n"+l+"}":"{"+f.join(",")+"}";a=l;return i}}if(typeof JSON.stringify!=="function")JSON.stringify=function(h,c,f){var g;a="";d="";if(typeof f==="number")for(g=0;g<f;g+=1)d+=" ";else if(typeof f==="string")d=f;b=c;if(c&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return e("",{"":h})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){var b;function d(f,g){var b,e,a=f[g];if(a&&typeof a==="object")for(b in a)if(Object.prototype.hasOwnProperty.call(a,b)){e=d(a,b);if(e!==undefined)a[b]=e;else delete a[b]}return c.call(f,g,a)}a=String(a);h.lastIndex=0;if(h.test(a))a=a.replace(h,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,""))){b=eval("("+a+")");return typeof c==="function"?d({"":b},""):b}throw new SyntaxError("JSON.parse");}})();(function(a){a.postJSON=function(d,c,b){a.ajax({url:d,type:"POST",dataType:"json",data:JSON.stringify(c),contentType:"application/json; charset=utf-8",success:b})}})(jQuery);(function(a){a.extend({tablesorter:new function(){var b=[],e=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:"/.|,/g",onRenderHeader:null,selectorHeaders:"thead th",debug:false};function c(b,a){f(b+","+(+new Date-a.getTime())+"ms")}this.benchmark=c;function f(a){if(typeof console!="undefined"&&typeof console.debug!="undefined")console.log(a);else alert(a)}function k(c,e){if(c.config.debug)var h="";if(c.tBodies.length==0)return;var g=c.tBodies[0].rows;if(g[0])for(var i=[],j=g[0].cells,k=j.length,b=0;b<k;b++){var d=false;if(a.metadata&&a(e[b]).metadata()&&a(e[b]).metadata().sorter)d=l(a(e[b]).metadata().sorter);else if(c.config.headers[b]&&c.config.headers[b].sorter)d=l(c.config.headers[b].sorter);if(!d)d=s(c,g,-1,b);if(c.config.debug)h+="column:"+b+" parser:"+d.id+"\n";i.push(d)}c.config.debug&&f(h);return i}function s(e,i,a,j){var k=b.length,g=false,d=false,h=true;while(d==""&&h){a++;if(i[a]){g=r(i,a,j);d=x(e.config,g);e.config.debug&&f("Checking if value was empty on row:"+a)}else h=false}for(var c=1;c<k;c++)if(b[c].is(d,e,g))return b[c];return b[0]}function r(c,b,a){return c[b].cells[a]}function x(b,c){return a.trim(g(b,c))}function l(c){for(var d=b.length,a=0;a<d;a++)if(b[a].id.toLowerCase()==c.toLowerCase())return b[a];return false}function o(b){if(b.config.debug)var l=new Date;for(var j=b.tBodies[0]&&b.tBodies[0].rows.length||0,k=b.tBodies[0].rows[0]&&b.tBodies[0].rows[0].cells.length||0,m=b.config.parsers,d={row:[],normalized:[]},i=0;i<j;++i){var e=a(b.tBodies[0].rows[i]),h=[];if(e.hasClass(b.config.cssChildRow)){d.row[d.row.length-1]=d.row[d.row.length-1].add(e);continue}d.row.push(e);for(var f=0;f<k;++f)h.push(m[f].format(g(b.config,e[0].cells[f]),b,e[0].cells[f]));h.push(d.normalized.length);d.normalized.push(h);h=null}b.config.debug&&c("Building cache for "+j+" rows:",l);return d}function g(c,b){var d="";if(!b)return"";if(!c.supportsTextContent)c.supportsTextContent=b.textContent||false;if(c.textExtraction=="simple")if(c.supportsTextContent)d=b.textContent;else if(b.childNodes[0]&&b.childNodes[0].hasChildNodes())d=b.childNodes[0].innerHTML;else d=b.innerHTML;else if(typeof c.textExtraction=="function")d=c.textExtraction(b);else d=a(b).text();return d}function h(b,p){if(b.config.debug)var l=new Date;for(var k=p,j=k.row,h=k.normalized,o=h.length,m=h[0].length-1,n=a(b.tBodies[0]),d=[],f=0;f<o;f++){var e=h[f][m];d.push(j[e]);if(!b.config.appender)for(var q=j[e].length,g=0;g<q;g++)n[0].appendChild(j[e][g])}b.config.appender&&b.config.appender(b,d);d=null;b.config.debug&&c("Rebuilt table:",l);i(b);setTimeout(function(){a(b).trigger("sortEnd")},0)}function B(b){if(b.config.debug)var e=new Date;var g=a.metadata?true:false,d=q(b);$tableHeaders=a(b.config.selectorHeaders,b).each(function(c){this.column=d[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=w(b.config.sortInitialOrder);this.count=this.order;if(u(this)||v(b,c))this.sortDisabled=true;if(j(b,c))this.order=this.lockedOrder=j(b,c);if(!this.sortDisabled){var e=a(this).addClass(b.config.cssHeader);b.config.onRenderHeader&&b.config.onRenderHeader.apply(e)}b.config.headerList[c]=this});if(b.config.debug){c("Built headers:",e);f($tableHeaders)}return $tableHeaders}function q(q){for(var c=[],i={},p=q.getElementsByTagName("THEAD")[0],k=p.getElementsByTagName("TR"),f=0;f<k.length;f++)for(var j=k[f].cells,g=0;g<j.length;g++){var e=j[g],b=e.parentNode.rowIndex,o=b+"-"+e.cellIndex,n=e.rowSpan||1,m=e.colSpan||1,d;if(typeof c[b]=="undefined")c[b]=[];for(var a=0;a<c[b].length+1;a++)if(typeof c[b][a]=="undefined"){d=a;break}i[o]=d;for(var a=b;a<b+n;a++){if(typeof c[a]=="undefined")c[a]=[];for(var l=c[a],h=d;h<d+m;h++)l[h]="x"}}return i}function u(b){return a.metadata&&a(b).metadata().sorter===false?true:false}function v(a,b){return a.config.headers[b]&&a.config.headers[b].sorter===false?true:false}function j(a,b){return a.config.headers[b]&&a.config.headers[b].lockedOrder?a.config.headers[b].lockedOrder:false}function i(b){for(var c=b.config.widgets,d=c.length,a=0;a<d;a++)m(c[a]).format(b)}function m(b){for(var c=e.length,a=0;a<c;a++)if(e[a].id.toLowerCase()==b.toLowerCase())return e[a]}function w(a){return typeof a!="Number"?a.toLowerCase()=="desc"?1:0:a==1?1:0}function A(d,b){for(var c=b.length,a=0;a<c;a++)if(b[a][0]==d)return true;return false}function n(h,e,c,d){e.removeClass(d[0]).removeClass(d[1]);var f=[];e.each(function(){if(!this.sortDisabled)f[this.column]=a(this)});for(var g=c.length,b=0;b<g;b++)f[c[b][0]].addClass(d[c[b][1]])}function z(b){var d=b.config;if(d.widthFixed){var c=a("<colgroup>");a("tr:first td",b.tBodies[0]).each(function(){c.append(a("<col>").css("width",a(this).width()))});a(b).prepend(c)}}function t(e,b){for(var f=e.config,g=b.length,a=0;a<g;a++){var d=b[a],c=f.headerList[d[0]];c.count=d[1];c.count++}}function p(g,f,h){if(g.config.debug)var m=new Date;for(var a="var sortWrapper = function(a,b) {",l=f.length,b=0;b<l;b++){var e=f[b][0],i=f[b][1],n=g.config.parsers[e].type=="text"?i==0?d("text","asc",e):d("text","desc",e):i==0?d("numeric","asc",e):d("numeric","desc",e),j="e"+b;a+="var "+j+" = "+n;a+="if("+j+") { return "+j+"; } ";a+="else { "}var k=h.normalized[0].length-1;a+="return a["+k+"]-b["+k+"];";for(var b=0;b<l;b++)a+="}; ";a+="return 0; ";a+="}; ";g.config.debug&&c("Evaling expression:"+a,new Date);eval(a);h.normalized.sort(sortWrapper);g.config.debug&&c("Sorting on "+f.toString()+" and dir "+i+" time:",m);return h}function d(d,c,e){var a="a["+e+"]",b="b["+e+"]";return d=="text"&&c=="asc"?"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));":d=="text"&&c=="desc"?"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));":d=="numeric"&&c=="asc"?"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));":d=="numeric"&&c=="desc"?"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));":void 0}this.construct=function(b){return this.each(function(){if(!this.tHead||!this.tBodies)return;var d,l,e,f,c,q=0,r;this.config={};c=a.extend(this.config,a.tablesorter.defaults,b);d=a(this);a.data(this,"tablesorter",c);e=B(this);this.config.parsers=k(this,e);f=o(this);var j=[c.cssDesc,c.cssAsc];z(this);e.click(function(o){var m=d[0].tBodies[0]&&d[0].tBodies[0].rows.length||0;if(!this.sortDisabled&&m>0){d.trigger("sortStart");var q=a(this),g=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!o[c.sortMultiSortKey]){c.sortList=[];if(c.sortForce!=null)for(var k=c.sortForce,b=0;b<k.length;b++)k[b][0]!=g&&c.sortList.push(k[b]);c.sortList.push([g,this.order])}else if(A(g,c.sortList))for(var b=0;b<c.sortList.length;b++){var i=c.sortList[b],l=c.headerList[i[0]];if(i[0]==g){l.count=i[1];l.count++;i[1]=l.count%2}}else c.sortList.push([g,this.order]);setTimeout(function(){n(d[0],e,c.sortList,j);h(d[0],p(d[0],c.sortList,f))},1);return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){var a=this;setTimeout(function(){a.config.parsers=k(a,e);f=o(a)},1)}).bind("updateCell",function(d,a){var c=this.config,b=[a.parentNode.rowIndex-1,a.cellIndex];f.normalized[b[0]][b[1]]=c.parsers[b[1]].format(g(c,a),a)}).bind("sorton",function(g,d){a(this).trigger("sortStart");c.sortList=d;var b=c.sortList;t(this,b);n(this,e,b,j);h(this,p(this,b,f))}).bind("appendCache",function(){h(this,f)}).bind("applyWidgetId",function(b,a){m(a).format(this)}).bind("applyWidgets",function(){i(this)});if(a.metadata&&a(this).metadata()&&a(this).metadata().sortlist)c.sortList=a(this).metadata().sortlist;c.sortList.length>0&&d.trigger("sorton",[c.sortList]);i(this)})};this.addParser=function(c){for(var e=b.length,d=true,a=0;a<e;a++)if(b[a].id.toLowerCase()==c.id.toLowerCase())d=false;d&&b.push(c)};this.addWidget=function(a){e.push(a)};this.formatFloat=function(b){var a=parseFloat(b.toString().replace(new RegExp(/,/g),""));return isNaN(a)?0:a};this.formatInt=function(b){var a=parseInt(b.toString().replace(new RegExp(/,/g),""));return isNaN(a)?0:a};this.isDigit=function(b){return/^[-+]?\d*$/.test(a.trim(b.replace(/[,.']/g,"")))};this.clearTableBody=function(b){if(a.browser.msie){function c(){while(this.firstChild)this.removeChild(this.firstChild)}c.apply(b.tBodies[0])}else b.tBodies[0].innerHTML=""}}});a.fn.extend({tablesorter:a.tablesorter.construct});var b=a.tablesorter;b.addParser({id:"text",is:function(){return true},format:function(b){return a.trim(b.toLocaleLowerCase())},type:"text"});b.addParser({id:"digit",is:function(d,b){var c=b.config;return a.tablesorter.isDigit(d,c)},format:function(b){return a.tablesorter.formatFloat(b)},type:"numeric"});b.addParser({id:"currency",is:function(a){return/^[£$€?.]/.test(a)},format:function(b){return a.tablesorter.formatFloat(b.replace(new RegExp(/[£$€]/g),""))},type:"numeric"});b.addParser({id:"ipAddress",is:function(a){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(a)},format:function(g){for(var e=g.split("."),d="",f=e.length,c=0;c<f;c++){var b=e[c];if(b.length==2)d+="0"+b;else d+=b}return a.tablesorter.formatFloat(d)},type:"numeric"});b.addParser({id:"url",is:function(a){return/^(https?|ftp|file):\/\/$/.test(a)},format:function(a){return jQuery.trim(a.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"});b.addParser({id:"isoDate",is:function(a){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},format:function(b){return a.tablesorter.formatFloat(b!=""?+new Date(b.replace(new RegExp(/-/g),"/")):"0")},type:"numeric"});b.addParser({id:"percent",is:function(b){return/\%$/.test(a.trim(b))},format:function(b){return a.tablesorter.formatFloat(b.replace(new RegExp(/%/g),""))},type:"numeric"});b.addParser({id:"usLongDate",is:function(a){return a.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(b){return a.tablesorter.formatFloat(+new Date(b))},type:"numeric"});b.addParser({id:"shortDate",is:function(a){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(a)},format:function(b,d){var c=d.config;b=b.replace(/\-/g,"/");if(c.dateFormat=="us")b=b.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");else if(c.dateFormat=="uk")b=b.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy")b=b.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");return a.tablesorter.formatFloat(+new Date(b))},type:"numeric"});b.addParser({id:"time",is:function(a){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(a)},format:function(b){return a.tablesorter.formatFloat(+new Date("2000/01/01 "+b))},type:"numeric"});b.addParser({id:"metadata",is:function(){return false},format:function(f,c,d){var b=c.config,e=!b.parserMetadataName?"sortValue":b.parserMetadataName;return a(d).metadata()[e]},type:"numeric"});b.addWidget({id:"zebra",format:function(b){if(b.config.debug)var f=new Date;var c,e=-1,d;a("tr:visible",b.tBodies[0]).each(function(){c=a(this);if(!c.hasClass(b.config.cssChildRow))e++;d=e%2==0;c.removeClass(b.config.widgetZebra.css[d?0:1]).addClass(b.config.widgetZebra.css[d?1:0])});b.config.debug&&a.tablesorter.benchmark("Applying Zebra widget",f)}})})(jQuery);(function(a){a.fn.textlimit=function(f,c,g){var i=g||15,h=g!=-1,j=true,b=this[0],d=false;e();function e(){typeof b=="object"&&a(f).text(Math.max(0,c-b.value.length)+" characters remaining.")}this.keydown(function(a){if(a.which==17)d=true;if(this.value.length<c)return;if(a.which==65&&d==true)return;if(a.which==86&&d==true)return;if(a.which==8||a.which==46)return;if(a.which>=37&&a.which<=40)return;if(a.which==35||a.which==36)return;a.preventDefault()}).keyup(function(k){e();if(k.which==17)d=false;if(this.value.length>=c&&j)if(h){if(this.value.length-c>10)b.value=b.value.substr(0,c+100);var g=setInterval(function(){if(b.value.length<=c){g=clearInterval(g);e()}else{b.value=b.value.substring(0,b.value.length-1);a(f).text("Trimming...")}},i)}else this.value=b.value.substr(0,c)})}})(jQuery);(function(a){function c(b,a,c){this.dec=b;this.group=a;this.neg=c}function b(a){var d=".",b=",",e="-";if(a=="us"||a=="ae"||a=="eg"||a=="il"||a=="jp"||a=="sk"||a=="th"||a=="cn"||a=="hk"||a=="tw"||a=="au"||a=="ca"||a=="gb"||a=="in"){d=".";b=","}else if(a=="de"||a=="vn"||a=="es"||a=="dk"||a=="at"||a=="gr"||a=="br"){d=",";b="."}else if(a=="cz"||a=="fr"||a=="fi"||a=="ru"||a=="se"){b=" ";d=","}else if(a=="ch"){b="'";d="."}return new c(d,b,e)}a.formatNumber=function(f,e){var e=a.extend({},a.fn.parse.defaults,e),c=b(e.locale.toLowerCase()),g=c.dec,i=c.group,h=c.neg,d=new String(f);d=d.replace(".",g).replace("-",h);return d};a.fn.parse=function(d){var d=a.extend({},a.fn.parse.defaults,d),c=b(d.locale.toLowerCase()),h=c.dec,f=c.group,i=c.neg,g="1234567890.-",e=[];this.each(function(){var b=new String(a(this).text());if(a(this).is(":input"))b=new String(a(this).val());b=b.replace(f,"").replace(h,".").replace(i,"-");var d="",k=false;if(b.charAt(b.length-1)=="%")k=true;for(var j=0;j<b.length;j++)if(g.indexOf(b.charAt(j))>-1)d=d+b.charAt(j);var c=new Number(d);if(k){c=c/100;c=c.toFixed(d.length-1)}e.push(c)});return e};a.fn.format=function(c){var c=a.extend({},a.fn.format.defaults,c),d=b(c.locale.toLowerCase()),g=d.dec,f=d.group,h=d.neg,e="0#-,.";return this.each(function(){var v=new String(a(this).text());if(a(this).is(":input"))v=new String(a(this).val());for(var j="",s=false,b=0;b<c.format.length;b++)if(e.indexOf(c.format.charAt(b))==-1)j=j+c.format.charAt(b);else if(b==0&&c.format.charAt(b)=="-"){s=true;continue}else break;for(var n="",b=c.format.length-1;b>=0;b--)if(e.indexOf(c.format.charAt(b))==-1)n=c.format.charAt(b)+n;else break;c.format=c.format.substring(j.length);c.format=c.format.substring(0,c.format.length-n.length);var i=new Number(v.replace(f,"").replace(g,".").replace(h,"-"));if(n=="%")i=i*100;var d="",w=i%1;if(c.format.indexOf(".")>-1){var p=g,o=c.format.substring(c.format.lastIndexOf(".")+1),k=new String(w.toFixed(o.length));k=k.substring(k.lastIndexOf(".")+1);for(var b=0;b<o.length;b++)if(o.charAt(b)=="#"&&k.charAt(b)!="0"){p+=k.charAt(b);break}else if(o.charAt(b)=="0")p+=k.charAt(b);d+=p}else i=Math.round(i);var r=Math.floor(i);if(i<0)r=Math.ceil(i);var l="";if(r==0)l="0";else{var m="";if(c.format.indexOf(".")==-1)m=c.format;else m=c.format.substring(0,c.format.indexOf("."));var u=new String(r),t=9999;if(m.lastIndexOf(",")!=-1)t=m.length-m.lastIndexOf(",")-1;for(var q=0,b=u.length-1;b>-1;b--){l=u.charAt(b)+l;q++;if(q==t&&b!=0){l=f+l;q=0}}}d=l+d;if(i<0&&s&&j.length>0){d=d.substring(1);j=h+j}d=j+d+n;if(a(this).is(":input"))a(this).val(d);else a(this).text(d)})};a.fn.parse.defaults={locale:"us"};a.fn.format.defaults={format:"#,###.00",locale:"us"}})(jQuery);(function(){window.FormsCommon={FocusInFirstElement:function(){b()},AddMaxLengthAttributes:function(){a()}};function b(){$("form:first *:input[type!=hidden]:enabled:first").focus()}function a(){$("input[data-val-length-max]").each(function(){var a=$(this);a.attr("maxlength",a.attr("data-val-length-max"))});var a=0;$("textarea[data-val-length-max], textarea[data-maxlength]").each(function(){var b=$(this),c=parseInt(b.attr("data-val-length-max"));if(isNaN(c))c=parseInt(b.attr("data-maxlength"));var d="textarea-counter-"+a++;b.after($("<div></div>").addClass("text-area-counter").attr("id",d));b.textlimit("#"+d,c)})}})();if(typeof jQuery=="undefined")throw"jQuery required.";(function(a){a.extend({DirtyForm:{debug:false,dirtyClass:"dirty",logger:function(a){if(this.debug){a="DirtyForm: "+a;window.console&&console.log(a)}},unsavedChangesMessage:"\n\n********************************************\n\nAn entry on the page was changed but has not been saved.\nIf you continue and leave this page your changes will be lost.\n\n********************************************\n\n",valueGetter:function(a){return a.is(":radio,:checkbox")?typeof a.attr("checked")=="undefined"?false:a.attr("checked"):a.val()},dirtifier:function(f){var b=a(f.target),c=b.parents(".watched-for-dirty"),e=b.data("clean-value"),d=a.DirtyForm.valueGetter(b);if(c.length!=1)return;if(e!=d){a.DirtyForm.logger("Input "+b.get(0).id+" is dirty.");c.addClass(a.DirtyForm.dirtyClass);b.addClass(a.DirtyForm.dirtyClass)}else{a.DirtyForm.logger("Input "+b.get(0).id+" is clean.");b.removeClass(a.DirtyForm.dirtyClass);if(a("."+a.DirtyForm.dirtyClass,c).length==0){c.removeClass(a.DirtyForm.dirtyClass);a.DirtyForm.logger("Its form is clean, too.")}}},isDirty:function(){var b=a(".watched-for-dirty."+a.DirtyForm.dirtyClass);return b.length>0},shouldAbortPageChange:function(){return!a.DirtyForm.isDirty()?false:confirm(a.DirtyForm.unsavedChangesMessage)?false:true}}});var b=false;a.fn.dirtyform=function(){if(!b){window.onbeforeunload=function(){if(a.DirtyForm.isDirty())return a.DirtyForm.unsavedChangesMessage};a("a").live("click",function(c){a.DirtyForm.logger("Link clicked.");var b=a(c.target);if(b.is(".page-change-link")){a.DirtyForm.logger("and it's a special link.");if(!a.DirtyForm.isDirty()||confirm(a.DirtyForm.unsavedChangesMessage)){a("."+a.DirtyForm.dirtyClass).removeClass(a.DirtyForm.dirtyClass);b.trigger("pageChangeClick")}c.preventDefault()}if(b.is(".skip-dirty-check")){a(".watched-for-dirty").removeClass("watched-for-dirty");a("."+a.DirtyForm.dirtyClass).removeClass(a.DirtyForm.dirtyClass)}});a("body").bind("ProgressReportAnswersSaved",function(){a("form.watched-for-dirty").dirtyform()});a("body").bind("dynamic-content-added-to-form",function(c,b){a(b).addClass(a.DirtyForm.dirtyClass)});a("body").bind("dynamic-content-removed-from-form",function(c,b){a(b).addClass(a.DirtyForm.dirtyClass)});b=true}return this.each(function(){var b=a(this);if(b.is(".dirty-check-ignore"))return;var d=":submit,:password,:button,.dirty-check-ignore",c=a(":input:not("+d+")",b);if(b.hasClass("watched-for-dirty")){b.removeClass(a.DirtyForm.dirtyClass);c.unbind("blur.dirtyforms").unbind("click.dirtyforms").unbind("datepickerOnSelect.dirtyforms").removeClass(a.DirtyForm.dirtyClass)}else{b.addClass("watched-for-dirty");b.submit(function(a){if(a.isDefaultPrevented()||a.isImmediatePropagationStopped())return;b.removeClass("watched-for-dirty")})}a.DirtyForm.logger("Storing initial data for form "+b.get(0));c.each(function(){var b=a(this);if(b.is(":radio,:checkbox"))b.bind("change.dirtyforms",a.DirtyForm.dirtifier);else{b.bind("blur.dirtyforms",a.DirtyForm.dirtifier);b.bind("datepickerOnSelect.dirtyforms",a.DirtyForm.dirtifier)}b.data("clean-value",a.DirtyForm.valueGetter(b))})})}})(jQuery);(function(a){a.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(b,a){this.defaults.type=b;this.defaults.name=a},"get":function(d,j){var b=a.extend({},this.defaults,j);if(!b.single.length)b.single="metadata";var c=a.data(d,b.single);if(c)return c;c="{}";var k=function(a){if(typeof a!="string")return a;if(a.indexOf("{")<0)a=eval("("+a+")")},f=function(a){if(typeof a!="string")return a;a=eval("("+a+")");return a};if(b.type=="html5"){var e={};a(d.attributes).each(function(){var a=this.nodeName;if(a.match(/^data-/))a=a.replace(/^data-/,"");else return true;e[a]=f(this.nodeValue)})}else{if(b.type=="class"){var i=b.cre.exec(d.className);if(i)c=i[1]}else if(b.type=="elem"){if(!d.getElementsByTagName)return;var h=d.getElementsByTagName(b.name);if(h.length)c=a.trim(h[0].innerHTML)}else if(d.getAttribute!=undefined){var g=d.getAttribute(b.name);if(g)c=g}e=f(c.indexOf("{")<0?"{"+c+"}":c)}a.data(d,b.single,e);return e}}});a.fn.metadata=function(b){return a.metadata.get(this[0],b)}})(jQuery);"use strict";(function(){if(jQuery&&jQuery.jstree)return;var a=false,b=false,c=false;(function(d){d.vakata={};d.vakata.css={get_css:function(d,e,c){d=d.toLowerCase();var b=c.cssRules||c.rules,a=0;do{if(b.length&&a>b.length+5)return false;if(b[a].selectorText&&b[a].selectorText.toLowerCase()==d)if(e===true){c.removeRule&&c.removeRule(a);c.deleteRule&&c.deleteRule(a);return true}else return b[a]}while(b[++a]);return false},add_css:function(a,b){if(d.jstree.css.get_css(a,false,b))return false;if(b.insertRule)b.insertRule(a+" { }",0);else b.addRule(a,null,0);return d.vakata.css.get_css(a)},remove_css:function(a,b){return d.vakata.css.get_css(a,true,b)},add_sheet:function(b){var a=false,c=true;if(b.str){if(b.title)a=d("style[id='"+b.title+"-stylesheet']")[0];if(a)c=false;else{a=document.createElement("style");a.setAttribute("type","text/css");b.title&&a.setAttribute("id",b.title+"-stylesheet")}if(a.styleSheet)if(c){document.getElementsByTagName("head")[0].appendChild(a);a.styleSheet.cssText=b.str}else a.styleSheet.cssText=a.styleSheet.cssText+" "+b.str;else{a.appendChild(document.createTextNode(b.str));document.getElementsByTagName("head")[0].appendChild(a)}return a.sheet||a.styleSheet}if(b.url)if(document.createStyleSheet)try{a=document.createStyleSheet(b.url)}catch(e){}else{a=document.createElement("link");a.rel="stylesheet";a.type="text/css";a.media="all";a.href=b.url;document.getElementsByTagName("head")[0].appendChild(a);return a.styleSheet}}};var e=[],g=-1,h={},f={};d.fn.jstree=function(a){var f=typeof a=="string",c=Array.prototype.slice.call(arguments,1),b=this;if(f){if(a.substring(0,1)=="_")return b;this.each(function(){var f=e[d.data(this,"jstree_instance_id")],g=f&&d.isFunction(f[a])?f[a].apply(f,c):f;if(typeof g!=="undefined"&&(a.indexOf("is_")===0||g!==true&&g!==false)){b=g;return false}})}else this.each(function(){var b=d.data(this,"jstree_instance_id"),i=[],f=a?d.extend({},true,a):{},j=d(this),g=false,k=[];i=i.concat(c);j.data("jstree")&&i.push(j.data("jstree"));f=i.length?d.extend.apply(null,[true,f].concat(i)):f;typeof b!=="undefined"&&e[b]&&e[b].destroy();b=parseInt(e.push({}),10)-1;d.data(this,"jstree_instance_id",b);f.plugins=d.isArray(f.plugins)?f.plugins:d.jstree.defaults.plugins.slice();f.plugins.unshift("core");f.plugins=f.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");g=d.extend(true,{},d.jstree.defaults,f);g.plugins=f.plugins;d.each(h,function(a){if(d.inArray(a,g.plugins)===-1){g[a]=null;delete g[a]}else k.push(a)});g.plugins=k;e[b]=new d.jstree._instance(b,d(this).addClass("jstree jstree-"+b),g);d.each(e[b]._get_settings().plugins,function(c,a){e[b].data[a]={}});d.each(e[b]._get_settings().plugins,function(c,a){h[a]&&h[a].__init.apply(e[b])});setTimeout(function(){e[b]&&e[b].init()},0)});return b};d.jstree={defaults:{plugins:[]},_focused:function(){return e[g]||null},_reference:function(a){if(e[a])return e[a];var b=d(a);if(!b.length&&typeof a==="string")b=d("#"+a);return!b.length?null:e[b.closest(".jstree").data("jstree_instance_id")]||null},_instance:function(c,b,a){this.data={core:{}};this.get_settings=function(){return d.extend(true,{},a)};this._get_settings=function(){return a};this.get_index=function(){return c};this.get_container=function(){return b};this.get_container_ul=function(){return b.children("ul:eq(0)")};this._set_settings=function(b){a=d.extend(true,{},a,b)}},_fn:{},plugin:function(b,a){a=d.extend({},{__init:d.noop,__destroy:d.noop,_fn:{},defaults:false},a);h[b]=a;d.jstree.defaults[b]=a.defaults;d.each(a._fn,function(a,c){c.plugin=b;c.old=d.jstree._fn[a];d.jstree._fn[a]=function(){var e,b=c,f=Array.prototype.slice.call(arguments),h=new d.Event("before.jstree"),g=false;if(this.data.core.locked===true&&a!=="unlock"&&a!=="is_locked")return;do{if(b&&b.plugin&&d.inArray(b.plugin,this._get_settings().plugins)!==-1)break;b=b.old}while(b);if(!b)return;if(a.indexOf("_")===0)e=b.apply(this,f);else{e=this.get_container().triggerHandler(h,{func:a,inst:this,args:f,plugin:b.plugin});if(e===false)return;if(typeof e!=="undefined")f=e;e=b.apply(d.extend({},this,{__callback:function(b){this.get_container().triggerHandler(a+".jstree",{inst:this,args:f,rslt:b,rlbk:g})},__rollback:function(){g=this.get_rollback();return g},__call_old:function(a){return b.old.apply(this,a?Array.prototype.slice.call(arguments,1):f)}}),f)}return e};d.jstree._fn[a].old=c.old;d.jstree._fn[a].plugin=b})},rollback:function(a){if(a){if(!d.isArray(a))a=[a];d.each(a,function(b,a){e[a.i].set_rollback(a.h,a.d)})}}};d.jstree._fn=d.jstree._instance.prototype={};d(function(){var e=navigator.userAgent.toLowerCase(),g=(e.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],f=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";if(/msie/.test(e)&&parseInt(g,10)==6){a=true;try{document.execCommand("BackgroundImageCache",false,true)}catch(h){}f+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}if(/msie/.test(e)&&parseInt(g,10)==7){b=true;f+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } "}if(!/compatible/.test(e)&&/mozilla/.test(e)&&parseFloat(g,10)<1.9){c=true;f+=".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } "}d.vakata.css.add_sheet({str:f,title:"jstree"})});d.jstree.plugin("core",{__init:function(){this.data.core.locked=false;this.data.core.to_open=this.get_settings().core.initially_open;this.data.core.to_load=this.get_settings().core.initially_load},defaults:{html_titles:false,animation:500,initially_open:[],initially_load:[],open_parents:true,notify_plugins:true,rtl:false,load_open:false,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus();this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl");this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>"+this._get_string("loading")+"</a></li></ul>");this.data.core.li_height=this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height()||18;this.get_container().delegate("li > ins","click.jstree",d.proxy(function(a){var b=d(a.target);this.toggle_node(b)},this)).bind("mousedown.jstree",d.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(){var a;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){a=window.getSelection();try{a.removeAllRanges();a.collapse()}catch(c){}}});this._get_settings().core.notify_plugins&&this.get_container().bind("load_node.jstree",d.proxy(function(e,c){var a=this._get_node(c.rslt.obj),b=this;if(a===-1)a=this.get_container_ul();if(!a.length)return;a.find("li").each(function(){var a=d(this);a.data("jstree")&&d.each(a.data("jstree"),function(c,e){b.data[c]&&d.isFunction(b["_"+c+"_notify"])&&b["_"+c+"_notify"].call(b,a,e)})})},this));this._get_settings().core.load_open&&this.get_container().bind("load_node.jstree",d.proxy(function(e,b){var a=this._get_node(b.rslt.obj),c=this;if(a===-1)a=this.get_container_ul();if(!a.length)return;a.find("li.jstree-open:not(:has(ul))").each(function(){c.load_node(this,d.noop,d.noop)})},this));this.__callback();this.load_node(-1,function(){this.loaded();this.reload_nodes()})},destroy:function(){var b,a=this.get_index(),f=this._get_settings(),c=this;d.each(f.plugins,function(d,a){try{h[a].__destroy.apply(c)}catch(b){}});this.__callback();if(this.is_focused())for(b in e)if(e.hasOwnProperty(b)&&b!=a){e[b].set_focus();break}if(a===g)g=-1;this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree_instance_id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/ig,"")});d(document).unbind(".jstree-"+a).undelegate(".jstree-"+a);e[a]=null;delete e[a]},_core_notify:function(b,a){a.opened&&this.open_node(b,false,true)},lock:function(){this.data.core.locked=true;this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7");this.__callback({})},unlock:function(){this.data.core.locked=false;this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1");this.__callback({})},is_locked:function(){return this.data.core.locked},save_opened:function(){var a=this;this.data.core.to_open=[];this.get_container_ul().find("li.jstree-open").each(function(){this.id&&a.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))});this.__callback(a.data.core.to_open)},save_loaded:function(){},reload_nodes:function(f){var a=this,e=true,b=[],c=[];if(!f){this.data.core.reopen=false;this.data.core.refreshing=true;this.data.core.to_open=d.map(d.makeArray(this.data.core.to_open),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")});this.data.core.to_load=d.map(d.makeArray(this.data.core.to_load),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")});if(this.data.core.to_open.length)this.data.core.to_load=this.data.core.to_load.concat(this.data.core.to_open)}if(this.data.core.to_load.length){d.each(this.data.core.to_load,function(e,a){if(a=="#")return true;if(d(a).length)b.push(a);else c.push(a)});if(b.length){this.data.core.to_load=c;d.each(b,function(c,b){if(!a._is_loaded(b)){a.load_node(b,function(){a.reload_nodes(true)},function(){a.reload_nodes(true)});e=false}})}}this.data.core.to_open.length&&d.each(this.data.core.to_open,function(c,b){a.open_node(b,false,true)});if(e){this.data.core.reopen&&clearTimeout(this.data.core.reopen);this.data.core.reopen=setTimeout(function(){a.__callback({},a)},50);this.data.core.refreshing=false;this.reopen()}},reopen:function(){var a=this;this.data.core.to_open.length&&d.each(this.data.core.to_open,function(c,b){a.open_node(b,false,true)});this.__callback({})},refresh:function(a){var b=this;this.save_opened();if(!a)a=-1;a=this._get_node(a);if(!a)a=-1;if(a!==-1)a.children("UL").remove();else this.get_container_ul().empty();this.load_node(a,function(){b.__callback({obj:a});b.reload_nodes()})},loaded:function(){this.__callback()},set_focus:function(){if(this.is_focused())return;var a=d.jstree._focused();a&&a.unset_focus();this.get_container().addClass("jstree-focused");g=this.get_index();this.__callback()},is_focused:function(){return g==this.get_index()},unset_focus:function(){if(this.is_focused()){this.get_container().removeClass("jstree-focused");g=-1}this.__callback()},_get_node:function(b){var a=d(b,this.get_container());if(a.is(".jstree")||b==-1)return-1;a=a.closest("li",this.get_container());return a.length?a:false},_get_next:function(a,b){a=this._get_node(a);return a===-1?this.get_container().find("> ul > li:first-child"):!a.length?false:b?a.nextAll("li").size()>0?a.nextAll("li:eq(0)"):false:a.hasClass("jstree-open")?a.find("li:eq(0)"):a.nextAll("li").size()>0?a.nextAll("li:eq(0)"):a.parentsUntil(".jstree","li").next("li").eq(0)},_get_prev:function(a,c){a=this._get_node(a);if(a===-1)return this.get_container().find("> ul > li:last-child");if(!a.length)return false;if(c)return a.prevAll("li").length>0?a.prevAll("li:eq(0)"):false;if(a.prev("li").length){a=a.prev("li").eq(0);while(a.hasClass("jstree-open"))a=a.children("ul:eq(0)").children("li:last");return a}else{var b=a.parentsUntil(".jstree","li:eq(0)");return b.length?b:false}},_get_parent:function(a){a=this._get_node(a);if(a==-1||!a.length)return false;var b=a.parentsUntil(".jstree","li:eq(0)");return b.length?b:-1},_get_children:function(a){a=this._get_node(a);return a===-1?this.get_container().children("ul:eq(0)").children("li"):!a.length?false:a.children("ul:eq(0)").children("li")},get_path:function(a,c){var b=[],d=this;a=this._get_node(a);if(a===-1||!a||!a.length)return false;a.parentsUntil(".jstree","li").each(function(){b.push(c?this.id:d.get_text(this))});b.reverse();b.push(c?a.attr("id"):this.get_text(a));return b},_get_string:function(a){return this._get_settings().core.strings[a]||a},is_open:function(a){a=this._get_node(a);return a&&a!==-1&&a.hasClass("jstree-open")},is_closed:function(a){a=this._get_node(a);return a&&a!==-1&&a.hasClass("jstree-closed")},is_leaf:function(a){a=this._get_node(a);return a&&a!==-1&&a.hasClass("jstree-leaf")},correct_state:function(a){a=this._get_node(a);if(!a||a===-1)return false;a.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();this.__callback({obj:a})},open_node:function(b,c,f){b=this._get_node(b);if(!b.length)return false;if(!b.hasClass("jstree-closed")){c&&c.call();return false}var e=f||a?0:this._get_settings().core.animation,d=this;if(!this._is_loaded(b)){b.children("a").addClass("jstree-loading");this.load_node(b,function(){d.open_node(b,c,f)},c)}else{this._get_settings().core.open_parents&&b.parentsUntil(".jstree",".jstree-closed").each(function(){d.open_node(this,false,true)});e&&b.children("ul").css("display","none");b.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");if(e)b.children("ul").stop(true,true).slideDown(e,function(){this.style.display="";d.after_open(b)});else d.after_open(b);this.__callback({obj:b});c&&c.call()}},after_open:function(a){this.__callback({obj:a})},close_node:function(b,e){b=this._get_node(b);var c=e||a?0:this._get_settings().core.animation,d=this;if(!b.length||!b.hasClass("jstree-open"))return false;c&&b.children("ul").attr("style","display:block !important");b.removeClass("jstree-open").addClass("jstree-closed");if(c)b.children("ul").stop(true,true).slideUp(c,function(){this.style.display="";d.after_close(b)});else d.after_close(b);this.__callback({obj:b})},after_close:function(a){this.__callback({obj:a})},toggle_node:function(a){a=this._get_node(a);return a.hasClass("jstree-closed")?this.open_node(a):a.hasClass("jstree-open")?this.close_node(a):void 0},open_all:function(a,d,b){a=a?this._get_node(a):-1;if(!a||a===-1)a=this.get_container_ul();if(b)a=a.find("li.jstree-closed");else{b=a;if(a.is(".jstree-closed"))a=a.find("li.jstree-closed").andSelf();else a=a.find("li.jstree-closed")}var c=this;a.each(function(){var a=this;if(!c._is_loaded(this))c.open_node(this,function(){c.open_all(a,d,b)},!d);else c.open_node(this,false,!d)});b.find("li.jstree-closed").length===0&&this.__callback({obj:b})},close_all:function(a,b){var c=this;a=a?this._get_node(a):this.get_container();if(!a||a===-1)a=this.get_container_ul();a.find("li.jstree-open").andSelf().each(function(){c.close_node(this,!b)});this.__callback({obj:a})},clean_node:function(a){a=a&&a!=-1?d(a):this.get_container_ul();a=a.is("li")?a.find("li").andSelf():a.find("li");a.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");a.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();this.__callback({obj:a})},get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(true),d:this.data}},set_rollback:function(b,a){this.get_container().empty().append(b);this.data=a;this.__callback()},load_node:function(a){this.__callback({obj:a})},_is_loaded:function(){return true},create_node:function(a,f,c,g,i){a=this._get_node(a);f=typeof f==="undefined"?"last":f;var e=d("<li />"),h=this._get_settings().core,b;if(a!==-1&&!a.length)return false;if(!i&&!this._is_loaded(a)){this.load_node(a,function(){this.create_node(a,f,c,g,true)});return false}this.__rollback();if(typeof c==="string")c={data:c};if(!c)c={};c.attr&&e.attr(c.attr);c.metadata&&e.data(c.metadata);c.state&&e.addClass("jstree-"+c.state);if(!c.data)c.data=this._get_string("new_node");if(!d.isArray(c.data)){b=c.data;c.data=[];c.data.push(b)}d.each(c.data,function(f,a){b=d("<a />");if(d.isFunction(a))a=a.call(this,c);if(typeof a=="string")b.attr("href","#")[h.html_titles?"html":"text"](a);else{if(!a.attr)a.attr={};if(!a.attr.href)a.attr.href="#";b.attr(a.attr)[h.html_titles?"html":"text"](a.title);a.language&&b.addClass(a.language)}b.prepend("<ins class='jstree-icon'>&#160;</ins>");if(!a.icon&&c.icon)a.icon=c.icon;if(a.icon)if(a.icon.indexOf("/")===-1)b.children("ins").addClass(a.icon);else b.children("ins").css("background","url('"+a.icon+"') center center no-repeat");e.append(b)});e.prepend("<ins class='jstree-icon'>&#160;</ins>");if(a===-1){a=this.get_container();if(f==="before")f="first";if(f==="after")f="last"}switch(f){case"before":a.before(e);b=this._get_parent(a);break;case"after":a.after(e);b=this._get_parent(a);break;case"inside":case"first":!a.children("ul").length&&a.append("<ul />");a.children("ul").prepend(e);b=a;break;case"last":!a.children("ul").length&&a.append("<ul />");a.children("ul").append(e);b=a;break;default:!a.children("ul").length&&a.append("<ul />");if(!f)f=0;b=a.children("ul").children("li").eq(f);if(b.length)b.before(e);else a.children("ul").append(e);b=a}if(b===-1||b.get(0)===this.get_container().get(0))b=-1;this.clean_node(b);this.__callback({obj:e,parent:b});g&&g.call(this,e);return e},get_text:function(a){a=this._get_node(a);if(!a.length)return false;var b=this._get_settings().core.html_titles;a=a.children("a:eq(0)");if(b){a=a.clone();a.children("INS").remove();return a.html()}else{a=a.contents().filter(function(){return this.nodeType==3})[0];return a.nodeValue}},set_text:function(a,b){a=this._get_node(a);if(!a.length)return false;a=a.children("a:eq(0)");if(this._get_settings().core.html_titles){var c=a.children("INS").clone();a.html(b).prepend(c);this.__callback({obj:a,name:b});return true}else{a=a.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:a,name:b});return a.nodeValue=b}},rename_node:function(a,b){a=this._get_node(a);this.__rollback();a&&a.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments))&&this.__callback({obj:a,name:b})},delete_node:function(a){a=this._get_node(a);if(!a.length)return false;this.__rollback();var b=this._get_parent(a),c=d([]),e=this;a.each(function(){c=c.add(e._get_prev(this))});a=a.detach();b!==-1&&b.find("> ul > li").length===0&&b.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");this.clean_node(b);this.__callback({obj:a,prev:c,parent:b});return a},prepare_move:function(e,g,c,b,h){var a={};a.ot=d.jstree._reference(e)||this;a.o=a.ot._get_node(e);a.r=g===-1?-1:this._get_node(g);a.p=typeof c==="undefined"||c===false?"last":c;if(!h&&f.o&&f.o[0]===a.o[0]&&f.r[0]===a.r[0]&&f.p===a.p){this.__callback(f);b&&b.call(this,f);return}a.ot=d.jstree._reference(a.o)||this;a.rt=d.jstree._reference(a.r)||this;if(a.r===-1||!a.r){a.cr=-1;switch(a.p){case"first":case"before":case"inside":a.cp=0;break;case"after":case"last":a.cp=a.rt.get_container().find(" > ul > li").length;break;default:a.cp=a.p}}else{if(!/^(before|after)$/.test(a.p)&&!this._is_loaded(a.r))return this.load_node(a.r,function(){this.prepare_move(e,g,c,b,true)});switch(a.p){case"before":a.cp=a.r.index();a.cr=a.rt._get_parent(a.r);break;case"after":a.cp=a.r.index()+1;a.cr=a.rt._get_parent(a.r);break;case"inside":case"first":a.cp=0;a.cr=a.r;break;case"last":a.cp=a.r.find(" > ul > li").length;a.cr=a.r;break;default:a.cp=a.p;a.cr=a.r}}a.np=a.cr==-1?a.rt.get_container():a.cr;a.op=a.ot._get_parent(a.o);a.cop=a.o.index();if(a.op===-1)a.op=a.ot?a.ot.get_container():this.get_container();if(!/^(before|after)$/.test(a.p)&&a.op&&a.np&&a.op[0]===a.np[0]&&a.o.index()<a.cp)a.cp++;a.or=a.np.find(" > ul > li:nth-child("+(a.cp+1)+")");f=a;this.__callback(f);b&&b.call(this,f)},check_move:function(){var a=f,b=true,c=a.r===-1?this.get_container():a.r;if(!a||!a.o||a.or[0]===a.o[0])return false;if(a.op&&a.np&&a.op[0]===a.np[0]&&a.cp-1===a.o.index())return false;a.o.each(function(){if(c.parentsUntil(".jstree","li").andSelf().index(this)!==-1){b=false;return false}});return b},move_node:function(a,i,h,c,g,e){if(!g)return this.prepare_move(a,i,h,function(a){this.move_node(a,false,false,c,true,e)});if(c)f.cy=true;if(!e&&!this.check_move())return false;this.__rollback();var b=false;if(c){b=a.o.clone(true);b.find("*[id]").andSelf().each(function(){if(this.id)this.id="copy_"+this.id})}else b=a.o;if(a.or.length)a.or.before(b);else{!a.np.children("ul").length&&d("<ul />").appendTo(a.np);a.np.children("ul:eq(0)").append(b)}try{a.ot.clean_node(a.op);a.rt.clean_node(a.np);!a.op.find("> ul > li").length&&a.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(j){}if(c){f.cy=true;f.oc=b}this.__callback(f);return f},_get_move:function(){return f}}})})(jQuery);(function(a){var c,b,d;a(function(){if(/msie/.test(navigator.userAgent.toLowerCase())){b=a('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body");d=a('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body");c=b.width()-d.width();b.add(d).remove()}else{b=a("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1e3,left:0}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200});c=100-b.width();b.parent().remove()}});a.jstree.plugin("ui",{__init:function(){this.data.ui.selected=a();this.data.ui.last_selected=false;this.data.ui.hovered=null;this.data.ui.to_select=this.get_settings().ui.initially_select;this.get_container().delegate("a","click.jstree",a.proxy(function(b){b.preventDefault();b.currentTarget.blur();!a(b.currentTarget).hasClass("jstree-loading")&&this.select_node(b.currentTarget,true,b)},this)).delegate("a","mouseenter.jstree",a.proxy(function(b){!a(b.currentTarget).hasClass("jstree-loading")&&this.hover_node(b.target)},this)).delegate("a","mouseleave.jstree",a.proxy(function(b){!a(b.currentTarget).hasClass("jstree-loading")&&this.dehover_node(b.target)},this)).bind("reopen.jstree",a.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",a.proxy(function(){this.dehover_node();this.save_selected()},this)).bind("set_rollback.jstree",a.proxy(function(){this.reselect()},this)).bind("close_node.jstree",a.proxy(function(g,f){var e=this._get_settings().ui,b=this._get_node(f.rslt.obj),d=b&&b.length?b.children("ul").find("a.jstree-clicked"):a(),c=this;if(e.selected_parent_close===false||!d.length)return;d.each(function(){c.deselect_node(this);e.selected_parent_close==="select_parent"&&c.select_node(b)})},this)).bind("delete_node.jstree",a.proxy(function(f,c){var e=this._get_settings().ui.select_prev_on_delete,a=this._get_node(c.rslt.obj),d=a&&a.length?a.find("a.jstree-clicked"):[],b=this;d.each(function(){b.deselect_node(this)});e&&d.length&&c.rslt.prev.each(function(){if(this.parentNode){b.select_node(this);return false}})},this)).bind("move_node.jstree",a.proxy(function(b,a){a.rslt.cy&&a.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl",select_range_modifier:"shift",selected_parent_close:"select_parent",selected_parent_open:true,select_prev_on_delete:true,disable_selecting_children:false,initially_select:[]},_fn:{_get_node:function(c,d){if(typeof c==="undefined"||c===null)return d?this.data.ui.selected:this.data.ui.last_selected;var b=a(c,this.get_container());if(b.is(".jstree")||c==-1)return-1;b=b.closest("li",this.get_container());return b.length?b:false},_ui_notify:function(b,a){a.selected&&this.select_node(b,false)},save_selected:function(){var a=this;this.data.ui.to_select=[];this.data.ui.selected.each(function(){this.id&&a.data.ui.to_select.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))});this.__callback(this.data.ui.to_select)},reselect:function(){var c=this,b=this.data.ui.to_select;b=a.map(a.makeArray(b),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")});a.each(b,function(b,a){a&&a!=="#"&&c.select_node(a)});this.data.ui.selected=this.data.ui.selected.filter(function(){return this.parentNode});this.__callback()},refresh:function(){this.save_selected();return this.__call_old()},hover_node:function(a){a=this._get_node(a);if(!a.length)return false;!a.hasClass("jstree-hovered")&&this.dehover_node();this.data.ui.hovered=a.children("a").addClass("jstree-hovered").parent();this._fix_scroll(a);this.__callback({obj:a})},dehover_node:function(){var a=this.data.ui.hovered,b;if(!a||!a.length)return false;b=a.children("a").removeClass("jstree-hovered").parent();if(this.data.ui.hovered[0]===b[0])this.data.ui.hovered=null;this.__callback({obj:a})},select_node:function(a,i,f){a=this._get_node(a);if(a==-1||!a||!a.length)return false;var b=this._get_settings().ui,e=b.select_multiple_modifier=="on"||b.select_multiple_modifier!==false&&f&&f[b.select_multiple_modifier+"Key"],h=b.select_range_modifier!==false&&f&&f[b.select_range_modifier+"Key"]&&this.data.ui.last_selected&&this.data.ui.last_selected[0]!==a[0]&&this.data.ui.last_selected.parent()[0]===a.parent()[0],c=this.is_selected(a),d=true,g=this;if(i){if(b.disable_selecting_children&&e&&(a.parentsUntil(".jstree","li").children("a.jstree-clicked").length||a.children("ul").find("a.jstree-clicked:eq(0)").length))return false;d=false;switch(true){case h:this.data.ui.last_selected.addClass("jstree-last-selected");a=a[a.index()<this.data.ui.last_selected.index()?"nextUntil":"prevUntil"](".jstree-last-selected").andSelf();if(b.select_limit==-1||a.length<b.select_limit){this.data.ui.last_selected.removeClass("jstree-last-selected");this.data.ui.selected.each(function(){this!==g.data.ui.last_selected[0]&&g.deselect_node(this)});c=false;d=true}else d=false;break;case c&&!e:this.deselect_all();c=false;d=true;break;case!c&&!e:if(b.select_limit==-1||b.select_limit>0){this.deselect_all();d=true}break;case c&&e:this.deselect_node(a);break;case!c&&e:if(b.select_limit==-1||this.data.ui.selected.length+1<=b.select_limit)d=true}}if(d&&!c){if(!h)this.data.ui.last_selected=a;a.children("a").addClass("jstree-clicked");b.selected_parent_open&&a.parents(".jstree-closed").each(function(){g.open_node(this,false,true)});this.data.ui.selected=this.data.ui.selected.add(a);this._fix_scroll(a.eq(0));this.__callback({obj:a,e:f})}},_fix_scroll:function(b){var a=this.get_container()[0],d;if(a.scrollHeight>a.offsetHeight){b=this._get_node(b);if(!b||b===-1||!b.length||!b.is(":visible"))return;d=b.offset().top-this.get_container().offset().top;if(d<0)a.scrollTop=a.scrollTop+d-1;if(d+this.data.core.li_height+(a.scrollWidth>a.offsetWidth?c:0)>a.offsetHeight)a.scrollTop=a.scrollTop+(d-a.offsetHeight+this.data.core.li_height+1+(a.scrollWidth>a.offsetWidth?c:0))}},deselect_node:function(a){a=this._get_node(a);if(!a.length)return false;if(this.is_selected(a)){a.children("a").removeClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.not(a);if(this.data.ui.last_selected.get(0)===a.get(0))this.data.ui.last_selected=this.data.ui.selected.eq(0);this.__callback({obj:a})}},toggle_select:function(a){a=this._get_node(a);if(!a.length)return false;if(this.is_selected(a))this.deselect_node(a);else this.select_node(a)},is_selected:function(a){return this.data.ui.selected.index(this._get_node(a))>=0},get_selected:function(b){return b?a(b).find("a.jstree-clicked").parent():this.data.ui.selected},deselect_all:function(b){var c=b?a(b).find("a.jstree-clicked").parent():this.get_container().find("a.jstree-clicked").parent();c.children("a.jstree-clicked").removeClass("jstree-clicked");this.data.ui.selected=a([]);this.data.ui.last_selected=false;this.__callback({obj:c})}}});a.jstree.defaults.plugins.push("ui")})(jQuery);(function(a){a.jstree.plugin("crrm",{__init:function(){this.get_container().bind("move_node.jstree",a.proxy(function(c,a){if(this._get_settings().crrm.move.open_onmove){var b=this;a.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){b.open_node(this,false,true)})}},this))},defaults:{input_width_limit:200,move:{always_copy:false,open_onmove:true,default_position:"last",check_move:function(){return true}}},_fn:{_show_input:function(b,j){b=this._get_node(b);var f=this._get_settings().core.rtl,i=this._get_settings().crrm.input_width_limit,g=b.children("ins").width(),h=b.find("> a:visible > ins").width()*b.find("> a:visible > ins").length,d=this.get_text(b),e=a("<div />",{css:{position:"absolute",top:"-200px",left:f?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),c=b.css("position","relative").append(a("<input />",{value:d,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver",position:"absolute",left:f?"auto":g+h+4+"px",right:f?g+h+4+"px":"auto",top:"0px",height:this.data.core.li_height-2+"px",lineHeight:this.data.core.li_height-2+"px",width:"150px"},blur:a.proxy(function(){var c=b.children(".jstree-rename-input"),a=c.val();if(a==="")a=d;e.remove();c.remove();this.set_text(b,d);this.rename_node(b,a);j.call(this,b,a,d);b.css("position","")},this),keyup:function(a){var b=a.keyCode||a.which;if(b==27){this.value=d;this.blur();return}else if(b==13){this.blur();return}else c.width(Math.min(e.text("pW"+this.value).width(),i))},keypress:function(a){var b=a.keyCode||a.which;if(b==13)return false}})).children(".jstree-rename-input");this.set_text(b,"");e.css({fontFamily:c.css("fontFamily")||"",fontSize:c.css("fontSize")||"",fontWeight:c.css("fontWeight")||"",fontStyle:c.css("fontStyle")||"",fontStretch:c.css("fontStretch")||"",fontVariant:c.css("fontVariant")||"",letterSpacing:c.css("letterSpacing")||"",wordSpacing:c.css("wordSpacing")||""});c.width(Math.min(e.text("pW"+c[0].value).width(),i))[0].select()},rename:function(a){a=this._get_node(a);this.__rollback();var b=this.__callback;this._show_input(a,function(d,a,c){b.call(this,{obj:d,new_name:a,old_name:c})})},create:function(b,g,h,c,f){var e,d=this;b=this._get_node(b);if(!b)b=-1;this.__rollback();e=this.create_node(b,g,h,function(b){var e=this._get_parent(b),g=a(b).index();c&&c.call(this,b);e.length&&e.hasClass("jstree-closed")&&this.open_node(e,false,true);if(!f)this._show_input(b,function(b,a){d.__callback({obj:b,name:a,parent:e,position:g})});else d.__callback({obj:b,name:this.get_text(b),parent:e,position:g})});return e},remove:function(a){a=this._get_node(a,true);var c=this._get_parent(a),b=this._get_prev(a);this.__rollback();a=this.delete_node(a);a!==false&&this.__callback({obj:a,prev:b,parent:c})},check_move:function(){if(!this.__call_old())return false;var a=this._get_settings().crrm.move;return!a.check_move.call(this,this._get_move())?false:true},move_node:function(c,f,a,d,g,e){var b=this._get_settings().crrm.move;if(!g){if(typeof a==="undefined")a=b.default_position;if(a==="inside"&&!b.default_position.match(/^(before|after)$/))a=b.default_position;return this.__call_old(true,c,f,a,d,false,e)}if(b.always_copy===true||b.always_copy==="multitree"&&c.rt.get_index()!==c.ot.get_index())d=true;this.__call_old(true,c,f,a,d,true,e)},cut:function(a){a=this._get_node(a,true);if(!a||!a.length)return false;this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes=a;this.__callback({obj:a})},copy:function(a){a=this._get_node(a,true);if(!a||!a.length)return false;this.data.crrm.ct_nodes=false;this.data.crrm.cp_nodes=a;this.__callback({obj:a})},paste:function(a){a=this._get_node(a);if(!a||!a.length)return false;var b=this.data.crrm.ct_nodes?this.data.crrm.ct_nodes:this.data.crrm.cp_nodes;if(!this.data.crrm.ct_nodes&&!this.data.crrm.cp_nodes)return false;if(this.data.crrm.ct_nodes){this.move_node(this.data.crrm.ct_nodes,a);this.data.crrm.ct_nodes=false}this.data.crrm.cp_nodes&&this.move_node(this.data.crrm.cp_nodes,a,false,true);this.__callback({obj:a,nodes:b})}}})})(jQuery);(function(a){var b=[];a.jstree._themes=false;a.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",a.proxy(function(){var a=this._get_settings().themes;this.data.themes.dots=a.dots;this.data.themes.icons=a.icons;this.set_theme(a.theme,a.url)},this)).bind("loaded.jstree",a.proxy(function(){if(!this.data.themes.dots)this.hide_dots();else this.show_dots();if(!this.data.themes.icons)this.hide_icons();else this.show_icons()},this))},defaults:{theme:"default",url:false,dots:true,icons:true},_fn:{set_theme:function(c,d){if(!c)return false;if(!d)d=a.jstree._themes+c+"/style.css";if(a.inArray(d,b)==-1){a.vakata.css.add_sheet({url:d});b.push(d)}if(this.data.themes.theme!=c){this.get_container().removeClass("jstree-"+this.data.themes.theme);this.data.themes.theme=c}this.get_container().addClass("jstree-"+c);if(!this.data.themes.dots)this.hide_dots();else this.show_dots();if(!this.data.themes.icons)this.hide_icons();else this.show_icons();this.__callback()},get_theme:function(){return this.data.themes.theme},show_dots:function(){this.data.themes.dots=true;this.get_container().children("ul").removeClass("jstree-no-dots")},hide_dots:function(){this.data.themes.dots=false;this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){if(this.data.themes.dots)this.hide_dots();else this.show_dots()},show_icons:function(){this.data.themes.icons=true;this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=false;this.get_container().children("ul").addClass("jstree-no-icons")},toggle_icons:function(){if(this.data.themes.icons)this.hide_icons();else this.show_icons()}}});a(function(){a.jstree._themes===false&&a("script").each(function(){if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)){a.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/";return false}});if(a.jstree._themes===false)a.jstree._themes="themes/"});a.jstree.defaults.plugins.push("themes")})(jQuery);(function(a){var b=[];function c(e,d){var b=a.jstree._focused(),c;if(b&&b.data&&b.data.hotkeys&&b.data.hotkeys.enabled){c=b._get_settings().hotkeys[e];if(c)return c.call(b,d)}}a.jstree.plugin("hotkeys",{__init:function(){if(typeof a.hotkeys==="undefined")throw"jsTree hotkeys: jQuery hotkeys plugin not included.";if(!this.data.ui)throw"jsTree hotkeys: jsTree UI plugin not included.";a.each(this._get_settings().hotkeys,function(d,e){if(e!==false&&a.inArray(d,b)==-1){a(document).bind("keydown",d,function(a){return c(d,a)});b.push(d)}});this.get_container().bind("lock.jstree",a.proxy(function(){if(this.data.hotkeys.enabled){this.data.hotkeys.enabled=false;this.data.hotkeys.revert=true}},this)).bind("unlock.jstree",a.proxy(function(){if(this.data.hotkeys.revert)this.data.hotkeys.enabled=true},this));this.enable_hotkeys()},defaults:{up:function(){var a=this.data.ui.hovered||this.data.ui.last_selected||-1;this.hover_node(this._get_prev(a));return false},"ctrl+up":function(){var a=this.data.ui.hovered||this.data.ui.last_selected||-1;this.hover_node(this._get_prev(a));return false},"shift+up":function(){var a=this.data.ui.hovered||this.data.ui.last_selected||-1;this.hover_node(this._get_prev(a));return false},down:function(){var a=this.data.ui.hovered||this.data.ui.last_selected||-1;this.hover_node(this._get_next(a));return false},"ctrl+down":function(){var a=this.data.ui.hovered||this.data.ui.last_selected||-1;this.hover_node(this._get_next(a));return false},"shift+down":function(){var a=this.data.ui.hovered||this.data.ui.last_selected||-1;this.hover_node(this._get_next(a));return false},left:function(){var a=this.data.ui.hovered||this.data.ui.last_selected;if(a)if(a.hasClass("jstree-open"))this.close_node(a);else this.hover_node(this._get_prev(a));return false},"ctrl+left":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;if(a)if(a.hasClass("jstree-open"))this.close_node(a);else this.hover_node(this._get_prev(a));return false},"shift+left":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;if(a)if(a.hasClass("jstree-open"))this.close_node(a);else this.hover_node(this._get_prev(a));return false},right:function(){var a=this.data.ui.hovered||this.data.ui.last_selected;if(a&&a.length)if(a.hasClass("jstree-closed"))this.open_node(a);else this.hover_node(this._get_next(a));return false},"ctrl+right":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;if(a&&a.length)if(a.hasClass("jstree-closed"))this.open_node(a);else this.hover_node(this._get_next(a));return false},"shift+right":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;if(a&&a.length)if(a.hasClass("jstree-closed"))this.open_node(a);else this.hover_node(this._get_next(a));return false},space:function(){this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").click();return false},"ctrl+space":function(a){a.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(a);return false},"shift+space":function(a){a.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(a);return false},f2:function(){this.rename(this.data.ui.hovered||this.data.ui.last_selected)},del:function(){this.remove(this.data.ui.hovered||this._get_node(null))}},_fn:{enable_hotkeys:function(){this.data.hotkeys.enabled=true},disable_hotkeys:function(){this.data.hotkeys.enabled=false}}})})(jQuery);(function(a){a.jstree.plugin("json_data",{__init:function(){var a=this._get_settings().json_data;a.progressive_unload&&this.get_container().bind("after_close.jstree",function(b,a){a.rslt.obj.children("ul").remove()})},defaults:{data:false,ajax:false,correct_state:true,progressive_render:false,progressive_unload:false},_fn:{load_node:function(b,d,c){var a=this;this.load_node_json(b,function(){a.__callback({obj:a._get_node(b)});d.call(this)},c)},_is_loaded:function(b){var c=this._get_settings().json_data;b=this._get_node(b);return b==-1||!b||!c.ajax&&!c.progressive_render&&!a.isFunction(c.data)||b.is(".jstree-open, .jstree-leaf")||b.children("ul").children("li").length>0},refresh:function(b){b=this._get_node(b);var c=this._get_settings().json_data;b&&b!==-1&&c.progressive_unload&&(a.isFunction(c.data)||!!c.ajax)&&b.removeData("jstree_children");return this.__call_old()},load_node_json:function(b,d,f){var c=this.get_settings().json_data,e,g=function(){},h=function(){};b=this._get_node(b);if(b&&b!==-1&&(c.progressive_render||c.progressive_unload)&&!b.is(".jstree-open, .jstree-leaf")&&b.children("ul").children("li").length===0&&b.data("jstree_children")){e=this._parse_json(b.data("jstree_children"),b);if(e){b.append(e);!c.progressive_unload&&b.removeData("jstree_children")}this.clean_node(b);d&&d.call(this);return}if(b&&b!==-1)if(b.data("jstree_is_loading"))return;else b.data("jstree_is_loading",true);switch(true){case!c.data&&!c.ajax:throw"Neither data nor ajax settings supplied.";case a.isFunction(c.data):c.data.call(this,b,a.proxy(function(a){a=this._parse_json(a,b);if(!a){if(b===-1||!b)c.correct_state&&this.get_container().children("ul").empty();else{b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");c.correct_state&&this.correct_state(b)}f&&f.call(this)}else{if(b===-1||!b)this.get_container().children("ul").empty().append(a.children());else{b.append(a).children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading")}this.clean_node(b);d&&d.call(this)}},this));break;case!!c.data&&!c.ajax||!!c.data&&!!c.ajax&&(!b||b===-1):if(!b||b==-1){e=this._parse_json(c.data,b);if(e){this.get_container().children("ul").empty().append(e.children());this.clean_node()}else c.correct_state&&this.get_container().children("ul").empty()}d&&d.call(this);break;case!c.data&&!!c.ajax||!!c.data&&!!c.ajax&&b&&b!==-1:g=function(g,a,e){var d=this.get_settings().json_data.ajax.error;d&&d.call(this,g,a,e);if(b!=-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");a==="success"&&c.correct_state&&this.correct_state(b)}else a==="success"&&c.correct_state&&this.get_container().children("ul").empty();f&&f.call(this)};h=function(e,h,i){var f=this.get_settings().json_data.ajax.success;if(f)e=f.call(this,e,h,i)||e;if(e===""||e&&e.toString&&e.toString().replace(/^[\s\n]+$/,"")===""||!a.isArray(e)&&!a.isPlainObject(e))return g.call(this,i,h,"");e=this._parse_json(e,b);if(e){if(b===-1||!b)this.get_container().children("ul").empty().append(e.children());else{b.append(e).children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading")}this.clean_node(b);d&&d.call(this)}else if(b===-1||!b){if(c.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}}else{b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");if(c.correct_state){this.correct_state(b);d&&d.call(this)}}};c.ajax.context=this;c.ajax.error=g;c.ajax.success=h;if(!c.ajax.dataType)c.ajax.dataType="json";if(a.isFunction(c.ajax.url))c.ajax.url=c.ajax.url.call(this,b);if(a.isFunction(c.ajax.data))c.ajax.data=c.ajax.data.call(this,b);a.ajax(c.ajax)}},_parse_json:function(b,e,m){var c=false,k=this._get_settings(),i=k.json_data,l=k.core.html_titles,d,f,j,g,h;if(!b)return c;i.progressive_unload&&e&&e!==-1&&e.data("jstree_children",c);if(a.isArray(b)){c=a();if(!b.length)return false;for(f=0,j=b.length;f<j;f++){d=this._parse_json(b[f],e,true);if(d.length)c=c.add(d)}}else{if(typeof b=="string")b={data:b};if(!b.data&&b.data!=="")return c;c=a("<li />");b.attr&&c.attr(b.attr);b.metadata&&c.data(b.metadata);b.state&&c.addClass("jstree-"+b.state);if(!a.isArray(b.data)){d=b.data;b.data=[];b.data.push(d)}a.each(b.data,function(f,e){d=a("<a />");if(a.isFunction(e))e=e.call(this,b);if(typeof e=="string")d.attr("href","#")[l?"html":"text"](e);else{if(!e.attr)e.attr={};if(!e.attr.href)e.attr.href="#";d.attr(e.attr)[l?"html":"text"](e.title);e.language&&d.addClass(e.language)}d.prepend("<ins class='jstree-icon'>&#160;</ins>");if(!e.icon&&b.icon)e.icon=b.icon;if(e.icon)if(e.icon.indexOf("/")===-1)d.children("ins").addClass(e.icon);else d.children("ins").css("background","url('"+e.icon+"') center center no-repeat");c.append(d)});c.prepend("<ins class='jstree-icon'>&#160;</ins>");if(b.children)if(i.progressive_render&&b.state!=="open")c.addClass("jstree-closed").data("jstree_children",b.children);else{i.progressive_unload&&c.data("jstree_children",b.children);if(a.isArray(b.children)&&b.children.length){d=this._parse_json(b.children,e,true);if(d.length){h=a("<ul />");h.append(d);c.append(h)}}}}if(!m){g=a("<ul />");g.append(c);c=g}return c},get_json:function(i,g,h,n){var m=[],f=this._get_settings(),j=this,e,b,d,l,c,k;i=this._get_node(i);if(!i||i===-1)i=this.get_container().find("> ul > li");g=a.isArray(g)?g:["id","class"];!n&&this.data.types&&g.push(f.types.type_attr);h=a.isArray(h)?h:[];i.each(function(){d=a(this);e={data:[]};if(g.length)e.attr={};a.each(g,function(c,a){b=d.attr(a);if(b&&b.length&&b.replace(/jstree[^ ]*/ig,"").length)e.attr[a]=(" "+b).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")});if(d.hasClass("jstree-open"))e.state="open";if(d.hasClass("jstree-closed"))e.state="closed";if(d.data())e.metadata=d.data();l=d.children("a");l.each(function(){c=a(this);if(h.length||a.inArray("languages",f.plugins)!==-1||c.children("ins").get(0).style.backgroundImage.length||c.children("ins").get(0).className&&c.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").length){k=false;a.inArray("languages",f.plugins)!==-1&&a.isArray(f.languages)&&f.languages.length&&a.each(f.languages,function(b,a){if(c.hasClass(a)){k=a;return false}});b={attr:{},title:j.get_text(c,k)};a.each(h,function(d,a){b.attr[a]=(" "+(c.attr(a)||"")).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")});a.inArray("languages",f.plugins)!==-1&&a.isArray(f.languages)&&f.languages.length&&a.each(f.languages,function(d,a){if(c.hasClass(a)){b.language=a;return true}});if(c.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)b.icon=c.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");if(c.children("ins").get(0).style.backgroundImage.length)b.icon=c.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}else b=j.get_text(c);if(l.length>1)e.data.push(b);else e.data=b});d=d.find("> ul > li");if(d.length)e.children=j.get_json(d,g,h,true);m.push(e)});return m}}})})(jQuery);(function(a){a.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(b){var d=this._get_settings().languages,c=false,e=".jstree-"+this.get_index()+" a";if(!a.isArray(d)||d.length===0)return false;if(a.inArray(b,d)==-1)if(!!d[b])b=d[b];else return false;if(b==this.data.languages.current_language)return true;c=a.vakata.css.get_css(e+"."+this.data.languages.current_language,false,this.data.languages.language_css);if(c!==false)c.style.display="none";c=a.vakata.css.get_css(e+"."+b,false,this.data.languages.language_css);if(c!==false)c.style.display="";this.data.languages.current_language=b;this.__callback(b);return true},get_lang:function(){return this.data.languages.current_language},_get_string:function(c,b){var e=this._get_settings().languages,d=this._get_settings().core.strings;if(a.isArray(e)&&e.length)b=b&&a.inArray(b,e)!=-1?b:this.data.languages.current_language;return d[b]&&d[b][c]?d[b][c]:d[c]?d[c]:c},get_text:function(b,c){b=this._get_node(b)||this.data.ui.last_selected;if(!b.size())return false;var d=this._get_settings().languages,e=this._get_settings().core.html_titles;if(a.isArray(d)&&d.length){c=c&&a.inArray(c,d)!=-1?c:this.data.languages.current_language;b=b.children("a."+c)}else b=b.children("a:eq(0)");if(e){b=b.clone();b.children("INS").remove();return b.html()}else{b=b.contents().filter(function(){return this.nodeType==3})[0];return b.nodeValue}},set_text:function(b,d,c){b=this._get_node(b)||this.data.ui.last_selected;if(!b.size())return false;var e=this._get_settings().languages,g=this._get_settings().core.html_titles,f;if(a.isArray(e)&&e.length){c=c&&a.inArray(c,e)!=-1?c:this.data.languages.current_language;b=b.children("a."+c)}else b=b.children("a:eq(0)");if(g){f=b.children("INS").clone();b.html(d).prepend(f);this.__callback({obj:b,name:d,lang:c});return true}else{b=b.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:b,name:d,lang:c});return b.nodeValue=d}},_load_css:function(){var b=this._get_settings().languages,d="/* languages css */",e=".jstree-"+this.get_index()+" a",c;if(a.isArray(b)&&b.length){this.data.languages.current_language=b[0];for(c=0;c<b.length;c++){d+=e+"."+b[c]+" {";if(b[c]!=this.data.languages.current_language)d+=" display:none; ";d+=" } "}this.data.languages.language_css=a.vakata.css.add_sheet({str:d,title:"jstree-languages"})}},create_node:function(d,c,e,b){return this.__call_old(true,d,c,e,function(f){var c=this._get_settings().languages,e=f.children("a"),d;if(a.isArray(c)&&c.length){for(d=0;d<c.length;d++)!e.is("."+c[d])&&f.append(e.eq(0).clone().removeClass(c.join(" ")).addClass(c[d]));e.not("."+c.join(", .")).remove()}b&&b.call(this,f)})}}})})(jQuery);(function(a){a.jstree.plugin("cookies",{__init:function(){if(typeof a.cookie==="undefined")throw"jsTree cookie: jQuery cookie plugin not included.";var c=this._get_settings().cookies,b;if(!!c.save_loaded){b=a.cookie(c.save_loaded);if(b&&b.length)this.data.core.to_load=b.split(",")}if(!!c.save_opened){b=a.cookie(c.save_opened);if(b&&b.length)this.data.core.to_open=b.split(",")}if(!!c.save_selected){b=a.cookie(c.save_selected);if(b&&b.length&&this.data.ui)this.data.ui.to_select=b.split(",")}this.get_container().one((this.data.ui?"reselect":"reopen")+".jstree",a.proxy(function(){this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree",a.proxy(function(a){this._get_settings().cookies.auto_save&&this.save_cookie((a.handleObj.namespace+a.handleObj.type).replace("jstree",""))},this))},this))},defaults:{save_loaded:"jstree_load",save_opened:"jstree_open",save_selected:"jstree_select",auto_save:true,cookie_options:{}},_fn:{save_cookie:function(c){if(this.data.core.refreshing)return;var b=this._get_settings().cookies;if(!c){if(b.save_loaded){this.save_loaded();a.cookie(b.save_loaded,this.data.core.to_load.join(","),b.cookie_options)}if(b.save_opened){this.save_opened();a.cookie(b.save_opened,this.data.core.to_open.join(","),b.cookie_options)}if(b.save_selected&&this.data.ui){this.save_selected();a.cookie(b.save_selected,this.data.ui.to_select.join(","),b.cookie_options)}return}switch(c){case"open_node":case"close_node":if(!!b.save_opened){this.save_opened();a.cookie(b.save_opened,this.data.core.to_open.join(","),b.cookie_options)}if(!!b.save_loaded){this.save_loaded();a.cookie(b.save_loaded,this.data.core.to_load.join(","),b.cookie_options)}break;case"select_node":case"deselect_node":if(!!b.save_selected&&this.data.ui){this.save_selected();a.cookie(b.save_selected,this.data.ui.to_select.join(","),b.cookie_options)}}}}})})(jQuery);(function(a){a.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",a.proxy(function(c,b){var a=this._get_node(b.rslt.obj);a=a===-1?this.get_container().children("ul"):a.children("ul");this.sort(a)},this)).bind("rename_node.jstree create_node.jstree create.jstree",a.proxy(function(b,a){this.sort(a.rslt.obj.parent())},this)).bind("move_node.jstree",a.proxy(function(c,a){var b=a.rslt.np==-1?this.get_container():a.rslt.np;this.sort(b.children("ul"))},this))},defaults:function(a,b){return this.get_text(a)>this.get_text(b)?1:-1},_fn:{sort:function(b){var d=this._get_settings().sort,c=this;b.append(a.makeArray(b.children("li")).sort(a.proxy(d,c)));b.find("> li > ul").each(function(){c.sort(a(this))});this.clean_node(b)}}})})(jQuery);(function(a){var e=false,c=false,d=false,b=false,f=false,g=false,h=false,i=false,j=false;a.vakata.dnd={is_down:false,is_drag:false,helper:false,scroll_spd:10,init_x:0,init_y:0,threshold:5,helper_left:5,helper_top:10,user_data:{},drag_start:function(b,c,d){a.vakata.dnd.is_drag&&a.vakata.drag_stop({});try{b.currentTarget.unselectable="on";b.currentTarget.onselectstart=function(){return false};if(b.currentTarget.style)b.currentTarget.style.MozUserSelect="none"}catch(e){}a.vakata.dnd.init_x=b.pageX;a.vakata.dnd.init_y=b.pageY;a.vakata.dnd.user_data=c;a.vakata.dnd.is_down=true;a.vakata.dnd.helper=a("<div id='vakata-dragged' />").html(d);a(document).bind("mousemove",a.vakata.dnd.drag);a(document).bind("mouseup",a.vakata.dnd.drag_stop);return false},drag:function(b){if(!a.vakata.dnd.is_down)return;if(!a.vakata.dnd.is_drag)if(Math.abs(b.pageX-a.vakata.dnd.init_x)>5||Math.abs(b.pageY-a.vakata.dnd.init_y)>5){a.vakata.dnd.helper.appendTo("body");a.vakata.dnd.is_drag=true;a(document).triggerHandler("drag_start.vakata",{event:b,data:a.vakata.dnd.user_data})}else return;if(b.type==="mousemove"){var c=a(document),e=c.scrollTop(),d=c.scrollLeft();if(b.pageY-e<20){if(g&&h==="down"){clearInterval(g);g=false}if(!g){h="up";g=setInterval(function(){a(document).scrollTop(a(document).scrollTop()-a.vakata.dnd.scroll_spd)},150)}}else if(g&&h==="up"){clearInterval(g);g=false}if(a(window).height()-(b.pageY-e)<20){if(g&&h==="up"){clearInterval(g);g=false}if(!g){h="down";g=setInterval(function(){a(document).scrollTop(a(document).scrollTop()+a.vakata.dnd.scroll_spd)},150)}}else if(g&&h==="down"){clearInterval(g);g=false}if(b.pageX-d<20){if(f&&i==="right"){clearInterval(f);f=false}if(!f){i="left";f=setInterval(function(){a(document).scrollLeft(a(document).scrollLeft()-a.vakata.dnd.scroll_spd)},150)}}else if(f&&i==="left"){clearInterval(f);f=false}if(a(window).width()-(b.pageX-d)<20){if(f&&i==="left"){clearInterval(f);f=false}if(!f){i="right";f=setInterval(function(){a(document).scrollLeft(a(document).scrollLeft()+a.vakata.dnd.scroll_spd)},150)}}else if(f&&i==="right"){clearInterval(f);f=false}}a.vakata.dnd.helper.css({left:b.pageX+a.vakata.dnd.helper_left+"px",top:b.pageY+a.vakata.dnd.helper_top+"px"});a(document).triggerHandler("drag.vakata",{event:b,data:a.vakata.dnd.user_data})},drag_stop:function(b){f&&clearInterval(f);g&&clearInterval(g);a(document).unbind("mousemove",a.vakata.dnd.drag);a(document).unbind("mouseup",a.vakata.dnd.drag_stop);a(document).triggerHandler("drag_stop.vakata",{event:b,data:a.vakata.dnd.user_data});a.vakata.dnd.helper.remove();a.vakata.dnd.init_x=0;a.vakata.dnd.init_y=0;a.vakata.dnd.user_data={};a.vakata.dnd.is_down=false;a.vakata.dnd.is_drag=false}};a(function(){var b="#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ";a.vakata.css.add_sheet({str:b,title:"vakata"})});a.jstree.plugin("dnd",{__init:function(){this.data.dnd={active:false,after:false,inside:false,before:false,off:false,prepared:false,w:0,to1:false,to2:false,cof:false,cw:false,ch:false,i1:false,i2:false,mto:false};this.get_container().bind("mouseenter.jstree",a.proxy(function(g){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree){if(this.data.themes){d.attr("class","jstree-"+this.data.themes.theme);b&&b.attr("class","jstree-"+this.data.themes.theme);a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}if(g.currentTarget===g.target&&a.vakata.dnd.user_data.obj&&a(a.vakata.dnd.user_data.obj).length&&a(a.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0]!==g.target){var c=a.jstree._reference(g.target),f;if(c.data.dnd.foreign){f=c._get_settings().dnd.drag_check.call(this,{o:e,r:c.get_container(),is_root:true});(f===true||f.inside===true||f.before===true||f.after===true)&&a.vakata.dnd.helper.children("ins").attr("class","jstree-ok")}else{c.prepare_move(e,c.get_container(),"last");c.check_move()&&a.vakata.dnd.helper.children("ins").attr("class","jstree-ok")}}}},this)).bind("mouseup.jstree",a.proxy(function(d){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&d.currentTarget===d.target&&a.vakata.dnd.user_data.obj&&a(a.vakata.dnd.user_data.obj).length&&a(a.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0]!==d.target){var b=a.jstree._reference(d.currentTarget),c;if(b.data.dnd.foreign){c=b._get_settings().dnd.drag_check.call(this,{o:e,r:b.get_container(),is_root:true});(c===true||c.inside===true||c.before===true||c.after===true)&&b._get_settings().dnd.drag_finish.call(this,{o:e,r:b.get_container(),is_root:true})}else b.move_node(e,b.get_container(),"last",d[b._get_settings().dnd.copy_modifier+"Key"])}},this)).bind("mouseleave.jstree",a.proxy(function(b){if(b.relatedTarget&&b.relatedTarget.id&&b.relatedTarget.id==="jstree-marker-line")return false;if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to2&&clearTimeout(this.data.dnd.to2);a.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")}},this)).bind("mousemove.jstree",a.proxy(function(c){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree){var b=this.get_container()[0];if(c.pageX+24>this.data.dnd.cof.left+this.data.dnd.cw){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(a.proxy(function(){this.scrollLeft+=a.vakata.dnd.scroll_spd},b),100)}else if(c.pageX-24<this.data.dnd.cof.left){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(a.proxy(function(){this.scrollLeft-=a.vakata.dnd.scroll_spd},b),100)}else this.data.dnd.i1&&clearInterval(this.data.dnd.i1);if(c.pageY+24>this.data.dnd.cof.top+this.data.dnd.ch){this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(a.proxy(function(){this.scrollTop+=a.vakata.dnd.scroll_spd},b),100)}else if(c.pageY-24<this.data.dnd.cof.top){this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(a.proxy(function(){this.scrollTop-=a.vakata.dnd.scroll_spd},b),100)}else this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).bind("scroll.jstree",a.proxy(function(){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&d&&b){d.hide();b.hide()}},this)).delegate("a","mousedown.jstree",a.proxy(function(a){if(a.which===1){this.start_drag(a.currentTarget,a);return false}},this)).delegate("a","mouseenter.jstree",a.proxy(function(b){a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&this.dnd_enter(b.currentTarget)},this)).delegate("a","mousemove.jstree",a.proxy(function(b){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree){(!c||!c.length||c.children("a")[0]!==b.currentTarget)&&this.dnd_enter(b.currentTarget);if(typeof this.data.dnd.off.top==="undefined")this.data.dnd.off=a(b.target).offset();this.data.dnd.w=(b.pageY-(this.data.dnd.off.top||0))%this.data.core.li_height;if(this.data.dnd.w<0)this.data.dnd.w+=this.data.core.li_height;this.dnd_show()}},this)).delegate("a","mouseleave.jstree",a.proxy(function(c){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree){if(c.relatedTarget&&c.relatedTarget.id&&c.relatedTarget.id==="jstree-marker-line")return false;d&&d.hide();b&&b.hide();this.data.dnd.mto=setTimeout(function(a){return function(){a.dnd_leave(c)}}(this),0)}},this)).delegate("a","mouseup.jstree",a.proxy(function(b){a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&this.dnd_finish(b)},this));a(document).bind("drag_stop.vakata",a.proxy(function(){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to2&&clearTimeout(this.data.dnd.to2);this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;this.data.dnd.off=false;this.data.dnd.prepared=false;this.data.dnd.w=false;this.data.dnd.to1=false;this.data.dnd.to2=false;this.data.dnd.i1=false;this.data.dnd.i2=false;this.data.dnd.active=false;this.data.dnd.foreign=false;d&&d.css({top:"-2000px"});b&&b.css({top:"-2000px"})},this)).bind("drag_start.vakata",a.proxy(function(d,b){if(b.data.jstree){var c=a(b.event.target);c.closest(".jstree").hasClass("jstree-"+this.get_index())&&this.dnd_enter(c)}},this));var f=this._get_settings().dnd;f.drag_target&&a(document).delegate(f.drag_target,"mousedown.jstree-"+this.get_index(),a.proxy(function(c){e=c.target;a.vakata.dnd.drag_start(c,{jstree:true,obj:c.target},"<ins class='jstree-icon'></ins>"+a(c.target).text());if(this.data.themes){d&&d.attr("class","jstree-"+this.data.themes.theme);b&&b.attr("class","jstree-"+this.data.themes.theme);a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");var f=this.get_container();this.data.dnd.cof=f.offset();this.data.dnd.cw=parseInt(f.width(),10);this.data.dnd.ch=parseInt(f.height(),10);this.data.dnd.foreign=true;c.preventDefault()},this));f.drop_target&&a(document).delegate(f.drop_target,"mouseenter.jstree-"+this.get_index(),a.proxy(function(b){this.data.dnd.active&&this._get_settings().dnd.drop_check.call(this,{o:e,r:a(b.target),e:b})&&a.vakata.dnd.helper.children("ins").attr("class","jstree-ok")},this)).delegate(f.drop_target,"mouseleave.jstree-"+this.get_index(),a.proxy(function(){this.data.dnd.active&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")},this)).delegate(f.drop_target,"mouseup.jstree-"+this.get_index(),a.proxy(function(b){this.data.dnd.active&&a.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&this._get_settings().dnd.drop_finish.call(this,{o:e,r:a(b.target),e:b})},this))},defaults:{copy_modifier:"ctrl",check_timeout:100,open_timeout:500,drop_target:".jstree-drop",drop_check:function(){return true},drop_finish:a.noop,drag_target:".jstree-draggable",drag_finish:a.noop,drag_check:function(){return{after:false,before:false,inside:true}}},_fn:{dnd_prepare:function(){if(!c||!c.length)return;this.data.dnd.off=c.offset();if(this._get_settings().core.rtl)this.data.dnd.off.right=this.data.dnd.off.left+c.width();if(this.data.dnd.foreign){var a=this._get_settings().dnd.drag_check.call(this,{o:e,r:c});this.data.dnd.after=a.after;this.data.dnd.before=a.before;this.data.dnd.inside=a.inside;this.data.dnd.prepared=true;return this.dnd_show()}this.prepare_move(e,c,"before");this.data.dnd.before=this.check_move();this.prepare_move(e,c,"after");this.data.dnd.after=this.check_move();if(this._is_loaded(c)){this.prepare_move(e,c,"inside");this.data.dnd.inside=this.check_move()}else this.data.dnd.inside=false;this.data.dnd.prepared=true;return this.dnd_show()},dnd_show:function(){if(!this.data.dnd.prepared)return;var f=["before","inside","after"],e=false,g=this._get_settings().core.rtl,c;if(this.data.dnd.w<this.data.core.li_height/3)f=["before","inside","after"];else if(this.data.dnd.w<=this.data.core.li_height*2/3)f=this.data.dnd.w<this.data.core.li_height/2?["inside","before","after"]:["inside","after","before"];else f=["after","inside","before"];a.each(f,a.proxy(function(c,b){if(this.data.dnd[b]){a.vakata.dnd.helper.children("ins").attr("class","jstree-ok");e=b;return false}},this));e===false&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");c=g?this.data.dnd.off.right-18:this.data.dnd.off.left+10;switch(e){case"before":d.css({left:c+"px",top:this.data.dnd.off.top-6+"px"}).show();b&&b.css({left:c+8+"px",top:this.data.dnd.off.top-1+"px"}).show();break;case"after":d.css({left:c+"px",top:this.data.dnd.off.top+this.data.core.li_height-6+"px"}).show();b&&b.css({left:c+8+"px",top:this.data.dnd.off.top+this.data.core.li_height-1+"px"}).show();break;case"inside":d.css({left:c+(g?-4:4)+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show();b&&b.hide();break;default:d.hide();b&&b.hide()}j=e;return e},dnd_open:function(){this.data.dnd.to2=false;this.open_node(c,a.proxy(this.dnd_prepare,this),true)},dnd_finish:function(a){if(this.data.dnd.foreign)(this.data.dnd.after||this.data.dnd.before||this.data.dnd.inside)&&this._get_settings().dnd.drag_finish.call(this,{o:e,r:c,p:j});else{this.dnd_prepare();this.move_node(e,c,j,a[this._get_settings().dnd.copy_modifier+"Key"])}e=false;c=false;d.hide();b&&b.hide()},dnd_enter:function(d){if(this.data.dnd.mto){clearTimeout(this.data.dnd.mto);this.data.dnd.mto=false}var b=this._get_settings().dnd;this.data.dnd.prepared=false;c=this._get_node(d);if(b.check_timeout){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to1=setTimeout(a.proxy(this.dnd_prepare,this),b.check_timeout)}else this.dnd_prepare();if(b.open_timeout){this.data.dnd.to2&&clearTimeout(this.data.dnd.to2);if(c&&c.length&&c.hasClass("jstree-closed"))this.data.dnd.to2=setTimeout(a.proxy(this.dnd_open,this),b.open_timeout)}else c&&c.length&&c.hasClass("jstree-closed")&&this.dnd_open()},dnd_leave:function(e){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");d.hide();b&&b.hide();if(c&&c[0]===e.target.parentNode){if(this.data.dnd.to1){clearTimeout(this.data.dnd.to1);this.data.dnd.to1=false}if(this.data.dnd.to2){clearTimeout(this.data.dnd.to2);this.data.dnd.to2=false}}},start_drag:function(g,h){e=this._get_node(g);if(this.data.ui&&this.is_selected(e))e=this._get_node(null,true);var f=e.length>1?this._get_string("multiple_selection"):this.get_text(e),c=this.get_container();if(!this._get_settings().core.html_titles)f=f.replace(/</ig,"&lt;").replace(/>/ig,"&gt;");a.vakata.dnd.drag_start(h,{jstree:true,obj:e},"<ins class='jstree-icon'></ins>"+f);if(this.data.themes){d&&d.attr("class","jstree-"+this.data.themes.theme);b&&b.attr("class","jstree-"+this.data.themes.theme);a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}this.data.dnd.cof=c.offset();this.data.dnd.cw=parseInt(c.width(),10);this.data.dnd.ch=parseInt(c.height(),10);this.data.dnd.active=true}}});a(function(){var e="#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px;  -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } #jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43;  cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666;  -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; }";a.vakata.css.add_sheet({str:e,title:"jstree"});d=a("<div />").attr({id:"jstree-marker"}).hide().html("&raquo;").bind("mouseleave mouseenter",function(a){d.hide();b.hide();a.preventDefault();a.stopImmediatePropagation();return false}).appendTo("body");b=a("<div />").attr({id:"jstree-marker-line"}).hide().bind("mouseup",function(a){if(c&&c.length){c.children("a").trigger(a);a.preventDefault();a.stopImmediatePropagation();return false}}).bind("mouseleave",function(e){var f=a(e.relatedTarget);if(f.is(".jstree")||f.closest(".jstree").length===0)if(c&&c.length){c.children("a").trigger(e);d.hide();b.hide();e.preventDefault();e.stopImmediatePropagation();return false}}).appendTo("body");a(document).bind("drag_start.vakata",function(c,a){if(a.data.jstree){d.show();b&&b.show()}});a(document).bind("drag_stop.vakata",function(c,a){if(a.data.jstree){d.hide();b&&b.hide()}})})})(jQuery);(function(a){a.jstree.plugin("checkbox",{__init:function(){this.data.checkbox.noui=this._get_settings().checkbox.override_ui;if(this.data.ui&&this.data.checkbox.noui){this.select_node=this.deselect_node=this.deselect_all=a.noop;this.get_selected=this.get_checked}this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree",a.proxy(function(b,a){this._prepare_checkboxes(a.rslt.obj)},this)).bind("loaded.jstree",a.proxy(function(){this._prepare_checkboxes()},this)).delegate(this.data.ui&&this.data.checkbox.noui?"a":"ins.jstree-checkbox","click.jstree",a.proxy(function(a){a.preventDefault();if(this._get_node(a.target).hasClass("jstree-checked"))this.uncheck_node(a.target);else this.check_node(a.target);if(this.data.ui&&this.data.checkbox.noui){this.save_selected();this.data.cookies&&this.save_cookie("select_node")}else{a.stopImmediatePropagation();return false}},this))},defaults:{override_ui:false,two_state:false,real_checkboxes:false,checked_parent_open:true,real_checkboxes_names:function(a){return["check_"+(a[0].id||Math.ceil(Math.random()*1e4)),1]}},__destroy:function(){this.get_container().find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end().find("ins.jstree-checkbox").remove()},_fn:{_checkbox_notify:function(b,a){a.checked&&this.check_node(b,false)},_prepare_checkboxes:function(b){b=!b||b==-1?this.get_container().find("> ul > li"):this._get_node(b);if(b===false)return;var f,d=this,c,e=this._get_settings().checkbox.two_state,g=this._get_settings().checkbox.real_checkboxes,h=this._get_settings().checkbox.real_checkboxes_names;b.each(function(){c=a(this);f=c.is("li")&&(c.hasClass("jstree-checked")||g&&c.children(":checked").length)?"jstree-checked":"jstree-unchecked";c.find("li").andSelf().each(function(){var b=a(this),c;b.children("a"+(d.data.languages?"":":eq(0)")).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(e?"jstree-unchecked":f);if(g)if(!b.children(":checkbox").length){c=h.call(d,b);b.prepend("<input type='checkbox' class='jstree-real-checkbox' id='"+c[0]+"' name='"+c[0]+"' value='"+c[1]+"' />")}else b.children(":checkbox").addClass("jstree-real-checkbox");if(!e)(f==="jstree-checked"||b.hasClass("jstree-checked")||b.children(":checked").length)&&b.find("li").andSelf().addClass("jstree-checked").children(":checkbox").prop("checked",true);else(b.hasClass("jstree-checked")||b.children(":checked").length)&&b.addClass("jstree-checked").children(":checkbox").prop("checked",true)})});!e&&b.find(".jstree-checked").parent().parent().each(function(){d._repair_state(this)})},change_state:function(b,e){b=this._get_node(b);var c=false,d=this._get_settings().checkbox.real_checkboxes;if(!b||b===-1)return false;e=e===false||e===true?e:b.hasClass("jstree-checked");if(this._get_settings().checkbox.two_state)if(e){b.removeClass("jstree-checked").addClass("jstree-unchecked");d&&b.children(":checkbox").prop("checked",false)}else{b.removeClass("jstree-unchecked").addClass("jstree-checked");d&&b.children(":checkbox").prop("checked",true)}else{if(e){c=b.find("li").andSelf();if(!c.filter(".jstree-checked, .jstree-undetermined").length)return false;c.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");d&&c.children(":checkbox").prop("checked",false)}else{c=b.find("li").andSelf();if(!c.filter(".jstree-unchecked, .jstree-undetermined").length)return false;c.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");d&&c.children(":checkbox").prop("checked",true);if(this.data.ui)this.data.ui.last_selected=b;this.data.checkbox.last_selected=b}b.parentsUntil(".jstree","li").each(function(){var b=a(this);if(e)if(b.children("ul").children("li.jstree-checked, li.jstree-undetermined").length){b.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");d&&b.parentsUntil(".jstree","li").andSelf().children(":checkbox").prop("checked",false);return false}else{b.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");d&&b.children(":checkbox").prop("checked",false)}else if(b.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length){b.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");d&&b.parentsUntil(".jstree","li").andSelf().children(":checkbox").prop("checked",false);return false}else{b.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");d&&b.children(":checkbox").prop("checked",true)}})}if(this.data.ui&&this.data.checkbox.noui)this.data.ui.selected=this.get_checked();this.__callback(b);return true},check_node:function(a){if(this.change_state(a,false)){a=this._get_node(a);if(this._get_settings().checkbox.checked_parent_open){var b=this;a.parents(".jstree-closed").each(function(){b.open_node(this,false,true)})}this.__callback({obj:a})}},uncheck_node:function(a){this.change_state(a,true)&&this.__callback({obj:this._get_node(a)})},check_all:function(){var a=this,b=this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li");b.each(function(){a.change_state(this,false)});this.__callback()},uncheck_all:function(){var a=this,b=this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li");b.each(function(){a.change_state(this,true)});this.__callback()},is_checked:function(a){a=this._get_node(a);return a.length?a.is(".jstree-checked"):false},get_checked:function(a,b){a=!a||a===-1?this.get_container():this._get_node(a);return b||this._get_settings().checkbox.two_state?a.find(".jstree-checked"):a.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},get_unchecked:function(a,b){a=!a||a===-1?this.get_container():this._get_node(a);return b||this._get_settings().checkbox.two_state?a.find(".jstree-unchecked"):a.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(a){a=this._get_node(a);if(!a.length)return;if(this._get_settings().checkbox.two_state){a.find("li").andSelf().not(".jstree-checked").removeClass("jstree-undetermined").addClass("jstree-unchecked").children(":checkbox").prop("checked",true);return}var d=this._get_settings().checkbox.real_checkboxes,b=a.find("> ul > .jstree-checked").length,e=a.find("> ul > .jstree-undetermined").length,c=a.find("> ul > li").length;if(c===0)a.hasClass("jstree-undetermined")&&this.change_state(a,false);else if(b===0&&e===0)this.change_state(a,true);else if(b===c)this.change_state(a,false);else{a.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");d&&a.parentsUntil(".jstree","li").andSelf().children(":checkbox").prop("checked",false)}},reselect:function(){if(this.data.ui&&this.data.checkbox.noui){var c=this,b=this.data.ui.to_select;b=a.map(a.makeArray(b),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")});this.deselect_all();a.each(b,function(b,a){c.check_node(a)});this.__callback()}else this.__call_old()},save_loaded:function(){var a=this;this.data.core.to_load=[];this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function(){this.id&&a.data.core.to_load.push("#"+this.id)})}}});a(function(){var b=".jstree .jstree-real-checkbox { display:none; } ";a.vakata.css.add_sheet({str:b,title:"jstree"})})})(jQuery);(function(a){a.vakata.xslt=function(b,c,h){var e="",f,g,d,i;if(document.recalc){f=document.createElement("xml");g=document.createElement("xml");f.innerHTML=b;g.innerHTML=c;a("body").append(f).append(g);setTimeout(function(b,c,d){return function(){d.call(null,b.transformNode(c.XMLDocument));setTimeout(function(b,c){return function(){a(b).remove();a(c).remove()}}(b,c),200)}}(f,g,h),100);return true}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor==="undefined"){b=(new DOMParser).parseFromString(b,"text/xml");c=(new DOMParser).parseFromString(c,"text/xml")}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor!=="undefined"){d=new XSLTProcessor;i=a.isFunction(d.transformDocument)?typeof window.XMLSerializer!=="undefined":true;if(!i)return false;b=(new DOMParser).parseFromString(b,"text/xml");c=(new DOMParser).parseFromString(c,"text/xml");if(a.isFunction(d.transformDocument)){e=document.implementation.createDocument("","",null);d.transformDocument(b,c,e,null);h.call(null,(new XMLSerializer).serializeToString(e));return true}else{d.importStylesheet(c);e=d.transformToFragment(b,document);h.call(null,a("<div />").append(e).html());return true}}return false};var c={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) &gt; 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text>&#xa0;</xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:copy-of select="./child::node()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>',flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text>&#xa0;</xsl:text>\t\t\t</ins>\t\t\t<xsl:copy-of select="./child::node()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'},b=function(a){return a.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")};a.jstree.plugin("xml_data",{defaults:{data:false,ajax:false,xsl:"flat",clean_node:false,correct_state:true,get_skip_empty:false,get_include_preamble:true},_fn:{load_node:function(b,d,c){var a=this;this.load_node_xml(b,function(){a.__callback({obj:a._get_node(b)});d.call(this)},c)},_is_loaded:function(b){var c=this._get_settings().xml_data;b=this._get_node(b);return b==-1||!b||!c.ajax&&!a.isFunction(c.data)||b.is(".jstree-open, .jstree-leaf")||b.children("ul").children("li").size()>0},load_node_xml:function(b,d,g){var c=this.get_settings().xml_data,e=function(){},f=function(){};b=this._get_node(b);if(b&&b!==-1)if(b.data("jstree_is_loading"))return;else b.data("jstree_is_loading",true);switch(true){case!c.data&&!c.ajax:throw"Neither data nor ajax settings supplied.";case a.isFunction(c.data):c.data.call(this,b,a.proxy(function(e){this.parse_xml(e,a.proxy(function(e){if(e){e=e.replace(/ ?xmlns="[^"]*"/ig,"");if(e.length>10){e=a(e);if(b===-1||!b)this.get_container().children("ul").empty().append(e.children());else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(e);b.removeData("jstree_is_loading")}c.clean_node&&this.clean_node(b);d&&d.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");if(c.correct_state){this.correct_state(b);d&&d.call(this)}}else if(c.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}}},this))},this));break;case!!c.data&&!c.ajax||!!c.data&&!!c.ajax&&(!b||b===-1):(!b||b==-1)&&this.parse_xml(c.data,a.proxy(function(e){if(e){e=e.replace(/ ?xmlns="[^"]*"/ig,"");if(e.length>10){e=a(e);this.get_container().children("ul").empty().append(e.children());c.clean_node&&this.clean_node(b);d&&d.call(this)}}else if(c.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}},this));break;case!c.data&&!!c.ajax||!!c.data&&!!c.ajax&&b&&b!==-1:e=function(f,a,e){var d=this.get_settings().xml_data.ajax.error;d&&d.call(this,f,a,e);if(b!==-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");a==="success"&&c.correct_state&&this.correct_state(b)}else a==="success"&&c.correct_state&&this.get_container().children("ul").empty();g&&g.call(this)};f=function(f,i,g){f=g.responseText;var h=this.get_settings().xml_data.ajax.success;if(h)f=h.call(this,f,i,g)||f;if(f===""||f&&f.toString&&f.toString().replace(/^[\s\n]+$/,"")==="")return e.call(this,g,i,"");this.parse_xml(f,a.proxy(function(e){if(e){e=e.replace(/ ?xmlns="[^"]*"/ig,"");if(e.length>10){e=a(e);if(b===-1||!b)this.get_container().children("ul").empty().append(e.children());else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(e);b.removeData("jstree_is_loading")}c.clean_node&&this.clean_node(b);d&&d.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");if(c.correct_state){this.correct_state(b);d&&d.call(this)}}else if(c.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}}},this))};c.ajax.context=this;c.ajax.error=e;c.ajax.success=f;if(!c.ajax.dataType)c.ajax.dataType="xml";if(a.isFunction(c.ajax.url))c.ajax.url=c.ajax.url.call(this,b);if(a.isFunction(c.ajax.data))c.ajax.data=c.ajax.data.call(this,b);a.ajax(c.ajax)}},parse_xml:function(d,b){var e=this._get_settings().xml_data;a.vakata.xslt(d,c[e.xsl],b)},get_xml:function(l,k,f,i,h){var c="",g=this._get_settings(),n=this,e,j,d,o,m;if(!l)l="flat";if(!h)h=0;k=this._get_node(k);if(!k||k===-1)k=this.get_container().find("> ul > li");f=a.isArray(f)?f:["id","class"];!h&&this.data.types&&a.inArray(g.types.type_attr,f)===-1&&f.push(g.types.type_attr);i=a.isArray(i)?i:[];if(!h){if(g.xml_data.get_include_preamble)c+='<?xml version="1.0" encoding="UTF-8"?>';c+="<root>"}k.each(function(){c+="<item";d=a(this);a.each(f,function(f,e){var a=d.attr(e);if(!g.xml_data.get_skip_empty||typeof a!=="undefined")c+=" "+e+'="'+b((" "+(a||"")).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"'});if(d.hasClass("jstree-open"))c+=' state="open"';if(d.hasClass("jstree-closed"))c+=' state="closed"';if(l==="flat")c+=' parent_id="'+b(h)+'"';c+=">";c+="<content>";o=d.children("a");o.each(function(){e=a(this);m=false;c+="<name";a.inArray("languages",g.plugins)!==-1&&a.each(g.languages,function(d,a){if(e.hasClass(a)){c+=' lang="'+b(a)+'"';m=a;return false}});i.length&&a.each(i,function(f,d){var a=e.attr(d);if(!g.xml_data.get_skip_empty||typeof a!=="undefined")c+=" "+d+'="'+b((" "+a||"").replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"'});if(e.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)c+=' icon="'+b(e.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"';if(e.children("ins").get(0).style.backgroundImage.length)c+=' icon="'+b(e.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/ig,"").replace(/"/ig,""))+'"';c+=">";c+="<![CDATA["+n.get_text(e,m)+"]\]>";c+="</name>"});c+="</content>";j=d[0].id||true;d=d.find("> ul > li");if(d.length)j=n.get_xml(l,d,f,i,j);else j="";if(l=="nest")c+=j;c+="</item>";if(l=="flat")c+=j});if(!h)c+="</root>";return c}}})})(jQuery);(function(a){a.expr[":"].jstree_contains=function(a,c,b){return(a.textContent||a.innerText||"").toLowerCase().indexOf(b[3].toLowerCase())>=0};a.expr[":"].jstree_title_contains=function(a,c,b){return(a.getAttribute("title")||"").toLowerCase().indexOf(b[3].toLowerCase())>=0};a.jstree.plugin("search",{__init:function(){this.data.search.str="";this.data.search.result=a();this._get_settings().search.show_only_matches&&this.get_container().bind("search.jstree",function(c,b){a(this).children("ul").find("li").hide().removeClass("jstree-last");b.rslt.nodes.parentsUntil(".jstree").andSelf().show().filter("ul").each(function(){a(this).children("li:visible").eq(-1).addClass("jstree-last")})}).bind("clear_search.jstree",function(){a(this).children("ul").find("li").css("display","").end().end().jstree("clean_node",-1)})},defaults:{ajax:false,search_method:"jstree_contains",show_only_matches:false},_fn:{search:function(c,f){if(a.trim(c)===""){this.clear_search();return}var b=this.get_settings().search,g=this,e=function(){},d=function(){};this.data.search.str=c;if(!f&&b.ajax!==false&&this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length>0){this.search.supress_callback=true;e=function(){};d=function(a,c,d){var b=this.get_settings().search.ajax.success;if(b)a=b.call(this,a,c,d)||a;this.data.search.to_open=a;this._search_open()};b.ajax.context=this;b.ajax.error=e;b.ajax.success=d;if(a.isFunction(b.ajax.url))b.ajax.url=b.ajax.url.call(this,c);if(a.isFunction(b.ajax.data))b.ajax.data=b.ajax.data.call(this,c);if(!b.ajax.data)b.ajax.data={search_string:c};if(!b.ajax.dataType||/^json/.exec(b.ajax.dataType))b.ajax.dataType="json";a.ajax(b.ajax);return}this.data.search.result.length&&this.clear_search();this.data.search.result=this.get_container().find("a"+(this.data.languages?"."+this.get_lang():"")+":"+b.search_method+"("+this.data.search.str+")");this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function(){g.open_node(this,false,true)});this.__callback({nodes:this.data.search.result,str:c})},clear_search:function(){this.data.search.result.removeClass("jstree-search");this.__callback(this.data.search.result);this.data.search.result=a()},_search_open:function(){var d=this,e=true,b=[],c=[];if(this.data.search.to_open.length){a.each(this.data.search.to_open,function(e,d){if(d=="#")return true;if(a(d).length&&a(d).is(".jstree-closed"))b.push(d);else c.push(d)});if(b.length){this.data.search.to_open=c;a.each(b,function(b,a){d.open_node(a,function(){d._search_open(true)})});e=false}}e&&this.search(this.data.search.str,true)}}})})(jQuery);(function(a){a.vakata.context={hide_on_mouseleave:false,cnt:a("<div id='vakata-contextmenu' />"),vis:false,tgt:false,par:false,func:false,data:false,rtl:false,show:function(k,d,f,b,i,j,h){a.vakata.context.rtl=!!h;var g=a.vakata.context.parse(k),c,e;if(!g)return;a.vakata.context.vis=true;a.vakata.context.tgt=d;a.vakata.context.par=j||d||null;a.vakata.context.data=i||null;a.vakata.context.cnt.html(g).css({visibility:"hidden",display:"block",left:0,top:0});if(a.vakata.context.hide_on_mouseleave)a.vakata.context.cnt.one("mouseleave",function(){a.vakata.context.hide()});c=a.vakata.context.cnt.height();e=a.vakata.context.cnt.width();if(f+e>a(document).width()){f=a(document).width()-(e+5);a.vakata.context.cnt.find("li > ul").addClass("right")}if(b+c>a(document).height()){b=b-(c+d[0].offsetHeight);a.vakata.context.cnt.find("li > ul").addClass("bottom")}a.vakata.context.cnt.css({left:f,top:b}).find("li:has(ul)").bind("mouseenter",function(){var d=a(document).width(),c=a(document).height(),b=a(this).children("ul").show();d!==a(document).width()&&b.toggleClass("right");c!==a(document).height()&&b.toggleClass("bottom")}).bind("mouseleave",function(){a(this).children("ul").hide()}).end().css({visibility:"visible"}).show();a(document).triggerHandler("context_show.vakata")},hide:function(){a.vakata.context.vis=false;a.vakata.context.cnt.attr("class","").css({visibility:"hidden"});a(document).triggerHandler("context_hide.vakata")},parse:function(e,f){if(!e)return false;var b="",d=false,c=true;if(!f)a.vakata.context.func={};b+="<ul>";a.each(e,function(f,e){if(!e)return true;a.vakata.context.func[f]=e.action;if(!c&&e.separator_before)b+="<li class='vakata-separator vakata-separator-before'></li>";c=false;b+="<li class='"+(e._class||"")+(e._disabled?" jstree-contextmenu-disabled ":"")+"'><ins ";if(e.icon&&e.icon.indexOf("/")===-1)b+=" class='"+e.icon+"' ";if(e.icon&&e.icon.indexOf("/")!==-1)b+=" style='background:url("+e.icon+") center center no-repeat;' ";b+=">&#160;</ins><a href='#' rel='"+f+"'>";if(e.submenu)b+="<span style='float:"+(a.vakata.context.rtl?"left":"right")+";'>&raquo;</span>";b+=e.label+"</a>";if(e.submenu){d=a.vakata.context.parse(e.submenu,true);if(d)b+=d}b+="</li>";if(e.separator_after){b+="<li class='vakata-separator vakata-separator-after'></li>";c=true}});b=b.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");b+="</ul>";a(document).triggerHandler("context_parse.vakata");return b.length>10?b:false},exec:function(b){if(a.isFunction(a.vakata.context.func[b])){a.vakata.context.func[b].call(a.vakata.context.data,a.vakata.context.par);return true}else return false}};a(function(){var b="#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } #vakata-contextmenu ul { min-width:180px; *width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ";a.vakata.css.add_sheet({str:b,title:"vakata"});a.vakata.context.cnt.delegate("a","click",function(a){a.preventDefault()}).delegate("a","mouseup",function(){if(!a(this).parent().hasClass("jstree-contextmenu-disabled")&&a.vakata.context.exec(a(this).attr("rel")))a.vakata.context.hide();else a(this).blur()}).delegate("a","mouseover",function(){a.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover")}).appendTo("body");a(document).bind("mousedown",function(b){a.vakata.context.vis&&!a.contains(a.vakata.context.cnt[0],b.target)&&a.vakata.context.hide()});typeof a.hotkeys!=="undefined"&&a(document).bind("keydown","up",function(c){if(a.vakata.context.vis){var b=a.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();if(!b.length)b=a.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last();b.addClass("vakata-hover");c.stopImmediatePropagation();c.preventDefault()}}).bind("keydown","down",function(c){if(a.vakata.context.vis){var b=a.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();if(!b.length)b=a.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first();b.addClass("vakata-hover");c.stopImmediatePropagation();c.preventDefault()}}).bind("keydown","right",function(b){if(a.vakata.context.vis){a.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");b.stopImmediatePropagation();b.preventDefault()}}).bind("keydown","left",function(b){if(a.vakata.context.vis){a.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");b.stopImmediatePropagation();b.preventDefault()}}).bind("keydown","esc",function(b){a.vakata.context.hide();b.preventDefault()}).bind("keydown","space",function(b){a.vakata.context.cnt.find(".vakata-hover").last().children("a").click();b.preventDefault()})});a.jstree.plugin("contextmenu",{__init:function(){this.get_container().delegate("a","contextmenu.jstree",a.proxy(function(b){b.preventDefault();!a(b.currentTarget).hasClass("jstree-loading")&&this.show_contextmenu(b.currentTarget,b.pageX,b.pageY)},this)).delegate("a","click.jstree",a.proxy(function(){this.data.contextmenu&&a.vakata.context.hide()},this)).bind("destroy.jstree",a.proxy(function(){this.data.contextmenu&&a.vakata.context.hide()},this));a(document).bind("context_hide.vakata",a.proxy(function(){this.data.contextmenu=false},this))},defaults:{select_node:false,show_at_node:true,items:{create:{separator_before:false,separator_after:true,label:"Create",action:function(a){this.create(a)}},rename:{separator_before:false,separator_after:false,label:"Rename",action:function(a){this.rename(a)}},remove:{separator_before:false,icon:false,separator_after:false,label:"Delete",action:function(a){if(this.is_selected(a))this.remove();else this.remove(a)}},ccp:{separator_before:true,icon:false,separator_after:false,label:"Edit",action:false,submenu:{cut:{separator_before:false,separator_after:false,label:"Cut",action:function(a){this.cut(a)}},copy:{separator_before:false,icon:false,separator_after:false,label:"Copy",action:function(a){this.copy(a)}},paste:{separator_before:false,icon:false,separator_after:false,label:"Paste",action:function(a){this.paste(a)}}}}}},_fn:{show_contextmenu:function(b,f,g){b=this._get_node(b);var e=this.get_settings().contextmenu,h=b.children("a:visible:eq(0)"),d=false,c=false;if(e.select_node&&this.data.ui&&!this.is_selected(b)){this.deselect_all();this.select_node(b,true)}if(e.show_at_node||typeof f==="undefined"||typeof g==="undefined"){d=h.offset();f=d.left;g=d.top+this.data.core.li_height}c=b.data("jstree")&&b.data("jstree").contextmenu?b.data("jstree").contextmenu:e.items;if(a.isFunction(c))c=c.call(this,b);this.data.contextmenu=true;a.vakata.context.show(c,h,f,g,this,b,this._get_settings().core.rtl);this.data.themes&&a.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})})(jQuery);(function(b){b.jstree.plugin("types",{__init:function(){var c=this._get_settings().types;this.data.types.attach_to=[];this.get_container().bind("init.jstree",b.proxy(function(){var e=c.types,f=c.type_attr,a="",d=this;b.each(e,function(e,c){b.each(c,function(a){!/^(max_depth|max_children|icon|valid_children)$/.test(a)&&d.data.types.attach_to.push(a)});if(!c.icon)return true;if(c.icon.image||c.icon.position){if(e=="default")a+=".jstree-"+d.get_index()+" a > .jstree-icon { ";else a+=".jstree-"+d.get_index()+" li["+f+'="'+e+'"] > a > .jstree-icon { ';if(c.icon.image)a+=" background-image:url("+c.icon.image+"); ";if(c.icon.position)a+=" background-position:"+c.icon.position+"; ";else a+=" background-position:0 0; ";a+="} "}});a!==""&&b.vakata.css.add_sheet({str:a,title:"jstree-types"})},this)).bind("before.jstree",b.proxy(function(g,a){var c,f,d=this._get_settings().types.use_data?this._get_node(a.args[0]):false,e=d&&d!==-1&&d.length?d.data("jstree"):false;if(e&&e.types&&e.types[a.func]===false){g.stopImmediatePropagation();return false}if(b.inArray(a.func,this.data.types.attach_to)!==-1){if(!a.args[0]||!a.args[0].tagName&&!a.args[0].jquery)return;c=this._get_settings().types.types;f=this._get_type(a.args[0]);if((c[f]&&typeof c[f][a.func]!=="undefined"||c["default"]&&typeof c["default"][a.func]!=="undefined")&&this._check(a.func,a.args[0])===false){g.stopImmediatePropagation();return false}}},this));a&&this.get_container().bind("load_node.jstree set_type.jstree",b.proxy(function(f,a){var d=a&&a.rslt&&a.rslt.obj&&a.rslt.obj!==-1?this._get_node(a.rslt.obj).parent():this.get_container_ul(),c=false,e=this._get_settings().types;b.each(e.types,function(b,a){if(a.icon&&(a.icon.image||a.icon.position)){c=b==="default"?d.find("li > a > .jstree-icon"):d.find("li["+e.type_attr+"='"+b+"'] > a > .jstree-icon");a.icon.image&&c.css("backgroundImage","url("+a.icon.image+")");c.css("backgroundPosition",a.icon.position||"0 0")}})},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",use_data:false,type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_types_notify:function(b,a){a.type&&this._get_settings().types.use_data&&this.set_type(a.type,b)},_get_type:function(a){a=this._get_node(a);return!a||!a.length?false:a.attr(this._get_settings().types.type_attr)||"default"},set_type:function(b,a){a=this._get_node(a);var c=!a.length||!b?false:a.attr(this._get_settings().types.type_attr,b);c&&this.__callback({obj:a,type:b});return c},_check:function(d,e,j){e=this._get_node(e);var a=false,h=this._get_type(e),f=0,i=this,c=this._get_settings().types,g=false;if(e===-1)if(!!c[d])a=c[d];else return;else{if(h===false)return;g=c.use_data?e.data("jstree"):false;if(g&&g.types&&typeof g.types[d]!=="undefined")a=g.types[d];else if(!!c.types[h]&&typeof c.types[h][d]!=="undefined")a=c.types[h][d];else if(!!c.types["default"]&&typeof c.types["default"][d]!=="undefined")a=c.types["default"][d]}if(b.isFunction(a))a=a.call(this,e);d==="max_depth"&&e!==-1&&j!==false&&c.max_depth!==-2&&a!==0&&e.children("a:eq(0)").parentsUntil(".jstree","li").each(function(b){if(c.max_depth!==-1&&c.max_depth-(b+1)<=0){a=0;return false}f=b===0?a:i._check(d,this,false);if(f!==-1&&f-(b+1)<=0){a=0;return false}if(f>=0&&(f-(b+1)<a||a<0))a=f-(b+1);if(c.max_depth>=0&&(c.max_depth-(b+1)<a||a<0))a=c.max_depth-(b+1)});return a},check_move:function(){if(!this.__call_old())return false;var a=this._get_move(),i=a.rt._get_settings().types,h=a.rt._check("max_children",a.cr),e=a.rt._check("max_depth",a.cr),f=a.rt._check("valid_children",a.cr),g=0,c=1,d;if(f==="none")return false;if(b.isArray(f)&&a.ot&&a.ot._get_type){a.o.each(function(){if(b.inArray(a.ot._get_type(this),f)===-1){c=false;return false}});if(c===false)return false}if(i.max_children!==-2&&h!==-1){g=a.cr===-1?this.get_container().find("> ul > li").not(a.o).length:a.cr.find("> ul > li").not(a.o).length;if(g+a.o.length>h)return false}if(i.max_depth!==-2&&e!==-1){c=0;if(e===0)return false;if(typeof a.o.d==="undefined"){d=a.o;while(d.length>0){d=d.find("> ul > li");c++}a.o.d=c}if(e-a.o.d<0)return false}return true},create_node:function(c,g,a,m,i,h){if(!h&&(i||this._is_loaded(c))){var d=typeof g=="string"&&g.match(/^before|after$/i)&&c!==-1?this._get_parent(c):this._get_node(c),e=this._get_settings().types,k=this._check("max_children",d),l=this._check("max_depth",d),f=this._check("valid_children",d),j;if(typeof a==="string")a={data:a};if(!a)a={};if(f==="none")return false;if(b.isArray(f))if(!a.attr||!a.attr[e.type_attr]){if(!a.attr)a.attr={};a.attr[e.type_attr]=f[0]}else if(b.inArray(a.attr[e.type_attr],f)===-1)return false;if(e.max_children!==-2&&k!==-1){j=d===-1?this.get_container().find("> ul > li").length:d.find("> ul > li").length;if(j+1>k)return false}if(e.max_depth!==-2&&l!==-1&&l-1<0)return false}return this.__call_old(true,c,g,a,m,i,h)}}})})(jQuery);(function(a){a.jstree.plugin("html_data",{__init:function(){this.data.html_data.original_container_html=this.get_container().find(" > ul > li").clone(true);this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function(){return this.nodeType==3}).remove()},defaults:{data:false,ajax:false,correct_state:true},_fn:{load_node:function(b,d,c){var a=this;this.load_node_html(b,function(){a.__callback({obj:a._get_node(b)});d.call(this)},c)},_is_loaded:function(b){b=this._get_node(b);return b==-1||!b||!this._get_settings().html_data.ajax&&!a.isFunction(this._get_settings().html_data.data)||b.is(".jstree-open, .jstree-leaf")||b.children("ul").children("li").size()>0},load_node_html:function(b,d,h){var e,c=this.get_settings().html_data,f=function(){},g=function(){};b=this._get_node(b);if(b&&b!==-1)if(b.data("jstree_is_loading"))return;else b.data("jstree_is_loading",true);switch(true){case a.isFunction(c.data):c.data.call(this,b,a.proxy(function(e){if(e&&e!==""&&e.toString&&e.toString().replace(/^[\s\n]+$/,"")!==""){e=a(e);if(!e.is("ul"))e=a("<ul />").append(e);if(b==-1||!b)this.get_container().children("ul").empty().append(e.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(e).children("ul").find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");b.removeData("jstree_is_loading")}this.clean_node(b);d&&d.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");if(c.correct_state){this.correct_state(b);d&&d.call(this)}}else if(c.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}},this));break;case!c.data&&!c.ajax:if(!b||b==-1){this.get_container().children("ul").empty().append(this.data.html_data.original_container_html).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");this.clean_node()}d&&d.call(this);break;case!!c.data&&!c.ajax||!!c.data&&!!c.ajax&&(!b||b===-1):if(!b||b==-1){e=a(c.data);if(!e.is("ul"))e=a("<ul />").append(e);this.get_container().children("ul").empty().append(e.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");this.clean_node()}d&&d.call(this);break;case!c.data&&!!c.ajax||!!c.data&&!!c.ajax&&b&&b!==-1:b=this._get_node(b);f=function(f,a,e){var d=this.get_settings().html_data.ajax.error;d&&d.call(this,f,a,e);if(b!=-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");a==="success"&&c.correct_state&&this.correct_state(b)}else a==="success"&&c.correct_state&&this.get_container().children("ul").empty();h&&h.call(this)};g=function(e,h,i){var g=this.get_settings().html_data.ajax.success;if(g)e=g.call(this,e,h,i)||e;if(e===""||e&&e.toString&&e.toString().replace(/^[\s\n]+$/,"")==="")return f.call(this,i,h,"");if(e){e=a(e);if(!e.is("ul"))e=a("<ul />").append(e);if(b==-1||!b)this.get_container().children("ul").empty().append(e.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(e).children("ul").find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");b.removeData("jstree_is_loading")}this.clean_node(b);d&&d.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree_is_loading");if(c.correct_state){this.correct_state(b);d&&d.call(this)}}else if(c.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}};c.ajax.context=this;c.ajax.error=f;c.ajax.success=g;if(!c.ajax.dataType)c.ajax.dataType="html";if(a.isFunction(c.ajax.url))c.ajax.url=c.ajax.url.call(this,b);if(a.isFunction(c.ajax.data))c.ajax.data=c.ajax.data.call(this,b);a.ajax(c.ajax)}}}});a.jstree.defaults.plugins.push("html_data")})(jQuery);(function(a){a.jstree.plugin("themeroller",{__init:function(){var b=this._get_settings().themeroller;this.get_container().addClass("ui-widget-content").addClass("jstree-themeroller").delegate("a","mouseenter.jstree",function(c){!a(c.currentTarget).hasClass("jstree-loading")&&a(this).addClass(b.item_h)}).delegate("a","mouseleave.jstree",function(){a(this).removeClass(b.item_h)}).bind("init.jstree",a.proxy(function(b,a){a.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh");this._themeroller(a.inst.get_container().find("> ul > li"))},this)).bind("open_node.jstree create_node.jstree",a.proxy(function(b,a){this._themeroller(a.rslt.obj)},this)).bind("loaded.jstree refresh.jstree",a.proxy(function(){this._themeroller()},this)).bind("close_node.jstree",a.proxy(function(b,a){this._themeroller(a.rslt.obj)},this)).bind("delete_node.jstree",a.proxy(function(b,a){this._themeroller(a.rslt.parent)},this)).bind("correct_state.jstree",a.proxy(function(c,a){a.rslt.obj.children("ins.jstree-icon").removeClass(b.opened+" "+b.closed+" ui-icon").end().find("> a > ins.ui-icon").filter(function(){return this.className.toString().replace(b.item_clsd,"").replace(b.item_open,"").replace(b.item_leaf,"").indexOf("ui-icon-")===-1}).removeClass(b.item_open+" "+b.item_clsd).addClass(b.item_leaf||"jstree-no-icon")},this)).bind("select_node.jstree",a.proxy(function(c,a){a.rslt.obj.children("a").addClass(b.item_a)},this)).bind("deselect_node.jstree deselect_all.jstree",a.proxy(function(){this.get_container().find("a."+b.item_a).removeClass(b.item_a).end().find("a.jstree-clicked").addClass(b.item_a)},this)).bind("dehover_node.jstree",a.proxy(function(c,a){a.rslt.obj.children("a").removeClass(b.item_h)},this)).bind("hover_node.jstree",a.proxy(function(c,a){this.get_container().find("a."+b.item_h).not(a.rslt.obj).removeClass(b.item_h);a.rslt.obj.children("a").addClass(b.item_h)},this)).bind("move_node.jstree",a.proxy(function(b,a){this._themeroller(a.rslt.o);this._themeroller(a.rslt.op)},this))},__destroy:function(){var c=this._get_settings().themeroller,b=["ui-icon"];a.each(c,function(c,a){a=a.split(" ");if(a.length)b=b.concat(a)});this.get_container().removeClass("ui-widget-content").find("."+b.join(", .")).removeClass(b.join(" "))},_fn:{_themeroller:function(b){var a=this._get_settings().themeroller;b=!b||b==-1?this.get_container_ul():this._get_node(b).parent();b.find("li.jstree-closed").children("ins.jstree-icon").removeClass(a.opened).addClass("ui-icon "+a.closed).end().children("a").addClass(a.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return this.className.toString().replace(a.item_clsd,"").replace(a.item_open,"").replace(a.item_leaf,"").indexOf("ui-icon-")===-1}).removeClass(a.item_leaf+" "+a.item_open).addClass(a.item_clsd||"jstree-no-icon").end().end().end().end().find("li.jstree-open").children("ins.jstree-icon").removeClass(a.closed).addClass("ui-icon "+a.opened).end().children("a").addClass(a.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return this.className.toString().replace(a.item_clsd,"").replace(a.item_open,"").replace(a.item_leaf,"").indexOf("ui-icon-")===-1}).removeClass(a.item_leaf+" "+a.item_clsd).addClass(a.item_open||"jstree-no-icon").end().end().end().end().find("li.jstree-leaf").children("ins.jstree-icon").removeClass(a.closed+" ui-icon "+a.opened).end().children("a").addClass(a.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return this.className.toString().replace(a.item_clsd,"").replace(a.item_open,"").replace(a.item_leaf,"").indexOf("ui-icon-")===-1}).removeClass(a.item_clsd+" "+a.item_open).addClass(a.item_leaf||"jstree-no-icon")}},defaults:{opened:"ui-icon-triangle-1-se",closed:"ui-icon-triangle-1-e",item:"ui-state-default",item_h:"ui-state-hover",item_a:"ui-state-active",item_open:"ui-icon-folder-open",item_clsd:"ui-icon-folder-collapsed",item_leaf:"ui-icon-document"}});a(function(){var b=".jstree-themeroller .ui-icon { overflow:visible; } .jstree-themeroller a { padding:0 2px; } .jstree-themeroller .jstree-no-icon { display:none; }";a.vakata.css.add_sheet({str:b,title:"jstree"})})})(jQuery);(function(a){a.jstree.plugin("unique",{__init:function(){this.get_container().bind("before.jstree",a.proxy(function(g,b){var d=[],e=true,c,f;if(b.func=="move_node")if(b.args[4]===true)if(b.args[0].o&&b.args[0].o.length){b.args[0].o.children("a").each(function(){d.push(a(this).text().replace(/^\s+/g,""))});e=this._check_unique(d,b.args[0].np.find("> ul > li").not(b.args[0].o),"move_node")}if(b.func=="create_node")if(b.args[4]||this._is_loaded(b.args[0])){c=this._get_node(b.args[0]);if(b.args[1]&&(b.args[1]==="before"||b.args[1]==="after")){c=this._get_parent(b.args[0]);if(!c||c===-1)c=this.get_container()}if(typeof b.args[2]==="string")d.push(b.args[2]);else if(!b.args[2]||!b.args[2].data)d.push(this._get_string("new_node"));else d.push(b.args[2].data);e=this._check_unique(d,c.find("> ul > li"),"create_node")}if(b.func=="rename_node"){d.push(b.args[1]);f=this._get_node(b.args[0]);c=this._get_parent(f);if(!c||c===-1)c=this.get_container();e=this._check_unique(d,c.find("> ul > li").not(f),"rename_node")}if(!e){g.stopPropagation();return false}},this))},defaults:{error_callback:a.noop},_fn:{_check_unique:function(c,d,e){var b=[];d.children("a").each(function(){b.push(a(this).text().replace(/^\s+/g,""))});if(!b.length||!c.length)return true;b=b.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");if(b.length+c.length!=b.concat(c).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length){this._get_settings().unique.error_callback.call(null,c,d,e);return false}return true},check_move:function(){if(!this.__call_old())return false;var b=this._get_move(),c=[];if(b.o&&b.o.length){b.o.children("a").each(function(){c.push(a(this).text().replace(/^\s+/g,""))});return this._check_unique(c,b.np.find("> ul > li").not(b.o),"check_move")}return true}}})})(jQuery);(function(d){d.jstree.plugin("wholerow",{__init:function(){if(!this.data.ui)throw"jsTree wholerow: jsTree UI plugin not included.";this.data.wholerow.html=false;this.data.wholerow.to=false;this.get_container().bind("init.jstree",d.proxy(function(){this._get_settings().core.animation=0},this)).bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree",d.proxy(function(b,a){this._prepare_wholerow_span(a&&a.rslt&&a.rslt.obj?a.rslt.obj:-1)},this)).bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree",d.proxy(function(b,a){this.data.to&&clearTimeout(this.data.to);this.data.to=setTimeout(function(b,a){return function(){b._prepare_wholerow_ul(a)}}(this,a&&a.rslt&&a.rslt.obj?a.rslt.obj:-1),0)},this)).bind("deselect_all.jstree",d.proxy(function(){this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked "+(this.data.themeroller?this._get_settings().themeroller.item_a:""))},this)).bind("select_node.jstree deselect_node.jstree ",d.proxy(function(b,a){a.rslt.obj.each(function(){var b=a.inst.get_container().find(" > .jstree-wholerow li:visible:eq("+parseInt((d(this).offset().top-a.inst.get_container().offset().top+a.inst.get_container()[0].scrollTop)/a.inst.data.core.li_height,10)+")");b.children("a").attr("class",a.rslt.obj.children("a").attr("class"))})},this)).bind("hover_node.jstree dehover_node.jstree",d.proxy(function(c,a){this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered "+(this.data.themeroller?this._get_settings().themeroller.item_h:""));if(c.type==="hover_node"){var b=this.get_container().find(" > .jstree-wholerow li:visible:eq("+parseInt((a.rslt.obj.offset().top-this.get_container().offset().top+this.get_container()[0].scrollTop)/this.data.core.li_height,10)+")");b.children("a").attr("class",a.rslt.obj.children(".jstree-hovered").attr("class"))}},this)).delegate(".jstree-wholerow-span, ins.jstree-icon, li","click.jstree",function(a){var b=d(a.currentTarget);if(a.target.tagName==="A"||a.target.tagName==="INS"&&b.closest("li").is(".jstree-open, .jstree-closed"))return;b.closest("li").children("a:visible:eq(0)").click();a.stopImmediatePropagation()}).delegate("li","mouseover.jstree",d.proxy(function(a){a.stopImmediatePropagation();if(d(a.currentTarget).children(".jstree-hovered, .jstree-clicked").length)return false;this.hover_node(a.currentTarget);return false},this)).delegate("li","mouseleave.jstree",d.proxy(function(a){if(d(a.currentTarget).children("a").hasClass("jstree-hovered").length)return;this.dehover_node(a.currentTarget)},this));(b||a)&&d.vakata.css.add_sheet({str:".jstree-"+this.get_index()+" { position:relative; } ",title:"jstree"})},defaults:{},__destroy:function(){this.get_container().children(".jstree-wholerow").remove();this.get_container().find(".jstree-wholerow-span").remove()},_fn:{_prepare_wholerow_span:function(a){a=!a||a==-1?this.get_container().find("> ul > li"):this._get_node(a);if(a===false)return;a.each(function(){d(this).find("li").andSelf().each(function(){var a=d(this);if(a.children(".jstree-wholerow-span").length)return true;a.prepend("<span class='jstree-wholerow-span' style='width:"+a.parentsUntil(".jstree","li").length*18+"px;'>&#160;</span>")})})},_prepare_wholerow_ul:function(){var a=this.get_container().children("ul").eq(0),c=a.html();a.addClass("jstree-wholerow-real");if(this.data.wholerow.last_html!==c){this.data.wholerow.last_html=c;this.get_container().children(".jstree-wholerow").remove();this.get_container().append(a.clone().removeClass("jstree-wholerow-real").wrapAll("<div class='jstree-wholerow' />").parent().width(a.parent()[0].scrollWidth).css("top",(a.height()+(b?5:0))*-1).find("li[id]").each(function(){this.removeAttribute("id")}).end())}}}});d(function(){var e=".jstree .jstree-wholerow-real { position:relative; z-index:1; } .jstree .jstree-wholerow-real li { cursor:pointer; } .jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } .jstree .jstree-wholerow { position:relative; z-index:0; height:0; } .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } .jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }";if(c)e+=".jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } .jstree .jstree-wholerow-real a { border-color:transparent !important; } ";if(b||a)e+=".jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } .jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } ";d.vakata.css.add_sheet({str:e,title:"jstree"})})})(jQuery);(function(a){var c=["getChildren","getChildrenCount","getAttr","getName","getProps"],b=function(c,b){var d=true;c=c||{};b=[].concat(b);a.each(b,function(e,b){if(!a.isFunction(c[b])){d=false;return false}});return d};a.jstree.plugin("model",{__init:function(){if(!this.data.json_data)throw"jsTree model: jsTree json_data plugin not included.";this._get_settings().json_data.data=function(f,e){var d=f==-1?this._get_settings().model.object:f.data("jstree_model");if(!b(d,c))return e.call(null,false);if(this._get_settings().model.async)d.getChildren(a.proxy(function(a){this.model_done(a,e)},this));else this.model_done(d.getChildren(),e)}},defaults:{object:false,id_prefix:false,async:false},_fn:{model_done:function(b,e){var d=[],c=this._get_settings(),f=this;if(!a.isArray(b))b=[b];a.each(b,function(g,e){var b=e.getProps()||{};b.attr=e.getAttr()||{};if(e.getChildrenCount())b.state="closed";b.data=e.getName();if(!a.isArray(b.data))b.data=[b.data];if(f.data.types&&a.isFunction(e.getType))b.attr[c.types.type_attr]=e.getType();if(b.attr.id&&c.model.id_prefix)b.attr.id=c.model.id_prefix+b.attr.id;if(!b.metadata)b.metadata={};b.metadata.jstree_model=e;d.push(b)});e.call(null,d)}}})})(jQuery)})();$(function(){function a(a,b){a=$(a);a.attr("disabled","disabled");var d=actionUrl("ApprovalWorkflows/Checkouts/"+b),c={resourceId:a.attr("data-resource-id")};$.post(d,c,function(){window.location.href=window.location.href},"json")}$(".checkin-button").bind("pageChangeClick",function(){a(this,"CheckIn")});$(".checkout-button").bind("pageChangeClick",function(){a(this,"CheckOut")})});(function(){window.Contractors=window.Contractors||{};window.Contractors.ContractorSelector={FillSelectWithContractors:function(b,c){a(b,c,false)},FillSelectWithContractorsForSecurity:function(b){a(b,null,true)}};function a(b,a,d){$.post(actionUrl("Contractors/ContractorSelector/ContractorJson"),{forSecurity:d},c,"json");function c(c){$.each(c,function(c,a){b.append($("<option>").attr("value",a.Id).text(a.Name))});a&&a(c.length)}}})();(function(){$.widget("ui.ContractorLabel",{options:{contractorId:null},_create:function(){$("<span></span>").addClass("contractor-label").text("...").appendTo($(this.element));var a=this;$.post(actionUrl("Contractors/ContractorLabel/Json"),{id:a.options.contractorId},function(b){a.receiveModel(b)},"json")},receiveModel:function(a){$("span.contractor-label",this.element).text(a.Name)},destroy:function(){$("span.contractor-label",this.element).remove()}})})();$(document).ready(function(){var a=$(".current-contractor-control");a.width()>400&&a.addClass("current-contractor-control-name-too-long")});jQuery(function(){var a=false,g='<div id="current-contractor-popup">  <span class="current-contractor-loading">Loading...</span>  <span class="current-contractor-prompt">    Select a Contractor:    <select name="current-contractor-select" />  </span>\t <span class="current-contractor-no-contractors">    No contractors could be found.  </span></div>';function h(){if(a)$("#current-contractor-popup").dialog("open");else{$("body").append(g);e();var c=$("#current-contractor-popup select").empty();Contractors.ContractorSelector.FillSelectWithContractors(c,b)}}function e(){setTimeout(function(){$("#current-contractor-popup").dialog({autoOpen:true,buttons:{Ok:d,Cancel:f},modal:true,title:"Change Current Contractor",width:"auto"})},100);$(".current-contractor-prompt").hide();$(".current-contractor-no-contractors").hide()}function b(d){a=true;var c=$("#current-contractor-popup select"),b=$(".current-contractor-control").attr("data-current-contractor-id");$("option[value='"+b+"']",c).attr("selected","selected");$(".current-contractor-loading").hide();if(d==0){$(":button:contains('Ok')").attr("disabled","disabled");$(".current-contractor-no-contractors").show()}else{$(":button:contains('Ok')").removeAttr("disabled");$(".current-contractor-prompt").show()}}function d(){var a=$("#current-contractor-popup select option:selected").val();$.post(actionUrl("Contractors/CurrentContractorControl/Set"),{id:a},c,"json")}function c(){var a=$(".current-contractor-control").attr("data-current-user-id");window.location=actionUrl("Security/LoginForm/GoToDefaultPage?userId="+a)}function f(){$("#current-contractor-popup").dialog("close")}$(".current-contractor-control a").bind("pageChangeClick",function(){h()})});(function(){window.Contractors=window.Contractors||{};window.Contractors.ContractorSelector={FillSelectWithContractors:function(b,c){a(b,c,false)},FillSelectWithContractorsForSecurity:function(b){a(b,null,true)}};function a(b,a,d){$.post(actionUrl("Contractors/ContractorSelector/ContractorJson"),{forSecurity:d},c,"json");function c(c){$.each(c,function(c,a){b.append($("<option>").attr("value",a.Id).text(a.Name))});a&&a(c.length)}}})();jQuery(function(){var a=false,g='<div id="current-division-popup">  <span class="current-division-loading">Loading...</span>  <span class="current-division-prompt">    Select a Division:    <select name="current-division-select" />  </span></div>';function h(){if(a)$("#current-division-popup").dialog("open");else{$("body").append(g);e();var c=$("#current-division-popup select").empty();Divisions.DivisionSelector.FillSelectWithDivisions(c,b)}}function e(){setTimeout(function(){$("#current-division-popup").dialog({autoOpen:true,buttons:{Ok:d,Cancel:f},modal:true,title:"Change Current Division",width:"auto"})},100);$(".current-division-prompt").hide()}function b(){a=true;var c=$("#current-division-popup select"),b=$(".current-division-control").attr("data-current-division-id");$("option[value='"+b+"']",c).attr("selected","selected");$(".current-division-loading").hide();$(".current-division-prompt").show()}function d(){var a=$("#current-division-popup select option:selected").val();$.post(actionUrl("Divisions/CurrentDivisionControl/Set"),{id:a},c,"json")}function c(){var a=$(".current-division-control").attr("data-current-user-id");window.location=actionUrl("Security/LoginForm/GoToDefaultPage?userId="+a)}function f(){$("#current-division-popup").dialog("close")}$(".current-division-control").bind("pageChangeClick",h)});(function(){$.widget("ui.DivisionLabel",{options:{divisionId:null},_create:function(){$("<span></span>").addClass("division").text("...").appendTo($(this.element));var a=this;$.post(actionUrl("Divisions/DivisionLabel/Json"),{id:a.options.divisionId},function(b){a.receiveModel(b)},"json")},receiveModel:function(a){$("span.division",this.element).text(a.Name)},destroy:function(){$("span.division",this.element).remove()}})})();(function(){window.Divisions=window.Divisions||{};window.Divisions.DivisionSelector={FillSelectWithDivisions:function(b,c){a(b,c)}};function a(b,a){$.post(actionUrl("Divisions/DivisionSelector/DivisionJson"),null,c,"json");function c(c){$.each(c,function(c,a){b.append($("<option>").attr("value",a.Id).text(a.Name))});a&&a()}}})();(function(){window.GrantProcessing=window.Divisions||{};window.GrantProcessing.ProgramSelector={FillSelectWithPrograms:function(b,c,d){a(b,c,null,false,d)},FillSelectWithProgramsForContractor:function(b,c,d){a(b,null,c,false,d)},FillSelectWithProgramsForAlerts:function(b,c,d){a(b,c,null,true,d)}};function a(b,e,c,f,a){$.post(actionUrl("GrantProcessing/ProgramSelector/ProgramJson"),{divisionId:e,contractorId:c,forAlerts:f},d,"json");function d(c){$.each(c,function(c,a){b.append($("<option>").attr("value",a.Id).text(a.Name))});a&&a()}}})();(function(){$.widget("ui.ProgramLabel",{options:{programId:null},_create:function(){$("<span></span>").addClass("program-label").text("...").appendTo($(this.element));var a=this;$.post(actionUrl("GrantProcessing/ProgramLabel/Json"),{id:a.options.programId},function(b){a.receiveModel(b)},"json")},receiveModel:function(a){$("span.program-label",this.element).text(a.Name)},destroy:function(){$("span.program-label",this.element).remove()}})})();(function(a){window.GrantProcessing=window.GrantProcessing||{};window.GrantProcessing.SpeedChartGrid={Selectors:{dialogClass:"#speedChartDialog",addLink:"#addSpeedChart",editLink:".edit-speed-chart",loading:"#speedChartDialogLoad",body:"#speedChartDialogBody",id:"#DialogId",reimbursementRequestId:"#DialogReimbursementRequestId",speedChartId:"#DialogSpeedChartId",amount:"#DialogAmount",errors:"#speedChartDialogErrors",grid:".speed-chart-table"},Options:{reimbursementRequestId:null},Initialize:function(a){window.GrantProcessing.SpeedChartGrid.Options.reimbursementRequestId=a;window.GrantProcessing.SpeedChartGrid._CreateDialog();window.GrantProcessing.SpeedChartGrid._SetupLinks()},ShowDialog:function(b){window.GrantProcessing.SpeedChartGrid._LoadData(b);a(window.GrantProcessing.SpeedChartGrid.Selectors.dialogClass).dialog("open")},Save:function(){var b=window.GrantProcessing.SpeedChartGrid.Selectors;if(window.GrantProcessing.SpeedChartGrid._IsValidData()){var c={Id:a(b.id).val(),ReimbursementRequestId:a(b.reimbursementRequestId).val(),SpeedChartId:a(b.speedChartId).val(),Amount:a(b.amount).val()};a.post(actionUrl("GrantProcessing/ReimbursementRequestSpeedCharts/Edit"),c,function(c){if(c.success){a(b.dialogClass).dialog("close");window.GrantProcessing.SpeedChartGrid._UpdateGrid(c.model);Toast.AddActionCompleteMessage(c.message)}})}},_CreateDialog:function(){var b=window.GrantProcessing.SpeedChartGrid.Selectors;a(b.dialogClass).dialog({modal:true,autoOpen:false,width:480,height:280,buttons:{Ok:window.GrantProcessing.SpeedChartGrid.Save,Cancel:function(){a(b.dialogClass).dialog("close")}}})},_SetupLinks:function(){var b=window.GrantProcessing.SpeedChartGrid.Selectors;a(b.addLink).click(function(a){a.preventDefault();window.GrantProcessing.SpeedChartGrid.ShowDialog()});a(b.grid).delegate(b.editLink,"click",function(b){b.preventDefault();var c=a(this).closest("tr").data("id");window.GrantProcessing.SpeedChartGrid.ShowDialog(c)});a(b.grid).delegate("a.delete","click",function(){var b=a(this).closest("tr"),d=b.data("id"),c=b.find(".speed-chart-value").text();confirm("Are you sure you want to remove "+c+"?")&&a.post(actionUrl("GrantProcessing/ReimbursementRequestSpeedCharts/Delete"),{id:d},function(){var c=b.closest(".grid-table");b.remove();a(".speed-chart-table tbody tr").length==0&&a("<tr class='grid-empty'><td colspan='8'>No Speed Charts found.</td></tr>").appendTo(".speed-chart-table tbody");window.GrantProcessing.SpeedChartGrid._UpdateTotal();c.trigger("rowsChanged");Toast.AddActionCompleteMessage("Speed chart removed.")},"json");return false})},_LoadData:function(d){var b=window.GrantProcessing.SpeedChartGrid.Selectors,c=window.GrantProcessing.SpeedChartGrid.Options.reimbursementRequestId;a(b.loading).show();a(b.body).hide();a(b.errors).empty().hide();a(b.speedChartId).removeClass("error");a(b.amount).removeClass("error");a.ajax({url:actionUrl("GrantProcessing/ReimbursementRequestSpeedCharts/GetSpeedChartModel"),data:{reimbursementRequestId:c,speedChartId:d},type:"GET",cache:false,dataType:"json",success:function(c){window.GrantProcessing.SpeedChartGrid._SetupData(c);a(b.loading).hide();a(b.body).show()},error:function(){a("<li/>").text("There was an error loading data for the speed chart.").appendTo(b.errors);a(b.errors).show();a(b.loading).hide()}})},_SetupData:function(b){var c=window.GrantProcessing.SpeedChartGrid.Selectors;a(c.id).val(b.Id);a(c.reimbursementRequestId).val(b.ReimbursementRequestId);a(c.amount).val(b.Amount);var e=a(c.speedChartId);e.empty();a("<option value=''>--</option>").appendTo(e);for(var d=0;d<b.AvailableSpeedCharts.length;d++)a("<option/>").attr("value",b.AvailableSpeedCharts[d].Id).text(b.AvailableSpeedCharts[d].SpeedChartValue).appendTo(e);if(b.AvailableSpeedCharts.length==0){a("<li/>").text("There are no available speedcharts.  Make sure the division is setup with the proper SetId and Departments, and there are appropriate speedcharts imported into the system.").appendTo(c.errors);a(c.errors).show()}a(c.speedChartId).val(b.SpeedChartId)},_IsValidData:function(){var b=window.GrantProcessing.SpeedChartGrid.Selectors,d=a(b.speedChartId).val(),e=a(b.amount).val();a(b.errors).empty();var c=true;if(d.length==0){a("<li/>").text("Speed chart is required").appendTo(b.errors);a(b.speedChartId).addClass("error");c=false}else a(b.speedChartId).removeClass("error");if(!a.isNumeric(e)){a("<li/>").text("Amount must be a valid decimal value.").appendTo(b.errors);a(b.amount).addClass("error");c=false}else a(b.amount).removeClass("error");if(!c)a(b.errors).show();else a(b.errors).hide();return c},_UpdateGrid:function(c){var g=window.GrantProcessing.SpeedChartGrid.Selectors,d=a(g.grid),b=d.find("tbody tr[data-id="+c.Id+"]");if(b.length===0){b=a("<tr />").attr("data-id",c.Id).appendTo(d.find("tbody"));var f=a("<td/>").addClass("icon-button").appendTo(b);a("<a/>").attr("href","#").attr("title","Delete").addClass("delete").text("Delete").appendTo(f);a("<td/>").addClass("set-id").appendTo(b);var e=a("<td/>").addClass("speed-chart").appendTo(b);a("<a/>").attr("href","#").addClass("speed-chart-value edit-speed-chart").appendTo(e);a("<td/>").addClass("department").appendTo(b);a("<td/>").addClass("account").appendTo(b);a("<td/>").addClass("project").appendTo(b);a("<td/>").addClass("activity").appendTo(b);a("<td/>").addClass("description").appendTo(b);a("<td/>").addClass("speed-chart-amount").appendTo(b)}b.find("td.set-id").text(c.SpeedChart.SetId);b.find("a.speed-chart-value").text(c.SpeedChart.SpeedChartValue);b.find("td.department").text(c.SpeedChart.Department);b.find("td.account").text(c.SpeedChart.Account);b.find("td.project").text(c.SpeedChart.Project);b.find("td.activity").text(c.SpeedChart.Activity);b.find("td.description").text(c.SpeedChart.Description);FormatCurrency(c.Amount,b.find("td.speed-chart-amount"));d.find("tbody tr").length>1&&d.find("tbody tr.grid-empty").remove();window.GrantProcessing.SpeedChartGrid._UpdateTotal();d.trigger("rowsChanged")},_UpdateTotal:function(){var b=ColumnTotal(".speed-chart-amount");FormatCurrency(b,a(".speed-chart-sum"))}}})(jQuery);$(function(){$(".attachments-link").live("click",function(){var b=$("<div class='attachments-dialog'>Loading...</div>").dialog({modal:true,title:"Attachments",width:650,height:450}),a={ownerId:$(this).attr("data-attachment-owner-id"),attachmentType:$(this).attr("data-attachment-type"),addRedirectUrl:window.location.pathname+window.location.search,noCacheTicket:Math.random()};$.get(actionUrl("ProgressReports/AttachmentGrid/Index"),a,function(a){b.html(a)},"html")})});(function(){window.ProgressReports=window.ProgressReports||{};window.ProgressReports.Submission={_WorksheetType:"Progress Report",InitWorksheetType:function(a){this._WorksheetType=a},WorksheetType:function(){return this._WorksheetType}}})();$(function(){$("[name='submit-progress-report']").click(function(){var a=$(this).attr("data-progress-report-instance-id");c(a)});$("[name='unsubmit-progress-report']").click(function(){var a=$(this),b=a.attr("data-progress-report-instance-id");a.attr("disabled","disabled").text("Unsubmitting...");d(b,function(b){if(b){a.text("Unsubmitted.");Toast.AddActionCompleteMessage(ProgressReports.Submission.WorksheetType()+" Unsubmitted.")}else{a.text("Failed.");Toast.AddErrorMessage("There was an error unsubmitting the "+ProgressReports.Submission.WorksheetType().toLowerCase()+".")}})});function c(a){b('<span class="loading">Submitting '+ProgressReports.Submission.WorksheetType().toLowerCase()+"...</span>");f(a)}function f(a){$.post(actionUrl("ProgressReports/ProgressReportFiller/Submit"),{id:a},e,"json")}function d(b,c){$.post(actionUrl("ProgressReports/ProgressReportFiller/Unsubmit"),{id:b},function(b){a(b,c)},"json")}function e(a){var d=$("#report-submission-dialog").text("");if(!a.SubmissionPreventionReasons||a.SubmissionPreventionReasons.length==0){d.dialog("close");Toast.AddActionCompleteMessage(ProgressReports.Submission.WorksheetType()+" Submitted.");var c=$("#approval-status-label");if(c.length>0){var f={userId:$("#current-user-id").attr("data-user-id"),status:"Pending"};$.post(actionUrl("ApprovalWorkflows/ApprovalLabel/ColorLabelForStatus"),f,function(a){c.html(a)})}return}var b=$("<div></div>").addClass("submit-blocked-reasons").appendTo(d);if(a.SubmissionPreventionReasons.length==1)b.text(a.SubmissionPreventionReasons[0]);else{b.text("The "+ProgressReports.Submission.WorksheetType().toLowerCase()+" cannot be submitted for the following reasons:");var e=$("<ul></ul>");$.each(a.SubmissionPreventionReasons,function(b,a){$("<li></li>").appendTo(e).text(a)});b.append(e)}}function a(a,b){if(a.FailedReason){alert(a.FailedReason);b(false)}else{$.event.trigger("ProgressReportUnsubmitted",[a.ProgressReportInstanceId]);b(true)}}function b(b){var a=$("#report-submission-dialog");if(a.length==0){a=$("<div></div>").attr("id","report-submission-dialog").appendTo("body").html(b);a.dialog({title:ProgressReports.Submission.WorksheetType()+" Submission",modal:true,width:400,height:300,buttons:{Ok:function(){a.dialog("close")}}})}else{a.html(b);a.dialog("open")}}});(function(){$.widget("ui.ContractorSectionTreeWidget",{options:{progressReportId:null,selectedNodeId:null,worksheetType:null,isReadOnly:null},_create:function(){var a=this;$.post(actionUrl("ProgressReports/ProgressReportFiller/JsTree"),{id:a.options.progressReportId,nodeId:a.options.selectedNodeId},function(b){a.receiveModel(b)},"json");$(document).bind("refreshCurrentNode",function(){a._loadQuestionModel()})},receiveModel:function(c){var a=this,b=this._getTreeOptions(c);this.element.jstree(b).bind("select_node.jstree",function(e,b){if($.DirtyForm.shouldAbortPageChange())return;a.options.selectedNodeId=b.rslt.obj.attr("id");a._loadQuestionModel();a._loadFinancialSummary();var d=b.inst._get_next(b.rslt.obj),c=b.inst._get_prev(b.rslt.obj);a._updateNavigation(c,d,b.inst)}).bind("loaded.jstree",function(){a._augmentTreeWithCompletionStatus()})},_updateNavigation:function(c,d,a){var b=this,e=$("#previous-node-container");b._updateNavigationNode(e,c,a);var f=$("#next-node-container");b._updateNavigationNode(f,d,a)},_updateNavigationNode:function(c,b,d){var f=this,a=c.find("a");if(b==false||b.length==0){c.hide();a.attr("href","#");a.text("");a.unbind("click")}else{c.show();a.attr("href","#"+b.attr("id"));var e=d.get_text(b);a.text(e);a.unbind("click").click(function(){var c=a.attr("href"),b=$.jstree._focused();b.deselect_all();b.select_node(c)})}},_augmentTreeWithCompletionStatus:function(){var a=this,d=a._getAllTreeLiNodes(),b=a._getNodeIds(d);b.length===1&&a._hideNavigation();var c={nodeIds:b,instanceId:$("#tree").attr("data-val-instance-id")};$.postJSON(actionUrl("ProgressReports/QuestionFiller/QuestionRollupModel"),c,function(b){a._updateQuestionCounts(b);a._rollupQuestionsAndAnswers();a._loadStatusData()})},_loadStatusData:function(){var a=this,b={id:a.options.progressReportId};$.post(actionUrl("ProgressReports/ProgressReportValidation/UnansweredRequiredQuestions"),b,function(b){a.element.data("MissingQuestions",b);a._rollupQuestionsAndAnswers()})},_getAllTreeLiNodes:function(){return this.element.find("li")},_updateQuestionCounts:function(b){var c=this,a=c._getAllTreeLiNodes();$.each(b,function(d,b){var c=a.filter('[id="'+b.NodeId+'"]');c.data("QuestionIds",b.QuestionIds);c.data("BudgetTotal",b.BudgetTotal)})},_rollupQuestionsAndAnswers:function(){var b=this;$(".node-status-indicator").remove();$(".node-subordinate-question-count").remove();$(".node-subordinate-budget-total").remove();var c=b._getAllTreeLiNodes();$.each(c,function(n,m){var c=$(m);$titleLink=c.children("a");var i=c.find("li"),d=$.merge([],c.data("QuestionIds")),g=c.data("BudgetTotal");$.each(i,function(e,b){var c=$(b).data("QuestionIds");$.merge(d,c);var a=$(b).data("BudgetTotal");if(a!=null)g+=a});var h=$('<div class="node-subordinate-question-count">').text("("+d.length+")");if(g==null)$titleLink.after(h);else{var l=$('<div class="node-subordinate-budget-total">').text("["+a(g)+"]");$titleLink.after(l).after(h)}var e=b.element.data("MissingQuestions");if(e==undefined||e==null)return;var f=null;if(b._hasUnansweredRequiredQuestion(d,e))f="red";else f="green";var k=actionUrl("Content/themes/default/"+f+".check.png"),j=$('<img class="node-status-indicator">').attr("src",k);$titleLink.before(j)})},_hasUnansweredRequiredQuestion:function(b,c){var a=false;$.each(b,function(d,b){$.each(c,function(d,c){if(b==c){a=true;return a}});if(a==true)return a});return a},_getNodeIds:function(b){var a=[];$.each(b,function(c,b){a.push($(b).attr("id"))});return a},_loadQuestionModel:function(){var a=this,b={parentId:a.options.selectedNodeId,instanceId:a.options.progressReportId,worksheetType:a.options.worksheetType};$.post(actionUrl("ProgressReports/QuestionFiller/Index"),b,function(c){$questionContent=$("#question-content");$questionContent.html(c);window.FormsCommon.AddMaxLengthAttributes();var b=$questionContent.closest("form");b.removeData("validator");b.removeData("unobtrusiveValidation");$.validator.unobtrusive.parse(b);b.dirtyform();a.element.trigger("questions-loaded");if(a.options.isReadOnly==="True")$questionContent.readonly();else $(".question-save-button").click(function(){setTimeout(function(){a.element.data("MissingQuestions",null);a._loadStatusData();a._loadFinancialSummary()},3e3)})},"html")},_loadFinancialSummary:function(){var b=this,a={progressReportInstanceId:b.options.progressReportId};$.post(actionUrl("ProgressReports/GrantAnswerSummary/GrantSummary"),a,function(a){$("#financial-summary-content").html(a)},"html")},_getTreeOptions:function(b){var a=this;return{core:{initially_open:[a.options.selectedNodeId]},json_data:{data:b},themes:{theme:"default",dots:false,icons:false,url:actionUrl("Content/themes/default/style.css")},ui:{select_limit:1,selected_parent_close:"select_parent",initially_select:[a.options.selectedNodeId]},plugins:["themes","json_data","ui"]}},_hideNavigation:function(){$("#tree-navigator").hide()},destroy:function(){this.element.html("")}});function a(a){a=a.toString().replace(/\$|\,/g,"");if(isNaN(a))a="0";sign=a==(a=Math.abs(a));a=Math.floor(a*100+.50000000001);cents=a%100;a=Math.floor(a/100).toString();if(cents<10)cents="0"+cents;for(var b=0;b<Math.floor((a.length-(1+b))/3);b++)a=a.substring(0,a.length-(4*b+3))+","+a.substring(a.length-(4*b+3));return(sign?"":"-")+"$"+a+"."+cents}})();(function(){window.ProgressReports=window.ProgressReports||{};window.ProgressReports.Validation={_WorksheetType:"Progress Report",InitWorksheetType:function(a){this._WorksheetType=a},WorksheetType:function(){return this._WorksheetType}}})();$(function(){$("a[name='validate-progress-report']").click(function(){var a=$(this).attr("data-progress-report-instance-id");b(a)});function b(b){c('<span class="loading">Loading validation summary...</span>');a(b)}function a(a){$.post(actionUrl("ProgressReports/ProgressReportValidation/HtmlFragment"),{id:a},d,"html")}function d(a){var b=$("#validation-summary-dialog").html(a);$(".grid-table",b).trigger("rowsChanged")}function c(b){var a=$("#validation-summary-dialog");if(a.length==0){a=$("<div></div>").attr("id","validation-summary-dialog").addClass("validation-summary").appendTo("body").html(b);a.dialog({title:ProgressReports.Validation.WorksheetType()+" Validation",modal:true,width:900,height:650,buttons:{Ok:function(){a.dialog("close")}}})}else{a.html(b);a.dialog("open")}}});$(function(){if($(".question-filler").length==0)return;(function(){$("input[name=Phone]").length>0&&$("input[name=Phone]").rules("add",{phone:true,messages:{phone:"Please enter a valid phone number."}});$("input[name=Email]").length>0&&$("input[name=Email]").rules("add","email");$(".question-save-button").click(function(){a($(this).closest("form"));var b=$(".question-filler").map(function(){var a=$(this),b=e(a),f=d(a);return{questionParentId:b,instanceId:f,answers:c(a)}}).get(),f={json:JSON.stringify(b)};$.post(actionUrl("ProgressReports/QuestionFiller/Save"),f,function(){Toast.AddActionCompleteMessage("Answers saved.")},"json");$.event.trigger("ProgressReportAnswersSaved")});function e(a){return a.attr("data-question-parent-id")}function d(b){var a=$("#question-content > .question-filler");if(a.length==0)a=b;return a.attr("data-instance-id")}function c(a){var c=a.find("div.question[data-question-type]"),d=a.find(".question-filler").find("div.question[data-question-type]"),e=c.not(d);return e.map(function(g,e){var a=$(e),c=a.attr("data-question-type"),d=b[c];if(typeof d!="function")throw'No serializer for question type: "'+c+'".';var f=d(a);return{questionId:a.attr("data-question-id"),answerData:f}}).get()}var b={checkbox:function(b){var a={};$("input[data-answer-id]:checked",b).each(function(){a[$(this).attr("data-answer-id")]="True"});return a},"contractor-contact":function(b){var c=$("input,select",b).serializeArray(),a={};$.each(c,function(){a[this.name]=this.value});return a},dropdown:function(b){var a={};a[$("option:selected",b).val()]="True";return a},grant:function(b){var a={};$("input[data-grant-id]",b).each(function(){var b=$(this);a[b.attr("data-grant-id")]=b.val()});return a},grid:function(b){var a={};$("input[data-row-index],textarea[data-row-index]",b).each(function(){var b=$(this),d=b.attr("data-row-index"),c=b.attr("data-column-index"),e=d+","+c;a[e]=b.val()});return a},"long-answer":function(a){return{text:$("textarea",a).val()}},radio:null,"short-answer":function(b){var a={};if($("textarea[data-short-answer-index]",b).size()>0)$("textarea[data-short-answer-index]",b).each(function(){var b=$(this);a[b.attr("data-short-answer-index")]=b.val();return a});else $("input[data-short-answer-index]",b).each(function(){var b=$(this);a[b.attr("data-short-answer-index")]=b.val();return a});return a},"static-answer":function(){return{}},"objective-answer":function(b){var a={},c=$(b).find(".objective-answer-input");$.each(c,function(d,c){var b=$(c);a[b.attr("data-answer-key")]=b.val()});var d=$(b).find(".objective-answer-text");$.each(d,function(d,c){var b=$(c);a[b.attr("data-answer-key")]=b.text()});return a},"repeater-answer":function(a){var c={},b=[],e=$(a).attr("data-question-id"),d=$(a).find("> .repeater-instance");$.each(d,function(d,a){var c=$(a).attr("data-repeater-instance-id");b.push(c)});c[e]=b.join(",");return c}};b.radio=b.checkbox})();(function(){$(".question-filler").closest("form").bind("ProgressReportPageTurning",function(){a(this)})})();function a(a){var c=$("input",a).length>50,b=c,d=b?$(a).data("validator").errorList.length==0:$(a).valid();if(d)$(".validation-summary-errors",a).addClass("validation-summary-valid");else{b&&alert("There are "+$(a).data("validator").errorList.length+" error(s) to fix in this area.");event.preventDefault()}}(function(){var g=null,e=false;$(".remove-contractor-grid-row").live("click",function(c){c.preventDefault();if(!confirm("Are you sure you want to delete this grid row?"))return;var a=$(this).closest("tr"),b=a.closest(".answer-grid");g=a.clone();a.remove();o(b);$.event.trigger("dynamic-content-removed-from-form",[b.closest("form")])});function o(a){var b=a.closest(".question").attr("data-question-id"),c=a.find("tr");$.each(c,function(a,f){a=a-1;var e=$(f),c=e.find("td");$.each(c,function(e,j){e=e-1;var i=$(j),c=i.find("input");if(c.length==0)return;var g=d(e,a,b);c.attr("id",g);var f=parseInt(c.attr("data-row-index"));h(c,f,a)})})}$(".add-answer-grid-row-button").live("click",function(){var j=$(this).siblings(".answer-grid"),m=j.find(".DoNotValidateMe");$.each(m,function(b,a){$.event.trigger("enable-grid-row-validation",[$(a)])});var a=j.children("tbody").children("tr").last(),h=a.hasClass("footer"),d=h?a.prev():a;if(d.hasClass("header")){d=g;e=true}var c=$("<tr></tr>").addClass("contractor-added-answer-row"),n=d.children("td");n.each(function(e,d){var a=l($(d)),b=a.hasClass("delete-column");b&&a.find(".remove-contractor-grid-row").length===0&&a.append($('<a class="remove-contractor-grid-row" title="Delete" href="#"></a>'));c.append(a);a.hasClass("calculated-column")&&setTimeout(function(){f(a)},0)});if(h)a.before(c);else a.after(c);var i=c.closest("form");k(i);b();$.event.trigger("dynamic-content-added-to-form",[i])});function l(b){var a=$("<td></td>");if(b.hasClass("row-sum"))return a;a.attr("class",b.attr("class"));if(a.hasClass("row-header")){a.append(j(b));return a}a.attr("data-calculation",b.attr("data-calculation"));a.append(i(b));return a}function j(g){var a=$("<input type='text' />"),h=-1;a.attr("data-column-index",h);var b=g.next().children("input,textarea"),i=parseInt(b.attr("data-row-index")),f=i+1;if(e===true)f=0;a.attr("data-row-index",f);var j=b.closest(".question").attr("data-question-id"),c=d();a.attr("id",c);a.attr("name",c);return a}function d(){return""+Math.floor(Math.random()*9999999)}function i(f){var d=f.clone(),a=d.children("input,textarea");a.val("");var c=parseInt(a.attr("data-row-index")),b=c+1;if(e===true)b=0;h(a,c,b);return d.children()}function h(b,h,f){b.attr("data-row-index",f);var g=b.attr("data-column-index"),k="grid-"+g+"-"+h,j="grid-"+g+"-"+f,i=d();b.attr("id",i);b.attr("name",i);var e="row "+(h+1),c="row "+(f+1);a(b,"data-val-integer",e,c);a(b,"data-val-range",e,c);a(b,"data-val-number",e,c);a(b,"data-val-currency",e,c)}function a(b,a,d,c){typeof b.attr(a)!="undefined"&&b.attr(a,b.attr(a).replace(d,c))}function k(a){a.removeData("validator");a.removeData("unobtrusiveValidation");$.validator.unobtrusive.parse(a)}$(document).bind("questions-loaded",function(){c()});$(document).bind("repeater-instance-added",function(){c()});c();function c(){$(".calculated-column").each(function(){f($(this))})}function f(c){var e=c.attr("data-calculation"),a=c.find("input, textarea");a.attr("data-calculation",e);var b=[],d=a.closest("tr").find("input[data-column-index],textarea[data-column-index]");d.each(function(){var c=$(this);if(n(a,c)||m(c))return true;b.push({Id:c.attr("id"),Index:parseInt(c.attr("data-column-index"))})});InstallColumnCalculation(a,b)}function n(a,b){return a.attr("id")===b.attr("id")}function m(a){return a.attr("data-column-index")==-1}})();(function(){function a(c,a,b,e){var f="data-"+c+"-index",d=0;jQuery("["+f+"='"+a+"']",b).each(function(){var a;if($(this).is("input")||$(this).is("textarea"))a=jQuery(this).val();else a=jQuery(this).text();a=GetValue(a);if(!isNaN(a))d+=a});jQuery("[data-sum-"+c+"-index='"+a+"']",b).text(GetValue(d).toFixed(2));e=="currency"&&FormatCurrency(d,jQuery("[data-sum-"+c+"-index='"+a+"']",b))}function c(b,e,d){var c=e.attr("data-sum-"+b+"-index"),g=e.attr("data-sum-format");a(b,c,d,g);var f="data-"+b+"-index='"+c+"'";$("input["+f+"], textarea["+f+"]",d).live("change",function(){a(b,c,d,g)})}$(document).bind("questions-loaded",function(){d();b()});function d(){$("table.answer-grid").each(function(){var a=$(this);$("[data-sum-row-index]",a).each(function(){c("row",$(this),a)});$("[data-sum-column-index]",a).each(function(){c("column",$(this),a)})})}})();function b(){$(".question-filler table.answer-grid .answer-column textarea").closest(".answer-column").css("text-align","left")}});(function(){$.widget("ui.QuestionLabel",{options:{questionId:null},_create:function(){$("<span></span>").addClass("question").text("...").appendTo($(this.element));var a=this,b=this.element.attr("data-question-id")||this.options.questionId;$.post(actionUrl("ProgressReports/QuestionLabel/Json"),{id:b},function(b){a.receiveModel(b)},"json")},receiveModel:function(a){$("span.question",this.element).text(a.QuestionName)},destroy:function(){$("span.question",this.element).remove()}})})();$(function(){var d=null,c=null;$(".progress-report-link").click(function(e){e.preventDefault();var b=$(this).attr("data-program-id"),d=$(this).attr("data-submitted")=="True",a=$(this).attr("data-has-reports")=="True";if(!a)return;c=$(this).attr("data-worksheet-type");l(b,d,c)});function l(b,c,a){k(a);g(b,c,a)}function g(c,d,b){var a=$("#progress-report-selector-popup");a.filter("select").empty();$(".progress-report-selector-loading").show();$(".progress-report-selector-prompt").hide();$(".progress-report-no-reports").hide();var f=a.find("#progress-report-grant-select"),e=a.find("#progress-report-select");ProgressReports.ProgressReportSelector.LoadData(c,b,d,m)}function k(a){$("#progress-report-selector-popup").dialog("destory").remove();var b=h(a);$("body").append(b);$("#progress-report-selector-popup").dialog({autoOpen:true,buttons:{Ok:i,Cancel:f},modal:true,title:"View "+e(a),width:525})}function e(a){if(a==="ProgressReport")return"Progress Report";else if(a==="GrantApplication")return"Application";throw"Unhandled Worksheet '"+a+"'.";}function h(c){var a=e(c),b=/^[a,e,i,o,u]/.test(a.toLowerCase())?"an":"a",d='<div id="progress-report-selector-popup">  <span class="progress-report-selector-loading">Loading...</span>  <div class="progress-report-selector-prompt">\t\t<div id="progress-report-grant">\t\t\tSelect a Grant:\t\t\t<select id="progress-report-grant-select" ><option>==========</option></select>\t\t</div>\t\t<div id="progress-report-due-date">\t\t\tSelect '+b+" "+a.toLowerCase()+':\t\t\t<select id="progress-report-select" ><option>==========</option></select>\t\t</div>  </div>\t <div class="progress-report-no-reports">    No '+a.toLowerCase()+" could be found.  </div></div>";return d}function i(){if($(".progress-report-no-reports").is(":visible")){f();return}var a=$("#progress-report-select").val();if(a==null||a.length==0){alert("No report selected.");return}var b=actionUrl(c+"s/ProgressReportFiller/Index/"+a);window.location=b}function f(){$("#progress-report-selector-popup").dialog("close")}function m(f,c){$(".progress-report-selector-loading").hide();if(c.length>0)$(".progress-report-selector-prompt").show();else{$(".progress-report-no-reports").show();return}var e=$("#progress-report-select");if(f&&f.length>1){d=c;$("#progress-report-grant").show();var g=$("#progress-report-grant-select"),i=j(f);a(g,i);g.change(function(){var c=g.find("option:selected").val(),f=b(d,c);a(e,f)});var h=b(d,i[0].value);a(e,h)}else{$("#progress-report-grant").hide();var h=b(c,null);a(e,h)}}function j(b){var a=[];$.each(b,function(c,b){a.push({text:b.Name,value:b.GrantId})});return a}function b(c,a){var b=[];$.each(c,function(f,c){var d=$.FormatShortDate($.ParseJsonDate(c.DueDate)),e=c.ProgressReportInstanceId;(a==null||a==c.GrantId)&&b.push({text:d,value:e})});return b}function a(a,b){a.empty();$.each(b,function(d,b){var c=$("<option>").attr("value",b.value).text(b.text);a.append(c)})}});(function(){window.ProgressReports=window.ProgressReports||{};window.ProgressReports.ProgressReportSelector={_GrantData:null,_DueDateData:null,LoadData:function(c,b,d,a){var e=this;$.post(actionUrl("ProgressReports/ProgressReportSelectorDialog/ProgressReportsJson"),{programId:c,worksheetType:b,submitted:d},function(c){if(b==="GrantApplication")e._OnDueDateDataLoaded(c,a);else a(null,c)},"json")},_OnDueDateDataLoaded:function(a,d){for(var f=this,b=[],c=0;c<a.length;c++){var e=a[c].GrantId;e!=null&&b.push(e)}if(b.length==0){d(null,a);return}$.postJSON(actionUrl("GrantProcessing/GrantLabel/LabelsJson"),{grantIds:b},function(b){d(b,a)},"json")}};})();(function(){window.ProgressReports=window.ProgressReports||{};window.ProgressReports.NodeEditor={$treeHolder:null,$questionResult:null,_nodeId:null,_worksheetType:null,Init:function(c,d,b){var a=this;if(c==="Section")a.InitSectionNode(d,b);else a.InitSpecialNode(false)},InitSectionNode:function(c,b){var a=this;a.$treeHolder=$("#tree");a.$questionResult=$("#question-result");a._nodeId=c;a._worksheetType=b;a._LoadTree()},InitSpecialNode:function(a){$("#Name").rules("add",{maxlength:a?100:8e3})},_LoadTree:function(){var a=this;$.ajax({url:actionUrl(a._worksheetType+"s/NodeEditor/JsTree/"+a._nodeId),dataType:"json",type:"POST",data:null,success:function(c){var b=a.__TreeOptions(c);a.$treeHolder.jstree(b).bind("select_node.jstree",function(b,c){a.__NodeSelectedEvent(b,c)}).bind("create.jstree",function(b,c){a.__NodeCreatedEvent(b,c)}).bind("remove.jstree",function(b,c){a.__NodeRemovedEvent(b,c)}).bind("rename.jstree",function(b,c){a.__NodeRenamedEvent(b,c)}).bind("move_node.jstree",function(b,c){a.__NodeMovedEvent(b,c)})}})},__TreeOptions:function(b){var a=this;return{json_data:{data:b},themes:{theme:"default",dots:false,icons:false,url:actionUrl("Content/themes/default/style.css")},ui:{select_limit:1,selected_parent_close:"select_parent",initially_select:[a._nodeId]},contextmenu:{items:a._TreeContextMenu},crrm:{move:{check_move:function(b){var a=this._get_parent(b.o);if(!a)return false;a=a==-1?this.get_container():a;return a===b.np?true:a[0]&&b.np[0]&&a[0]===b.np[0]?true:false}}},dnd:{drop_target:false,drag_target:false},plugins:["themes","json_data","contextmenu","ui","crrm","dnd"]}},__NodeSelectedEvent:function(c,b){var a=this;$.post(actionUrl(a._worksheetType+"s/QuestionEditor/QuestionGrid/Index"),{parentId:b.rslt.obj.attr("id"),parentType:b.rslt.obj.attr("nodetype"),worksheetType:a._worksheetType},function(b){a.$questionResult.html(b);$(".grid-table").each(function(){$(this).trigger("rowsChanged")})})},__NodeCreatedEvent:function(c,a){var b=this;$.post(actionUrl(b._worksheetType+"s/NodeEditor/CreateNode"),{parentId:a.rslt.parent.attr("id"),nodeName:a.rslt.name},function(b){if(b)$(a.rslt.obj).attr("id",b.NodeId);else $.jstree.rollback(a.rlbk)})},__NodeRemovedEvent:function(c,a){var b=this;a.rslt.obj.each(function(){$.post(actionUrl(b._worksheetType+"s/NodeEditor/DeleteNode"),{nodeId:this.id},function(){})})},__NodeRenamedEvent:function(c,a){var b=this;$.post(actionUrl(b._worksheetType+"s/NodeEditor/RenameNode"),{nodeId:a.rslt.obj.attr("id"),newNodeName:a.rslt.new_name},function(b){!b.NodeId&&$.jstree.rollback(a.rlbk)})},__NodeMovedEvent:function(e,a){var b=this,c=b._GetCalculatedPosition(a),d=a.rslt.o.attr("id");$.post(actionUrl(b._worksheetType+"s/NodeEditor/ReorderNode"),{nodeId:d,newSequenceNumber:c},function(b){!b.NodeId&&$.jstree.rollback(a.rlbk)})},_GetCalculatedPosition:function(b){var c=b.rslt.p,a=b.rslt.cp;if(c==="before")calculatedPosition=a+1;else calculatedPosition=a;return calculatedPosition},_TreeContextMenu:function(){return{ccp:false,create:{label:"Create",action:function(a){this.create(a)},separator_after:true,icon:false},rename:{label:"Rename",action:function(a){this.rename(a)},icon:false},remove:{label:"Delete",action:function(a){confirm("Are you sure you want to delete?")&&this.remove(a)},icon:false}}}}})();(function(){var a="\t\t<div id='user-selector-add-user-to-system'>\t\t\t<div class='user-selector-add-user-prompt'>\t\t\t\tThe user \"<span class='user-selector-username'></span>\" exists with the following\t\t\t\tdetails, but hasn't been added to this system yet.  Do you want to add this user?\t\t\t</div>\t\t\t<div class='user-selector-add-user-details'>\t\t\t\t<span class='user-selector-first-name'></span>&nbsp;<span class='user-selector-last-name'></span>\t\t\t</div>\t\t</div>\t";$.widget("ui.UserSelector",{_create:function(){var a=this;$(".user-selector-find").click(function(){a.onFindClick()})},destroy:function(){},onFindClick:function(){var a={username:$(".user-selector-text",this.element).val()};if($.trim(a.username)==""){alert("Enter a user name to search for.");return}this.showNotFoundIndicator(false);this.showLoadingIndicator(true);var b=this;$.post(actionUrl("Security/UserSelector/Find"),a,function(a){b.handleSearchResults(a)},"json")},showLoadingIndicator:function(a){this.showIndicator(a,"loading","Loading...")},showNotFoundIndicator:function(b,a){this.showIndicator(b,"username-not-found",'Username "'+a+'" not found.')},showConfirmingIndicator:function(b,a){this.showIndicator(b,"confirming",'Confirming "'+a+'"...')},showIndicator:function(b,a,c){var d=$("."+a,this.element);if(d.length==0){if(!b)return;$("<span></span>").addClass(a).text(c).appendTo($(this.element))}else d.text(c).toggle(b)},handleSearchResults:function(a){this.showNotFoundIndicator(false);this.showLoadingIndicator(false);if(a.Timeout){alert("The LDAP system did not respond in the allotted amount of time.");return}if(a.User==null)this.showNotFoundIndicator(true,a.SearchFor);else if(a.IsRecognizedInSystem)this.publishUserSelectedEvent(a.User);else this.confirmAddUserToSystem(a.User)},publishUserSelectedEvent:function(a){$.event.trigger("UserSelector_UserSelected",[a])},userBeingConfirmed:null,confirmAddUserToSystem:function(b){this.userBeingConfirmed=b;var a=$("#user-selector-add-user-to-system");if(a.length==0)a=this.initializeAddUserDialog();a.dialog("open");$(".user-selector-username",a).text(b.Username);$(".user-selector-first-name",a).text(b.FirstName);$(".user-selector-last-name",a).text(b.LastName)},initializeAddUserDialog:function(){var b=this;return $(a).appendTo($("body")).dialog({title:"New User",buttons:{"Add User":function(){b.onAddUserDialogConfirm()},Cancel:function(){b.closeAddUserDialog()}},modal:true})},onAddUserDialogConfirm:function(){var a=this;this.showConfirmingIndicator(true,this.userBeingConfirmed.Username);$.post(actionUrl("Security/UserSelector/Confirm"),this.userBeingConfirmed,function(){a.showConfirmingIndicator(false)},"json");this.publishUserSelectedEvent(this.userBeingConfirmed);this.closeAddUserDialog()},closeAddUserDialog:function(){$("#user-selector-add-user-to-system").dialog("close")}});$(function(){$(".user-selector").UserSelector()})})();window.Security=window.Security||{};window.Security.UserUsage=function(){var d={CheckIfDeleteIsAllowed:function(c,a,d){var g=actionUrl("Security/UserUsage/CheckIfDeleteIsAllowed"),f={userId:c,systemLevel:a},e={userId:c,systemLevel:a,callback:d};$.post(g,f,function(a){b(e,a)},"json")}},c={ApprovalWorkflowStage:function(a){return{url:actionUrl("ApprovalWorkflows/ApprovalWorkflowLabelForDeletion/GetLabel"),data:{approvalWorkflowStageID:a.OwnerId}}},GeneratedReportSaved:function(a){return{url:actionUrl("ReportGenerator/ReportLabelForDeletion/GetLabel"),data:{reportId:a.OwnerId}}},Approval:function(a){return{url:actionUrl("ApprovalWorkflows/ApprovalLabelForDeletion/GetLabel"),data:{approvalID:a.OwnerId}}},ReimbursementRequestSubmitted:function(a){return{url:actionUrl("Contractors/ReimbursementRequestSubmittedLabelForDeletion/GetLabel"),data:{reimbursementRequestId:a.OwnerId}}},ContractorBudgetSubmitted:function(a){return{url:actionUrl("Contractors/ContractorBudgetSubmittedLabelForDeletion/GetLabel"),data:{contractorFinancialsId:a.OwnerId}}},ContractorBudgetSaved:function(a){return{url:actionUrl("Contractors/ContractorBudgetSavedLabelForDeletion/GetLabel"),data:{budgetId:a.OwnerId}}},ProgressReportInstanceSubmitted:"Submitted progress report(s)."};function b(e,d){if(d.length==0){e.callback(null);return}var b=[],f=function(){b.length==d.length&&a(e,b)};$.each(d,function(h,g){var a=c[g.Type];switch(typeof a){case"string":b.push(a);break;case"function":var d=a(g);d.data.userId=e.userId;$.post(d.url,d.data,function(a){b.push(a);f()},"json");break;case"undefined":throw"Undefined UserUsage ResponseType: "+g.Type;default:throw"Expected descriptionHelp to be either a string or a function, but it was a "+typeof a;}});f()}function a(d,c){var a="",b={};$.each(c,function(d,c){if(!b[c]){a=a+"\t"+c+"\r\n";b[c]=true}});d.callback(a)}return d}();(function(){window.Toast={AddActionCompleteMessage:function(c){b("ActionComplete",c);a()},AddErrorMessage:function(a){b("Error",a)},HideActionCompleteToasts:function(){a()},ClearErrors:function(){$(".toast-item").remove()}};function b(b,c){var a=$("<div />").addClass("toast-item").addClass(b).text(c);$(".toast").append(a)}function a(){$(".toast .ActionComplete").delay(3e3).fadeOut(1e3,function(){$(this).remove()})}})();(function(){var a="\t\t\t<div class='editor-container'>\t\t\t\t<div class='editor-label'>Is Active:</div>\t\t\t\t<div class='editor-field'>\t\t\t\t\t<span class='user-widget-status-label'></span>\t\t\t\t</div>\t\t\t</div>\t\t\t<div class='editor-buttons'>\t\t\t\t<a href='#' class='change-status-button nav-button page-change-link'>set this value in code</a>\t\t\t</div>\t";$.widget("ui.UserStatus",{options:{userId:null,activeButtonText:null,inactiveButtonText:null},_create:function(){var a=this;$.post(actionUrl("Security/UserStatus/Json"),{id:a.options.userId},function(b){a._receiveModel(b)},"json")},_receiveModel:function(b){if(b==null){$.event.trigger("UserStatusNew");return}!b.IsActive&&$.event.trigger("UserStatusInactive");var c=this,d=b.IsActive?c.options.inactiveButtonText:c.options.activeButtonText;c.options.currentValue=b.IsActive;this.element.empty().append(a);this.element.find(".user-widget-status-label").text(b.IsActive);this.element.find(".change-status-button").text(d).bind("pageChangeClick",function(){c._onChangeStatusClicked();return false})},_onChangeStatusClicked:function(){var a=this;$.post(actionUrl("Security/UserStatus/ChangeStatus"),{id:a.options.userId,status:!a.options.currentValue},function(){a.options.currentValue=!a.options.currentValue;a.element.find(".user-widget-status-label").text(a.options.currentValue);var b=a.element.find(".change-status-button"),c=b.text();if(c==a.options.activeButtonText)b.text(a.options.inactiveButtonText);else b.text(a.options.activeButtonText);$.event.trigger("UserStatusChanged")},"json")},destroy:function(){this.element.empty()}})})();window.Shared=window.Shared||{};window.Shared.UsageCheckAndProcessing=function(){var a,i={InactivateOrDeleteIfAllowed:function(b){a=b;d(b.id,b.type,c)}};function d(i,h,d){var c="";switch(h){case b.AccountCode:c=actionUrl("GrantProcessing/AccountCodeUsage/CheckIfDeleteIsAllowed");break;case b.BudgetCategory:c=actionUrl("Budgets/BudgetCategoryUsage/CheckIfDeleteIsAllowed");break;case b.Contractor:c=actionUrl("Contractors/ContractorUsage/CheckIfDeleteIsAllowed");break;case b.SpeedChart:c=actionUrl("GrantProcessing/SpeedCharts/CheckIfDeleteIsAllowed")}var g={id:a.id},f={id:a.id,callback:d};$.post(c,g,function(a){e(f,a)},"json")}function e(b,a){b.callback(a.length==0?null:a)}function c(b){if(b){if(!confirm("Removal of this "+a.textToDisplay+" is not allowed because it is in use.\r\nWould you like to inactivate it instead?"))return;h(a.tr,false);return}j(a.tr)}function h(g,d){if(d)if(!confirm("Are you sure you want to inactivate this "+a.textToDisplay+"?"))return;var c;switch(a.type){case b.AccountCode:c=actionUrl("GrantProcessing/AccountCodeGrid/Inactivate");break;case b.BudgetCategory:c=actionUrl("Budgets/BudgetCategoryGrid/Inactivate");break;case b.Contractor:c=actionUrl("Contractors/ContractorGrid/Inactivate");break;case b.SpeedChart:c=actionUrl("GrantProcessing/SpeedCharts/Inactivate")}var e={id:a.id};$.post(c,e,f,"json")}function f(){var b=a.tr.closest(".grid-table");a.tr.find(".is-active").text("False");var c=b[0].config.sortList;b.trigger("update");b.trigger("sorton",[c]);b.trigger("rowsChanged");Toast.AddActionCompleteMessage(a.textToDisplay+" inactivated.")}function j(){if(!confirm("Are you sure you want to delete this "+a.textToDisplay+"?"))return;deleteRow=true;var c;switch(a.type){case b.AccountCode:c=actionUrl("GrantProcessing/AccountCodeGrid/Delete");break;case b.BudgetCategory:c=actionUrl("Budgets/BudgetCategoryGrid/Delete");break;case b.Contractor:c=actionUrl("Contractors/ContractorGrid/Delete");break;case b.SpeedChart:c=actionUrl("GrantProcessing/SpeedCharts/Delete")}var d={id:a.id};$.post(c,d,g,"json")}function g(){var b=a.tr.closest(".grid-table");a.tr.remove();b.trigger("update");b.trigger("rowsChanged");Toast.AddActionCompleteMessage(a.textToDisplay+" deleted.")}var b={AccountCode:"AccountCode",BudgetCategory:"BudgetCategory",Contractor:"Contractor",SpeedChart:"SpeedChart"};return i}();(function(){window.GrantProcessing=window.GrantProcessing||{};window.GrantProcessing.GrantDropDown={FillSelectForReceipts:function(c,b){$.post(actionUrl("GrantProcessing/GrantDropDown/ForReceiptsJson"),{},function(d){a(c,d);b&&b()},"json")},FillSelect:function(c,d,b){$.post(actionUrl("GrantProcessing/GrantDropDown/Json"),{programId:d},function(d){a(c,d);b&&b()},"json")}};function a(a,b){$.each(b,function(c,b){a.append($("<option>").attr("value",b.Value).text(b.Text))})}})();(function(){window.Budgets=window.Budgets||{};window.Budgets.ObligationSelector={$grantSelector:null,$contractorSelector:null,$vendorNoLabel:null,$departmentNoLabel:null,$activityNoLabel:null,_obligations:null,$obligationTypeSelector:null,$poContainer:null,$poNumberSelector:null,$obligationIdField:null,$accountCodeLabel:null,$accountCodeSelector:null,$divisionLabel:null,_hasBeenInitialized:null,$obligationIdField:null,_initializedObligationId:null,$grantIdField:null,_initializedGrantId:null,Init:function(b,d,c,e){$grantSelector=$("#Grant");$contractorSelector=$("#ContractorId");$vendorNoLabel=$("#ContractorVendorNumber");$departmentNoLabel=$("#ContractorDepartmentNumber");$activityNoLabel=$("#ContractorActivityNumber");$obligationTypeSelector=$("#ObligationType");$poContainer=$("#PurchaseOrderNumberContainer");$poNumberSelector=$("#PurchaseOrderNumber");$accountCodeLabel=$("#AccountCode");$accountCodeSelector=$("#AccountCodeId");$divisionLabel=$("#Division");this._hasBeenInitialized=false;$obligationIdField=$("#"+b);this._initializedObligationId=d;$grantIdField=$("#"+c);this._initializedGrantId=e;var a=this;$grantSelector.change(function(){a._FillContractorSelector()});$contractorSelector.change(function(){a._FillContractorInfo();a._FillObligationTypes()});$obligationTypeSelector.change(function(){a._FillPurchaseOrderNumbersOrAccountCodes()});$poNumberSelector.change(function(){a._FillObligationInfo();a.ObligationSelectionChanged($poNumberSelector.val())});$accountCodeSelector.change(function(){a._FillObligationInfo();a.ObligationSelectionChanged($accountCodeSelector.val())});GrantProcessing.GrantDropDown.FillSelectForReceipts($grantSelector,a._FillContractorSelector)},_FillContractorSelector:function(){!Budgets.ObligationSelector._hasBeenInitialized&&Budgets.ObligationSelector._initializedGrantId&&$grantSelector.val(Budgets.ObligationSelector._initializedGrantId);var a=$grantSelector.val();if(a==null)return;$grantIdField.val(a);$.post(actionUrl("Budgets/ObligationSelector/GetObligationsJson"),{grantId:a},b,"json");function b(b){Budgets.ObligationSelector._obligations=b;var a=Budgets.ObligationSelector._GetDistinctContractorObligations();$contractorSelector.empty();if(a.length>0){$.each(a,function(b,a){$contractorSelector.append($("<option>").attr("value",a.ContractorId).text(a.ContractorName))});Budgets.ObligationSelector._FillContractorInfo();Budgets.ObligationSelector._FillObligationTypes();if(!Budgets.ObligationSelector._hasBeenInitialized&&Budgets.ObligationSelector._initializedObligationId){Budgets.ObligationSelector._SelectObligation(Budgets.ObligationSelector._initializedObligationId);$(".obligation-selector").readonly();Budgets.ObligationSelector._hasBeenInitialized=true}}else{Budgets.ObligationSelector._ClearContractorInfo();$obligationTypeSelector.empty();$obligationTypeSelector.change();$poNumberSelector.empty();$poNumberSelector.change();$accountCodeSelector.empty();$accountCodeSelector.change()}}},_GetDistinctContractorObligations:function(){var b=[],a=[];$.each(this._obligations,function(d,c){if($.inArray(c.ContractorId,b)==-1){a.push(c);b.push(c.ContractorId)}});return a},_SelectObligation:function(b){var a=this._GetObligation(b);$contractorSelector.val(a.ContractorId);$contractorSelector.change();$obligationTypeSelector.val(a.ObligationType);$obligationTypeSelector.change();if(this._IsPurchaseOrderType()){$poNumberSelector.val(a.ObligationId);$poNumberSelector.change()}else{$accountCodeSelector.val(a.ObligationId);$accountCodeSelector.change()}},_GetObligations:function(e,c){var a=[];if(e){var f=$contractorSelector.val();$.each(this._obligations,function(c,b){b.ContractorId==f&&a.push(b)})}if(c){var d=$obligationTypeSelector.val(),b=[];$.each(a,function(c,a){a.ObligationType==d&&b.push(a)});a=b}return a},_GetSelectedObligation:function(){return this._GetObligation($obligationIdField.val())},_GetObligation:function(b){var a=null;$.each(this._obligations,function(d,c){if(c.ObligationId==b){a=c;return false}});return a},_FillContractorInfo:function(){var b=this._GetObligations(true,false),a=b[0];$vendorNoLabel.text("Vendor No: "+a.ContractorVendorNumber);$departmentNoLabel.text("Department No: "+a.ContractorDepartmentNumber);$activityNoLabel.text("Activity No: "+a.ContractorActivityNumber)},_ClearContractorInfo:function(){$vendorNoLabel.text("Vendor No: ");$departmentNoLabel.text("Department No: ");$activityNoLabel.text("Activity No: ")},_FillObligationTypes:function(){for(var b=this._GetObligations(true,false),d=false,c=false,a=0;a<b.length;a++){if(b[a].ObligationType==0)d=true;if(b[a].ObligationType==1)c=true}$obligationTypeSelector.empty();d&&$obligationTypeSelector.append($("<option>").attr("value",0).text("Purchase Order"));c&&$obligationTypeSelector.append($("<option>").attr("value",1).text("Non-Purchase Order"));this._FillPurchaseOrderNumbersOrAccountCodes()},_IsPurchaseOrderType:function(){var a=$obligationTypeSelector.val();return a==0},_FillPurchaseOrderNumbersOrAccountCodes:function(){var c=this._GetObligations(true,true),a=null,b=this._IsPurchaseOrderType();if(b){$poContainer.show();a=$poNumberSelector;$accountCodeSelector.hide();$accountCodeLabel.show()}else{$poContainer.hide();a=$accountCodeSelector;$accountCodeSelector.show();$accountCodeLabel.hide()}a.empty();$.each(c,function(d,c){a.append($("<option>").attr("value",c.ObligationId).text(b?c.PurchaseOrderNumber:c.AccountCodeDisplayText))});this._FillObligationInfo()},_FillObligationInfo:function(){var b=this._IsPurchaseOrderType(),c=b?$poNumberSelector.val():$accountCodeSelector.val();$obligationIdField.val(c);this.ObligationSelectionChanged(c);var a=this._GetSelectedObligation();b&&$accountCodeLabel.text(a==null?"":a.AccountCodeDisplayText);$divisionLabel.text(a==null?"":a.Division)},ObligationSelectionChanged:function(){}}})();function GetValue(a){var b=a.toString().indexOf("(")>-1&&a.toString().indexOf(")")>-1,c=a.toString().replace(/[%$,\(\)]+/g,"");return Number((Number(c)*(b?-1:1)).toFixed(2))}function FormatCurrency(b,a){var c=GetValue(b)!==Math.abs(GetValue(b));if(c===true){a.text(GetValue(b)*-1);a.format({format:"($#,###.00)"})}else{a.text(GetValue(b));a.format({format:"$#,###.00"})}}function FormatPercentage(a,b){var c=a!==Math.abs(a);if(c===true){b.text(a*-1);b.format({format:"(#.00%)"})}else{a=a.toFixed(4);b.text(a);b.format({format:"#.00%"})}}function ParseElementValue(a){var b,c=a.is("input")?a:a.find("input");if(c.length===0)b=a.text();else b=c.val();return GetValue(b)}function ColumnTotal(b){var a=0;$.each($(b),function(){a+=ParseElementValue($(this))});return Math.round(a*100)/100}(function(a){a.Trim=function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")};a.ParseJsonDate=function(a){return new Date(parseInt(a.substr(6)))};a.FormatShortDate=function(b){return a.Pad(b.getMonth()+1,2)+"/"+a.Pad(b.getDate(),2)+"/"+b.getFullYear()};a.Pad=function(c,d,b){var a=c.toString();if(!b)b="0";while(a.length<d)a=b+a;return a};a.isNumeric=function(b){return!a.isArray(b)&&b-parseFloat(b)+1>=0}})(jQuery);(function(){window.SessionAlert={InitializeTimeout:c,ResetTimeout:r};var q={timeoutInSeconds:1200,gracePeriodInSeconds:300},a,h,i;function c(b){if(s())return;a=$.extend({},q);b!==undefined&&$.extend(a,b);$alertTime=$("#session-alert-remaining-time");$sessionAlertDialog=$("#session-alert");h=new Date;var c=(a.timeoutInSeconds-a.gracePeriodInSeconds)*1e3;i=setTimeout(n,c)}function r(){clearTimeout(i);c()}function s(){return window.location.pathname.toLowerCase().indexOf("security/loginform/loginform")!=-1}var b=false,e,d;function n(){if(k()<1){j();return}d=new Date;$sessionAlertDialog.dialog({resizable:false,height:200,width:600,modal:true,open:function(){g();e=setInterval(g,250);$(this).parent("div").find('button:contains("Extend Session")').focus()},close:function(){if(b)j();else p();clearInterval(e);$sessionAlertDialog.dialog("destroy")},buttons:{"Log Out":function(){b=true;$(this).dialog("close")},"Extend Session":function(){b=false;$(this).dialog("close")}}})}function m(b){var c=Math.floor(b/60),a=b-c*60;a=a<10?"0"+a:a;return c+":"+a}function l(){return f(d,a.gracePeriodInSeconds)}function k(){return f(h,a.timeoutInSeconds)}function f(e,d){var a=+new Date-e.getTime(),c=a/1e3,b=d-c;return Math.floor(b)}function g(){var a=l();if(a<0){b=true;$sessionAlertDialog.dialog("close");return}o(a)}function o(a){var b=m(a);$alertTime.text(b)}function j(){window.onbeforeunload=undefined;window.location=actionUrl("Security/LogoutControl/Logout")}function p(){keepAlive();c(a)}})();function IsBrowserIncompatible(){var a=$.browser,b=parseInt(a.version.split(".")[0]);return a.mozilla&&b<9||a.msie&&b<9||a.webkit&&b<18}