$(document).ready(function(){
	/*PNG FIX - IE 5 / 5.5 / 6 */
	$(document).pngFix(); 
		
  /*INTERNE LINKS - scrollTo*/
	$('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target
      || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body').animate({scrollTop: targetOffset}, 1000);
       return false;
      }
    }
  });

	/*TOPNAV*/
	$('div#topnav').show();
	$('div#topnav').css({"opacity":"0.2"});
	$('div#topnav').hover(function(){
		$(this).fadeTo("fast",1);
	},function(){
		$(this).fadeTo("fast",0.2);
	});
	
	/*NAVIGATION*/
	$(' ul li a.current').click(function(){
		return false;
	});
	
	/*KONTAKTFORMULAR*/
	$('#contactform').validate({
		event: 'blur',
		rules: {
			message: 	{ required: true },
			name: 		{ required: true, minLength: 3, maxLength: 64 },
			email: 		{ required: true, email: true }
		},
		messages: {
			message: 	{ required: "Feld ist erforderlich."},
			name: 		{ required: "Feld ist erforderlich.", minLength: "Muss min. 3 Zeichen haben.", maxLength: "Darf max. 64 Zeichen haben."},
			email:		{ required: "Feld ist erforderlich.", email: "Bitte eine gültige Email angeben."}
		}
	});
	$('input, textarea').hover(function(){
		$(this).parent().children('label').addClass("hoverinput");
	},function(){
		$(this).parent().children('label').removeClass("hoverinput");
	});
	
	$('input, textarea').focus(function(){
		$(this).parent().children('label').addClass("focusinput");
	});
	$('input, textarea').blur(function(){
		$(this).parent().children('label').removeClass("focusinput");
	});
});
