﻿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 - 12) + "px";
        }
        else
        {
            targetRelation.style.height = (divheightContent - 12)  + "px";
        }
        
        if (divheightRelation < MinimumContentHeight && divheightContent < MinimumContentHeight)
        {
        targetContent.style.height = (MinimumContentHeight) + "px";
        targetRelation.style.height = (MinimumContentHeight) + "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();};
/* init functions onLoad */
addLoadEvent(call_jquery);
addLoadEvent(call_fancy);
addLoadEvent(checkHeight);
addLoadEvent(call_dateTimePicker);

