
/*
	Source: classbehaviours.handlers._template.js
	ClassBehaviours is a javascript framework based on class-name parsing.
	Copyright 2011 by Maurice van Creij and published on http://www.woollymittens.nl/
	This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
*/

	// CLASSBEHAVIOURS CLASS
	// create the root classbehaviours object if it doesn't already exist
	if(typeof(classBehaviours)=='undefined') classBehaviours = {};

		// CLASSNAME BEHAVIOUR FUNCTIONS
		// create the handlers child object if it doesn't already exist
		if(typeof(classBehaviours.handlers)=='undefined') classBehaviours.handlers = {}

			// implements the functionality to this classname
			classBehaviours.handlers.dropDownSelector = {
				// properties
				name: 'dropDownSelector',
				instance: 0,
				widthOffset: 10,
				settings: new Array(),
				// methods
				start: function(node){
					// create a node specific config object
					node.id = (node.id) ? node.id : this.name + '_' + this.instance++ ;
					this.settings[node.id] = {};
					// build the selector from the select element
					if(node.nodeName.indexOf('SELECT')>-1) this.build(node);
				},
				build: function(node){
					// shortcut pointers
					var dds = classBehaviours.handlers.dropDownSelector;
					var cu = classBehaviours.utilities;
					var tnn = classBehaviours.handlers.toggleNextNode;
					var cfg = dds.settings[node.id];
					// get the select element
					var selectElement = node;
					// create a new wrapper around this element
					var selectWrapper = document.createElement('span');
					selectWrapper.style.width = selectElement.offsetWidth + 'px';
					// transfer the classname of the select element to the wrapper
					selectWrapper.className = selectElement.className;
					// incorporate the value of the select element in the class name of the wrapper
					cu.setClassParameter(selectWrapper, 'value', selectElement.value.replace(/ /g, ''));
					// insert the wrapper before the select element
					selectElement.parentNode.insertBefore(selectWrapper, selectElement);
					// move the select element into the wrapper
					selectElement = selectElement.parentNode.removeChild(selectElement, true);
					selectWrapper.appendChild(selectElement);
					// create a new SPAN element
					var newOuterSpanElement = document.createElement('span');
					var newInnerSpanElement = document.createElement('span');
					// get the text content of the SPAN element from the select element's options
					var selectOptions = selectElement.getElementsByTagName('option');
					newInnerSpanElement.innerHTML = selectOptions[selectElement.selectedIndex].firstChild.nodeValue.split(' - ')[0];
					// add the SPAN element to the root node
					newOuterSpanElement.appendChild(newInnerSpanElement);
					newOuterSpanElement.style.width = selectElement.offsetWidth + 'px';
					selectWrapper.insertBefore(newOuterSpanElement, selectElement);
					// build the dropdown list
					var newUlElement = document.createElement('ul');
					var newLiElement, newAElement;
					for(var a=0; a<selectOptions.length; a++){
						// create a new LI element
						newLiElement = document.createElement('li');
						// create a new A element
						newAElement = document.createElement('a');
						// set the target URL of the A element
						newAElement.setAttribute('href', '#');
						// set the classname of the A element
						cu.setClassParameter(newAElement, 'index', a);
						cu.setClassParameter(newAElement, 'value', selectOptions[a].value.replace(/ /g, ''));
						// set the text content of the A element
						newAElement.innerHTML = selectOptions[a].firstChild.nodeValue;
						// add the click event to the new A element
						cu.addEvent(newAElement, 'click', (
							// with a copy of the pointer
							function(aElement){
								return function(event){
									// handle the event
									dds.select(aElement);
									// cancel the click on the A element
									event.preventDefault ? event.preventDefault() : event.returnValue = false;
								}
							}(newAElement)
						));
						// add the A element to the LI
						newLiElement.appendChild(newAElement);
						// add the LI element to the UL
						newUlElement.appendChild(newLiElement);
					}
					// set the minimum size of UL element
					newUlElement.style.minWidth = (selectWrapper.offsetWidth - dds.widthOffset) + 'px';
					if(navigator.userAgent.indexOf('MSIE 6')>-1 || navigator.userAgent.indexOf('MSIE 7')>-1){
						newUlElement.style.marginLeft = '-' + selectWrapper.offsetWidth + 'px';
						newUlElement.style.marginTop = newOuterSpanElement.offsetHeight + 'px';
					}
					// add the UL element to the root node
					selectWrapper.insertBefore(newUlElement, selectElement);
					// make sure the construct still responds to the selected index of the select
					cfg.selectedIndex = selectElement.selectedIndex;
					cfg.interval = setInterval(function(){
						if(selectElement.selectedIndex != cfg.selectedIndex){
							var allOptions = selectWrapper.getElementsByTagName('A')
							// update the selection
							dds.select(allOptions[selectElement.selectedIndex]);
						}
					}, 1000);
					// activate the styling of the root node
					selectWrapper.className += ' dropdown_active';
					newOuterSpanElement.className = 'toggleNextNode family_dropdownselector';
					newUlElement.className = 'hideThisNode';
					tnn.start(newOuterSpanElement);
				},
				// events
				select: function(that){
					// shortcut pointers
					var node = (typeof(this.nodeName)=='undefined') ? that : this ;
					var dds = classBehaviours.handlers.dropDownSelector;
					var htn = classBehaviours.handlers.hideThisNode;
					var cu = classBehaviours.utilities;
					// get the root element
					var rootElement = node.parentNode.parentNode.parentNode;
					// transfer the value to the wrapper as a classname
					var spanElement = rootElement.getElementsByTagName('span')[1];
					spanElement.innerHTML = node.innerHTML.split(' - ')[0];
					cu.setClassParameter(
						rootElement,
						'value',
						cu.getClassParameter(node, 'value')
					);
					// set the selected index of the select element
					var selectElement = rootElement.getElementsByTagName('select')[0];
					selectElement.selectedIndex = parseInt(cu.getClassParameter(node, 'index', '0'));
					// trigger the onchange event the element might have
					cu.triggerEvent(selectElement, 'change');
					// trigger toggle next node for this item
					htn.start(rootElement.getElementsByTagName('ul')[0]);
					// store the new index
					var cfg = dds.settings[selectElement.id];
					cfg.selectedIndex = selectElement.selectedIndex;
				}
			}

	// JQUERY WRAPPER
	if(typeof(jQuery)!='undefined'){
		(function($){
			var methods = {
				init : function(options) {
					return this.each(function(){
						classBehaviours.handlers.dropDownSelector.start($(this).context);
					});
				}
			};
			$.fn.dropDownSelector = function(method){
				if(methods[method]) {
					return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
				}else if(typeof method === 'object' || !method){
					return methods.init.apply(this, arguments);
				}else{
					$.error('Method ' +  method + ' does not exist on jQuery.dropDownSelector');
				}
			};
		})(jQuery);

		// JQUERY EVENTS
		$(document).ready(function() {
			$(".dropDownSelector").dropDownSelector();
		});

		/* DIRECT APPLICATION
		$("#myList li").addClass('dropDownSelector foo_bar');
		$("#myList li").dropDownSelector();
		*/
	}

