var noobSlide=new Class({initialize:function(a){this.items=a.items;this.mode=a.mode||'horizontal';this.modes={horizontal:['left','width'],vertical:['top','height']};this.size=a.size||240;this.box=a.box.setStyle(this.modes[this.mode][1],(this.size*this.items.length)+'px');this.button_event=a.button_event||'click';this.handle_event=a.handle_event||'click';this.interval=a.interval||5000;this.buttons={previous:[],next:[],play:[],playback:[],stop:[]};if(a.buttons){for(var b in a.buttons){this.addActionButtons(b,$type(a.buttons[b])=='array'?a.buttons[b]:[a.buttons[b]])}}this.handles=a.handles||null;if(this.handles){this.addHandleButtons(this.handles)}this.fx=new Fx.Style(this.box,this.modes[this.mode][0],a.fxOptions||{duration:500,wait:false});this.onWalk=a.onWalk||null;this.currentIndex=a.startItem||0;this.previousIndex=null;this.nextIndex=null;this.autoPlay=a.autoPlay||false;this._auto=null;this.box.setStyle(this.modes[this.mode][0],(-this.currentIndex*this.size)+'px');if(a.autoPlay)this.play(this.interval,'next',true)},previous:function(a){this.currentIndex+=this.currentIndex>0?-1:this.items.length-1;this.walk(null,a)},next:function(a){this.currentIndex+=this.currentIndex<this.items.length-1?1:1-this.items.length;this.walk(null,a)},play:function(a,b,c){this.stop();if(!c){this[b](false)}this._auto=this[b].periodical(a,this,false)},stop:function(){$clear(this._auto)},walk:function(a,b){if($defined(a)){if(a==this.currentIndex)return;this.currentIndex=a}this.previousIndex=this.currentIndex+(this.currentIndex>0?-1:this.items.length-1);this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length);if(b){this.stop()}this.fx.start(-this.currentIndex*this.size);if(this.onWalk){this.onWalk(this.items[this.currentIndex],(this.handles?this.handles[this.currentIndex]:null))}if(b&&this.autoPlay){this.play(this.interval,'next',true)}},addHandleButtons:function(a){for(var i=0;i<a.length;i++){a[i].addEvent(this.handle_event,this.walk.bind(this,[i,true]))}},addActionButtons:function(a,b){for(var i=0;i<b.length;i++){switch(a){case'previous':b[i].addEvent(this.button_event,this.previous.bind(this,true));break;case'next':b[i].addEvent(this.button_event,this.next.bind(this,true));break;case'play':b[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'next',false]));break;case'playback':b[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'previous',false]));break;case'stop':b[i].addEvent(this.button_event,this.stop.bind(this));break}this.buttons[a].push(b[i])}}});

/**
* @version		$Id: modal.js 5263 2006-10-02 01:25:24Z webImagery $
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

/**
 * JCaption javascript behavior
 *
 * Used for displaying image captions
 *
 * @package		Joomla
 * @since		1.5
 * @version     1.0
 */
var JCaption = new Class({
	initialize: function(selector)
	{
		this.selector = selector;

		var images = $$(selector);
		images.each(function(image){ this.createCaption(image); }, this);
	},

	createCaption: function(element)
	{
		var caption   = document.createTextNode(element.title);
		var container = document.createElement("div");
		var text      = document.createElement("p");
		var width     = element.getAttribute("width");
		var align     = element.getAttribute("align");

		if(!width) {
			width = element.width;
		}

		text.appendChild(caption);
		element.parentNode.insertBefore(container, element);
		container.appendChild(element);
		if ( element.title != "" ) {
			container.appendChild(text);
		}
		container.className   = this.selector.replace('.', '_');
		container.className   = container.className + " " + align;
		container.setAttribute("style","float:"+align);
		container.style.width = width + "px";

	}
});

document.caption = null
window.addEvent('load', function() {
  var caption = new JCaption('img.caption')
  document.caption = caption
});


