function addLoadEvent(func_name) {
  var lastonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func_name;
  } else {
    window.onload = function() {
      lastonload(); func_name();
    }
  } 
}
function call_jquery(){
$(".standardTabelle tr:nth-child(odd)").addClass("odd");
};
function checkHeight() {
        var divheightRelation = document.getElementById('rightbox').offsetHeight;
        var divheightContent = document.getElementById('contentBackground').offsetHeight;
        var targetContent = document.getElementById('contentBackground');
        var targetRelation = document.getElementById('rightbox');
        var MinimumContentHeight = 434;
        
        if (divheightContent < divheightRelation)
        {
            targetContent.style.height = ( divheightRelation - 46 ) + "px";
        }
        else
        {
            targetRelation.style.height = ( divheightContent + 34 ) + "px";
        }
        
        if (divheightRelation < MinimumContentHeight && divheightContent < MinimumContentHeight)
        {
        targetContent.style.height = (MinimumContentHeight) + "px";
        targetRelation.style.height = (MinimumContentHeight + 34) + "px";
}
        								
    							};
function call_fancy() {
			$("a.lightbox").fancybox({
				'titlePosition'	: 'over'
			});
			$("a[rel=lightbox]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '</div><span id="fancybox-title-over">Bild: ' + (title.length ? ' &nbsp; ' + title : '') + '</span><div class="pages">  Foto <strong>' + (currentIndex + 1) + '</strong> von ' + currentArray.length;
				}
			});

		
		};
		
function call_dateTimePicker(){
$('.dt_date_start, .dt_time_start,' + '.dt_date_end,   .dt_time_end')   .calendricalDateTimeRange();};

/* START ariport center addons */
function call_LastListItem() {
  var acListe = $(".airportCenterNewsListe");
  if (acListe) {
	$(".airportCenterNewsListe:last").addClass("last");
  }
};


function goAccordeon() {
  var goAccordeonOk = $(".airportCenterNewsListe");
  if (goAccordeonOk) {
    var siteurl = window.location.href;
    var klasseACBox = siteurl.search("#airportCenterBox");
    if (klasseACBox) {
      $('.accordionButton').removeClass('on');
      $('.accordionContent').slideUp('normal');

      if ($(this).next().is(':hidden') == true) {
        $(this).addClass('on');
        $(this).next().slideDown('normal');
      }
    }

    $('.accordionContent').hide();
  }
};

function getLogoBorder() {		
	var logo = $(".kontakteLogo");
	logo.each(function(i) { 
		if ($(this).find("img").length < 1) { 
			$(this).css({
			
			"border-color":"#eee",
			"border-width":"1px",
			"border-style":"solid"

			});
	} 
	});
};

/* STOP aiport center addons */

/* init functions onLoad */
addLoadEvent(call_jquery);
addLoadEvent(call_fancy);
addLoadEvent(checkHeight);
addLoadEvent(call_dateTimePicker);
addLoadEvent(call_LastListItem);
addLoadEvent(goAccordeon);
addLoadEvent(getLogoBorder);

