$(function() {

/** Menu bar **/
	// ¸ðµÎ ¼û±è
	$(".subMenu").hide();

	// ±âº» menuBar Á¶È¸ - > Ãß°¡¸¦ À§ÇØ
	$("#menuBar").children().filter(function() { findSubMenu($(this).attr("menu")); });
/** // Menu bar **/

}); // 

/** Menu bar for jquery **/
// ¸¶¿ì½º ¾÷
$(".Bar").live("mouseover",function(e) {
	$(".subMenu").hide();
	
	if($.browser.msie) {  // for msie
		var pos1 = $(this).offset();	// Sub Menu º¸ÀÌ±â
		$("#"+$(this).attr("menu")).css( { "left": (700 + pos1.left) + "px", "top":(pos1.top+30) + "px" } ).show();

	} else {
		var pos1 = $(this).offset();	// Sub Menu º¸ÀÌ±â
		$("#"+$(this).attr("menu")).css( { "left": (pos1.left) + "px", "top":(pos1.top+30) + "px" } ).show();
	}
});

// ¼­ºê¸Þ´º 
$(".subMenuItem").live("mouseover",function() {
	$(this).parent().children().filter(function() {	// Sub-Sub menu ¼û±â±â
		if($(this).attr("menu") != "undefined") {
			$("#"+$(this).attr("menu")).hide();
		}
	});
	
	$(this).addClass("ItemMouseOver");
	
	if($(this).attr("menu")) {	// Sub-Sub menu º¸ÀÌ±â
		if($.browser.msie) {  //
			var pos1 = $(this).parent().position();
			var pos2 = $(this).position();
			$("#"+ $(this).attr("menu")).css( { "left": (pos1.left + pos2.left + 130) + "px", "top": (pos1.top + pos2.top + 5) + "px" } ).show();
		} else {
			var pos1 = $(this).parent().position();
			var pos2 = $(this).position();
			$("#"+ $(this).attr("menu")).css( { "left": (pos1.left + pos2.left + 130) + "px", "top": (pos1.top + pos2.top + 5) + "px" } ).show();
		}
	}
	
}).live("mouseout",function(e) {	$(this).removeClass("ItemMouseOver"); e.stopPropagation();  });
	
// Click - font ÅÂ±×°¡ ¾È ´ÝÇô¼­ ÀüÃ¼ ÆäÀÌÁö¿¡¼­ ¿À·ù ¹ß»ý
$(".subMenuItem[cmd]").live("click",function() {
	if($(this).is(":visible") && $(this).attr("cmd")) {
		document.location.href = $(this).attr("cmd");
	}
});

function findSubMenu(targetMenu) {
	$("#"+targetMenu).children().filter(function() {
		var $subMenu_id = $(this).attr("menu");
		if($subMenu_id) {
			$(this).append("<span id='"+$subMenu_id+"_Arrow' class='Arrow'>¢º</span>");
		}
	});
}// func
/** Menu bar for jquery **/
