
/*only supports nav one level deep. will do dynamic hovers for all first
tier nav nodes, but only show deeper nodes for the selected node*/
var Navigation = {
	default_node:2,
	hover_timer:null,
	hover_node:function(id,o){
		if(this.hover_timer != null) clearTimeout(this.hover_timer);
		
		this.clear_and_hide_selected_root(true, id);
		
		//for application link there are no child items
		try{
			$('nav_child_items_'+id).show();
			$(o).addClassName('nav_selected_root_item');
		}catch(ex){}
	},
	clear_hover_node:function(){
		this.hover_timer = setTimeout(function(){
			this.clear_and_hide_selected_root(false, -1);
		}.bind(this), 1000);
	},
	suspend_clear_timer:function(){
		if(this.hover_timer != null) clearTimeout(this.hover_timer);
	},
	resume_clear_timer:function(){
		this.clear_hover_node();
	},
	clear_and_hide_selected_root:function(force_switch, sel_id){
		$$('.nav_child_items').each(function(t){
			if(!t.hasClassName('perma_menu')){
				t.hide();
			}
		});
		$$('.nav_selected_root_item').each(function(t){
			t.removeClassName('nav_selected_root_item');
		});
		//restore to default menu, not empty. if nothing set this will skip and
		//restore to empty.
		if(!force_switch && this.default_node > 0){
			//for application link there are no child items
			try{
				$('nav_link_'+this.default_node).addClassName('nav_selected_root_item');
				$('nav_child_items_'+this.default_node).show();
				$$('.nav_sub_child_items').each(function(t){t.show();});
			}catch(ex){}
		}else{
			if(sel_id == this.default_node){
				$$('.nav_sub_child_items').each(function(t){t.show();});
			}else{
				$$('.nav_sub_child_items').each(function(t){t.hide();});
			}
		}
	}
}





















