(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

$(document).ready(function(){
	
	jQuery.preLoadImages("fundraiser_over.png", "/img/medien/fundraiser_over.png");
	jQuery.preLoadImages("wiwo_over.png", "/img/medien/wiwo_over.png");
	jQuery.preLoadImages("ntv_over.png", "/img/medien/ntv_over.png");
	jQuery.preLoadImages("caritas_over.png", "/img/medien/caritas_over.png");
	jQuery.preLoadImages("impulse_over.png", "/img/medien/impulse_over.png");
	jQuery.preLoadImages("spiegel_online_over.png", "/img/medien/spiegel_online_over.png");
	jQuery.preLoadImages("tagesspiegel_over.png", "/img/medien/tagesspiegel_over.png");
	jQuery.preLoadImages("welt_online_over.png", "/img/medien/welt_online_over.png");
	
	$("#medien1").hover(function(){
		$(this).attr('src', '/img/medien/fundraiser_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/fundraiser_up.png');
	});
	
	$("#medien2").hover(function(){
		$(this).attr('src', '/img/medien/wiwo_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/wiwo_up.png');
	});
	
	$("#medien3").hover(function(){
		$(this).attr('src', '/img/medien/ntv_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/ntv_up.png');
	});
	
	$("#medien4").hover(function(){
		$(this).attr('src', '/img/medien/caritas_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/caritas_up.png');
	});	
	
	$("#medien5").hover(function(){
		$(this).attr('src', '/img/medien/impulse_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/impulse_up.png');
	});	
	
	$("#medien6").hover(function(){
		$(this).attr('src', '/img/medien/spiegel_online_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/spiegel_online_up.png');
	});	
	
	$("#medien7").hover(function(){
		$(this).attr('src', '/img/medien/tagesspiegel_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/tagesspiegel_up.png');
	});		
	
	$("#medien8").hover(function(){
		$(this).attr('src', '/img/medien/welt_online_over.png');
	}).mouseout(function(){
		$(this).attr('src', '/img/medien/welt_online_up.png');
	});		
});