/* 
 * DasÖrtliche Javascript Library
 * Copyright (C) 2008 TENSQUARE gmbh
 */
if(!$oe$||!$||!$oe$.ui){throw new Error("Core libs missing");}(function(){var A=$oe$.getNamespace("competencebox");DEFAULT_CB_OPTIONS={expandDelay:800};function B(M,J){var L=this;M=$oe$.obj.extend(M||{},DEFAULT_CB_OPTIONS);var G=null;var J=J;var F={};this.timerId=1;function K(P){clearTimeout(L.timerId);L.timerId=false;F.waitFor=P;var O={idx:P[0].itemIdx,filled:P[0].filled,lifeTime:new Date().getTime()-P[0].lifeTime};if($oe$.val.isFunction(J)){var N=J(P,O);if(N){F.waitFor=null;}return N;}return true;}this.bindEvents=function(){G=$("#inner_local_compbox");if(G.length==0){$oe$.log("bindEvents: failed - missing 'inner_local_compbox'");return ;}G=$(G[0]);var P={header:"a.head_compbox",active:".active",collapsible:true,onClick:K.getBinding(L),icons:{header:"",headerSelected:"selected"}};G.accordion(P);var N=G.children("a.head_compbox");for(var O=0;O<N.length;O++){var Q=N[O];Q.itemIdx=O;Q.filled=C($(Q)).trim()!="";Q.lifeTime=new Date().getTime();$(Q).bind("mouseenter",L,D);$(Q).bind("mouseleave",L,I);}};function D(N){$oe$.log("MouseEnter: ItemIdx="+this.itemIdx);clearTimeout(L.timerId);L.timerId=false;if(!L.timerId){L.timerId=E.getBinding(L).callDelayed(M.expandDelay,this);}}function I(N){$oe$.log("MouseLeave: ItemIdx="+this.itemIdx);if(L.timerId){clearTimeout(L.timerId);L.timerId=false;}}function E(N){G.accordion("activate",N);clearTimeout(L.timerId);}this.active=function(P,O,N){if(O!=""){H(P,O,N);}if(F.waitFor){if(F.waitFor[0].itemIdx===P[0].itemIdx){return ;}}F.waitFor=null;G.accordion("activate",P,true);};function H(P,O,N){P[0].filled=(O!="");if(!P[0].filled){return ;}P.next(".cb_content").html(O);P.find(".head_content").html(N);P[0].lifeTime=new Date().getTime();}function C(N){return(N.next(".cb_content").html()?N.next(".cb_content").html():"");}}A.CompetenceBoxHandler=B;}());