jQuery(document).ready(function() {
	jQuery(".menu-ul").children("li").each(function(){
		this.onmouseover = function() {
			jQuery(this).removeClass("li-normal");
			jQuery(this).addClass("li-over");
            if (jQuery(this).find("span").attr("id") == "wiki")
                jQuery(".wikisubmenu").css("display", "block");
		}
		this.onmouseout = function() {
			jQuery(this).removeClass("li-over");
			jQuery(this).addClass("li-normal");
            if (jQuery(this).find("span").attr("id") == "wiki")
                jQuery(".wikisubmenu").css("display", "none");
		}
	});

	jQuery(".top-link-wrapper").find("ul").find("li").each(function(){
		this.onmouseover = function() {
			jQuery(this).addClass("linkover");
			if (jQuery(this).attr("id") == "mylinks-id")
				jQuery(".mylinks-display").css("display", "block");
		}
		this.onmouseout = function() {
			jQuery(this).removeClass("linkover");
			if (jQuery(this).attr("id") == "mylinks-id")
				jQuery(".mylinks-display").css("display", "none");
		}
	});

	jQuery(".banner-wrapper .button-wrapper").find("span").each(function(){
		this.onmouseover = function() {
			if (!jQuery(this).hasClass("active"))
			{
				jQuery(this).removeClass("normal");
				jQuery(this).addClass("over");
			}
		}

		this.onmouseout = function() {
			if (!jQuery(this).hasClass("active")) {
				jQuery(this).removeClass("over");
				jQuery(this).addClass("normal");
			}
		}

		this.onclick = function() {
			if (!jQuery(this).hasClass("active")) { 
				jQuery(".banner-wrapper .button-wrapper").find("span").each(function(){
					if (jQuery(this).hasClass("active"))
					{
						jQuery(this).removeClass("active");
						jQuery(this).addClass("normal");
						jQuery("#" + jQuery(this).attr("id") + "-content").css("display", "none");
					}
				});
				var position = jQuery(this).position();
				var x = parseInt(position.left + jQuery(this).width()/2 + 10);
				jQuery(this).removeClass("over");
				jQuery(this).addClass("active");
				jQuery(".banner-wrapper .arrow").css("left", x);
				jQuery("#" + jQuery(this).attr("id") + "-content").css("display", "block");
			}
		}
	});
});