function toogleContactLayer() {	
$('#contact').css('display', 'block');
$('#contactlayer_content').css('display', 'none');
$('#contactlayer_content').css('opacity', '0.99');

$('#contact').click().toggle(function(){
$('#contactlayer_content').animate({
width: 'show',
opacity: 'show'
}, 'slow', function() {
$('#clayer').css('background-position', '0 -547px');
});
}, function(){
$('#contactlayer_content').animate({
width: 'hide',
opacity: 'hide'
}, 'slow', function() {
$('#clayer').css('background-position', '0 0');
});
});
}

function styleTable() {
// Border zu den letzten Zellen hinzufuegen
$('tr.table-rows:last td', '.stripes').css('border-bottom', '1px solid #B5B5B5');
$('tr.table-rows:last th', '.stripes').css('border-bottom', '1px solid #B5B5B5');

//andere Farbe fuer gerade Zeilen
$("tr.table-rows:even td", ".stripes").addClass('oddrow');
$("tr.table-rows:even th", ".stripes").addClass('oddrow');

// Position der aktiven Spalte auslesen

var position = '';
$.each($(".stripes"), function() {
var $this = $(this);
$.each($("colgroup", this).children(), function(count) {
if ($(this).attr('class') == 'activecol') {
position = count;

$.each($('tbody', $this).children(), function(count) {
element = $('td',this).get(position-1);
if ($(element).hasClass('header')) {
$(element).attr('class', 'header-active');
}

if ($(element).hasClass('oddrow')) {
$(element).removeClass('oddrow');
$(element).addClass('oddrow-active');
} else if (!$(element).hasClass('oddrow')) {
$(element).addClass('oddrow');
}
});
}
});
});
}

jQuery(function ($) {
//Kontakt-Layer-Toggle
if ($('#contact').length) {
toogleContactLayer();
}

// Tabellen-Styles (Deckungsuebersicht)
if ($('.stripes').length) {
styleTable();
}

// unterschiedliche Zeilenfarben für Offerblock
if ($('.offerblock-table').length) {
$("tr:even td", ".offerblock-table").addClass('evenrow');
$("tr:even th", ".offerblock-table").addClass('evenrow');
}

// Zeilenfarben beim Kontaktformular
if ($('#mailform').length) {
$('li:even','#mailform fieldset ol').css('background', "transparent url(/typo3conf/ext/dfv_forms/img/bg5.gif) repeat-y scroll center bottom");
$('li:last','#mailform fieldset ol').css('background', "transparent");
$('li:last','#mailform fieldset ol').css('border-bottom', "none");
$('li:last','#mailform fieldset ol').css('padding', "0");
}

if ($('.tx_dfvforms_pi1_fieldwrap_html').length) {
$('.tx_dfvforms_pi1_fieldwrap_html:even').css('background', "transparent url(/typo3conf/ext/dfv_forms/img/bg5.gif) repeat-y scroll center bottom");
}

if ($('.tx_dfvforms_pi1_fieldwrap_html','#landing').length) {
$('.tx_dfvforms_pi1_fieldwrap_html:even','#landing').css('background', "transparent url(/typo3conf/ext/dfv_forms/img/bg5.gif) repeat-y scroll -195px bottom");
}

if ($('.tx_dfvforms_pi1_fieldwrap_html','.landing2col').length) {
$('.tx_dfvforms_pi1_fieldwrap_html:even','.landing2col').css('background', "transparent url(/typo3conf/ext/dfv_forms/img/bg5.gif) repeat-y scroll center bottom");
}

$('.popup_link').bind("click.open", function(event) {
event.stopPropagation();
event.preventDefault();
var my_window = window.open($(this).attr('href'), "Zweitfenster", "width=540,height=510,scrollbars=yes");
my_window.focus();
});

//BKK Heilberufe blaue Pfeile
$('img[src="fileadmin/template/images/arrows-white.png"]','.bkkheil').attr('src','fileadmin/template/images/arrows-blue_bkkheil.png');
$('img[src="fileadmin/template/images/arrows-white-back.png"]','.bkkheil').attr('src','fileadmin/template/images/arrows-blue-back_bkkheil.png');

//bei IE6 png-Logo gegen gif tauschen
if ($.browser.msie && $.browser.version < 7) {
if ($('#logo').length) {
$('#logo').attr('src', $('#logo').attr('src').replace(/png/,'gif'));

$('#logo').bind('error', function() {
$('#logo').attr('src', $('#logo').attr('src').replace(/gif/,'png'));
});
}
}
});