
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - ui-tabcontainer.js - */
// http://www.clearspring.com/docs/portal_javascripts/ui-tabcontainer.js?original=1
(function(){var set=function(v,def){return(v!==undefined?v:def)};window.CS=set(window.CS,{});CS.UI=set(CS.UI,{});CS.UI.TABCONTAINER=function(parent_id,tab_names,container_ids,options){if(!parent_id||!tab_names){throw new Error("CS.UI.TABCONTAINER: parent_id and tab_ids required!")}
if(!$(parent_id)){throw new Error("CS.UI.TABCONTAINER: parent_id is not a valid element!")}
if(!is_a(tab_names,Array)){throw new TypeError("CS.UI.TABCONTAINER: tab_names must be an array!")}
container_ids=(is_a(container_ids,Array)?container_ids:$A());this.options=(is_a(options,Object)?options:{});this.parent_id=parent_id;var container_id=unique_id("tabcontainer");$(parent_id).innerHTML+='<div id="'+container_id+'" style="display:none;" class="tabscontainer"></div>';this.container=$(container_id);var tab_str="";this.tab_ids=$A();var tabcontent_str="";this.tab_ids=$A(tab_names).map((function(tab,idx){var container_id=this.container.id;var tab_id=container_id+"_tab"+idx;tab_str+='<li id="'+tab_id+'" class="tab"><a>'+tab+'</a></li>';var tabcontent_id=container_id+"_tabcontainer"+idx;tabcontent_str+='<div id="'+tabcontent_id+'" class="tabcontent-container"></div>\n';return{tabcontent_id:tabcontent_id,tab_id:tab_id}}).bind(this));var tabcontent_containers_class=(this.options.hasBorder?'tabcontent-containers border':'tabcontent-containers');this.container.innerHTML='<div class="tabs"><ul class="tabnav">'+tab_str+'</ul></div>'+'<div class="'+tabcontent_containers_class+'">\n'+tabcontent_str+'\n</div>';this.tabs=this.tab_ids.map((function(container_ids,pair,idx){var tab=$(pair.tab_id);var tabcontent=$(pair.tabcontent_id);Object.extend(tab,tab_methods);tab.observe("click",tab_listener.bindAsEventListener(this,tab,this.container));if(is_a(this.options.onClick,Function)){tab.observe("click",this.options.onClick.bindAsEventListener(this,tab,this.container))}
tab._tabcontent=tabcontent;tab._tabcontainer=this.container;var content=$(container_ids[idx]);if(!content){return{tab:tab,tabcontent:tabcontent}}
tabcontent.appendChild(content);return{tab:tab,tabcontent:tabcontent}}).bind(this,container_ids));this.activate_tab=(function(index){this.tabs[index].tab.activate()}).bind(this);this.container.show();activate_tab_by_element(this.tabs[0].tab,this.container)};var tab_methods={activate: function(){activate_tab_by_element(this,this._tabcontainer)}};var tab_listener=function(evt,tab_element,owning_container){activate_tab_by_element(tab_element,owning_container)};var activate_tab_by_element=function(tab_element,owning_container){var parent=owning_container.parentNode;parent.getElementsBySelector("#"+owning_container.id+" > div.tabs li.tab").invoke("removeClassName","active");parent.getElementsBySelector("#"+owning_container.id+" > div.tabcontent-containers > div.tabcontent-container['display'!='none']").invoke("hide");tab_element._tabcontent.show();tab_element.addClassName("active")};var unique_id=function(stem){var id,i=0;while(document.getElementById((id=stem+String(i++)))!==null){}
return id};var get_instance=function(o){switch(typeof(o)){case "string":return new String(o);case "number":return new Number(o);case "boolean":return new Boolean(o);case "undefined":case "function":case "object":default:return o}};var type=function(o){switch(typeof(o)){case "undefined":return undefined;case "string":return String;case "number":return Number;case "boolean":return Boolean;case "function":case "object":default:var types=_known_types;for(var i=0;i<types.length;i++){if(o instanceof types[i]){return types[i]}}
if(o instanceof Object){return Object}
return null}};var _known_types=[Function,Array,RegExp,Date,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError];var is_a=function(o,type){return((o instanceof Object)?o instanceof type:get_instance(o) instanceof type)}})();

/* - plone-tabloader.js - */
// http://www.clearspring.com/docs/portal_javascripts/plone-tabloader.js?original=1
Event.observe(window,"load",(function(){var tabcontainer_selector=".make.tabcontainer";var global_options={hasBorder:true};var unique_id=function(stem){var id,i=0;while(document.getElementById((id=stem+String(i++)))){}
return id};var inferTabcontainer=function(options,parent){var parent_id=parent.id;var ids=$$("#"+parent_id+" > div").map((function(parent_id,tab_div,idx){var tabname_element=tab_div.down(".tabname");var tabname="Tab "+idx;if(tabname_element){tabname=(tabname_element.textContent||tabname_element.innerText);tabname_element.remove()}
var container_id=tab_div.readAttribute("id")||unique_id(parent_id+"_tabcontent");tab_div.setAttribute("id",container_id);return{tab_name:tabname,container_id:container_id}}).bind(this,parent_id));var tab_names=ids.pluck("tab_name");var container_ids=ids.pluck("container_id");$(parent_id).removeClassName("make");return new CS.UI.TABCONTAINER(parent_id,tab_names,container_ids,options)};$$(tabcontainer_selector).each(inferTabcontainer.bind(this,global_options))}));
