

var over = false;
//var curr_menu;
var menu_items = Array();

var curr_color = "#c1d82f";
var over_color = "#c1d82f";
var text_over_color = "#d9d8d8";
var text_normal_color = "#d9d8d8";
//var over_image = "#c1d82f";
var is_IE = false;
//var border_normal = "solid 1px #DEDEDE";

function initDropDowns(isIE){
	is_IE == isIE
	over = false;
	
	menu_items = $(".drop_down");
	
	$(".drop_down").bind("mouseover", dropOver);
	$(".drop_down").bind("mouseout", dropOut);
	
	$(".drop_down").children().next().bind("mouseover", dropChildOver);
	$(".drop_down").children().next().bind("mouseout", dropChildOut);
}

function dropOver (e){
 	var curr_id = $(this).attr("id");
	over = true;
	
	jQuery.each(menu_items, function(){
									 if($(this).attr("id") != curr_id) {
										 $(this).children().next().hide();
										 $(this).css("background", "none");
										 //$(this).children().css("border-left", border_normal);
										 if($(this).children().attr("class") == "current") {
											 $(this).children().css("background", curr_color);
										 }
									 }
									 });
	
	 if(is_IE) {
		 $(this).children().css("display", "block");
	 } else {
		$(this).children().next().fadeIn(250);
	 }
	 //$(this).children().css("border-left", "none");
	// if($(this).children().attr("class") == "current") {
		 $(this).children('a').css("color", "#000");
		 $(this).children('a').css("background", over_color);
		 $(this).children('a').css("text-shadow", "none");
		 $(this).children("a").css("padding-bottom", "4px");
		 $(this).children('a').next().css("background", over_color);
	 //}
	
 }
 
function dropOut(){
	over = false;
	stopTimer($(this));
	startTimer($(this));
	$(this).children('a').css("background", over_color);
	$(this).children('a').css("color", "#000");
	$(this).children('a').css("text-shadow", "none");
}

function dropChildOver(){
	over = true;						  
	stopTimer($(this).parent());
	//$(this).parent().css("background", over_color);
}

function dropChildOut(){
	over = false;
	startTimer($(this).parent());
}


function startTimer(obj) {
	$(obj).animate({
				   dummy:0
				   },
				   250,
				   function callBack(){
					   resetMenuItem(obj);
				   }
				   );
}

function stopTimer(obj) {
	$(obj).stop(true, false);
}

function resetMenuItem(obj) {
//	var curr_id = $(".current").closest(".drop_down").attr("id");
//	var obj_id = obj.attr("id");
//	alert(obj.children("a").attr("class"));
	if(!over) {
		$(".drop_down").children('a').css("background", "none");
		$(".drop_down").children('a').css("color", text_normal_color);
		$(".drop_down").children('a').css("text-shadow", "#000 1px 1px 2px");
		$(".current").css("background", curr_color);
//		$(".current").css("color", curr_color);
		if(obj.children("a").attr("class") == "current") {
			obj.children("a").css("background", over_color);
			obj.children("a").css("color", "#000");
			obj.children("a").css("text-shadow", "none");
			obj.children("a").css("padding-bottom", "0");
		}
		$(obj).children().next().hide();
		over = false;
	}
}
