
     $.fn.autoScroll= function(destination) {
	        var dest = $(destination).offset().top;
	        jQuery(this).show(1, function() {
				$("html:not(:animated),body:not(:animated)").animate({scrollTop: dest}, 1000);
			});
			return false;
	 };


  $(document).ready(function() {
							 
							 
					$('span.toplink').click(function(){ 		 
					   $('html, body').animate({scrollTop:0}, 700); 		 
		            });
							 
							 
              
					$('div#fade').innerfade({
						speed: 1700,
						timeout: 5000,
						type: 'sequence',
						containerheight: '220px'
					});
					
					
										 
							 
							 
		    	
    $('a.links').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " - ",
		fade: 250
	});
	
	$('span.toplink').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " - ",
		fade: 250
	});
	

							 
     $("a[rel^='prettyPhoto']").prettyPhoto();							 

       
     $('span.more').click(function () {
		 var next = $(this).parent().next();
         if ($(next).is(":hidden")) {
            $(next).slideDown(500);
		    $(this).html('ausblenden');
 		    $(next).autoScroll(next.prev());
			$(this).css('background-image','url(images/hide.png)');


		 }else {
           $(next).slideUp(500);		   
		   $(this).html('anzeigen');
		   $(this).css('background-image','url(images/add.png)');
		 }
		 return false;

     });	 
	
  });
  
   $(function() {
	  $('#container-1').tabs({ fxFade: true, fxSpeed: 'slow' });
      $('#container-2').tabs({ fxFade: true, fxSpeed: 'slow' });
	  $('#container-3').tabs({ fxFade: true, fxSpeed: 'slow' });
	  $('#container-4').tabs({ fxFade: true, fxSpeed: 'slow' });
	  return false;
   });
   
   	jQuery(function() {
		// show a simple loading indicator
		var loader = jQuery('<div id="loader"><img src="images/loading.gif" alt="loading..." /></div>')
			/*.css({position: "absolute", top: "400px", left: "400px;"})*/
			.appendTo("#form").hide();
		jQuery().ajaxStart(function() {
			loader.show();
			/*$("#submitbutton").hide();*/
		}).ajaxStop(function() {
			loader.hide();	
			/*$("#submitbutton").show();*/
				
           

		}).ajaxError(function(a, b, e) {
			throw e;
		});
		
		var v = jQuery("#form").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({target: "#result"});
			    $('<div id="result"></div>')
	              .insertAfter( $('#submitbutton') )
				  .fadeIn('slow')
	              .animate({opacity: 1.0}, 5000)
	              .fadeOut('slow', function() {
            	  $(this).remove();
              	});
				 v.resetForm();
				return false;
			}
		});
		
		jQuery("#reset").click(function() {
			v.resetForm();
		});
	});	


