function printSchedule()
{
	var printWindow = window.open(WSD_WEBROOT+"print-schedule.php");
}

function htmlentities (string, quote_style)
{
	// Convert all applicable characters to HTML entities  
	// version: 1004.2314
	// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)

	var hash_map = {}, symbol = '', tmp_str = '', entity = '';
	tmp_str = string.toString();    
	if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
		return false;
	}
	hash_map["'"] = '&#039;';    for (symbol in hash_map) {
		entity = hash_map[symbol];
		tmp_str = tmp_str.split(symbol).join(entity);
	}
	return tmp_str;
}

function get_html_translation_table (table, quote_style)
{
	// Returns the internal translation table used by htmlspecialchars and htmlentities  
	// version: 1004.2314
	// original by: Philip Peterson

	var entities = {}, hash_map = {}, decimal = 0, symbol = '';    var constMappingTable = {}, constMappingQuoteStyle = {};
	var useTable = {}, useQuoteStyle = {};

	// Translate arguments
	constMappingTable[0]      = 'HTML_SPECIALCHARS';    constMappingTable[1]      = 'HTML_ENTITIES';
	constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
	constMappingQuoteStyle[2] = 'ENT_COMPAT';
	constMappingQuoteStyle[3] = 'ENT_QUOTES';
	 useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
	useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';

	if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
		throw new Error("Table: "+useTable+' not supported');        // return false;
	}

	entities['38'] = '&amp;';
	if (useTable === 'HTML_ENTITIES') {        entities['160'] = '&nbsp;';
		entities['161'] = '&iexcl;';
		entities['162'] = '&cent;';
		entities['163'] = '&pound;';
		entities['164'] = '&curren;';        entities['165'] = '&yen;';
		entities['166'] = '&brvbar;';
		entities['167'] = '&sect;';
		entities['168'] = '&uml;';
		entities['169'] = '&copy;';        entities['170'] = '&ordf;';
		entities['171'] = '&laquo;';
		entities['172'] = '&not;';
		entities['173'] = '&shy;';
		entities['174'] = '&reg;';        entities['175'] = '&macr;';
		entities['176'] = '&deg;';
		entities['177'] = '&plusmn;';
		entities['178'] = '&sup2;';
		entities['179'] = '&sup3;';        entities['180'] = '&acute;';
		entities['181'] = '&micro;';
		entities['182'] = '&para;';
		entities['183'] = '&middot;';
		entities['184'] = '&cedil;';        entities['185'] = '&sup1;';
		entities['186'] = '&ordm;';
		entities['187'] = '&raquo;';
		entities['188'] = '&frac14;';
		entities['189'] = '&frac12;';        entities['190'] = '&frac34;';
		entities['191'] = '&iquest;';
		entities['192'] = '&Agrave;';
		entities['193'] = '&Aacute;';
		entities['194'] = '&Acirc;';        entities['195'] = '&Atilde;';
		entities['196'] = '&Auml;';
		entities['197'] = '&Aring;';
		entities['198'] = '&AElig;';
		entities['199'] = '&Ccedil;';        entities['200'] = '&Egrave;';
		entities['201'] = '&Eacute;';
		entities['202'] = '&Ecirc;';
		entities['203'] = '&Euml;';
		entities['204'] = '&Igrave;';        entities['205'] = '&Iacute;';
		entities['206'] = '&Icirc;';
		entities['207'] = '&Iuml;';
		entities['208'] = '&ETH;';
		entities['209'] = '&Ntilde;';        entities['210'] = '&Ograve;';
		entities['211'] = '&Oacute;';
		entities['212'] = '&Ocirc;';
		entities['213'] = '&Otilde;';
		entities['214'] = '&Ouml;';        entities['215'] = '&times;';
		entities['216'] = '&Oslash;';
		entities['217'] = '&Ugrave;';
		entities['218'] = '&Uacute;';
		entities['219'] = '&Ucirc;';        entities['220'] = '&Uuml;';
		entities['221'] = '&Yacute;';
		entities['222'] = '&THORN;';
		entities['223'] = '&szlig;';
		entities['224'] = '&agrave;';        entities['225'] = '&aacute;';
		entities['226'] = '&acirc;';
		entities['227'] = '&atilde;';
		entities['228'] = '&auml;';
		entities['229'] = '&aring;';        entities['230'] = '&aelig;';
		entities['231'] = '&ccedil;';
		entities['232'] = '&egrave;';
		entities['233'] = '&eacute;';
		entities['234'] = '&ecirc;';        entities['235'] = '&euml;';
		entities['236'] = '&igrave;';
		entities['237'] = '&iacute;';
		entities['238'] = '&icirc;';
		entities['239'] = '&iuml;';        entities['240'] = '&eth;';
		entities['241'] = '&ntilde;';
		entities['242'] = '&ograve;';
		entities['243'] = '&oacute;';
		entities['244'] = '&ocirc;';        entities['245'] = '&otilde;';
		entities['246'] = '&ouml;';
		entities['247'] = '&divide;';
		entities['248'] = '&oslash;';
		entities['249'] = '&ugrave;';        entities['250'] = '&uacute;';
		entities['251'] = '&ucirc;';
		entities['252'] = '&uuml;';
		entities['253'] = '&yacute;';
		entities['254'] = '&thorn;';        entities['255'] = '&yuml;';
	}

	if (useQuoteStyle !== 'ENT_NOQUOTES') {
		entities['34'] = '&quot;';    }
	if (useQuoteStyle === 'ENT_QUOTES') {
		entities['39'] = '&#39;';
	}
	entities['60'] = '&lt;';    entities['62'] = '&gt;';


	// ascii decimals to real symbols
	for (decimal in entities) {        symbol = String.fromCharCode(decimal);
		hash_map[symbol] = entities[decimal];
	}

	return hash_map;
}

