// JavaScript Document

jQuery.noConflict();
jQuery(document).ready(function($) {
		
		// ------------------------
		// AKTUELLES
		// ------------------------
		
		$("#loaderblock").fadeOut("slow", function() {
			$("#news").fadeIn("slow");
		});
		
		
		$("li.item").each(function(i) {
			var itemheight = $(this).find("img").attr("height");
			itemheight = itemheight + 'px';
			
			var itemdivID = $(this).find("div.teaserpic").attr("id");
			
			var itementryID = $(this).find("div.entry").attr("id");
			itemheight = document.getElementById(itementryID).offsetHeight;
			itemheight = itemheight - 16;
			itemheight = itemheight + 'px';
			
			document.getElementById(itemdivID).style.height = itemheight;
			
			
		});
		
		
		$("li.item").mouseenter(function() {
			var imgheight = $(this).find("img").attr("height");
			imgheight = imgheight + 'px';
			var imgwidth = $(this).find("img").attr("width");
			imgwidth = imgwidth + 'px';
			var itemdivID = $(this).find("div.imgbordersmall").attr("id");
			
			$("#"+itemdivID).stop(true, true).animate({
				height: imgheight,
				width: imgwidth
			}, 500);
			
			
			var itemteaserpicID = $(this).find("div.teaserpic").attr("id");
			
			$("#"+itemteaserpicID).stop(true, true).animate({
				height: imgheight
			}, 500);
			
			//$(this).find("div.imgbordersmall").addClass("imgborder");
			//$(this).find("div.imgbordersmall").removeClass("imgbordersmall");							
			
		});
		
		$("li.item").mouseleave(function() {
			var itemdivID = $(this).find("div.imgbordersmall").attr("id");
			
			$("#"+itemdivID).stop(true, true).animate({
				height: '33px',
				width: '55px'
			}, 500);
			
			
			var itementryID = $(this).find("div.entry").attr("id");
			itemheight = document.getElementById(itementryID).offsetHeight;
			itemheight = itemheight - 16;
			itemheight = itemheight + 'px';
			
			var itemteaserpicID = $(this).find("div.teaserpic").attr("id");
			
			$("#"+itemteaserpicID).stop(true, true).animate({
				height: itemheight
			}, 500);
									   
			//$(this).find("div.imgborder").addClass("imgbordersmall");
			//$(this).find("div.imgborder").removeClass("imgborder");	
		});
		
		
		
		// ------------------------
		// KALENDER
		// ------------------------
		$("li.homecalendarlistentry").each(function(i) {
			
			var dayFrom = $(this).find("div.dayFrom").html();
			var dateFromMonthnameLong = $(this).find("div.dateFromMonthnameLong").html();
			var yearFrom = $(this).find("div.yearFrom").html();
			
			var dayTo = $(this).find("div.dayTo").html();
			var dateToMonthnameLong = $(this).find("div.dateToMonthnameLong").html();
			var yearTo = $(this).find("div.yearTo").html();
			
			var homecalendarentrydate = dayFrom + '. ' + dateFromMonthnameLong + ' ' + yearFrom + ' bis ' + dayTo + '. ' + dateToMonthnameLong + ' ' + yearTo;
			
			if(dayFrom == dayTo && dateFromMonthnameLong == dateToMonthnameLong && yearFrom == yearTo)  homecalendarentrydate = dayFrom + '. ' + dateFromMonthnameLong + ' ' + yearFrom;
			
			$(this).find("a.homecalendarentrydate").html(homecalendarentrydate);
			
		});
		
		
		
	
});
