/*
	Audio and Video player scripts. 
	Based on ABC News scripts by Andrew Kesper.
	created by: Geoff Pack, August 2007
	last modified by: GP, August 2009
*/

// Add new string functions
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function classAdd(element, theclass) {
	// Add a CSS class to the specified element (will not add the class if it already exists)
	if (!element) return;
	if (!element.className) element.className = '';
	var reg = new RegExp('(^| )'+theclass+'( |$)', 'g');
	if (element.className.search(reg) == -1) element.className = (element.className + ' ' + theclass).trim();
}

function classRemove(element, theclass) {
	// Remove a CSS class from the specified element
	if (!element) return;
	if (!element.className) return;
	var reg = new RegExp('(^| )'+theclass+'( |$)', 'g');
	element.className = element.className.replace(reg, ' ').trim();
}


