(function(d){var b=d.telerik;var c=3;var a=0;b.grouping={};b.grouping.initialize=function(f){d.extend(f,b.grouping.implementation);f.$groupDropCue=d('
');f.$groupHeader=d("> .t-grouping-header",f.element);function h(){var k=d.map(f.$groupHeader.find(".t-group-indicator"),function(l){var m=d(l);var n=m.offset().left;var o=m.outerWidth();return{left:n,right:n+o,width:o,$group:m}});return{first:k[0],all:k,last:k[k.length-1]}}function g(r){var m=r.$cue.text();if(!d.contains(f.element,r.target)||!d(r.target).closest(".t-grouping-header").length||(f.groupFromTitle(m)&&r.$draggable.closest(".t-header").length)){f.$groupDropCue.remove();return}var n=d("> .t-grid-toolbar",f.element).outerHeight()+c;var o=h();if(!o.all.length){f.$groupDropCue.css({top:n,left:a}).appendTo(f.$groupHeader);return}var q=o.first;var s=o.last;var l=parseInt(q.$group.css("marginLeft"));var k=parseInt(q.$group.css("marginRight"));var p=d.grep(o.all,function(t){return r.pageX>=t.left-l-k&&r.pageX<=t.right})[0];if(!p&&q&&r.pageX=0){f.groups.splice(d.inArray(m,f.groups),1);f.groups.splice(o,0,m)}f.groupBy=d.map(f.groups,function(q){return q.member+"-"+q.order}).join("~");if(this.isAjax()){var p=this.$groupHeader.find('div:contains("'+l+'")');if(p.length==0){var k=new d.telerik.stringBuilder().cat('").string();p=d(k).appendTo(this.$groupHeader)}if(this.$groupDropCue.is(":visible")){p.insertBefore(this.$groupDropCue)}p.find(".t-link .t-icon").toggleClass("t-arrow-up-small",m.order=="asc").toggleClass("t-arrow-down-small",m.order=="desc").html("("+(m.order=="asc"?f.localization.sortedAsc:f.localization.sortedDesc)+")");this.ajaxRequest()}else{this.serverRequest()}};f.unGroup=function(l){var k=f.groupFromTitle(l);f.groups.splice(d.inArray(k,f.groups),1);if(f.groups.length==0){f.$groupHeader.html(f.localization.groupHint)}f.groupBy=d.map(f.groups,function(m){return m.member+"-"+m.order}).join("~");if(f.isAjax()){f.$groupHeader.find('div:contains("'+k.title+'")').remove();f.ajaxRequest()}else{f.serverRequest()}},f.normalizeColumns=function(n){var o=f.groups.length;var m=n-f.$tbody.parent().find(" > colgroup > col").length;if(m==0){return}var p=f.$tbody.parent().add(f.$headerWrap.find("table")).add(f.$footer.find("table"));if(d.browser.msie){if(m>0){d(new b.stringBuilder().rep('',m).string()).prependTo(p.find("colgroup"));d(new b.stringBuilder().rep('',m).string()).insertBefore(p.find("th.t-header:first"));d(new b.stringBuilder().rep(' | ',m).string()).insertBefore(p.find("tr.t-footer-template > td:first"))}else{p.find("th:lt("+Math.abs(m)+"), tr.t-footer-template > td:lt("+Math.abs(m)+")").remove().end().find("col:lt("+Math.abs(m)+")").remove()}var k=[];var l=0;d("table, .t-grid-bottom",f.element).each(function(){k.push(this.parentNode)}).appendTo(d("")).each(function(){k[l++].appendChild(this)})}else{p.find("col.t-group-col").remove();d(new b.stringBuilder().rep('',o).string()).prependTo(p.find("colgroup"));p.find("th.t-group-cell").remove();p.find("tr.t-footer-template > td.t-group-cell").remove();d(new b.stringBuilder().rep('',o).string()).insertBefore(p.find("th.t-header:first"));d(new b.stringBuilder().rep(' | ',o).string()).insertBefore(p.find("tr.t-footer-template > td:first"))}},f.bindGroup=function(n,r,q,p){var o=f.groups[p];var t=n.Key;var m=d.grep(f.columns,function(l){return o.member==l.member})[0];if(m&&(m.format||m.type=="Date")){t=b.formatString(m.format||"{0:G}",t)}q.cat('').rep(' | ',p).cat('');if(m){q.cat(m.groupHeader(d.extend({Title:o.title,Key:t},n.Aggregates[m.member])))}else{q.cat(o.title+": "+t)}q.cat(" |
");if(n.HasSubgroups){for(var k=0,s=n.Items.length;k