/**
* Rollover effect, changes element's src attribute on hover, e.g.:
*
* image.png?foo=bar => image_h.png?foo=bar
*
* Pass true to preload images.
*/
jQuery.fn.rollover = function(preload) {
    this.filter(':not([src*="_h."])').each(function() {
		var a = $(this).attr('src');
		var b;
// 		alert(src);
		// determine and save image names
		if (a.indexOf('blank.gif') > -1) { // pngiefix in IE 6
// 			alert($(this).css('filter'));
			var f = $(this).attr("filters");
			f = f["DXImageTransform.Microsoft.AlphaImageLoader"];
// 			for (var i in f)
// 				{alert(i);}
// 			alert(f.src);
			a = f.src;
			if (a.indexOf("_h.") > -1) return;
			b = a.replace(/\.(\w+(\?[^$]*)?)$/, '_h.$1');
			
			$(this)
				.mouseover(function(){
					$(this).css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+b+'", sizingMethod="scale")');
				})
				.mouseout(function(){
					$(this).css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'", sizingMethod="scale")');
				});
				
		} else {
			b = a.replace(/\.(\w+(\?[^$]*)?)$/, '_h.$1');
			$(this)
				.mouseover(function(){
					$(this).attr('src', b);
				})
				.mouseout(function(){
					$(this).attr('src', a);
				});
		}
		
		if (preload) {
           	var i = new Image;
           	i.src = b;
        }
    });
    return this;
};