    function show_hide(obj){
         if (obj.style.display=="none") obj.style.display="block";
         else obj.style.display="none";
    }

  function toggle_class(obj,string1,string2){
    x=obj.className.match(string1);
     if(obj.className.match(string1)){
     obj.className =obj.className.replace(string1,string2);
     }
     else obj.className =obj.className.replace(string2,string1);
    }


function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all :
        oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }
    }
    return (arrReturnElements)
}


   function expand_behaviour(){
     controluri=getElementsByClassName(document,'h3','control');
     if(controluri.length) {
     for (i=0;i<controluri.length;i++){
	addEvent(controluri[i], 'mouseover', function(){
		if (!this.className.match("iehover")) this.className+=" iehover";
       });

	addEvent(controluri[i], 'mouseout', function(){
		toggle_class(this,"iehover","");
       });

       addEvent(controluri[i], 'click', function(){
       if (this.nextSibling.nodeType!=3){
        de_controlat=this.nextSibling;
        }
        else de_controlat=this.nextSibling.nextSibling;
        show_hide(de_controlat);
        toggle_class(this,"expandat","colapsat");
       });
      }
     }
   }

   function ascunde_controlate(){
     if (document.getElementById("wrapper_sa")){
     controlate=getElementsByClassName(document,'div','controlat');
     if(controlate.length) {
     for (i=0;i<controlate.length;i++){
         controlate[i].style.display="none";
         if (controlate[i].previousSibling.nodeType!=3)
          control=controlate[i].previousSibling;
         else control=controlate[i].previousSibling.previousSibling;
          toggle_class(control,"expandat","colapsat");
      }
     }
     }
   }

   addEvent(window,'load',expand_behaviour);
   addEvent(window,'load',ascunde_controlate);
