$(function(){
	$('img[hover],input[hover]').imghover();

	$('#answers li a.answer_text span.details').hide();
	$('#answers li a.uitleg').click(function(){
		var a_uitleg = $(this);
		if (a_uitleg.hasClass('uitleg_open')) {
			a_uitleg.parent().find('span.details').slideUp('fast',function(){
				a_uitleg.removeClass('uitleg_open');
			});
		} else {
			a_uitleg.next().find('span.details').slideDown('fast',function(){
				a_uitleg.addClass('uitleg_open');
			});
		}
		return false;
	});

	// Fix column width for IE6 on answers-page
	if ($.browser.msie && $.browser.version < 7) {
		if ($('#answers').length>0) {
			$('#outerContentCon').css('width','auto');
		}
	}
});

;(function($){

	$.fn.pngfix = function () {	
		if ($.browser.msie && $.browser.version < 7) {
			return this.each (function () {
				$(this).css({
					filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.src+"')"
				});
				this.src = 'images/blank.gif';
			});
		} else {
			return this;
		}
	};

	$.prefetch = function () {
		for (var i=0; i<arguments.length; i++)  {
			$('<img>').attr('src', arguments[i]);
		}
	}

	$.fn.imghover = function () {
		return this.each (function () {
			$(this).data('__img__original', this.src);
			$.prefetch($(this).attr('hover'));
		}).hover(function(){
			this.src = $(this).attr('hover');
		},function(){
			this.src = $(this).data('__img__original');
		});
	};

})(jQuery);