(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window).scrollable()};c.fn.scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this.scrollable().each(function(){var m=this,k=c(m),l=f,j,h={},n=k.is("html,body");switch(typeof l){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(l)){l=b(l);break}l=c(l,this);case"object":if(l.is||l.style){j=(l=c(l)).offset()}}c.each(d.axis.split(""),function(r,s){var t=s=="x"?"Left":"Top",u=t.toLowerCase(),q="scroll"+t,o=m[q],p=s=="x"?"Width":"Height";if(j){h[q]=j[u]+(n?0:o-k.offset()[u]);if(d.margin){h[q]-=parseInt(l.css("margin"+t))||0;h[q]-=parseInt(l.css("border"+t+"Width"))||0}h[q]+=d.offset[u]||0;if(d.over[u]){h[q]+=l[p.toLowerCase()]()*d.over[u]}}else{h[q]=l[u]}if(/^\d+$/.test(h[q])){h[q]=h[q]<=0?0:Math.min(h[q],g(p))}if(!r&&d.queue){if(o!=h[q]){i(d.onAfterFirst)}delete h[q]}});i(d.onAfter);function i(o){k.animate(h,e,d.easing,o&&function(){o.call(this,f,d)})}function g(s){var p="scroll"+s;if(!n){return m[p]}var r="client"+s,q=m.ownerDocument.documentElement,o=m.ownerDocument.body;return Math.max(q[p],o[p])-Math.min(q[r],o[r])}}).end()};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);
;
jive.gui.SpaceBrowserGui=function(g,l,n,e,k,p,c,v){var f=this;var w=$j("#jive-space-slider_"+l);var y=w.find(".jive-spaces-container");var b;var h=jive.rest.url("/places/search/");v.addListener(f);function m(z){var A=158.25;var C=0.75;var B=A+(z.width()*C);w.scrollTo(z,B);b=z}function j(){w.scrollTo(0);b=null}$j(".space-browser-spaces-tree div.jive-accordion-content").show();if(k=="small"){$j(".space-browser-spaces-search h4").addClass("jive-accordion-toggle-active");$j(".space-browser-spaces-search").show()}$j("#jive-accordion-container_"+l).each(function(){$j(this).find(".jive-accordion h4").click(function(){if($j(this).hasClass("jive-accordion-toggle-active")){if($j(this).parents(".jive-icon-spaces-spaces")){j()}}});$j(this).find(".jive-accordion-content").find(".space-browser-scrollable_"+l).scroll(function(){f.scroller($j(this))})});var t=function(){$j("#container-search-input_"+l).val("");$j("#space-browser-search-results_"+l).hide();w.show();if(k=="large"){$j("#content-block-title").html(n.get("global.communities"));$j("#content-block-search-clear").attr("disabled",true)}return false};var q=function(){var z=$j("#container-search-input_"+l).val();if(z.length>1){w.hide();$j("#jive-search-loading_"+l).show();$j("#space-browser-search-results_"+l).hide();var A={allowedContainerIds:$j("#allowedContainerIds").val(),resultFilterBeanName:$j("#resultFilterBeanName").val(),rootContainerID:$j("#rootContainerID").val(),rootContainerType:$j("#rootContainerType").val(),showDescription:$j("#showDescription").val()};$j.getJSON(h+z,A,function(B){var C=new JiveContainerAutoComplete(z,$j("#resultFilterBeanName").val(),$j("#allowedContainerIds").val(),$j("#rootContainerID").val(),$j("#rootContainerType").val(),"#places_search_"+l,"","false",n.get("widget.places.noresults.text"));C.clearPlaces();C.loadExternalPlaces(B);$j("#jive-search-loading_"+l).hide();$j("#space-browser-search-results_"+l).show();if(k=="large"){$j("#content-block-title").html(n.get("global.search.results"));$j("#content-block-search-clear").attr("disabled",false)}})}if(z.length<1){t()}};$j("#container-search-input_"+l).delayedObserver(q,0.5);$j("#container-search-input_"+l).keypress(function(A){var z=A.which||A.keyCode;if(z===jive.Event.KEY_RETURN){q();A.preventDefault()}});$j("#clearsearch_"+l).click(t);if(k=="large"){$j("#content-block-search-clear").click(t)}w.width(w.parent().width());y.children().width(w.width());$j(window).bind("resize",function(){if(w.parent().length>0){w.width(w.parent().width());y.children().width(w.width());if(b){w.scrollTo(b)}}});this.loadPlaces=function(z){if("COMMUNITY"!=z.name){return}f.populateContainers(z)};this.beginLoadingPlaces=function(){};this.doneLoadingPlaces=function(C,D){var z=v.getPlaces(C.type);var A=z.slice(D,z.length);var B;if(C.communityID<=1||C.communityID==c){B=$j("#COMMUNITY_list_"+l);f.populateSpaces(A,B)}else{B=$j("#places-spaces-list_"+l+"_"+C.communityID);f.populateSpaces(A,B)}if(C.slide&&C.widgetID==l){m(B.closest("div"))}};this.loadingPlacesFailed=function(){};this.populateContainers=function i(A){var z=v.getPlaces(A);if(!z||z.length===0){$j("#COMMUNITY_list_"+l).append('<li><p class="empty">'+n.get(A.name)+"</p></li>")}else{f.populateSpaces(v.getPlaces(A),$j("#COMMUNITY_list_"+l))}};function s(){var A=y.width(),z=w.width(),B=(y.children().length+1)*z;if(B>=A){y.width(B*2)}}function o(D,B){D.nextAll().remove();s();var E=$j("<div class='jive-slider-sub' id='slider-sub_"+l+"_"+B.ID+"'></div>");E.width(w.width());y.append(E);var z;if(k=="large"){z=$j("<span class='jive-space-current'></span>")}else{z=$j("<span class='jive-space-current'><strong>"+B.name+"</strong></span>")}var A=$j("<a href='#' class='jive-slider-link jive-slider-link-back' title='Back'>Back to <strong>"+B.name+"</strong></a>");A.click(function(){m(E.prev());return false});if(k=="large"){E.append(A)}else{z.append(A);E.append(z)}var C=$j("<ul id='places-spaces-list_"+l+"_"+B.ID+"' class='j-place-list clearfix'></ul>");E.append(C);C.scroll(function(){f.scroller($j(this))});v.morePlaces({type:B.type,page:0,communityID:B.ID,parentID:B.parentID,slide:true,widgetID:l})}this.populateSpaces=function a(z,C){var E,A,D,B,F;for(E=0;E<z.length;E++){A=z[E];if(C.find("#place-space-list-entry_"+l+"_"+A.ID).length>0){return false}D=$j("<li id='place-space-list-entry_"+l+"_"+A.ID+"' class='place-space-list-entry clearfix'></li>");D.append(f.createObjectLink(A));if(A.parent=="true"||A.parent===true){if(k=="large"){B=n.get("view.subspaces")}else{B="&raquo;"}F=$j("<a href='#' class='jive-slider-link' id='jive-slider-link_"+A.id+"' title='View sub-spaces in "+A.name+"'>"+B+"</a>");F.bind("click",A,function(H){var G=H.data;var I=w.find("#slider-sub_"+l+"_"+G.ID);if(I.length>0){m(I);return false}else{o(C.parent(),G);return false}});D.append(F)}C.append(D);if(k=="large"){C.removeClass("jive-striped");C.find("li:even").addClass("jive-striped")}}};this.addListEntries=function d(z,B){for(var D=0;D<z.length;D++){var A=z[D];var C=$j("<li></li>");C.append(f.createObjectLink(A));B.append(C)}};this.createObjectLink=function r(A){var z;if(A.disabledPlace=="true"){z=$j("<span></span>")}else{var B=p=="true"?"jivecontainerTT-hover-container":"";var E=k=="large"?" no-underline":"";if(A.onClickJs&&A.onClickJs.length>0){z=$j("<a href='#' class='"+B+E+"' onclick='"+A.onClickJs+"'); return false;'></a>")}else{z=$j("<a href='"+A.objectURL+"' class='"+B+E+"'></a>")}}var D=$j("<span class='jive-places-name'></span>");D.text(A.name);var F=$j("<span class='"+A.iconCssClass+"'></span>");z.append(F);z.append(D);if(p=="true"){z.bind("mouseover",A,function(H){var G=H.data;quickcontainersummary.getContainerTooltip(G.ID,G.objectType)});z.mouseout(function(){quickcontainersummary.cancelTooltip()})}if(k=="large"&&A.description!=null){var C=$j("<span class='jive-description'>"+A.description+"</span>");return $j.merge(z,C)}else{return z}};this.scroller=function u(B){if(B[0].scrollHeight-B.scrollTop()==B.outerHeight()){var D=B.find("li").length;if(D%30===0){var z=B.attr("id");var C=z.split("_")[0];var A=c;if(B.parent().attr("id").match(/^slider-sub_/)){A=B.parent().attr("id").split("_")[2];C="COMMUNITY"}var E=D/30;v.morePlaces({type:{name:C},page:E,communityID:A,parentID:c})}}};this.resetPlaces=function x(z){}};
;

