function loading_gif (action, element_id) {
	element_id = typeof(element_id) != 'undefined' ? element_id : 'loading_img';
	var mygif = document.getElementById(element_id);
	if (action == null) {
		action = 'hide';
		if (mygif.style.display == 'none') {
			action = 'show';
		}
	}

	if (mygif != null) {
		if (action == 'hide') {
			try {
				mygif.style.display = 'none';
			} catch (e) {}
		} else if (action == 'show') {
			try {
				mygif.style.display = 'block';
			} catch (e) {}
		}
	}
}

function toggle_plus_minus (plus_minus_img, div_id) {
	 var mydiv = document.getElementById(div_id);
	 if (mydiv.style.display == 'none') {
		 mydiv.style.display = 'block';
		 plus_minus_img.src = '/img/minus.png';
	 } else {
		 mydiv.style.display = 'none';
		 plus_minus_img.src = '/img/plus.png';
	 }
}

function printMe(elm, fld){
	var content = document.getElementById(elm).innerHTML;
	document.getElementById(fld).value = content;
	return true;
}

function shade (action) {
	var shade = document.getElementById('shade');
	if (action == 'show') {
		shade.style.display = 'block';
	} else {
		shade.style.display = 'none';
	}
}

function info_box (action, inner_text) {
	var info_box = document.getElementById('info_box');
	var info_box_inner_text = document.getElementById('info_box_inner_text');
	if (action == 'show') {
		info_box.style.display = 'block';
		info_box_inner_text.innerHTML = inner_text + info_box_inner_text.innerHTML;
	} else {
		info_box.style.display = 'none';
	}
	shade(action);
}

function selectAll(formElement) {
	var theForm = formElement.form;
	for(z=0; z < theForm.length; z++){
		if(theForm[z].type == 'checkbox' && theForm[z] != formElement){
			theForm[z].checked = formElement.checked;
		}
	}
}

//-------Drop Down Menu Function------------
function mOver(divId){
	var id = document.getElementById(divId);
	id.style.display = 'block';

}
function hideElms(){
	var spanArray = document.getElementsByTagName('div');
    //loop through all the div tags on the page
    for(var i=0; i<spanArray.length; ++i){
		divId = spanArray[i].id;                         //Div tag id
 
		//Hide div tags that have and X in the id.
		if(divId.indexOf('menu_list_inner')>-1){
			document.getElementById(divId).style.display = "none";
		}
	}
}
