﻿// JScript File
/*-----------------------------------------------------
File:			Common.js

Written By:		Jen Fowler, ReachFarther.com, Inc.
				Copyright 2008, All rights reserved

Description:	Contains various commonly used
				JavaScript functions.
------------------------------------------------------*/


/**********************************************************************
showHideItem(showThis, hideThis)

This function allows for showing and hiding elements within the DOM.

showThis (required):	
	takes a string type of the ID of the element to show. If you do 
	not wish to provide a value for this, you can pass in ''.
			
hideThis (optional):	
	takes a string type of the ID of the element to hide.  Multiple 
	IDs	can be passed in, separating each ID by a comma.
************************************************************************/
function showHideItem(showThis, hideThis) {
	
	// check if a hideThis item was passed in
	if (hideThis) {
		// uses regex to split on a comma to the first word boundry
		var hideThese = hideThis.split(/,*\W/);
		
		for (i=0; i<hideThese.length; i++) {
			try {
				document.getElementById(hideThese[i]).style.display = "none";
			} catch(e) {
			}
		}
	}
	
	if (showThis != "") {
		try {
			document.getElementById(showThis).style.display = "block";
		} catch(e) {
		}
	}
}