/*----------------------------------------
INCUBATE by Hatchling Studios
FILENAME: 	menu.dom.js
CREATED BY:	Ian Muir
CREATED ON: 01/10/05
MODULE:		Global

DESCRIPTION:
This file is for finding DOM elements across 
browsers.

FUNCTIONS:
show_div(str object_id) : sets display to block
hide_div(str object_id) : sets display to none
swap_div(str object_id) : switches display to opposite
pop_div(str base_object_id, str object_id) : drop style-menu popper
pop_delay() : delay hiding of menus;

CLASSES:
none

REQUIREMENTS:
-main file must include dom.func.js script
----------------------------------------*/
var open_menu='';
var close_method=1;
var delay=100;
//FUNCTIONS

	/*FUNCTION: show_div(str object_id)
	  ARGS:
	  -str object_id : the id name of the element
	  DESCRIPTION:
	  This function sets the display property
	  to block*/
	  
	  function show_div(object_id){
			var the_obj = find_style(object_id);
			if(open_menu!=''){
				close_method=1;
				hide_div();
			}
			close_method=0;
			open_menu = object_id;
			the_obj.display = 'block';
	  }
	//END FUNCTION: show_div
	
	/*FUNCTION: show_div(str object_id)
	  ARGS:
	  -str object_id : the id name of the element
	  DESCRIPTION:
	  This function sets the display property
	  to none*/
	  
	  function hide_div(){
			var the_obj = find_style(open_menu);
			
			if(close_method==1){
				the_obj.display = 'none';
			}
			if(close_method>1){
					close_method++;
					if(close_method>=10){
						close_method=1;
					}
					setTimeout('hide_div()',delay);
			}
	  }
	//END FUNCTION: show_div

	/*FUNCTION: swap_div(str object_id)
	  ARGS:
	  -str object_id : the id name of the element
	  DESCRIPTION:
	  This function sets the display property
	  to block if it is currently none and sets
	  display to block under any other conditions.*/
	  
	  function swap_div(object_id){
			var the_obj = find_style(object_id);
			
			if(the_obj.display != 'block'){
				the_obj.display = 'block';
			}else{
				the_obj.display = 'none';
			}
	  }
	//END FUNCTION: show_div
