$(document).ready(function() {
	
	/*Aktiver Navigationspunkt*/
	var pathname = window.location.pathname;
	
    $('ul.menu li a').each(function(){
        var name = $(this).attr('href');
        if(pathname.indexOf(name) != -1) {
            $(this).css('background-color', '#c33333');
            $(this).css('color', '#fff');
        }
    });


    $('ul.menu li a').mouseover(function(){
        var name = $(this).attr('href');
        if(pathname.indexOf(name) == -1) {
            $(this).animate({
                backgroundColor: '#c4c4c4', color:'#fff'
            }, 'fast');
        }
    });
    $('ul.menu li a').mouseout(function(){
        var name = $(this).attr('href');
        if(pathname.indexOf(name) == -1) {
            $(this).animate({
                backgroundColor: '#d9d9d9', color:'#444444'
            }, 'fast');
        }
    });

	
	
  
  /*Fancybox*/
  $("a.zoom").fancybox({
		'titlePosition'		: 'outside',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9,
		'opacity'		: true,
		'overlayShow'	: false,
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade'
   });
   /*end*/
   
  /*Img Alpha Function for Fancy*/
  $('a.zoom img').hover(function(){
	  $(this).stop().animate({ opacity: '0.7' } , '100');
  } , function(){
	  $(this).stop().animate({ opacity: '1'} , '100');
  });
  	
  
  /*Accordion*/
  $("#accordion").accordion({autoHeight:false, active: 0});
  var active = $( ".selector" ).accordion( "option", "active" );
  /*end*/
  
  
  /*Formular Felder Select Function*/
   $("#kontaktform input, textarea").click(function () {   
		  var aktinp=$(this).attr('name');
		  $("#kontaktform input, textarea").each(function () {
				  $(this).removeClass("inpstyle"); 
				  
			   if($(this).attr('name')==aktinp ){    
						if( !$(this).hasClass("inpstyle") ) {
						   $(this).addClass("inpstyle"); 
						}
			   }   
		  });

 });
 /*end*/
 
 
 /*Formular Fancybox*/
 $(document).ready(function() {
			$("#sub-form").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'fade',
				'transitionOut'	: 'fade'
			});
			
	});
	/*end*/
 
   /*Formular Pflichtfeld Checker*/
	function CheckAllRequiredInputs()
	{
	var requiredInput = $(".required");
	var NoError = true;
	for(var i=0; i<requiredInput.length; i++)
	{
	if(requiredInput[i].value == "")
	{
						 
	$("#error").show();
	requiredInput[i].style.border = "1px solid red"; 
	NoError = false;
	
	}
	else //Wenn alles ausgefüllt
	{
	$("#error").hide(); //Element mit der ID "error" ausblenden
	requiredInput[i].removeAttribute("style"); //Roten rand entfernen
	}
	}
	
	return NoError;
	}
	/*end*/
  
});
