/* ***********************************************************************************
	Prototype JavaScript framework, version 1.5.1.2
	(c) 2005-2008 Sam Stephenson - http://www.prototypejs.org/
	'getElementsByClassName' modified from Prototype 1.5.1.2
*********************************************************************************** */
if (!document.getElementsByClassName) {
	if (document.evaluate) { // check to see if the browser features XPath
		document._getElementsByXPath = function(expression, parentElement) {
			var results = [];
			var query = document.evaluate(expression, document.getElementById(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
			for (var i = 0,
			length = query.snapshotLength; i < length; i++) {
				results.push(query.snapshotItem(i));
			}
			return results;
		};
		document.getElementsByClassName = function(className, parentElement) {
			var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
			return document._getElementsByXPath(q, parentElement);
		};
	} else {
		document.getElementsByClassName = function(className, parentElement) {
			var children = (document.getElementById(parentElement) || document.body).getElementsByTagName('*');
			var elements = [],
			child,
			pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
			for (var i = 0,
			length = children.length; i < length; i++) {
				child = children[i];
				var elementClassName = child.className;
				if (elementClassName.length === 0) {
					continue;
				}
				if (elementClassName === className || elementClassName.match(pattern)) {
					elements.push(child);
				}
			}
			return elements;
		};
	}
}

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

	CJ Hover Effect JavaScript framework, v1.0

	Copyright (c) 2008, Doug Jones. All rights reserved.

	Redistribution and use in source and binary forms, with or without
	modification, are permitted provided that the following conditions
	are met:
	
	a) Redistributions of source code must retain the above copyright
	   notice, this list of conditions and the following disclaimer.
	  
	b) Redistributions in binary form must reproduce the above copyright
	   notice, this list of conditions and the following disclaimer in the
	   documentation and/or other materials provided with the distribution. 
	  
	c) Neither the name of the Creative Juices, Bo. Co. nor the names of its
	   contributors may be used to endorse or promote products derived from
	   this software without specific prior written permission.
	
	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
	"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
	LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
	A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
	OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
	LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
	DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
	THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
	OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
	
	For further information, visit the Creative Juices website: www.cjboco.com.
	
	Description: This framework will scan your HTML document for elements
				 with as a class name of "CJ_Hover_Effect". Once found it 
				 will attach events to fade the element in and out on any
				 mouseover and mouseout events.

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

var CJHoverEffect = {

	version: '1.0',
	elemClassName: 'CJ_Hover_Effect',

	hoverEffect: function() {
		var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
		var IE7 = (typeof document.addEventListener != 'function' && window.XMLHttpRequest) ? true : false;
		if (IE6 || IE7) {
			return;
		}
		this.prefs = {
			speed: 15,
			amount: parseFloat(0.05),
			minimum: parseFloat(0.5),
			transparency: parseFloat(0.0),
			type: null,
			timer: null
		};
		this.setOpacity = function(o) {
			if (!o._CJHoverEffect.prefs.transparency) {
				return;
			}
			if (o._CJHoverEffect.prefs.transparency > 1.0) {
				o._CJHoverEffect.prefs.transparency = 1.0;
				return;
			}
			o.style.opacity = o._CJHoverEffect.prefs.transparency;
			o.style.MozOpacity = o._CJHoverEffect.prefs.transparency;
			o.style.filter = "alpha(opacity=" + (o._CJHoverEffect.prefs.transparency * 100) + ")";
		};
		this.fade = function(o, t) {
			var _this = o._CJHoverEffect;
			var op = _this.prefs.transparency;
			var f = function() {
				_this.fade(o, t);
			};
			if (t === "mouseover") {
				if (_this.prefs.timer && _this.prefs.type !== "mouseover") {
					clearTimeout(_this.prefs.timer);
				}
				_this.prefs.transparency = _this.prefs.transparency - _this.prefs.amount < _this.prefs.minimum ? parseFloat(_this.prefs.minimum) : parseFloat(_this.prefs.transparency - _this.prefs.amount);
				_this.setOpacity(o);
				if (_this.prefs.transparency > _this.prefs.minimum) {
					_this.prefs.type = "mouseover";
					_this.prefs.timer = setTimeout(f, parseInt(_this.prefs.speed, 10));
				}
			} else if (t === "mouseout") {
				if (_this.prefs.timer && _this.prefs.type !== "mouseout") {
					clearTimeout(_this.prefs.timer);
				}
				_this.prefs.transparency = _this.prefs.transparency + parseFloat(_this.prefs.amount * 2) > 1 ? parseFloat(1.0) : parseFloat(_this.prefs.transparency + parseFloat(_this.prefs.amount * 2));
				_this.setOpacity(o);
				if (_this.prefs.transparency < 1) {
					_this.prefs.type = "mouseout";
					_this.prefs.timer = setTimeout(f, parseInt(_this.prefs.speed / 2, 10));
				}
			}
		};
	},
	addEvent: function(e, t, fn, c) {
		if (e.addEventListener) {
			e.addEventListener(t, fn, c);
			return true;
		} else if (e.attachEvent) {
			var r = e.attachEvent('on' + t, fn);
			return r;
		} else {
			e['on' + t] = fn;
		}
	},
	init: function() {
		var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
		var IE7 = (typeof document.addEventListener != 'function' && window.XMLHttpRequest) ? true : false;
		if (IE6 || IE7 || !document.getElementById || !document.createElement) {
			return;
		}
		var os = document.getElementsByClassName(CJHoverEffect.elemClassName);
		for (var i in os) {
			if (os[i]) {
				var o = os[i];
				if (o.className === CJHoverEffect.elemClassName) {
					var f;
					o._CJHoverEffect = new CJHoverEffect.hoverEffect();
					o._CJHoverEffect.prefs.transparency = 1;
					f = function() {
						return function(e) {
							var event = !e ? window.event: e;
							this._CJHoverEffect.fade(this, e.type);
						};
					} ();
					CJHoverEffect.addEvent(o, 'mouseover', f, false);
					CJHoverEffect.addEvent(o, 'mouseout', f, false);
					f = function() {
						return function(e) {
							var event = !e ? window.event: e;
							if (this._CJHoverEffect && this._CJHoverEffect.prefs.timer) {
								clearTimeout(this._CJHoverEffect.prefs.timer);
							}
							if (this._CJHoverEffect.prefs.transparency < 1) {
								this._CJHoverEffect.prefs.transparency = 1.0;
								this._CJHoverEffect.setOpacity(this);
							}
						};
					} ();
					CJHoverEffect.addEvent(o, 'click', f, false);
				}
			}
		}
	}
};

CJHoverEffect.addEvent(window, 'load', CJHoverEffect.init, false);