$(document).ready(function(){
	/**********************************************************/
	/*                Starte Sliding im Header                */
	/**********************************************************/
	var num = $("div.scrollable .csc-default").length;
	if(num == 1){
		$("a.browse").hide();
	} else {
		$("div.scrollable").scrollable({
			/* Wieviele sollen nebeneinander angezeigt werden?*/						   
			size: 1,	
			/* Klick in den Header für nächstes Bild? */
			clickable: false,
			/* Animation - siehe jQuery.easing */
			easing: "easeInOutExpo",
			/* Erlaube Tastatureingabe für Bildwechsel? */
			keyboard: false,
			/* Start von vorne nach dem letzten Bild? */
			loop: true,
			/* Geschwindigkeit */
			speed: 700
		}).navigator();
	}
	
	
	/**********************************************************/
	/*             Sliding Box für den Content                */
	/**********************************************************/
	//Horizontal Sliding
	$('#main .boxgrid.slideright').hover(function(){
		$(".csc-textpic-text", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".csc-textpic-text", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	$('#main .boxgrid.slideleft').hover(function(){
		$(".csc-textpic-text", this).stop().animate({left:'-325px'},{queue:false,duration:300});
	}, function() {
		$(".csc-textpic-text", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	$('#main .boxgrid.slidebottom').hover(function(){
		$(".csc-textpic-text", this).stop().animate({top:'100px'},{queue:false,duration:160});
	}, function() {
		$(".csc-textpic-text", this).stop().animate({top:'0px'},{queue:false,duration:160});
	});
	//Caption Sliding (Partially Hidden to Visible)
	$('#main .boxgrid.caption').hover(function(){
		$(".csc-textpic-text", this).stop().animate({top:'0px'},{queue:false,duration:160});
	}, function() {
		$(".csc-textpic-text", this).stop().animate({top:'65px'},{queue:false,duration:160});
	});
	
	
	/**********************************************************/
	/*              Sliding Boxes für den Header              */
	/**********************************************************/
	//Caption Sliding (Partially Hidden to Visible)
	$('#header .boxgrid.caption').hover(function(){
		$(".csc-textpic-text", this).stop().animate({top:'-20px'},{queue:false,duration:160});
	}, function() {
		$(".csc-textpic-text", this).stop().animate({top:'223px'},{queue:false,duration:160});
	});
	
	
	/**********************************************************/
	/*                       Tooltips                         */
	/**********************************************************/
	/* Tooltips für Servicenavigation */
	$("#service a[title]").tooltip({
		tip: '#demotip',
		effect: 'slide',
		position: 'top center',
		opacity: 0.9
	});
	 /* Tooltips für alle Absätze des Contentbereichs */
	$("#main_middle p a[title]").tooltip({
		tip: '#demotip',
		effect: 'slide',
		position: 'top center',
		opacity: 0.9
	});
	$("#main_middle ul a[title]").tooltip({
		tip: '#demotip',
		effect: 'slide',
		position: 'top center',
		opacity: 0.9
	});
	 /* Tooltips für Empfehlen und Drucken */
	$("#tip-print a[title]").tooltip({
		tip: '#demotip',
		effect: 'slide',
		position: 'top center',
		opacity: 0.9
	});
	
	
	/**********************************************************/
	/*                       Dropdown                         */
	/**********************************************************/
	$('ul.sub-navigation').parent().append(""); //Only shows drop down trigger when js is enabled – Adds empty span tag after ul.subnav
	$('ul.main-navigation li span').hover(function() { //When trigger is clicked…
	//Following events are applied to the subnav itself (moving subnav up and down)
	$(this).parent().find('ul.sub-navigation').stop(true, true).slideDown({duration: 500, easing: 'easeOutExpo'}).show(); //Drop down the subnav on click
	$(this).parent().hover(function() {}, function(){
			$(this).parent().find('ul.sub-navigation').slideUp({duration: 500, easing: 'easeOutExpo'}); //When the mouse hovers out of the subnav, move it back up
		});
		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass('subhover'); //On hover over, add class “subhover”
		}, function(){ //On Hover Out
			$(this).removeClass('subhover'); //On hover out, remove class “subhover”
	});
	//$("ul.main-navigation li:first").addClass("alpha");
	
	
	/**********************************************************/
	/*                       Lightbox                         */
	/**********************************************************/
	$(".lightbox").lightbox({
		navbarOnTop: 0, 
		resizeSpeed: 300, 
		overlayOpacity: 0.8,
		strings : { 
			prevLinkTitle: "vorheriges Bild", 
			nextLinkTitle: "n&auml;chstes Bild", 
			prevLinkText:  "&laquo;&nbsp;&nbsp;", 
			nextLinkText:  "&nbsp;&nbsp;&raquo;",
			closeTitle: "schlie&szlig;en", 
			image: "Bild", 
			of: "von"
		}
	});
	
	
	/**********************************************************/
	/*                       Twitter                          */
	/**********************************************************/
	$(document).ready(function() {
		$("#twitter").getTwitter({
			userName: "1601com",
			numTweets: 2,
			loaderText: "Loading tweets...",
			slideIn: true,
			showHeading: true,
			headingText: "",
			showProfileLink: true
		});
	});
});