/* Der Uber-banner script */
$(document).ready(function(){
var defaultdisplay = $("#ub-display img").attr("src");
var defaultlink = $("#ub-display").attr("href");
/** For the hover effect of pieces of banner
 *  - in the content, the <a> element parenting the actual <img> element
 *    should be given class 'uberbannerhover'.
 *  - the image which should be shown when hovered over current image, should
 *    have EXACTLY the same path (directory and name and extension),
 *    EXCEPT "_hover" should  be appended to it's name, before the extension.
 *    Like this: normal image name: fred.png
 *               hover image name:  fred_hover.png
 *  - there is no check built in (yet) against missing files, so make sure
 *    you always provide the hover image (like described above)
 */
$(".uberbannerhover img").hover(function(){
		var src = $(this).attr("src").match(/[^\.]+/)+"_hover.png";
		$(this).attr("src",src);
	}, function() {
		var src = $(this).attr("src").replace("_hover","");
		$(this).attr("src",src);
	});
/**
 * For the display in the display area
 * Documentation TODO
 */
/** Switch to default */
$(".ub-switcher-default img").hover(function(){
		$("#ub-display").attr("href",defaultlink);
                $("#ub-display img").attr("src",defaultdisplay);
	}, function(){});
/** Switch to something custom */
$(".ub-switcher img").hover(function(){
		$("#ub-display").attr("href",$(this).parent().attr("href"));
		var src = $(this).attr("src").match(/[^\.]+/)+"_ss.png";
		$("#ub-display img").attr("src",src);
	},function(){});
/**
 * Resetting the banner when hovering out of it's region
 * Documentation TODO
 */
$("#uberbanner").hover(function(){
	},function(){
		//reset
		$("#ub-display").attr("href",defaultlink);
		$("#ub-display img").attr("src",defaultdisplay);
	});
});

