﻿var wiii = new domFunction(dropOut);

function hideStuff() {
		var i, a;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel") == "alternate stylesheet") {
			a.setAttribute("rel","stylesheet");
			a.disabled=false
		}
	}
}
hideStuff();

function dropOut () {
	if (document.getElementById("jobListing")) {
		var disabled = "false"
		var lastClick
		theLI = document.getElementById("jobListing").getElementsByTagName("li");
		var i;
		for (i=0;i<theLI.length;i++) {
			if (theLI[i].className == "expandable"){
				theLI[i].style.position="relative"
				theTrigger = createElement("a");
				theTrigger.style.margin = "0"
				theTrigger.style.padding = "0"
				theTrigger.style.display = "block";
				theTrigger.style.position = "absolute";
				theTrigger.style.top = "0";
				theTrigger.style.height = (theLI[i].clientHeight) + "px"
				theTrigger.style.width = "15px";
				theTrigger.style.zIndex = "150";
				theLI[i].appendChild(theTrigger);
				theTrigger.onclick = function() {
					if(lastClick != this) {
						lastClick.parentNode.className = "expandable";
						this.parentNode.className = "expanded"
					} else {
						if(this.parentNode.className == "expandable"){
							this.parentNode.className = "expanded"
						} else {
							this.parentNode.className = "expandable"
						}
					}
					lastClick = this
					return false;
					
				}
				lastClick = theTrigger
			}
		}
		theLinks = document.getElementById("jobListing").getElementsByTagName("a");
		var l;
		for(l=0;l<theLinks.length;l++) {
			theLinks[l].onmouseover = function() {
				disabled="true"
			}
			theLinks[l].onmouseout = function() {
				disabled="false"
			}
		}
	}
}

// DF1.1 :: domFunction 
// *****************************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
// GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html
//******************************************************
function domFunction(f, a) {
	var n = 0;
	var t = setInterval(function() {
		var c = true;
		n++;
		if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null)) {
			c = false;
			if(typeof a == 'object') {
				for(var i in a) {
					if((a[i] == 'id' && document.getElementById(i) == null) || (a[i] == 'tag' && document.getElementsByTagName(i).length < 1)) { 
						c = true; 
						break; 
					}
				}
			}
			if(!c) { f(); clearInterval(t); }
		}
		if(n >= 60) {
			clearInterval(t);
		}
	}, 250);
};
function createElement(element) {
  if (typeof document.createElementNS != 'undefined') {
    return document.createElementNS('http://www.w3.org/1999/xhtml', element);
  }
  if (typeof document.createElement != 'undefined') {
    return document.createElement(element);
  }
  return false;	
}
