jQuery.noConflict();
(function($) {		  
	jQuery(document).ready(function() 
	{			
		Cufon.replace('h1'); 
		Cufon.replace('#header ul#navMain li a', { hover:true }); 
		Cufon.replace('#header #navTop ul#navList li a', { hover:true }); 
		Cufon.replace('#navSub ul li a', { hover:true });
		Cufon.replace('#homeBoxes .boxtitle');
		Cufon.replace('#homeBoxes .ersteUeberschrift');
		
		$('#homeBoxes #boxLeft').click(function(){
			var href = $(this).find('a').attr('href');
			//href = 'http://194.150.248.69/~bigzh/'+href;
			window.location.href = href;
			return false;
		});
		$('#homeBoxes #boxMiddle').click(function(){
			var href = $(this).find('a').attr('href');
			//href = 'http://194.150.248.69/~bigzh/'+href;
			window.location.href = href;
			return false;
		});
		$('#homeBoxes #boxRight').click(function(){
			var href = $(this).find('a').attr('href');
			//href = 'http://194.150.248.69/~bigzh/'+href;
			window.location.href = href;
			return false;
		});
		
		var gotoNumber = 0;
		var countImgs = $('#img_slider div.csc-default').size() -1;
		var counter = 0;
		var intervalId = 0;
		var intervalTime = 4000;
		intervalId = setInterval( nextPic, intervalTime );

		$('#img_slider a#prev').click(function(){
			clearInterval( intervalId );										   
			prevPic();	
			return false;
		});
		$('#img_slider a#next').click(function(){
			clearInterval( intervalId );
			nextPic();	
			return false;
		});

		function prevPic()
		{
			counter--;
			if( counter < 0 )
			{
				counter = countImgs; 
			}			
			var xpos = ( (counter * 861 + ((counter-1)*18) )* -1) + 'px';		
			$('#img_slider div#headerpics').stop(true,false).animate({'left': xpos}, {queue:false, duration:1000, easing: 'easeOutQuart'});
		}
		
		function nextPic()
		{
			counter++;
			if( counter > countImgs )
			{
				counter = 0
			}				
			var xpos = ( (counter * 861 + ((counter-1)*18) )* -1) + 'px';			
			$('#img_slider div#headerpics').stop(true,false).animate({'left': xpos}, {queue:false, duration:1000, easing: 'easeOutQuart'});
		}	
		
		$('#content #imgSliderContentWrapper #imgSliderContent div.csc-textpic-imagewrap').removeAttr('style');
		$('#content #imgSliderContentWrapper #imgSliderContent div.csc-textpic-imagewrap .csc-textpic-imagerow').removeAttr('style');
		var gotoNumberContent = 0;
		var countImgsContent = $('#content #imgSliderContentWrapper #imgSliderContent > div.csc-textpic > div.csc-textpic-imagewrap div.csc-textpic-imagerow').size() -1;
		var counterContent = 0;
		var intervalIdContent = 0;
		var intervalTimeContent = 4000;
		intervalIdContent = setInterval( nextPicContent, intervalTimeContent );

		$('#content #imgSliderContentWrapper a#prev').click(function(){
			clearInterval( intervalIdContent );										   
			prevPicContent();	
			return false;
		});
		$('#content #imgSliderContentWrapper a#next').click(function(){
			clearInterval( intervalIdContent );
			nextPicContent();	
			return false;
		});

		function prevPicContent()
		{
			counterContent--;
			if( counterContent < 0 )
			{
				counterContent = countImgsContent; 
			}			
			var xposContent = ( (counterContent * 562)* -1) + 'px';		
			$('#content #imgSliderContentWrapper #imgSliderContent').stop(true,false).animate({'left': xposContent}, {queue:false, duration:1000, easing: 'easeOutQuart'});
		}
		
		function nextPicContent()
		{
			counterContent++;
			if( counterContent > countImgsContent )
			{
				counterContent = 0
			}			
			var xposContent = ( (counterContent * 562)* -1) + 'px';	
			$('#content #imgSliderContentWrapper #imgSliderContent').stop(true,false).animate({'left': xposContent}, {queue:false, duration:1000, easing: 'easeOutQuart'});
		}	

		
		
		var gotoNewsNumber = 0;
		var countNews = $('#news #newsItems div.newsItem').size() -1;
		var counterNews = 0;
		var intervalIdNews = 0;
		var intervalTimeNews = 6000;
		intervalIdNews = setInterval( nextNews, intervalTimeNews );

		$('#news a#newsNav').click(function(){
			clearInterval( intervalIdNews );										   
			nextNews();	
			return false;
		});

		function nextNews()
		{
			counterNews++;
			if( counterNews > countNews )
			{
				counterNews = 0;
			}				
			var ypos = ( (counterNews * 39 + ((counterNews-1)*5))* -1) + 'px';			
			$('#news #newsItems').stop(true,false).animate({'top': ypos}, {queue:false, duration:1000, easing: 'easeOutQuart'});
		}
	});
})(jQuery);	
