/* default jInit */
$(function(){

	/* accordion */
	if ( $('#accordion').length ) {

		$("#accordion").accordion({
			autoHeight: false,
			collapsible: true,
			header: "h2",
			navigation: true
		});
		/* close the first too... */
		$("#accordion h2:first").click();
		 /* ... und nur wech von hier */
		$("#Schnellsuche").focus();
		$("#accordion h2:first").removeClass("ui-state-focus");
	}

	/* jeden 3|5ten thumb versilbern */	
	if ( $('DIV.thumbnails').length ) { 
		$("#SpalteInhalt DIV.thumbnails DIV.thumb:nth-child(3n)").addClass("last-in-row").after('<br class="clear" />');
		$("#SpalteInhaltBreit DIV.thumbnails DIV.thumb:nth-child(5n)").addClass("last-in-row").after('<br class="clear" />');
	}

	/* FancyBox  */
	if ( $('a[rel=FancyBox]').length ) { 
		$("a[rel=FancyBox]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'	: 'none',
			'titleShow'			: 'true',
			'titlePosition' 	: 'inside'
		});
	}

	/* ui-slider */
	if ( $('.Bilderleisten > ul').length ) { 
		var ul = $('.Bilderleisten > ul');
		 $('.slider').slider({
			range: false,
			min: 0, 
			max: ul.width(), 
			change: function(event, ui) {
				ul.css('margin-left', '-' + ui.value + 'px');
			}
		});
	}

});

