jQuery.noConflict();
// Newsfader


// Slide per click

function movebyclick(box_restcount) {

	// check if the object isn't allready shown
	if ( jQuery('.sima_slider_boxcount:eq('+ box_restcount +')').is(':hidden') )
	{
		// fade action
		jQuery('.sima_slider_boxcount:visible').fadeOut(1000);
		jQuery('.sima_slider_boxcount:eq('+ box_restcount +')').fadeIn(1000);

		// Change the Border and opacity of the click-element
		jQuery('div.sima_slider_click').css("border", "2px solid white");
		jQuery('div.sima_slider_click').css("opacity", "0.5");
		jQuery('div.sima_slider_click#'+box_restcount).css("border", "2px solid #99010a");
		jQuery('div.sima_slider_click#'+box_restcount).css("opacity", "1.0");
		
	}
	
	/* restart the Slide-Per-Time frequenz */
	clearInterval(sliderIntervalID);
	
	sliderIntervalID = setInterval(function(){
		doFade();
	},10000);

}

// Move elements

function doFade() {
 
 		// fade-out the visible object
 		jQuery('.sima_slider_boxcount:visible').fadeOut(1000);
		
		// check if the object wasn't the last one
		var nextbox = jQuery('.sima_slider_boxcount:visible').next('.sima_slider_boxcount').length;
		
		if ( nextbox > 0 )
		{
			
			// fade in the next object
			jQuery('.sima_slider_boxcount:visible').next('.sima_slider_boxcount').fadeIn(1000);
			
			var boxcount = jQuery(".sima_slider_boxcount").index(jQuery(".sima_slider_boxcount:visible"));
			var boxcountnew = boxcount + 1;

			// set border Color

			jQuery('div.sima_slider_click#'+boxcount).css("border", "2px solid white");
			jQuery('div.sima_slider_click#'+boxcount).css("opacity", "0.5");
			jQuery('div.sima_slider_click#'+boxcountnew).css("border", "2px solid #99010a");
			jQuery('div.sima_slider_click#'+boxcountnew).css("opacity", "1.0");
			
		}
		else
		{
			// fade-in the first element
			jQuery('.sima_slider_boxcount:first').fadeIn(1000);
			
			// set border Color
			jQuery('div.sima_slider_click').css("border", "2px solid white");
			jQuery('div.sima_slider_click').css("opacity", "0.5");
			jQuery('div.sima_slider_click#0').css("border", "2px solid #99010a");
			jQuery('div.sima_slider_click#0').css("opacity", "1.0");
		}

}

jQuery(function(){

		// change the cursor to a pointer
		jQuery('.sima_slider_click').mouseover(function() {
		  jQuery(this).css('cursor', 'pointer')
		});

		// set the configuration for the fader
		jQuery('.sima_slider_boxcount').css({"position":"absolute"});
		jQuery('.sima_slider_boxcount').css({"left":"0"});
		jQuery('.sima_slider_boxcount').css({"top":"0"});
		jQuery('.sima_slider_boxcount').css({"display":"none"});
		jQuery('.sima_slider_boxcount:first').css({"display":"block"});

		// set border Color
		jQuery('div.sima_slider_click').css("border", "2px solid white");
		jQuery('div.sima_slider_click').css("opacity", "0.5");
		jQuery('div.sima_slider_click#0').css("border", "2px solid #99010a");
		jQuery('div.sima_slider_click#0').css("opacity", "1.0");

		// Fade per time

		 sliderIntervalID = setInterval(function(){
			doFade();
		},10000);


		// Slide per click
		 
		jQuery('div.sima_slider_click').click(function() {  
			
			var box_restcount = this.id;			
			movebyclick(box_restcount);
		
		} );

});