cal_date_arr = new Array();

function springen(obj){
	
	pos = $(obj).position();
	posY = pos.top;
	
	//$(window).scrollTop(posY)
	
	}

$(window).load(function(){
	$("#date_01_07_2011").next().addClass("abges");
	$("#date_02_07_2011").next().addClass("abges");
	
	//alert($(".abges").attr("class"))
	/*$(".abges").each(function(){
		l = $(this).offset();
		h = $(this).height();
	
		$("body").append("<div style='height:"+(h+100)+"px; width:600px; top:"+l.top+"px; left:"+l.left+"px; background-image:url(fileadmin/templates/pic/abgesagt.png); background-repeat:no-repeat; position:absolute;'></div>")
		})*/
	
	
	
	$("body").append("<div class='mitte'></div>");
	$(".mitte").click(function(){ 
		
				$(this).remove();
		}).html("<p style='font-size:64pt; font-family:LetterGo; text-align:center; margin-top:31px; line-height:84px;'>SO FAR STAY TUNED FOR MORE NEXT YEAR OR EARLIER ELSEWHERE OR NEVER EVER AGAIN</p> <p style='font-family:LetterGo; font-size:18px; margin-top:-40px; text-align:center;'>DANKE AN ALLE FREUNDE, KÜNSTLER, HELFER UND UNTERSTÜTZER, DIE DAS SOMMERLOCH 2011 AUF UNTERSCHIEDLICHSTE WEISE MIT UNS GESTALTET UND ÜBERHAUPT ERST MÖGLICH GEMACHT HABEN</p>");
		
			$(".mitte").css("cursor","pointer");

	

	
	if ( cal_onoff == "off" ) {
		$('.cal_cont').css("display","none");
		} else 
		{
		$('.cal_cont').css("display","block");
		}
	
	//zur nächsten Veranstaltung der nächsten 7 Tage springen
	for(i = 0; i < 7; i++){		
		var obj = document.getElementById(date[i]);
		
		if(obj != null) {
			//alert(date[i]+" heute")
			}
		
		if(obj != null) {			
			springen('#'+date[i]); break;
		  	}	
		}
	//Termin markieren, über den die Maus rollt
	$(".anker").next().hover(function(){
		s = $(this).prev().attr("id").split("_");
		cl = ".cal_"+s[1]+"_"+s[2]+"_"+s[3];
		
		$(".cal span").css({"font-style":"normal"});
		$(cl).css({"font-style":"italic"});
		})
		
	
	//Alle Termine in Kalender markieren
	$(".anker").each(function(){
		id = $(this).attr("id");
		var s = id.split("_");
		
		cl = ".cal_"+s[1]+"_"+s[2]+"_"+s[3];
		
		if(cl != cal_date_arr[cal_date_arr.length-1])
			{
			if("date_"+s[1]+"_"+s[2]+"_"+s[3] == date[0]){
				strich = "url(fileadmin/templates/pic/doppelstrich_sw.jpg)";
				} else {
				strich = "url(fileadmin/templates/pic/strich_sw.jpg)";
				}
			
			cal_date_arr.push(cl);
		
			$(cl)
				.bind("click",function(){
					springen($("#date_"+s[1]+"_"+s[2]+"_"+s[3]));
					$(".cal span").css({"font-style":"normal"});
					$(".cal_"+s[1]+"_"+s[2]+"_"+s[3]).css({"font-style":"italic"});
					})
				.addClass("cal_mark")
				.parent().css({
					"background-image":strich,
					"background-position":"bottom center",
					"background-repeat":"no-repeat"
					})
				.mouseenter(function(){
					$(this).css({"cursor":"pointer","background-color":"#000"})
					})
				.mouseleave(function(){
					$(this).css({"cursor":"pointer","background-color":"transparent"})
					});			
			}
		
		})
		
	
	});

