﻿function setBookmark()
{
  var brty = navigator.appName;
  var brve = navigator.appVersion;
  var url=document.location.href; 
  var titel = document.title; 
  if (brty.indexOf("Explorer")>-1)
  {
    // add this page to favorites for IE4+
    //window.external.AddFavorite(document.location.href, document.title);
    window.external.AddFavorite(url,titel);
  }
  else
  {
    //alert("Diese Funktion steht nur für Internet Explorer zur Verfügung");
    alert(unescape("Diese Funktion steht nur f%FCr Internet Explorer zur Verf%FCgung"));
  }
}

function changepic(img)
{
 document.getElementById("contenthome").style.backgroundImage = "url("+img+")";
}

function Top()
{
 document.location.href="#Top";
}

function winOpen(theURL,winName,features) 
{ 
winName = window.open(theURL,winName,features); 
if(winName == null || winName.closed){window.open(theURL,winName,features);} 
else{winName.location.href = theURL;} 
if (!winName.closed) 
winName.focus(); 
}

function switch2Url(targeturl)
{
  if (targeturl != null)
  {
    var values = targeturl.split(";"); 
    var target = values[0];
    var href = values[1];
    
    switch (target)
    {
      case "_self":
        self.document.location.href = href;
        break;
      case "_top":
        top.document.location.href = href;
        break;
      case "_parent":
        parent.document.location.href = href;
        break;
      case "_blank":
        window.open(href, target, "", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600");
        break;
      case "_winopen":
        window.open(href, target, "", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600");
        break;
      default:
        if (document.location.frames == null || document.location.frames[target])
          document.location.href = href;
        else
          document.location.frames[target].href = href;       
    }
  }
}

$(document).ready(function(){
  initTabs();

$.each($("div.teaserbox"), function(i, n) {
 $(n).before("<div class=\"teaserboxtop\"></div>");
 $(n).after("<div class=\"teaserboxbottom\"></div>");
});

  /* ::: Start Accordion Function ::: */
  $.each( $("div.contentplus > div"), function(i, n){
    $(n).children("h2:first-child").addClass("hide");
    jQuery(n).before("<h2 class='onAccHead'>"+$(n).children("h2:first-child").html()+"</h2>");

    if ($(n).hasClass('open')) {
      $(n).prev(".onAccHead").addClass("selected")
      $(n).prev(".onAccHead").addClass("selected")
    } else {
      $(n).addClass("hide");
    }
  });

  $.each( $("div.contentplus2 > div"), function(i, n){
    $(n).children("h2:first-child").addClass("hide");
    jQuery(n).before("<h2 class='onAccHead'>"+$(n).children("h2:first-child").html()+"</h2>");

    if ($(n).hasClass('open')) {
      $(n).prev(".onAccHead").addClass("selected")
      $(n).prev(".onAccHead").addClass("selected")
    } else {
      $(n).addClass("hide");
    }
  });

  $(".onAccHead").click(function() {
    $(this).addClass("current");
    $.each( $(this).parent(".contentplus").children(".selected:not('.current')"), function(i, n){
/* , opacity: 'toggle' */
      $(n).next("div").animate({ height: 'toggle'},{duration: 300,
        complete:function(){ 
          $(n).parent(".contentplus").children(".onAccHead:not('.current')").removeClass("selected");
      } });
    });
/* , opacity: 'toggle' */
    $(this).next("div").animate({ height: 'toggle'},{duration: 300, 
      complete:function(){
        $(this).prev(".onAccHead").toggleClass("selected");  
        $(this).prev(".onAccHead").removeClass("current");
    } });
  });

jQuery("h2.onAccHead").prepend("<span class=\"button\"></span>");
/* ##### End Accordion Function ##### */

});


function initTabs() {
  $("div.generate-ui-tab").prepend("<ul></ul>");
  $.each( $("div.generate-ui-tab > .supertab > h2"), function(i, n){
    var test = $(n).html();
    $(n).parent(".supertab").attr("id","tab_"+i+"");
    $(n).parent(".supertab").parent(".generate-ui-tab").children("ul").append("<li><a href='#tab_"+i+"'>"+test+"</a></li>");
    $(n).addClass("hide");
  });
  $.each( $("div.generate-ui-tab"), function(j, m){  
    $.each( $(m).children(".supertab"), function(i, n){  
      if($(n).parent(".generate-ui-tab").children().is(".defaulttab")){
        if($(this).is(".defaulttab")){
          $(this).parent(".generate-ui-tab").children("ul").tabs({ fx: { height: 'toggle', opacity: 'toggle' },selected: i });
        } 
      } else {
        $(n).parent(".generate-ui-tab").children("ul").tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
      }
    });
  });
}


/* ::: - - - - - addLoadEvent Funtion - - - - - ::: */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}





