// JavaScript Document

jQuery.noConflict();
jQuery(document).ready(function($) {

	function doNews(obj, currentObj) {
		if (currentObj) {
			var tmpObj1 = $(currentObj).find("div.aktuellesEntryContent");
			tmpObj1.removeClass("aktuellesEntryActive");    
			//$(currentObj).removeClass("aktuellesEntryActive");    
		}
		currentObj = obj;
		var tmpObj = $(obj).find("div.aktuellesEntryContent");
		tmpObj.addClass("aktuellesEntryActive"); 
		//$(obj).addClass("aktuellesEntryActive");    
		
		
		/*
		<div id="aktuellesEntry1" class="aktuellesEntry">
              <div class="aktuellesEntryContent aktuellesEntryActive">
		*/
		var newsPicturePath = '';
		var PicturePath = $(obj).find("img").attr("src");
		if(PicturePath!=undefined) newsPicturePath = PicturePath.replace("px=47", "px=174");
		
		var newsHeadlineVar = $(obj).find("div.aktuellesEntryContentHeadline").html();
		var newsTeaserTextVar = $(obj).find("h4").html();
		//newsDateVar = $(obj).find("h5").html();
		var newsLinkVar = $(obj).find("a").attr("href");
		//newsLinkWeiterVar = $(obj).find("a").attr("href");
		//headlinePicVar = $(obj).find(".headlinePic").html();
		var headlinePicVar = newsHeadlineVar;
		$("#newsPicture").attr({ src: newsPicturePath, alt: headlinePicVar, title: headlinePicVar });
		$("#newsHeadline").html(newsHeadlineVar);
		$("#newsTeaserText").html(newsTeaserTextVar);
		//$("#newsDate").html(newsDateVar);
		$("#newsLink").attr({ href: newsLinkVar });
		//$("#newsLinkWeiter").attr({ href: newsLinkWeiterVar });
		return currentObj;
	}
	$(document).ready(function(){
		var firstTime = false;
		var currentObj;
		currentObj = doNews("#aktuellesList div:first", currentObj);
		
		$("#aktuellesList div.aktuellesEntry").hover(function(){
			currentObj = doNews(this,currentObj);                              
		}); 
		$("#loaderblock").fadeOut("slow", function() {
			$("#news").fadeIn("slow");
		});
	});
	
	
	$(document).ready(function(){
		$("div#aktuellesList div.aktuellesEntry").click(function(){
		  window.location=$(this).find("a").attr("href"); return false;
		});
		
		$("div#aktuellesList div.aktuellesEntry").attr("id", function (arr) {
		  return "aktuellesEntry" + arr;
		});
		/*$("div#aktuellesList div.umbruchVar").attr("class", function (arr) {
		  return "umbruch" + arr;
		});*/
		/*$(".newsgross").click(function(){
		  window.location=$(this).find("a").attr("href"); return false;
		});*/
	});      
});

