var menuLayerTimer = "";
var menuLayerTime = 150;
function showToggleLayer(thisObjId,doAction) {
var thisObj = $('#'+thisObjId);
var thisPos = thisObj.position();
var menuName = thisObj.attr('menuName');
if (doAction == "show") {
$.get('/_public/ajax_getMenuLayerContent.inc.php',
{
thissite : thisObj.attr('menuname'),
intLanguagesId : intLanguagesId,
lang : lang
},
function(returned_data) {
//Show new button ****************************************
var imgLeftPosMinus = '';
switch(menuName) {
case "home": imgLeftPosMinus = 11; break;
case "unternehmen": imgLeftPosMinus = 4; break;
case "handel": imgLeftPosMinus = 4; break;
case "lieferanten": imgLeftPosMinus = 7; break;
case "karriere": imgLeftPosMinus = 6; break;
case "presse": imgLeftPosMinus = 6; break;
case "kontakt": imgLeftPosMinus = 6; break;
default: imgLeftPosMinus = 5;
}
var imgLeftPos = (thisPos.left - imgLeftPosMinus);
//if current hover-button is hidden
if ($('#'+thisObjId+'_button_on').css('display') == "none" || $('#'+thisObjId+'_button_on').length < 1) {
//Hide all button elements first
$('.activeMenuLabel').hide();
//Show current over-state button
thisObj.append('');
$('#'+thisObjId+'_button_on').css('zIndex',999);
} else {
}
//Show layer including dynamic content *******************
$('#menuLayerInner').html(returned_data);
//Set "|" after all 2nd level elements
var k = 0;
$('.menu_main1_layer_1_link span').each(function(){
k++;
(k<5) ? $(this).append('|') : k = 0;
});
//get and set new layer height
var innerHeight = $('#menuLayer').height() + 20;
$('#menuLayerBg').attr('height',innerHeight);
$('#menuLayer').css('zIndex','99').show();
}
);
} else {
//Hide all button elements first
$('.activeMenuLabel').hide();
//Hide layer
$('#menuLayer').hide();
}
}
/**
* Resize all 3 content cols to same height
*/
function setColsToSameHeight() {
var innerLeftcol = $('#leftcolInnerHtml');
var innerContent = $('#contentInnerHtml');
var innerContext = $('#contextInnerHtml');
var contentInner = $('#contentInner');
//Reset all dynamicly added height-values from cols
innerLeftcol.css({ height: '' });
innerContent.css({ height: '' });
innerContext.css({ height: '' });
//get current height of inner content
var contentInnerHeight = contentInner.innerHeight();
contentInnerHeight = contentInnerHeight - 20;
if ($('#contentKeyvisualOuter').length > 0) {
var keyvisualHeight = $('#contentKeyvisualOuter').height();
var newHeight = contentInnerHeight - keyvisualHeight;
innerLeftcol.css({ height: contentInnerHeight-11 });
innerContent.css({ height: newHeight-12 });
innerContext.css({ height: newHeight-11 });
} else {
innerLeftcol.css({ height: contentInnerHeight-11 });
innerContent.css({ height: contentInnerHeight-12 });
innerContext.css({ height: contentInnerHeight-11 });
}
}
/**
* Home: Resize 2 Teaserboxes to same height
*/
function setHomeColsToSameHeight() {
var leftCol = $('#homeVideoInnerHtml');
var rightCol = $('#homeNewsInnerHtml');
var leftColHeight = leftCol.innerHeight();
var rightColHeight = rightCol.innerHeight();
var newHeight = (leftColHeight >= rightColHeight ? leftColHeight : rightColHeight)
leftCol.css({ height: newHeight });
rightCol.css({ height: newHeight });
}
function setHistoryNavi(setElement,setStatus) {
var prevImage = $('#prev_image'),
nextImage = $('#next_image');
if (setElement == 'prev') {
if (setStatus == 'on') {
prevImage.attr('src', prevImage.attr('imgSrcActive'));
} else {
prevImage.attr('src', prevImage.attr('imgSrcInactive'));
}
}
if (setElement == 'next') {
if (setStatus == 'on') {
nextImage.attr('src', nextImage.attr('imgSrcActive'));
} else {
nextImage.attr('src', nextImage.attr('imgSrcInactive'));
}
}
}
function switchHistoryAutoslide(doAction) {
var doAction = (doAction==undefined ? $('.playPauseButton').attr('doAction') : doAction),
playPauseButton = $('.playPauseButton'),
playPauseImage = $('#play_pause_image'),
currentIndex = api.getIndex(),
sumItems = api.getSize();
//Disable prev button
if (currentIndex == 0) {
setHistoryNavi('prev','off');
} else {
setHistoryNavi('prev','on');
}
//Disable next button
if (currentIndex == (sumItems-1)) {
setHistoryNavi('next','off');
} else {
setHistoryNavi('next','on');
}
//Start/Stop slideshow
if (doAction == "play") {
api.play();
playPauseButton.attr('doAction','pause');
playPauseImage.attr('src', playPauseButton.attr('imgSrcPause'));
}
else if (doAction == "pause") {
api.pause();
playPauseButton.attr('doAction','play');
playPauseImage.attr('src', playPauseButton.attr('imgSrcPlay'));
}
}
function showContent(intElement) {
$('#loesungenLayerWrapper .loesungenLayer').hide();
$('#loesungenLayerWrapper #element_'+intElement).show();
setColsToSameHeight();
}
window.onload = function() {
if ($('#loesungenLayerWrapper').length > 0) {
showContent(0);
}
/**
* Resize all galleries depending on imagesize
*/
$('.resizeGallery').each(function(){
var thisWidth = $(this).attr('galleryWidth') + 'px',
thisHeight = $(this).attr('galleryHeight') + 'px';
if ($(this).hasClass('isContext')) {
$(this).parent().parent().css({
width : thisWidth,
height : thisHeight
});
}
$(this).css({
width : thisWidth,
height : thisHeight
});
$(this).find(".items div").css({
width : thisWidth
});
$(this).find(".items div img").css({
width : thisWidth,
height : thisHeight
});
});
/**
* Calculate position of header search elements depending on width of #nav_top
*/
var widthNavTop = $('#nav_top').width();
$('#headerSearch').css('left', (widthNavTop + 20) );
/**
* Resize all 3 content cols to same height
*/
setColsToSameHeight();
/**
* Home: Resize 2 Teaserboxes to same height
*/
if ($('.box_50').length > 0) {
setHomeColsToSameHeight();
}
$('.BtnOver').hover(
function() {
$(this).attr('src', $(this).attr('over'));
},
function() {
$(this).attr('src', $(this).attr('out'));
}
);
// initialize scrollable together with the navigator plugin
$("#browsableHome")
.scrollable({
circular: true,
speed: 800,
mousewheel: true
})
.navigator()
.autoscroll({
autoplay: true,
autopause: true,
interval: 5800
}
);
$(".scrollGallery")
.scrollable({
circular: true,
speed: 800,
mousewheel: true
})
.navigator()
.autoscroll({
autoplay: true,
autopause: true,
interval: 5800
}
);
var historyGallery = $(".scrollGalleryHistory")
.scrollable({
circular: false,
speed: 800,
mousewheel: true,
onBeforeSeek: function(obj,i) {
//first item
if (i < 1) {
setHistoryNavi('prev','off');
} else {
setHistoryNavi('prev','on');
}
//last item
if (i+1 >= api.getSize()) {
switchHistoryAutoslide('pause');
setHistoryNavi('next','off');
} else {
setHistoryNavi('next','on');
}
}
})
.navigator({
navi: '.naviHistory',
naviItem: '.element'
})
.autoscroll({
autoplay: false,
autopause: false,
interval: 8000
}
);
if ($(".scrollGalleryHistory").length > 0) {
window.api = historyGallery.data('scrollable');
switchHistoryAutoslide('pause');
setHistoryNavi('next','on');
$('.playPauseButton').click(function(){ switchHistoryAutoslide(); });
$('.leftRight').click(function(){ switchHistoryAutoslide('pause'); });
$('.element').click(function(){ switchHistoryAutoslide('pause'); });
}
/*$('#jahreDropdownInner').attr('initHeight', $('#jahreDropdownInner').css('height'));
var historyToggleSpeed = 200;
$('#btnJahrWaehlen').click(function(){
var initHeight = $('#jahreDropdownInner').attr('initHeight');
//Slide down
if ($('#jahreDropdownInner').css('top') == '-'+initHeight) {
$('#jahreDropdownInner').css('zIndex','999');
$('#jahreDropdownInner').animate({
top : '0px'
}, historyToggleSpeed, function(){
//callback
});
}
//Slide up
else {
$('#jahreDropdownInner').animate({
top : '-'+initHeight
}, historyToggleSpeed, function(){
$('#jahreDropdownInner').css('zIndex','1');
});
}
});
$('#jahreDropdownInner .element').click(function(){
$('#jahreDropdownInner .element').each(function(){ $(this).removeClass('active'); });
$(this).addClass('active');
var initHeight = $('#jahreDropdownInner').attr('initHeight');
$('#jahreDropdownInner').animate({
top : '-'+initHeight
}, historyToggleSpeed, function(){
$('#jahreDropdownInner').css('zIndex','1');
});
});*/
/**
* Header Main Menu Layer
*/
$('#nav_main1 a').hover(
function() {
if ($(this).hasClass('hasChildren') == true) {
var thisObjId = $(this).attr('id');
window.clearTimeout(menuLayerTimer);
menuLayerTimer = window.setTimeout(" showToggleLayer('"+thisObjId+"','show')", menuLayerTime);
}
},
function() {
if ($(this).hasClass('hasChildren') == true) {
var thisObjId = $(this).attr('id');
window.clearTimeout(menuLayerTimer);
menuLayerTimer = window.setTimeout("showToggleLayer('"+thisObjId+"','hide')", menuLayerTime);
}
}
);
$('#menuLayer').hover(
function() {
window.clearTimeout(menuLayerTimer);
},
function() {
var thisObjId = $(this).attr('id');
menuLayerTimer = window.setTimeout("showToggleLayer('"+thisObjId+"','hide')", menuLayerTime);
}
);
$('.sliderHead').click(function(){
var sliderWrapper = $(this).parent();
var sliderContent = sliderWrapper.find('.sliderContent');
if (sliderContent.is(':hidden') == true) {
sliderContent.addClass('openedLayer');
} else {
sliderContent.removeClass('openedLayer');
}
setColsToSameHeight();
});
if ($('#isWebsite').length == 1) {
$.supersized({
slides : [ {
image : '/images/html_bg.jpg',
title : 'Gropper'
} ]
});
}
// setup tooltip for a single DIV element
$(".myTooltip").tooltip({
// custom positioning
position: 'top center',
// move tooltip a little bit to the right
offset: [20, 0],
});
$('.productGroupWrapper .productWrapper .thumbWrapper').click(function(){
var layer = $(this).parent().find('.productLayer');
showProductLayer(layer);
});
var countLayers = 0,
maxOpenedLayers = 5;
$('.productLayerInner .closeLayer').click(function(){
$(this).parent().parent().hide();
countLayers--;
});
function showProductLayer(thisLayer) {
if (thisLayer.is(':hidden')) {
countLayers++;
if (countLayers >= maxOpenedLayers) {
$('#layerCount_'+(countLayers-maxOpenedLayers)).hide();
}
thisLayer.attr('id','layerCount_'+countLayers).css({ zIndex: 250+(countLayers*10) }).show();
} else {
countLayers--;
thisLayer.hide();
}
}
};