window.onload=init;function init(){EFFECTS.init();setRoleAttr();initDatePicker()}function myPreload(img_src){var d=document;if(d.images){if(!d.p){d.p=new Array()}var key=d.p.length;d.p[key]=new Image;d.p[key].src=img_src}}function preloadImages(){var a=preloadImages.arguments;for(i=0;i<a.length;i++){if(a[i].indexOf("#")!=0){myPreload(a[i])}}}function setRoleAttr(){if($('#header')){$('#header').attr('role','banner')}if($('#navi')){$('#navi').attr('role','navigation')}if($('#col1')){$('#col1').attr('role','complementary')}if($('#col2')){$('#col2').attr('role','complementary')}if($('#col3')){$('#col3').attr('role','main')}if($('#footer')){$('#footer').attr('role','contentinfo')}}var EFFECTS={init:function(){EFFECTS.initOnOver();if($('#pic')){EFFECTS.initOnClick();EFFECTS.initArrows();EFFECTS.pic_src=$('#pic').attr('src')}},initOnOver:function(){var data=$('img.onOver');for(var x=0;x<data.length;x++){var orig_src=data[x].src;var over_src=orig_src.replace(/.jpg/,"_hover.jpg");over_src=over_src.replace(/.gif/,"_hover.gif");over_src=over_src.replace(/.png/,"_hover.png");data[x].onmouseover=new Function("this.src ='"+over_src+"'");data[x].onmouseout=new Function("this.src ='"+orig_src+"'");myPreload(over_src)}},pic_nr:1,initOnClick:function(){var data=$('img.onClick');for(var x=0;x<data.length;x++){var new_src=$('#pic').attr('src').replace(/01/,"0"+(x+1));data[x].onclick=new Function("$('#pic').attr('src','"+new_src+"');  EFFECTS.setCurrentImg("+x+"); EFFECTS.pic_nr="+(x+1));myPreload(new_src)}if(data.length>0){EFFECTS.setCurrentImg(0)}},setCurrentImg:function(x){var data=$('img.onClick');for(y=0;y<data.length;y++){data[y].className=data[y].className.replace("onCurrent","")}data[x].className+=" onCurrent"},initArrows:function(){if($('#arrowMinus')){$('#arrowMinus').onclick=new Function("EFFECTS.minusArrow();")}if($('#arrowPlus')){$('#arrowPlus').onclick=new Function("EFFECTS.plusArrow();")}},minusArrow:function(){var pic_count=$('img.onClick').length;var minus=EFFECTS.pic_nr-1;if(minus==0){minus=pic_count}var new_src=EFFECTS.pic_src.replace(/01/,"0"+minus);$('#pic').attr('src',new_src);EFFECTS.pic_nr=minus;EFFECTS.setCurrentImg((minus-1))},plusArrow:function(){var pic_count=$('img.onClick').length;var plus=EFFECTS.pic_nr+1;if(plus==(pic_count+1)){plus=1}var new_src=EFFECTS.pic_src.replace(/01/,"0"+plus);$('#pic').attr('src',new_src);EFFECTS.pic_nr=plus;EFFECTS.setCurrentImg((plus-1))}};var url="includes/newsbox_klicks.php?param=";function handleHttpResponse(){if(http.readyState==4){results=http.responseText.split(",");alert(results[0])}}function cntNc(id){http.open("GET",url+id,true);http.send(null)}function getHTTPObject(){var xmlhttp;/*@cc_on@if(@_jscript_version>=5)try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttp=false}}@else xmlhttp=false;@end@*/if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest()}catch(e){xmlhttp=false}}return xmlhttp}var http=getHTTPObject();function initDatePicker(){var sf=$("#f_date_sa").datepicker({minDate:"0",onSelect:function(){var anrDate=new Date(Date.parse($('#f_date_sa').datepicker('getDate')));var abrDate=new Date(Date.parse($('#f_date_sb').datepicker('getDate')));if(anrDate>=abrDate||$('#f_date_sb').val()==''){$('#f_date_sb').datepicker('setDate',new Date(anrDate.getTime()+86400000))}$("#f_date_sb").datepicker("option","minDate",new Date(anrDate.getTime()+86400000))}});var st=$("#f_date_sb").datepicker({minDate:"+1",onSelect:function(){var abrDate=new Date(Date.parse($('#f_date_sb').datepicker('getDate')));if($('#f_date_sa').val()==''){$('#f_date_sa').datepicker('setDate',new Date(abrDate.getTime()-86400000))}}})}

var IE6 = false /*@cc_on || @_jscript_version <= 5.7 @*/;

