$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_square'});
	$('#success').hide();
	$('#error').hide();
	banner_buttons();   
	slideshow_control();   
	go_top();
	portfolio_zoom();
	
	$(".activefocus").focus(function () {
			if ($(this).attr("value") == $(this).attr("defaultValue")) {
					$(this).attr("value", '');
			}

	});

	$(".activefocus").blur(function () {
			if ($(this).attr("value") == '') {
					$(this).attr("value", $(this).attr("defaultValue"));
			}

	});
	
	
	$("h3.toggler").click(function(){
		$(this).toggleClass("active").next(".toggle_container").slideToggle("fast");
	});
	
	$(".tab_content").hide();
	$("ul.tabs li:first").addClass("active").show();
	$(".tab_content:first").show(); 
	
	$("ul.tabs li").click(function() {
	
		$("ul.tabs li").removeClass("active");
		$(".tab_content").hide(); 
		$(this).addClass("active"); 
		var tabNum = ($(this).find("a").attr("href")).replace('#tab', '');
		$(this).parent().next().find("div:nth-child(" + tabNum + ")").fadeIn();

		return false;
	});


	
	$(".footer_social_network ul li").fadeTo('normal', 0.4);
	$(".footer_social_network ul li").hover(function(){
		$(this).fadeTo('normal', 1);
	}, function() {
		$(this).fadeTo('normal', 0.4);
	});
	
});

/* Banner Button Effect */
function banner_buttons(){
	$('#recentimages li').append('<div class="hover"></div>');  
	$('#recentimages li').hover(  
		function() {  
			$(this).children('div').fadeIn('500');   
		},   
		function() {  
			$(this).children('div').fadeOut('500');      
		}).click(function () {
			$('#recentimages li').removeClass('selected');
			$(this).addClass('selected');
			return false;
		});

	$('#recentimages_details li').append('<div class="hover_details"></div>');  
	$('#recentimages_details li').hover(  
		function() {  
			$(this).children('div').fadeIn('500');   
		},   
		function() {  
			$(this).children('div').fadeOut('500');      
		}).click(function () {
			$('#recentimages_details li').removeClass('selected');
			$(this).addClass('selected');
			return false;
		});

}

function portfolio_zoom(){

	$('.site_box_anime').hover(function(){
		$(".site_zoom", this).fadeIn('500');
	
	}, function() {
		$(".site_zoom", this).fadeOut('500');
	});
}


/* Slide show play & pause */
function slideshow_control(){
	$('#slideshow').hover(  
		function() {
			jQuery('#slideshow').cycle('pause')
		},   
		function() {  
		 	jQuery('#slideshow').cycle('resume')
	});
	$('#slideshow_details').hover(  
		function() {
			jQuery('#slideshow_details').cycle('pause')
		},   
		function() {  
		 	jQuery('#slideshow_details').cycle('resume')
	});
}


function go_top(){
	$('a[href^=#respond]').bind("click", function(event) {
        event.preventDefault();
        var ziel = $(this).attr("href");

        $('html,body').animate({
                scrollTop: $(ziel).offset().top
        }, 500);
        return false;
    });	
	
	$('a[href^=#top]').bind("click", function() {
        $('html,body').animate({
                scrollTop: 0
		}, 500);
        return false;
    });	
}

