
var WEB_ROOT = "/careerdevelopment";

//
// JQUERY FUNCTIONS
//

function stripeTables(className) {
	if (className==undefined) className='dataTable, .dataTableHorizontal';
	$('.' + className + " tr:nth-child(even)").addClass("even");
	$('.' + className + " tr:nth-child(odd)").addClass("odd");
}


//
// STANDARD JAVASCRIPT FUNCTIONS
//

function toggleDisplay(id) {
	if (document.getElementById) {
		var e = document.getElementById(id); //the element to collapse or expand
		if (e.style.display != "block") {
			e.style.display = "block";
		}
		else {
			e.style.display = "none";
		}
	}
}

function displayBlock(id) {
	if (document.getElementById) {
		var e = document.getElementById(id); //the element to display
		e.style.display = "block";
	}
}

function displayNone(id) {
	if (document.getElementById) {
		var e = document.getElementById(id); //the element to hide
		e.style.display = "none";
	}
}

//allows you to do myString.trim()
String.prototype.trim = function() {
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};



/*
** REQUIRES dynamicContent.css! **
Expands or collapses a list; supports hierachical lists
@param id		id of the list to be expanded or collapsed
@param level	level of the hierarchy, for determing the size of plus and minus images
               (optional, default is 0)

Only supports one level for now until CSS is defined for "expandedListItem" and "collapsedListItem" classes
*/
function toggleList(id, level) {
	if (document.getElementById) {   
		var e = document.getElementById(id); //the element to collapse or expand
		
		//Determine CSS classes to use
		if (level==undefined || level==0) {
			var expandedClass = "expandedListItem";
			var collapsedClass = "collapsedListItem";
		}
		/*
		These CSS classes don't exist for now, so this is commented out
		
		else {
			var expandedClass = "expandedListItem";
			var collapsedClass = "collapsedListItem";
		}
		*/
		
		//Show or hide the sub-list and change the icon next to the parent list item
		
		if (e.style.display != "block") {
		  	e.style.display = "block";
		  	e.parentNode.className  = expandedClass;
		}
		else {
		  	e.style.display = "none";
		  	e.parentNode.className = collapsedClass;
		}
	}
}


/*
** REQUIRES dynamicContent.css! **
*
* Writes the CSS necessary to hide the sub-lists in a hierarchical list
* (so that they are only hidden if javascript is turned on)
*/
function initHierarchicalList() {
     document.write("<style type='text/css'> .hierarchicalList ul {display:none} </style>");
}