$(document).ready(function(){
	
	$('#browsable .items a').each(function() {
		id = $(this).attr('id');
		if (id.match(RegExp(/^c/))) {
			$('#browsable .items a#'+id).remove();
		}
	});
	
	$('.slider-maschine a').each(function() {
		id = $(this).attr('id');
		if (id.match(RegExp(/^c/))) {
			$('.slider-maschine a#'+id).remove();
		}
	});
	
	/*===========================
	*
	* Date Created: 19/03/2010
	* Last Update: 19/03/2010
	*	Source: -
	* Description: -
	*
	*===========================*/	
	
	// language
	$('#countries').hover( function() {
    $('ul.switch-language', this).slideDown(100);
  }, function() {
    $('ul.switch-language', this).slideUp(100);
  });
	
	/*===========================
	*
	* Pluginname: Superfish v1.4.8 jQuery menu plugin by Joel Birch
	* Date Created: 15/03/2010
	* Last Update: 15/03/2010
	*	Source: http://users.tpg.com.au/j_birch/plugins/superfish/
	* Description: Dropdown menu
	*
	*===========================*/

	$('.sf-menu').supersubs({ 
		minWidth:    25, 
		maxWidth:    25,
		extraWidth:  1
		}).superfish({
			autoArrows: false, 
			dropShadows: false,
			speed: 'fast', 
			delay: 0
	});

	/*===========================
	*
	* Pluginname: jquery.prettyPhoto.js
	* Date Created: 07/09/2009
	* Last Update: 07/09/2009
	*	Source: http://www.visionmasterdesigns.com
	* Description: lightbox
	*
	*===========================*/

	$("a[rel^='prettyPhoto']").prettyPhoto({
		theme: 'light_rounded'
	})
	
	/*===========================
	*
	* Library: jquery.tools 1.1.2 - The missing UI library for the Web
	* Date Created: 04/03/2010
	* Last Update: 05/03/2010
	*	Source: link to plugin
	* Description: http://flowplayer.org/tools/index.html
	*
	*===========================*/
	
	$("#browsable").scrollable({
		size: 1,
		clickable: false,
		loop: true				
	}).circular().navigator({
			idPrefix: 's5'
	}).autoscroll({
		autoplay: false,
		autopause: true,
		interval: 5000
	});
	
	// initialize scrollable
	$("div.scrollable-vid").scrollable({
	vertical:true,
	size: 3,
	items: '.artikel',
	nextPage: ".nextPage-vid",
	prevPage: ".prevPage-vid"
	}).mousewheel();
	
	
	/*===========================
	*
	* Library: jQuery Cycle Plugin
	* Date Created: 19/03/2010
	* Last Update: 19/03/2010
	*	Source: link to plugin
	* Description: http://malsup.com/jquery/cycle/
	*
	*===========================*/		

	if ( $('.slider-maschine').length ) {
  	$('.slider-maschine').cycle({
  		fx: 'scrollHorz',
  		speed: 'fast',
  		timeout: 0,
  		prev: '#prev',
  		next: '#next',
  		pager: '.slnavi',
  		activePagerClass: 'active',
  		startingSlide: 0,
  		pause: 1,
  		pagerClick: function(zeroBasedSlideIndex, slideElement){
  			$('.id-punkte a').removeClass('active');
  			$('.id-punkte a:eq(' + zeroBasedSlideIndex + ')').addClass('active');
  		},
  		prevNextClick: function(isNext, zeroBasedSlideIndex, slideElement){
  			$('.id-punkte a').removeClass('active');
  			$('.id-punkte a:eq(' + zeroBasedSlideIndex + ')').addClass('active');
  		},
  		pagerAnchorBuilder: function(idx, slide){
  			return '.slnavi li:eq(' + (idx) + ') a';
  		}
  	});
  	
  	$('.id-punkt:first-child').addClass('active');
  	
  	$('.id-punkt').click(function(){
  		value = $(this).attr('rel');
  		$('.slnavi li:eq(' + value + ') a').trigger('click');
  		$('a', $(this).parent()).removeClass('active');
  		$(this).addClass('active');
  		return false;
  	});
  }

	$("#carousel1").CloudCarousel({
		xPos: 163,
		yPos: -40,
		buttonLeft: $("#left-but"),
		buttonRight: $("#right-but"),
		altBox: $("#alt-text"),
		titleBox: $("#title-text"),
		autoRotate: 'right',
		autoRotateDelay: 2000,
		speed: 0.1,
		reflHeight: 60,
		reflGap: 2,
		xRadius: 500,
		yRadius: 100,
		reflOpacity: 0.7
});
});