if(typeof(MooTools)!='undefined'){var subnav=new Array();Element.extend({hide:function(timeout)
{this.status='hide';clearTimeout(this.timeout);if(timeout)
{this.timeout=setTimeout(this.anim.bind(this),timeout);}else{this.anim();}},show:function(timeout)
{this.status='show';clearTimeout(this.timeout);if(timeout)
{this.timeout=setTimeout(this.anim.bind(this),timeout);}else{this.anim();}},setActive:function(){this.className+='sfhover';},setDeactive:function(){this.className=this.className.replace(new RegExp("sfhover\\b"),"");},anim:function(){if((this.status=='hide'&&this.style.left!='auto')||(this.status=='show'&&this.style.left=='auto'&&!this.hidding))return;this.setStyle('overflow','hidden');if(this.status=='show'){this.hidding=0;this.hideAll();}else{}
if(this.status=='hide')
{this.hidding=1;this.myFx2.stop();if(this.parent._id)this.myFx2.start(this.offsetWidth,0);else this.myFx2.start(this.offsetHeight,0);}else{this.setStyle('left','auto');this.myFx2.stop();if(this.parent._id)this.myFx2.start(0,this.mw);else this.myFx2.start(0,this.mh);}},init:function(){this.mw=this.clientWidth;this.mh=this.clientHeight;if(this.parent._id)
{this.myFx2=new Fx.Style(this,'width',{transition:Fx.Transitions.Bounce.easeOut},{duration:500});this.myFx2.set(0);}else{this.myFx2=new Fx.Style(this,'height',{transition:Fx.Transitions.Bounce.easeOut},{duration:500});this.myFx2.set(0);}
this.setStyle('left','-999em');animComp=function(){if(this.status=='hide')
{this.setStyle('left','-999em');this.hidding=0;}
this.setStyle('overflow','');}
this.myFx2.addEvent('onComplete',animComp.bind(this));},hideAll:function(){for(var i=0;i<subnav.length;i++){if(!this.isChild(subnav[i]))
{subnav[i].hide(0);}}},isChild:function(_obj){obj=this;while(obj.parent)
{if(obj._id==_obj._id)
{return true;}
obj=obj.parent;}
return false;}});var DropdownMenu=new Class({initialize:function(element)
{$A($(element).childNodes).each(function(el)
{if(el.nodeName.toLowerCase()=='li')
{$A($(el).childNodes).each(function(el2)
{if(el2.nodeName.toLowerCase()=='ul')
{$(el2)._id=subnav.length+1;$(el2).parent=$(element);subnav.push($(el2));el2.init();el.addEvent('mouseover',function()
{el.setActive();el2.show(0);return false;});el.addEvent('mouseout',function()
{el.setDeactive();el2.hide(20);});new DropdownMenu(el2);el.hasSub=1;}});if(!el.hasSub)
{el.addEvent('mouseover',function()
{el.setActive();return false;});el.addEvent('mouseout',function()
{el.setDeactive();});}}});return this;}});Window.onDomReady(function(){new DropdownMenu($E('#hornav ul.menu'))});}else{sfHover=function(){var sfEls=document.getElementById("hornav").getElementsByTagName("li");for(var i=0;i<sfEls.length;++i){sfEls[i].onmouseover=function(){this.className+="sfhover";}
sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp("sfhover\\b"),"");}}}
if(window.attachEvent)window.attachEvent("onload",sfHover);}


eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('m.1("n",2(){$(\'a\').3(\'c\',\'d\');$(\'b\').3(\'c\',\'d\');f 4=0 g.h(\'b\').i();f 5=0 g.h(\'a\').i();$(\'o\').1(\'6\',2(e){e=0 7(e);$(\'a\').3(\'j\',\'k\');5.l();4.8();e.9()});$(\'p\').1(\'6\',2(e){e=0 7(e);5.8();e.9()});$(\'q\').1(\'6\',2(e){e=0 7(e);$(\'b\').3(\'j\',\'k\');5.8();4.l();e.9()});$(\'r\').1(\'6\',2(e){e=0 7(e);4.8();e.9()})});',28,28,'new|addEvent|function|setStyle|myReg|myLogin|click|Event|slideOut|stop|login|reg|height|auto||var|Fx|Slide|hide|visibility|visible|toggle|window|domready|toggleLogin|closeLogin|toggleReg|closeReg'.split('|'),0,{}))