function html_entity_decode (string, quote_style) {
    // Convert all HTML entities to their applicable characters  
    // version: 1004.2314
    // +   original by: john (http://www.jd-tech.net)

	var hash_map = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {        return false;
    }
 
    // fix &amp; problem
    // http://phpjs.org/functions/get_html_translation_table:416#comment_97660    delete(hash_map['&']);
    hash_map['&'] = '&amp;';
 
    for (symbol in hash_map) {
        entity = hash_map[symbol];        tmp_str = tmp_str.split(entity).join(symbol);
    }
    tmp_str = tmp_str.split('&#039;').join("'");
    
    return tmp_str;
}

function hoverImage(hoverCode)
{
	var oldSrc = E(hoverCode+'_n').src;

	E(hoverCode+'_n').src = E(hoverCode+'_h').src;
	E(hoverCode+'_h').src = oldSrc;
}

function ajax_encode(content)
{
	content = Base64.encode(content).replace(/\+/gi, "{F_PLUS}");

	return content;
}

function printSub(subTitleC)
{
	var printWindow = window.open(WSD_WEBROOT+"show_submenu.php?pageSub="+subTitleC);
}

function common_Hover(tCode)
{
	var oldSrc = E(tCode+'_n').src;

	E(tCode+'_n').src = E(tCode+'_h').src;
	E(tCode+'_h').src = oldSrc;
}

function djnav_HoverTab(tCode)
{
	var oldSrc = E('djNav_'+tCode+'_n').src;

	E('djNav_'+tCode+'_n').src = E('djNav_'+tCode+'_h').src;
	E('djNav_'+tCode+'_h').src = oldSrc;
}

/*
	DJ Page:
*/

function dj_SwitchTab(i)
{
	var oldTab = s_currentTab;

	if(currentTarget.id != 'stage_'+i+'_n')
	{
		dj_HoverTab('in', i);
	}

	s_currentTab = i;
	
 	if(oldTab > 0)
	{
		dj_HoverTab('out', oldTab);
	}
}

function dj_HoverTab(hType, i)
{
	if(s_currentTab == i) return false;

	if(hType == 'in')
	{
		var oldSrc = E('stage_'+i+'_n').src;
		
		E('stage_'+i+'_n').src = E('stage_'+i+'_h').src;
		E('stage_'+i+'_h').src = oldSrc;
	}
	else
	{
		var oldSrc = E('stage_'+i+'_n').src;
		
		E('stage_'+i+'_n').src = E('stage_'+i+'_h').src;
		E('stage_'+i+'_h').src = oldSrc;
	}
}


/*
	Frontpage SlideShow:
*/

AttachEvent(window, 'load', slideShow_init, false);
AttachEvent(document, 'mousemove', slideShow_loopcheck, false);

// width of the slide placeholder; this will be filled by slideShow_init
var slideWidth;

