//-- ### Javascript for Suckerfish Dropdown Navigation ### -- //
sfHover = function() {
	if(document.getElementById("navigation")){
		var sfEls = document.getElementById("navigation").getElementsByTagName("li");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
	
				// Hide from Opera
				if(navigator.userAgent.indexOf("MSIE 6") != -1){
					var ieUL = this.getElementsByTagName('ul')[0];
					if (ieUL) {
						var ieMat = document.createElement('iframe');
						ieUL.insertBefore(ieMat,ieUL.firstChild);
					} 
				}
			
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
// ----------------------------------------------------------//

/* grab Elements from the DOM by className */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/* window 'load' attachment */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


// === hide and show div's  === //

function toggleDiv(divID, divState) // 1 visible, 0 hidden
{
	//alert(divID + ":" + divState);
	var obj = document.getElementById(divID);
	
	if (obj) {
		obj.style.display = divState ? "" : "none";
	} else {
		//alert("unable to find element with id: " + divID);
	}
}

// === changing classes for tabs === //

function changeElementClass(element,classname)
{
  document.getElementById(element).className = classname;
}
