/*
 * Initialization
 */
$.swap2 = {
	init: function() {
		for (module in $.swap2) {
			if ($.swap2[module].init)
				$.swap2[module].init();
		}
	}
};
$(document).ready($.swap2.init);

/*
 * Mouse hover
 */
$.swap2.hover = {
	init: function() {
		$('IMG.hover, IMG.hover1')
			.bind('mouseover', this.enter)
			.bind('mouseout', this.exit)
			.each(this.preload);
	},
	preload: function() {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},
	enter: function() {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},
	exit: function() {
		this.src = this.src.replace(/^(.+)_over(\.[a-z]+)$/, "$1$2");
	}
};

/* 
 * dropmenu
 */
$.swap2.drop = {
	init: function() {
		$(".drop")
			.bind('mouseover', this.dropon)
			.bind('mouseout', this.dropoff)
			.each(this.dropload);
	},
	dropload: function() {
		$(".dropmenu").hide();
	},
	dropon: function() {
		$(".dropmenu").toggle();
	},
	dropoff: function() {
		$(".dropmenu").toggle();
	}
};
