$(document).ready(function() {
	$.featureList(
		$("#tabs li a"),
		$("#output li"), {
			start_item	:	0
		}
	);
	$("label").inFieldLabels();
	
	if (!$.browser.msie)
	{
		if (window.location.pathname == "/")
		{
			$('#logo').hide().fadeIn(2000,'easeInCirc');
		}
		$('#logo').hover(function() {$(this).stop().fadeTo('slow', 0.5)},function() {$(this).stop().fadeTo('slow', 1)});
	}
	
	$('.miniprojekt').fadeTo('fast', 0.5).hover(function() {$(this).stop().fadeTo('slow', 1)},function() {$(this).stop().fadeTo('slow', 0.5)}).css({'cursor' : 'pointer'});
	
	$('#rightcontact').append('<p><input type="submit" value="senden" class="submit"></p>');
	$('#javascript').remove();
	$(".submit").click(function() 
	{  
		//pflicht:
    	var name = $("input#name").val();  
    	var nachricht = $("textarea#nachricht").val(); 
    	var email = $("input#email").val(); 
    	//optional:
    	var tel = $("input#tel").val(); 
    	var www = $("input#www").val(); 
    	
        if (nachricht == "") 
        {  
       		$("textarea#nachricht").focus();  
       		$("textarea#nachricht").css("background-position", "-1500px 0").css("border", "1px solid #cf3232");
       		return false;  
     	} 
        if (name == "") 
        {
       		$("input#name").focus();  
       		$("input#name").css("background-position", "-1500px 0").css("border", "1px solid #cf3232");
       		return false;  
     	}  
        if (email == "") 
        {  
       		$("input#email").focus();  
       		$("input#email").css("background-position", "-1500px 0").css("border", "1px solid #cf3232");
       		return false;  
     	}    
     	
     	var dataString = 'form=kontakt&name=' + name + '&email=' + email + '&nachricht=' + nachricht + '&tel=' + tel + '&www=' + www;  
		$.ajax(
		{  
			type: "POST",  
		    url: "ajax.php",  
		   	data: dataString,  
		   	success: function() 
		   	{  
		     	$('form').fadeTo("slow",0);  
		     	$('#message').html("Vielen Dank für Ihre Nachricht!<br> Ich werde Ihre Anfrage schnellstmöglich beantworten.").fadeIn("slow");
		   	}  
		});  
		return false; 
    });  
    
    
    // Sprite der Navigation:
    		   $('#navi li a').append('<span class="hover"></span>')
		   
		   $('#navi li a').hover(function() {
	        
		// Stuff that happens when you hover on + the stop()
		$('.hover', this).stop().animate({
			'opacity': 1
			}, 700,'easeOutSine')
	
	},function() {
	
		// Stuff that happens when you unhover + the stop()
		$('.hover', this).stop().animate({
			'opacity': 0
			}, 700, 'easeOutQuad')
	
	})
	
	// FancyBox
	
	$("a.miniprojekt").fancybox();
	
	/* Using custom settings */
	
	$("a.miniprojekt").fancybox({
		'hideOnContentClick': true,
		'padding'			: 0,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'speedIn'			: 300, 
		'speedOut'			: 300, 
		'overlayShow'		: false

	});

});
