/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** BEGIN - GLOBALS ************************************************************************* */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ////////////////////////////////////////////////// */

/* ********** BEGIN - TAG *************************** */

/* ////////////////////////////////////////////////// */

/*
 
     =====================
     .....................
     ... .................
     .. + ................
     ... ...... ..........
     ......... ^ .........
     .......... ..........
     ......... ^ .........          
     ........ ^^^ ........
     ....... ^^^^^ .......
     ...... ^^^^^^^ ......
     ..... ^^^^^^^^^ .....     
     =====================
     SIMON CORRY BA(HONS.)
     SCIENCE 'N CREATIVITY
     =====================
          
     http://simoncorry.com
               
*/

/* ////////////////////////////////////////////////// */

/* ********** END - TAG ***************************** */

/* ////////////////////////////////////////////////// */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** END - GLOBALS *************************************************************************** */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** BEGIN - FADE **************************************************************************** */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

if (!Element.prototype.addEventListener) {
	var oListeners = {};
	function runListeners(oEvent) {
		if (!oEvent) { oEvent = window.event; }
		for (var iLstId = 0, iElId = 0, oEvtListeners = oListeners[oEvent.type]; iElId < oEvtListeners.aEls.length; iElId++) {
			if (oEvtListeners.aEls[iElId] === this) {
				for (iLstId; iLstId < oEvtListeners.aEvts[iElId].length; iLstId++) { oEvtListeners.aEvts[iElId][iLstId].call(this, oEvent); }
				break;
			}
		}
	}
	Element.prototype.addEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) {
		if (oListeners.hasOwnProperty(sEventType)) {
			var oEvtListeners = oListeners[sEventType];
			for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) {
				if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; }
			}
			if (nElIdx === -1) {
				oEvtListeners.aEls.push(this);
				oEvtListeners.aEvts.push([fListener]);
				this["on" + sEventType] = runListeners;
			} else {
				var aElListeners = oEvtListeners.aEvts[nElIdx];
				if (this["on" + sEventType] !== runListeners) {
					aElListeners.splice(0);
					this["on" + sEventType] = runListeners;
				}
				for (var iLstId = 0; iLstId < aElListeners.length; iLstId++) {
					if (aElListeners[iLstId] === fListener) { return; }
				}			
				aElListeners.push(fListener);
			}
		} else {
			oListeners[sEventType] = { aEls: [this], aEvts: [ [fListener] ] };
			this["on" + sEventType] = runListeners;
		}
	};
	Element.prototype.removeEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) {
		if (!oListeners.hasOwnProperty(sEventType)) { return; }
		var oEvtListeners = oListeners[sEventType];
		for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) {
			if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; }
		}
		if (nElIdx === -1) { return; }
		for (var iLstId = 0, aElListeners = oEvtListeners.aEvts[nElIdx]; iLstId < aElListeners.length; iLstId++) {
			if (aElListeners[iLstId] === fListener) { aElListeners.splice(iLstId, 1); }
		}
	};
}

/* ////////////////////////////////////////////////// */

/* ********** BEGIN - SUBNAVFADE ******************** */

/* ////////////////////////////////////////////////// */

var timeout;
var isHidden = false;

document.addEventListener("mousemove", subnavFade);

function subnavFade() {
    if (timeout) {
        clearTimeout(timeout);
    }
    timeout = setTimeout(function() {
        if (!isHidden) {
            $("#sub-nav").animate({opacity:'toggle'});
            isHidden = true;
        }
    }, 2000);
    if (isHidden) {
        $("#sub-nav").animate({opacity:'toggle'});
        isHidden = false;
    }
};

/* ////////////////////////////////////////////////// */

/* ********** END - SUBNAVFADE ********************** */

/* ////////////////////////////////////////////////// */

/* ////////////////////////////////////////////////// */

/* ********** BEGIN - TIMELINEPOINTERFADE *********** */

/* ////////////////////////////////////////////////// */

/*
var timeout2;
var isHidden2 = false;

document.addEventListener("mousemove", timelinepointerFade);

function timelinepointerFade() {
    if (timeout2) {
        clearTimeout(timeout2);
    }
    timeout2 = setTimeout(function() {
        if (!isHidden2) {
            $("#timeline-pointer").animate({opacity:'toggle'});
            isHidden2 = true;
        }
    }, 7000);
    if (isHidden2) {
        $("#timeline-pointer").delay(1000).animate({opacity:'toggle'});
        isHidden2 = false;
    }
};
*/

/* ////////////////////////////////////////////////// */

/* ********** END - TIMELINEPOINTERFADE ************* */

/* ////////////////////////////////////////////////// */


/* //////////////////////////////////////////////////////////////////////////////////////////////////// */

/* ********** END - FADE ****************************************************************************** */

/* //////////////////////////////////////////////////////////////////////////////////////////////////// */