/*
	Source: classbehaviours.handlers.togglenextnode.js
	ClassBehaviours is a javascript framework based on class-name parsing.
	Copyright 2011 by Maurice van Creij and published on http://www.woollymittens.nl/
	This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
*/

	// CLASSBEHAVIOURS CLASS
	// create the root classbehaviours object if it doesn't already exist
	if(typeof(classBehaviours)=='undefined') classBehaviours = {};

		// CLASSNAME BEHAVIOUR FUNCTIONS
		// create the handlers child object if it doesn't already exist
		if(typeof(classBehaviours.handlers)=='undefined') classBehaviours.handlers = {}

			// open or close a container object
			document.writeln("<style>.toggleNextNode{cursor:pointer;}</style>");
			classBehaviours.handlers.toggleNextNode = {
				// properties
				name: 'toggleNextNode',
				step: 10,
				acceleration: 10,
				extra: 0,
				delay: 50,
				index: 0,
				// methods
				start: function(node){
					var t2n = classBehaviours.handlers.toggleNextNode;
					var cu = classBehaviours.utilities;
					// set the event handlers for the source node
					if(node.nodeName=='INPUT' || node.nodeName=='TEXTAREA' || node.nodeName=='SELECT'){
						cu.addEvent(node, 'focus', function(event){t2n.toggle(node, event)});
						cu.addEvent(node, 'blur', function(event){t2n.toggle(node, event)});
					}else{
						cu.addEvent(node, 'click', function(event){t2n.toggle(node, event)});
					}
					// give this node an id if it doesn't have one yet
					node.id = (node.id) ? node.id : t2n.name + t2n.index++ ;
					// is this node marked as "auto", order it to open on a timeout
					autoDelay = cu.getClassParameter(node, 'auto', null);
					if(autoDelay){
						t2n.index++
						node.id = (node.id) ? node.id : t2n.name + t2n.index ;
						setTimeout(function(){
							classBehaviours.handlers.toggleNextNode.toggle(node);
						}, autoDelay);
					}
				},
				findContainer: function(targetLabel, targetRecursion){
					var t2n = classBehaviours.handlers.toggleNextNode;
					var cu = classBehaviours.utilities;
					// if there was a target recursion, recurse parent nodes
					if(targetRecursion) for(var a=0; a<parseInt(targetRecursion); a++) targetLabel = targetLabel.parentNode;
					// get the next sibling of the label, which should be the container
					targetObject = cu.nextNode(targetLabel);
					// give it an ID for reference
					targetObject.id = (targetObject.id) ? targetObject.id : t2n.name + 'Target' + t2n.index++;
					// pass it back
					return targetObject;
				},
				positionContainer: function(targetContainer, screenXpos, screenYpos){
					if(targetContainer.firstChild!=null){
						// if the position is too close to the edge
						targetContainerWidth = targetContainer.firstChild.offsetWidth;
						screenWidth = (window.innerWidth) ? window.innerWidth : document.documentElement.clientWidth ;
						scrolledWidth = (typeof(document.documentElement.scrollLeft)!='undefined') ? document.documentElement.scrollLeft : window.pageXOffset ;
						if(screenXpos+targetContainerWidth > screenWidth+window.pageXOffset) screenXpos -= targetContainerWidth;
						// if the position is too close to the bottom
						targetContainerHeight = targetContainer.firstChild.offsetHeight;
						screenHeight = (window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight ;
						scrolledHeight = (typeof(document.documentElement.scrollTop)!='undefined') ? document.documentElement.scrollTop : window.pageYOffset ;
						if(screenYpos+targetContainerHeight+10 > screenHeight+scrolledHeight) screenYpos -= targetContainerHeight;
						// set the position
						targetContainer.style.left = screenXpos + 'px';
						targetContainer.style.top = screenYpos + 'px';
					}
				},
				// events
				toggle: function(node, event){
					var objNode = node;
					var t2n = classBehaviours.handlers.toggleNextNode;
					var cu = classBehaviours.utilities;
					// get all information on this node
					targetLabel = objNode;
					targetAnchor = (targetLabel.getAttribute('href')!=null) ? (targetLabel.getAttribute('href').indexOf('#')>-1) ? targetLabel.getAttribute('href').split('#')[1] : null : null ;
					targetContainerId = cu.getClassParameter(targetLabel, 'id', targetAnchor);
					targetRecursion = cu.getClassParameter(targetLabel, 'parent', null);
					targetClosable = (cu.getClassParameter(targetLabel, 'closable', 'yes') == 'yes');
					targetAtMouse = (cu.getClassParameter(targetLabel, 'atmouse', 'no') == 'yes');
					targetContainer = (targetContainerId!=null) ? document.getElementById(targetContainerId) : t2n.findContainer(targetLabel, targetRecursion) ;
					// if the target container is not marked for hiding or showing, mark it now
					if(targetContainer.className.indexOf('hideThisNode')<0 && targetContainer.className.indexOf('showThisNode')<0) targetContainer.className += ' showThisNode' ;
					// call for the node to grow or shrink
					targetGrows = (targetContainer.className.indexOf('hideThisNode')>-1);
					if(!targetGrows && targetClosable || targetGrows) t2n.update(targetLabel.id, targetGrows);
					// position the node at the mouse' position if needed
					if(targetAtMouse && targetGrows){
						// get the position
						screenXpos = (typeof(event)!='undefined' && document.all) ? event.x : that.layerX ;
						screenYpos = (typeof(event)!='undefined' && document.all) ? event.y : that.layerY ;
						// set the position
						t2n.positionContainer(targetContainer, screenXpos, screenYpos);
					}
					// cancel the click
					if(event!=null) event.preventDefault ? event.preventDefault() : event.returnValue = false;
				},
				update: function(id, grows){
					var t2n = classBehaviours.handlers.toggleNextNode;
					var cu = classBehaviours.utilities;
					// get all information on this node
					var targetLabel = document.getElementById(id);
					var targetAnchor = (targetLabel.getAttribute('href')!=null) ? (targetLabel.getAttribute('href').indexOf('#')>-1) ? targetLabel.getAttribute('href').split('#')[1] : null : null ;
					var targetContainerId = cu.getClassParameter(targetLabel, 'id', targetAnchor);
					var targetFamily = cu.getClassParameter(targetLabel, 'family', null);
					var targetRecursion = cu.getClassParameter(targetLabel, 'parent', null);
					var targetContainer = (targetContainerId!=null) ? document.getElementById(targetContainerId) : t2n.findContainer(targetLabel, targetRecursion) ;
					// TARGET NODE
					// prepare the container
					targetContainer.style.overflow = 'hidden';
					targetContainer.style.visibility = 'visible';
					// open or close the container
					if(!grows){
						classBehaviours.fader.size(targetContainer, null, 1, t2n.step, t2n.delay, t2n.acceleration, function(){classBehaviours.handlers.hideThisNode.start(targetContainer)});
					}else{
						classBehaviours.fader.size(targetContainer, 1, null, t2n.step, t2n.delay, t2n.acceleration, function(){classBehaviours.handlers.showThisNode.start(targetContainer)});
					}
					// activate the link
					targetLabel.className = (!grows) ? targetLabel.className.replace('active', 'link') : targetLabel.className.replace('link', 'active');
					// PEER NODES
					// get all nodes of this class
					var allNodes = cu.getElementsByClassName(t2n.name);
					// for every node in the node-list
					for(var a=0; a<allNodes.length; a++){
						// get its properties
						var peerLabel = allNodes[a];
						var peerAnchor = (peerLabel.getAttribute('href')!=null) ? (peerLabel.getAttribute('href').indexOf('#')>-1) ? peerLabel.getAttribute('href').split('#')[1] : null : null ;
						var peerContainerId = cu.getClassParameter(peerLabel, 'id', peerAnchor);
						var peerFamily = cu.getClassParameter(peerLabel, 'family', null);
						var peerRecursion = cu.getClassParameter(peerLabel, 'parent', null);
						var peerContainer = (peerContainerId!=null) ? document.getElementById(peerContainerId) : t2n.findContainer(peerLabel, peerRecursion) ;
						// if this node belongs to the same family and is open but has a different id
						if(peerFamily==targetFamily && peerFamily!=null && peerContainer.className.indexOf('hideThisNode')<0 && peerContainer!=targetContainer){
							// prepare the container
							peerContainer.style.overflow = 'hidden';
							peerContainer.style.visibility = 'visible';
							var peerTarget = peerContainer;
							// close the container
							classBehaviours.fader.size(peerContainer, null, 1, t2n.step ,t2n.delay, t2n.acceleration, function(){classBehaviours.handlers.hideThisNode.start(peerTarget)});
							// de-activate the link
							peerLabel.className = peerLabel.className.replace('active', 'link');
						}
					}
				}
			}

			// hide the "hideThisNode" class behaviour by default
			document.writeln("<style>.hideThisNode{overflow:hidden; visibility:hidden; height:1px;}</style>");
			classBehaviours.handlers.hideThisNode = {
				// properties
				name: 'hideThisNode',
				// methods
				start: function(node){
					node.style.overflow = 'hidden';
					node.style.visibility = 'hidden';
					node.style.height = '1px';
					node.className = node.className.replace('showThisNode', 'hideThisNode');
				}
			}

			// explicit opposite of a hidden node
			document.writeln("<style>.ShowThisNode{overflow:visible; visibility:visible; height:auto;}</style>");
			classBehaviours.handlers.showThisNode = {
				// properties
				name: 'showThisNode',
				// methods
				start: function(node){
					node.style.overflow = 'visible';
					node.style.visibility = 'visible';
					node.style.height = 'auto';
					node.className = node.className.replace('hideThisNode', 'showThisNode');
				}
			}

	// JQUERY WRAPPER
	if(typeof(jQuery)!='undefined'){
		(function($){
			var methods = {
				init : function(options) {
					return this.each(function(){
						classBehaviours.handlers.toggleNextNode.start($(this).context);
					});
				},
				hideThisNode : function(){
					return this.each(function(){
						classBehaviours.handlers.hideThisNode.start($(this).context);
					});
				},
				showThisNode : function(){
					return this.each(function(){
						classBehaviours.handlers.showThisNode.start($(this).context);
					});
				}
			};
			$.fn.toggleNextNode = function(method){
				if(methods[method]) {
					return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
				}else if(typeof method === 'object' || !method){
					return methods.init.apply(this, arguments);
				}else{
					$.error('Method ' +  method + ' does not exist on jQuery.togglenextnode');
				}
			};
		})(jQuery);

		// JQUERY EVENTS
		$(document).ready(function() {
			$(".toggleNextNode").toggleNextNode();
			$(".hideThisNode").toggleNextNode('hideThisNode');
			$(".showThisNode").toggleNextNode('showThisNode');
		});
	}

/*
	Source: classbehaviours.fader.js
	ClassBehaviours is a javascript framework based on class-name parsing.
	Copyright 2011 by Maurice van Creij and published on http://www.woollymittens.nl/
	This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
*/

	// CLASSBEHAVIOURS CLASS
	// create the root classbehaviours object if it doesn't already exist
	if(typeof(classBehaviours)=='undefined') classBehaviours = {};

		// COMMON FADER FUNCTIONS
		// create the utilities child object if it doesn't already exist
		if(typeof(classBehaviours.fader)=='undefined') classBehaviours.fader = {
			getFade : function(node){
				var fadeValue = null;
				if(node!=null){
					// get the fade value using the proper method
					if(typeof(node.style.MozOpacity)!='undefined') fadeValue = Math.round(parseFloat(node.style.MozOpacity)*100);
					if(typeof(node.filters)!='undefined') if(typeof(node.filters.alpha)!='undefined') fadeValue = parseInt(node.filters.alpha.opacity);
					if(typeof(node.style.opacity)!='undefined')	fadeValue = Math.round(parseFloat(node.style.opacity)*100);
				}
				// return the value
				return (isNaN(fadeValue)) ? null : fadeValue;
			},
			setFade : function(node, amount){
				if(node!=null){
					// set the fade value using the proper method
					if(typeof(node.style.MozOpacity)!='undefined') node.style.MozOpacity = amount/100;
					if(typeof(node.filters)!='undefined') if(typeof(node.filters.alpha)!='undefined') node.filters.alpha.opacity = amount;
//					if(typeof(node.style.filter)!='undefined') if(typeof(node.style.filter.alpha)!='undefined') node.style.filter = "alpha(opacity=" + amount + ")";
					if(typeof(node.style.opacity)!='undefined') node.style.opacity = amount/100;
				}
				//	filter:alpha(opacity=50);	imageobject.filters.alpha.opacity=opacity
				//	-moz-opacity: 0.5;			imageobject.style.MozOpacity=opacity/100
				//	opacity: 0.5;
				//	-khtml-opacity: 0.5;
			},
			getSize : function(node){
				// measure the height of the container
				var nodeWidth = node.offsetWidth;
				var nodeHeight = node.offsetHeight;
				// measure the height of all the childnodes of the container
				var totalWidth = 0;
				var totalHeight = 0;
				var contents = node.childNodes;
				for(var a=0; a<contents.length; a++){
					totalWidth += (contents[a].offsetWidth) ? contents[a].offsetWidth : 0 ;
					totalHeight += (contents[a].offsetHeight) ? contents[a].offsetHeight : 0 ;
				}
				// pass back the largest number
				return new Array(nodeWidth, nodeHeight, totalWidth, totalHeight);
			},
			setSize : function(node, xAmount, yAmount){
				if(xAmount!=null) node.style.width = xAmount + 'px';
				if(yAmount!=null) node.style.height = yAmount + 'px';
			},
			fade : function(id, start, end, step, delay, acceleration, evalOnEnd){
				var cf = classBehaviours.fader;
				// get the target node
				var target = (typeof(id)=='string') ? document.getElementById(id) : id ;
				// get the start value if missing
				if(start==null) start = cf.getFade(target);
				if(end==null) end = 100;
				if(step==null) step = 1;
				if(delay==null) delay = 10;
				if(acceleration==null) acceleration = 1;
				if(evalOnEnd==null) evalOnEnd = '';
				// calculate the new value
				if(start<end) {value = (start+step>end) ? end : start+step ;}
				else if(start>end) {value = (start-step<end) ? end : start-step ;}
				// set the fade
				cf.setFade(target, value);
				// order the next step
				var timeOut;
				if(value!=end){
					timeOut = setTimeout(function(){
						classBehaviours.fader.fade(id, value, end, step+acceleration, delay, acceleration, evalOnEnd);
					}, delay);
				}else {
					if(typeof(evalOnEnd)=='string'){
						eval(evalOnEnd);
					}else{
						evalOnEnd();
					}
				}
				// return a way of cancelling the animation
				return timeOut;
			},
			size : function(id, start, end, step, delay, acceleration, evalOnEnd){
				var cf = classBehaviours.fader;
				// get the target node
				var target = (typeof(id)=='string') ? document.getElementById(id) : id ;
				// get the start value if missing
				if(start==null) start = cf.getSize(target)[1];
				if(end==null) end = cf.getSize(target)[3];
				if(step==null) step = 10;
				if(delay==null) delay = 10;
				if(acceleration==null) acceleration = 10;
				if(evalOnEnd==null) evalOnEnd = '';
				// calculate the new value
				if(start<end) {value = (start+step>end) ? end : start+step ;}
				else if(start>end) {value = (start-step<end) ? end : start-step ;}
				// set the fade
				cf.setSize(target, null, value);
				// order the next step
				var timeOut;
				if(value!=end) {
					var nextTarget = target;
					var nextValue = value;
					var nextEnd = end;
					var nextStep = step+acceleration;
					var nextDelay = delay;
					var nextAcceleration = acceleration;
					var nextEvalOnEnd = evalOnEnd;
					timeOut = setTimeout(function(){
						classBehaviours.fader.size(nextTarget, nextValue, nextEnd, nextStep, nextDelay, nextAcceleration, nextEvalOnEnd);
					}, delay);
				}else {
					if(typeof(evalOnEnd)=='string'){
						eval(evalOnEnd);
					}else{
						evalOnEnd();
					}
				}
				// return a way of cancelling the animation
				return timeOut;
			},
			// START: legacy wrappers
			fadeIn : function(id, step, delay, evalOnEnd, acceleration){
				fade(id, 0, 100, step, delay, acceleration, evalOnEnd);
			},
			fadeOut : function(id, step, delay, evalOnEnd, acceleration){
				fade(id, 100, 0, step, delay, acceleration, evalOnEnd);
			},
			crossFade : function(idIn, idOut, amount, step, delay, evalOnEnd, acceleration){
				fade(idIn, 0, 100, step, delay, acceleration, evalOnEnd);
				fade(idOut, 100, 0, step, delay, acceleration, '');
			},
			grow : function(id, step, delay, evalOnEnd, acceleration){
				size(id, 1, null, step, delay, acceleration, evalOnEnd);
			},
			shrink : function(id, step, delay, evalOnEnd, acceleration){
				size(id, null, 1, step, delay, acceleration, evalOnEnd);
			}
			// END: legacy wrappers
		}

/*
	Source: classbehaviours.utilities.js
	ClassBehaviours is a javascript framework based on class-name parsing.
	Copyright 2011 by Maurice van Creij and published on http://www.woollymittens.nl/
	This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
*/

	// CLASSBEHAVIOURS CLASS
	// create the root classbehaviours object if it doesn't already exist
	if(typeof(classBehaviours)=='undefined') classBehaviours = {};

		// COMMON UTILITY FUNCTIONS
		// create the utilities child object if it doesn't already exist
		if(typeof(classBehaviours.utilities)=='undefined') classBehaviours.utilities = {
			// returns all nodes of the same class
			getElementsByClassName : function(className, node){
				// use the whole body if no target was provided
				var target = (node!=null) ? node : document ;
				// make an empty array for the results
				var foundNodes = new Array();
				// make a regular expression to recognise the class name
				var wantedClass = new RegExp('\\b'+className+'\\b');
				// for all elements in the parent node
				var allNodes = (target.all) ? target.all : target.getElementsByTagName("*");
				for(var a=0; a<allNodes.length; a++){
					// if the classname was found add it to the results
					if(wantedClass.test(allNodes[a].className)) foundNodes[foundNodes.length] = allNodes[a];
				}
				// return the list
				return foundNodes;
			},
			// gets the value of a parameter from a className
			getClassParameter : function(targetNode, paramName, defaultValue){
				if(targetNode!=null){
					var parameterValue = (targetNode.className.indexOf(' ' + paramName + '_')>-1) ?
						targetNode.className.split(' ' + paramName + '_')[1].split(' ')[0] :
						defaultValue ;
					return (isNaN(defaultValue) || defaultValue==null || defaultValue=='' || typeof(defaultValue)!='string') ?
						parameterValue :
						parseFloat(parameterValue.replace('D','.'));
				}else{
					return defaultValue;
				}
			},
			// sets the value of a parameter from a className
			setClassParameter : function(targetNode, paramName, newValue){
				if(targetNode!=null){
					// create a default value, if there isn't one
					if(targetNode.className==null) targetNode.className = '';
					if(targetNode.className.indexOf(' ' + paramName + '_')<0) targetNode.className += ' ' + paramName + '_0';
					// get the old value
					oldValue = this.getClassParameter(targetNode, paramName, null);
					// replace the old value
					if(oldValue!=null) targetNode.className = targetNode.className.replace(paramName+'_'+oldValue, paramName+'_'+newValue);
				}
			},
			// get the next node without worrying about text nodes
			nextNode : function(targetNode, count){
				var testNode = targetNode;
				if(count==null) count = 1;
				for(var a=0; a<count; a++){
					do {
						testNode = (testNode.nextSibling!=null) ? testNode.nextSibling : targetNode ;
					}while(testNode.nodeName.indexOf('#text')>-1);
				}
				return testNode;
			},
			// get the previous node without worrying about text nodes
			previousNode : function(node, count){
				testNode = node;
				if(count==null) count = 1;
				// look for the previous html node
				for(var a=0; a<count; a++){
					do {
						testNode = testNode.previousSibling;
						if(testNode==null) testNode = node;
					}while(testNode.nodeName.indexOf('#text')>-1);
				}
				// return it
				return testNode;
			},
			// find the parent node with the given classname
			findParentNode : function(node, rootTag, rootId, rootClass){
				// try parent nodes until you find the one which meets the conditions
				rootFound = false;
				while(!rootFound && node.nodeName!='BODY'){
					rootFound = (rootTag && node.nodeName) ? (node.nodeName.indexOf(rootTag)>-1) : rootFound ;
					rootFound = (rootId && node.id) ? (node.id.indexOf(rootId)>-1) : rootFound ;
					rootFound = (rootClass && node.className) ? (node.className.indexOf(rootClass)>-1) : rootFound ;
					node = (!rootFound) ? node.parentNode : node;
				}
				// pass it back
				return node;
			},
			// gracefully add an event handler
			addEvent : function(node, eventName, eventHandler){
				if('addEventListener' in node){
					node.addEventListener(eventName, eventHandler, false);
				}else if('attachEvent' in node){
					node.attachEvent('on'+eventName, function(event){eventHandler(event)});
				}else{
					node['on'+eventName] = eventHandler;
				}
				return true;
			},
			// trigger an event handler manually
			triggerEvent : function(node, eventName){
				if('fireEvent' in node){
					node.fireEvent('on' + eventName);
				}else if('dispatchEvent' in node){
					var evt = document.createEvent('HTMLEvents');
					evt.initEvent(eventName, false, true);
					node.dispatchEvent(evt);
				}else{
					eval('node.on' + eventName + '()');
				}
				return true;
			},
			// trim whitespace from around a string
			trim : function(string){
				var cu = classBehaviours.utilities;
				return cu.rtrim(cu.ltrim(string));
			},
			ltrim : function(string){
				var left = 0;
				while(left < string.length && string[left] == ' '){
					left++;
				}
				return string.substring(left, string.length);
			},
			rtrim : function(string){
				var right = string.length - 1;
				while(right > 0 && string[right] == ' '){
					right -= 1;
				}
				return string.substring(0, right + 1);
			}
		}

/*
	Source: classbehaviours.parser.js
	ClassBehaviours is a javascript framework based on class-name parsing.
	Copyright 2011 by Maurice van Creij and published on http://www.woollymittens.nl/
	This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
*/

	// CLASSBEHAVIOURS CLASS
	// create the root classbehaviours object if it doesn't already exist
	if(typeof(classBehaviours)=='undefined') classBehaviours = {};

 		// COMMON PARSER FUNCTIONS
		// create the utilities child object if it doesn't already exist
		if(typeof(classBehaviours.parser)=='undefined') classBehaviours.parser = {
			// timeout constant
			interval : null,
			// verify the state of the object
			start : function(){
				var cp = classBehaviours.parser;
				// check if enough of the DOM was loaded
				if(/interactive|loaded|complete/i.test(document.readyState)){
					// cancel the interval
					clearInterval(cp.interval);
					// start the parser
					setTimeout(function(){cp.parseDocument()}, 100);
				// else if we're not already waiting for another test
				}else if(cp.interval==null){
					// test again
					cp.interval = setInterval(cp.start, 100);
				}
			},
			// scan the whole document
			parseDocument : function(){
				// pass the document object to the parser
				classBehaviours.parser.parseNode(document);
				// return the status
				return false;
			},
			// recursive version of the same function
			parseNode : function(node){
				// process the node
				parseChildNodes = (node.className!=null) ? this.processNode(node) : true ;
				// parse any childnodes
				if(parseChildNodes) for(var a=0; a<node.childNodes.length; a++) this.parseNode(node.childNodes[a]);
			},
			// process the classnames of the node
			processNode : function(node){
				// for all class behaviours
				var wantedClass;
				for(b in classBehaviours.handlers){
					// define the search based on the handler's expected classn ame
					wantedClass = new RegExp('\\b'+classBehaviours.handlers[b].name+'\\b');
					// if the behaviour name is in the className tested node
					if(wantedClass.test(node.className)){
						// apply its respective behaviour
						classBehaviours.handlers[b].start(node);
					}
				}
				// decide if to continue parsing deeper into this branch
				return (node.className.indexOf('doNotParse')<0);
			}
		}

		// initialise the parser manually if jQuery isn't used
		if(typeof(jQuery)=='undefined') classBehaviours.parser.start();

