(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);


var numImages = 3;
var currentImage = 1;

$(document).ready(function() {
  $("#img1").css("display", "block");
  var imageInterval = setInterval("switchBild()", 3000);
});




function switchBild()
  {
    
    $("#img" + currentImage).customFadeOut("normal", function() {
      if (currentImage >= numImages)
      {
              currentImage = 0;
      }
      $("#img" + (currentImage + 1) ).customFadeIn("normal", function() {
              currentImage++;
      });
    });   
  }



/*
function ChangeBild(was)
  {
    neues_bild = "../../fileadmin/img/startseite/startseite_"+was+".png";
    document.getElementById("bild_startseite").src = neues_bild;

  }
*/