// width of the inner slideshow (long strip with images inside); this will be also be filled by slideShow_init
var slideWidthInner;

// middle region in pixels where slide will be paused when hovering:
var slideMiddleMargin = 50;

// max margin in pixels to slide
var slideSpeedMax = 50;

var slideInit = false;

var slideTimer;
var slideLeft;
var slideTop;

var slideStart = false;

// calculate inner slideshow width :
function slideShow_init()
{
	if(!E('slideBox'))
	{
		return false;
	}

	var nextSlide = E('slideBox');

	slideLeft = nextSlide.offsetLeft;
	slideTop = nextSlide.offsetTop;

	nextSlide = nextSlide.offsetParent;

	do
	{
		slideLeft += nextSlide.offsetLeft;
		slideTop += nextSlide.offsetTop;
	}
	while (nextSlide = nextSlide.offsetParent);

	// set the width of the outer width (not the long inner width)
	slideWidth = parseInt(E('slideBox').style.width);
	
	// width of the inner slideshow (long strip with images inside)
	slideWidthInner = parseInt(E('slideInner').style.width);

	slideInit = true;
}

function slideShow()
{
	if(!slideInit)
	{
		slideShow_init();
	}

	// debug the width of the slideshow:
	//E('posY').innerHTML = "slideshow width: "+slideWidthInner+" -- "+slideWidth;

	var mouseRelX = mouseX - slideLeft;
	var mouseRelY = mouseY - slideTop;

	var mLeft = parseInt(E('slideInner').style.marginLeft.replace(/px/, ""));

	if(!mLeft) {mLeft = 0};
	
	// going left:
	if(mouseRelX < parseInt((slideWidth - slideMiddleMargin) / 2))
	{
		var mPosPerc = 100 - (mouseRelX / ((slideWidth - slideMiddleMargin) / 2)) * 100;
		var mSpeed = (slideSpeedMax / 100) * mPosPerc;

		if(mLeft + mSpeed < 0)
		{
			E('slideInner').style.marginLeft = (mLeft + mSpeed)+'px';
		}
		else
		{
			E('slideInner').style.marginLeft = '0px';
		}

		//E('posX').innerHTML = 'left mouse percentage: '+mPosPerc+'%';
	}

	// going right
	else if (mouseRelX > parseInt((slideWidth - (slideWidth / 2))) + (slideMiddleMargin / 2))
	{
		var mPosPerc = ((mouseRelX - (slideWidth / 2) - (slideMiddleMargin / 2)) / ((slideWidth - slideMiddleMargin) / 2)) * 100;
		var mSpeed = (slideSpeedMax / 100) * mPosPerc;
		
		if((0 - (mLeft - mSpeed)) + slideWidth < parseInt(E('slideInner').style.width))
		{
			E('slideInner').style.marginLeft = (mLeft - mSpeed)+'px';
		}
		else
		{
			E('slideInner').style.marginLeft = 0 - (parseInt(E('slideInner').style.width) - slideWidth)+'px';
		}

		//E('posX').innerHTML = 'right mouse percentage: '+(mPosPerc)+'%';
	}
	else
	{
		//E('posX').innerHTML = 'doin nothin';
	}

	// slide timer:
	slideTimer = setTimeout(slideShow, 25);
}

function slideShow_loopcheck()
{
	if(slideWidthInner <= slideWidth)
	{
		return false;
	}

	if(!E('slideBox') || (slideStart && !parent_found('slideBox')))
	{
		slideStart = false;

		clearTimeout(slideTimer);
	}
	else if(!slideStart && parent_found('slideBox'))
	{
		slideStart = true;

		slideTimer = setTimeout(slideShow, 1);
	}
}
// end slideshow


function subscribeNewsletter(nlCode)
{
	var emailAddress = E('nlInput_'+nlCode).value;

	emailAddress = Base64.encode(emailAddress).replace(/\+/gi, "{F_PLUS}");

	var xmlHttp = createXMLHttpRequest();

	xmlHttp.onreadystatechange = function(e){finishNewsletter(xmlHttp, nlCode);};

	xmlHttp.open("GET", WSD_WEBROOT+"js-subscribe-newsletter.php?email="+emailAddress, true);

	xmlHttp.send(null);
}

