$(function(){

	//PrÃ©chargement des images (pour Ã©viter le scintillement des roll-over
	preload();

	//Cette fonction permet aux icones des articles (dans 'accueil' et dans 'textes') de changer sans que l'action ne se dÃ©clence au passage de la ligne 'p' toute entiÃšre.
	$('#rechts .text-inhalt #liste_textes a, #rechts .entrance-column a').hover(function(){
		$(this).parent("p").css("background-image","url('/static/img/icon_article_h.jpg')");
	},function(){
		$(this).parent("p").css("background-image","url('/static/img/icon_article.jpg')");
	});
});


//Fonction de PrÃ©chargement
function preload(){
    (function($) {
      var cache = [];
      $.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)

	jQuery.preLoadImages("/static/img/fleche_links_h.jpg","/static/img/fleche_rechts_h.jpg","/static/img/icon_article_h.jpg","/static/img/icon_blog_h.jpg","/static/img/icon_fb_h.jpg","/static/img/icon_mail_h.jpg","/static/img/icon_tel_h.jpg","/static/img/icon_twitter_h.jpg");	
}
//

$('.wechsel').mouseover(function() {
		var speed = 100;
		var distance = 100;
		var thumb = $(this);
			thumb.x = 0;
		window.t = window.setInterval(function() {
			if (thumb.x == -1200){
				thumb.css('backgroundPosition',  (0) + 'px 0');
			return }
			thumb.x -= distance;
			thumb.css('backgroundPosition',  (thumb.x) + 'px 0');
		}, speed);	
		
	}).mouseout(function() {
		window.clearInterval(window.t);
		$(this).css( {backgroundPosition: "0 0"} );
	});


