$(document).ready(function() {

  var isInEditor = document.getElementsByTagName("input")[0].value;

  if(isInEditor == null || isInEditor =='') isInEditor = 1;

  $(".vkNavi > a.vkNaviLinkAktive").css("background-image","url(/ALBA_de/wLayout/design/img/backgrounds/reiter_aktiv.gif)");


  $(".seiteLink1 div").css({
    "background-image" : "url(/ALBA_de/wLayout/design/img/backgrounds/reiter_aktiv.gif)",
    "padding-top"      : "5px",
    "margin-bottom"    : "5px"
  });
   
  for(_i = 1; _i <= 8; _i++){
    $("a.seiteLink" + _i).click((function(num){
      return function(){
        $(".seite" + num).css("display","block");
        $(".seiteLink" + num + " div").css({
          "background-image" : "url(/ALBA_de/wLayout/design/img/backgrounds/reiter_aktiv.gif)",
          "padding-top"      : "5px",
          "margin-bottom"    : "5px"
        });
        for(__i = 1; __i <= 8; __i++){
          if(num != __i){
            $(".seite" + __i).css("display","none");
            $(".seiteLink" + __i + " div").css({
              "background-image" : "url(/ALBA_de/wLayout/design/img/backgrounds/reiter.gif)",
              "padding-top"      : "10px",
              "margin-bottom"    : "0"
            });
          } 
        }
      }
    })(_i));
  }
  
  if(isInEditor == 0) {

    $("dt").css({background:"transparent url(/ALBA_de/img/plus.png) no-repeat 0px 3px", paddingLeft:"16px"});
    $(".innerFirmaname").css({background:"transparent url(/ALBA_de/img/plus.png) no-repeat 0px 3px", paddingLeft:"16px"});

    $("dd:not(:first)").hide("normal",bildAusblenden);
    if ( $.browser.msie && $.browser.version == "6.0") {
      $("dd.hackIE6").css({height:"73px"});
    }
    $(".infoFirma:not(:first)").hide("normal",bildAusblenden);
    var browserIE = $.browser.msie;
    var browserIEV = $.browser.version;
    if ( $.browser.msie && $.browser.version <= "7.0") {
      $("div.firmaname").css({width:"197px"});
    }

    $("div.firmaname").mousedown(function(){
      var aux = $(this).parent().children("dd").slideToggle("normal",bildToggle);
      return false;
    });

    var auxHTML = '';
    for(i=0;i<$(".elementStandardLeistungen").length;i++) {
      auxHTML = $(".elementStandardLeistungen").get(i).innerHTML;
      auxHTML = auxHTML.replace('<!-- web:text:start editor="box" -->','');
      auxHTML = auxHTML.replace('<!-- web:text:stop -->','');
      $(".elementStandardLeistungen").get(i).innerHTML = auxHTML;
    }
    
    // Dropdown
    $(".dropdown-content").hide();
    $(".dropdown-link")
      .css({background:"transparent url(/ALBA_de/img/plus.png) no-repeat 0px 3px", paddingLeft:"16px", cursor:"pointer"})
      .click(function(){
        var _parent = $(this).parent(); 
        _parent.find(".dropdown-content").slideToggle("normal",function(){
          if( $(this).css("display") == "none" ){
            _parent.find(".dropdown-link").css({background:"transparent url(/ALBA_de/img/plus.png) no-repeat 0px 3px", paddingLeft:"16px"});
          } else {
            _parent.find(".dropdown-link").css({background:"transparent url(/ALBA_de/img/minus.png) no-repeat 0px 3px", paddingLeft:"16px"});
          }
        });
      });  
  }

  if($.browser.msie == false) {

    var hspace = $("div.text img").attr("hspace");
    var vspace = $("div.text img").attr("vspace");
      $("div.text img").css("margin-left", hspace);
      $("div.text img").css("margin-right", hspace);
      $("div.text img").css("margin-top", vspace);
      $("div.text img").css("margin-bottom", vspace);
  }
});

function bildAusblenden () {
  $(this).prev().find("img").attr("src","/ALBA_de/img/plus.png");
}

function bildToggle () {
  if($(this).prev().find("img").attr("src") == "/ALBA_de/img/plus.png") {
    $(this).prev().find("img").attr("src","/ALBA_de/img/minus.png")
  } else {
    $(this).prev().find("img").attr("src","/ALBA_de/img/plus.png")
  }
}
