(function($){
	$(document).ready(function(){
		
		// Droppy
		$('#mainnav ul#nav').droppy();
		
		// Last
		$('#metanav li:nth-child(5)').addClass('last');
		$('#metanav li:last-child').addClass('last');
		$('#hersteller li:last-child').addClass('last');
		// $('.news ul li:last-child').addClass('last');
		$('#breadcrumb a:last-child').addClass('last');		

		// News
		$(".showBlog").click(function () {
			$("div.twitterPanel").hide();
			$("div.blogPanel").show();
			$(".showBlog").addClass("selected");
			$(".showTwitter").removeClass("selected");
		});

		$(".showTwitter").click(function () {
			$("div.blogPanel").hide();
			$("div.twitterPanel").show();
			$(".showTwitter").addClass("selected");
			$(".showBlog").removeClass("selected");
		});
		

		$("#twitter").getTwitter({
			userName: "buerocenter",
			numTweets: 3,
			loaderText: "Lade tweets...",
			slideIn: false,
			slideDuration: 750,
			showHeading: false,
			headingText: "Latest Tweets",
			showProfileLink: false,
			showTimestamp: false
		});
		
		
		// Search-Box: Value leeren onfocus
	  $("#ajaxSearch_input").focus(function () {
			$(this).attr("value","");
	  });
	  $("#ajaxSearch_input").blur(function () {
			$(this).attr("value","Suchbegriff eingeben");
	  });
	

		// Search-Box: Button-Mouse-Over
		$("#ajaxSearch_submit").mouseover(function () {
			$(this).attr("src","images/btn_search_mo.gif");
	  });
		$("#ajaxSearch_submit").mouseout(function () {
			$(this).attr("src","images/btn_search.gif");
	  });

		// Photo Zoom
		$('#slideshow img').hover(
			function(){
				var $this = $(this);
				$this.stop().animate({'duration':'10','opacity':'1.0','height':'91px','width':'134px','top':'-0px','left':'-0px'},"fast");
			},
			function(){
				var $this = $(this);
				$this.stop().animate({'duration':'10','opacity':'1.0','height':'182px','width':'268px','top':'-45px','left':'-65px'},"fast");
			}
		);
		
		// Colorbox
	  $(".zoom").colorbox({
			opacity: 0.75,
			close: ""
		});
		
		$(".map").colorbox({
			transition:'none', 
			innerWidth: "655", 
			innerHeight: "500", 
			iframe: true,
			close: ""
		});
		
		$(".video").colorbox({
			transition:'none',
			innerWidth: '800',
			innerHeight: '600',
			iframe: true,
			close: ""
		});
	
	
	
	  // Cycle
		$('#slideshow').cycle({ 
		    fx:     'scrollHorz', 
		    speed:   800, 
		    timeout: 0, 
		    next:   '.nextSlide',
		 		prev:   '.prevSlide', 
		    pause:   0,
    		cleartype: true, 
        cleartypeNoBg: true 
		});
		
		$('.page1').click(function() { 
			$('#slideshow').cycle(0); 
			return false; 
		}); 

		$('.page2').click(function() { 
			$('#slideshow').cycle(1); 
			return false; 
		});
		
		$('.page3').click(function() { 
			$('#slideshow').cycle(2); 
			return false; 
		});
		
		$("#pager a").click(function () {
			$("#pager li").removeClass("selected");
			$(this).parent("li").addClass("selected");
		});		
		
		// ImgHover
		$(".hover").imghover({suffix: "_hover"});
		$(".btn").imghover({suffix: "_hover"});
		

	});
})(jQuery);
