var application_tabs=new Class({str_tab_home_id:"tab_home",str_selector_tab_trigger:".authenticated #application_tab_triggers .tab_item, .authenticated #tab_home",str_selector_tab_trigger_active:".authenticated #application_tab_triggers .tab.active",str_selector_tab_content:".authenticated #application_tab_content > div",str_iframe_url_attribute:"title",initialize:function(){var D=$(document.body).getElement(this.str_selector_tab_trigger_active);if(D&&D.hasClass("tab_item_page")&&D.get("id")!=this.str_tab_home_id){return }var F=$(document.body).getElements(this.str_selector_tab_trigger);var A=new Array();for(var C=0;C<F.length;C++){if(!F[C].hasClass("not-authorised")){A.push(F[C])}}if(A.length==0){return }$$(A).addEvent("click",this._event_tab_click.bindWithEvent(this));var B=new String(window.location.hash).replace(/#/,"");if(B){var E=$("tab_"+B)}if(!E){var E=$(document.body).getElement(this.str_selector_tab_trigger_active)||A[0]}this.switch_tab(E.removeClass("active").get("id"))},_event_tab_click:function(A){var C=null;var B=$(A.target);C=B.get("id");if(!C){C=B.getParent().get("id")}A.preventDefault();this.switch_tab(C)},switch_tab:function(D){if($(D).hasClass("active")){return }$(document.body).getElements(this.str_selector_tab_content).setStyle("display","none");var C=$(document.body).getElement(this.str_selector_tab_content+"."+D+"_content");if(C){C.setStyle("display","block")}$(document.body).getElements(this.str_selector_tab_trigger).removeClass("active");$(D).addClass("active");var E=$(D).getProperty(this.str_iframe_url_attribute);if(C){this._activate_iframes(C,E)}if(D!="tab_home"){var A=D.replace(/tab_/,"");window.location.hash=A;var B=$(document).getElement("body").get("id");B=B.replace(/page_/,"");B=B.replace(/_index/,"");new Request({url:"/utility/log",method:"get",data:{context:B,key:A}}).send()}else{if(window.location.hash!=""){window.location.hash="#"}}},_activate_iframes:function(F,E){if(F.hasClass("iframe-checked")){return }var B=F.getElements("iframe");for(var D=0,C=B.length;D<C;D++){var A=B[D];if(E){A.setProperty("src",E)}}F.addClass("iframe-checked")}});