function finishNewsletter(xmlHttp, nlCode)
{

    if(xmlHttp.readyState == 4)
	{
        if(xmlHttp.status == 200)
		{
			var responseStatus = xmlHttp.responseText;

			if(responseStatus != 'good')
			{
				alert(responseStatus);
			}
			else
			{
				var letterContent = E('nlContent_'+nlCode);

				letterContent.innerHTML = "<div style='color: red; padding-left: 5px;'><i>Thank you!</i></div>";
			}
		}
	}
}

var browserCheck = new RegExp('Microsoft', 'i'); // fuck microsoft and their stupid rules

if(browserCheck.test(navigator.appName))
{
	var app = "ie";
}
else
{
	var app = "moz";
}

var currentTarget;
var mouseX;
var mouseY;

function setTarget(event)
{
	if(!document.body)
	{
		return false;
	}

	var e = event || window.event;

	currentTarget = e.target || e.srcElement;

	if(app == "ie")
	{
		mouseX = event.clientX + parseInt((document.body.scrollLeft) ? document.body.scrollLeft : document.documentElement.scrollLeft);
		mouseY = event.clientY + parseInt((document.body.scrollTop) ? document.body.scrollTop : document.documentElement.scrollTop);
	}
	else
	{
		mouseX = e.pageX;
		mouseY = e.pageY;
	}
}

AttachEvent(document, 'mousemove', setTarget, false);

function getUserSelection()
{
	var cSelection;

	if (window.getSelection) {
		cSelection = String(window.getSelection());
	}
	else if (document.selection) { // should come last; Opera!
		cSelection = String(document.selection.createRange().text);
	}

	cSelection = cSelection.trim();

	return cSelection;
}

function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue)
{
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)", "i") : null;
    var oCurrent;
    var oAttribute;

    for(var i=0; i<arrElements.length; i++)
    {
        oCurrent = arrElements[i];
        oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);

        if(typeof oAttribute == "string" && oAttribute.length > 0)
	{
            if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute)))
	    {
                arrReturnElements.push(oCurrent);
            }
        }
    }

    return arrReturnElements;
}

function Viewport()
{
	this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth;
	this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight;
	this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft;
	this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;
	this.pageX = (document.documentElement && document.documentElement.scrollWidth) 
		? document.documentElement.scrollWidth 
		: (document.body.scrollWidth > document.body.offsetWidth) 
			? document.body.scrollWidth 
			: document.body.offsetWidth; 
	this.pageY = (document.documentElement && document.documentElement.scrollHeight) 
		? document.documentElement.scrollHeight 
		: (document.body.scrollHeight > document.body.offsetHeight) 
			? document.body.scrollHeight 
			: document.body.offsetHeight;
}

function parent_found(elCode)
{
	if(!currentTarget)
	{
		return false;
	}

	//	if(currentTarget.id == 'globalBox_'+menuIndex || currentTarget.id == 'submenu_'+menuIndex || currentTarget.id == 'mainMenuholder_'+menuIndex)
	if(currentTarget.id == elCode)
	{
		return true;
	}
	else
	{
		// loop parents node:
		tempTarget = currentTarget.parentNode;

		while(tempTarget)
		{
			//if(tempTarget.id == 'globalBox_'+menuIndex || tempTarget.id == 'submenu_'+menuIndex || tempTarget.id == 'mainMenuholder_'+menuIndex)
			if(tempTarget.id == elCode)
			{
				return true
				break;
			}
			else
			{
				tempTarget = tempTarget.parentNode;
			}
		}
	}

	return false;
}

function validateURL(urlID)
{
	var urlElement = E(urlID);

	var urlValue = urlElement.value;
	var urlPrefix;

	var optionToSelect;

	if(!urlValue.trim())
	{
		return false
	}
	else
	{
		// I.E. Needs value assigned to var first :(
		if(urlValue.match(/^([a-z]*\:\/\/)/gi))
		{
			urlPrefix = /^([a-z]*\:\/\/)/gi.exec(urlValue)[0];

			urlValue = urlValue.replace(/^([a-z]*\:\/\/)/gi, "");
		}
		else
		{
			urlPrefix = "";
		}

		if(urlPrefix.trim())
		{
			switch(urlPrefix)
			{
				case "http://":
					optionToSelect = 0;
				break;

				case "https://":
					optionToSelect = 2;
				break;

				case "ftp://":
					optionToSelect = 1;
				break;

				case "ssl://":
					optionToSelect = 3;
				break;

				case "news://":
					optionToSelect = 4;
				break;
			}

			E('website_0_p').selectedIndex = optionToSelect;

			urlElement.value = urlValue;
		}

		return true;
	}
}

