/**
 * jQuery rollover plugin v1.0
 *
 * rollover the images that you hover and have current URL not to rollover.
 * http://www.miyagino.net/my/jquery-rollover/
 *
 * The rollover original source is as follows.
 * http://rewish.org/javascript/jquery_rollover
 *
 * This plugin is required jQuery version 1.3 or newer.
 *
 * This is under both MIT and GPL Lisences (same as jQuery).
 *
 * 2009 (c) Kazuo Kohchi <kohchi@miyagino.net>, All Rights Reserved.
 */

(function($) {
	$.fn.rollover = function(opts) {
		var default_opts = { current : '', on : '_on.' };
		var icache = new Array();

		opts = $.extend(default_opts, opts || {});

		var image_name = function(src) {
			var m = src.match(/(.+)\.([^\.]+)$/);
			return m[1] + opts.on + m[2];
		}

		var set_current = function(o) {
			if (o.length != 0) {
				var cimg = (o.children())[0];
				cimg.src = image_name(cimg.src);
			}
		}

		set_current(this.parent("a[href=" + opts.current + "]"));

		return this.not("[src*=" + opts.on + "]").each(function(i) {
			var imgsrc = this.src;
			var imgsrc_on = image_name(this.src);

			icache[i] = new Image();
			icache[i].src = imgsrc_on;
			$(this).hover(
				function() { this.src = imgsrc_on; },
				function() { this.src = imgsrc; }
			);
		});
	}
})(jQuery);
$(document).ready(function() {
	$(".newsG #nav-news a img").rollover({current : '/news/'});
	$(".aboutG #nav-about a img").rollover({current : '/about/'});
	$(".activitiesG #nav-activities a img").rollover({current : '/activities/'});
	$(".membershipG #nav-membership a img").rollover({current : '/membership/'});
	$(".supportG #nav-support a img").rollover({current : '/support/'});
	$(".scholarshipG #nav-scholarship a img").rollover({current : '/scholarship/'});
	$("#home-contact a img,#home-nav a img,#home-footer a img,#nav img,#head-contact a img,#footer a img,#topcontrol img,.back a img,form .submit input:image,.submit img").rollover();
});


