/* the colors for the menu */
var menu_over_colors = ["#ffffff","#98e027","#abff59","#6aff56","#53e4ff","#73ff53","#baff83","#dbff96","#f6ff95","#fffe84","#ffe062","#96fb52","#e6fc8e","#e8f6c6","#f7fbdb"];
var main_li_color;

function sifr_init(base_url){  
  if(typeof sIFR == "function"){ 
      sIFR.replaceElement(named({ sSelector:".headhead", sFlashSrc: "/layout/templates/bargatemurray/sIFR/HelveNeu.swf", sWmode: "transparent", sColor:"#FFFFFF"}));
      sIFR.replaceElement(named({ sSelector:".headesc", sFlashSrc: "/layout/templates/bargatemurray/sIFR/HelveNeuUL.swf", sWmode: "transparent", sColor:"#FFFFFF"}));
	 
	 }
}

$(document).ready(function(){

	$("#navigator > li > a").hover(
		function(){//over
			var over_color = main_li_color = menu_over_colors[$(this).attr('class').substring(1,3)];
			$(this).animate({ color: over_color }, 500 );

		},
		function(){//out
			/* if this is the ".on" menu item, let's not make it white */
			if ( $(this).parent().is(".on") ) return;

			$(this).animate({color: menu_over_colors[0]},"fast");
		}
	);

/*     var saved_color;
	 
  	 $(".w400 > li > a").hover(
		function(){//over		
			$(this).animate({ color: "#010101" }, 500 );

		},
		function(){//out

			if ( $(this).parent().is(".on") ) return;

			$(this).animate({color: "#000000"},"fast");
		}
	);
*/	 
	 
	 
	/* Making the ".on" menu item colored */
	var temp_nr = $("#navigator li.on a").attr('class').substring(1,3);
	var temp = menu_over_colors[temp_nr];
	
	$("#navigator > li.on > a").css("color",temp);
	
	$(".w400 > li.on > a").css("color","#010101");
	$(".w400 > li > a").css("color","#00000");
	
	
	$("body").addClass("c"+temp_nr);

	/* adding elements for the menu & submenu */
	$("#navigator > li").append("<span></span>");
	$("#navigator li ul").wrap("<div></div>");
	$("#navigator li div").append("<em class=\"l\"></em><em class=\"r\"></em>");


	/* resizing submenus */
	$("#navigator li ul").each(function(){
		var temp_sum = 0;
		$(this).css("width",1000+"px");
		$("li", this).each(function(){
			temp_sum += $(this).width() + 10;
		});
		temp_sum += temp_sum%2;
		$(this).css("width",temp_sum+"px");
	});


	$("#navigator li div").hide();
	$("#navigator li.on div").show();
	$(".w400 > li.on").parent().parent().show();
	

	/* submenu open/close actions */
	$("#navigator li:has(div)").mouseover(function(){
  	   $("body").removeClass();					   
	   $("body").addClass("c"+$("a",this).attr('class').substring(1,3));
	   
	    $("#navigator li div").hide();
		$("div", this).show();										
										  		
	});
});