/**
* @version		$Id: validate.js 7401 2007-05-14 04:12:55Z eddieajau $
* @package		Joomla
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

/**
 * Unobtrusive Form Validation library
 *
 * Inspired by: Chris Campbell <www.particletree.com>
 *
 * @package		Joomla.Framework
 * @subpackage	Forms
 * @since		1.5
 */
var JFormValidator = new Class({
	initialize: function()
	{
		// Initialize variables
		this.handlers	= Object();
		this.custom		= Object();

		// Default handlers
		this.setHandler('username',
			function (value) {
				regex = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&]", "i");
				return !regex.test(value);
			}
		);

		this.setHandler('password',
			function (value) {
				regex=/^\S[\S ]{2,98}\S$/;
				return regex.test(value);
			}
		);

		this.setHandler('numeric',
			function (value) {
				regex=/^(\d|-)?(\d|,)*\.?\d*$/;
				return regex.test(value);
			}
		);

		this.setHandler('email',
			function (value) {
				regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
				return regex.test(value);
			}
		);

		// Attach to forms with class 'form-validate'
		var forms = $$('form.form-validate');
		forms.each(function(form){ this.attachToForm(form); }, this);
	},

	setHandler: function(name, fn, en)
	{
		en = (en == '') ? true : en;
		this.handlers[name] = { enabled: en, exec: fn };
	},

	attachToForm: function(form)
	{
		// Iterate through the form object and attach the validate method to all input fields.
		$A(form.elements).each(function(el){
			el = $(el);
			if ((el.getTag() == 'input' || el.getTag() == 'button') && el.getProperty('type') == 'submit') {
				if (el.hasClass('validate')) {
					el.onclick = function(){return document.formvalidator.isValid(this.form);};
				}
			} else {
				el.addEvent('blur', function(){return document.formvalidator.validate(this);});
			}
		});
	},

	validate: function(el)
	{
		// If the field is required make sure it has a value
		if ($(el).hasClass('required')) {
			if (!($(el).getValue())) {
				this.handleResponse(false, el);
				return false;
			}
		}

		// Only validate the field if the validate class is set
		var handler = (el.className && el.className.search(/validate-([a-zA-Z0-9\_\-]+)/) != -1) ? el.className.match(/validate-([a-zA-Z0-9\_\-]+)/)[1] : "";
		if (handler == '') {
			this.handleResponse(true, el);
			return true;
		}

		// Check the additional validation types
		if ((handler) && (handler != 'none') && (this.handlers[handler]) && $(el).getValue()) {
			// Execute the validation handler and return result
			if (this.handlers[handler].exec($(el).getValue()) != true) {
				this.handleResponse(false, el);
				return false;
			}
		}

		// Return validation state
		this.handleResponse(true, el);
		return true;
	},

	isValid: function(form)
	{
		var valid = true;

		// Validate form fields
		for (var i=0;i < form.elements.length; i++) {
			if (this.validate(form.elements[i]) == false) {
				valid = false;
			}
		}

		// Run custom form validators if present
		$A(this.custom).each(function(validator){
			if (validator.exec() != true) {
				valid = false;
			}
		});

		return valid;
	},

	handleResponse: function(state, el)
	{
		// Find the label object for the given field if it exists
		if (!(el.labelref)) {
			var labels = $$('label');
			labels.each(function(label){
				if (label.getProperty('for') == el.getProperty('id')) {
					el.labelref = label;
				}
			});
		}

		// Set the element and its label (if exists) invalid state
		if (state == false) {
			el.addClass('invalid');
			if (el.labelref) {
				$(el.labelref).addClass('invalid');
			}
		} else {
			el.removeClass('invalid');
			if (el.labelref) {
				$(el.labelref).removeClass('invalid');
			}
		}
	}
});

document.formvalidator = null;
Window.onDomReady(function(){
	document.formvalidator = new JFormValidator();
});