// use $ instead of getElementById
function E(obj)
{
	var newObj;

	if (arguments.length > 1)
	{
		for (var i = 0, objects = []; i < arguments.length; i++)
		{
			if(document.getElementById(arguments[i]) !== null)
			{
				objects.push(E(arguments[i]));
			}
		}
		return objects;
	}

	if (typeof obj == 'string')
	{
		newObj = document.getElementById(obj);
	}
	return newObj;
}

String.prototype.trim = function()
{
	return this.replace(/^\s+|\s+$/g,"");
}

String.prototype.ltrim = function()
{
	return this.replace(/^\s+/,"");
}

String.prototype.rtrim = function()
{
	return this.replace(/\s+$/,"");
}

//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted
//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false);
function AttachEvent(obj,evt,fnc,useCapture)
{
	if (!useCapture) useCapture=false;
	if (obj.addEventListener){
		obj.addEventListener(evt,fnc,useCapture);
		return true;
	} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
	else{
		MyAttachEvent(obj,evt,fnc);
		obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
	}
} 

//The following are for browsers like NS4 or IE5Mac which don't support either
//attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc)
{
	if (!obj.myEvents) obj.myEvents={};
	if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
	var evts = obj.myEvents[evt];
	evts[evts.length]=fnc;
}

function MyFireEvent(obj,evt)
{
	if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
	var evts = obj.myEvents[evt];
	for (var i=0,len=evts.length;i<len;i++) evts[i]();
}


var Base64 = {
 
	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 
	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = Base64._utf8_encode(input);
 
		while (i < input.length) {
 
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
 
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
 
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
 
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
		}
 
		return output;
	},
 
	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
		while (i < input.length) {
 
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
 
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
 
			output = output + String.fromCharCode(chr1);
 
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
 
		}
 
		output = Base64._utf8_decode(output);
 
		return output;
 
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
		return string;
	}
}

function getElementsByClassName(oElm, strTagName, strClassName)
{
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++)
	{
		oElement = arrElements[i];

		if(oRegExp.test(oElement.className))
		{
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

	function changePassword(changeBox, passMain)
{
	if(changeBox.checked)
	{
		E(passMain+'_js').value = "";
		E(passMain+'_r_js').value = "";

		E(passMain+'_js').disabled = false;
		E(passMain+'_r_js').disabled = false;
	}
	else
	{
		E(passMain+'_js').value = "*****";
		E(passMain+'_r_js').value = "*****";

		E(passMain+'_js').disabled = true;
		E(passMain+'_r_js').disabled = true;
	}
}

// This function is called when you click the 'Add to my favorite DJs' button on a dj-detail page
function addArtistToMyFavorites ( artistID )
{
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = function ( )
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
		{
			alert(xmlHttp.responseText);
		}
	};
	xmlHttp.open("GET", WSD_WEBROOT+"rpc.add-artist-to-my-favorites.php?artistID="+artistID, true);
	xmlHttp.send(null);
}


// This function is called when you click the 'Add to my schedule' button on a dj-detail page
function addArtistToMySchedule ( artistID )
{
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = function ( )
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
		{
			alert(xmlHttp.responseText);
		}
	};
	xmlHttp.open("GET", WSD_WEBROOT+"rpc.add-artist-to-my-schedule.php?artistID="+artistID, true);
	xmlHttp.send(null);
}

// This function is called when you click the 'Add to my buddies' button on a user profile page
function addUserToMyBuddies ( userID )
{
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = function ( )
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
		{
			alert(xmlHttp.responseText);
		}
	};
	xmlHttp.open("GET", WSD_WEBROOT+"rpc.add-user-to-my-buddies.php?userID="+userID, true);
	xmlHttp.send(null);
}

// This function is called when you remove a friend from your friendslist @ profile->your friends
function removeUserFromMyBuddies ( userID )
{
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.onreadystatechange = function ( )
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
		{
			document.getElementById("buddy_"+userID).style.display = "none";
		}
	};
	xmlHttp.open("GET", WSD_WEBROOT+"rpc.remove-user-from-my-buddies.php?userID="+userID, true);
	xmlHttp.send(null);
}
