$(document).ready(function() {
	
  /*TopLink*/
 $(document).ready(function() {
     $('a.totop').click(function(){
     $('html, body').animate({scrollTop: '0px'}, 600);
     return false;
   });
 });
   
  /*Img Alpha Function for Fancy*/
  $('a.zoom img').hover(function(){
	  $(this).stop().animate({ opacity: '0.7' } , '100');
  } , function(){
	  $(this).stop().animate({ opacity: '1'} , '100');
  });



  
  /*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*/
 
 
   /*Fancybox*/
  $("a.zoom").fancybox({
		'titlePosition'		: 'outside',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.9,
		'opacity'		: true,
		'overlayShow'	: false,
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade'
   });
   /*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*/
  
});
