// DannyDiablo.de v2 jQuery Functions ( Daniel Knaack - http://www.dannydiablo.de )

// jQuery Functions [ BEGIN ]
$(document).ready(function(){

	// Carousel [ START ]
	function formatText(index, panel) {
		  return index + "";
	    }
        $(function () {
            $('.carousel').anythingSlider({
                easing: "easeInOutExpo",
                autoPlay: true,
                delay: 4000,
                startStopped: false,
                animationTime: 700,
                hashTags: false,
                buildNavigation: true,
        		pauseOnHover: true,
        		startText: "Go",
		        stopText: "Stop",
		        navigationFormatter: formatText
            });
        });
	// Carousel [ STOP ]

	// Slider [ START ]
	function formatText(index, panel) {
		  return index + "";
	    }
        $(function () {
            $('.slider').anythingSlider({
                easing: "easeInOutBack",
                autoPlay: true,
                delay: 2600,
                startStopped: false,
                animationTime: 500,
                hashTags: false,
                buildNavigation: false,
        		pauseOnHover: true,
        		startText: "Go",
		        stopText: "Stop",
		        navigationFormatter: null
            });
        });
	// Slider [ STOP ]

	// Anchor Sliding [ START ]
	$('.btn-up a, .btn-down a, #end div a, #btn-contact a').smoothScroll({
		afterScroll: function() {
		}
	});
	// Anchor Sliding [ STOP ]

	// Button Fading [ START ]
	$('.fade').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
			$(this).hover(function () {
				$span.stop().fadeTo(600, 1);
			}, function () {
				$span.stop().fadeTo(600, 0);
		});
		$('.fade > .hover').empty();
	})
	// Button Fading [ STOP ]
	
	// Fading [ START ]
	$("#intro #btn-contact, #contact .submit").fadeTo("slow", 0.5);
	$("#intro #btn-contact, #contact .submit").hover(function(){
		$(this).fadeTo("slow", 1.0);
	},function(){
		$(this).fadeTo("slow", 0.5);
	});
	$("#text-6 li, #text-5 li").fadeTo("slow", 0.6);
	$("#text-6 li, #text-5 li").hover(function(){
		$(this).fadeTo("slow", 1.0);
	},function(){
		$(this).fadeTo("slow", 0.6);
	});
	$("#contact input, #contact textarea").fadeTo("slow", 0.7);
	$("#contact input, #contact textarea").hover(function(){
		$(this).fadeTo("slow", 1.0);
	},function(){
		$(this).fadeTo("slow", 0.7);
	});
	$("#end").fadeTo("slow", 0.4);
	$("#end").hover(function(){
		$(this).fadeTo("slow", 1.0);
	},function(){
		$(this).fadeTo("slow", 0.4);
	});
	$(".img-large a span, .thumbnails li a span").fadeTo("slow", 0.0);
	$(".img-large a span, .thumbnails li a span").hover(function(){
		$(this).fadeTo("slow", 1.0);
	},function(){
		$(this).fadeTo("slow", 0.0);
	});
	// Fading [ STOP ]
	
	// Clickable Blocks [ START ]
	$("#text-5 li").click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});
	// Clickable Blocks [ STOP ]
	
	// Tooltips [ START ]
	$("#end div a, #btn-contact a, #text-6 li a, .submit input, .btn-up a, .btn-down a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-48"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-68"}, "fast");
	});
	$("#design .navbtn a, #mockups .navbtn a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "36"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "55"}, "fast");
	});
	$(".info abbr").append("<em></em>");
	$(".info abbr").hover(function() {
		$(this).find("em").animate({opacity: "show", top: "-92"}, "slow");
		var hoverText = $(this).attr("title");
	    $(this).find("em").text(hoverText);
	}, function() {
		$(this).find("em").animate({opacity: "hide", top: "-80"}, "fast");
	});
	// Tooltips [ STOP ]
	
	// FancyBox [ START ]
	$("a.getfancy").fancybox({
		'titleShow'			: true,
		'titlePosition'		: 'over',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'easingIn'			: 'easeOutBack',
		'easingOut'			: 'easeInBack',
		'autoScale'			: false,
		'hideOnOverlayClick' : true,
		'hideOnContentClick' : true,
		'speedIn'			: '500',
		'speedOut'			: '500',
		'opacity'			: true,
		'overlayColor'		: '#000',
		'overlayOpacity'	: '0.5'
	});
	// FancyBox [ STOP ]
	
	// Auto-Resize [ START ]
	$('textarea#msg').autoResize({
    onResize : function() {
        $(this).css({opacity:0.8});
    },
    animateCallback : function() {
        $(this).css({opacity:0.9});
    },
    animateDuration : 150,
	limit: 270,
    extraSpace : 17
	});
	// Auto-Resize [ STOP ]

});
// jQuery Functions [ END ]

/* ############# jQuery Credits ############
Yes fellas, Photoshop-Punks are needing help, too. Thanks for the jQuery Plugins to these great Developers and Websites:
- jQuery DevTeam ( http://jquery.com/ )
- AnythingSlider by Chris Coyier ( http://css-tricks.com/anythingslider-jquery-plugin/ )
- FancyBox by Janis Skarnelis ( http://www.fancybox.net/ )
- jQuery Tutorials for Designers by WebDesignerWall ( http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/ )
- Animated Scrolling by Karl Swedberg ( http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links )
- AutoResize by James Padolsey ( http://james.padolsey.com/javascript/jquery-plugin-autoresize/ )
*/
