hs.graphicsDir = '/de/wGlobal/layout/styles/graphics/';
hs.numberOfImagesToPreload = 0;
hs.showCredits = false;
hs.preserveContent = false;
hs.align = 'center';
hs.allowMultipleInstances = false;
hs.fadeInOut = true;
hs.dimmingOpacity = 0.5;

function show_movie(me) {
  return hs.htmlExpand(me, {
    wrapperClassName: 'draggable-header',
    objectType: 'iframe',
    outlineType: 'rounded-white',
    headingText: 'Die FAIRRANK group',
    width: 515,
    height: 350
  });
}

function show_request(me) {
  return hs.htmlExpand(me, {
    wrapperClassName: 'draggable-header',
    objectType: 'iframe',
    outlineType: 'rounded-white',
    headingText: 'Anfrageformular',
    width: 780,
    height: 585
  });
}

/*
function show_callback(me) {
  return hs.htmlExpand(me, {
    wrapperClassName: 'draggable-header',
    objectType: 'iframe',
    outlineType: 'rounded-white',
    headingText: 'Call-Back-Service',
    width: 450,
    height: 500
  });
}

function show_tippspiel(me) {
  return hs.htmlExpand(me, {
    wrapperClassName: 'draggable-header',
    objectType: 'iframe',
    outlineType: 'rounded-white',
    headingText: 'FAIRRANK WM-Tippspiel 2010',
    width: 1020,
    height: 650
  });
}
*/

function new_win(){
  window.open("http://ea.ce-intern.com/_s.php?&fid=3766&fpw=52e824750ab7cc361f188417ee48b815","newwindow","width=535,height=390,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,top=5,left=5");
}

function animation() {
  $.ajax({
    type: "POST",
    url: "/de/wGlobal/layout/scripts/loadPictures.php",
    async: false,
    success: function(msg) {
      if (msg != 'error') {
        $("#header").append(msg);
        $("img#header_start").animate( { opacity: 0.3 }, 4000 ).delay(500);
        $("ul#scroller img").animate( { opacity: 1 }, 6000 );
        $("ul#scroller").simplyScroll({
          autoMode: 'loop',
          speed: 2,
          pauseOnHover: false
        });
      }
    }
    
  });
}

function callContact() {
  $("#contact_me").click();
  return false;
}

$(document).ready(function(){
  
  /* nur ausführen, falls nicht in Editor */
  if ($("#wEditorExtensionArea").length == 0) {
  
  /* Click-Funktion auf komplettes LI ausweiten (statt nur A-Tag) */
  $("#mainmenu li").click(function() {
    var temp = $(this).find("a:first").attr("href");
    if (temp != "") document.location.href = temp;
  });
  $("#submenu li").click(function() {
    var temp = $(this).find("a:first").attr("href");
    if (temp != "") document.location.href = temp;
  });
  
  /* Hover-Effect auf komplettes LI */
  $("#mainmenu li.navLevel1").hover(
    function() { 
      $(this).css("background-color","#FFFFFF");
      $(this).find("a:first").css("color","#399441"); 
    },
    function() {
      $(this).css("background-color","transparent");
      $(this).find("a:first").css("color","#393939");
    }
  );
  
  /* Accordion für Team-Seite */
  if ($("div.accordion").length > 0) {
    $("div.accordion").accordion({
      active: false,
      autoHeight: false,
      header: 'div.department',
      animated: false,
      collapsible: true
    });
  }
  
  /* Click-Funktion für CallBack */
  $("#callback").click(function() {
      $(this).find("a:first").trigger("click");
  });
  
  /* Click-Funktion für CallBack / Anfrage rechts */
  $("div.contact_container").click(function() {
      $(this).find("div.contact_image a:first").trigger("click");
      event.stopPropagation();
  });
  
  /* Click-Funktion für Textboxen rechts */
  $("#sidebar div.text").each(function() {
    if ($(this).find("a.more:first").length > 0) {
      $(this).click(function() {
        document.location.href = $(this).find("a.more:first").attr("href");
      });
      $(this).css("cursor","pointer");
    }
  });
  
  /* Click-Funktion für Kundenstimmen */
  $("#sidebar .ref_desc").each(function() {
    if ($(this).find("a.ref_more:first").length > 0) {
      $(this).parents(".ref_element:first").click(function() {
        document.location.href = $(this).find("a.ref_more:first").attr("href");
      });
      $(this).parents(".ref_element:first").css("cursor","pointer");
    }
  });
  
  /* Click-Funktion für News */
  $("#sidebar .news_desc").each(function() {
    if ($(this).find("a.more:first").length > 0) {
      $(this).parents(".news_element:first").click(function() {
        document.location.href = $(this).find("a.more:first").attr("href");
      });
      $(this).parents(".news_element:first").css("cursor","pointer");
    }
  });
  
  /* Animation Startseite */
  /* if ($("#header").length > 0) {
    setTimeout ( "animation()", 2000 );
  } */
  
  /* Tooltips aktivieren */
  $("a.tooltip").cluetip({
     dropShadowSteps: 2,
     clickThrough: true,
     ajaxCache: true,
     positionBy: 'mouse'
  });
  
  $("a.tooltip").click(function() {
    return false;
  });
  
  $("a.tooltip").dblclick(function() {
    document.location.href = $(this).attr("href");
  });
  
  }

  /* alles weitere wird immer ausgeführt */
  
  /* diverse Anpassungen CSS */
  $("#content .ref_element:last,#content .news_element:last").css("background","none").css("padding-bottom","0");
  
  $("#sidebar a.newsletter").parent("div:first").css("margin-bottom","20px").siblings("div.elementList:first").css("margin-bottom","0px");
  
  $("#content hr").each(function() {
    $(this).wrap("<div>").parent("div:first").addClass("hr").find("hr").hide();
  }); 
  
});

/* Unload für Google Maps */
if ($("#map_canvas").length > 0) {
  $(window).unload(function() {
    GUnload();
  });
}