// --------- Brent Farris --------- \\
//           jFarris  1.4           \\
//	  http://www.farrisarts.com		\\
// -------------------------------- \\

var activeElements = new Array();var jf = new function(){this.files = new function(){this.external = function(elmid, file){var xmlHttp = getXMLHttp();xmlHttp.onreadystatechange = function(){if(xmlHttp.readyState == 4){HandleResponse(elmid, xmlHttp.responseText);}};xmlHttp.open("GET", file, true);xmlHttp.send(null);}};this.img = new function(){this.presets = new function(){this.fade = function(parentId, fadeAmount, fadeSpeed, duration, startFrom, override){if (override)clearTimeout(switchNext);nxtimgChildren = document.getElementById(parentId).getElementsByTagName("div");if (fadeAmount == "large")nxtimgAmount = 0.5;else if (fadeAmount == "medium")nxtimgAmount = 0.25;else if (fadeAmount == "small")nxtimgAmount = 0.05;else if (fadeAmount == "subtle")nxtimgAmount = 0.025;else nxtimgAmount = fadeAmount;if (fadeSpeed == "fast")nxtimgSpeed = 15;else if (fadeSpeed == "mid")nxtimgSpeed = 30;else if (fadeSpeed == "slow")nxtimgSpeed = 50;else if (fadeSpeed == "crawl")nxtimgSpeed = 100;else {var breakDown = 1 / amount;nxtimgSpeed = fadeSpeed / breakDown; }if (duration == "long")nxtimgDuration = 10000;else if (duration == "medium")nxtimgDuration = 5000;else if (duration == "short")nxtimgDuration = 2000;else if (duration == "tiny")nxtimgDuration = 500;else nxtimgDuration = duration;if (startFrom != null)startImg = startFrom;else startImg = 0;setTimeout("nxtimg("+startImg+", -1)", 100);}}};this.loops = new function(){this.sleepLoop = function(callFunction, restTime, loops){if (loops != null){if (loops >= 0){loops--;eval(callFunction);}}else {eval(callFunction);loops = null;}setTimeout(function() { jf.loops.sleepLoop(callFunction, restTime, loops); }, restTime);}};this.obj = new function(){var originalWidth = 0;var originalHeight = 0;var currentWidth = 0;var currentHeight = 0;var started = false;this.expand = function(elmid, direction, xspeed, increment, width, height){if (xspeed == "fast")speed = 1;else if (xspeed == "medium")speed = 25;else if (xspeed == "slow")speed = 50;if (increment != null)inc = increment;else inc = 5;if (!started){if (width == null && height == null){if (document.getElementById(elmid).style.width != '0px')originalWidth = parseInt(document.getElementById(elmid).style.width);if (document.getElementById(elmid).style.height != '0px')originalHeight = parseInt(document.getElementById(elmid).style.height);}else if (width != null && height != null){originalWidth = width;originalHeight = height;if (isNaN(parseInt(document.getElementById(elmid).style.width)))currentWidth = 0;elsecurrentWidth = parseInt(document.getElementById(elmid).style.width);if (isNaN(parseInt(document.getElementById(elmid).style.height)))currentHeight = 0;elsecurrentHeight = parseInt(document.getElementById(elmid).style.height);}else if (width != null){originalWidth = width;if (isNaN(parseInt(document.getElementById(elmid).style.width)))currentWidth = 0;elsecurrentWidth = parseInt(document.getElementById(elmid).style.width);}else if (height != null){originalHeight = height;if (isNaN(parseInt(document.getElementById(elmid).style.height)))currentHeight = 0;else currentHeight = parseInt(document.getElementById(elmid).style.height);}document.getElementById(elmid).style.display = "block";started = true;}if (direction == "top"){currentWidth = originalWidth;document.getElementById(elmid).style.width = originalWidth + "px";}if (direction == "left"){currentHeight = originalHeight;document.getElementById(elmid).style.height = originalHeight + "px";}if (currentHeight < originalHeight || currentWidth < originalWidth){if (currentHeight < originalHeight){if (direction == "top" || direction == "both"){currentHeight += inc;var conv = currentHeight + 'px';document.getElementById(elmid).style.height = conv;}}if (currentWidth < originalWidth){if (direction == "left" || direction == "both"){currentWidth += inc;var conv = currentWidth + 'px';document.getElementById(elmid).style.width = conv;}}setTimeout(function() { jf.obj.expand(elmid, direction, speed, inc) }, speed);}else {originalWidth = 0;originalHeight = 0;currentWidth = 0;currentHeight = 0;started = false;}};this.collapse = function(elmid, direction, speed, increment, width, height){if (speed == "fast")speed = 1;else if (speed == "medium")speed = 25;else if (speed == "slow")speed = 50;if (increment != null)inc = increment;else inc = 5;if (!started){currentWidth = parseInt(document.getElementById(elmid).style.width);currentHeight = parseInt(document.getElementById(elmid).style.height);if (width == null && height == null){originalWidth = 0;originalHeight = 0;}else if (width != null && height != null){originalWidth = width;originalHeight = height;}else if (width != null){originalWidth = width;originalHeight = 0;}else if (height != null){originalWidth = 0;originalHeight = height;}started = true;}var execute = false;if (direction == "top")if (currentHeight > originalHeight)execute = true;else if (direction == "left")if (currentWidth > originalWidth)execute = true;else if (direction == "both")if (currentHeight > originalHeight || currentWidth > originalWidth)execute = true;if (execute){if (currentHeight > originalHeight){if (direction == "top" || direction == "both"){currentHeight -= inc;var conv = currentHeight + 'px';document.getElementById(elmid).style.height = conv;}}if (currentWidth > originalWidth){if (direction == "left" || direction == "both"){currentWidth -= inc;var conv = currentWidth + 'px';document.getElementById(elmid).style.width = conv;}}setTimeout(function() { jf.obj.collapse(elmid, direction, speed, inc) }, speed);}else {if (currentHeight <= 0 || currentWidth <= 0)document.getElementById(elmid).style.display = "none";originalWidth = 0;originalHeight = 0;currentWidth = 0;currentHeight = 0;started = false;}};this.fade = function(elmid, direction, amount, speed, transparency, once, busy){if (!busy || busy == null){if (AddActive(elmid)){busy = true;}}if (busy){if (typeof(elmid) == 'object')elm = elmid;else elm = document.getElementById(elmid);if (elm.style.display == 'none')elm.style.display = 'block';if (amount == "large")amount = 0.5;else if (amount == "medium")amount = 0.25;else if (amount == "small")amount = 0.05;else if (amount == "subtle")amount = 0.025;if (speed == "fast")xspeed = 15;else if (speed == "mid")xspeed = 30;else if (speed == "slow")xspeed = 50;else if (speed == "crawl")xspeed = 100;else {var breakDown = 1 / amount;xspeed = speed / breakDown; }if (transparency == null)transparency = direction;executeFade = function(){var op = parseFloat(elm.style.opacity);if (direction == 0)op -= amount;else op += amount;elm.style.opacity = op;op *= 10;elm.style.filter = '"alpha(opacity=' + op + ')"';setTimeout(function() {jf.obj.fade(elmid, direction, amount, speed, transparency, once, true) }, xspeed);};clean = false;if (!once || once == null){if (direction == 0){if (elm.style.opacity > transparency){executeFade();clean = false;}else {clean = true;}}else {if (elm.style.opacity < transparency){executeFade();clean = false;}else {clean = true;}}if (clean){Cleanup(elmid);}}else {var op = parseFloat(elm.style.opacity);if (direction == 0)op -= amount;else op += amount;elm.style.opacity = op;op *= 10;elm.style.filter = '"alpha(opacity=' + op + ')"';}if (elm.style.opacity <= 0)elm.style.display = 'none';}}};};var nxtimgAmount = 0;var nxtimgSpeed = 0;var nxtimgDuration = 0;var nxtimgChildren = new Array();var switchNext;function nxtimg(imgid, imgid2){if (nxtimgChildren[imgid].style.opacity < 1){jf.obj.fade(nxtimgChildren[imgid], 1, nxtimgAmount, null, null, true, true);if (imgid2 != -1){jf.obj.fade(nxtimgChildren[imgid2], 0, nxtimgAmount, null, null, true, true);}switchNext = setTimeout("nxtimg("+ imgid +", "+ imgid2 +")", nxtimgSpeed); }else {imgid2 = imgid;imgid += 1;if (imgid == nxtimgChildren.length)imgid = 0;switchNext = setTimeout("nxtimg("+ imgid +", "+ imgid2 +")", nxtimgDuration);}}function getXMLHttp(){var xmlHttp;try{xmlHttp = new XMLHttpRequest();}catch(e){try{xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser does not support AJAX!");return false;}}}return xmlHttp;}function HandleResponse(elmid, response){document.getElementById(elmid).innerHTML = response;}function AddActive(elm){addto = true;for (var i = 0; i < activeElements.length; i++){if (activeElements[i] == elm){addto = false;break;}}if (addto)activeElements.push(elm);return addto;}function Cleanup(elm){for (var i = 0; i < activeElements.length; i++){if (activeElements[i] == elm){activeElements[i] = null;break;}}clean = true;for (var i = 0; i < activeElements.length; i++){if (activeElements[i] != null){clean = false;break;}}if (clean)activeElements = new Array();}var mouseX = 0, mouseY = 0;document.documentElement.onmousemove = function (e){e = e || window.event;mouseX = e.clientX;mouseY = e.clientY;};function mouseIsOver(){return document.elementFromPoint(mouseX, mouseY);}
