var breadcrumb = Array();
breadcrumb.length = 0;
var filename = '';
var nm = '';
var type = '';
var showsidemenu = 0;
$(document).ready(function(){
		
	$("#sidemenutree").treeview({
		animated: "fast",
		collapsed: true,
		persist: "match",
		filename: filename,
		control: "#treecontrol"
	});
	$(".menu_on").closest(".dropdownparent").addClass("parentmenu");
	if(nm != null || $nm != ""){breadcrumb.push("<a style='margin:0 5px;' href='"+type+"/"+nm+"'>"+nm+"</a>")};
	if($(".menu_on .menutxt:first").html() != null && $(".menu_on .menutxt:first").html() != ""){
		link = $(".menu_on .menutxt:first").html();
		var curpage = "<a href='"+$(".menu_on a:first").attr("href")+"'>"+link+"</a>";
		if(nm) curpage += "&nbsp; &raquo;";
		$("#breadcrumb").html(curpage);
		breadcrumb.push(curpage);	
	}
	$(".menu_on").parents().each(function(){
		//if($(this).children("a:first").html() != null){
		if($(this).children().children(".menutxt:first").html() != null && $(this).children().children(".menutxt:first").html() != ""){
			link = $(this).children().children(".menutxt:first").html();
			//alert($(this).children().html());
			breadcrumb.push("<a style='margin:0 5px;' href='"+$(this).children("a:first").attr("href")+"'>"+link+"</a> &raquo; &nbsp;");
		}	
								
		if($(this).hasClass("parentmenu")){							
			var crumb;
			$("#breadcrumb").html("");
			while(crumb = breadcrumb.pop()){
				$("#breadcrumb").html($("#breadcrumb").html()+crumb);
			}
			return false;
		}
	});
	
	$("#sidemenutree a").hover(function(){
		$(this).addClass("hover");
	},
	function(){
		$(this).removeClass("hover");
	});
	
	$(".dropdownparent").hoverIntent(function(){
		var offsettop = $(this).offset();
		//var tp = parseInt(parseInt($(this).children(".dropdown").css("top"))-2);
		var tp = $(this).position().top+$(this).height();
		var lf = $(this).position().left;
		$(this).children(".dropdown").css({"top":tp, "left":lf});
		if(!$(this).hasClass("parentmenu")){							
			$(this).children("a:first").css({"background":"url(/images/menu_on.jpg)", "color":"white"});
		}
		$(this).children(".dropdown").show();
	}, 
	function(){								
	    if(!$(this).hasClass("parentmenu")){							
		  $(this).children("a:first").css({"background":"url('/images/menu_off.jpg')","color":"white"});
	    }
		$(this).children(".dropdown").hide();
	});	
	$(".subdropdownparent").hoverIntent(function(){						
		$(this).children("a:first").css({"background-color":"#0a3967", "color":"white"});
		var offset = $(this).parent().offset();
		var offsettop = $(this).offset();
		if($(this).children(".subdropdown").html() != null){
			pos = $(this).parent().width();
			$(this).children(".subdropdown").css({"left":pos});
			$(this).children(".subdropdown").show();
		}
	}, 
	function(){												
		$(this).children("a:first").css({"background-color":"","color":"#595959"});
		$(this).children(".subdropdown").hide();
	});	
	
	
	
	if(showsidemenu != "0"){
		$(".equal").equalHeight();						
		$("#side_menu_css").css({"visibility":"visible"});
	}
	
	
});				
