////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// addClass()
	//
	//
	//
function addClass(element, value) {
	if(!element.className) {
		element.className = value;	
	}else{
		newClassName = element.className;
		newClassName+= " ";
		newClassName+= value;
		element.className = newClassName;
	}
}


////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	// fadeElem()
	//
	//
function fadeElem(element, speed, start, end) {
	 new Effect.Opacity(element, {duration:speed, from:start, to:end});
}

////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	//displayLoading()
	//
	//
	//
function displayLoading(element, value) {
	var button = document.getElementById(element);
	button.setAttribute("value", value);
}

////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// removeConfirmations();
	//
	//
	//
function removeConfirmations() {
	var paras = document.getElementsByTagName("p");
	for(var i=0; i<paras.length; i++){
		if(paras[i].className == "confirm" || paras[i].className == "removed"){
			var feedback = paras[i];
			setTimeout(function() {new Effect.Fade(feedback);}, 6000);
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// ajaxifyForm(form_id, url, loadingElem)
	//
	//
	//
////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// initPageScroll( htmlelem [container], classname [top_class]);
	// Grabs all links in [container], sets their onclick to scroll to an internal anchor
	// 
	// Grabs all a tags with [top_class], sets their onclick to scroll to an internal anchor
	//
	//
	//

////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	// expandElement(elemClass, triggerClass)
	//
	//
function expandElement(containerElem, elemClass, triggerClass) {
	var container = $(containerElem);
	if(!container) return false;
	
	var targetElems = $$('div.' + elemClass);
	hideElems(targetElems);
	
	var triggers = $$('a.' + triggerClass);
	for(var i=0; i < triggers.length; i++) {
		var t = triggers[i];
		t.style.display = 'block';
		t.destination = t.getAttribute('href').split('#')[1];
		t.default_text = t.firstChild.nodeValue;
		t.active_text = "Close -";
		t.onclick = function() {
			new Effect.toggle(this.destination, 'appear');
			
			if(this.firstChild.nodeValue == this.default_text) {
				this.firstChild.nodeValue = this.active_text;
			} else {
				this.firstChild.nodeValue = this.default_text;
			}
			
			return false;
		}
	}
}

function hideElems(collection) {
	for(var i=0; i < collection.length; i++) {
		collection[i].style.display = 'none';
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	//addLoadEvent()
	//
	//
	//
function addLoadEvent(func) {
	var oldonload = window.onload;
	if(typeof window.onload != 'function') {
		window.onload = func;
	}else{
		window.onload = function() {
			oldonload();
			func();
			
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//call functions on page load with addLoadEvent
	//
addLoadEvent(function(){
	
		
});






