if(!IE6) {
$(document).ready(function(){
	var col3_height = $('#col3_inner_content').height();
	if(col3_height > $(window).height()-200) {
		col3_height = $(window).height() - 200;
		var col3_overflow = true;
	}
	//Init with JavaScript
	$('#main').css({width:'3000px',position:'static'});
	$('#content_plus').css({width:'auto',overflow:'visible',marginLeft:440});
	if( col3_height > 200) {
		$('#col3_content').css({height: col3_height});
		$('#col3').css({height: (col3_height+35), marginTop: ((col3_height - 200 + 35) * -1), maxHeight:2000});
	} else {
		$('#col3_content').css({height: 165});
	}
	$('#newsbox a.button').css({position:'absolute'});
	$('#col3_content').css({overflow:'hidden'});
	if(col3_overflow == true) {
		$('#col3_content').css({overflow:'auto'});
	}
	// IE7 patch für Content
	if(isIE7) { 
		$('#col3').css({left: $(window).width()/2 - 300,marginLeft:0});
	}
	if(zu) {
		$('#content_plus').css({marginLeft:0});
		$('#col3_content').css({overflow:'hidden',height:'145px'});
		$('#col3').css({position:'static',marginLeft:0,marginTop:0,height:200});
		$('#col3_weiter').css({display:'inline'});
		$('#col3_wrap').css({paddingBottom:'30px'});
	} else {
		$('#col3_zu').show();
		$('#col3_wrap').css({paddingBottom:'10px'});
	}
	// IE7 patch für Pfeile
	if(isIE7) {
		$('#pfeil_rechts').css('right',$(window).width()/2 - 500);
		$('#pfeil_links').css('left',$(window).width()/2 - 500);
		$('#col3_content').css({position:'static'});
	}
	if($('#content_plus div').length > 1) {
		$('#pfeil_rechts').show();	
	}
	
	//Klick "lesen Sie weiter"
	$('#col3_weiter').click(function(e) {
		var speed = -(parseInt($('#main').css('margin-left'))) * 1.75;
		$('#main').animate({
			marginLeft: 0
		},speed);
		$('#pfeil_links').fadeOut(700);
		$('#pfeil_rechts').fadeIn(700);
		$('#col3_wrap').css('padding-bottom',10);
		$('#col3').css({
				position:'absolute',
				marginLeft:'200px'
			}).animate({
				height: (col3_height+35),
				marginTop: ((col3_height - 200 + 45) * -1)
			}, 500);
		//Höhe Check
		if(col3_overflow == true) {
			$('#col3_content').css({overflow:'auto'});
		}		
		// IE7 patch für Content
		if(isIE7) {
			$('#col3').css({
				left: $(window).width()/2 - 300,
				marginLeft:0
			});
		}
		$('#col3_content').animate({
				height: col3_height
			}, 500);
		$('#content_plus').css('margin-left',440);
		$('#col3_weiter').fadeOut(700);
		$('#col3_zu').fadeIn(700);
	});
	
	//Klick "schliessen"
	$('#col3_zu').click(function(e){
		$('#col3_wrap').css('padding-bottom',30);
		$('#col3_content').css({overflow:'hidden'});
		$('#col3_content').animate({
			height: 145
		}, 1000);
		$('#col3').animate({
			height: 200,
			marginTop: 0
		}, 1000, function(){$('#col3').css({
				position:'static',
				marginLeft:0
		});$('#content_plus').css('margin-left',0);	});
		$('#col3_weiter').fadeIn(700);
		$('#col3_zu').fadeOut(700);
	});
	
	//Pfeil Weiter
	var animWidth = parseInt($('#content_plus').width())-360;
	$('#pfeil_rechts').mouseover(function(e){
		$('#navi ul li#current img').fadeOut(200);
		$('#col3').css({position:'static', marginLeft:0});
		$('#content_plus').css('margin-left',0);	
		$('#col3_content').css({overflow:'hidden'});
		$('#col3_wrap').css({paddingBottom:20});
		$('#col3_zu').hide();		
		$('#col3_wrap').css('padding-bottom',30);
		//Höhen Check
		if(klein) {
			//$('#col3').css({paddingTop:10});
			$('#col3_wrap').css('padding-bottom',10);
		} else {
			$('#col3_weiter').fadeIn(700);	
			$('#col3_content').animate({
				height: 145
			}, 500);
			$('#col3').animate({
				height: 200,
				marginTop: 0
			}, 500);
		}
		
		var left = parseInt($('#main').css('margin-left'));
		var speed = (animWidth + left) * 1.75;
		$('#main').animate({
			marginLeft: -(animWidth)
		},speed);
	});
	$('#pfeil_rechts').mouseout(function(e){
		$('#main').stop();
		var left = parseInt($('#main').css('margin-left'));
		if(left < 0) {
			$('#pfeil_links').fadeIn(700);	
		} 
		if(left == (animWidth * -1)) {
			$(this).fadeOut(700);
		}
	});
	
	//Pfeil Zurück
	$('#pfeil_links').mouseover(function(e){
		var speed = -(parseInt($('#main').css('margin-left'))) * 1.75;
		$('#main').animate({
			marginLeft: 0
		},speed);
	});
	$('#pfeil_links').mouseout(function(e){
		$('#main').stop();
		var left = parseInt($('#main').css('margin-left'));
		if(left == 0) {
			$(this).fadeOut(700);
			$('#navi ul li#current img').fadeIn(500);
		}
		if(left > (animWidth * -1)) {
			$('#pfeil_rechts').fadeIn(700);
		}
	});
	
	
});
}
