function getScrollTop () {
  return window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop;
}

function docgeladen() {
  $('img[@src$=.png]', '#main').rollover(); 
  $('#main div').pngfix(); 
  $('img[@src$=.png]:not("#versteckt")').pngfix(); 
	
	$('td.hover').each(function(i,obj) {
		$(obj).mouseover(function() {
		$(this).addClass('highlight');
		});
		
		$(obj).mouseout(function() {
		$(this).removeClass('highlight');
		});
		
		$(obj).click(function() {
			var id = $(this).find('p:eq(0)').attr('id');

			if (id != undefined) {
				$.get(base_url+"kalender_detail", { id: id },
				  function(data){
				    $('.ajaxcontainer').html(data);
				    $('div.detail').show();
					$('#versteckt').pngfix();
				  });
			}
		});
	});
	
	$('div.detaillink').each(function(i,obj) {
		$(obj).click(function() {
			var id = $(this).attr('id');
			if (id != undefined) {
				$.get(base_url+"kalender_detail", { id: id },
				  function(data){
				    $('.ajaxcontainer').html(data);
					$('.detail').css('top',getScrollTop()+115)
				    $('div.detail').show();
					$('#versteckt').pngfix();
				  });
			}
		});
	});
	
	
	$('div.close').click(function() {
		$('div.detail').hide();
		$('#versteckt').pngunfix();
	});
	
};

window.onload = docgeladen;