$(document).ready(function() {
	$("#navigation ul").children("li").each(function() {
		$(this).children("a").css({backgroundImage:"none"});
	});
	function attachNavEvents(parent, myClass) {
		$(parent + " ." + myClass + "-link").mouseover(function() {
			$(this).before('<div class="nav-hover ' + myClass + '-hover"></div>');
			$("div.nav-hover").css({display:"none"}).fadeIn(200);
		}).mouseout(function() {
			$("div." + myClass + "-hover").fadeOut(200, function() {
				$(this).remove();
			});
		});
	}
	attachNavEvents("#navigation", "home");
	attachNavEvents("#navigation", "news-events");
	attachNavEvents("#navigation", "kids-zone");
	attachNavEvents("#navigation", "mums-dads");
	attachNavEvents("#navigation", "contact");
});


/*
 *	jQuery Timer plugin v0.1
 *		Matt Schmidt [http://www.mattptr.net]
 *
 *	Licensed under the BSD License:
 *		http://mattptr.net/license/license.txt
 */
 
 jQuery.timer = function (interval, callback)
 {
	var interval = interval || 100;

	if (!callback)
		return false;
	
	_timer = function (interval, callback) {
		this.stop = function () {
			clearInterval(self.id);
		};
		
		this.internalCallback = function () {
			callback(self);
		};
		
		this.reset = function (val) {
			if (self.id)
				clearInterval(self.id);
			
			var val = val || 100;
			this.id = setInterval(this.internalCallback, val);
		};
		
		this.interval = interval;
		this.id = setInterval(this.internalCallback, this.interval);
		
		var self = this;
	};
	
	return new _timer(interval, callback);
 };


$(document).ready(function(){
	var currentitem = 0;
	var itemcount = $("#image_scroller").children().size();
	switchfeature(0, false);
	function switchfeature(index, fade) {
		if (index >= itemcount) {
			index = 0;
		}
		if(fade==true) {
			$("#image_scroller li").eq(index).css({left:"-100%"}).show().animate({left:"0%"}, 200).end()
			.not($("#image_scroller li").eq(index)).fadeOut(300);
		} else {
			$("#image_scroller li").hide().eq(index).show();
		};
		currentitem = index;
	}
	
	$.timer(3000, function (timer) {
  		switchfeature(currentitem+1, true);
  	});
	
	$(".exitbutton").click(function(){
		$(".ie6_warning").fadeOut('slow');
		return false;
	});

});