//v1.2
//Copyright 2006 Adobe Macromedia Software LLC and its licensors. All rights reserved.
function AC_AX_RunContent(){
  var ret = AC_AX_GetArgs(arguments);
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_AX_GetArgs(args){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "pluginspage":
      case "type":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "data":
      case "codebase":
      case "classid":
      case "id":
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  return ret;
}
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

var MooTools={version:"1.2.4",build:"0d9113241a90b9cd5643b926795852a2026710d4"};var Native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect;
var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterImplement||function(){};var d=f||i;h=h!==false;d.constructor=Native;d.$family={name:"native"};
if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.toLowerCase();d.prototype.$family={name:e};Native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o;
}if(h){Native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,p){if(typeof n=="string"){var o=this.prototype[n];if((n=o)){return j(this,l,n,p);
}}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return j(this,m,l,o);}for(var n in m){j(this,n,m[n],l);
}return this;};if(c){d.implement(c);}return d;};Native.genericize=function(b,c,a){if((!a||!b[c])&&typeof b.prototype[c]=="function"){b[c]=function(){var d=Array.prototype.slice.call(arguments);
return b.prototype[c].apply(d.shift(),d);};}};Native.implement=function(d,c){for(var b=0,a=d.length;b<a;b++){d[b].implement(c);}};Native.typize=function(a,b){if(!a.type){a.type=function(c){return($type(c)===b);
};}};(function(){var a={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var h in a){new Native({name:h,initialize:a[h],protect:true});
}var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var f={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};
for(var e in f){for(var b=f[e].length;b--;){Native.genericize(a[e],f[e][b],true);}}})();var Hash=new Native({name:"Hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getClean());
}for(var b in a){this[b]=a[b];}return this;}});Hash.implement({forEach:function(b,c){for(var a in this){if(this.hasOwnProperty(a)){b.call(c,this[a],a,this);
}}},getClean:function(){var b={};for(var a in this){if(this.hasOwnProperty(a)){b[a]=this[a];}}return b;},getLength:function(){var b=0;for(var a in this){if(this.hasOwnProperty(a)){b++;
}}return b;}});Hash.alias("forEach","each");Array.implement({forEach:function(c,d){for(var b=0,a=this.length;b<a;b++){c.call(d,this[b],b,this);}}});Array.alias("forEach","each");
function $A(b){if(b.item){var a=b.length,c=new Array(a);while(a--){c[a]=b[a];}return c;}return Array.prototype.slice.call(b);}function $arguments(a){return function(){return arguments[a];
};}function $chk(a){return !!(a||a===0);}function $clear(a){clearTimeout(a);clearInterval(a);return null;}function $defined(a){return(a!=undefined);}function $each(c,b,d){var a=$type(c);
((a=="arguments"||a=="collection"||a=="array")?Array:Hash).each(c,b,d);}function $empty(){}function $extend(c,a){for(var b in (a||{})){c[b]=a[b];}return c;
}function $H(a){return new Hash(a);}function $lambda(a){return($type(a)=="function")?a:function(){return a;};}function $merge(){var a=Array.slice(arguments);
a.unshift({});return $mixin.apply(null,a);}function $mixin(e){for(var d=1,a=arguments.length;d<a;d++){var b=arguments[d];if($type(b)!="object"){continue;
}for(var c in b){var g=b[c],f=e[c];e[c]=(f&&$type(g)=="object"&&$type(f)=="object")?$mixin(f,g):$unlink(g);}}return e;}function $pick(){for(var b=0,a=arguments.length;
b<a;b++){if(arguments[b]!=undefined){return arguments[b];}}return null;}function $random(b,a){return Math.floor(Math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b);
return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=Date.now||function(){return +new Date;};function $try(){for(var b=0,a=arguments.length;b<a;
b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isFinite(a))?false:a.$family.name;
}if(a.nodeName){switch(a.nodeType){case 1:return"element";case 3:return(/\S/).test(a.nodeValue)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments";
}else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]);
}break;case"hash":b=new Hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var Browser=$merge({Engine:{name:"unknown",version:0},Platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));
},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?((document.querySelectorAll)?6:5):4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);
},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;
Browser.detect=function(){for(var b in this.Engines){var a=this.Engines[b]();if(a){this.Engine={name:b,version:a};this.Engine[b]=this.Engine[b+a]=true;
break;}}return{name:b,version:a};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("MSXML2.XMLHTTP");
},function(){return new ActiveXObject("Microsoft.XMLHTTP");});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var a=($try(function(){return navigator.plugins["Shockwave Flash"].description;
},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version");})||"0 r0").match(/\d+/g);return{version:parseInt(a[0]||0+"."+a[1],10)||0,build:parseInt(a[2],10)||0};
})();function $exec(b){if(!b){return b;}if(window.execScript){window.execScript(b);}else{var a=document.createElement("script");a.setAttribute("type","text/javascript");
a[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=b;document.head.appendChild(a);document.head.removeChild(a);}return b;}Native.UID=1;
var $uid=(Browser.Engine.trident)?function(a){return(a.uid||(a.uid=[Native.UID++]))[0];}:function(a){return a.uid||(a.uid=Native.UID++);};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(a){$uid(a);
if(!a.Element){a.Element=$empty;if(Browser.Engine.webkit){a.document.createElement("iframe");}a.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};
}a.document.window=a;return $extend(a,Window.Prototype);},afterImplement:function(b,a){window[b]=Window.Prototype[b]=a;}});Window.Prototype={$family:{name:"window"}};
new Window(window);var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(a){$uid(a);a.head=a.getElementsByTagName("head")[0];
a.html=a.getElementsByTagName("html")[0];if(Browser.Engine.trident&&Browser.Engine.version<=4){$try(function(){a.execCommand("BackgroundImageCache",false,true);
});}if(Browser.Engine.trident){a.window.attachEvent("onunload",function(){a.window.detachEvent("onunload",arguments.callee);a.head=a.html=a.window=null;
});}return $extend(a,Document.Prototype);},afterImplement:function(b,a){document[b]=Document.Prototype[b]=a;}});Document.Prototype={$family:{name:"document"}};
new Document(document);Array.implement({every:function(c,d){for(var b=0,a=this.length;b<a;b++){if(!c.call(d,this[b],b,this)){return false;}}return true;
},filter:function(d,e){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(e,this[b],b,this)){c.push(this[b]);}}return c;},clean:function(){return this.filter($defined);
},indexOf:function(c,d){var a=this.length;for(var b=(d<0)?Math.max(0,a+d):d||0;b<a;b++){if(this[b]===c){return b;}}return -1;},map:function(d,e){var c=[];
for(var b=0,a=this.length;b<a;b++){c[b]=d.call(e,this[b],b,this);}return c;},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true;
}}return false;},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={};
for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},contains:function(a,b){return this.indexOf(a,b)!=-1;
},extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b]);}return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;
},include:function(a){if(!this.contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b]);}return this;
},erase:function(b){for(var a=this.length;a--;a){if(this[a]===b){this.splice(a,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var d=[];
for(var b=0,a=this.length;b<a;b++){var c=$type(this[b]);if(!c){continue;}d=d.concat((c=="array"||c=="collection"||c=="arguments")?Array.flatten(this[b]):this[b]);
}return d;},hexToRgb:function(b){if(this.length!=3){return null;}var a=this.map(function(c){if(c.length==1){c+=c;}return c.toInt(16);});return(b)?a:"rgb("+a+")";
},rgbToHex:function(d){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!d){return"transparent";}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16);
b.push((c.length==1)?"0"+c:c);}return(d)?b:"#"+b.join("");}});Function.implement({extend:function(a){for(var b in a){this[b]=a[b];}return this;},create:function(b){var a=this;
b=b||{};return function(d){var c=b.arguments;c=(c!=undefined)?$splat(c):Array.slice(arguments,(b.event)?1:0);if(b.event){c=[d||window.event].extend(c);
}var e=function(){return a.apply(b.bind||null,c);};if(b.delay){return setTimeout(e,b.delay);}if(b.periodical){return setInterval(e,b.periodical);}if(b.attempt){return $try(e);
}return e();};},run:function(a,b){return this.apply(b,$splat(a));},pass:function(a,b){return this.create({bind:b,arguments:a});},bind:function(b,a){return this.create({bind:b,arguments:a});
},bindWithEvent:function(b,a){return this.create({bind:b,arguments:a,event:true});},attempt:function(a,b){return this.create({bind:b,arguments:a,attempt:true})();
},delay:function(b,c,a){return this.create({bind:c,arguments:a,delay:b})();},periodical:function(c,b,a){return this.create({bind:b,arguments:a,periodical:c})();
}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0);return Math.round(this*a)/a;},times:function(b,c){for(var a=0;
a<this;a++){b.call(c,a,this);}},toFloat:function(){return parseFloat(this);},toInt:function(a){return parseInt(this,a||10);}});Number.alias("times","each");
(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat($A(arguments)));};}});Number.implement(a);
})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);String.implement({test:function(a,b){return((typeof a=="string")?new RegExp(a,b):a).test(this);
},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:this.indexOf(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim();
},camelCase:function(){return this.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());
});},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");
},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null;},stripScripts:function(b){var a="";
var c=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c);
}}return c;},substitute:function(a,b){return this.replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:"";
});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){for(var a in this){if(this.hasOwnProperty(a)&&this[a]===b){return a;}}return null;
},hasValue:function(a){return(Hash.keyOf(this,a)!==null);},extend:function(a){Hash.each(a||{},function(c,b){Hash.set(this,b,c);},this);return this;},combine:function(a){Hash.each(a||{},function(c,b){Hash.include(this,b,c);
},this);return this;},erase:function(a){if(this.hasOwnProperty(a)){delete this[a];}return this;},get:function(a){return(this.hasOwnProperty(a))?this[a]:null;
},set:function(a,b){if(!this[a]||this.hasOwnProperty(a)){this[a]=b;}return this;},empty:function(){Hash.each(this,function(b,a){delete this[a];},this);
return this;},include:function(a,b){if(this[a]==undefined){this[a]=b;}return this;},map:function(b,c){var a=new Hash;Hash.each(this,function(e,d){a.set(d,b.call(c,e,d,this));
},this);return a;},filter:function(b,c){var a=new Hash;Hash.each(this,function(e,d){if(b.call(c,e,d,this)){a.set(d,e);}},this);return a;},every:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&!b.call(c,this[a],a)){return false;
}}return true;},some:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&b.call(c,this[a],a)){return true;}}return false;},getKeys:function(){var a=[];
Hash.each(this,function(c,b){a.push(b);});return a;},getValues:function(){var a=[];Hash.each(this,function(b){a.push(b);});return a;},toQueryString:function(a){var b=[];
Hash.each(this,function(f,e){if(a){e=a+"["+e+"]";}var d;switch($type(f)){case"object":d=Hash.toQueryString(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h;
});d=Hash.toQueryString(c,e);break;default:d=e+"="+encodeURIComponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"});
var Event=new Native({name:"Event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$extended){return a;}this.$extended=true;var j=a.type;
var g=a.target||a.srcElement;while(g&&g.nodeType==3){g=g.parentNode;}if(j.test(/key/)){var b=a.which||a.keyCode;var m=Event.Keys.keyOf(b);if(j=="keydown"){var d=b-111;
if(d>0&&d<13){m="f"+d;}}m=m||String.fromCharCode(b).toLowerCase();}else{if(j.match(/(click|mouse|menu)/i)){k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body;
var i={x:a.pageX||a.clientX+k.scrollLeft,y:a.pageY||a.clientY+k.scrollTop};var c={x:(a.pageX)?a.pageX-f.pageXOffset:a.clientX,y:(a.pageY)?a.pageY-f.pageYOffset:a.clientY};
if(j.match(/DOMMouseScroll|mousewheel/)){var h=(a.wheelDelta)?a.wheelDelta/120:-(a.detail||0)/3;}var e=(a.which==3)||(a.button==2);var l=null;if(j.match(/over|out/)){switch(j){case"mouseover":l=a.relatedTarget||a.fromElement;
break;case"mouseout":l=a.relatedTarget||a.toElement;}if(!(function(){while(l&&l.nodeType==3){l=l.parentNode;}return true;}).create({attempt:Browser.Engine.gecko})()){l=false;
}}}}return $extend(this,{event:a,type:j,page:i,client:c,rightClick:e,wheel:h,relatedTarget:l,target:g,code:b,key:m,shift:a.shiftKey,control:a.ctrlKey,alt:a.altKey,meta:a.metaKey});
}});Event.Keys=new Hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();
},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault();
}else{this.event.returnValue=false;}return this;}});function Class(b){if(b instanceof Function){b={initialize:b};}var a=function(){Object.reset(this);if(a._prototyping){return this;
}this._current=$empty;var c=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return c;}.extend(this);
a.implement(b);a.constructor=Class;a.prototype.constructor=a;return a;}Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(a,c){if(c==null){for(var e in a){Object.reset(a,e);
}return a;}delete a[c];switch($type(a[c])){case"object":var d=function(){};d.prototype=a[c];var b=new d;a[c]=Object.reset(b);break;case"array":a[c]=$unlink(a[c]);
break;}return a;};new Native({name:"Class",initialize:Class}).extend({instantiate:function(b){b._prototyping=true;var a=new b;delete b._prototyping;return a;
},wrap:function(a,b,c){if(c._origin){c=c._origin;}return function(){if(c._protected&&this._current==null){throw new Error('The method "'+b+'" cannot be called.');
}var e=this.caller,f=this._current;this.caller=f;this._current=arguments.callee;var d=c.apply(this,arguments);this._current=f;this.caller=e;return d;}.extend({_owner:a,_origin:c,_name:b});
}});Class.implement({implement:function(a,d){if($type(a)=="object"){for(var e in a){this.implement(e,a[e]);}return this;}var f=Class.Mutators[a];if(f){d=f.call(this,d);
if(d==null){return this;}}var c=this.prototype;switch($type(d)){case"function":if(d._hidden){return this;}c[a]=Class.wrap(this,a,d);break;case"object":var b=c[a];
if($type(b)=="object"){$mixin(b,d);}else{c[a]=$unlink(d);}break;case"array":c[a]=$unlink(d);break;default:c[a]=d;}return this;}});Class.Mutators={Extends:function(a){this.parent=a;
this.prototype=Class.instantiate(a);this.implement("parent",function(){var b=this.caller._name,c=this.caller._owner.parent.prototype[b];if(!c){throw new Error('The method "'+b+'" has no parent.');
}return c.apply(this,arguments);}.protect());},Implements:function(a){$splat(a).each(function(b){if(b instanceof Function){b=Class.instantiate(b);}this.implement(b);
},this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;
},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(c,b,a){c=Events.removeOn(c);if(b!=$empty){this.$events[c]=this.$events[c]||[];
this.$events[c].include(b);if(a){b.internal=true;}}return this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this;},fireEvent:function(c,b,a){c=Events.removeOn(c);
if(!this.$events||!this.$events[c]){return this;}this.$events[c].each(function(d){d.create({bind:this,delay:a,"arguments":b})();},this);return this;},removeEvent:function(b,a){b=Events.removeOn(b);
if(!this.$events[b]){return this;}if(!a.internal){this.$events[b].erase(a);}return this;},removeEvents:function(c){var d;if($type(c)=="object"){for(d in c){this.removeEvent(d,c[d]);
}return this;}if(c){c=Events.removeOn(c);}for(d in this.$events){if(c&&c!=d){continue;}var b=this.$events[d];for(var a=b.length;a--;a){this.removeEvent(d,b[a]);
}}return this;}});Events.removeOn=function(a){return a.replace(/^on([A-Z])/,function(b,c){return c.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));
if(!this.addEvent){return this;}for(var a in this.options){if($type(this.options[a])!="function"||!(/^on[A-Z]/).test(a)){continue;}this.addEvent(a,this.options[a]);
delete this.options[a];}return this;}});var Element=new Native({name:"Element",legacy:window.Element,initialize:function(a,b){var c=Element.Constructors.get(a);
if(c){return c(b);}if(typeof a=="string"){return document.newElement(a,b);}return document.id(a).set(b);},afterImplement:function(a,b){Element.Prototype[a]=b;
if(Array[a]){return;}Elements.implement(a,function(){var c=[],g=true;for(var e=0,d=this.length;e<d;e++){var f=this[e][a].apply(this[e],arguments);c.push(f);
if(g){g=($type(f)=="element");}}return(g)?new Elements(c):c;});}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var f=Array.link(arguments,{properties:Object.type,iframe:$defined});
var d=f.properties||{};var c=document.id(f.iframe);var e=d.onload||$empty;delete d.onload;d.id=d.name=$pick(d.id,d.name,c?(c.id||c.name):"IFrame_"+$time());
c=new Element(c||"iframe",d);var b=function(){var g=$try(function(){return c.contentWindow.location.host;});if(!g||g==window.location.host){var h=new Window(c.contentWindow);
new Document(c.contentWindow.document);$extend(h.Element.prototype,Element.Prototype);}e.call(c.contentWindow,c.contentWindow.document);};var a=$try(function(){return c.contentWindow;
});((a&&a.document.body)||window.frames[d.id])?b():c.addListener("load",b);return c;}});var Elements=new Native({initialize:function(f,b){b=$extend({ddup:true,cash:true},b);
f=f||[];if(b.ddup||b.cash){var g={},e=[];for(var c=0,a=f.length;c<a;c++){var d=document.id(f[c],!b.cash);if(b.ddup){if(g[d.uid]){continue;}g[d.uid]=true;
}if(d){e.push(d);}}f=e;}return(b.cash)?$extend(f,this):f;}});Elements.implement({filter:function(a,b){if(!a){return this;}return new Elements(Array.filter(this,(typeof a=="string")?function(c){return c.match(a);
}:a,b));}});Document.implement({newElement:function(a,b){if(Browser.Engine.trident&&b){["name","type","checked"].each(function(c){if(!b[c]){return;}a+=" "+c+'="'+b[c]+'"';
if(c!="checked"){delete b[c];}});a="<"+a+">";}return document.id(this.createElement(a)).set(b);},newTextNode:function(a){return this.createTextNode(a);
},getDocument:function(){return this;},getWindow:function(){return this.window;},id:(function(){var a={string:function(d,c,b){d=b.getElementById(d);return(d)?a.element(d,c):null;
},element:function(b,e){$uid(b);if(!e&&!b.$family&&!(/^object|embed$/i).test(b.tagName)){var c=Element.Prototype;for(var d in c){b[d]=c[d];}}return b;},object:function(c,d,b){if(c.toElement){return a.element(c.toElement(b),d);
}return null;}};a.textnode=a.whitespace=a.window=a.document=$arguments(0);return function(c,e,d){if(c&&c.$family&&c.uid){return c;}var b=$type(c);return(a[b])?a[b](c,e,d||document):null;
};})()});if(window.$==null){Window.implement({$:function(a,b){return document.id(a,b,this.document);}});}Window.implement({$$:function(a){if(arguments.length==1&&typeof a=="string"){return this.document.getElements(a);
}var f=[];var c=Array.flatten(arguments);for(var d=0,b=c.length;d<b;d++){var e=c[d];switch($type(e)){case"element":f.push(e);break;case"string":f.extend(this.document.getElements(e,true));
}}return new Elements(f);},getDocument:function(){return this.document;},getWindow:function(){return this;}});Native.implement([Element,Document],{getElement:function(a,b){return document.id(this.getElements(a,true)[0]||null,b);
},getElements:function(a,d){a=a.split(",");var c=[];var b=(a.length>1);a.each(function(e){var f=this.getElementsByTagName(e.trim());(b)?c.extend(f):c=f;
},this);return new Elements(c,{ddup:b,cash:!d});}});(function(){var h={},f={};var i={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"};
var c=function(l){return(f[l]||(f[l]={}));};var g=function(n,l){if(!n){return;}var m=n.uid;if(Browser.Engine.trident){if(n.clearAttributes){var q=l&&n.cloneNode(false);
n.clearAttributes();if(q){n.mergeAttributes(q);}}else{if(n.removeEvents){n.removeEvents();}}if((/object/i).test(n.tagName)){for(var o in n){if(typeof n[o]=="function"){n[o]=$empty;
}}Element.dispose(n);}}if(!m){return;}h[m]=f[m]=null;};var d=function(){Hash.each(h,g);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(g);
}if(window.CollectGarbage){CollectGarbage();}h=f=null;};var j=function(n,l,s,m,p,r){var o=n[s||l];var q=[];while(o){if(o.nodeType==1&&(!m||Element.match(o,m))){if(!p){return document.id(o,r);
}q.push(o);}o=o[l];}return(p)?new Elements(q,{ddup:false,cash:!r}):null;};var e={html:"innerHTML","class":"className","for":"htmlFor",defaultValue:"defaultValue",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"};
var b=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var k=["value","type","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"];
b=b.associate(b);Hash.extend(e,b);Hash.extend(e,k.associate(k.map(String.toLowerCase)));var a={before:function(m,l){if(l.parentNode){l.parentNode.insertBefore(m,l);
}},after:function(m,l){if(!l.parentNode){return;}var n=l.nextSibling;(n)?l.parentNode.insertBefore(m,n):l.parentNode.appendChild(m);},bottom:function(m,l){l.appendChild(m);
},top:function(m,l){var n=l.firstChild;(n)?l.insertBefore(m,n):l.appendChild(m);}};a.inside=a.bottom;Hash.each(a,function(l,m){m=m.capitalize();Element.implement("inject"+m,function(n){l(this,document.id(n,true));
return this;});Element.implement("grab"+m,function(n){l(document.id(n,true),this);return this;});});Element.implement({set:function(o,m){switch($type(o)){case"object":for(var n in o){this.set(n,o[n]);
}break;case"string":var l=Element.Properties.get(o);(l&&l.set)?l.set.apply(this,Array.slice(arguments,1)):this.setProperty(o,m);}return this;},get:function(m){var l=Element.Properties.get(m);
return(l&&l.get)?l.get.apply(this,Array.slice(arguments,1)):this.getProperty(m);},erase:function(m){var l=Element.Properties.get(m);(l&&l.erase)?l.erase.apply(this):this.removeProperty(m);
return this;},setProperty:function(m,n){var l=e[m];if(n==undefined){return this.removeProperty(m);}if(l&&b[m]){n=!!n;}(l)?this[l]=n:this.setAttribute(m,""+n);
return this;},setProperties:function(l){for(var m in l){this.setProperty(m,l[m]);}return this;},getProperty:function(m){var l=e[m];var n=(l)?this[l]:this.getAttribute(m,2);
return(b[m])?!!n:(l)?n:n||null;},getProperties:function(){var l=$A(arguments);return l.map(this.getProperty,this).associate(l);},removeProperty:function(m){var l=e[m];
(l)?this[l]=(l&&b[m])?false:"":this.removeAttribute(m);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;
},hasClass:function(l){return this.className.contains(l," ");},addClass:function(l){if(!this.hasClass(l)){this.className=(this.className+" "+l).clean();
}return this;},removeClass:function(l){this.className=this.className.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)"),"$1");return this;},toggleClass:function(l){return this.hasClass(l)?this.removeClass(l):this.addClass(l);
},adopt:function(){Array.flatten(arguments).each(function(l){l=document.id(l,true);if(l){this.appendChild(l);}},this);return this;},appendText:function(m,l){return this.grab(this.getDocument().newTextNode(m),l);
},grab:function(m,l){a[l||"bottom"](document.id(m,true),this);return this;},inject:function(m,l){a[l||"bottom"](this,document.id(m,true));return this;},replaces:function(l){l=document.id(l,true);
l.parentNode.replaceChild(this,l);return this;},wraps:function(m,l){m=document.id(m,true);return this.replaces(m).grab(m,l);},getPrevious:function(l,m){return j(this,"previousSibling",null,l,false,m);
},getAllPrevious:function(l,m){return j(this,"previousSibling",null,l,true,m);},getNext:function(l,m){return j(this,"nextSibling",null,l,false,m);},getAllNext:function(l,m){return j(this,"nextSibling",null,l,true,m);
},getFirst:function(l,m){return j(this,"nextSibling","firstChild",l,false,m);},getLast:function(l,m){return j(this,"previousSibling","lastChild",l,false,m);
},getParent:function(l,m){return j(this,"parentNode",null,l,false,m);},getParents:function(l,m){return j(this,"parentNode",null,l,true,m);},getSiblings:function(l,m){return this.getParent().getChildren(l,m).erase(this);
},getChildren:function(l,m){return j(this,"nextSibling","firstChild",l,true,m);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;
},getElementById:function(o,n){var m=this.ownerDocument.getElementById(o);if(!m){return null;}for(var l=m.parentNode;l!=this;l=l.parentNode){if(!l){return null;
}}return document.id(m,n);},getSelected:function(){return new Elements($A(this.options).filter(function(l){return l.selected;}));},getComputedStyle:function(m){if(this.currentStyle){return this.currentStyle[m.camelCase()];
}var l=this.getDocument().defaultView.getComputedStyle(this,null);return(l)?l.getPropertyValue([m.hyphenate()]):null;},toQueryString:function(){var l=[];
this.getElements("input, select, textarea",true).each(function(m){if(!m.name||m.disabled||m.type=="submit"||m.type=="reset"||m.type=="file"){return;}var n=(m.tagName.toLowerCase()=="select")?Element.getSelected(m).map(function(o){return o.value;
}):((m.type=="radio"||m.type=="checkbox")&&!m.checked)?null:m.value;$splat(n).each(function(o){if(typeof o!="undefined"){l.push(m.name+"="+encodeURIComponent(o));
}});});return l.join("&");},clone:function(o,l){o=o!==false;var r=this.cloneNode(o);var n=function(v,u){if(!l){v.removeAttribute("id");}if(Browser.Engine.trident){v.clearAttributes();
v.mergeAttributes(u);v.removeAttribute("uid");if(v.options){var w=v.options,s=u.options;for(var t=w.length;t--;){w[t].selected=s[t].selected;}}}var x=i[u.tagName.toLowerCase()];
if(x&&u[x]){v[x]=u[x];}};if(o){var p=r.getElementsByTagName("*"),q=this.getElementsByTagName("*");for(var m=p.length;m--;){n(p[m],q[m]);}}n(r,this);return document.id(r);
},destroy:function(){Element.empty(this);Element.dispose(this);g(this,true);return null;},empty:function(){$A(this.childNodes).each(function(l){Element.destroy(l);
});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(l){l=document.id(l,true);if(!l){return false;
}if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(l.tagName)).contains(l);}return(this.contains)?(this!=l&&this.contains(l)):!!(this.compareDocumentPosition(l)&16);
},match:function(l){return(!l||(l==this)||(Element.get(this,"tag")==l));}});Native.implement([Element,Window,Document],{addListener:function(o,n){if(o=="unload"){var l=n,m=this;
n=function(){m.removeListener("unload",n);l();};}else{h[this.uid]=this;}if(this.addEventListener){this.addEventListener(o,n,false);}else{this.attachEvent("on"+o,n);
}return this;},removeListener:function(m,l){if(this.removeEventListener){this.removeEventListener(m,l,false);}else{this.detachEvent("on"+m,l);}return this;
},retrieve:function(m,l){var o=c(this.uid),n=o[m];if(l!=undefined&&n==undefined){n=o[m]=l;}return $pick(n);},store:function(m,l){var n=c(this.uid);n[m]=l;
return this;},eliminate:function(l){var m=c(this.uid);delete m[l];return this;}});window.addListener("unload",d);})();Element.Properties=new Hash;Element.Properties.style={set:function(a){this.style.cssText=a;
},get:function(){return this.style.cssText;},erase:function(){this.style.cssText="";}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();
}};Element.Properties.html=(function(){var c=document.createElement("div");var a={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]};
a.thead=a.tfoot=a.tbody;var b={set:function(){var e=Array.flatten(arguments).join("");var f=Browser.Engine.trident&&a[this.get("tag")];if(f){var g=c;g.innerHTML=f[1]+e+f[2];
for(var d=f[0];d--;){g=g.firstChild;}this.empty().adopt(g.childNodes);}else{this.innerHTML=e;}}};b.erase=b.set;return b;})();if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText;
}var a=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);var b=a.innerText;a.destroy();return b;}};}Element.Properties.events={set:function(a){this.addEvents(a);
}};Native.implement([Element,Window,Document],{addEvent:function(e,g){var h=this.retrieve("events",{});h[e]=h[e]||{keys:[],values:[]};if(h[e].keys.contains(g)){return this;
}h[e].keys.push(g);var f=e,a=Element.Events.get(e),c=g,i=this;if(a){if(a.onAdd){a.onAdd.call(this,g);}if(a.condition){c=function(j){if(a.condition.call(this,j)){return g.call(this,j);
}return true;};}f=a.base||f;}var d=function(){return g.call(i);};var b=Element.NativeEvents[f];if(b){if(b==2){d=function(j){j=new Event(j,i.getWindow());
if(c.call(i,j)===false){j.stop();}};}this.addListener(f,d);}h[e].values.push(d);return this;},removeEvent:function(c,b){var a=this.retrieve("events");if(!a||!a[c]){return this;
}var f=a[c].keys.indexOf(b);if(f==-1){return this;}a[c].keys.splice(f,1);var e=a[c].values.splice(f,1)[0];var d=Element.Events.get(c);if(d){if(d.onRemove){d.onRemove.call(this,b);
}c=d.base||c;}return(Element.NativeEvents[c])?this.removeListener(c,e):this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this;
},removeEvents:function(a){var c;if($type(a)=="object"){for(c in a){this.removeEvent(c,a[c]);}return this;}var b=this.retrieve("events");if(!b){return this;
}if(!a){for(c in b){this.removeEvents(c);}this.eliminate("events");}else{if(b[a]){while(b[a].keys[0]){this.removeEvent(a,b[a].keys[0]);}b[a]=null;}}return this;
},fireEvent:function(d,b,a){var c=this.retrieve("events");if(!c||!c[d]){return this;}c[d].keys.each(function(e){e.create({bind:this,delay:a,"arguments":b})();
},this);return this;},cloneEvents:function(d,a){d=document.id(d);var c=d.retrieve("events");if(!c){return this;}if(!a){for(var b in c){this.cloneEvents(d,b);
}}else{if(c[a]){c[a].keys.each(function(e){this.addEvent(a,e);},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};
(function(){var a=function(b){var c=b.relatedTarget;if(c==undefined){return true;}if(c===false){return false;}return($type(this)!="document"&&c!=this&&c.prefix!="xul"&&!this.hasChild(c));
};Element.Events=new Hash({mouseenter:{base:"mouseover",condition:a},mouseleave:{base:"mouseout",condition:a},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}});
})();Element.Properties.styles={set:function(a){this.setStyles(a);}};Element.Properties.opacity={set:function(a,b){if(!b){if(a==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden";
}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(Browser.Engine.trident){this.style.filter=(a==1)?"":"alpha(opacity="+a*100+")";
}this.style.opacity=a;this.store("opacity",a);},get:function(){return this.retrieve("opacity",1);}};Element.implement({setOpacity:function(a){return this.set("opacity",a,true);
},getOpacity:function(){return this.get("opacity");},setStyle:function(b,a){switch(b){case"opacity":return this.set("opacity",parseFloat(a));case"float":b=(Browser.Engine.trident)?"styleFloat":"cssFloat";
}b=b.camelCase();if($type(a)!="string"){var c=(Element.Styles.get(b)||"@").split(" ");a=$splat(a).map(function(e,d){if(!c[d]){return"";}return($type(e)=="number")?c[d].replace("@",Math.round(e)):e;
}).join(" ");}else{if(a==String(Number(a))){a=Math.round(a);}}this.style[b]=a;return this;},getStyle:function(g){switch(g){case"opacity":return this.get("opacity");
case"float":g=(Browser.Engine.trident)?"styleFloat":"cssFloat";}g=g.camelCase();var a=this.style[g];if(!$chk(a)){a=[];for(var f in Element.ShortStyles){if(g!=f){continue;
}for(var e in Element.ShortStyles[f]){a.push(this.getStyle(e));}return a.join(" ");}a=this.getComputedStyle(g);}if(a){a=String(a);var c=a.match(/rgba?\([\d\s,]+\)/);
if(c){a=a.replace(c[0],c[0].rgbToHex());}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(a,10)))){if(g.test(/^(height|width)$/)){var b=(g=="width")?["left","right"]:["top","bottom"],d=0;
b.each(function(h){d+=this.getStyle("border-"+h+"-width").toInt()+this.getStyle("padding-"+h).toInt();},this);return this["offset"+g.capitalize()]-d+"px";
}if((Browser.Engine.presto)&&String(a).test("px")){return a;}if(g.test(/(border(.+)Width|margin|padding)/)){return"0px";}}return a;},setStyles:function(b){for(var a in b){this.setStyle(a,b[a]);
}return this;},getStyles:function(){var a={};Array.flatten(arguments).each(function(b){a[b]=this.getStyle(b);},this);return a;}});Element.Styles=new Hash({left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"});
Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(g){var f=Element.ShortStyles;
var b=Element.Styles;["margin","padding"].each(function(h){var i=h+g;f[h][i]=b[i]="@px";});var e="border"+g;f.border[e]=b[e]="@px @ rgb(@, @, @)";var d=e+"Width",a=e+"Style",c=e+"Color";
f[e]={};f.borderWidth[d]=f[e][d]=b[d]="@px";f.borderStyle[a]=f[e][a]=b[a]="@";f.borderColor[c]=f[e][c]=b[c]="rgb(@, @, @)";});(function(){Element.implement({scrollTo:function(h,i){if(b(this)){this.getWindow().scrollTo(h,i);
}else{this.scrollLeft=h;this.scrollTop=i;}return this;},getSize:function(){if(b(this)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight};
},getScrollSize:function(){if(b(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(b(this)){return this.getWindow().getScroll();
}return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var i=this,h={x:0,y:0};while(i&&!b(i)){h.x+=i.scrollLeft;h.y+=i.scrollTop;i=i.parentNode;
}return h;},getOffsetParent:function(){var h=this;if(b(h)){return null;}if(!Browser.Engine.trident){return h.offsetParent;}while((h=h.parentNode)&&!b(h)){if(d(h,"position")!="static"){return h;
}}return null;},getOffsets:function(){if(this.getBoundingClientRect){var j=this.getBoundingClientRect(),m=document.id(this.getDocument().documentElement),p=m.getScroll(),k=this.getScrolls(),i=this.getScroll(),h=(d(this,"position")=="fixed");
return{x:j.left.toInt()+k.x-i.x+((h)?0:p.x)-m.clientLeft,y:j.top.toInt()+k.y-i.y+((h)?0:p.y)-m.clientTop};}var l=this,n={x:0,y:0};if(b(this)){return n;
}while(l&&!b(l)){n.x+=l.offsetLeft;n.y+=l.offsetTop;if(Browser.Engine.gecko){if(!f(l)){n.x+=c(l);n.y+=g(l);}var o=l.parentNode;if(o&&d(o,"overflow")!="visible"){n.x+=c(o);
n.y+=g(o);}}else{if(l!=this&&Browser.Engine.webkit){n.x+=c(l);n.y+=g(l);}}l=l.offsetParent;}if(Browser.Engine.gecko&&!f(this)){n.x-=c(this);n.y-=g(this);
}return n;},getPosition:function(k){if(b(this)){return{x:0,y:0};}var l=this.getOffsets(),i=this.getScrolls();var h={x:l.x-i.x,y:l.y-i.y};var j=(k&&(k=document.id(k)))?k.getPosition():{x:0,y:0};
return{x:h.x-j.x,y:h.y-j.y};},getCoordinates:function(j){if(b(this)){return this.getWindow().getCoordinates();}var h=this.getPosition(j),i=this.getSize();
var k={left:h.x,top:h.y,width:i.x,height:i.y};k.right=k.left+k.width;k.bottom=k.top+k.height;return k;},computePosition:function(h){return{left:h.x-e(this,"margin-left"),top:h.y-e(this,"margin-top")};
},setPosition:function(h){return this.setStyles(this.computePosition(h));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var i=this.getWindow();
return{x:i.innerWidth,y:i.innerHeight};}var h=a(this);return{x:h.clientWidth,y:h.clientHeight};},getScroll:function(){var i=this.getWindow(),h=a(this);
return{x:i.pageXOffset||h.scrollLeft,y:i.pageYOffset||h.scrollTop};},getScrollSize:function(){var i=a(this),h=this.getSize();return{x:Math.max(i.scrollWidth,h.x),y:Math.max(i.scrollHeight,h.y)};
},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var h=this.getSize();return{top:0,left:0,bottom:h.y,right:h.x,height:h.y,width:h.x};
}});var d=Element.getComputedStyle;function e(h,i){return d(h,i).toInt()||0;}function f(h){return d(h,"-moz-box-sizing")=="border-box";}function g(h){return e(h,"border-top-width");
}function c(h){return e(h,"border-left-width");}function b(h){return(/^(?:body|html)$/i).test(h.tagName);}function a(h){var i=h.getDocument();return(!i.compatMode||i.compatMode=="CSS1Compat")?i.html:i.body;
}})();Element.alias("setPosition","position");Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;
},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;
},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;
}});Native.implement([Document,Element],{getElements:function(h,g){h=h.split(",");var c,e={};for(var d=0,b=h.length;d<b;d++){var a=h[d],f=Selectors.Utils.search(this,a,e);
if(d!=0&&f.item){f=$A(f);}c=(d==0)?f:(c.item)?$A(c).concat(f):c.concat(f);}return new Elements(c,{ddup:(h.length>1),cash:!g});}});Element.implement({match:function(b){if(!b||(b==this)){return true;
}var d=Selectors.Utils.parseTagAndID(b);var a=d[0],e=d[1];if(!Selectors.Filters.byID(this,e)||!Selectors.Filters.byTag(this,a)){return false;}var c=Selectors.Utils.parseSelector(b);
return(c)?Selectors.Utils.filter(this,c,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};
Selectors.Utils={chk:function(b,c){if(!c){return true;}var a=$uid(b);if(!c[a]){return c[a]=true;}return false;},parseNthArgument:function(h){if(Selectors.Cache.nth[h]){return Selectors.Cache.nth[h];
}var e=h.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!e){return false;}var g=parseInt(e[1],10);var d=(g||g===0)?g:1;var f=e[2]||false;var c=parseInt(e[3],10)||0;
if(d!=0){c--;while(c<1){c+=d;}while(c>=d){c-=d;}}else{d=c;f="index";}switch(f){case"n":e={a:d,b:c,special:"n"};break;case"odd":e={a:2,b:0,special:"n"};
break;case"even":e={a:2,b:1,special:"n"};break;case"first":e={a:0,special:"index"};break;case"last":e={special:"last-child"};break;case"only":e={special:"only-child"};
break;default:e={a:(d-1),special:"index"};}return Selectors.Cache.nth[h]=e;},parseSelector:function(e){if(Selectors.Cache.parsed[e]){return Selectors.Cache.parsed[e];
}var d,h={classes:[],pseudos:[],attributes:[]};while((d=Selectors.RegExps.combined.exec(e))){var i=d[1],g=d[2],f=d[3],b=d[5],c=d[6],j=d[7];if(i){h.classes.push(i);
}else{if(c){var a=Selectors.Pseudo.get(c);if(a){h.pseudos.push({parser:a,argument:j});}else{h.attributes.push({name:c,operator:"=",value:j});}}else{if(g){h.attributes.push({name:g,operator:f,value:b});
}}}}if(!h.classes.length){delete h.classes;}if(!h.attributes.length){delete h.attributes;}if(!h.pseudos.length){delete h.pseudos;}if(!h.classes&&!h.attributes&&!h.pseudos){h=null;
}return Selectors.Cache.parsed[e]=h;},parseTagAndID:function(b){var a=b.match(Selectors.RegExps.tag);var c=b.match(Selectors.RegExps.id);return[(a)?a[1]:"*",(c)?c[1]:false];
},filter:function(f,c,e){var d;if(c.classes){for(d=c.classes.length;d--;d){var g=c.classes[d];if(!Selectors.Filters.byClass(f,g)){return false;}}}if(c.attributes){for(d=c.attributes.length;
d--;d){var b=c.attributes[d];if(!Selectors.Filters.byAttribute(f,b.name,b.operator,b.value)){return false;}}}if(c.pseudos){for(d=c.pseudos.length;d--;d){var a=c.pseudos[d];
if(!Selectors.Filters.byPseudo(f,a.parser,a.argument,e)){return false;}}}return true;},getByTagAndID:function(b,a,d){if(d){var c=(b.getElementById)?b.getElementById(d,true):Element.getElementById(b,d,true);
return(c&&Selectors.Filters.byTag(c,a))?[c]:[];}else{return b.getElementsByTagName(a);}},search:function(o,h,t){var b=[];var c=h.trim().replace(Selectors.RegExps.splitter,function(k,j,i){b.push(j);
return":)"+i;}).split(":)");var p,e,A;for(var z=0,v=c.length;z<v;z++){var y=c[z];if(z==0&&Selectors.RegExps.quick.test(y)){p=o.getElementsByTagName(y);
continue;}var a=b[z-1];var q=Selectors.Utils.parseTagAndID(y);var B=q[0],r=q[1];if(z==0){p=Selectors.Utils.getByTagAndID(o,B,r);}else{var d={},g=[];for(var x=0,w=p.length;
x<w;x++){g=Selectors.Getters[a](g,p[x],B,r,d);}p=g;}var f=Selectors.Utils.parseSelector(y);if(f){e=[];for(var u=0,s=p.length;u<s;u++){A=p[u];if(Selectors.Utils.filter(A,f,t)){e.push(A);
}}p=e;}}return p;}};Selectors.Getters={" ":function(h,g,j,a,e){var d=Selectors.Utils.getByTagAndID(g,j,a);for(var c=0,b=d.length;c<b;c++){var f=d[c];if(Selectors.Utils.chk(f,e)){h.push(f);
}}return h;},">":function(h,g,j,a,f){var c=Selectors.Utils.getByTagAndID(g,j,a);for(var e=0,d=c.length;e<d;e++){var b=c[e];if(b.parentNode==g&&Selectors.Utils.chk(b,f)){h.push(b);
}}return h;},"+":function(c,b,a,e,d){while((b=b.nextSibling)){if(b.nodeType==1){if(Selectors.Utils.chk(b,d)&&Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,e)){c.push(b);
}break;}}return c;},"~":function(c,b,a,e,d){while((b=b.nextSibling)){if(b.nodeType==1){if(!Selectors.Utils.chk(b,d)){break;}if(Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,e)){c.push(b);
}}}return c;}};Selectors.Filters={byTag:function(b,a){return(a=="*"||(b.tagName&&b.tagName.toLowerCase()==a));},byID:function(a,b){return(!b||(a.id&&a.id==b));
},byClass:function(b,a){return(b.className&&b.className.contains&&b.className.contains(a," "));},byPseudo:function(a,d,c,b){return d.call(a,c,b);},byAttribute:function(c,d,b,e){var a=Element.prototype.getProperty.call(c,d);
if(!a){return(b=="!=");}if(!b||e==undefined){return true;}switch(b){case"=":return(a==e);case"*=":return(a.contains(e));case"^=":return(a.substr(0,e.length)==e);
case"$=":return(a.substr(a.length-e.length)==e);case"!=":return(a!=e);case"~=":return a.contains(e," ");case"|=":return a.contains(e,"-");}return false;
}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return !(this.innerText||this.textContent||"").length;},not:function(a){return !Element.match(this,a);
},contains:function(a){return(this.innerText||this.textContent||"").contains(a);},"first-child":function(){return Selectors.Pseudo.index.call(this,0);},"last-child":function(){var a=this;
while((a=a.nextSibling)){if(a.nodeType==1){return false;}}return true;},"only-child":function(){var b=this;while((b=b.previousSibling)){if(b.nodeType==1){return false;
}}var a=this;while((a=a.nextSibling)){if(a.nodeType==1){return false;}}return true;},"nth-child":function(g,e){g=(g==undefined)?"n":g;var c=Selectors.Utils.parseNthArgument(g);
if(c.special!="n"){return Selectors.Pseudo[c.special].call(this,c.a,e);}var f=0;e.positions=e.positions||{};var d=$uid(this);if(!e.positions[d]){var b=this;
while((b=b.previousSibling)){if(b.nodeType!=1){continue;}f++;var a=e.positions[$uid(b)];if(a!=undefined){f=a+f;break;}}e.positions[d]=f;}return(e.positions[d]%c.a==c.b);
},index:function(a){var b=this,c=0;while((b=b.previousSibling)){if(b.nodeType==1&&++c>a){return false;}}return(c==a);},even:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n+1",a);
},odd:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n",a);},selected:function(){return this.selected;},enabled:function(){return(this.disabled===false);
}});Element.Events.domready={onAdd:function(a){if(Browser.loaded){a.call(this);}}};(function(){var b=function(){if(Browser.loaded){return;}Browser.loaded=true;
window.fireEvent("domready");document.fireEvent("domready");};window.addEvent("load",b);if(Browser.Engine.trident){var a=document.createElement("div");
(function(){($try(function(){a.doScroll();return document.id(a).inject(document.body).set("html","temp").dispose();}))?b():arguments.callee.delay(50);})();
}else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?b():arguments.callee.delay(50);
})();}else{document.addEvent("DOMContentLoaded",b);}}})();var JSON=new Hash(this.JSON&&{stringify:JSON.stringify,parse:JSON.parse}).extend({$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(a){return JSON.$specialChars[a]||"\\u00"+Math.floor(a.charCodeAt()/16).toString(16)+(a.charCodeAt()%16).toString(16);
},encode:function(b){switch($type(b)){case"string":return'"'+b.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(b.map(JSON.encode).clean())+"]";
case"object":case"hash":var a=[];Hash.each(b,function(e,d){var c=JSON.encode(e);if(c){a.push(JSON.encode(d)+":"+c);}});return"{"+a+"}";case"number":case"boolean":return String(b);
case false:return"null";}return null;},decode:function(string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null;
}return eval("("+string+")");}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(b,a){this.key=b;
this.setOptions(a);},write:function(b){b=encodeURIComponent(b);if(this.options.domain){b+="; domain="+this.options.domain;}if(this.options.path){b+="; path="+this.options.path;
}if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString();}if(this.options.secure){b+="; secure";
}this.options.document.cookie=this.key+"="+b;return this;},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)");
return(a)?decodeURIComponent(a[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write("");return this;}});Cookie.write=function(b,c,a){return new Cookie(b,a).write(c);
};Cookie.read=function(a){return new Cookie(a).read();};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:"high",allowScriptAccess:"always",wMode:"transparent",swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;
},initialize:function(l,m){this.instance="Swiff_"+$time();this.setOptions(m);m=this.options;var b=this.id=m.id||this.instance;var a=document.id(m.container);
Swiff.CallBacks[this.instance]={};var e=m.params,g=m.vars,f=m.callBacks;var h=$extend({height:m.height,width:m.width},m.properties);var k=this;for(var d in f){Swiff.CallBacks[this.instance][d]=(function(n){return function(){return n.apply(k.object,arguments);
};})(f[d]);g[d]="Swiff.CallBacks."+this.instance+"."+d;}e.flashVars=Hash.toQueryString(g);if(Browser.Engine.trident){h.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
e.movie=l;}else{h.type="application/x-shockwave-flash";h.data=l;}var j='<object id="'+b+'"';for(var i in h){j+=" "+i+'="'+h[i]+'"';}j+=">";for(var c in e){if(e[c]){j+='<param name="'+c+'" value="'+e[c]+'" />';
}}j+="</object>";this.object=((a)?a.empty():new Element("div")).set("html",j).firstChild;},replaces:function(a){a=document.id(a,true);a.parentNode.replaceChild(this.toElement(),a);
return this;},inject:function(a){document.id(a,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));
}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+"</invoke>");
return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(a){this.subject=this.subject||this;
this.setOptions(a);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var b=this.options.wait;if(b===false){this.options.link="cancel";
}},getTransition:function(){return function(a){return -(Math.cos(Math.PI*a)-1)/2;};},step:function(){var a=$time();if(a<this.time+this.options.duration){var b=this.transition((a-this.time)/this.options.duration);
this.set(this.compute(this.from,this.to,b));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(a){return a;},compute:function(c,b,a){return Fx.compute(c,b,a);
},check:function(){if(!this.timer){return true;}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));
return false;}return false;},start:function(b,a){if(!this.check(b,a)){return this;}this.from=b;this.to=a;this.time=0;this.transition=this.getTransition();
this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer()){this.onComplete();}return this;},cancel:function(){if(this.stopTimer()){this.onCancel();
}return this;},onStart:function(){this.fireEvent("start",this.subject);},onComplete:function(){this.fireEvent("complete",this.subject);if(!this.callChain()){this.fireEvent("chainComplete",this.subject);
}},onCancel:function(){this.fireEvent("cancel",this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();
return this;},stopTimer:function(){if(!this.timer){return false;}this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer){return false;
}this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(c,b,a){return(b-c)*a+c;
};Fx.Durations={"short":250,normal:500,"long":1000};Fx.CSS=new Class({Extends:Fx,prepare:function(d,e,b){b=$splat(b);var c=b[1];if(!$chk(c)){b[1]=b[0];
b[0]=d.getStyle(e);}var a=b.map(this.parse);return{from:a[0],to:a[1]};},parse:function(a){a=$lambda(a)();a=(typeof a=="string")?a.split(" "):$splat(a);
return a.map(function(c){c=String(c);var b=false;Fx.CSS.Parsers.each(function(f,e){if(b){return;}var d=f.parse(c);if($chk(d)){b={value:d,parser:f};}});
b=b||{value:c,parser:Fx.CSS.Parsers.String};return b;});},compute:function(d,c,b){var a=[];(Math.min(d.length,c.length)).times(function(e){a.push({value:d[e].parser.compute(d[e].value,c[e].value,b),parser:d[e].parser});
});a.$family={name:"fx:css:value"};return a;},serve:function(c,b){if($type(c)!="fx:css:value"){c=this.parse(c);}var a=[];c.each(function(d){a=a.concat(d.parser.serve(d.value,b));
});return a;},render:function(a,d,c,b){a.setStyle(d,this.serve(c,b));},search:function(a){if(Fx.CSS.Cache[a]){return Fx.CSS.Cache[a];}var b={};Array.each(document.styleSheets,function(e,d){var c=e.href;
if(c&&c.contains("://")&&!c.contains(document.domain)){return;}var f=e.rules||e.cssRules;Array.each(f,function(j,g){if(!j.style){return;}var h=(j.selectorText)?j.selectorText.replace(/^\w+/,function(i){return i.toLowerCase();
}):null;if(!h||!h.test("^"+a+"$")){return;}Element.Styles.each(function(k,i){if(!j.style[i]||Element.ShortStyles[i]){return;}k=String(j.style[i]);b[i]=(k.test(/^rgb/))?k.rgbToHex():k;
});});});return Fx.CSS.Cache[a]=b;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(a){if(a.match(/^#[0-9a-f]{3,6}$/i)){return a.hexToRgb(true);
}return((a=a.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[a[1],a[2],a[3]]:false;},compute:function(c,b,a){return c.map(function(e,d){return Math.round(Fx.compute(c[d],b[d],a));
});},serve:function(a){return a.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(b,a){return(a)?b+a:b;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});
Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a);},set:function(b,a){if(arguments.length==1){a=b;
b=this.property||this.options.property;}this.render(this.element,b,a,this.options.unit);return this;},start:function(c,e,d){if(!this.check(c,e,d)){return this;
}var b=Array.flatten(arguments);this.property=this.options.property||b.shift();var a=this.prepare(this.element,this.property,b);return this.parent(a.from,a.to);
}});Element.Properties.tween={set:function(a){var b=this.retrieve("tween");if(b){b.cancel();}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},a));
},get:function(a){if(a||!this.retrieve("tween")){if(a||!this.retrieve("tween:options")){this.set("tween",a);}this.store("tween",new Fx.Tween(this,this.retrieve("tween:options")));
}return this.retrieve("tween");}};Element.implement({tween:function(a,c,b){this.get("tween").start(arguments);return this;},fade:function(c){var e=this.get("tween"),d="opacity",a;
c=$pick(c,"toggle");switch(c){case"in":e.start(d,1);break;case"out":e.start(d,0);break;case"show":e.set(d,1);break;case"hide":e.set(d,0);break;case"toggle":var b=this.retrieve("fade:flag",this.get("opacity")==1);
e.start(d,(b)?0:1);this.store("fade:flag",!b);a=true;break;default:e.start(d,arguments);}if(!a){this.eliminate("fade:flag");}return this;},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getStyle("background-color"));
a=(a=="transparent")?"#fff":a;}var b=this.get("tween");b.start("background-color",c||"#ffff88",a).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));
b.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a);
},set:function(a){if(typeof a=="string"){a=this.search(a);}for(var b in a){this.render(this.element,b,a[b],this.options.unit);}return this;},compute:function(e,d,c){var a={};
for(var b in e){a[b]=this.parent(e[b],d[b],c);}return a;},start:function(b){if(!this.check(b)){return this;}if(typeof b=="string"){b=this.search(b);}var e={},d={};
for(var c in b){var a=this.prepare(this.element,c,b[c]);e[c]=a.from;d[c]=a.to;}return this.parent(e,d);}});Element.Properties.morph={set:function(a){var b=this.retrieve("morph");
if(b){b.cancel();}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},a));},get:function(a){if(a||!this.retrieve("morph")){if(a||!this.retrieve("morph:options")){this.set("morph",a);
}this.store("morph",new Fx.Morph(this,this.retrieve("morph:options")));}return this.retrieve("morph");}};Element.implement({morph:function(a){this.get("morph").start(a);
return this;}});Fx.implement({getTransition:function(){var a=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof a=="string"){var b=a.split(":");
a=Fx.Transitions;a=a[b[0]]||a[b[0].capitalize()];if(b[1]){a=a["ease"+b[1].capitalize()+(b[2]?b[2].capitalize():"")];}}return a;}});Fx.Transition=function(b,a){a=$splat(a);
return $extend(b,{easeIn:function(c){return b(c,a);},easeOut:function(c){return 1-b(1-c,a);},easeInOut:function(c){return(c<=0.5)?b(2*c,a)/2:(2-b(2*(1-c),a))/2;
}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b]);}};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a[0]||6);
},Expo:function(a){return Math.pow(2,8*(a-1));},Circ:function(a){return 1-Math.sin(Math.acos(a));},Sine:function(a){return 1-Math.sin((1-a)*Math.PI/2);
},Back:function(b,a){a=a[0]||1.618;return Math.pow(b,2)*((a+1)*b-a);},Bounce:function(f){var e;for(var d=0,c=1;1;d+=c,c/=2){if(f>=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2);
break;}}return e;},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,[a+2]);
});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,noCache:false},initialize:function(a){this.xhr=new Browser.Request();
this.setOptions(a);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return;
}this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));this.xhr.onreadystatechange=$empty;if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};
this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}},isSuccess:function(){return((this.status>=200)&&(this.status<300));
},processScripts:function(a){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(a);}return a.stripScripts(this.options.evalScripts);
},success:function(b,a){this.onSuccess(this.processScripts(b),a);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain();
},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},setHeader:function(a,b){this.headers.set(a,b);
return this;},getHeader:function(a){return $try(function(){return this.xhr.getResponseHeader(a);}.bind(this));},check:function(){if(!this.running){return true;
}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(k){if(!this.check(k)){return this;
}this.running=true;var i=$type(k);if(i=="string"||i=="element"){k={data:k};}var d=this.options;k=$extend({data:d.data,url:d.url,method:d.method},k);var g=k.data,b=String(k.url),a=k.method.toLowerCase();
switch($type(g)){case"element":g=document.id(g).toQueryString();break;case"object":case"hash":g=Hash.toQueryString(g);}if(this.options.format){var j="format="+this.options.format;
g=(g)?j+"&"+g:j;}if(this.options.emulation&&!["get","post"].contains(a)){var h="_method="+a;g=(g)?h+"&"+g:h;a="post";}if(this.options.urlEncoded&&a=="post"){var c=(this.options.encoding)?"; charset="+this.options.encoding:"";
this.headers.set("Content-type","application/x-www-form-urlencoded"+c);}if(this.options.noCache){var f="noCache="+new Date().getTime();g=(g)?f+"&"+g:f;
}var e=b.lastIndexOf("/");if(e>-1&&(e=b.indexOf("#"))>-1){b=b.substr(0,e);}if(g&&a=="get"){b=b+(b.contains("?")?"&":"?")+g;g=null;}this.xhr.open(a.toUpperCase(),b,this.options.async);
this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(m,l){try{this.xhr.setRequestHeader(l,m);}catch(n){this.fireEvent("exception",[l,m]);
}},this);this.fireEvent("request");this.xhr.send(g);if(!this.options.async){this.onStateChange();}return this;},cancel:function(){if(!this.running){return this;
}this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});(function(){var a={};
["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(b){a[b]=function(){var c=Array.link(arguments,{url:String.type,data:$defined});
return this.send($extend(c,{method:b}));};});Request.implement(a);})();Element.Properties.send={set:function(a){var b=this.retrieve("send");if(b){b.cancel();
}return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},a));},get:function(a){if(a||!this.retrieve("send")){if(a||!this.retrieve("send:options")){this.set("send",a);
}this.store("send",new Request(this.retrieve("send:options")));}return this.retrieve("send");}};Element.implement({send:function(a){var b=this.get("send");
b.send({data:this,url:a||b.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(c){var b=c.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
c=(b)?b[1]:c;var a=new Element("div");return $try(function(){var d="<root>"+c+"</root>",g;if(Browser.Engine.trident){g=new ActiveXObject("Microsoft.XMLDOM");
g.async=false;g.loadXML(d);}else{g=new DOMParser().parseFromString(d,"text/xml");}d=g.getElementsByTagName("root")[0];if(!d){return null;}for(var f=0,e=d.childNodes.length;
f<e;f++){var h=Element.clone(d.childNodes[f],true,true);if(h){a.grab(h);}}return a;})||a.set("html",c);},success:function(d){var c=this.options,b=this.response;
b.html=d.stripScripts(function(e){b.javascript=e;});var a=this.processHTML(b.html);b.tree=a.childNodes;b.elements=a.getElements("*");if(c.filter){b.tree=b.elements.filter(c.filter);
}if(c.update){document.id(c.update).empty().set("html",b.html);}else{if(c.append){document.id(c.append).adopt(a.getChildren());}}if(c.evalScripts){$exec(b.javascript);
}this.onSuccess(b.tree,b.elements,b.html,b.javascript);}});Element.Properties.load={set:function(a){var b=this.retrieve("load");if(b){b.cancel();}return this.eliminate("load").store("load:options",$extend({data:this,link:"cancel",update:this,method:"get"},a));
},get:function(a){if(a||!this.retrieve("load")){if(a||!this.retrieve("load:options")){this.set("load",a);}this.store("load",new Request.HTML(this.retrieve("load:options")));
}return this.retrieve("load");}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Object.type,url:String.type}));return this;
}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);this.headers.extend({Accept:"application/json","X-Request":"JSON"});
},success:function(a){this.response.json=JSON.decode(a,this.options.secure);this.onSuccess(this.response.json,a);}});//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License.

MooTools.More={version:"1.2.4.4",build:"6f6057dc645fdb7547689183b2311063bd653ddf"};(function(){var a={language:"en-US",languages:{"en-US":{}},cascades:["en-US"]};
var b;MooTools.lang=new Events();$extend(MooTools.lang,{setLanguage:function(c){if(!a.languages[c]){return this;}a.language=c;this.load();this.fireEvent("langChange",c);
return this;},load:function(){var c=this.cascade(this.getCurrentLanguage());b={};$each(c,function(e,d){b[d]=this.lambda(e);},this);},getCurrentLanguage:function(){return a.language;
},addLanguage:function(c){a.languages[c]=a.languages[c]||{};return this;},cascade:function(e){var c=(a.languages[e]||{}).cascades||[];c.combine(a.cascades);
c.erase(e).push(e);var d=c.map(function(f){return a.languages[f];},this);return $merge.apply(this,d);},lambda:function(c){(c||{}).get=function(e,d){return $lambda(c[e]).apply(this,$splat(d));
};return c;},get:function(e,d,c){if(b&&b[e]){return(d?b[e].get(d,c):b[e]);}},set:function(d,e,c){this.addLanguage(d);langData=a.languages[d];if(!langData[e]){langData[e]={};
}$extend(langData[e],c);if(d==this.getCurrentLanguage()){this.load();this.fireEvent("langChange",d);}return this;},list:function(){return Hash.getKeys(a.languages);
}});})();(function(){var c=this;var b=function(){if(c.console&&console.log){try{console.log.apply(console,arguments);}catch(d){console.log(Array.slice(arguments));
}}else{Log.logged.push(arguments);}return this;};var a=function(){this.logged.push(arguments);return this;};this.Log=new Class({logged:[],log:a,resetLog:function(){this.logged.empty();
return this;},enableLog:function(){this.log=b;this.logged.each(function(d){this.log.apply(this,d);},this);return this.resetLog();},disableLog:function(){this.log=a;
return this;}});Log.extend(new Log).enableLog();Log.logger=function(){return this.log.apply(this,arguments);};})();var Depender={options:{loadedSources:[],loadedScripts:["Core","Browser","Array","String","Function","Number","Hash","Element","Event","Element.Event","Class","DomReady","Class.Extras","Request","JSON","Request.JSON","More","Depender","Log"],useScriptInjection:true},loaded:[],sources:{},libs:{},include:function(b){this.log("include: ",b);
this.mapLoaded=false;var a=function(c){this.libs=$merge(this.libs,c);$each(this.libs,function(d,e){if(d.scripts){this.loadSource(e,d.scripts);}},this);
}.bind(this);if($type(b)=="string"){this.log("fetching libs ",b);this.request(b,a);}else{a(b);}return this;},required:[],require:function(b){var a=function(){var c=this.calculateDependencies(b.scripts);
if(b.sources){b.sources.each(function(d){c.combine(this.libs[d].files);},this);}if(b.serial){c.combine(this.getLoadedScripts());}b.scripts=c;this.required.push(b);
this.fireEvent("require",b);this.loadScripts(b.scripts);};if(this.mapLoaded){a.call(this);}else{this.addEvent("mapLoaded",a.bind(this));}return this;},cleanDoubleSlash:function(b){if(!b){return b;
}var a="";if(b.test(/^http:\/\//)){a="http://";b=b.substring(7,b.length);}b=b.replace(/\/\//g,"/");return a+b;},request:function(a,b){new Request.JSON({url:a,secure:false,onSuccess:b}).send();
},loadSource:function(b,a){if(this.libs[b].files){this.dataLoaded();return;}this.log("loading source: ",a);this.request(this.cleanDoubleSlash(a+"/scripts.json"),function(c){this.log("loaded source: ",a);
this.libs[b].files=c;this.dataLoaded();}.bind(this));},dataLoaded:function(){var a=true;$each(this.libs,function(c,b){if(!this.libs[b].files){a=false;}},this);
if(a){this.mapTree();this.mapLoaded=true;this.calculateLoaded();this.lastLoaded=this.getLoadedScripts().getLength();this.fireEvent("mapLoaded");this.removeEvents("mapLoaded");
}},calculateLoaded:function(){var a=function(b){this.scriptsState[b]=true;}.bind(this);if(this.options.loadedScripts){this.options.loadedScripts.each(a);
}if(this.options.loadedSources){this.options.loadedSources.each(function(b){$each(this.libs[b].files,function(c){$each(c,function(e,d){a(d);},this);},this);
},this);}},deps:{},pathMap:{},mapTree:function(){$each(this.libs,function(b,a){$each(b.files,function(c,d){$each(c,function(f,e){var g=a+":"+d+":"+e;if(this.deps[g]){return;
}this.deps[g]=f.deps;this.pathMap[e]=g;},this);},this);},this);},getDepsForScript:function(a){return this.deps[this.pathMap[a]]||[];},calculateDependencies:function(a){var b=[];
$splat(a).each(function(c){if(c=="None"||!c){return;}var d=this.getDepsForScript(c);if(!d){if(window.console&&console.warn){console.warn("dependencies not mapped: script: %o, map: %o, :deps: %o",c,this.pathMap,this.deps);
}}else{d.each(function(e){if(e==c||e=="None"||!e){return;}if(!b.contains(e)){b.combine(this.calculateDependencies(e));}b.include(e);},this);}b.include(c);
},this);return b;},getPath:function(a){try{var f=this.pathMap[a].split(":");var d=this.libs[f[0]];var b=(d.path||d.scripts)+"/";f.shift();return this.cleanDoubleSlash(b+f.join("/")+".js");
}catch(c){return a;}},loadScripts:function(a){a=a.filter(function(b){if(!this.scriptsState[b]&&b!="None"){this.scriptsState[b]=false;return true;}},this);
if(a.length){a.each(function(b){this.loadScript(b);},this);}else{this.check();}},toLoad:[],loadScript:function(b){if(this.scriptsState[b]&&this.toLoad.length){this.loadScript(this.toLoad.shift());
return;}else{if(this.loading){this.toLoad.push(b);return;}}var e=function(){this.loading=false;this.scriptLoaded(b);if(this.toLoad.length){this.loadScript(this.toLoad.shift());
}}.bind(this);var d=function(){this.log("could not load: ",a);}.bind(this);this.loading=true;var a=this.getPath(b);if(this.options.useScriptInjection){this.log("injecting script: ",a);
var c=function(){this.log("loaded script: ",a);e();}.bind(this);new Element("script",{src:a+(this.options.noCache?"?noCache="+new Date().getTime():""),events:{load:c,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){c();
}},error:d}}).inject(this.options.target||document.head);}else{this.log("requesting script: ",a);new Request({url:a,noCache:this.options.noCache,onComplete:function(f){this.log("loaded script: ",a);
$exec(f);e();}.bind(this),onFailure:d,onException:d}).send();}},scriptsState:$H(),getLoadedScripts:function(){return this.scriptsState.filter(function(a){return a;
});},scriptLoaded:function(a){this.log("loaded script: ",a);this.scriptsState[a]=true;this.check();var b=this.getLoadedScripts();var d=b.getLength();var c=this.scriptsState.getLength();
this.fireEvent("scriptLoaded",{script:a,totalLoaded:(d/c*100).round(),currentLoaded:((d-this.lastLoaded)/(c-this.lastLoaded)*100).round(),loaded:b});if(d==c){this.lastLoaded=d;
}},lastLoaded:0,check:function(){var a=[];this.required.each(function(c){var b=[];c.scripts.each(function(d){if(this.scriptsState[d]){b.push(d);}},this);
if(c.onStep){c.onStep({percent:b.length/c.scripts.length*100,scripts:b});}if(c.scripts.length!=b.length){return;}c.callback();this.required.erase(c);this.fireEvent("requirementLoaded",[b,c]);
},this);}};$extend(Depender,new Events);$extend(Depender,new Options);$extend(Depender,new Log);Depender._setOptions=Depender.setOptions;Depender.setOptions=function(){Depender._setOptions.apply(Depender,arguments);
if(this.options.log){Depender.enableLog();}return this;};Class.refactor=function(b,a){$each(a,function(e,d){var c=b.prototype[d];if(c&&(c=c._origin)&&typeof e=="function"){b.implement(d,function(){var f=this.previous;
this.previous=c;var g=e.apply(this,arguments);this.previous=f;return g;});}else{b.implement(d,e);}});return b;};Class.Mutators.Binds=function(a){return a;
};Class.Mutators.initialize=function(a){return function(){$splat(this.Binds).each(function(b){var c=this[b];if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);
};};Class.Occlude=new Class({occlude:function(c,b){b=document.id(b||this.element);var a=b.retrieve(c||this.property);if(a&&!$defined(this.occluded)){return this.occluded=a;
}this.occluded=false;b.store(c||this.property,this);return this.occluded;}});(function(){var a={wait:function(b){return this.chain(function(){this.callChain.delay($pick(b,500),this);
}.bind(this));}};Chain.implement(a);if(window.Fx){Fx.implement(a);["Css","Tween","Elements"].each(function(b){if(Fx[b]){Fx[b].implement(a);}});}Element.implement({chains:function(b){$splat($pick(b,["tween","morph","reveal"])).each(function(c){c=this.get(c);
if(!c){return;}c.setOptions({link:"chain"});},this);return this;},pauseFx:function(c,b){this.chains(b).get($pick(b,"tween")).wait(c);return this;}});})();
Array.implement({min:function(){return Math.min.apply(null,this);},max:function(){return Math.max.apply(null,this);},average:function(){return this.length?this.sum()/this.length:0;
},sum:function(){var a=0,b=this.length;if(b){do{a+=this[--b];}while(b);}return a;},unique:function(){return[].combine(this);},shuffle:function(){for(var b=this.length;
b&&--b;){var a=this[b],c=Math.floor(Math.random()*(b+1));this[b]=this[c];this[c]=a;}return this;}});(function(){var i=this.Date;if(!i.now){i.now=$time;
}i.Methods={ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"};["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds"].each(function(p){i.Methods[p.toLowerCase()]=p;
});var d=function(q,p){return new Array(p-String(q).length+1).join("0")+q;};i.implement({set:function(t,r){switch($type(t)){case"object":for(var s in t){this.set(s,t[s]);
}break;case"string":t=t.toLowerCase();var q=i.Methods;if(q[t]){this["set"+q[t]](r);}}return this;},get:function(q){q=q.toLowerCase();var p=i.Methods;if(p[q]){return this["get"+p[q]]();
}return null;},clone:function(){return new i(this.get("time"));},increment:function(p,r){p=p||"day";r=$pick(r,1);switch(p){case"year":return this.increment("month",r*12);
case"month":var q=this.get("date");this.set("date",1).set("mo",this.get("mo")+r);return this.set("date",q.min(this.get("lastdayofmonth")));case"week":return this.increment("day",r*7);
case"day":return this.set("date",this.get("date")+r);}if(!i.units[p]){throw new Error(p+" is not a supported interval");}return this.set("time",this.get("time")+r*i.units[p]());
},decrement:function(p,q){return this.increment(p,-1*$pick(q,1));},isLeapYear:function(){return i.isLeapYear(this.get("year"));},clearTime:function(){return this.set({hr:0,min:0,sec:0,ms:0});
},diff:function(q,p){if($type(q)=="string"){q=i.parse(q);}return((q-this)/i.units[p||"day"](3,3)).toInt();},getLastDayOfMonth:function(){return i.daysInMonth(this.get("mo"),this.get("year"));
},getDayOfYear:function(){return(i.UTC(this.get("year"),this.get("mo"),this.get("date")+1)-i.UTC(this.get("year"),0,1))/i.units.day();},getWeek:function(){return(this.get("dayofyear")/7).ceil();
},getOrdinal:function(p){return i.getMsg("ordinal",p||this.get("date"));},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");
},getGMTOffset:function(){var p=this.get("timezoneOffset");return((p>0)?"-":"+")+d((p.abs()/60).floor(),2)+d(p%60,2);},setAMPM:function(p){p=p.toUpperCase();
var q=this.get("hr");if(q>11&&p=="AM"){return this.decrement("hour",12);}else{if(q<12&&p=="PM"){return this.increment("hour",12);}}return this;},getAMPM:function(){return(this.get("hr")<12)?"AM":"PM";
},parse:function(p){this.set("time",i.parse(p));return this;},isValid:function(p){return !!(p||this).valueOf();},format:function(p){if(!this.isValid()){return"invalid date";
}p=p||"%x %X";p=k[p.toLowerCase()]||p;var q=this;return p.replace(/%([a-z%])/gi,function(s,r){switch(r){case"a":return i.getMsg("days")[q.get("day")].substr(0,3);
case"A":return i.getMsg("days")[q.get("day")];case"b":return i.getMsg("months")[q.get("month")].substr(0,3);case"B":return i.getMsg("months")[q.get("month")];
case"c":return q.toString();case"d":return d(q.get("date"),2);case"H":return d(q.get("hr"),2);case"I":return((q.get("hr")%12)||12);case"j":return d(q.get("dayofyear"),3);
case"m":return d((q.get("mo")+1),2);case"M":return d(q.get("min"),2);case"o":return q.get("ordinal");case"p":return i.getMsg(q.get("ampm"));case"S":return d(q.get("seconds"),2);
case"U":return d(q.get("week"),2);case"w":return q.get("day");case"x":return q.format(i.getMsg("shortDate"));case"X":return q.format(i.getMsg("shortTime"));
case"y":return q.get("year").toString().substr(2);case"Y":return q.get("year");case"T":return q.get("GMTOffset");case"Z":return q.get("Timezone");}return r;
});},toISOString:function(){return this.format("iso8601");}});i.alias("toISOString","toJSON");i.alias("diff","compare");i.alias("format","strftime");var k={db:"%Y-%m-%d %H:%M:%S",compact:"%Y%m%dT%H%M%S",iso8601:"%Y-%m-%dT%H:%M:%S%T",rfc822:"%a, %d %b %Y %H:%M:%S %Z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"};
var g=[];var e=i.parse;var n=function(s,u,r){var q=-1;var t=i.getMsg(s+"s");switch($type(u)){case"object":q=t[u.get(s)];break;case"number":q=t[month-1];
if(!q){throw new Error("Invalid "+s+" index: "+index);}break;case"string":var p=t.filter(function(v){return this.test(v);},new RegExp("^"+u,"i"));if(!p.length){throw new Error("Invalid "+s+" string");
}if(p.length>1){throw new Error("Ambiguous "+s);}q=p[0];}return(r)?t.indexOf(q):q;};i.extend({getMsg:function(q,p){return MooTools.lang.get("Date",q,p);
},units:{ms:$lambda(1),second:$lambda(1000),minute:$lambda(60000),hour:$lambda(3600000),day:$lambda(86400000),week:$lambda(608400000),month:function(q,p){var r=new i;
return i.daysInMonth($pick(q,r.get("mo")),$pick(p,r.get("year")))*86400000;},year:function(p){p=p||new i().get("year");return i.isLeapYear(p)?31622400000:31536000000;
}},daysInMonth:function(q,p){return[31,i.isLeapYear(p)?29:28,31,30,31,30,31,31,30,31,30,31][q];},isLeapYear:function(p){return((p%4===0)&&(p%100!==0))||(p%400===0);
},parse:function(r){var q=$type(r);if(q=="number"){return new i(r);}if(q!="string"){return r;}r=r.clean();if(!r.length){return null;}var p;g.some(function(t){var s=t.re.exec(r);
return(s)?(p=t.handler(s)):false;});return p||new i(e(r));},parseDay:function(p,q){return n("day",p,q);},parseMonth:function(q,p){return n("month",q,p);
},parseUTC:function(q){var p=new i(q);var r=i.UTC(p.get("year"),p.get("mo"),p.get("date"),p.get("hr"),p.get("min"),p.get("sec"));return new i(r);},orderIndex:function(p){return i.getMsg("dateOrder").indexOf(p)+1;
},defineFormat:function(p,q){k[p]=q;},defineFormats:function(p){for(var q in p){i.defineFormat(q,p[q]);}},parsePatterns:g,defineParser:function(p){g.push((p.re&&p.handler)?p:l(p));
},defineParsers:function(){Array.flatten(arguments).each(i.defineParser);},define2DigitYearStart:function(p){h=p%100;m=p-h;}});var m=1900;var h=70;var j=function(p){return new RegExp("(?:"+i.getMsg(p).map(function(q){return q.substr(0,3);
}).join("|")+")[a-z]*");};var a=function(p){switch(p){case"x":return((i.orderIndex("month")==1)?"%m[.-/]%d":"%d[.-/]%m")+"([.-/]%y)?";case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%T?";
}return null;};var o={d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,o:/[a-z]*/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,T:/Z|[+-]\d{2}(?::?\d{2})?/};
o.m=o.I;o.S=o.M;var c;var b=function(p){c=p;o.a=o.A=j("days");o.b=o.B=j("months");g.each(function(r,q){if(r.format){g[q]=l(r.format);}});};var l=function(r){if(!c){return{format:r};
}var p=[];var q=(r.source||r).replace(/%([a-z])/gi,function(t,s){return a(s)||t;}).replace(/\((?!\?)/g,"(?:").replace(/ (?!\?|\*)/g,",? ").replace(/%([a-z%])/gi,function(t,s){var u=o[s];
if(!u){return s;}p.push(s);return"("+u.source+")";}).replace(/\[a-z\]/gi,"[a-z\\u00c0-\\uffff]");return{format:r,re:new RegExp("^"+q+"$","i"),handler:function(u){u=u.slice(1).associate(p);
var s=new i().clearTime();if("d" in u){f.call(s,"d",1);}if("m" in u||"b" in u||"B" in u){f.call(s,"m",1);}for(var t in u){f.call(s,t,u[t]);}return s;}};
};var f=function(p,q){if(!q){return this;}switch(p){case"a":case"A":return this.set("day",i.parseDay(q,true));case"b":case"B":return this.set("mo",i.parseMonth(q,true));
case"d":return this.set("date",q);case"H":case"I":return this.set("hr",q);case"m":return this.set("mo",q-1);case"M":return this.set("min",q);case"p":return this.set("ampm",q.replace(/\./g,""));
case"S":return this.set("sec",q);case"s":return this.set("ms",("0."+q)*1000);case"w":return this.set("day",q);case"Y":return this.set("year",q);case"y":q=+q;
if(q<100){q+=m+(q<h?100:0);}return this.set("year",q);case"T":if(q=="Z"){q="+00";}var r=q.match(/([+-])(\d{2}):?(\d{2})?/);r=(r[1]+"1")*(r[2]*60+(+r[3]||0))+this.getTimezoneOffset();
return this.set("time",this-r*60000);}return this;};i.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?","%Y%m%d(T%H(%M%S?)?)?","%x( %X)?","%d%o( %b( %Y)?)?( %X)?","%b( %d%o)?( %Y)?( %X)?","%Y %b( %d%o( %X)?)?","%o %b %d %X %T %Y");
MooTools.lang.addEvent("langChange",function(p){if(MooTools.lang.get("Date")){b(p);}}).fireEvent("langChange",MooTools.lang.getCurrentLanguage());})();
Date.implement({timeDiffInWords:function(a){return Date.distanceOfTimeInWords(this,a||new Date);},timeDiff:function(g,b){if(g==null){g=new Date;}var f=((g-this)/1000).toInt();
if(!f){return"0s";}var a={s:60,m:60,h:24,d:365,y:0};var e,d=[];for(var c in a){if(!f){break;}if((e=a[c])){d.unshift((f%e)+c);f=(f/e).toInt();}else{d.unshift(f+c);
}}return d.join(b||":");}});Date.alias("timeDiffInWords","timeAgoInWords");Date.extend({distanceOfTimeInWords:function(b,a){return Date.getTimePhrase(((a-b)/1000).toInt());
},getTimePhrase:function(f){var d=(f<0)?"Until":"Ago";if(f<0){f*=-1;}var b={minute:60,hour:60,day:24,week:7,month:52/12,year:12,eon:Infinity};var e="lessThanMinute";
for(var c in b){var a=b[c];if(f<1.5*a){if(f>0.75*a){e=c;}break;}f/=a;e=c+"s";}return Date.getMsg(e+d).substitute({delta:f.round()});}});Date.defineParsers({re:/^(?:tod|tom|yes)/i,handler:function(a){var b=new Date().clearTime();
switch(a[0]){case"tom":return b.increment();case"yes":return b.decrement();default:return b;}}},{re:/^(next|last) ([a-z]+)$/i,handler:function(e){var f=new Date().clearTime();
var b=f.getDay();var c=Date.parseDay(e[2],true);var a=c-b;if(c<=b){a+=7;}if(e[1]=="last"){a-=7;}return f.set("date",f.getDate()+a);}});Hash.implement({getFromPath:function(a){var b=this.getClean();
a.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g,function(c){if(!b){return null;}var d=arguments[2]||arguments[1]||arguments[0];b=(d in b)?b[d]:null;return c;
});return b;},cleanValues:function(a){a=a||$defined;this.each(function(c,b){if(!a(c)){this.erase(b);}},this);return this;},run:function(){var a=arguments;
this.each(function(c,b){if($type(c)=="function"){c.run(a);}});}});(function(){var b=["À","à","Á","á","Â","â","Ã","ã","Ä","ä","Å","å","Ă","ă","Ą","ą","Ć","ć","Č","č","Ç","ç","Ď","ď","Đ","đ","È","è","É","é","Ê","ê","Ë","ë","Ě","ě","Ę","ę","Ğ","ğ","Ì","ì","Í","í","Î","î","Ï","ï","Ĺ","ĺ","Ľ","ľ","Ł","ł","Ñ","ñ","Ň","ň","Ń","ń","Ò","ò","Ó","ó","Ô","ô","Õ","õ","Ö","ö","Ø","ø","ő","Ř","ř","Ŕ","ŕ","Š","š","Ş","ş","Ś","ś","Ť","ť","Ť","ť","Ţ","ţ","Ù","ù","Ú","ú","Û","û","Ü","ü","Ů","ů","Ÿ","ÿ","ý","Ý","Ž","ž","Ź","ź","Ż","ż","Þ","þ","Ð","ð","ß","Œ","œ","Æ","æ","µ"];
var a=["A","a","A","a","A","a","A","a","Ae","ae","A","a","A","a","A","a","C","c","C","c","C","c","D","d","D","d","E","e","E","e","E","e","E","e","E","e","E","e","G","g","I","i","I","i","I","i","I","i","L","l","L","l","L","l","N","n","N","n","N","n","O","o","O","o","O","o","O","o","Oe","oe","O","o","o","R","r","R","r","S","s","S","s","S","s","T","t","T","t","T","t","U","u","U","u","U","u","Ue","ue","U","u","Y","y","Y","y","Z","z","Z","z","Z","z","TH","th","DH","dh","ss","OE","oe","AE","ae","u"];
var d={"[\xa0\u2002\u2003\u2009]":" ","\xb7":"*","[\u2018\u2019]":"'","[\u201c\u201d]":'"',"\u2026":"...","\u2013":"-","\u2014":"--","\uFFFD":"&raquo;"};
var c=function(e,f){e=e||"";var g=f?"<"+e+"[^>]*>([\\s\\S]*?)</"+e+">":"</?"+e+"([^>]+)?>";reg=new RegExp(g,"gi");return reg;};String.implement({standardize:function(){var e=this;
b.each(function(g,f){e=e.replace(new RegExp(g,"g"),a[f]);});return e;},repeat:function(e){return new Array(e+1).join(this);},pad:function(f,h,e){if(this.length>=f){return this;
}var g=(h==null?" ":""+h).repeat(f-this.length).substr(0,f-this.length);if(!e||e=="right"){return this+g;}if(e=="left"){return g+this;}return g.substr(0,(g.length/2).floor())+this+g.substr(0,(g.length/2).ceil());
},getTags:function(e,f){return this.match(c(e,f))||[];},stripTags:function(e,f){return this.replace(c(e,f),"");},tidy:function(){var e=this.toString();
$each(d,function(g,f){e=e.replace(new RegExp(f,"g"),g);});return e;}});})();String.implement({parseQueryString:function(){var b=this.split(/[&;]/),a={};
if(b.length){b.each(function(g){var c=g.indexOf("="),d=c<0?[""]:g.substr(0,c).match(/[^\]\[]+/g),e=decodeURIComponent(g.substr(c+1)),f=a;d.each(function(j,h){var k=f[j];
if(h<d.length-1){f=f[j]=k||{};}else{if($type(k)=="array"){k.push(e);}else{f[j]=$defined(k)?[k,e]:e;}}});});}return a;},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1);
return a?a.run([c,d]):$chk(d);}).join("&");}});var URI=new Class({Implements:Options,options:{},regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:["scheme","user","password","host","port","directory","file","query","fragment"],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(b,a){this.setOptions(a);
var c=this.options.base||URI.base;if(!b){b=c;}if(b&&b.parsed){this.parsed=$unlink(b.parsed);}else{this.set("value",b.href||b.toString(),c?new URI(c):false);
}},parse:function(c,b){var a=c.match(this.regex);if(!a){return false;}a.shift();return this.merge(a.associate(this.parts),b);},merge:function(b,a){if((!b||!b.scheme)&&(!a||!a.scheme)){return false;
}if(a){this.parts.every(function(c){if(b[c]){return false;}b[c]=a[c]||"";return true;});}b.port=b.port||this.schemes[b.scheme.toLowerCase()];b.directory=b.directory?this.parseDirectory(b.directory,a?a.directory:""):"/";
return b;},parseDirectory:function(b,c){b=(b.substr(0,1)=="/"?"":(c||"/"))+b;if(!b.test(URI.regs.directoryDot)){return b;}var a=[];b.replace(URI.regs.endSlash,"").split("/").each(function(d){if(d==".."&&a.length>0){a.pop();
}else{if(d!="."){a.push(d);}}});return a.join("/")+"/";},combine:function(a){return a.value||a.scheme+"://"+(a.user?a.user+(a.password?":"+a.password:"")+"@":"")+(a.host||"")+(a.port&&a.port!=this.schemes[a.scheme]?":"+a.port:"")+(a.directory||"/")+(a.file||"")+(a.query?"?"+a.query:"")+(a.fragment?"#"+a.fragment:"");
},set:function(b,d,c){if(b=="value"){var a=d.match(URI.regs.scheme);if(a){a=a[1];}if(a&&!$defined(this.schemes[a.toLowerCase()])){this.parsed={scheme:a,value:d};
}else{this.parsed=this.parse(d,(c||this).parsed)||(a?{scheme:a,value:d}:{value:d});}}else{if(b=="data"){this.setData(d);}else{this.parsed[b]=d;}}return this;
},get:function(a,b){switch(a){case"value":return this.combine(this.parsed,b?b.parsed:false);case"data":return this.getData();}return this.parsed[a]||"";
},go:function(){document.location.href=this.toString();},toURI:function(){return this;},getData:function(c,b){var a=this.get(b||"query");if(!$chk(a)){return c?null:{};
}var d=a.parseQueryString();return c?d[c]:d;},setData:function(a,c,b){if(typeof a=="string"){data=this.getData();data[arguments[0]]=arguments[1];a=data;
}else{if(c){a=$merge(this.getData(),a);}}return this.set(b||"query",Hash.toQueryString(a));},clearData:function(a){return this.set(a||"query","");}});URI.prototype.toString=URI.prototype.valueOf=function(){return this.get("value");
};URI.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};URI.base=new URI(document.getElements("base[href]",true).getLast(),{base:document.location});
String.implement({toURI:function(a){return new URI(this,a);}});URI=Class.refactor(URI,{combine:function(f,e){if(!e||f.scheme!=e.scheme||f.host!=e.host||f.port!=e.port){return this.previous.apply(this,arguments);
}var a=f.file+(f.query?"?"+f.query:"")+(f.fragment?"#"+f.fragment:"");if(!e.directory){return(f.directory||(f.file?"":"./"))+a;}var d=e.directory.split("/"),c=f.directory.split("/"),g="",h;
var b=0;for(h=0;h<d.length&&h<c.length&&d[h]==c[h];h++){}for(b=0;b<d.length-h-1;b++){g+="../";}for(b=h;b<c.length-1;b++){g+=c[b]+"/";}return(g||(f.file?"":"./"))+a;
},toAbsolute:function(a){a=new URI(a);if(a){a.set("directory","").set("file","");}return this.toRelative(a);},toRelative:function(a){return this.get("value",new URI(a));
}});Element.implement({tidy:function(){this.set("value",this.get("value").tidy());},getTextInRange:function(b,a){return this.get("value").substring(b,a);
},getSelectedText:function(){if(this.setSelectionRange){return this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd());}return document.selection.createRange().text;
},getSelectedRange:function(){if($defined(this.selectionStart)){return{start:this.selectionStart,end:this.selectionEnd};}var e={start:0,end:0};var a=this.getDocument().selection.createRange();
if(!a||a.parentElement()!=this){return e;}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);e.end=e.start+a.text.length;
}else{var b=this.get("value");var d=b.length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);if(c.text.length){d-=b.match(/[\n\r]*$/)[0].length;
}e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length;}return e;},getSelectionStart:function(){return this.getSelectedRange().start;
},getSelectionEnd:function(){return this.getSelectedRange().end;},setCaretPosition:function(a){if(a=="end"){a=this.get("value").length;}this.selectRange(a,a);
return this;},getCaretPosition:function(){return this.getSelectedRange().start;},selectRange:function(e,a){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,a);
}else{var c=this.get("value");var d=c.substr(e,a-e).replace(/\r/g,"").length;e=c.substr(0,e).replace(/\r/g,"").length;var b=this.createTextRange();b.collapse(true);
b.moveEnd("character",e+d);b.moveStart("character",e);b.select();}return this;},insertAtCursor:function(b,a){var d=this.getSelectedRange();var c=this.get("value");
this.set("value",c.substring(0,d.start)+b+c.substring(d.end,c.length));if($pick(a,true)){this.selectRange(d.start,d.start+b.length);}else{this.setCaretPosition(d.start+b.length);
}return this;},insertAroundCursor:function(b,a){b=$extend({before:"",defaultMiddle:"",after:""},b);var c=this.getSelectedText()||b.defaultMiddle;var g=this.getSelectedRange();
var f=this.get("value");if(g.start==g.end){this.set("value",f.substring(0,g.start)+b.before+c+b.after+f.substring(g.end,f.length));this.selectRange(g.start+b.before.length,g.end+b.before.length+c.length);
}else{var d=f.substring(g.start,g.end);this.set("value",f.substring(0,g.start)+b.before+d+b.after+f.substring(g.end,f.length));var e=g.start+b.before.length;
if($pick(a,true)){this.selectRange(e,e+d.length);}else{this.setCaretPosition(e+f.length);}}return this;}});Elements.from=function(e,d){if($pick(d,true)){e=e.stripScripts();
}var b,c=e.match(/^\s*<(t[dhr]|tbody|tfoot|thead)/i);if(c){b=new Element("table");var a=c[1].toLowerCase();if(["td","th","tr"].contains(a)){b=new Element("tbody").inject(b);
if(a!="tr"){b=new Element("tr").inject(b);}}}return(b||new Element("div")).set("html",e).getChildren();};(function(d,e){var c=/(.*?):relay\(([^)]+)\)$/,b=/[+>~\s]/,f=function(g){var h=g.match(c);
return !h?{event:g}:{event:h[1],selector:h[2]};},a=function(m,g){var k=m.target;if(b.test(g=g.trim())){var j=this.getElements(g);for(var h=j.length;h--;
){var l=j[h];if(k==l||l.hasChild(k)){return l;}}}else{for(;k&&k!=this;k=k.parentNode){if(Element.match(k,g)){return document.id(k);}}}return null;};Element.implement({addEvent:function(j,i){var k=f(j);
if(k.selector){var h=this.retrieve("$moo:delegateMonitors",{});if(!h[j]){var g=function(m){var l=a.call(this,m,k.selector);if(l){this.fireEvent(j,[m,l],0,l);
}}.bind(this);h[j]=g;d.call(this,k.event,g);}}return d.apply(this,arguments);},removeEvent:function(j,i){var k=f(j);if(k.selector){var h=this.retrieve("events");
if(!h||!h[j]||(i&&!h[j].keys.contains(i))){return this;}if(i){e.apply(this,[j,i]);}else{e.apply(this,j);}h=this.retrieve("events");if(h&&h[j]&&h[j].keys.length==0){var g=this.retrieve("$moo:delegateMonitors",{});
e.apply(this,[k.event,g[j]]);delete g[j];}return this;}return e.apply(this,arguments);},fireEvent:function(j,h,g,k){var i=this.retrieve("events");if(!i||!i[j]){return this;
}i[j].keys.each(function(l){l.create({bind:k||this,delay:g,arguments:h})();},this);return this;}});})(Element.prototype.addEvent,Element.prototype.removeEvent);
Element.implement({measure:function(e){var g=function(h){return !!(!h||h.offsetHeight||h.offsetWidth);};if(g(this)){return e.apply(this);}var d=this.getParent(),f=[],b=[];
while(!g(d)&&d!=document.body){b.push(d.expose());d=d.getParent();}var c=this.expose();var a=e.apply(this);c();b.each(function(h){h();});return a;},expose:function(){if(this.getStyle("display")!="none"){return $empty;
}var a=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=a;}.bind(this);
},getDimensions:function(a){a=$merge({computeSize:false},a);var f={};var d=function(g,e){return(e.computeSize)?g.getComputedSize(e):g.getSize();};var b=this.getParent("body");
if(b&&this.getStyle("display")=="none"){f=this.measure(function(){return d(this,a);});}else{if(b){try{f=d(this,a);}catch(c){}}else{f={x:0,y:0};}}return $chk(f.x)?$extend(f,{width:f.x,height:f.y}):$extend(f,{x:f.width,y:f.height});
},getComputedSize:function(a){a=$merge({styles:["padding","border"],plains:{height:["top","bottom"],width:["left","right"]},mode:"both"},a);var c={width:0,height:0};
switch(a.mode){case"vertical":delete c.width;delete a.plains.width;break;case"horizontal":delete c.height;delete a.plains.height;break;}var b=[];$each(a.plains,function(g,f){g.each(function(h){a.styles.each(function(i){b.push((i=="border")?i+"-"+h+"-width":i+"-"+h);
});});});var e={};b.each(function(f){e[f]=this.getComputedStyle(f);},this);var d=[];$each(a.plains,function(g,f){var h=f.capitalize();c["total"+h]=c["computed"+h]=0;
g.each(function(i){c["computed"+i.capitalize()]=0;b.each(function(k,j){if(k.test(i)){e[k]=e[k].toInt()||0;c["total"+h]=c["total"+h]+e[k];c["computed"+i.capitalize()]=c["computed"+i.capitalize()]+e[k];
}if(k.test(i)&&f!=k&&(k.test("border")||k.test("padding"))&&!d.contains(k)){d.push(k);c["computed"+h]=c["computed"+h]-e[k];}});});});["Width","Height"].each(function(g){var f=g.toLowerCase();
if(!$chk(c[f])){return;}c[f]=c[f]+this["offset"+g]+c["computed"+g];c["total"+g]=c[f]+c["total"+g];delete c["computed"+g];},this);return $extend(e,c);}});
(function(){var a=false;window.addEvent("domready",function(){var b=new Element("div").setStyles({position:"fixed",top:0,right:0}).inject(document.body);
a=(b.offsetTop===0);b.dispose();});Element.implement({pin:function(d){if(this.getStyle("display")=="none"){return null;}var f,b=window.getScroll();if(d!==false){f=this.getPosition();
if(!this.retrieve("pinned")){var h={top:f.y-b.y,left:f.x-b.x};if(a){this.setStyle("position","fixed").setStyles(h);}else{this.store("pinnedByJS",true);
this.setStyles({position:"absolute",top:f.y,left:f.x}).addClass("isPinned");this.store("scrollFixer",(function(){if(this.retrieve("pinned")){var i=window.getScroll();
}this.setStyles({top:h.top.toInt()+i.y,left:h.left.toInt()+i.x});}).bind(this));window.addEvent("scroll",this.retrieve("scrollFixer"));}this.store("pinned",true);
}}else{var g;if(!Browser.Engine.trident){var e=this.getParent();g=(e.getComputedStyle("position")!="static"?e:e.getOffsetParent());}f=this.getPosition(g);
this.store("pinned",false);var c;if(a&&!this.retrieve("pinnedByJS")){c={top:f.y+b.y,left:f.x+b.x};}else{this.store("pinnedByJS",false);window.removeEvent("scroll",this.retrieve("scrollFixer"));
c={top:f.y,left:f.x};}this.setStyles($merge(c,{position:"absolute"})).removeClass("isPinned");}return this;},unpin:function(){return this.pin(false);},togglepin:function(){this.pin(!this.retrieve("pinned"));
}});})();(function(){var a=Element.prototype.position;Element.implement({position:function(g){if(g&&($defined(g.x)||$defined(g.y))){return a?a.apply(this,arguments):this;
}$each(g||{},function(u,t){if(!$defined(u)){delete g[t];}});g=$merge({relativeTo:document.body,position:{x:"center",y:"center"},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,ignoreScroll:false,allowNegative:false},g);
var r={x:0,y:0},e=false;var c=this.measure(function(){return document.id(this.getOffsetParent());});if(c&&c!=this.getDocument().body){r=c.measure(function(){return this.getPosition();
});e=c!=document.id(g.relativeTo);g.offset.x=g.offset.x-r.x;g.offset.y=g.offset.y-r.y;}var s=function(t){if($type(t)!="string"){return t;}t=t.toLowerCase();
var u={};if(t.test("left")){u.x="left";}else{if(t.test("right")){u.x="right";}else{u.x="center";}}if(t.test("upper")||t.test("top")){u.y="top";}else{if(t.test("bottom")){u.y="bottom";
}else{u.y="center";}}return u;};g.edge=s(g.edge);g.position=s(g.position);if(!g.edge){if(g.position.x=="center"&&g.position.y=="center"){g.edge={x:"center",y:"center"};
}else{g.edge={x:"left",y:"top"};}}this.setStyle("position","absolute");var f=document.id(g.relativeTo)||document.body,d=f==document.body?window.getScroll():f.getPosition(),l=d.y,h=d.x;
var n=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});var j={},o=g.offset.y,q=g.offset.x,k=window.getSize();switch(g.position.x){case"left":j.x=h+q;
break;case"right":j.x=h+q+f.offsetWidth;break;default:j.x=h+((f==document.body?k.x:f.offsetWidth)/2)+q;break;}switch(g.position.y){case"top":j.y=l+o;break;
case"bottom":j.y=l+o+f.offsetHeight;break;default:j.y=l+((f==document.body?k.y:f.offsetHeight)/2)+o;break;}if(g.edge){var b={};switch(g.edge.x){case"left":b.x=0;
break;case"right":b.x=-n.x-n.computedRight-n.computedLeft;break;default:b.x=-(n.totalWidth/2);break;}switch(g.edge.y){case"top":b.y=0;break;case"bottom":b.y=-n.y-n.computedTop-n.computedBottom;
break;default:b.y=-(n.totalHeight/2);break;}j.x+=b.x;j.y+=b.y;}j={left:((j.x>=0||e||g.allowNegative)?j.x:0).toInt(),top:((j.y>=0||e||g.allowNegative)?j.y:0).toInt()};
var i={left:"x",top:"y"};["minimum","maximum"].each(function(t){["left","top"].each(function(u){var v=g[t]?g[t][i[u]]:null;if(v!=null&&j[u]<v){j[u]=v;}});
});if(f.getStyle("position")=="fixed"||g.relFixedPosition){var m=window.getScroll();j.top+=m.y;j.left+=m.x;}if(g.ignoreScroll){var p=f.getScroll();j.top-=p.y;
j.left-=p.x;}if(g.ignoreMargins){j.left+=(g.edge.x=="right"?n["margin-right"]:g.edge.x=="center"?-n["margin-left"]+((n["margin-right"]+n["margin-left"])/2):-n["margin-left"]);
j.top+=(g.edge.y=="bottom"?n["margin-bottom"]:g.edge.y=="center"?-n["margin-top"]+((n["margin-bottom"]+n["margin-top"])/2):-n["margin-top"]);}j.left=Math.ceil(j.left);
j.top=Math.ceil(j.top);if(g.returnPos){return j;}else{this.setStyles(j);}return this;}});})();Element.implement({isDisplayed:function(){return this.getStyle("display")!="none";
},isVisible:function(){var a=this.offsetWidth,b=this.offsetHeight;return(a==0&&b==0)?false:(a>0&&b>0)?true:this.isDisplayed();},toggle:function(){return this[this.isDisplayed()?"hide":"show"]();
},hide:function(){var b;try{b=this.getStyle("display");}catch(a){}return this.store("originalDisplay",b||"").setStyle("display","none");},show:function(a){a=a||this.retrieve("originalDisplay")||"block";
return this.setStyle("display",(a=="none")?"block":a);},swapClass:function(a,b){return this.removeClass(a).addClass(b);}});if(!window.Form){window.Form={};
}(function(){Form.Request=new Class({Binds:["onSubmit","onFormValidate"],Implements:[Options,Events,Class.Occlude],options:{requestOptions:{evalScripts:true,useSpinner:true,emulation:false,link:"ignore"},extraData:{},resetForm:true},property:"form.request",initialize:function(b,c,a){this.element=document.id(b);
if(this.occlude()){return this.occluded;}this.update=document.id(c);this.setOptions(a);this.makeRequest();if(this.options.resetForm){this.request.addEvent("success",function(){$try(function(){this.element.reset();
}.bind(this));if(window.OverText){OverText.update();}}.bind(this));}this.attach();},toElement:function(){return this.element;},makeRequest:function(){this.request=new Request.HTML($merge({update:this.update,emulation:false,spinnerTarget:this.element,method:this.element.get("method")||"post"},this.options.requestOptions)).addEvents({success:function(b,a){["complete","success"].each(function(c){this.fireEvent(c,[this.update,b,a]);
},this);}.bind(this),failure:function(a){this.fireEvent("complete").fireEvent("failure",a);}.bind(this),exception:function(){this.fireEvent("failure",xhr);
}.bind(this)});},attach:function(a){a=$pick(a,true);method=a?"addEvent":"removeEvent";var b=this.element.retrieve("validator");if(b){b[method]("onFormValidate",this.onFormValidate);
}if(!b||!a){this.element[method]("submit",this.onSubmit);}},detach:function(){this.attach(false);},enable:function(){this.attach();},disable:function(){this.detach();
},onFormValidate:function(b,a,d){var c=this.element.retrieve("validator");if(b||(c&&!c.options.stopOnFailure)){if(d&&d.stop){d.stop();}this.send();}},onSubmit:function(a){if(this.element.retrieve("validator")){this.detach();
return;}a.stop();this.send();},send:function(){var b=this.element.toQueryString().trim();var a=$H(this.options.extraData).toQueryString();if(b){b+="&"+a;
}else{b=a;}this.fireEvent("send",[this.element,b.parseQueryString()]);this.request.send({data:b,url:this.element.get("action")});return this;}});Element.Properties.formRequest={set:function(){var a=Array.link(arguments,{options:Object.type,update:Element.type,updateId:String.type});
var c=a.update||a.updateId;var b=this.retrieve("form.request");if(c){if(b){b.update=document.id(c);}this.store("form.request:update",c);}if(a.options){if(b){b.setOptions(a.options);
}this.store("form.request:options",a.options);}return this;},get:function(){var a=Array.link(arguments,{options:Object.type,update:Element.type,updateId:String.type});
var b=a.update||a.updateId;if(a.options||b||!this.retrieve("form.request")){if(a.options||!this.retrieve("form.request:options")){this.set("form.request",a.options);
}if(b){this.set("form.request",b);}this.store("form.request",new Form.Request(this,this.retrieve("form.request:update"),this.retrieve("form.request:options")));
}return this.retrieve("form.request");}};Element.implement({formUpdate:function(b,a){this.get("form.request",b,a).send();return this;}});})();Form.Request.Append=new Class({Extends:Form.Request,options:{useReveal:true,revealOptions:{},inject:"bottom"},makeRequest:function(){this.request=new Request.HTML($merge({url:this.element.get("action"),method:this.element.get("method")||"post",spinnerTarget:this.element},this.options.requestOptions,{evalScripts:false})).addEvents({success:function(b,g,f,a){var c;
var d=Elements.from(f);if(d.length==1){c=d[0];}else{c=new Element("div",{styles:{display:"none"}}).adopt(d);}c.inject(this.update,this.options.inject);
if(this.options.requestOptions.evalScripts){$exec(a);}this.fireEvent("beforeEffect",c);var e=function(){this.fireEvent("success",[c,this.update,b,g,f,a]);
}.bind(this);if(this.options.useReveal){c.get("reveal",this.options.revealOptions).chain(e);c.reveal();}else{e();}}.bind(this),failure:function(a){this.fireEvent("failure",a);
}.bind(this)});}});if(!window.Form){window.Form={};}var InputValidator=new Class({Implements:[Options],options:{errorMsg:"Validation failed.",test:function(a){return true;
}},initialize:function(b,a){this.setOptions(a);this.className=b;},test:function(b,a){if(document.id(b)){return this.options.test(document.id(b),a||this.getProps(b));
}else{return false;}},getError:function(c,a){var b=this.options.errorMsg;if($type(b)=="function"){b=b(document.id(c),a||this.getProps(c));}return b;},getProps:function(a){if(!document.id(a)){return{};
}return a.get("validatorProps");}});Element.Properties.validatorProps={set:function(a){return this.eliminate("validatorProps").store("validatorProps",a);
},get:function(a){if(a){this.set(a);}if(this.retrieve("validatorProps")){return this.retrieve("validatorProps");}if(this.getProperty("validatorProps")){try{this.store("validatorProps",JSON.decode(this.getProperty("validatorProps")));
}catch(c){return{};}}else{var b=this.get("class").split(" ").filter(function(d){return d.test(":");});if(!b.length){this.store("validatorProps",{});}else{a={};
b.each(function(d){var f=d.split(":");if(f[1]){try{a[f[0]]=JSON.decode(f[1]);}catch(g){}}});this.store("validatorProps",a);}}return this.retrieve("validatorProps");
}};Form.Validator=new Class({Implements:[Options,Events],Binds:["onSubmit"],options:{fieldSelectors:"input, select, textarea",ignoreHidden:true,ignoreDisabled:true,useTitles:false,evaluateOnSubmit:true,evaluateFieldsOnBlur:true,evaluateFieldsOnChange:true,serial:true,stopOnFailure:true,warningPrefix:function(){return Form.Validator.getMsg("warningPrefix")||"Warning: ";
},errorPrefix:function(){return Form.Validator.getMsg("errorPrefix")||"Error: ";}},initialize:function(b,a){this.setOptions(a);this.element=document.id(b);
this.element.store("validator",this);this.warningPrefix=$lambda(this.options.warningPrefix)();this.errorPrefix=$lambda(this.options.errorPrefix)();if(this.options.evaluateOnSubmit){this.element.addEvent("submit",this.onSubmit);
}if(this.options.evaluateFieldsOnBlur||this.options.evaluateFieldsOnChange){this.watchFields(this.getFields());}},toElement:function(){return this.element;
},getFields:function(){return(this.fields=this.element.getElements(this.options.fieldSelectors));},watchFields:function(a){a.each(function(b){if(this.options.evaluateFieldsOnBlur){b.addEvent("blur",this.validationMonitor.pass([b,false],this));
}if(this.options.evaluateFieldsOnChange){b.addEvent("change",this.validationMonitor.pass([b,true],this));}},this);},validationMonitor:function(){$clear(this.timer);
this.timer=this.validateField.delay(50,this,arguments);},onSubmit:function(a){if(!this.validate(a)&&a){a.preventDefault();}else{this.reset();}},reset:function(){this.getFields().each(this.resetField,this);
return this;},validate:function(b){var a=this.getFields().map(function(c){return this.validateField(c,true);},this).every(function(c){return c;});this.fireEvent("formValidate",[a,this.element,b]);
if(this.options.stopOnFailure&&!a&&b){b.preventDefault();}return a;},validateField:function(i,a){if(this.paused){return true;}i=document.id(i);var d=!i.hasClass("validation-failed");
var f,h;if(this.options.serial&&!a){f=this.element.getElement(".validation-failed");h=this.element.getElement(".warning");}if(i&&(!f||a||i.hasClass("validation-failed")||(f&&!this.options.serial))){var c=i.className.split(" ").some(function(j){return this.getValidator(j);
},this);var g=[];i.className.split(" ").each(function(j){if(j&&!this.test(j,i)){g.include(j);}},this);d=g.length===0;if(c&&!i.hasClass("warnOnly")){if(d){i.addClass("validation-passed").removeClass("validation-failed");
this.fireEvent("elementPass",i);}else{i.addClass("validation-failed").removeClass("validation-passed");this.fireEvent("elementFail",[i,g]);}}if(!h){var e=i.className.split(" ").some(function(j){if(j.test("^warn-")||i.hasClass("warnOnly")){return this.getValidator(j.replace(/^warn-/,""));
}else{return null;}},this);i.removeClass("warning");var b=i.className.split(" ").map(function(j){if(j.test("^warn-")||i.hasClass("warnOnly")){return this.test(j.replace(/^warn-/,""),i,true);
}else{return null;}},this);}}return d;},test:function(b,d,e){d=document.id(d);if((this.options.ignoreHidden&&!d.isVisible())||(this.options.ignoreDisabled&&d.get("disabled"))){return true;
}var a=this.getValidator(b);if(d.hasClass("ignoreValidation")){return true;}e=$pick(e,false);if(d.hasClass("warnOnly")){e=true;}var c=a?a.test(d):true;
if(a&&d.isVisible()){this.fireEvent("elementValidate",[c,d,b,e]);}if(e){return true;}return c;},resetField:function(a){a=document.id(a);if(a){a.className.split(" ").each(function(b){if(b.test("^warn-")){b=b.replace(/^warn-/,"");
}a.removeClass("validation-failed");a.removeClass("warning");a.removeClass("validation-passed");},this);}return this;},stop:function(){this.paused=true;
return this;},start:function(){this.paused=false;return this;},ignoreField:function(a,b){a=document.id(a);if(a){this.enforceField(a);if(b){a.addClass("warnOnly");
}else{a.addClass("ignoreValidation");}}return this;},enforceField:function(a){a=document.id(a);if(a){a.removeClass("warnOnly").removeClass("ignoreValidation");
}return this;}});Form.Validator.getMsg=function(a){return MooTools.lang.get("Form.Validator",a);};Form.Validator.adders={validators:{},add:function(b,a){this.validators[b]=new InputValidator(b,a);
if(!this.initialize){this.implement({validators:this.validators});}},addAllThese:function(a){$A(a).each(function(b){this.add(b[0],b[1]);},this);},getValidator:function(a){return this.validators[a.split(":")[0]];
}};$extend(Form.Validator,Form.Validator.adders);Form.Validator.implement(Form.Validator.adders);Form.Validator.add("IsEmpty",{errorMsg:false,test:function(a){if(a.type=="select-one"||a.type=="select"){return !(a.selectedIndex>=0&&a.options[a.selectedIndex].value!="");
}else{return((a.get("value")==null)||(a.get("value").length==0));}}});Form.Validator.addAllThese([["required",{errorMsg:function(){return Form.Validator.getMsg("required");
},test:function(a){return !Form.Validator.getValidator("IsEmpty").test(a);}}],["minLength",{errorMsg:function(a,b){if($type(b.minLength)){return Form.Validator.getMsg("minLength").substitute({minLength:b.minLength,length:a.get("value").length});
}else{return"";}},test:function(a,b){if($type(b.minLength)){return(a.get("value").length>=$pick(b.minLength,0));}else{return true;}}}],["maxLength",{errorMsg:function(a,b){if($type(b.maxLength)){return Form.Validator.getMsg("maxLength").substitute({maxLength:b.maxLength,length:a.get("value").length});
}else{return"";}},test:function(a,b){return(a.get("value").length<=$pick(b.maxLength,10000));}}],["validate-integer",{errorMsg:Form.Validator.getMsg.pass("integer"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^(-?[1-9]\d*|0)$/).test(a.get("value"));
}}],["validate-numeric",{errorMsg:Form.Validator.getMsg.pass("numeric"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(a.get("value"));
}}],["validate-digits",{errorMsg:Form.Validator.getMsg.pass("digits"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^[\d() .:\-\+#]+$/.test(a.get("value")));
}}],["validate-alpha",{errorMsg:Form.Validator.getMsg.pass("alpha"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^[a-zA-Z]+$/).test(a.get("value"));
}}],["validate-alphanum",{errorMsg:Form.Validator.getMsg.pass("alphanum"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||!(/\W/).test(a.get("value"));
}}],["validate-date",{errorMsg:function(a,b){if(Date.parse){var c=b.dateFormat||"%x";return Form.Validator.getMsg("dateSuchAs").substitute({date:new Date().format(c)});
}else{return Form.Validator.getMsg("dateInFormatMDY");}},test:function(a,b){if(Form.Validator.getValidator("IsEmpty").test(a)){return true;}var g;if(Date.parse){var f=b.dateFormat||"%x";
g=Date.parse(a.get("value"));var e=g.format(f);if(e!="invalid date"){a.set("value",e);}return !isNaN(g);}else{var c=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!c.test(a.get("value"))){return false;
}g=new Date(a.get("value").replace(c,"$1/$2/$3"));return(parseInt(RegExp.$1,10)==(1+g.getMonth()))&&(parseInt(RegExp.$2,10)==g.getDate())&&(parseInt(RegExp.$3,10)==g.getFullYear());
}}}],["validate-email",{errorMsg:Form.Validator.getMsg.pass("email"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i).test(a.get("value"));
}}],["validate-url",{errorMsg:Form.Validator.getMsg.pass("url"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i).test(a.get("value"));
}}],["validate-currency-dollar",{errorMsg:Form.Validator.getMsg.pass("currencyDollar"),test:function(a){return Form.Validator.getValidator("IsEmpty").test(a)||(/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(a.get("value"));
}}],["validate-one-required",{errorMsg:Form.Validator.getMsg.pass("oneRequired"),test:function(a,b){var c=document.id(b["validate-one-required"])||a.getParent();
return c.getElements("input").some(function(d){if(["checkbox","radio"].contains(d.get("type"))){return d.get("checked");}return d.get("value");});}}]]);
Element.Properties.validator={set:function(a){var b=this.retrieve("validator");if(b){b.setOptions(a);}return this.store("validator:options");},get:function(a){if(a||!this.retrieve("validator")){if(a||!this.retrieve("validator:options")){this.set("validator",a);
}this.store("validator",new Form.Validator(this,this.retrieve("validator:options")));}return this.retrieve("validator");}};Element.implement({validate:function(a){this.set("validator",a);
return this.get("validator",a).validate();}});var FormValidator=Form.Validator;Form.Validator.Inline=new Class({Extends:Form.Validator,options:{scrollToErrorsOnSubmit:true,scrollFxOptions:{transition:"quad:out",offset:{y:-20}}},initialize:function(b,a){this.parent(b,a);
this.addEvent("onElementValidate",function(g,f,e,h){var d=this.getValidator(e);if(!g&&d.getError(f)){if(h){f.addClass("warning");}var c=this.makeAdvice(e,f,d.getError(f),h);
this.insertAdvice(c,f);this.showAdvice(e,f);}else{this.hideAdvice(e,f);}});},makeAdvice:function(d,f,c,g){var e=(g)?this.warningPrefix:this.errorPrefix;
e+=(this.options.useTitles)?f.title||c:c;var a=(g)?"warning-advice":"validation-advice";var b=this.getAdvice(d,f);if(b){b=b.set("html",e);}else{b=new Element("div",{html:e,styles:{display:"none"},id:"advice-"+d+"-"+this.getFieldId(f)}).addClass(a);
}f.store("advice-"+d,b);return b;},getFieldId:function(a){return a.id?a.id:a.id="input_"+a.name;},showAdvice:function(b,c){var a=this.getAdvice(b,c);if(a&&!c.retrieve(this.getPropName(b))&&(a.getStyle("display")=="none"||a.getStyle("visiblity")=="hidden"||a.getStyle("opacity")==0)){c.store(this.getPropName(b),true);
if(a.reveal){a.reveal();}else{a.setStyle("display","block");}}},hideAdvice:function(b,c){var a=this.getAdvice(b,c);if(a&&c.retrieve(this.getPropName(b))){c.store(this.getPropName(b),false);
if(a.dissolve){a.dissolve();}else{a.setStyle("display","none");}}},getPropName:function(a){return"advice"+a;},resetField:function(a){a=document.id(a);if(!a){return this;
}this.parent(a);a.className.split(" ").each(function(b){this.hideAdvice(b,a);},this);return this;},getAllAdviceMessages:function(d,c){var b=[];if(d.hasClass("ignoreValidation")&&!c){return b;
}var a=d.className.split(" ").some(function(g){var e=g.test("^warn-")||d.hasClass("warnOnly");if(e){g=g.replace(/^warn-/,"");}var f=this.getValidator(g);
if(!f){return;}b.push({message:f.getError(d),warnOnly:e,passed:f.test(),validator:f});},this);return b;},getAdvice:function(a,b){return b.retrieve("advice-"+a);
},insertAdvice:function(a,c){var b=c.get("validatorProps");if(!b.msgPos||!document.id(b.msgPos)){if(c.type.toLowerCase()=="radio"){c.getParent().adopt(a);
}else{a.inject(document.id(c),"after");}}else{document.id(b.msgPos).grab(a);}},validateField:function(f,e){var a=this.parent(f,e);if(this.options.scrollToErrorsOnSubmit&&!a){var b=document.id(this).getElement(".validation-failed");
var c=document.id(this).getParent();while(c!=document.body&&c.getScrollSize().y==c.getSize().y){c=c.getParent();}var d=c.retrieve("fvScroller");if(!d&&window.Fx&&Fx.Scroll){d=new Fx.Scroll(c,this.options.scrollFxOptions);
c.store("fvScroller",d);}if(b){if(d){d.toElement(b);}else{c.scrollTo(c.getScroll().x,b.getPosition(c).y-20);}}}return a;}});Form.Validator.addAllThese([["validate-enforce-oncheck",{test:function(a,b){if(a.checked){var c=a.getParent("form").retrieve("validator");
if(!c){return true;}(b.toEnforce||document.id(b.enforceChildrenOf).getElements("input, select, textarea")).map(function(d){c.enforceField(d);});}return true;
}}],["validate-ignore-oncheck",{test:function(a,b){if(a.checked){var c=a.getParent("form").retrieve("validator");if(!c){return true;}(b.toIgnore||document.id(b.ignoreChildrenOf).getElements("input, select, textarea")).each(function(d){c.ignoreField(d);
c.resetField(d);});}return true;}}],["validate-nospace",{errorMsg:function(){return Form.Validator.getMsg("noSpace");},test:function(a,b){return !a.get("value").test(/\s/);
}}],["validate-toggle-oncheck",{test:function(b,c){var d=b.getParent("form").retrieve("validator");if(!d){return true;}var a=c.toToggle||document.id(c.toToggleChildrenOf).getElements("input, select, textarea");
if(!b.checked){a.each(function(e){d.ignoreField(e);d.resetField(e);});}else{a.each(function(e){d.enforceField(e);});}return true;}}],["validate-reqchk-bynode",{errorMsg:function(){return Form.Validator.getMsg("reqChkByNode");
},test:function(a,b){return(document.id(b.nodeId).getElements(b.selector||"input[type=checkbox], input[type=radio]")).some(function(c){return c.checked;
});}}],["validate-required-check",{errorMsg:function(a,b){return b.useTitle?a.get("title"):Form.Validator.getMsg("requiredChk");},test:function(a,b){return !!a.checked;
}}],["validate-reqchk-byname",{errorMsg:function(a,b){return Form.Validator.getMsg("reqChkByName").substitute({label:b.label||a.get("type")});},test:function(b,d){var c=d.groupName||b.get("name");
var a=$$(document.getElementsByName(c)).some(function(g,f){return g.checked;});var e=b.getParent("form").retrieve("validator");if(a&&e){e.resetField(b);
}return a;}}],["validate-match",{errorMsg:function(a,b){return Form.Validator.getMsg("match").substitute({matchName:b.matchName||document.id(b.matchInput).get("name")});
},test:function(b,c){var d=b.get("value");var a=document.id(c.matchInput)&&document.id(c.matchInput).get("value");return d&&a?d==a:true;}}],["validate-after-date",{errorMsg:function(a,b){return Form.Validator.getMsg("afterDate").substitute({label:b.afterLabel||(b.afterElement?Form.Validator.getMsg("startDate"):Form.Validator.getMsg("currentDate"))});
},test:function(b,c){var d=document.id(c.afterElement)?Date.parse(document.id(c.afterElement).get("value")):new Date();var a=Date.parse(b.get("value"));
return a&&d?a>=d:true;}}],["validate-before-date",{errorMsg:function(a,b){return Form.Validator.getMsg("beforeDate").substitute({label:b.beforeLabel||(b.beforeElement?Form.Validator.getMsg("endDate"):Form.Validator.getMsg("currentDate"))});
},test:function(b,c){var d=Date.parse(b.get("value"));var a=document.id(c.beforeElement)?Date.parse(document.id(c.beforeElement).get("value")):new Date();
return a&&d?a>=d:true;}}],["validate-custom-required",{errorMsg:function(){return Form.Validator.getMsg("required");},test:function(a,b){return a.get("value")!=b.emptyValue;
}}],["validate-same-month",{errorMsg:function(a,b){var c=document.id(b.sameMonthAs)&&document.id(b.sameMonthAs).get("value");var d=a.get("value");if(d!=""){return Form.Validator.getMsg(c?"sameMonth":"startMonth");
}},test:function(a,b){var d=Date.parse(a.get("value"));var c=Date.parse(document.id(b.sameMonthAs)&&document.id(b.sameMonthAs).get("value"));return d&&c?d.format("%B")==c.format("%B"):true;
}}],["validate-cc-num",{errorMsg:function(a){var b=a.get("value").replace(/[^0-9]/g,"");return Form.Validator.getMsg("creditcard").substitute({length:b.length});
},test:function(c){if(Form.Validator.getValidator("IsEmpty").test(c)){return true;}var g=c.get("value");g=g.replace(/[^0-9]/g,"");var a=false;if(g.test(/^4[0-9]{12}([0-9]{3})?$/)){a="Visa";
}else{if(g.test(/^5[1-5]([0-9]{14})$/)){a="Master Card";}else{if(g.test(/^3[47][0-9]{13}$/)){a="American Express";}else{if(g.test(/^6011[0-9]{12}$/)){a="Discover";
}}}}if(a){var d=0;var e=0;for(var b=g.length-1;b>=0;--b){e=g.charAt(b).toInt();if(e==0){continue;}if((g.length-b)%2==0){e+=e;}if(e>9){e=e.toString().charAt(0).toInt()+e.toString().charAt(1).toInt();
}d+=e;}if((d%10)==0){return true;}}var f="";while(g!=""){f+=" "+g.substr(0,4);g=g.substr(4);}c.getParent("form").retrieve("validator").ignoreField(c);c.set("value",f.clean());
c.getParent("form").retrieve("validator").enforceField(c);return false;}}]]);var OverText=new Class({Implements:[Options,Events,Class.Occlude],Binds:["reposition","assert","focus","hide"],options:{element:"label",positionOptions:{position:"upperLeft",edge:"upperLeft",offset:{x:4,y:2}},poll:false,pollInterval:250,wrap:false},property:"OverText",initialize:function(b,a){this.element=document.id(b);
if(this.occlude()){return this.occluded;}this.setOptions(a);this.attach(this.element);OverText.instances.push(this);if(this.options.poll){this.poll();}return this;
},toElement:function(){return this.element;},attach:function(){var a=this.options.textOverride||this.element.get("alt")||this.element.get("title");if(!a){return;
}this.text=new Element(this.options.element,{"class":"overTxtLabel",styles:{lineHeight:"normal",position:"absolute",cursor:"text"},html:a,events:{click:this.hide.pass(this.options.element=="label",this)}}).inject(this.element,"after");
if(this.options.element=="label"){if(!this.element.get("id")){this.element.set("id","input_"+new Date().getTime());}this.text.set("for",this.element.get("id"));
}if(this.options.wrap){this.textHolder=new Element("div",{styles:{lineHeight:"normal",position:"relative"},"class":"overTxtWrapper"}).adopt(this.text).inject(this.element,"before");
}this.element.addEvents({focus:this.focus,blur:this.assert,change:this.assert}).store("OverTextDiv",this.text);window.addEvent("resize",this.reposition.bind(this));
this.assert(true);this.reposition();},wrap:function(){if(this.options.element=="label"){if(!this.element.get("id")){this.element.set("id","input_"+new Date().getTime());
}this.text.set("for",this.element.get("id"));}},startPolling:function(){this.pollingPaused=false;return this.poll();},poll:function(a){if(this.poller&&!a){return this;
}var b=function(){if(!this.pollingPaused){this.assert(true);}}.bind(this);if(a){$clear(this.poller);}else{this.poller=b.periodical(this.options.pollInterval,this);
}return this;},stopPolling:function(){this.pollingPaused=true;return this.poll(true);},focus:function(){if(this.text&&(!this.text.isDisplayed()||this.element.get("disabled"))){return;
}this.hide();},hide:function(c,a){if(this.text&&(this.text.isDisplayed()&&(!this.element.get("disabled")||a))){this.text.hide();this.fireEvent("textHide",[this.text,this.element]);
this.pollingPaused=true;if(!c){try{this.element.fireEvent("focus");this.element.focus();}catch(b){}}}return this;},show:function(){if(this.text&&!this.text.isDisplayed()){this.text.show();
this.reposition();this.fireEvent("textShow",[this.text,this.element]);this.pollingPaused=false;}return this;},assert:function(a){this[this.test()?"show":"hide"](a);
},test:function(){var a=this.element.get("value");return !a;},reposition:function(){this.assert(true);if(!this.element.isVisible()){return this.stopPolling().hide();
}if(this.text&&this.test()){this.text.position($merge(this.options.positionOptions,{relativeTo:this.element}));}return this;}});OverText.instances=[];$extend(OverText,{each:function(a){return OverText.instances.map(function(c,b){if(c.element&&c.text){return a.apply(OverText,[c,b]);
}return null;});},update:function(){return OverText.each(function(a){return a.reposition();});},hideAll:function(){return OverText.each(function(a){return a.hide(true,true);
});},showAll:function(){return OverText.each(function(a){return a.show();});}});if(window.Fx&&Fx.Reveal){Fx.Reveal.implement({hideInputs:Browser.Engine.trident?"select, input, textarea, object, embed, .overTxtLabel":false});
}Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);this.parent(a);},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};
for(var b in a){f[b]=this.parent(a[b],e[b],j);}}return c;},set:function(b){for(var c in b){var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit);
}}return this;},start:function(c){if(!this.check(c)){return this;}var h={},j={};for(var d in c){var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);
a[b]=e.from;g[b]=e.to;}}return this.parent(h,j);}});Fx.Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:"click",initialDisplayFx:true,returnHeightToAuto:true},initialize:function(){var c=Array.link(arguments,{container:Element.type,options:Object.type,togglers:$defined,elements:$defined});
this.parent(c.elements,c.options);this.togglers=$$(c.togglers);this.previous=-1;this.internalChain=new Chain();if(this.options.alwaysHide){this.options.wait=true;
}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}if(this.options.start){this.options.display=false;this.options.show=false;
}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity";}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth";
}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight";}for(var b=0,a=this.togglers.length;b<a;b++){this.addSection(this.togglers[b],this.elements[b]);
}this.elements.each(function(e,d){if(this.options.show===d){this.fireEvent("active",[this.togglers[d],e]);}else{for(var f in this.effects){e.setStyle(f,0);
}}},this);if($chk(this.options.display)||this.options.initialDisplayFx===false){this.display(this.options.display,this.options.initialDisplayFx);}if(this.options.fixedHeight!==false){this.options.returnHeightToAuto=false;
}this.addEvent("complete",this.internalChain.callChain.bind(this.internalChain));},addSection:function(e,c){e=document.id(e);c=document.id(c);var f=this.togglers.contains(e);
this.togglers.include(e);this.elements.include(c);var a=this.togglers.indexOf(e);var b=this.display.bind(this,a);e.store("accordion:display",b);e.addEvent(this.options.trigger,b);
if(this.options.height){c.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"});}if(this.options.width){c.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"});
}c.fullOpacity=1;if(this.options.fixedWidth){c.fullWidth=this.options.fixedWidth;}if(this.options.fixedHeight){c.fullHeight=this.options.fixedHeight;}c.setStyle("overflow","hidden");
if(!f){for(var d in this.effects){c.setStyle(d,0);}}return this;},detach:function(){this.togglers.each(function(a){a.removeEvent(this.options.trigger,a.retrieve("accordion:display"));
},this);},display:function(a,b){if(!this.check(a,b)){return this;}b=$pick(b,true);if(this.options.returnHeightToAuto){var d=this.elements[this.previous];
if(d&&!this.selfHidden){for(var c in this.effects){d.setStyle(c,d[this.effects[c]]);}}}a=($type(a)=="element")?this.elements.indexOf(a):a;if((this.timer&&this.options.wait)||(a===this.previous&&!this.options.alwaysHide)){return this;
}this.previous=a;var e={};this.elements.each(function(h,g){e[g]={};var f;if(g!=a){f=true;}else{if(this.options.alwaysHide&&((h.offsetHeight>0&&this.options.height)||h.offsetWidth>0&&this.options.width)){f=true;
this.selfHidden=true;}}this.fireEvent(f?"background":"active",[this.togglers[g],h]);for(var j in this.effects){e[g][j]=f?0:h[this.effects[j]];}},this);
this.internalChain.chain(function(){if(this.options.returnHeightToAuto&&!this.selfHidden){var f=this.elements[a];if(f){f.setStyle("height","auto");}}}.bind(this));
return b?this.start(e):this.set(e);}});var Accordion=new Class({Extends:Fx.Accordion,initialize:function(){this.parent.apply(this,arguments);var a=Array.link(arguments,{container:Element.type});
this.container=a.container;},addSection:function(c,b,e){c=document.id(c);b=document.id(b);var d=this.togglers.contains(c);var a=this.togglers.length;if(a&&(!d||e)){e=$pick(e,a-1);
c.inject(this.togglers[e],"before");b.inject(c,"after");}else{if(this.container&&!d){c.inject(this.container);b.inject(this.container);}}return this.parent.apply(this,arguments);
}});Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0}},start:function(a){return this.parent(this.element.position($merge(this.options,a,{returnPos:true})));
}});Element.Properties.move={set:function(a){var b=this.retrieve("move");if(b){b.cancel();}return this.eliminate("move").store("move:options",$extend({link:"cancel"},a));
},get:function(a){if(a||!this.retrieve("move")){if(a||!this.retrieve("move:options")){this.set("move",a);}this.store("move",new Fx.Move(this,this.retrieve("move:options")));
}return this.retrieve("move");}};Element.implement({move:function(a){this.get("move").start(a);return this;}});Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.Engine.trident4,mode:"vertical",display:"block",hideInputs:Browser.Engine.trident?"select, input, textarea, object, embed":false},dissolve:function(){try{if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;
this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});
this.element.setStyle("display",this.options.display);if(this.options.transitionOpacity){d.opacity=1;}var b={};$each(d,function(f,e){b[e]=[f,0];},this);
this.element.setStyle("overflow","hidden");var a=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;this.$chain.unshift(function(){if(this.hidden){this.hiding=false;
$each(d,function(f,e){d[e]=f;},this);this.element.style.cssText=this.cssText;this.element.setStyle("display","none");if(a){a.setStyle("visibility","visible");
}}this.fireEvent("hide",this.element);this.callChain();}.bind(this));if(a){a.setStyle("visibility","hidden");}this.start(b);}else{this.callChain.delay(10,this);
this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this));
}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve();}}}}catch(c){this.hiding=false;this.element.setStyle("display","none");
this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}return this;},reveal:function(){try{if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.showing=true;
this.hiding=this.hidden=false;var d;this.cssText=this.element.style.cssText;this.element.measure(function(){d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});
}.bind(this));$each(d,function(f,e){d[e]=f;});if($chk(this.options.heightOverride)){d.height=this.options.heightOverride.toInt();}if($chk(this.options.widthOverride)){d.width=this.options.widthOverride.toInt();
}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);d.opacity=1;}var b={height:0,display:this.options.display};$each(d,function(f,e){b[e]=0;
});this.element.setStyles($merge(b,{overflow:"hidden"}));var a=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;if(a){a.setStyle("visibility","hidden");
}this.start(d);this.$chain.unshift(function(){this.element.style.cssText=this.cssText;this.element.setStyle("display",this.options.display);if(!this.hidden){this.showing=false;
}if(a){a.setStyle("visibility","visible");}this.callChain();this.fireEvent("show",this.element);}.bind(this));}else{this.callChain();this.fireEvent("complete",this.element);
this.fireEvent("show",this.element);}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this));}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();
this.reveal();}}}}catch(c){this.element.setStyles({display:this.options.display,visiblity:"visible",opacity:1});this.showing=false;this.callChain.delay(10,this);
this.fireEvent("complete",this.element);this.fireEvent("show",this.element);}return this;},toggle:function(){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.reveal();
}else{this.dissolve();}return this;},cancel:function(){this.parent.apply(this,arguments);this.element.style.cssText=this.cssText;this.hidding=false;this.showing=false;
}});Element.Properties.reveal={set:function(a){var b=this.retrieve("reveal");if(b){b.cancel();}return this.eliminate("reveal").store("reveal:options",a);
},get:function(a){if(a||!this.retrieve("reveal")){if(a||!this.retrieve("reveal:options")){this.set("reveal",a);}this.store("reveal",new Fx.Reveal(this,this.retrieve("reveal:options")));
}return this.retrieve("reveal");}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(a){this.get("reveal",a).reveal();
return this;},dissolve:function(a){this.get("reveal",a).dissolve();return this;},nix:function(){var a=Array.link(arguments,{destroy:Boolean.type,options:Object.type});
this.get("reveal",a.options).dissolve().chain(function(){this[a.destroy?"destroy":"dispose"]();}.bind(this));return this;},wink:function(){var b=Array.link(arguments,{duration:Number.type,options:Object.type});
var a=this.get("reveal",b.options);a.reveal().chain(function(){(function(){a.dissolve();}).delay(b.duration||2000);});}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(b,a){this.element=this.subject=document.id(b);
this.parent(a);var d=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=document.id(this.element.getDocument().body);}var c=this.element;
if(this.options.wheelStops){this.addEvent("start",function(){c.addEvent("mousewheel",d);},true);this.addEvent("complete",function(){c.removeEvent("mousewheel",d);
},true);}},set:function(){var a=Array.flatten(arguments);if(Browser.Engine.gecko){a=[Math.round(a[0]),Math.round(a[1])];}this.element.scrollTo(a[0],a[1]);
},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(c,g){if(!this.check(c,g)){return this;}var e=this.element.getScrollSize(),b=this.element.getScroll(),d={x:c,y:g};
for(var f in d){var a=e[f];if($chk(d[f])){d[f]=($type(d[f])=="number")?d[f]:a;}else{d[f]=b[f];}d[f]+=this.options.offset[f];}return this.parent([b.x,b.y],[d.x,d.y]);
},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");
},toElement:function(b){var a=document.id(b).getPosition(this.element);return this.start(a.x,a.y);},scrollIntoView:function(c,e,d){e=e?$splat(e):["x","y"];
var h={};c=document.id(c);var f=c.getPosition(this.element);var i=c.getSize();var g=this.element.getScroll();var a=this.element.getSize();var b={x:f.x+i.x,y:f.y+i.y};
["x","y"].each(function(j){if(e.contains(j)){if(b[j]>g[j]+a[j]){h[j]=b[j]-a[j];}if(f[j]<g[j]){h[j]=f[j];}}if(h[j]==null){h[j]=g[j];}if(d&&d[j]){h[j]=h[j]+d[j];
}},this);if(h.x!=g.x||h.y!=g.y){this.start(h.x,h.y);}return this;},scrollToCenter:function(c,e,d){e=e?$splat(e):["x","y"];c=$(c);var h={},f=c.getPosition(this.element),i=c.getSize(),g=this.element.getScroll(),a=this.element.getSize(),b={x:f.x+i.x,y:f.y+i.y};
["x","y"].each(function(j){if(e.contains(j)){h[j]=f[j]-(a[j]-i[j])/2;}if(h[j]==null){h[j]=g[j];}if(d&&d[j]){h[j]=h[j]+d[j];}},this);if(h.x!=g.x||h.y!=g.y){this.start(h.x,h.y);
}return this;}});Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",wrapper:false,hideOverflow:true},initialize:function(b,a){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);
if(this.open){this.wrapper.setStyle("height","");}if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=document.id(b);
this.parent(a);var d=this.element.retrieve("wrapper");var c=this.element.getStyles("margin","position","overflow");if(this.options.hideOverflow){c=$extend(c,{overflow:"hidden"});
}if(this.options.wrapper){d=document.id(this.options.wrapper).setStyles(c);}this.wrapper=d||new Element("div",{styles:c}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);
this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";
this.layout="width";this.offset=this.element.offsetWidth;},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);
return this;},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(b,e){if(!this.check(b,e)){return this;
}this[e||this.options.mode]();var d=this.element.getStyle(this.margin).toInt();var c=this.wrapper.getStyle(this.layout).toInt();var a=[[d,c],[0,this.offset]];
var g=[[d,c],[-this.offset,0]];var f;switch(b){case"in":f=a;break;case"out":f=g;break;case"toggle":f=(c==0)?a:g;}return this.parent(f[0],f[1]);},slideIn:function(a){return this.start("in",a);
},slideOut:function(a){return this.start("out",a);},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(a){this[a||this.options.mode]();
this.open=true;return this.set([0,this.offset]);},toggle:function(a){return this.start("toggle",a);}});Element.Properties.slide={set:function(b){var a=this.retrieve("slide");
if(a){a.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},b));},get:function(a){if(a||!this.retrieve("slide")){if(a||!this.retrieve("slide:options")){this.set("slide",a);
}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(d,e){d=d||"toggle";
var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[c?"slideOut":"slideIn"](e);
this.store("slide:flag",!c);a=true;break;default:b.start(d,e);}if(!a){this.eliminate("slide:flag");}return this;}});var SmoothScroll=Fx.SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(b,c){c=c||document;
this.doc=c.getDocument();var d=c.getWindow();this.parent(this.doc,b);this.links=$$(this.options.links||this.doc.links);var a=d.location.href.match(/^[^#]*/)[0]+"#";
this.links.each(function(f){if(f.href.indexOf(a)!=0){return;}var e=f.href.substr(a.length);if(e){this.useLink(f,e);}},this);if(!Browser.Engine.webkit419){this.addEvent("complete",function(){d.location.hash=this.anchor;
},true);}},useLink:function(c,a){var b;c.addEvent("click",function(d){if(b!==false&&!b){b=document.id(a)||this.doc.getElement("a[name="+a+"]");}if(b){d.preventDefault();
this.anchor=a;this.toElement(b).chain(function(){this.fireEvent("scrolledTo",[c,b]);}.bind(this));c.blur();}}.bind(this));}});Fx.Sort=new Class({Extends:Fx.Elements,options:{mode:"vertical"},initialize:function(b,a){this.parent(b,a);
this.elements.each(function(c){if(c.getStyle("position")=="static"){c.setStyle("position","relative");}});this.setDefaultOrder();},setDefaultOrder:function(){this.currentOrder=this.elements.map(function(b,a){return a;
});},sort:function(e){if($type(e)!="array"){return false;}var i=0,a=0,c={},h={},d=this.options.mode=="vertical";var f=this.elements.map(function(m,j){var l=m.getComputedSize({styles:["border","padding","margin"]});
var n;if(d){n={top:i,margin:l["margin-top"],height:l.totalHeight};i+=n.height-l["margin-top"];}else{n={left:a,margin:l["margin-left"],width:l.totalWidth};
a+=n.width;}var k=d?"top":"left";h[j]={};var o=m.getStyle(k).toInt();h[j][k]=o||0;return n;},this);this.set(h);e=e.map(function(j){return j.toInt();});
if(e.length!=this.elements.length){this.currentOrder.each(function(j){if(!e.contains(j)){e.push(j);}});if(e.length>this.elements.length){e.splice(this.elements.length-1,e.length-this.elements.length);
}}var b=i=a=0;e.each(function(l,j){var k={};if(d){k.top=i-f[l].top-b;i+=f[l].height;}else{k.left=a-f[l].left;a+=f[l].width;}b=b+f[l].margin;c[l]=k;},this);
var g={};$A(e).sort().each(function(j){g[j]=c[j];});this.start(g);this.currentOrder=e;return this;},rearrangeDOM:function(a){a=a||this.currentOrder;var b=this.elements[0].getParent();
var c=[];this.elements.setStyle("opacity",0);a.each(function(d){c.push(this.elements[d].inject(b).setStyles({top:0,left:0}));},this);this.elements.setStyle("opacity",1);
this.elements=$$(c);this.setDefaultOrder();return this;},getDefaultOrder:function(){return this.elements.map(function(b,a){return a;});},forward:function(){return this.sort(this.getDefaultOrder());
},backward:function(){return this.sort(this.getDefaultOrder().reverse());},reverse:function(){return this.sort(this.currentOrder.reverse());},sortByElements:function(a){return this.sort(a.map(function(b){return this.elements.indexOf(b);
},this));},swap:function(c,b){if($type(c)=="element"){c=this.elements.indexOf(c);}if($type(b)=="element"){b=this.elements.indexOf(b);}var a=$A(this.currentOrder);
a[this.currentOrder.indexOf(c)]=b;a[this.currentOrder.indexOf(b)]=c;return this.sort(a);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Object.type,element:$defined});
this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=$type(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};
this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);
return this;},start:function(c){if(c.rightClick){return;}if(this.options.preventDefault){c.preventDefault();}if(this.options.stopPropagation){c.stopPropagation();
}this.mouse.start=c.page;this.fireEvent("beforeStart",this.element);var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue;
}if(this.options.style){this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();}else{this.value.now[d]=this.element[this.options.modifiers[d]];
}if(this.options.invert){this.value.now[d]*=-1;}this.mouse.pos[d]=c.page[d]-this.value.now[d];if(a&&a[d]){for(var b=2;b--;b){if($chk(a[d][b])){this.limit[d][b]=$lambda(a[d][b])();
}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});
this.document.addEvent(this.selection,this.bound.eventStop);},check:function(a){if(this.options.preventDefault){a.preventDefault();}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));
if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);
}},drag:function(a){if(this.options.preventDefault){a.preventDefault();}this.mouse.now=a.page;for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue;
}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.options.invert){this.value.now[b]*=-1;}if(this.options.limit&&this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];
}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];}}}if(this.options.grid[b]){this.value.now[b]-=((this.value.now[b]-(this.limit[b][0]||0))%this.options.grid[b]);
}if(this.options.style){this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit);}else{this.element[this.options.modifiers[b]]=this.value.now[b];
}}this.fireEvent("drag",[this.element,a]);},cancel:function(a){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);
if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(a){this.document.removeEvent(this.selection,this.bound.eventStop);
this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(a){this.fireEvent("complete",[this.element,a]);
}}});Element.implement({makeResizable:function(a){var b=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},a));this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);
}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(b,a){this.parent(b,a);
b=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=document.id(this.container.getDocument().body);
}var c=b.getStyles("left","top","position");if(c.left=="auto"||c.top=="auto"){b.setPosition(b.getPosition(b.getOffsetParent()));}if(c.position=="static"){b.setStyle("position","absolute");
}this.addEvent("start",this.checkDroppables,true);this.overed=null;},start:function(a){if(this.container){this.options.limit=this.calculateLimit();}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates();
});}this.parent(a);},calculateLimit:function(){var d=this.element.getOffsetParent(),g=this.container.getCoordinates(d),f={},c={},b={},i={},k={};["top","right","bottom","left"].each(function(o){f[o]=this.container.getStyle("border-"+o).toInt();
b[o]=this.element.getStyle("border-"+o).toInt();c[o]=this.element.getStyle("margin-"+o).toInt();i[o]=this.container.getStyle("margin-"+o).toInt();k[o]=d.getStyle("padding-"+o).toInt();
},this);var e=this.element.offsetWidth+c.left+c.right,n=this.element.offsetHeight+c.top+c.bottom,h=0,j=0,m=g.right-f.right-e,a=g.bottom-f.bottom-n;if(this.options.includeMargins){h+=c.left;
j+=c.top;}else{m+=c.right;a+=c.bottom;}if(this.element.getStyle("position")=="relative"){var l=this.element.getCoordinates(d);l.left-=this.element.getStyle("left").toInt();
l.top-=this.element.getStyle("top").toInt();h+=f.left-l.left;j+=f.top-l.top;m+=c.left-l.left;a+=c.top-l.top;if(this.container!=d){h+=i.left+k.left;j+=(Browser.Engine.trident4?0:i.top)+k.top;
}}else{h-=c.left;j-=c.top;if(this.container==d){m-=f.left;a-=f.top;}else{h+=g.left+f.left;j+=g.top+f.top;}}return{x:[h,m],y:[j,a]};},checkAgainst:function(c,b){c=(this.positions)?this.positions[b]:c.getCoordinates();
var a=this.mouse.now;return(a.x>c.left&&a.x<c.right&&a.y<c.bottom&&a.y>c.top);},checkDroppables:function(){var a=this.droppables.filter(this.checkAgainst,this).getLast();
if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);
if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables();}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);
this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);this.store("dragger",b);return b;}});
var Slider=new Class({Implements:[Events,Options],Binds:["clickedElement","draggedKnob","scrolledElement"],options:{onTick:function(a){if(this.options.snap){a=this.toPosition(this.step);
}this.knob.setStyle(this.property,a);},initialStep:0,snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(f,a,e){this.setOptions(e);
this.element=document.id(f);this.knob=document.id(a);this.previousChange=this.previousEnd=this.step=-1;var g,b={},d={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";
this.property="top";g="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";g="offsetWidth";}this.full=this.element.measure(function(){this.half=this.knob[g]/2;
return this.element[g]-this.knob[g]+(this.options.offset*2);}.bind(this));this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;
this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);
this.knob.setStyle("position","relative").setStyle(this.property,this.options.initialStep?this.toPosition(this.options.initialStep):-this.options.offset);
d[this.axis]=this.property;b[this.axis]=[-this.options.offset,this.full-this.options.offset];var c={snap:0,limit:b,modifiers:d,onDrag:this.draggedKnob,onStart:this.draggedKnob,onBeforeStart:(function(){this.isDragging=true;
}).bind(this),onCancel:function(){this.isDragging=false;}.bind(this),onComplete:function(){this.isDragging=false;this.draggedKnob();this.end();}.bind(this)};
if(this.options.snap){c.grid=Math.ceil(this.stepWidth);c.limit[this.axis][1]=this.full;}this.drag=new Drag(this.knob,c);this.attach();},attach:function(){this.element.addEvent("mousedown",this.clickedElement);
if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement);}this.drag.attach();return this;},detach:function(){this.element.removeEvent("mousedown",this.clickedElement);
this.element.removeEvent("mousewheel",this.scrolledElement);this.drag.detach();return this;},set:function(a){if(!((this.range>0)^(a<this.min))){a=this.min;
}if(!((this.range>0)^(a>this.max))){a=this.max;}this.step=Math.round(a);this.checkStep();this.fireEvent("tick",this.toPosition(this.step));this.end();return this;
},clickedElement:function(c){if(this.isDragging||c.target==this.knob){return;}var b=this.range<0?-1:1;var a=c.page[this.axis]-this.element.getPosition()[this.axis]-this.half;
a=a.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();this.fireEvent("tick",a);
this.end();},scrolledElement:function(a){var b=(this.options.mode=="horizontal")?(a.wheel<0):(a.wheel>0);this.set(b?this.step-this.stepSize:this.step+this.stepSize);
a.stop();},draggedKnob:function(){var b=this.range<0?-1:1;var a=this.drag.value.now[this.axis];a=a.limit(-this.options.offset,this.full-this.options.offset);
this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;
this.fireEvent("change",this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"");
}},toStep:function(a){var b=(a+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(b-=b%this.stepSize):b;},toPosition:function(a){return(this.full*Math.abs(this.min-a))/(this.steps*this.stepSize)-this.options.offset;
}});var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(a,b){this.setOptions(b);
this.elements=[];this.lists=[];this.idle=true;this.addLists($$(document.id(a)||a));if(!this.options.clone){this.options.revert=false;}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert));
}},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(a){this.elements.push(a);
var b=a.retrieve("sortables:start",this.start.bindWithEvent(this,a));(this.options.handle?a.getElement(this.options.handle)||a:a).addEvent("mousedown",b);
},this);return this;},addLists:function(){Array.flatten(arguments).each(function(a){this.lists.push(a);this.addItems(a.getChildren());},this);return this;
},removeItems:function(){return $$(Array.flatten(arguments).map(function(a){this.elements.erase(a);var b=a.retrieve("sortables:start");(this.options.handle?a.getElement(this.options.handle)||a:a).removeEvent("mousedown",b);
return a;},this));},removeLists:function(){return $$(Array.flatten(arguments).map(function(a){this.lists.erase(a);this.removeItems(a.getChildren());return a;
},this));},getClone:function(b,a){if(!this.options.clone){return new Element("div").inject(document.body);}if($type(this.options.clone)=="function"){return this.options.clone.call(this,b,a,this.list);
}var c=a.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:a.getStyle("width")});if(c.get("html").test("radio")){c.getElements("input[type=radio]").each(function(d,e){d.set("name","clone_"+e);
});}return c.inject(this.list).setPosition(a.getPosition(a.getOffsetParent()));},getDroppables:function(){var a=this.list.getChildren();if(!this.options.constrain){a=this.lists.concat(a).erase(this.list);
}return a.erase(this.clone).erase(this.element);},insert:function(c,b){var a="inside";if(this.lists.contains(b)){this.list=b;this.drag.droppables=this.getDroppables();
}else{a=this.element.getAllPrevious().contains(b)?"before":"after";}this.element.inject(b,a);this.fireEvent("sort",[this.element,this.clone]);},start:function(b,a){if(!this.idle){return;
}this.idle=false;this.element=a;this.opacity=a.get("opacity");this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){b.stop();
this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone]);}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});
this.clone.inject(this.element,"before");this.drag.start(b);},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var a=this.element.getStyles("width","height");
var b=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:b.top,left:b.left,width:a.width,height:a.height,opacity:0.25}).chain(this.reset.bind(this));
}else{this.reset();}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent("complete",this.element);},serialize:function(){var c=Array.link(arguments,{modifier:Function.type,index:$defined});
var b=this.lists.map(function(d){return d.getChildren().map(c.modifier||function(e){return e.get("id");},this);},this);var a=c.index;if(this.lists.length==1){a=0;
}return $chk(a)&&a>=0&&a<this.lists.length?b[a]:b;}});Request.JSONP=new Class({Implements:[Chain,Events,Options,Log],options:{url:"",data:{},retries:0,timeout:0,link:"ignore",callbackKey:"callback",injectScript:document.head},initialize:function(a){this.setOptions(a);
if(this.options.log){this.enableLog();}this.running=false;this.requests=0;this.triesRemaining=[];},check:function(){if(!this.running){return true;}switch(this.options.link){case"cancel":this.cancel();
return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(c){if(!$chk(arguments[1])&&!this.check(c)){return this;
}var e=$type(c),a=this.options,b=$chk(arguments[1])?arguments[1]:this.requests++;if(e=="string"||e=="element"){c={data:c};}c=$extend({data:a.data,url:a.url},c);
if(!$chk(this.triesRemaining[b])){this.triesRemaining[b]=this.options.retries;}var d=this.triesRemaining[b];(function(){var f=this.getScript(c);this.log("JSONP retrieving script with url: "+f.get("src"));
this.fireEvent("request",f);this.running=true;(function(){if(d){this.triesRemaining[b]=d-1;if(f){f.destroy();this.send(c,b).fireEvent("retry",this.triesRemaining[b]);
}}else{if(f&&this.options.timeout){f.destroy();this.cancel().fireEvent("failure");}}}).delay(this.options.timeout,this);}).delay(Browser.Engine.trident?50:0,this);
return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.fireEvent("cancel");return this;},getScript:function(c){var b=Request.JSONP.counter,d;
Request.JSONP.counter++;switch($type(c.data)){case"element":d=document.id(c.data).toQueryString();break;case"object":case"hash":d=Hash.toQueryString(c.data);
}var e=c.url+(c.url.test("\\?")?"&":"?")+(c.callbackKey||this.options.callbackKey)+"=Request.JSONP.request_map.request_"+b+(d?"&"+d:"");if(e.length>2083){this.log("JSONP "+e+" will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs");
}var a=new Element("script",{type:"text/javascript",src:e});Request.JSONP.request_map["request_"+b]=function(){this.success(arguments,a);}.bind(this);return a.inject(this.options.injectScript);
},success:function(b,a){if(a){a.destroy();}this.running=false;this.log("JSONP successfully retrieved: ",b);this.fireEvent("complete",b).fireEvent("success",b).callChain();
}});Request.JSONP.counter=0;Request.JSONP.request_map={};Request.Queue=new Class({Implements:[Options,Events],Binds:["attach","request","complete","cancel","success","failure","exception"],options:{stopOnFailure:true,autoAdvance:true,concurrent:1,requests:{}},initialize:function(a){if(a){var b=a.requests;
delete a.requests;}this.setOptions(a);this.requests=new Hash;this.queue=[];this.reqBinders={};if(b){this.addRequests(b);}},addRequest:function(a,b){this.requests.set(a,b);
this.attach(a,b);return this;},addRequests:function(a){$each(a,function(c,b){this.addRequest(b,c);},this);return this;},getName:function(a){return this.requests.keyOf(a);
},attach:function(a,b){if(b._groupSend){return this;}["request","complete","cancel","success","failure","exception"].each(function(c){if(!this.reqBinders[a]){this.reqBinders[a]={};
}this.reqBinders[a][c]=function(){this["on"+c.capitalize()].apply(this,[a,b].extend(arguments));}.bind(this);b.addEvent(c,this.reqBinders[a][c]);},this);
b._groupSend=b.send;b.send=function(c){this.send(a,c);return b;}.bind(this);return this;},removeRequest:function(b){var a=$type(b)=="object"?this.getName(b):b;
if(!a&&$type(a)!="string"){return this;}b=this.requests.get(a);if(!b){return this;}["request","complete","cancel","success","failure","exception"].each(function(c){b.removeEvent(c,this.reqBinders[a][c]);
},this);b.send=b._groupSend;delete b._groupSend;return this;},getRunning:function(){return this.requests.filter(function(a){return a.running;});},isRunning:function(){return !!(this.getRunning().getKeys().length);
},send:function(b,a){var c=function(){this.requests.get(b)._groupSend(a);this.queue.erase(c);}.bind(this);c.name=b;if(this.getRunning().getKeys().length>=this.options.concurrent||(this.error&&this.options.stopOnFailure)){this.queue.push(c);
}else{c();}return this;},hasNext:function(a){return(!a)?!!this.queue.length:!!this.queue.filter(function(b){return b.name==a;}).length;},resume:function(){this.error=false;
(this.options.concurrent-this.getRunning().getKeys().length).times(this.runNext,this);return this;},runNext:function(a){if(!this.queue.length){return this;
}if(!a){this.queue[0]();}else{var b;this.queue.each(function(c){if(!b&&c.name==a){b=true;c();}});}return this;},runAll:function(){this.queue.each(function(a){a();
});return this;},clear:function(a){if(!a){this.queue.empty();}else{this.queue=this.queue.map(function(b){if(b.name!=a){return b;}else{return false;}}).filter(function(b){return b;
});}return this;},cancel:function(a){this.requests.get(a).cancel();return this;},onRequest:function(){this.fireEvent("request",arguments);},onComplete:function(){this.fireEvent("complete",arguments);
if(!this.queue.length){this.fireEvent("end");}},onCancel:function(){if(this.options.autoAdvance&&!this.error){this.runNext();}this.fireEvent("cancel",arguments);
},onSuccess:function(){if(this.options.autoAdvance&&!this.error){this.runNext();}this.fireEvent("success",arguments);},onFailure:function(){this.error=true;
if(!this.options.stopOnFailure&&this.options.autoAdvance){this.runNext();}this.fireEvent("failure",arguments);},onException:function(){this.error=true;
if(!this.options.stopOnFailure&&this.options.autoAdvance){this.runNext();}this.fireEvent("exception",arguments);}});Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(b){var a=function(){if(!this.running){this.send({data:b});
}};this.timer=a.delay(this.options.initialDelay,this);this.lastDelay=this.options.initialDelay;this.completeCheck=function(c){$clear(this.timer);this.lastDelay=(c)?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit);
this.timer=a.delay(this.lastDelay,this);};return this.addEvent("complete",this.completeCheck);},stopTimer:function(){$clear(this.timer);return this.removeEvent("complete",this.completeCheck);
}});var Asset={javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);if(d.onLoad){d.onload=d.onLoad;}var b=new Element("script",{src:f,type:"text/javascript"});
var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;b.addEvents({load:e,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){e();
}}}).set(d);if(Browser.Engine.webkit419){var c=(function(){if(!$try(a)){return;}$clear(c);e();}).periodical(50);}return b.inject(g.head);},css:function(b,a){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head);
},image:function(c,b){b=$merge({onload:$empty,onabort:$empty,onerror:$empty},b);var d=new Image();var a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var g="on"+e;
var f=e.capitalize();if(b["on"+f]){b[g]=b["on"+f];}var h=b[g];delete b[g];d[g]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;
}d=d.onload=d.onabort=d.onerror=null;h.delay(1,a,a);a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(d,c){c=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},c);
d=$splat(d);var a=[];var b=0;return new Elements(d.map(function(e){return Asset.image(e,$extend(c.properties,{onload:function(){c.onProgress.call(this,b,d.indexOf(e));
b++;if(b==d.length){c.onComplete();}},onerror:function(){c.onError.call(this,b,d.indexOf(e));b++;if(b==d.length){c.onComplete();}}}));}));}};var Color=new Native({initialize:function(b,c){if(arguments.length>=3){c="rgb";
b=Array.slice(arguments,0,3);}else{if(typeof b=="string"){if(b.match(/rgb/)){b=b.rgbToHex().hexToRgb(true);}else{if(b.match(/hsb/)){b=b.hsbToRgb();}else{b=b.hexToRgb(true);
}}}}c=c||"rgb";switch(c){case"hsb":var a=b;b=b.hsbToRgb();b.hsb=a;break;case"hex":b=b.hexToRgb(true);break;}b.rgb=b.slice(0,3);b.hsb=b.hsb||b.rgbToHsb();
b.hex=b.rgbToHex();return $extend(b,this);}});Color.implement({mix:function(){var a=Array.slice(arguments);var c=($type(a.getLast())=="number")?a.pop():50;
var b=this.slice();a.each(function(d){d=new Color(d);for(var e=0;e<3;e++){b[e]=Math.round((b[e]/100*(100-c))+(d[e]/100*c));}});return new Color(b,"rgb");
},invert:function(){return new Color(this.map(function(a){return 255-a;}));},setHue:function(a){return new Color([a,this.hsb[1],this.hsb[2]],"hsb");},setSaturation:function(a){return new Color([this.hsb[0],a,this.hsb[2]],"hsb");
},setBrightness:function(a){return new Color([this.hsb[0],this.hsb[1],a],"hsb");}});var $RGB=function(d,c,a){return new Color([d,c,a],"rgb");};var $HSB=function(d,c,a){return new Color([d,c,a],"hsb");
};var $HEX=function(a){return new Color(a,"hex");};Array.implement({rgbToHsb:function(){var b=this[0],c=this[1],j=this[2],g=0;var i=Math.max(b,c,j),e=Math.min(b,c,j);
var k=i-e;var h=i/255,f=(i!=0)?k/i:0;if(f!=0){var d=(i-b)/k;var a=(i-c)/k;var l=(i-j)/k;if(b==i){g=l-a;}else{if(c==i){g=2+d-l;}else{g=4+a-d;}}g/=6;if(g<0){g++;
}}return[Math.round(g*360),Math.round(f*100),Math.round(h*100)];},hsbToRgb:function(){var c=Math.round(this[2]/100*255);if(this[1]==0){return[c,c,c];}else{var a=this[0]%360;
var e=a%60;var g=Math.round((this[2]*(100-this[1]))/10000*255);var d=Math.round((this[2]*(6000-this[1]*e))/600000*255);var b=Math.round((this[2]*(6000-this[1]*(60-e)))/600000*255);
switch(Math.floor(a/60)){case 0:return[c,b,g];case 1:return[d,c,g];case 2:return[g,c,b];case 3:return[g,d,c];case 4:return[b,g,c];case 5:return[c,g,d];
}}return false;}});String.implement({rgbToHsb:function(){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHsb():null;},hsbToRgb:function(){var a=this.match(/\d{1,3}/g);
return(a)?a.hsbToRgb():null;}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={};},addEvent:function(b,a){this.checker[b]=this.checker[b]||{};
this.events[b]=this.events[b]||[];if(this.events[b].contains(a)){return false;}else{this.events[b].push(a);}this.instances.each(function(c,d){c.addEvent(b,this.check.bind(this,[b,c,d]));
},this);return this;},check:function(c,a,b){this.checker[c][b]=true;var d=this.instances.every(function(f,e){return this.checker[c][e]||false;},this);if(!d){return;
}this.checker[c]={};this.events[c].each(function(e){e.call(this,this.instances,a);},this);}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(b,a){this.parent(b,a);
this.load();},save:function(){var a=JSON.encode(this.hash);if(!a||a.length>4096){return false;}if(a=="{}"){this.dispose();}else{this.write(a);}return true;
},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this;}});Hash.each(Hash.prototype,function(b,a){if(typeof b=="function"){Hash.Cookie.implement(a,function(){var c=b.apply(this.hash,arguments);
if(this.options.autoSave){this.save();}return c;});}});var IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:(Browser.Engine.trident4||(Browser.Engine.gecko&&!Browser.Engine.gecko19&&Browser.Platform.mac))},property:"IframeShim",initialize:function(b,a){this.element=document.id(b);
if(this.occlude()){return this.occluded;}this.setOptions(a);this.makeShim();return this;},makeShim:function(){if(this.options.browsers){var c=this.element.getStyle("zIndex").toInt();
if(!c){c=1;var b=this.element.getStyle("position");if(b=="static"||!b){this.element.setStyle("position","relative");}this.element.setStyle("zIndex",c);
}c=($chk(this.options.zIndex)&&c>this.options.zIndex)?this.options.zIndex:c-1;if(c<0){c=1;}this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:c,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this);
var a=(function(){this.shim.inject(this.element,"after");this[this.options.display?"show":"hide"]();this.fireEvent("inject");}).bind(this);if(!IframeShim.ready){window.addEvent("load",a);
}else{a();}}else{this.position=this.hide=this.show=this.dispose=$lambda(this);}},position:function(){if(!IframeShim.ready||!this.shim){return this;}var a=this.element.measure(function(){return this.getSize();
});if(this.options.margin!=undefined){a.x=a.x-(this.options.margin*2);a.y=a.y-(this.options.margin*2);this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin;
}this.shim.set({width:a.x,height:a.y}).position({relativeTo:this.element,offset:this.options.offset});return this;},hide:function(){if(this.shim){this.shim.setStyle("display","none");
}return this;},show:function(){if(this.shim){this.shim.setStyle("display","block");}return this.position();},dispose:function(){if(this.shim){this.shim.dispose();
}return this;},destroy:function(){if(this.shim){this.shim.destroy();}return this;}});window.addEvent("load",function(){IframeShim.ready=true;});var HtmlTable=new Class({Implements:[Options,Events,Class.Occlude],options:{properties:{cellpadding:0,cellspacing:0,border:0},rows:[],headers:[],footers:[]},property:"HtmlTable",initialize:function(){var a=Array.link(arguments,{options:Object.type,table:Element.type});
this.setOptions(a.options);this.element=a.table||new Element("table",this.options.properties);if(this.occlude()){return this.occluded;}this.build();},build:function(){this.element.store("HtmlTable",this);
this.body=document.id(this.element.tBodies[0])||new Element("tbody").inject(this.element);$$(this.body.rows);if(this.options.headers.length){this.setHeaders(this.options.headers);
}else{this.thead=document.id(this.element.tHead);}if(this.thead){this.head=document.id(this.thead.rows[0]);}if(this.options.footers.length){this.setFooters(this.options.footers);
}this.tfoot=document.id(this.element.tFoot);if(this.tfoot){this.foot=document.id(this.thead.rows[0]);}this.options.rows.each(function(a){this.push(a);},this);
["adopt","inject","wraps","grab","replaces","dispose"].each(function(a){this[a]=this.element[a].bind(this.element);},this);},toElement:function(){return this.element;
},empty:function(){this.body.empty();return this;},set:function(d,a){var c=(d=="headers")?"tHead":"tFoot";this[c.toLowerCase()]=(document.id(this.element[c])||new Element(c.toLowerCase()).inject(this.element,"top")).empty();
var b=this.push(a,{},this[c.toLowerCase()],d=="headers"?"th":"td");if(d=="headers"){this.head=document.id(this.thead.rows[0]);}else{this.foot=document.id(this.thead.rows[0]);
}return b;},setHeaders:function(a){this.set("headers",a);return this;},setFooters:function(a){this.set("footers",a);return this;},push:function(e,b,d,a){var c=e.map(function(h){var i=new Element(a||"td",h.properties),g=h.content||h||"",f=document.id(g);
if($type(g)!="string"&&f){i.adopt(f);}else{i.set("html",g);}return i;});return{tr:new Element("tr",b).inject(d||this.body).adopt(c),tds:c};}});HtmlTable=Class.refactor(HtmlTable,{options:{classZebra:"table-tr-odd",zebra:true},initialize:function(){this.previous.apply(this,arguments);
if(this.occluded){return this.occluded;}if(this.options.zebra){this.updateZebras();}},updateZebras:function(){Array.each(this.body.rows,this.zebra,this);
},zebra:function(b,a){return b[((a%2)?"remove":"add")+"Class"](this.options.classZebra);},push:function(){var a=this.previous.apply(this,arguments);if(this.options.zebra){this.updateZebras();
}return a;}});HtmlTable=Class.refactor(HtmlTable,{options:{sortIndex:0,sortReverse:false,parsers:[],defaultParser:"string",classSortable:"table-sortable",classHeadSort:"table-th-sort",classHeadSortRev:"table-th-sort-rev",classNoSort:"table-th-nosort",classGroupHead:"table-tr-group-head",classGroup:"table-tr-group",classCellSort:"table-td-sort",classSortSpan:"table-th-sort-span",sortable:false},initialize:function(){this.previous.apply(this,arguments);
if(this.occluded){return this.occluded;}this.sorted={index:null,dir:1};this.bound={headClick:this.headClick.bind(this)};this.sortSpans=new Elements();if(this.options.sortable){this.enableSort();
if(this.options.sortIndex!=null){this.sort(this.options.sortIndex,this.options.sortReverse);}}},attachSorts:function(a){this.element.removeEvents("click:relay(th)");
this.element[$pick(a,true)?"addEvent":"removeEvent"]("click:relay(th)",this.bound.headClick);},setHeaders:function(){this.previous.apply(this,arguments);
if(this.sortEnabled){this.detectParsers();}},detectParsers:function(c){if(!this.head){return;}var a=this.options.parsers,b=this.body.rows;this.parsers=$$(this.head.cells).map(function(d,e){if(!c&&(d.hasClass(this.options.classNoSort)||d.retrieve("htmltable-parser"))){return d.retrieve("htmltable-parser");
}var f=new Element("div");$each(d.childNodes,function(j){f.adopt(j);});f.inject(d);var h=new Element("span",{html:"&#160;","class":this.options.classSortSpan}).inject(f,"top");
this.sortSpans.push(h);var i=a[e],g;switch($type(i)){case"function":i={convert:i};g=true;break;case"string":i=i;g=true;break;}if(!g){HtmlTable.Parsers.some(function(n){var l=n.match;
if(!l){return false;}for(var m=0,k=b.length;m<k;m++){var o=$(b[m].cells[e]).get("html").clean();if(o&&l.test(o)){i=n;return true;}}});}if(!i){i=this.options.defaultParser;
}d.store("htmltable-parser",i);return i;},this);},headClick:function(c,b){if(!this.head||b.hasClass(this.options.classNoSort)){return;}var a=Array.indexOf(this.head.cells,b);
this.sort(a);return false;},sort:function(f,h,m){if(!this.head){return;}m=!!(m);var l=this.options.classCellSort;var o=this.options.classGroup,t=this.options.classGroupHead;
if(!m){if(f!=null){if(this.sorted.index==f){this.sorted.reverse=!(this.sorted.reverse);}else{if(this.sorted.index!=null){this.sorted.reverse=false;this.head.cells[this.sorted.index].removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
}else{this.sorted.reverse=true;}this.sorted.index=f;}}else{f=this.sorted.index;}if(h!=null){this.sorted.reverse=h;}var d=document.id(this.head.cells[f]);
if(d){d.addClass(this.options.classHeadSort);if(this.sorted.reverse){d.addClass(this.options.classHeadSortRev);}else{d.removeClass(this.options.classHeadSortRev);
}}this.body.getElements("td").removeClass(this.options.classCellSort);}var c=this.parsers[f];if($type(c)=="string"){c=HtmlTable.Parsers.get(c);}if(!c){return;
}if(!Browser.Engine.trident){var b=this.body.getParent();this.body.dispose();}var s=Array.map(this.body.rows,function(v,j){var u=c.convert.call(document.id(v.cells[f]));
return{position:j,value:u,toString:function(){return u.toString();}};},this);s.reverse(true);s.sort(function(j,i){if(j.value===i.value){return 0;}return j.value>i.value?1:-1;
});if(!this.sorted.reverse){s.reverse(true);}var p=s.length,k=this.body;var n,r,a,g;while(p){var q=s[--p];r=q.position;var e=k.rows[r];if(e.disabled){continue;
}if(!m){if(g===q.value){e.removeClass(t).addClass(o);}else{g=q.value;e.removeClass(o).addClass(t);}if(this.zebra){this.zebra(e,p);}e.cells[f].addClass(l);
}k.appendChild(e);for(n=0;n<p;n++){if(s[n].position>r){s[n].position--;}}}s=null;if(b){b.grab(k);}return this.fireEvent("sort",[k,f]);},reSort:function(){if(this.sortEnabled){this.sort.call(this,this.sorted.index,this.sorted.reverse);
}return this;},enableSort:function(){this.element.addClass(this.options.classSortable);this.attachSorts(true);this.detectParsers();this.sortEnabled=true;
return this;},disableSort:function(){this.element.removeClass(this.options.classSortable);this.attachSorts(false);this.sortSpans.each(function(a){a.destroy();
});this.sortSpans.empty();this.sortEnabled=false;return this;}});HtmlTable.Parsers=new Hash({date:{match:/^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,convert:function(){return Date.parse(this.get("text")).format("db");
},type:"date"},"input-checked":{match:/ type="(radio|checkbox)" /,convert:function(){return this.getElement("input").checked;}},"input-value":{match:/<input/,convert:function(){return this.getElement("input").value;
}},number:{match:/^\d+[^\d.,]*$/,convert:function(){return this.get("text").toInt();},number:true},numberLax:{match:/^[^\d]+\d+$/,convert:function(){return this.get("text").replace(/[^-?^0-9]/,"").toInt();
},number:true},"float":{match:/^[\d]+\.[\d]+/,convert:function(){return this.get("text").replace(/[^-?^\d.]/,"").toFloat();},number:true},floatLax:{match:/^[^\d]+[\d]+\.[\d]+$/,convert:function(){return this.get("text").replace(/[^-?^\d.]/,"");
},number:true},string:{match:null,convert:function(){return this.get("text");}},title:{match:null,convert:function(){return this.title;}}});HtmlTable=Class.refactor(HtmlTable,{options:{useKeyboard:true,classRowSelected:"table-tr-selected",classRowHovered:"table-tr-hovered",classSelectable:"table-selectable",allowMultiSelect:true,selectable:false},initialize:function(){this.previous.apply(this,arguments);
if(this.occluded){return this.occluded;}this.selectedRows=new Elements();this.bound={mouseleave:this.mouseleave.bind(this),focusRow:this.focusRow.bind(this)};
if(this.options.selectable){this.enableSelect();}},enableSelect:function(){this.selectEnabled=true;this.attachSelects();this.element.addClass(this.options.classSelectable);
},disableSelect:function(){this.selectEnabled=false;this.attach(false);this.element.removeClass(this.options.classSelectable);},attachSelects:function(a){a=$pick(a,true);
var b=a?"addEvents":"removeEvents";this.element[b]({mouseleave:this.bound.mouseleave});this.body[b]({"click:relay(tr)":this.bound.focusRow});if(this.options.useKeyboard||this.keyboard){if(!this.keyboard){this.keyboard=new Keyboard({events:{down:function(c){c.preventDefault();
this.shiftFocus(1);}.bind(this),up:function(c){c.preventDefault();this.shiftFocus(-1);}.bind(this),enter:function(c){c.preventDefault();if(this.hover){this.focusRow(this.hover);
}}.bind(this)},active:true});}this.keyboard[a?"activate":"deactivate"]();}this.updateSelects();},mouseleave:function(){if(this.hover){this.leaveRow(this.hover);
}},focus:function(){if(this.keyboard){this.keyboard.activate();}},blur:function(){if(this.keyboard){this.keyboard.deactivate();}},push:function(){var a=this.previous.apply(this,arguments);
this.updateSelects();return a;},updateSelects:function(){Array.each(this.body.rows,function(a){var b=a.retrieve("binders");if((b&&this.selectEnabled)||(!b&&!this.selectEnabled)){return;
}if(!b){b={mouseenter:this.enterRow.bind(this,[a]),mouseleave:this.leaveRow.bind(this,[a])};a.store("binders",b).addEvents(b);}else{a.removeEvents(b);}},this);
},enterRow:function(a){if(this.hover){this.hover=this.leaveRow(this.hover);}this.hover=a.addClass(this.options.classRowHovered);},shiftFocus:function(a){if(!this.hover){return this.enterRow(this.body.rows[0]);
}var b=Array.indexOf(this.body.rows,this.hover)+a;if(b<0){b=0;}if(b>=this.body.rows.length){b=this.body.rows.length-1;}if(this.hover==this.body.rows[b]){return this;
}this.enterRow(this.body.rows[b]);},leaveRow:function(a){a.removeClass(this.options.classRowHovered);},focusRow:function(){var b=arguments[1]||arguments[0];
if(!this.body.getChildren().contains(b)){return;}var a=function(c){this.selectedRows.erase(c);c.removeClass(this.options.classRowSelected);this.fireEvent("rowUnfocus",[c,this.selectedRows]);
}.bind(this);if(!this.options.allowMultiSelect){this.selectedRows.each(a);}if(!this.selectedRows.contains(b)){this.selectedRows.push(b);b.addClass(this.options.classRowSelected);
this.fireEvent("rowFocus",[b,this.selectedRows]);}else{a(b);}return false;},selectAll:function(a){a=$pick(a,true);if(!this.options.allowMultiSelect&&a){return;
}if(!a){this.selectedRows.removeClass(this.options.classRowSelected).empty();}else{this.selectedRows.combine(this.body.rows).addClass(this.options.classRowSelected);
}return this;},selectNone:function(){return this.selectAll(false);}});(function(){var a=this.Keyboard=new Class({Extends:Events,Implements:[Options,Log],options:{defaultEventType:"keydown",active:false,events:{},nonParsedEvents:["activate","deactivate","onactivate","ondeactivate","changed","onchanged"]},initialize:function(f){this.setOptions(f);
this.setup();},setup:function(){this.addEvents(this.options.events);if(a.manager&&!this.manager){a.manager.manage(this);}if(this.options.active){this.activate();
}},handle:function(h,g){if(h.preventKeyboardPropagation){return;}var f=!!this.manager;if(f&&this.activeKB){this.activeKB.handle(h,g);if(h.preventKeyboardPropagation){return;
}}this.fireEvent(g,h);if(!f&&this.activeKB){this.activeKB.handle(h,g);}},addEvent:function(h,g,f){return this.parent(a.parse(h,this.options.defaultEventType,this.options.nonParsedEvents),g,f);
},removeEvent:function(g,f){return this.parent(a.parse(g,this.options.defaultEventType,this.options.nonParsedEvents),f);},toggleActive:function(){return this[this.active?"deactivate":"activate"]();
},activate:function(f){if(f){if(f!=this.activeKB){this.previous=this.activeKB;}this.activeKB=f.fireEvent("activate");a.manager.fireEvent("changed");}else{if(this.manager){this.manager.activate(this);
}}return this;},deactivate:function(f){if(f){if(f===this.activeKB){this.activeKB=null;f.fireEvent("deactivate");a.manager.fireEvent("changed");}}else{if(this.manager){this.manager.deactivate(this);
}}return this;},relenquish:function(){if(this.previous){this.activate(this.previous);}},manage:function(f){if(f.manager){f.manager.drop(f);}this.instances.push(f);
f.manager=this;if(!this.activeKB){this.activate(f);}else{this._disable(f);}},_disable:function(f){if(this.activeKB==f){this.activeKB=null;}},drop:function(f){this._disable(f);
this.instances.erase(f);},instances:[],trace:function(){a.trace(this);},each:function(f){a.each(this,f);}});var b={};var c=["shift","control","alt","meta"];
var e=/^(?:shift|control|ctrl|alt|meta)$/;a.parse=function(h,g,k){if(k&&k.contains(h.toLowerCase())){return h;}h=h.toLowerCase().replace(/^(keyup|keydown):/,function(m,l){g=l;
return"";});if(!b[h]){var f,j={};h.split("+").each(function(l){if(e.test(l)){j[l]=true;}else{f=l;}});j.control=j.control||j.ctrl;var i=[];c.each(function(l){if(j[l]){i.push(l);
}});if(f){i.push(f);}b[h]=i.join("+");}return g+":"+b[h];};a.each=function(f,g){var h=f||a.manager;while(h){g.run(h);h=h.activeKB;}};a.stop=function(f){f.preventKeyboardPropagation=true;
};a.manager=new a({active:true});a.trace=function(f){f=f||a.manager;f.enableLog();f.log("the following items have focus: ");a.each(f,function(g){f.log(document.id(g.widget)||g.wiget||g);
});};var d=function(g){var f=[];c.each(function(h){if(g[h]){f.push(h);}});if(!e.test(g.key)){f.push(g.key);}a.manager.handle(g,g.type+":"+f.join("+"));
};document.addEvents({keyup:d,keydown:d});Event.Keys.extend({shift:16,control:17,alt:18,capslock:20,pageup:33,pagedown:34,end:35,home:36,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":Browser.Engine.Gecko?109:189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222});
})();Keyboard.prototype.options.nonParsedEvents.combine(["rebound","onrebound"]);Keyboard.implement({addShortcut:function(b,a){this.shortcuts=this.shortcuts||[];
this.shortcutIndex=this.shortcutIndex||{};a.getKeyboard=$lambda(this);a.name=b;this.shortcutIndex[b]=a;this.shortcuts.push(a);if(a.keys){this.addEvent(a.keys,a.handler);
}return this;},addShortcuts:function(b){for(var a in b){this.addShortcut(a,b[a]);}return this;},getShortcuts:function(){return this.shortcuts||[];},getShortcut:function(a){return(this.shortcutIndex||{})[a];
}});Keyboard.rebind=function(b,a){$splat(a).each(function(c){c.getKeyboard().removeEvent(c.keys,c.handler);c.getKeyboard().addEvent(b,c.handler);c.keys=b;
c.getKeyboard().fireEvent("rebound");});};Keyboard.getActiveShortcuts=function(b){var a=[],c=[];Keyboard.each(b,[].push.bind(a));a.each(function(d){c.extend(d.getShortcuts());
});return c;};Keyboard.getShortcut=function(c,b,d){d=d||{};var a=d.many?[]:null,e=d.many?function(g){var f=g.getShortcut(c);if(f){a.push(f);}}:function(f){if(!a){a=f.getShortcut(c);
}};Keyboard.each(b,e);return a;};Keyboard.getShortcuts=function(b,a){return Keyboard.getShortcut(b,a,{many:true});};var Mask=new Class({Implements:[Options,Events],Binds:["position"],options:{style:{},"class":"mask",maskMargins:false,useIframeShim:true,iframeShimOptions:{}},initialize:function(b,a){this.target=document.id(b)||document.id(document.body);
this.target.store("Mask",this);this.setOptions(a);this.render();this.inject();},render:function(){this.element=new Element("div",{"class":this.options["class"],id:this.options.id||"mask-"+$time(),styles:$merge(this.options.style,{display:"none"}),events:{click:function(){this.fireEvent("click");
if(this.options.hideOnClick){this.hide();}}.bind(this)}});this.hidden=true;},toElement:function(){return this.element;},inject:function(b,a){a=a||this.options.inject?this.options.inject.where:""||this.target==document.body?"inside":"after";
b=b||this.options.inject?this.options.inject.target:""||this.target;this.element.inject(b,a);if(this.options.useIframeShim){this.shim=new IframeShim(this.element,this.options.iframeShimOptions);
this.addEvents({show:this.shim.show.bind(this.shim),hide:this.shim.hide.bind(this.shim),destroy:this.shim.destroy.bind(this.shim)});}},position:function(){this.resize(this.options.width,this.options.height);
this.element.position({relativeTo:this.target,position:"topLeft",ignoreMargins:!this.options.maskMargins,ignoreScroll:this.target==document.body});return this;
},resize:function(a,e){var b={styles:["padding","border"]};if(this.options.maskMargins){b.styles.push("margin");}var d=this.target.getComputedSize(b);if(this.target==document.body){var c=window.getSize();
if(d.totalHeight<c.y){d.totalHeight=c.y;}if(d.totalWidth<c.x){d.totalWidth=c.x;}}this.element.setStyles({width:$pick(a,d.totalWidth,d.x),height:$pick(e,d.totalHeight,d.y)});
return this;},show:function(){if(!this.hidden){return this;}window.addEvent("resize",this.position);this.position();this.showMask.apply(this,arguments);
return this;},showMask:function(){this.element.setStyle("display","block");this.hidden=false;this.fireEvent("show");},hide:function(){if(this.hidden){return this;
}window.removeEvent("resize",this.position);this.hideMask.apply(this,arguments);if(this.options.destroyOnHide){return this.destroy();}return this;},hideMask:function(){this.element.setStyle("display","none");
this.hidden=true;this.fireEvent("hide");},toggle:function(){this[this.hidden?"show":"hide"]();},destroy:function(){this.hide();this.element.destroy();this.fireEvent("destroy");
this.target.eliminate("mask");}});Element.Properties.mask={set:function(b){var a=this.retrieve("mask");return this.eliminate("mask").store("mask:options",b);
},get:function(a){if(a||!this.retrieve("mask")){if(this.retrieve("mask")){this.retrieve("mask").destroy();}if(a||!this.retrieve("mask:options")){this.set("mask",a);
}this.store("mask",new Mask(this,this.retrieve("mask:options")));}return this.retrieve("mask");}};Element.implement({mask:function(a){this.get("mask",a).show();
return this;},unmask:function(){this.get("mask").hide();return this;}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(a,b){this.element.scrollTo(a,b);
},fps:50},initialize:function(b,a){this.setOptions(a);this.element=document.id(b);this.docBody=document.id(this.element.getDocument().body);this.listener=($type(this.element)!="element")?this.docBody:this.element;
this.timer=null;this.bound={attach:this.attach.bind(this),detach:this.detach.bind(this),getCoords:this.getCoords.bind(this)};},start:function(){this.listener.addEvents({mouseover:this.bound.attach,mouseout:this.bound.detach});
},stop:function(){this.listener.removeEvents({mouseover:this.bound.attach,mouseout:this.bound.detach});this.detach();this.timer=$clear(this.timer);},attach:function(){this.listener.addEvent("mousemove",this.bound.getCoords);
},detach:function(){this.listener.removeEvent("mousemove",this.bound.getCoords);this.timer=$clear(this.timer);},getCoords:function(a){this.page=(this.listener.get("tag")=="body")?a.client:a.page;
if(!this.timer){this.timer=this.scroll.periodical(Math.round(1000/this.options.fps),this);}},scroll:function(){var b=this.element.getSize(),a=this.element.getScroll(),f=this.element!=this.docBody?this.element.getOffsets():{x:0,y:0},c=this.element.getScrollSize(),e={x:0,y:0};
for(var d in this.page){if(this.page[d]<(this.options.area+f[d])&&a[d]!=0){e[d]=(this.page[d]-this.options.area-f[d])*this.options.velocity;}else{if(this.page[d]+this.options.area>(b[d]+f[d])&&a[d]+b[d]!=c[d]){e[d]=(this.page[d]-b[d]+this.options.area-f[d])*this.options.velocity;
}}}if(e.y||e.x){this.fireEvent("change",[a.x+e.x,a.y+e.y]);}}});(function(){var a=function(c,b){return(c)?($type(c)=="function"?c(b):b.get(c)):"";};this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block");
},onHide:function(){this.tip.setStyle("display","none");},title:"title",text:function(b){return b.get("rel")||b.get("href");},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},windowPadding:{x:0,y:0},fixed:false},initialize:function(){var b=Array.link(arguments,{options:Object.type,elements:$defined});
this.setOptions(b.options);if(b.elements){this.attach(b.elements);}this.container=new Element("div",{"class":"tip"});},toElement:function(){if(this.tip){return this.tip;
}return this.tip=new Element("div",{"class":this.options.className,styles:{position:"absolute",top:0,left:0}}).adopt(new Element("div",{"class":"tip-top"}),this.container,new Element("div",{"class":"tip-bottom"})).inject(document.body);
},attach:function(b){$$(b).each(function(d){var f=a(this.options.title,d),e=a(this.options.text,d);d.erase("title").store("tip:native",f).retrieve("tip:title",f);
d.retrieve("tip:text",e);this.fireEvent("attach",[d]);var c=["enter","leave"];if(!this.options.fixed){c.push("move");}c.each(function(h){var g=d.retrieve("tip:"+h);
if(!g){g=this["element"+h.capitalize()].bindWithEvent(this,d);}d.store("tip:"+h,g).addEvent("mouse"+h,g);},this);},this);return this;},detach:function(b){$$(b).each(function(d){["enter","leave","move"].each(function(e){d.removeEvent("mouse"+e,d.retrieve("tip:"+e)).eliminate("tip:"+e);
});this.fireEvent("detach",[d]);if(this.options.title=="title"){var c=d.retrieve("tip:native");if(c){d.set("title",c);}}},this);return this;},elementEnter:function(c,b){this.container.empty();
["title","text"].each(function(e){var d=b.retrieve("tip:"+e);if(d){this.fill(new Element("div",{"class":"tip-"+e}).inject(this.container),d);}},this);$clear(this.timer);
this.timer=(function(){this.show(this,b);this.position((this.options.fixed)?{page:b.getPosition()}:c);}).delay(this.options.showDelay,this);},elementLeave:function(c,b){$clear(this.timer);
this.timer=this.hide.delay(this.options.hideDelay,this,b);this.fireForParent(c,b);},fireForParent:function(c,b){b=b.getParent();if(!b||b==document.body){return;
}if(b.retrieve("tip:enter")){b.fireEvent("mouseenter",c);}else{this.fireForParent(c,b);}},elementMove:function(c,b){this.position(c);},position:function(e){if(!this.tip){document.id(this);
}var c=window.getSize(),b=window.getScroll(),f={x:this.tip.offsetWidth,y:this.tip.offsetHeight},d={x:"left",y:"top"},g={};for(var h in d){g[d[h]]=e.page[h]+this.options.offset[h];
if((g[d[h]]+f[h]-b[h])>c[h]-this.options.windowPadding[h]){g[d[h]]=e.page[h]-this.options.offset[h]-f[h];}}this.tip.setStyles(g);},fill:function(b,c){if(typeof c=="string"){b.set("html",c);
}else{b.adopt(c);}},show:function(b){if(!this.tip){document.id(this);}this.fireEvent("show",[this.tip,b]);},hide:function(b){if(!this.tip){document.id(this);
}this.fireEvent("hide",[this.tip,b]);}});})();var Spinner=new Class({Extends:Mask,options:{"class":"spinner",containerPosition:{},content:{"class":"spinner-content"},messageContainer:{"class":"spinner-msg"},img:{"class":"spinner-img"},fxOptions:{link:"chain"}},initialize:function(){this.parent.apply(this,arguments);
this.target.store("spinner",this);var a=function(){this.active=false;}.bind(this);this.addEvents({hide:a,show:a});},render:function(){this.parent();this.element.set("id",this.options.id||"spinner-"+$time());
this.content=document.id(this.options.content)||new Element("div",this.options.content);this.content.inject(this.element);if(this.options.message){this.msg=document.id(this.options.message)||new Element("p",this.options.messageContainer).appendText(this.options.message);
this.msg.inject(this.content);}if(this.options.img){this.img=document.id(this.options.img)||new Element("div",this.options.img);this.img.inject(this.content);
}this.element.set("tween",this.options.fxOptions);},show:function(a){if(this.active){return this.chain(this.show.bind(this));}if(!this.hidden){this.callChain.delay(20,this);
return this;}this.active=true;return this.parent(a);},showMask:function(a){var b=function(){this.content.position($merge({relativeTo:this.element},this.options.containerPosition));
}.bind(this);if(a){this.parent();b();}else{this.element.setStyles({display:"block",opacity:0}).tween("opacity",this.options.style.opacity||0.9);b();this.hidden=false;
this.fireEvent("show");this.callChain();}},hide:function(a){if(this.active){return this.chain(this.hide.bind(this));}if(this.hidden){this.callChain.delay(20,this);
return this;}this.active=true;return this.parent(a);},hideMask:function(a){if(a){return this.parent();}this.element.tween("opacity",0).get("tween").chain(function(){this.element.setStyle("display","none");
this.hidden=true;this.fireEvent("hide");this.callChain();}.bind(this));},destroy:function(){this.content.destroy();this.parent();this.target.eliminate("spinner");
}});Spinner.implement(new Chain);if(window.Request){Request=Class.refactor(Request,{options:{useSpinner:false,spinnerOptions:{},spinnerTarget:false},initialize:function(a){this._send=this.send;
this.send=function(c){if(this.spinner){this.spinner.chain(this._send.bind(this,c)).show();}else{this._send(c);}return this;};this.previous(a);var b=document.id(this.options.spinnerTarget)||document.id(this.options.update);
if(this.options.useSpinner&&b){this.spinner=b.get("spinner",this.options.spinnerOptions);["onComplete","onException","onCancel"].each(function(c){this.addEvent(c,this.spinner.hide.bind(this.spinner));
},this);}},getSpinner:function(){return this.spinner;}});}Element.Properties.spinner={set:function(a){var b=this.retrieve("spinner");return this.eliminate("spinner").store("spinner:options",a);
},get:function(a){if(a||!this.retrieve("spinner")){if(this.retrieve("spinner")){this.retrieve("spinner").destroy();}if(a||!this.retrieve("spinner:options")){this.set("spinner",a);
}new Spinner(this,this.retrieve("spinner:options"));}return this.retrieve("spinner");}};Element.implement({spin:function(a){this.get("spinner",a).show();
return this;},unspin:function(){var a=Array.link(arguments,{options:Object.type,callback:Function.type});this.get("spinner",a.options).hide(a.callback);
return this;}});MooTools.lang.set("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",ordinal:function(a){return(a>3&&a<21)?"th":["th","st","nd","rd","th"][Math.min(a%10,4)];
},lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",weekAgo:"1 week ago",weeksAgo:"{delta} weeks ago",monthAgo:"1 month ago",monthsAgo:"{delta} months ago",yearAgo:"1 year ago",yearsAgo:"{delta} years ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now",weekUntil:"1 week from now",weeksUntil:"{delta} weeks from now",monthUntil:"1 month from now",monthsUntil:"{delta} months from now",yearUntil:"1 year from now",yearsUntil:"{delta} years from now"});
MooTools.lang.set("en-US","Form.Validator",{required:"This field is required.",minLength:"Please enter at least {minLength} characters (you entered {length} characters).",maxLength:"Please enter no more than {maxLength} characters (you entered {length} characters).",integer:"Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.",numeric:'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',digits:"Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).",alpha:"Please use letters only (a-z) with in this field. No spaces or other characters are allowed.",alphanum:"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.",dateSuchAs:"Please enter a valid date such as {date}",dateInFormatMDY:'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',email:'Please enter a valid email address. For example "fred@domain.com".',url:"Please enter a valid URL such as http://www.google.com.",currencyDollar:"Please enter a valid $ amount. For example $100.00 .",oneRequired:"Please enter something for at least one of these inputs.",errorPrefix:"Error: ",warningPrefix:"Warning: ",noSpace:"There can be no spaces in this input.",reqChkByNode:"No items are selected.",requiredChk:"This field is required.",reqChkByName:"Please select a {label}.",match:"This field needs to match the {matchName} field",startDate:"the start date",endDate:"the end date",currendDate:"the current date",afterDate:"The date should be the same or after {label}.",beforeDate:"The date should be the same or before {label}.",startMonth:"Please select a start month",sameMonth:"These two dates must be in the same month - you must change one or the other.",creditcard:"The credit card number entered is invalid. Please check the number and try again. {length} digits entered."});
/*
	mediaboxAdvanced v1.3.4b - The ultimate extension of Slimbox and Mediabox; an all-media script
	updated 2010.09.21
		(c) 2007-2010 John Einselen <http://iaian7.com>
	based on Slimbox v1.64 - The ultimate lightweight Lightbox clone
		(c) 2007-2008 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/

var Mediabox;

(function() {
	// Global variables, accessible to Mediabox only
	var options, images, activeImage, prevImage, nextImage, top, mTop, left, mLeft, winWidth, winHeight, fx, preload, preloadPrev = new Image(), preloadNext = new Image(), foxfix = false, iefix = false,
	// DOM elements
	overlay, center, image, bottom, captionSplit, title, caption, prevLink, number, nextLink,
	// Mediabox specific vars
	URL, WH, WHL, elrel, mediaWidth, mediaHeight, mediaType = "none", mediaSplit, mediaId = "mediaBox", mediaFmt, margin;

	/*	Initialization	*/

	window.addEvent("domready", function() {
		// Create and append the Mediabox HTML code at the bottom of the document
		document.id(document.body).adopt(
			$$([
				overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close),
				center = new Element("div", {id: "mbCenter"})
			]).setStyle("display", "none")
		);

		image = new Element("div", {id: "mbImage"}).injectInside(center);
		bottom = new Element("div", {id: "mbBottom"}).injectInside(center).adopt(
			closeLink = new Element("a", {id: "mbCloseLink", href: "#"}).addEvent("click", close),
			nextLink = new Element("a", {id: "mbNextLink", href: "#"}).addEvent("click", next),
			prevLink = new Element("a", {id: "mbPrevLink", href: "#"}).addEvent("click", previous),
			title = new Element("div", {id: "mbTitle"}),
			number = new Element("div", {id: "mbNumber"}),
			caption = new Element("div", {id: "mbCaption"})
		);

		fx = {
			overlay: new Fx.Tween(overlay, {property: "opacity", duration: 360}).set(0),
			image: new Fx.Tween(image, {property: "opacity", duration: 360, onComplete: captionAnimate}),
			bottom: new Fx.Tween(bottom, {property: "opacity", duration: 240}).set(0)
		};
	});

	/*	API		*/

	Mediabox = {
		close: function(){
			close();	// Thanks to Yosha on the google group for fixing the close function API!
		},

		open: function(_images, startImage, _options) {
			options = $extend({
				text: ['<big>&laquo;</big>','<big>&raquo;</big>','<big>&times;</big>'],		// Set "previous", "next", and "close" button content (HTML code should be written as entity codes or properly escaped)
//				text: ['<big>«</big>','<big>»</big>','<big>×</big>'],		// Set "previous", "next", and "close" button content (HTML code should be written as entity codes or properly escaped)
//	example		text: ['<b>P</b>rev','<b>N</b>ext','<b>C</b>lose'],
				loop: false,					// Allows to navigate between first and last images
				keyboard: true,					// Enables keyboard control; escape key, left arrow, and right arrow
				alpha: true,					// Adds 'x', 'c', 'p', and 'n' when keyboard control is also set to true
				stopKey: false,					// Stops all default keyboard actions while overlay is open (such as up/down arrows)
													// Does not apply to iFrame content, does not affect mouse scrolling
				overlayOpacity: 0.7,			// 1 is opaque, 0 is completely transparent (change the color in the CSS file)
				resizeOpening: true,			// Determines if box opens small and grows (true) or starts at larger size (false)
				resizeDuration: 240,			// Duration of each of the box resize animations (in milliseconds)
				resizeTransition: false,		// Mootools transition effect (false leaves it at the default)
				initialWidth: 320,				// Initial width of the box (in pixels)
				initialHeight: 180,				// Initial height of the box (in pixels)
				defaultWidth: 640,				// Default width of the box (in pixels) for undefined media (MP4, FLV, etc.)
				defaultHeight: 360,				// Default height of the box (in pixels) for undefined media (MP4, FLV, etc.)
				showCaption: true,				// Display the title and caption, true / false
				showCounter: true,				// If true, a counter will only be shown if there is more than 1 image to display
				counterText: '({x} of {y})',	// Translate or change as you wish
//			Image options
				imgBackground: false,		// Embed images as CSS background (true) or <img> tag (false)
											// CSS background is naturally non-clickable, preventing downloads
											// IMG tag allows automatic scaling for smaller screens
											// (all images have no-click code applied, albeit not Opera compatible. To remove, comment lines 212 and 822)
				imgPadding: 100,			// Clearance necessary for images larger than the window size (only used when imgBackground is false)
											// Change this number only if the CSS style is significantly divergent from the original, and requires different sizes
//			Inline options
//				overflow: 'auto',			// If set, overides CSS settings for inline content only
//			Global media options
				html5: 'true',				// HTML5 settings for YouTube and Vimeo, false = off, true = on
				scriptaccess: 'true',		// Allow script access to flash files
				fullscreen: 'true',			// Use fullscreen
				fullscreenNum: '1',			// 1 = true
				autoplay: 'true',			// Plays the video as soon as it's opened
				autoplayNum: '1',			// 1 = true
				autoplayYes: 'yes',			// yes = true
				volume: '100',				// 0-100, used for NonverBlaster and Quicktime players
				medialoop: 'true',			// Loop video playback, true / false, used for NonverBlaster and Quicktime players
				bgcolor: '#000000',			// Background color, used for flash and QT media
				wmode: 'opaque',			// Background setting for Adobe Flash ('opaque' and 'transparent' are most common)
//			NonverBlaster
				useNB: true,				// use NonverBlaster (true) or JW Media Player (false) for .flv and .mp4 files
				playerpath: 'scripts/jwplayer/NonverBlaster.swf',	// Path to NonverBlaster.swf
				controlColor: '0xFFFFFF',	// set the controlbar color
				controlBackColor: '0x000000',	// set the controlbar color
				showTimecode: 'true',		// turn timecode display off or on
//			JW Media Player settings and options
				JWplayerpath: 'scripts/jwplayer/player.swf',	// Path to the mediaplayer.swf or flvplayer.swf file
				backcolor:	'000000',		// Base color for the controller, color name / hex value (0x000000)
				frontcolor: '999999',		// Text and button color for the controller, color name / hex value (0x000000)
				lightcolor: '000000',		// Rollover color for the controller, color name / hex value (0x000000)
				screencolor: '000000',		// Rollover color for the controller, color name / hex value (0x000000)
				controlbar: 'over',			// bottom, over, none (this setting is ignored when playing audio files)
//			Quicktime options
				controller: 'true',			// Show controller, true / false
//			Flickr options
				flInfo: 'true',				// Show title and info at video start
//			Revver options
				revverID: '187866',			// Revver affiliate ID, required for ad revinue sharing
				revverFullscreen: 'true',	// Fullscreen option
				revverBack: '000000',		// Background color
				revverFront: 'ffffff',		// Foreground color
				revverGrad: '000000',		// Gradation color
//			Ustream options
				usViewers: 'true',				// Show online viewer count (true/false)
//			Youtube options
				ytBorder: '0',				// Outline				(1=true, 0=false)
				ytColor1: '000000',			// Outline color
				ytColor2: '333333',			// Base interface color (highlight colors stay consistent)
				ytQuality: '&ap=%2526fmt%3D18', // Leave empty for standard quality, use '&ap=%2526fmt%3D18' for high quality, and '&ap=%2526fmt%3D22' for HD (note that not all videos are availible in high quality, and very few in HD)
				ytRel: '0',					// Show related videos	(1=true, 0=false)
				ytInfo: '1',				// Show video info		(1=true, 0=false)
				ytSearch: '0',				// Show search field	(1=true, 0=false)
//			Viddyou options
				vuPlayer: 'basic',			// Use 'full' or 'basic' players
//			Vimeo options
				vmTitle: '1',				// Show video title
				vmByline: '1',				// Show byline
				vmPortrait: '1',			// Show author portrait
				vmColor: 'ffffff'			// Custom controller colors, hex value minus the # sign, defult is 5ca0b5
			}, _options || {});

			prevLink.set('html', options.text[0]);
			nextLink.set('html', options.text[1]);
			closeLink.set('html', options.text[2]);

			margin = center.getStyle('padding-left').toInt()+image.getStyle('margin-left').toInt()+image.getStyle('padding-left').toInt();

			if ((Browser.Engine.gecko) && (Browser.Engine.version<19)) {	// Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash
				foxfix = true;
				options.overlayOpacity = 1;
				overlay.className = 'mbOverlayFF';
			}

			if ((Browser.Engine.trident) && (Browser.Engine.version<5)) {	// Fixes IE 6 and earlier incompatibilities with CSS position: fixed;
				iefix = true;
				overlay.className = 'mbOverlayIE';
				overlay.setStyle("position", "absolute");
				position();
			}

			if (typeof _images == "string") {	// Used for single images only, with URL and Title as first two arguments
				_images = [[_images,startImage,_options]];
				startImage = 0;
			}

			images = _images;
			options.loop = options.loop && (images.length > 1);

			size();
			setup(true);
			top = window.getScrollTop() + (window.getHeight()/2);
			left = window.getScrollLeft() + (window.getWidth()/2);
			fx.resize = new Fx.Morph(center, $extend({duration: options.resizeDuration, onComplete: imageAnimate}, options.resizeTransition ? {transition: options.resizeTransition} : {}));
			center.setStyles({top: top, left: left, width: options.initialWidth, height: options.initialHeight, marginTop: -(options.initialHeight/2)-margin, marginLeft: -(options.initialWidth/2)-margin, display: ""});
			fx.overlay.start(options.overlayOpacity);
			return changeImage(startImage);
		}
	};

	Element.implement({
		mediabox: function(_options, linkMapper) {
			$$(this).mediabox(_options, linkMapper);	// The processing of a single element is similar to the processing of a collection with a single element

			return this;
		}
	});

	Elements.implement({
		/*
			options:	Optional options object, see Mediabox.open()
			linkMapper:	Optional function taking a link DOM element and an index as arguments and returning an array containing 3 elements:
						the image URL and the image caption (may contain HTML)
			linksFilter:Optional function taking a link DOM element and an index as arguments and returning true if the element is part of
						the image collection that will be shown on click, false if not. "this" refers to the element that was clicked.
						This function must always return true when the DOM element argument is "this".
		*/
		mediabox: function(_options, linkMapper, linksFilter) {
			linkMapper = linkMapper || function(el) {
				elrel = el.rel.split(/[\[\]]/);
				elrel = elrel[1];
				return [el.href, el.title, elrel];
			};

			linksFilter = linksFilter || function() {
				return true;
			};

			var links = this;

			links.addEvent('contextmenu', function(e){
				if (this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)) e.stop();
			});

			links.removeEvents("click").addEvent("click", function() {
				// Build the list of images that will be displayed
				var filteredArray = links.filter(linksFilter, this);
				var filteredLinks = [];
				var filteredHrefs = [];

				filteredArray.each(function(item, index){
					if(filteredHrefs.indexOf(item.toString()) < 0) {
						filteredLinks.include(filteredArray[index]);
						filteredHrefs.include(filteredArray[index].toString());
					};
				});

				return Mediabox.open(filteredLinks.map(linkMapper), filteredHrefs.indexOf(this.toString()), _options);
			});

			return links;
		}
	});

	/*	Internal functions	*/

	function position() {
		overlay.setStyles({top: window.getScrollTop(), left: window.getScrollLeft()});
	}

	function size() {
		winWidth = window.getWidth();
		winHeight = window.getHeight();
		overlay.setStyles({width: winWidth, height: winHeight});
	}

	function setup(open) {
		// Hides on-page objects and embeds while the overlay is open, nessesary to counteract Firefox stupidity
		if (Browser.Engine.gecko) {
			["object", window.ie ? "select" : "embed"].forEach(function(tag) {
				Array.forEach(document.getElementsByTagName(tag), function(el) {
					if (open) el._mediabox = el.style.visibility;
					el.style.visibility = open ? "hidden" : el._mediabox;
				});
			});
		}

		overlay.style.display = open ? "" : "none";

		var fn = open ? "addEvent" : "removeEvent";
		if (iefix) window[fn]("scroll", position);
		window[fn]("resize", size);
		if (options.keyboard) document[fn]("keydown", keyDown);
	}

	function keyDown(event) {
		if (options.alpha) {
			switch(event.code) {
				case 27:	// Esc
				case 88:	// 'x'
				case 67:	// 'c'
					close();
					break;
				case 37:	// Left arrow
				case 80:	// 'p'
					previous();
					break;
				case 39:	// Right arrow
				case 78:	// 'n'
					next();
			}
		} else {
			switch(event.code) {
				case 27:	// Esc
					close();
					break;
				case 37:	// Left arrow
					previous();
					break;
				case 39:	// Right arrow
					next();
			}
		}
		if (options.stopKey) { return false; };
	}

	function previous() {
		return changeImage(prevImage);
	}

	function next() {
		return changeImage(nextImage);
	}

	function changeImage(imageIndex) {
		if (imageIndex >= 0) {
			image.set('html', '');
			activeImage = imageIndex;
			prevImage = ((activeImage || !options.loop) ? activeImage : images.length) - 1;
			nextImage = activeImage + 1;
			if (nextImage == images.length) nextImage = options.loop ? 0 : -1;
			stop();
			center.className = "mbLoading";

	/*	mediaboxAdvanced link formatting and media support	*/

			if (!images[imageIndex][2]) images[imageIndex][2] = '';	// Thanks to Leo Feyer for offering this fix
			WH = images[imageIndex][2].split(' ');
			WHL = WH.length;
			if (WHL>1) {
				mediaWidth = (WH[WHL-2].match("%")) ? (window.getWidth()*((WH[WHL-2].replace("%", ""))*0.01))+"px" : WH[WHL-2]+"px";
				mediaHeight = (WH[WHL-1].match("%")) ? (window.getHeight()*((WH[WHL-1].replace("%", ""))*0.01))+"px" : WH[WHL-1]+"px";
			} else {
				mediaWidth = "";
				mediaHeight = "";
			}
			URL = images[imageIndex][0];
			URL = encodeURI(URL).replace("(","%28").replace(")","%29");
			captionSplit = images[activeImage][1].split('::');

// Quietube and yFrog support
			if (URL.match(/quietube\.com/i)) {
				mediaSplit = URL.split('v.php/');
				URL = mediaSplit[1];
			} else if (URL.match(/\/\/yfrog/i)) {
				mediaType = (URL.substring(URL.length-1));
				if (mediaType.match(/b|g|j|p|t/i)) mediaType = 'image';
				if (mediaType == 's') mediaType = 'flash';
				if (mediaType.match(/f|z/i)) mediaType = 'video';
				URL = URL+":iphone";
			}

	/*	Specific Media Types	*/

// GIF, JPG, PNG
			if (URL.match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i) || mediaType == 'image') {
				mediaType = 'img';
				URL = URL.replace(/twitpic\.com/i, "twitpic.com/show/full");
				preload = new Image();
				preload.onload = startEffect;
				preload.src = URL;
// FLV, MP4
			} else if (URL.match(/\.flv|\.mp4/i) || mediaType == 'video') {
				mediaType = 'obj';
				mediaWidth = mediaWidth || options.defaultWidth;
				mediaHeight = mediaHeight || options.defaultHeight;
				if (options.useNB) {
				preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {
					id: 'MediaboxSWF',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				} else {
				preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar, {
					id: 'MediaboxSWF',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				}
				startEffect();
// MP3, AAC
			} else if (URL.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i) || mediaType == 'audio') {
				mediaType = 'obj';
				mediaWidth = mediaWidth || options.defaultWidth;
				mediaHeight = mediaHeight || "20px";
				if (URL.match(/tweetmic\.com|tmic\.fm/i)) {
					URL = URL.split('/');
					URL[4] = URL[4] || URL[3];
					URL = "http://media4.fjarnet.net/tweet/tweetmicapp-"+URL[4]+'.mp3';
				}
				if (options.useNB) {
				preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {
					id: 'MediaboxSWF',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				} else {
				preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay, {
					id: 'MediaboxSWF',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				}
				startEffect();
// SWF
			} else if (URL.match(/\.swf/i) || mediaType == 'flash') {
				mediaType = 'obj';
				mediaWidth = mediaWidth || options.defaultWidth;
				mediaHeight = mediaHeight || options.defaultHeight;
				preload = new Swiff(URL, {
					id: 'MediaboxSWF',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// MOV, M4V, M4A, MP4, AIFF, etc.
			} else if (URL.match(/\.mov|\.m4v|\.m4a|\.aiff|\.avi|\.caf|\.dv|\.mid|\.m3u|\.mp3|\.mp2|\.mp4|\.qtz/i) || mediaType == 'qt') {
				mediaType = 'qt';
				mediaWidth = mediaWidth || options.defaultWidth;
				mediaHeight = (parseInt(mediaHeight)+16)+"px" || options.defaultHeight;
				preload = new Quickie(URL, {
					id: 'MediaboxQT',
					width: mediaWidth,
					height: mediaHeight,
					container: 'mbImage',
					attributes: {controller: options.controller, autoplay: options.autoplay, volume: options.volume, loop: options.medialoop, bgcolor: options.bgcolor}
					});
				startEffect();

	/*	Social Media Sites	*/

// Blip.tv
			} else if (URL.match(/blip\.tv/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "640px";
				mediaHeight = mediaHeight || "390px";
				preload = new Swiff(URL, {
					src: URL,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Break.com
			} else if (URL.match(/break\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "464px";
				mediaHeight = mediaHeight || "376px";
				mediaId = URL.match(/\d{6}/g);
				preload = new Swiff('http://embed.break.com/'+mediaId, {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// DailyMotion
			} else if (URL.match(/dailymotion\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "480px";
				mediaHeight = mediaHeight || "381px";
				preload = new Swiff(URL, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Facebook
			} else if (URL.match(/facebook\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "320px";
				mediaHeight = mediaHeight || "240px";
				mediaSplit = URL.split('v=');
				mediaSplit = mediaSplit[1].split('&');
				mediaId = mediaSplit[0];
				preload = new Swiff('http://www.facebook.com/v/'+mediaId, {
					movie: 'http://www.facebook.com/v/'+mediaId,
					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Flickr
			} else if (URL.match(/flickr\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "500px";
				mediaHeight = mediaHeight || "375px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[5];
				preload = new Swiff('http://www.flickr.com/apps/video/stewart.swf', {
					id: mediaId,
					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
					width: mediaWidth,
					height: mediaHeight,
					params: {flashvars: 'photo_id='+mediaId+'&amp;show_info_box='+options.flInfo, wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// GameTrailers Video
			} else if (URL.match(/gametrailers\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "480px";
				mediaHeight = mediaHeight || "392px";
				mediaId = URL.match(/\d{5}/g);
				preload = new Swiff('http://www.gametrailers.com/remote_wrap.php?mid='+mediaId, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Google Video
			} else if (URL.match(/google\.com\/videoplay/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "400px";
				mediaHeight = mediaHeight || "326px";
				mediaSplit = URL.split('=');
				mediaId = mediaSplit[1];
				preload = new Swiff('http://video.google.com/googleplayer.swf?docId='+mediaId+'&autoplay='+options.autoplayNum, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Megavideo - Thanks to Robert Jandreu for suggesting this code!
			} else if (URL.match(/megavideo\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "640px";
				mediaHeight = mediaHeight || "360px";
				mediaSplit = URL.split('=');
				mediaId = mediaSplit[1];
				preload = new Swiff('http://wwwstatic.megavideo.com/mv_player.swf?v='+mediaId, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Metacafe
			} else if (URL.match(/metacafe\.com\/watch/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "400px";
				mediaHeight = mediaHeight || "345px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[4];
				preload = new Swiff('http://www.metacafe.com/fplayer/'+mediaId+'/.swf?playerVars=autoPlay='+options.autoplayYes, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Myspace
			} else if (URL.match(/vids\.myspace\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "425px";
				mediaHeight = mediaHeight || "360px";
				preload = new Swiff(URL, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Revver
			} else if (URL.match(/revver\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "480px";
				mediaHeight = mediaHeight || "392px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[4];
				preload = new Swiff('http://flash.revver.com/player/1.0/player.swf?mediaId='+mediaId+'&affiliateId='+options.revverID+'&allowFullScreen='+options.revverFullscreen+'&autoStart='+options.autoplay+'&backColor=#'+options.revverBack+'&frontColor=#'+options.revverFront+'&gradColor=#'+options.revverGrad+'&shareUrl=revver', {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Rutube
			} else if (URL.match(/rutube\.ru/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "470px";
				mediaHeight = mediaHeight || "353px";
				mediaSplit = URL.split('=');
				mediaId = mediaSplit[1];
				preload = new Swiff('http://video.rutube.ru/'+mediaId, {
					movie: 'http://video.rutube.ru/'+mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Seesmic
			} else if (URL.match(/seesmic\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "435px";
				mediaHeight = mediaHeight || "355px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[5];
				preload = new Swiff('http://seesmic.com/Standalone.swf?video='+mediaId, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Tudou
			} else if (URL.match(/tudou\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "400px";
				mediaHeight = mediaHeight || "340px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[5];
				preload = new Swiff('http://www.tudou.com/v/'+mediaId, {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Twitvcam
			} else if (URL.match(/twitcam\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "320px";
				mediaHeight = mediaHeight || "265px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[3];
				preload = new Swiff('http://static.livestream.com/chromelessPlayer/wrappers/TwitcamPlayer.swf?hash='+mediaId, {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Twiturm
			} else if (URL.match(/twiturm\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "402px";
				mediaHeight = mediaHeight || "48px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[3];
				preload = new Swiff('http://twiturm.com/flash/twiturm_mp3.swf?playerID=0&sf='+mediaId, {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Twitvid
			} else if (URL.match(/twitvid\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "600px";
				mediaHeight = mediaHeight || "338px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[3];
				preload = new Swiff('http://www.twitvid.com/player/'+mediaId, {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Ustream.tv
			} else if (URL.match(/ustream\.tv/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "400px";
				mediaHeight = mediaHeight || "326px";
				preload = new Swiff(URL+'&amp;viewcount='+options.usViewers+'&amp;autoplay='+options.autoplay, {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// YouKu
			} else if (URL.match(/youku\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "480px";
				mediaHeight = mediaHeight || "400px";
				mediaSplit = URL.split('id_');
				mediaId = mediaSplit[1];
				preload = new Swiff('http://player.youku.com/player.php/sid/'+mediaId+'=/v.swf', {
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// YouTube Video (now includes HTML5 option)
			} else if (URL.match(/youtube\.com\/watch/i)) {
				mediaSplit = URL.split('v=');
				if (options.html5) {
					mediaType = 'url';
					mediaWidth = mediaWidth || "640px";
					mediaHeight = mediaHeight || "385px";
					mediaId = "mediaId_"+new Date().getTime();	// Safari may not update iframe content with a static id.
					preload = new Element('iframe', {
						'src': 'http://www.youtube.com/embed/'+mediaSplit[1],
						'id': mediaId,
						'width': mediaWidth,
						'height': mediaHeight,
						'frameborder': 0
						});
					startEffect();
				} else {
					mediaType = 'obj';
					mediaId = mediaSplit[1];
					if (mediaId.match(/fmt=22/i)) {
						mediaFmt = '&ap=%2526fmt%3D22';
						mediaWidth = mediaWidth || "640px";
						mediaHeight = mediaHeight || "385px";
					} else if (mediaId.match(/fmt=18/i)) {
						mediaFmt = '&ap=%2526fmt%3D18';
						mediaWidth = mediaWidth || "560px";
						mediaHeight = mediaHeight || "345px";
					} else {
						mediaFmt = options.ytQuality;
						mediaWidth = mediaWidth || "480px";
						mediaHeight = mediaHeight || "295px";
					}
					preload = new Swiff('http://www.youtube.com/v/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {
						id: mediaId,
						width: mediaWidth,
						height: mediaHeight,
						params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
						});
					startEffect();
				}
// YouTube Playlist
			} else if (URL.match(/youtube\.com\/view/i)) {
				mediaType = 'obj';
				mediaSplit = URL.split('p=');
				mediaId = mediaSplit[1];
				mediaWidth = mediaWidth || "480px";
				mediaHeight = mediaHeight || "385px";
				preload = new Swiff('http://www.youtube.com/p/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Veoh
			} else if (URL.match(/veoh\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "410px";
				mediaHeight = mediaHeight || "341px";
				URL = URL.replace('%3D','/');
				mediaSplit = URL.split('watch/');
				mediaId = mediaSplit[1];
				preload = new Swiff('http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId='+mediaId+'&player=videodetailsembedded&videoAutoPlay='+options.AutoplayNum+'&id=anonymous', {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Viddler
			} else if (URL.match(/viddler\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "437px";
				mediaHeight = mediaHeight || "370px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[4];
				preload = new Swiff(URL, {
					id: 'viddler_'+mediaId,
					movie: URL,
					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen, id: 'viddler_'+mediaId, movie: URL}
					});
				startEffect();
// Viddyou
			} else if (URL.match(/viddyou\.com/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "416px";
				mediaHeight = mediaHeight || "312px";
				mediaSplit = URL.split('=');
				mediaId = mediaSplit[1];
				preload = new Swiff('http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf', {
					id: mediaId,
					movie: 'http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf',
					width: mediaWidth,
					height: mediaHeight,
					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();
// Vimeo (now includes HTML5 option)
			} else if (URL.match(/vimeo\.com/i)) {
				mediaWidth = mediaWidth || "640px";		// site defualt: 400px
				mediaHeight = mediaHeight || "360px";	// site defualt: 225px
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[3];

				if (options.html5) {
					mediaType = 'url';
					mediaId = "mediaId_"+new Date().getTime();	// Safari may not update iframe content with a static id.
					preload = new Element('iframe', {
						'src': 'http://player.vimeo.com/video/'+mediaSplit[3]+'?portrait='+options.vmPortrait,
						'id': mediaId,
						'width': mediaWidth,
						'height': mediaHeight,
						'frameborder': 0
						});
					startEffect();
				} else {
					mediaType = 'obj';
					preload = new Swiff('http://www.vimeo.com/moogaloop.swf?clip_id='+mediaId+'&amp;server=www.vimeo.com&amp;fullscreen='+options.fullscreenNum+'&amp;autoplay='+options.autoplayNum+'&amp;show_title='+options.vmTitle+'&amp;show_byline='+options.vmByline+'&amp;show_portrait='+options.vmPortrait+'&amp;color='+options.vmColor, {
						id: mediaId,
						width: mediaWidth,
						height: mediaHeight,
						params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
						});
					startEffect();
				}
// 12seconds
			} else if (URL.match(/12seconds\.tv/i)) {
				mediaType = 'obj';
				mediaWidth = mediaWidth || "430px";
				mediaHeight = mediaHeight || "360px";
				mediaSplit = URL.split('/');
				mediaId = mediaSplit[5];
				preload = new Swiff('http://embed.12seconds.tv/players/remotePlayer.swf', {
					id: mediaId,
					width: mediaWidth,
					height: mediaHeight,
					params: {flashvars: 'vid='+mediaId+'', wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
					});
				startEffect();

	/*	Specific Content Types	*/

// INLINE
			} else if (URL.match(/\#mb_/i)) {
				mediaType = 'inline';
				mediaWidth = mediaWidth || options.defaultWidth;
				mediaHeight = mediaHeight || options.defaultHeight;
				URLsplit = URL.split('#');
				preload = document.id(URLsplit[1]).get('html');
				startEffect();
// HTML
			} else {
				mediaType = 'url';
				mediaWidth = mediaWidth || options.defaultWidth;
				mediaHeight = mediaHeight || options.defaultHeight;
				mediaId = "mediaId_"+new Date().getTime();	// Safari may not update iframe content with a static id.
				preload = new Element('iframe', {
					'src': URL,
					'id': mediaId,
					'width': mediaWidth,
					'height': mediaHeight,
					'frameborder': 0
					});
				startEffect();
			}
		}
		return false;
	}

	function startEffect() {
		if (mediaType == "img"){
			mediaWidth = preload.width;
			mediaHeight = preload.height;
			if (options.imgBackground) {
				image.setStyles({backgroundImage: "url("+URL+")", display: ""});
			} else {	// Thanks to Dusan Medlin for fixing large 16x9 image errors in a 4x3 browser
				if (mediaHeight >= winHeight-options.imgPadding && (mediaHeight / winHeight) >= (mediaWidth / winWidth)) {
					mediaHeight = winHeight-options.imgPadding;
					mediaWidth = preload.width = parseInt((mediaHeight/preload.height)*mediaWidth);
					preload.height = mediaHeight;
				} else if (mediaWidth >= winWidth-options.imgPadding && (mediaHeight / winHeight) < (mediaWidth / winWidth)) {
					mediaWidth = winWidth-options.imgPadding;
					mediaHeight = preload.height = parseInt((mediaWidth/preload.width)*mediaHeight);
					preload.width = mediaWidth;
				}
				if (Browser.Engine.trident) preload = document.id(preload);
				preload.addEvent('mousedown', function(e){ e.stop(); }).addEvent('contextmenu', function(e){ e.stop(); });
				image.setStyles({backgroundImage: "none", display: ""});
				preload.inject(image);
			}
		} else if (mediaType == "obj") {
			if (Browser.Plugins.Flash.version<8) {
				image.setStyles({backgroundImage: "none", display: ""});
				image.set('html', '<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>');
				mediaWidth = options.DefaultWidth;
				mediaHeight = options.DefaultHeight;
			} else {
				image.setStyles({backgroundImage: "none", display: ""});
				preload.inject(image);
			}
		} else if (mediaType == "qt") {
			image.setStyles({backgroundImage: "none", display: ""});
			preload;
		} else if (mediaType == "inline") {
//			if (options.overflow) image.setStyles({overflow: options.overflow});
			image.setStyles({backgroundImage: "none", display: ""});
			image.set('html', preload);
		} else if (mediaType == "url") {
			image.setStyles({backgroundImage: "none", display: ""});
			preload.inject(image);
		} else {
			image.setStyles({backgroundImage: "none", display: ""});
			image.set('html', '<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>');
			mediaWidth = options.defaultWidth;
			mediaHeight = options.defaultHeight;
		}
		image.setStyles({width: mediaWidth, height: mediaHeight});
		caption.setStyles({width: mediaWidth});

		title.set('html', (options.showCaption) ? captionSplit[0] : "");
		caption.set('html', (options.showCaption && (captionSplit.length > 1)) ? captionSplit[1] : "");
		number.set('html', (options.showCounter && (images.length > 1)) ? options.counterText.replace(/{x}/, activeImage + 1).replace(/{y}/, images.length) : "");

		if ((prevImage >= 0) && (images[prevImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadPrev.src = images[prevImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");
		if ((nextImage >= 0) && (images[nextImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadNext.src = images[nextImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");

		mediaWidth = image.offsetWidth;
		mediaHeight = image.offsetHeight+bottom.offsetHeight;
		if (mediaHeight >= top+top) { mTop = -top } else { mTop = -(mediaHeight/2) };
		if (mediaWidth >= left+left) { mLeft = -left } else { mLeft = -(mediaWidth/2) };
		if (options.resizeOpening) { fx.resize.start({width: mediaWidth, height: mediaHeight, marginTop: mTop-margin, marginLeft: mLeft-margin});
		} else { center.setStyles({width: mediaWidth, height: mediaHeight, marginTop: mTop-margin, marginLeft: mLeft-margin}); imageAnimate(); }
	}

	function imageAnimate() {
		fx.image.start(1);
	}

	function captionAnimate() {
		center.className = "";
		if (prevImage >= 0) prevLink.style.display = "";
		if (nextImage >= 0) nextLink.style.display = "";
		fx.bottom.start(1);
	}

	function stop() {
		if (preload) preload.onload = $empty;
		fx.resize.cancel();
		fx.image.cancel().set(0);
		fx.bottom.cancel().set(0);
		$$(prevLink, nextLink).setStyle("display", "none");
	}

	function close() {
		if (activeImage >= 0) {
			preload.onload = $empty;
			image.set('html', '');
			for (var f in fx) fx[f].cancel();
			center.setStyle("display", "none");
			fx.overlay.chain(setup).start(0);
		}
		return false;
	}
})();

	/*	Autoload code block	*/

Mediabox.scanPage = function() {
//	$$('#mb_').each(function(hide) { hide.set('display', 'none'); });
	var links = $$("a").filter(function(el) {
		return el.rel && el.rel.test(/^lightbox/i);
	});
	$$(links).mediabox({/* Put custom options here */}, null, function(el) {
		var rel0 = this.rel.replace(/[[]|]/gi," ");
		var relsize = rel0.split(" ");
		return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1]));
	});
};
window.addEvent("domready", Mediabox.scanPage);/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;/******************************************************************************
Name:    Highslide JS
Version: 4.1.8 (October 27 2009)
Config:  default +events +unobtrusive +imagemap +slideshow +positioning +transitions +viewport +thumbstrip +inline +ajax +iframe +flash +packed
Author:  Torstein Hønsi
Support: http://highslide.com/support

Licence:
Highslide JS is licensed under a Creative Commons Attribution-NonCommercial 2.5
License (http://creativecommons.org/licenses/by-nc/2.5/).

You are free:
	* to copy, distribute, display, and perform the work
	* to make derivative works

Under the following conditions:
	* Attribution. You must attribute the work in the manner  specified by  the
	  author or licensor.
	* Noncommercial. You may not use this work for commercial purposes.

* For  any  reuse  or  distribution, you  must make clear to others the license
  terms of this work.
* Any  of  these  conditions  can  be  waived  if  you  get permission from the 
  copyright holder.

Your fair use and other rights are in no way affected by the above.
******************************************************************************/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('q(!m){A m={11:{9m:\'aE\',aR:\'dD...\',aD:\'8I 2d dE\',bk:\'8I 2d dC 2d dB\',9j:\'dz 2d dA D (f)\',cz:\'dF by <i>aa a7</i>\',cL:\'dG 2d dL aa a7 dM\',8x:\'ae\',8y:\'a8\',8j:\'ad\',8p:\'am\',8n:\'am (dK)\',aX:\'dJ\',a6:\'al\',at:\'al 1p (ag)\',bd:\'ap\',ab:\'ap 1p (ag)\',8w:\'ae (8N 18)\',8A:\'a8 (8N 3m)\',8s:\'ad\',aZ:\'1:1\',3G:\'dI %1 dy %2\',9E:\'8I 2d 24 2L, dx ai dn 2d 3x. do 8N dm O 1C ai 3c.\'},4Y:\'K/di/\',7M:\'dj.54\',6r:\'dk.54\',6Z:5G,8Y:5G,4B:15,90:15,5g:15,6z:15,4w:dp,b7:0.75,9t:L,9b:5,3R:2,dq:3,5F:1l,bn:\'4H 3m\',bp:1,bR:L,ck:\'dv://K.dw/\',cj:\'du\',aI:L,91:[\'a\',\'5k\'],3k:[],cx:5G,45:0,89:50,6Q:1l,6R:L,4E:L,3Q:\'60\',7W:L,4c:\'1P\',9q:\'1P\',aV:I,aW:I,9L:L,4I:an,6p:an,5U:L,1Y:\'dr-ds\',8g:{2U:\'<Q 1X="K-2U"><5V>\'+\'<1L 1X="K-3c">\'+\'<a 23="#" 2i="{m.11.8w}">\'+\'<1D>{m.11.8x}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-3O">\'+\'<a 23="#" 2i="{m.11.at}">\'+\'<1D>{m.11.a6}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-3h">\'+\'<a 23="#" 2i="{m.11.ab}">\'+\'<1D>{m.11.bd}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-1C">\'+\'<a 23="#" 2i="{m.11.8A}">\'+\'<1D>{m.11.8y}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-3x">\'+\'<a 23="#" 2i="{m.11.8s}">\'+\'<1D>{m.11.8j}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-19-2F">\'+\'<a 23="#" 2i="{m.11.9j}">\'+\'<1D>{m.11.aZ}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-24">\'+\'<a 23="#" 2i="{m.11.8n}" >\'+\'<1D>{m.11.8p}</1D></a>\'+\'</1L>\'+\'</5V></Q>\',b5:\'<Q 1X="K-ed"><5V>\'+\'<1L 1X="K-3c">\'+\'<a 23="#" 2i="{m.11.8w}" 2m="E m.3c(k)">\'+\'<1D>{m.11.8x}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-1C">\'+\'<a 23="#" 2i="{m.11.8A}" 2m="E m.1C(k)">\'+\'<1D>{m.11.8y}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-3x">\'+\'<a 23="#" 2i="{m.11.8s}" 2m="E 1l">\'+\'<1D>{m.11.8j}</1D></a>\'+\'</1L>\'+\'<1L 1X="K-24">\'+\'<a 23="#" 2i="{m.11.8n}" 2m="E m.24(k)">\'+\'<1D>{m.11.8p}</1D></a>\'+\'</1L>\'+\'</5V></Q>\'+\'<Q 1X="K-1f"></Q>\'+\'<Q 1X="K-ef"><Q>\'+\'<1D 1X="K-3Y" 2i="{m.11.aX}"><1D></1D></1D>\'+\'</Q></Q>\'},6u:[],9C:L,14:[],a3:[\'5U\',\'3w\',\'4c\',\'9q\',\'aV\',\'aW\',\'1Y\',\'3R\',\'ek\',\'em\',\'ej\',\'b3\',\'ei\',\'eg\',\'eh\',\'b2\',\'cJ\',\'9L\',\'3V\',\'66\',\'3k\',\'45\',\'M\',\'N\',\'9R\',\'6Q\',\'6R\',\'4E\',\'e7\',\'e6\',\'dh\',\'2E\',\'7W\',\'46\',\'4C\',\'3Q\',\'8c\',\'9W\',\'4I\',\'6p\',\'6N\',\'9o\',\'2M\',\'2P\',\'cp\',\'ct\',\'1d\'],1S:[],5I:0,8W:{x:[\'bJ\',\'18\',\'4y\',\'3m\',\'bK\'],y:[\'6v\',\'16\',\'9D\',\'4H\',\'7J\']},7B:{},b2:{},b3:{},8c:{aH:{},26:{},az:{}},3X:[],6b:[],4i:{},4v:[],7u:[],5e:[],7m:{},7R:{},77:[],3J:/dV\\/4\\.0/.1b(4n.6d)?8:8R((4n.6d.5u().2s(/.+(?:av|dT|dS|1E)[\\/: ]([\\d.]+)/)||[0,\'0\'])[1]),1E:(W.6j&&!2c.3T),4z:/cu/.1b(4n.6d),6f:/dP.+av:1\\.[0-8].+dR/.1b(4n.6d),$:C(1v){q(1v)E W.7X(1v)},2o:C(28,3o){28[28.V]=3o},1c:C(ba,3W,4f,68,bb){A el=W.1c(ba);q(3W)m.3L(el,3W);q(bb)m.R(el,{7T:0,8v:\'1B\',9z:0});q(4f)m.R(el,4f);q(68)68.21(el);E el},3L:C(el,3W){O(A x 3a 3W)el[x]=3W[x];E el},R:C(el,4f){O(A x 3a 4f){q(m.1E&&x==\'1A\'){q(4f[x]>0.99)el.G.e4(\'6a\');J el.G.6a=\'b9(1A=\'+(4f[x]*2w)+\')\'}J el.G[x]=4f[x]}},2x:C(el,1g,3y){A 4A,5d,4s;q(1F 3y!=\'7z\'||3y===I){A 2H=bh;3y={4a:2H[2],2P:2H[3],6L:2H[4]}}q(1F 3y.4a!=\'3G\')3y.4a=5G;3y.2P=1h[3y.2P]||1h.b6;3y.7e=m.3L({},1g);O(A 3d 3a 1g){A e=1I m.fx(el,3y,3d);4A=8R(m.8t(el,3d))||0;5d=8R(1g[3d]);4s=3d!=\'1A\'?\'F\':\'\';e.3r(4A,5d,4s)}},8t:C(el,1g){q(W.7S){E W.7S.bx(el,I).ca(1g)}J{q(1g==\'1A\')1g=\'6a\';A 3o=el.6q[1g.2h(/\\-(\\w)/g,C(a,b){E b.b1()})];q(1g==\'6a\')3o=3o.2h(/b9\\(1A=([0-9]+)\\)/,C(a,b){E b/2w});E 3o===\'\'?1:3o}},7I:C(){A d=W,w=2c,5L=d.7G&&d.7G!=\'8S\'?d.56:d.1f;A M=m.1E?5L.8i:(d.56.8i||7c.e2),N=m.1E?5L.cK:7c.e0;m.4u={M:M,N:N,5w:m.1E?5L.5w:e1,5z:m.1E?5L.5z:cP}},6C:C(el){q(/5k/i.1b(el.3E)){A 73=W.2u(\'1N\');O(A i=0;i<73.V;i++){A u=73[i].cY;q(u&&u.2h(/^.*?#/,\'\')==el.22.3d){el=73[i];5i}}}A p={x:el.4F,y:el.80};4Z(el.b8){el=el.b8;p.x+=el.4F;p.y+=el.80;q(el!=W.1f&&el!=W.56){p.x-=el.5w;p.y-=el.5z}}E p},2F:C(a,26,3r,U){q(!a)a=m.1c(\'a\',I,{1n:\'1B\'},m.2a);q(1F a.5K==\'C\')E 26;q(U==\'3A\'){O(A i=0;i<m.4v.V;i++){q(m.4v[i]&&m.4v[i].a==a){m.4v[i].c8();m.4v[i]=I;E 1l}}m.aK=L}1w{1I m.69(a,26,3r,U);E 1l}1t(e){E L}},95:C(a,26,3r){E m.2F(a,26,3r,\'3A\')},9O:C(){E m.1c(\'Q\',{1a:\'K-3A-S\',2g:m.8a(m.8g.b5)})},4J:C(el,3E,1a){A 1m=el.2u(3E);O(A i=0;i<1m.V;i++){q((1I 5p(1a)).1b(1m[i].1a)){E 1m[i]}}E I},8a:C(s){s=s.2h(/\\s/g,\' \');A 2k=/{m\\.11\\.([^}]+)\\}/g,6i=s.2s(2k),11;q(6i)O(A i=0;i<6i.V;i++){11=6i[i].2h(2k,"$1");q(1F m.11[11]!=\'1T\')s=s.2h(6i[i],m.11[11])}E s},cf:C(){A 1m=W.2u(\'a\');O(A i=0;i<1m.V;i++){A U=m.aC(1m[i]);q(U&&!1m[i].aS){(C(){A t=U;q(m.1z(m,\'cX\',{7b:1m[i],U:t})){1m[i].2m=(U==\'2L\')?C(){E m.2F(k)}:C(){E m.95(k,{2E:t})}}})();1m[i].aS=L}}m.5Z()},aC:C(el){q(el.7k==\'K\')E\'2L\';J q(el.7k==\'K-2R\')E\'2R\';J q(el.7k==\'K-1i\')E\'1i\';J q(el.7k==\'K-3t\')E\'3t\'},7Y:C(a){O(A i=0;i<m.5e.V;i++){q(m.5e[i][0]==a){A c=m.5e[i][1];m.5e[i][1]=c.6s(1);E c}}E I},bG:C(e){A 28=m.5Z();O(A i=0;i<28.5s.V;i++){A a=28.5s[i];q(m.44(a,\'2E\')==\'2R\'&&m.44(a,\'7W\'))m.2o(m.7u,a)}m.7Z(0)},7Z:C(i){q(!m.7u[i])E;A a=m.7u[i];A 64=m.4x(m.44(a,\'9R\'));q(!64)64=m.9O();A 2R=1I m.7A(a,64,1);2R.8X=C(){};2R.3u=C(){m.2o(m.5e,[a,64]);m.7Z(i+1)};2R.94()},aL:C(){A 7V=0,7t=-1,14=m.14,B,1G;O(A i=0;i<14.V;i++){B=14[i];q(B){1G=B.T.G.1G;q(1G&&1G>7V){7V=1G;7t=i}}}q(7t==-1)m.30=-1;J 14[7t].3B()},44:C(a,5P){a.5K=a.2m;A p=a.5K?a.5K():I;a.5K=I;E(p&&1F p[5P]!=\'1T\')?p[5P]:(1F m[5P]!=\'1T\'?m[5P]:I)},76:C(a){A 1d=m.44(a,\'1d\');q(1d)E 1d;E a.23},4x:C(1v){A 1M=m.$(1v),4Q=m.7R[1v],a={};q(!1M&&!4Q)E I;q(!4Q){4Q=1M.6s(L);4Q.1v=\'\';m.7R[1v]=4Q;E 1M}J{E 4Q.6s(L)}},3D:C(d){q(d)m.97.21(d);m.97.2g=\'\'},1x:C(B){q(!m.2S){m.2S=m.1c(\'Q\',{1a:\'K-dd K-2B-D\',6e:\'\',2m:C(){q(m.1z(m,\'de\'))m.24()}},{1o:\'1Z\',1A:0},m.2a,L)}m.2S.G.1n=\'\';m.2S.6e+=\'|\'+B.P;q(m.6f&&m.aP)m.R(m.2S,{9K:\'7E(\'+m.4Y+\'d5.au)\',1A:1});J m.2x(m.2S,{1A:B.45},m.89)},93:C(P){q(!m.2S)E;q(1F P!=\'1T\')m.2S.6e=m.2S.6e.2h(\'|\'+P,\'\');q((1F P!=\'1T\'&&m.2S.6e!=\'\')||(m.2r&&m.44(m.2r,\'45\')))E;q(m.6f&&m.aP)m.2S.G.1n=\'1B\';J m.2x(m.2S,{1A:0},m.89,I,C(){m.2S.G.1n=\'1B\'})},8Q:C(7r,B){A 1j=B=B||m.2C();q(m.2r)E 1l;J m.1j=1j;1w{m.2r=7r;7r.2m()}1t(e){m.1j=m.2r=I}1w{q(!7r||B.3k[1]!=\'43\')B.24()}1t(e){}E 1l},7q:C(el,2p){A B=m.2C(el);q(B)E m.8Q(B.8V(2p),B);J E 1l},3c:C(el){E m.7q(el,-1)},1C:C(el){E m.7q(el,1)},6V:C(e){q(!e)e=2c.2y;q(!e.2G)e.2G=e.a0;q(1F e.2G.9X!=\'1T\')E L;q(!m.1z(m,\'cM\',e))E L;A B=m.2C();A 2p=I;aq(e.dg){2b 70:q(B)B.7v();E L;2b 32:2p=2;5i;2b 34:2b 39:2b 40:2p=1;5i;2b 8:2b 33:2b 37:2b 38:2p=-1;5i;2b 27:2b 13:2p=0}q(2p!==I){q(2p!=2)m.5n(W,2c.3T?\'9c\':\'9d\',m.6V);q(!m.aI)E L;q(e.4X)e.4X();J e.bl=1l;q(B){q(2p==0){B.24()}J q(2p==2){q(B.1p)B.1p.bm()}J{q(B.1p)B.1p.3h();m.7q(B.P,2p)}E 1l}}E L},df:C(Z){m.2o(m.1S,m.3L(Z,{1V:\'1V\'+m.5I++}))},d9:C(1r){A 3b=1r.2M;q(1F 3b==\'7z\'){O(A i=0;i<3b.V;i++){A o={};O(A x 3a 1r)o[x]=1r[x];o.2M=3b[i];m.2o(m.6b,o)}}J{m.2o(m.6b,1r)}},9P:C(7b,7p){A el,2k=/^K-T-([0-9]+)$/;el=7b;4Z(el.22){q(el.6T!==1T)E el.6T;q(el.1v&&2k.1b(el.1v))E el.1v.2h(2k,"$1");el=el.22}q(!7p){el=7b;4Z(el.22){q(el.3E&&m.6M(el)){O(A P=0;P<m.14.V;P++){A B=m.14[P];q(B&&B.a==el)E P}}el=el.22}}E I},2C:C(el,7p){q(1F el==\'1T\')E m.14[m.30]||I;q(1F el==\'3G\')E m.14[el]||I;q(1F el==\'9n\')el=m.$(el);E m.14[m.9P(el,7p)]||I},6M:C(a){E(a.2m&&a.2m.cA().2h(/\\s/g,\' \').2s(/m.(d2|e)d4/))},bj:C(){O(A i=0;i<m.14.V;i++)q(m.14[i]&&m.14[i].6n)m.aL()},1z:C(5Y,9T,2H){E 5Y&&5Y[9T]?(5Y[9T](5Y,2H)!==1l):L},8d:C(e){q(!e)e=2c.2y;q(e.d7>1)E L;q(!e.2G)e.2G=e.a0;A el=e.2G;4Z(el.22&&!(/K-(2L|3x|3A|3Y)/.1b(el.1a))){el=el.22}A B=m.2C(el);q(B&&(B.5D||!B.6n))E L;q(B&&e.U==\'88\'){q(e.2G.9X)E L;A 2s=el.1a.2s(/K-(2L|3x|3Y)/);q(2s){m.2v={B:B,U:2s[1],18:B.x.H,M:B.x.D,16:B.y.H,N:B.y.D,aM:e.7C,aN:e.7L};m.2n(W,\'7F\',m.6X);q(e.4X)e.4X();q(/K-(2L|3A)-9M/.1b(B.S.1a)){B.3B();m.9S=L}E 1l}J q(/K-3A/.1b(el.1a)&&m.30!=B.P){B.3B();B.55(\'1q\')}}J q(e.U==\'ce\'){m.5n(W,\'7F\',m.6X);q(m.2v){q(m.4W&&m.2v.U==\'2L\')m.2v.B.S.G.4t=m.4W;A 3S=m.2v.3S;q(!3S&&!m.9S&&!/(3x|3Y)/.1b(m.2v.U)){q(m.1z(B,\'d1\'))B.24()}J q(3S||(!3S&&m.aK)){m.2v.B.55(\'1q\')}q(m.2v.B.3K)m.2v.B.3K.G.1n=\'1B\';q(3S)m.1z(m.2v.B,\'dc\',m.2v);m.9S=1l;m.2v=I}J q(/K-2L-9M/.1b(el.1a)){el.G.4t=m.4W}}E 1l},6X:C(e){q(!m.2v)E L;q(!e)e=2c.2y;A a=m.2v,B=a.B;q(B.1i){q(!B.3K)B.3K=m.1c(\'Q\',I,{1k:\'2l\',M:B.x.D+\'F\',N:B.y.D+\'F\',18:B.x.cb+\'F\',16:B.y.cb+\'F\',1G:4,9K:(m.1E?\'da\':\'1B\'),1A:.cQ},B.T,L);q(B.3K.G.1n==\'1B\')B.3K.G.1n=\'\'}a.dX=e.7C-a.aM;a.dY=e.7L-a.aN;A 9V=1h.cN(1h.aQ(a.dX,2)+1h.aQ(a.dY,2));q(!a.3S)a.3S=(a.U!=\'2L\'&&9V>0)||(9V>(m.cT||5));q(a.3S&&e.7C>5&&e.7L>5){q(!m.1z(B,\'ey\',a))E 1l;q(a.U==\'3Y\')B.3Y(a);J{B.9B(a.18+a.dX,a.16+a.dY);q(a.U==\'2L\')B.S.G.4t=\'3x\'}}E 1l},aG:C(e){1w{q(!e)e=2c.2y;A 6t=/fJ/i.1b(e.U);q(!e.2G)e.2G=e.a0;q(m.1E)e.9Y=6t?e.fL:e.fM;A B=m.2C(e.2G);q(!B.6n)E;q(!B||!e.9Y||m.2C(e.9Y,L)==B||m.2v)E;m.1z(B,6t?\'fk\':\'fy\',e);O(A i=0;i<B.1S.V;i++)(C(){A o=m.$(\'1V\'+B.1S[i]);q(o&&o.7f){q(6t)m.R(o,{1o:\'1Z\',1n:\'\'});m.2x(o,{1A:6t?o.1A:0},o.41)}})()}1t(e){}},2n:C(el,2y,3U){q(el==W&&2y==\'42\')m.2o(m.77,3U);1w{el.2n(2y,3U,1l)}1t(e){1w{el.aF(\'6w\'+2y,3U);el.fv(\'6w\'+2y,3U)}1t(e){el[\'6w\'+2y]=3U}}},5n:C(el,2y,3U){1w{el.5n(2y,3U,1l)}1t(e){1w{el.aF(\'6w\'+2y,3U)}1t(e){el[\'6w\'+2y]=I}}},7j:C(i){q(m.9C&&m.6u[i]&&m.6u[i]!=\'1T\'){A 1N=W.1c(\'1N\');1N.4O=C(){1N=I;m.7j(i+1)};1N.1d=m.6u[i]}},cg:C(3G){q(3G&&1F 3G!=\'7z\')m.9b=3G;A 28=m.5Z();O(A i=0;i<28.5l.V&&i<m.9b;i++){m.2o(m.6u,m.76(28.5l[i]))}q(m.1Y)1I m.5A(m.1Y,C(){m.7j(0)});J m.7j(0);q(m.6r)A 54=m.1c(\'1N\',{1d:m.4Y+m.6r})},7y:C(){q(!m.2a){m.7I();m.5c=m.1E&&m.3J<7;m.c0=m.5c&&81.fw==\'fA:\';O(A x 3a m.7i){q(1F m[x]!=\'1T\')m.11[x]=m[x];J q(1F m.11[x]==\'1T\'&&1F m.7i[x]!=\'1T\')m.11[x]=m.7i[x]}m.2a=m.1c(\'Q\',{1a:\'K-2a\'},{1k:\'2l\',18:0,16:0,M:\'2w%\',1G:m.4w,9r:\'aE\'},W.1f,L);m.2q=m.1c(\'a\',{1a:\'K-2q\',2i:m.11.aD,2g:m.11.aR,23:\'bH:;\'},{1k:\'2l\',16:\'-4l\',1A:m.b7,1G:1},m.2a);m.97=m.1c(\'Q\',I,{1n:\'1B\'},m.2a);m.2B=m.1c(\'Q\',{1a:\'K-2B K-2B-D\'},{1o:(m.4z&&m.3J<cy)?\'1Z\':\'1q\'},m.2a,1);m.3v=m.1c(\'Q\',I,{aw:\'aA\',fQ:\'fP\'},I,L);1h.fS=C(t,b,c,d){E c*t/d+b};1h.b6=C(t,b,c,d){E c*(t/=d)*t+b};1h.8M=C(t,b,c,d){E-c*(t/=d)*(t-2)+b};m.c9=m.5c;m.bz=((2c.3T&&m.3J<9)||4n.aU==\'aT\'||(m.1E&&m.3J<5.5));m.1z(k,\'fT\')}},42:C(){q(m.9f)E;m.9f=L;O(A i=0;i<m.77.V;i++)m.77[i]()},85:C(){A el,1m,6j=[],5l=[],5s=[],3e={},2k;O(A i=0;i<m.91.V;i++){1m=W.2u(m.91[i]);O(A j=0;j<1m.V;j++){el=1m[j];2k=m.6M(el);q(2k){m.2o(6j,el);q(2k[0]==\'m.2F\')m.2o(5l,el);J q(2k[0]==\'m.95\')m.2o(5s,el);A g=m.44(el,\'2M\')||\'1B\';q(!3e[g])3e[g]=[];m.2o(3e[g],el)}}}m.4G={6j:6j,3e:3e,5l:5l,5s:5s};E m.4G},5Z:C(){E m.4G||m.85()},24:C(el){A B=m.2C(el);q(B)B.24();E 1l}};m.fx=C(36,1r,1g){k.1r=1r;k.36=36;k.1g=1g;q(!1r.bc)1r.bc={}};m.fx.4V={96:C(){(m.fx.3C[k.1g]||m.fx.3C.ac)(k);q(k.1r.3C)k.1r.3C.af(k.36,k.4L,k)},3r:C(8r,2d,4s){k.9u=(1I 7a()).79();k.4A=8r;k.5d=2d;k.4s=4s;k.4L=k.4A;k.H=k.9i=0;A 7c=k;C t(7d){E 7c.3C(7d)}t.36=k.36;q(t()&&m.3X.2o(t)==1){m.aY=fN(C(){A 3X=m.3X;O(A i=0;i<3X.V;i++)q(!3X[i]())3X.fG(i--,1);q(!3X.V){fE(m.aY)}},13)}},3C:C(7d){A t=(1I 7a()).79();q(7d||t>=k.1r.4a+k.9u){k.4L=k.5d;k.H=k.9i=1;k.96();k.1r.7e[k.1g]=L;A 9s=L;O(A i 3a k.1r.7e)q(k.1r.7e[i]!==L)9s=1l;q(9s){q(k.1r.6L)k.1r.6L.af(k.36)}E 1l}J{A n=t-k.9u;k.9i=n/k.1r.4a;k.H=k.1r.2P(n,0,1,k.1r.4a);k.4L=k.4A+((k.5d-k.4A)*k.H);k.96()}E L}};m.3L(m.fx,{3C:{1A:C(fx){m.R(fx.36,{1A:fx.4L})},ac:C(fx){1w{q(fx.36.G&&fx.36.G[fx.1g]!=I)fx.36.G[fx.1g]=fx.4L+fx.4s;J fx.36[fx.1g]=fx.4L}1t(e){}}}});m.5A=C(1Y,3u){k.3u=3u;k.1Y=1Y;A v=m.3J,4b;k.9v=m.1E&&v>=5.5&&v<7;q(!1Y){q(3u)3u();E}m.7y();k.2e=m.1c(\'2e\',{eE:0},{1o:\'1q\',1k:\'2l\',eD:\'eH\',M:0},m.2a,L);A 4M=m.1c(\'4M\',I,I,k.2e,1);k.2D=[];O(A i=0;i<=8;i++){q(i%3==0)4b=m.1c(\'4b\',I,{N:\'1P\'},4M,L);k.2D[i]=m.1c(\'2D\',I,I,4b,L);A G=i!=4?{eI:0,eL:0}:{1k:\'4m\'};m.R(k.2D[i],G)}k.2D[4].1a=1Y+\' K-1e\';k.a9()};m.5A.4V={a9:C(){A 1d=m.4Y+(m.eK||"eJ/")+k.1Y+".au";A ao=m.4z?m.2a:I;k.3N=m.1c(\'1N\',I,{1k:\'2l\',16:\'-4l\'},ao,L);A 3z=k;k.3N.4O=C(){3z.aj()};k.3N.1d=1d},aj:C(){A o=k.1y=k.3N.M/4,H=[[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],1x={N:(2*o)+\'F\',M:(2*o)+\'F\'};O(A i=0;i<=8;i++){q(H[i]){q(k.9v){A w=(i==1||i==7)?\'2w%\':k.3N.M+\'F\';A Q=m.1c(\'Q\',I,{M:\'2w%\',N:\'2w%\',1k:\'4m\',2j:\'1q\'},k.2D[i],L);m.1c(\'Q\',I,{6a:"es:er.bC.ep(eu=ev, 1d=\'"+k.3N.1d+"\')",1k:\'2l\',M:w,N:k.3N.N+\'F\',18:(H[i][0]*o)+\'F\',16:(H[i][1]*o)+\'F\'},Q,L)}J{m.R(k.2D[i],{9K:\'7E(\'+k.3N.1d+\') \'+(H[i][0]*o)+\'F \'+(H[i][1]*o)+\'F\'})}q(2c.3T&&(i==3||i==5))m.1c(\'Q\',I,1x,k.2D[i],L);m.R(k.2D[i],1x)}}k.3N=I;q(m.4i[k.1Y])m.4i[k.1Y].5v();m.4i[k.1Y]=k;q(k.3u)k.3u()},4D:C(H,1y,ah,41,2P){A B=k.B,5C=B.T.G,1y=1y||0,H=H||{x:B.x.H+1y,y:B.y.H+1y,w:B.x.Y(\'2f\')-2*1y,h:B.y.Y(\'2f\')-2*1y};q(ah)k.2e.G.1o=(H.h>=4*k.1y)?\'1Z\':\'1q\';m.R(k.2e,{18:(H.x-k.1y)+\'F\',16:(H.y-k.1y)+\'F\',M:(H.w+2*k.1y)+\'F\'});H.w-=2*k.1y;H.h-=2*k.1y;m.R(k.2D[4],{M:H.w>=0?H.w+\'F\':0,N:H.h>=0?H.h+\'F\':0});q(k.9v)k.2D[3].G.N=k.2D[5].G.N=k.2D[4].G.N},5v:C(ar){q(ar)k.2e.G.1o=\'1q\';J m.3D(k.2e)}};m.6O=C(B,1x){k.B=B;k.1x=1x;k.3f=1x==\'x\'?\'bV\':\'bO\';k.3j=k.3f.5u();k.5B=1x==\'x\'?\'c1\':\'bX\';k.6U=k.5B.5u();k.9p=1x==\'x\'?\'c3\':\'c7\';k.b0=k.9p.5u();k.1H=k.2Z=0};m.6O.4V={Y:C(P){aq(P){2b\'9F\':E k.1J+k.3i+(k.t-m.2q[\'1y\'+k.3f])/2;2b\'9G\':E k.H+k.cb+k.1H+(k.D-m.2q[\'1y\'+k.3f])/2;2b\'2f\':E k.D+2*k.cb+k.1H+k.2Z;2b\'52\':E k.4S-k.3n-k.4p;2b\'8h\':E k.Y(\'52\')-2*k.cb-k.1H-k.2Z;2b\'63\':E k.H-(k.B.1e?k.B.1e.1y:0);2b\'9w\':E k.Y(\'2f\')+(k.B.1e?2*k.B.1e.1y:0);2b\'2J\':E k.1W?1h.31((k.D-k.1W)/2):0}},83:C(){k.cb=(k.B.S[\'1y\'+k.3f]-k.t)/2;k.4p=m[\'9z\'+k.9p]},9Z:C(){k.t=k.B.el[k.3j]?3s(k.B.el[k.3j]):k.B.el[\'1y\'+k.3f];k.1J=k.B.1J[k.1x];k.3i=(k.B.el[\'1y\'+k.3f]-k.t)/2;q(k.1J==0||k.1J==-1){k.1J=(m.4u[k.3j]/2)+m.4u[\'29\'+k.5B]}},86:C(){A B=k.B;k.2O=\'1P\';q(B.9q==\'4y\')k.2O=\'4y\';J q(1I 5p(k.6U).1b(B.4c))k.2O=I;J q(1I 5p(k.b0).1b(B.4c))k.2O=\'4j\';k.H=k.1J-k.cb+k.3i;q(k.9o&&k.1x==\'x\')B.6N=1h.2Y(B.6N||k.19,B.9o*k.19/B.y.19);k.D=1h.2Y(k.19,B[\'4j\'+k.3f]||k.19);k.2N=B.5U?1h.2Y(B[\'2Y\'+k.3f],k.19):k.19;q(B.2I&&B.3w){k.D=B[k.3j];k.1W=k.19}q(k.1x==\'x\'&&m.5F)k.2N=B.4I;k.2G=B[\'2G\'+k.1x.b1()];k.3n=m[\'9z\'+k.5B];k.29=m.4u[\'29\'+k.5B];k.4S=m.4u[k.3j]},6W:C(i){A B=k.B;q(B.2I&&(B.3w||m.5F)){k.1W=i;k.D=1h.4j(k.D,k.1W);B.S.G[k.6U]=k.Y(\'2J\')+\'F\'}J k.D=i;B.S.G[k.3j]=i+\'F\';B.T.G[k.3j]=k.Y(\'2f\')+\'F\';q(B.1e)B.1e.4D();q(B.3K)B.3K.G[k.3j]=i+\'F\';q(k.1x==\'y\'&&B.5O&&B.1f.G.N!=\'1P\')1w{B.5O.1f.G.2j=\'1P\'}1t(e){}q(B.2z){A d=B.2t;q(k.92===1T)k.92=B.1s[\'1y\'+k.3f]-d[\'1y\'+k.3f];d.G[k.3j]=(k.D-k.92)+\'F\';q(k.1x==\'x\')B.48.G.M=\'1P\';q(B.1f)B.1f.G[k.3j]=\'1P\'}q(k.1x==\'x\'&&B.1u)B.5o(L);q(k.1x==\'x\'&&B.1p&&B.2I){q(i==k.19)B.1p.58(\'19-2F\');J B.1p.4R(\'19-2F\')}},9U:C(i){k.H=i;k.B.T.G[k.6U]=i+\'F\';q(k.B.1e)k.B.1e.4D()}};m.69=C(a,26,3r,3g){q(W.bu&&m.1E&&!m.9f){m.2n(W,\'42\',C(){1I m.69(a,26,3r,3g)});E}k.a=a;k.3r=3r;k.3g=3g||\'2L\';k.2z=(3g==\'3A\');k.2I=!k.2z;m.9C=1l;k.1S=[];k.1j=m.1j;m.1j=I;m.7y();A P=k.P=m.14.V;O(A i=0;i<m.a3.V;i++){A 3d=m.a3[i];k[3d]=26&&1F 26[3d]!=\'1T\'?26[3d]:m[3d]}q(!k.1d)k.1d=a.23;A el=(26&&26.87)?m.$(26.87):a;el=k.aB=el.2u(\'1N\')[0]||el;k.7O=el.1v||a.1v;q(!m.1z(k,\'f8\'))E L;O(A i=0;i<m.14.V;i++){q(m.14[i]&&m.14[i].a==a&&!(k.1j&&k.3k[1]==\'43\')){m.14[i].3B();E 1l}}q(!m.fc)O(A i=0;i<m.14.V;i++){q(m.14[i]&&m.14[i].aB!=el&&!m.14[i].6I){m.14[i].6B()}}m.14[P]=k;q(!m.9t&&!m.2r){q(m.14[P-1])m.14[P-1].24();q(1F m.30!=\'1T\'&&m.14[m.30])m.14[m.30].24()}k.el=el;k.1J=m.6C(el);m.7I();A x=k.x=1I m.6O(k,\'x\');x.9Z();A y=k.y=1I m.6O(k,\'y\');y.9Z();q(/5k/i.1b(el.3E))k.ak(el);k.T=m.1c(\'Q\',{1v:\'K-T-\'+k.P,1a:\'K-T \'+k.9W},{1o:\'1q\',1k:\'2l\',1G:m.4w+=2},I,L);k.T.f0=k.T.eT=m.aG;q(k.3g==\'2L\'&&k.3R==2)k.3R=0;q(!k.1Y||(k.1j&&k.2I&&k.3k[1]==\'43\')){k[k.3g+\'9J\']()}J q(m.4i[k.1Y]){k.9I();k[k.3g+\'9J\']()}J{k.65();A B=k;1I m.5A(k.1Y,C(){B.9I();B[B.3g+\'9J\']()})}E L};m.69.4V={9y:C(e){2c.81.23=k.1d},9I:C(){A 1e=k.1e=m.4i[k.1Y];1e.B=k;1e.2e.G.1G=k.T.G.1G-1;m.4i[k.1Y]=I},65:C(){q(k.6I||k.2q)E;k.2q=m.2q;A B=k;k.2q.2m=C(){B.6B()};q(!m.1z(k,\'eQ\'))E;A B=k,l=k.x.Y(\'9F\')+\'F\',t=k.y.Y(\'9F\')+\'F\';q(!2W&&k.1j&&k.3k[1]==\'43\')A 2W=k.1j;q(2W){l=2W.x.Y(\'9G\')+\'F\';t=2W.y.Y(\'9G\')+\'F\';k.2q.G.1G=m.4w++}49(C(){q(B.2q)m.R(B.2q,{18:l,16:t,1G:m.4w++})},2w)},eY:C(){A B=k;A 1N=W.1c(\'1N\');k.S=1N;1N.4O=C(){q(m.14[B.P])B.67()};q(m.eX)1N.eW=C(){E 1l};1N.1a=\'K-2L\';m.R(1N,{1o:\'1q\',1n:\'3M\',1k:\'2l\',6N:\'4l\',1G:3});1N.2i=m.11.9E;q(m.4z)m.2a.21(1N);q(m.1E&&m.eZ)1N.1d=I;1N.1d=k.1d;k.65()},eU:C(){q(!m.1z(k,\'eP\'))E;k.S=m.7Y(k.a);q(!k.S)k.S=m.4x(k.9R);q(!k.S)k.S=m.9O();k.a4([\'6E\']);q(k.6E){A 1f=m.4J(k.S,\'Q\',\'K-1f\');q(1f)1f.21(k.6E);k.6E.G.1n=\'3M\'}m.1z(k,\'eS\');A 1s=k.1s=k.S;q(/(3t|1i)/.1b(k.2E))k.8T(1s);m.2a.21(k.T);m.R(k.T,{1k:\'f1\',7T:\'0 \'+m.90+\'F 0 \'+m.4B+\'F\'});k.S=m.1c(\'Q\',{1a:\'K-3A\'},{1k:\'4m\',1G:3,2j:\'1q\'},k.T);k.48=m.1c(\'Q\',I,I,k.S,1);k.48.21(1s);m.R(1s,{1k:\'4m\',1n:\'3M\',9r:m.11.9m||\'\'});q(k.M)1s.G.M=k.M+\'F\';q(k.N)m.R(1s,{N:k.N+\'F\',2j:\'1q\'});q(1s.1R<k.4I)1s.G.M=k.4I+\'F\';q(k.2E==\'2R\'&&!m.7Y(k.a)){k.65();A B=k;A 2R=1I m.7A(k.a,1s);2R.1d=k.1d;2R.3u=C(){q(m.14[B.P])B.67()};2R.8X=C(){81.23=B.1d};2R.94()}J q(k.2E==\'1i\'&&k.3Q==\'60\'){k.6A()}J k.67()},67:C(){1w{q(!k.S)E;k.S.4O=I;q(k.6I)E;J k.6I=L;A x=k.x,y=k.y;q(k.2q){m.R(k.2q,{16:\'-4l\'});k.2q=I;m.1z(k,\'cl\')}q(k.2I){x.19=k.S.M;y.19=k.S.N;m.R(k.S,{M:x.t+\'F\',N:y.t+\'F\'});k.T.21(k.S);m.2a.21(k.T)}J q(k.7Q)k.7Q();x.83();y.83();m.R(k.T,{18:(x.1J+x.3i-x.cb)+\'F\',16:(y.1J+x.3i-y.cb)+\'F\'});k.9l();k.bT();A 2X=x.19/y.19;x.86();k.2O(x);y.86();k.2O(y);q(k.2z)k.b4();q(k.1u)k.5o(0,1);q(k.5U){q(k.2I)k.cr(2X);J k.7P();A 1O=k.1p;q(1O&&k.1j&&1O.2U&&1O.aJ){A H=1O.ch.1k||\'\',p;O(A 1x 3a m.8W)O(A i=0;i<5;i++){p=k[1x];q(H.2s(m.8W[1x][i])){p.H=k.1j[1x].H+(k.1j[1x].1H-p.1H)+(k.1j[1x].D-p.D)*[0,0,.5,1,1][i];q(1O.aJ==\'fb\'){q(p.H+p.D+p.1H+p.2Z>p.29+p.4S-p.4p)p.H=p.29+p.4S-p.D-p.3n-p.4p-p.1H-p.2Z;q(p.H<p.29+p.3n)p.H=p.29+p.3n}}}}q(k.2I&&k.x.19>(k.x.1W||k.x.D)){k.bI();q(k.1S.V==1)k.5o()}}k.9k()}1t(e){k.9y(e)}},8T:C(68,1P){A c=m.4J(68,\'7l\',\'K-1f\');q(/(1i|3t)/.1b(k.2E)){q(k.46)c.G.M=k.46+\'F\';q(k.4C)c.G.N=k.4C+\'F\'}},6A:C(){q(k.ay)E;A B=k;k.1f=m.4J(k.1s,\'7l\',\'K-1f\');q(k.2E==\'1i\'){k.65();A 53=m.3v.6s(1);k.1f.21(53);k.f2=k.1s.1R;q(!k.46)k.46=53.1R;A 5t=k.1s.1U-k.1f.1U,h=k.4C||m.4u.N-5t-m.5g-m.6z,4O=k.3Q==\'60\'?\' 4O="q (m.14[\'+k.P+\']) m.14[\'+k.P+\'].67()" \':\'\';k.1f.2g+=\'<1i 3d="m\'+(1I 7a()).79()+\'" f5="0" P="\'+k.P+\'" \'+\' G="M:\'+k.46+\'F; N:\'+h+\'F" \'+4O+\' 1d="\'+k.1d+\'" ></1i>\';k.53=k.1f.2u(\'Q\')[0];k.1i=k.1f.2u(\'1i\')[0];q(k.3Q==\'6l\')k.8u()}q(k.2E==\'3t\'){k.1f.1v=k.1f.1v||\'m-eO-1v-\'+k.P;A a=k.8c;q(!a.26)a.26={};q(1F a.26.aO==\'1T\')a.26.aO=\'eq\';q(9x)9x.et(k.1d,k.1f.1v,k.46,k.4C,a.eM||\'7\',a.eC,a.aH,a.26,a.az)}k.ay=L},7Q:C(){q(k.1i&&!k.4C){k.1i.G.N=k.1f.G.N=k.8H()+\'F\'}k.1s.21(m.3v);q(!k.x.19)k.x.19=k.1s.1R;k.y.19=k.1s.1U;k.1s.9h(m.3v);q(m.1E&&k.ax>3s(k.1s.6q.N)){k.ax=3s(k.1s.6q.N)}m.R(k.T,{1k:\'2l\',7T:\'0\'});m.R(k.S,{M:k.x.t+\'F\',N:k.y.t+\'F\'})},8H:C(){A h;1w{A 2A=k.5O=k.1i.9N||k.1i.5W.W;A 3v=2A.1c(\'Q\');3v.G.aw=\'aA\';2A.1f.21(3v);h=3v.80;q(m.1E)h+=3s(2A.1f.6q.5g)+3s(2A.1f.6q.6z)-1}1t(e){h=fD}E h},8u:C(){A 5f=k.1s.1R-k.53.1R;m.3D(k.53);q(5f<0)5f=0;A 5t=k.1s.1U-k.1i.1U;q(k.5O&&!k.4C&&!k.N&&k.y.D==k.y.19)1w{k.5O.1f.G.2j=\'1q\'}1t(e){}m.R(k.1i,{M:1h.a2(k.x.D-5f)+\'F\',N:1h.a2(k.y.D-5t)+\'F\'});m.R(k.1f,{M:k.1i.G.M,N:k.1i.G.N});k.5q=k.1i;k.2t=k.5q},b4:C(){k.8T(k.1s);q(k.2E==\'3t\'&&k.3Q==\'60\')k.6A();q(k.x.D<k.x.19&&!k.6Q)k.x.D=k.x.19;q(k.y.D<k.y.19&&!k.6R)k.y.D=k.y.19;k.2t=k.1s;m.R(k.48,{1k:\'4m\',M:k.x.D+\'F\'});m.R(k.1s,{8v:\'1B\',M:\'1P\',N:\'1P\'});A 1M=m.4J(k.1s,\'7l\',\'K-1f\');q(1M&&!/(1i|3t)/.1b(k.2E)){A 5b=1M;1M=m.1c(5b.fl,I,{2j:\'1q\'},I,L);5b.22.fm(1M,5b);1M.21(m.3v);1M.21(5b);A 5f=k.1s.1R-1M.1R;A 5t=k.1s.1U-1M.1U;1M.9h(m.3v);A 6G=m.4z||4n.aU==\'aT\'?1:0;m.R(1M,{M:(k.x.D-5f-6G)+\'F\',N:(k.y.D-5t)+\'F\',2j:\'1P\',1k:\'4m\'});q(6G&&5b.1U>1M.1U){1M.G.M=(3s(1M.G.M)+6G)+\'F\'}k.5q=1M;k.2t=k.5q}q(k.1i&&k.3Q==\'60\')k.8u();q(!k.5q&&k.y.D<k.48.1U)k.2t=k.S;q(k.2t==k.S&&!k.6Q&&!/(1i|3t)/.1b(k.2E)){k.x.D+=17}q(k.2t&&k.2t.1U>k.2t.22.1U){49("1w { m.14["+k.P+"].2t.G.2j = \'1P\'; } 1t(e) {}",m.6Z)}},ak:C(5k){A c=5k.fj.7o(\',\');O(A i=0;i<c.V;i++)c[i]=3s(c[i]);q(5k.fg.5u()==\'fs\'){k.x.1J+=c[0]-c[2];k.y.1J+=c[1]-c[2];k.x.t=k.y.t=2*c[2]}J{A 5R,5H,5J=5R=c[0],6o=5H=c[1];O(A i=0;i<c.V;i++){q(i%2==0){5J=1h.2Y(5J,c[i]);5R=1h.4j(5R,c[i])}J{6o=1h.2Y(6o,c[i]);5H=1h.4j(5H,c[i])}}k.x.1J+=5J;k.x.t=5R-5J;k.y.1J+=6o;k.y.t=5H-6o}},2O:C(p,57){A 4K,2W=p.2G,1x=p==k.x?\'x\':\'y\';q(2W&&2W.2s(/ /)){4K=2W.7o(\' \');2W=4K[0]}q(2W&&m.$(2W)){p.H=m.6C(m.$(2W))[1x];q(4K&&4K[1]&&4K[1].2s(/^[-]?[0-9]+F$/))p.H+=3s(4K[1]);q(p.D<p.2N)p.D=p.2N}J q(p.2O==\'1P\'||p.2O==\'4y\'){A 8b=1l;A 5a=p.B.5U;q(p.2O==\'4y\')p.H=1h.31(p.29+(p.4S+p.3n-p.4p-p.Y(\'2f\'))/2);J p.H=1h.31(p.H-((p.Y(\'2f\')-p.t)/2));q(p.H<p.29+p.3n){p.H=p.29+p.3n;8b=L}q(!57&&p.D<p.2N){p.D=p.2N;5a=1l}q(p.H+p.Y(\'2f\')>p.29+p.4S-p.4p){q(!57&&8b&&5a){p.D=1h.2Y(p.D,p.Y(1x==\'y\'?\'52\':\'8h\'))}J q(p.Y(\'2f\')<p.Y(\'52\')){p.H=p.29+p.4S-p.4p-p.Y(\'2f\')}J{p.H=p.29+p.3n;q(!57&&5a)p.D=p.Y(1x==\'y\'?\'52\':\'8h\')}}q(!57&&p.D<p.2N){p.D=p.2N;5a=1l}}J q(p.2O==\'4j\'){p.H=1h.fr(p.H-p.D+p.t)}q(p.H<p.3n){A cs=p.H;p.H=p.3n;q(5a&&!57)p.D=p.D-(p.H-cs)}},cr:C(2X){A x=k.x,y=k.y,3P=1l,35=1h.2Y(x.19,x.D),3Z=1h.2Y(y.19,y.D),3w=(k.3w||m.5F);q(35/3Z>2X){ 35=3Z*2X;q(35<x.2N){35=x.2N;3Z=35/2X}3P=L}J q(35/3Z<2X){ 3Z=35/2X;3P=L}q(m.5F&&x.19<x.2N){x.1W=x.19;y.D=y.1W=y.19}J q(k.3w){x.1W=35;y.1W=3Z}J{x.D=35;y.D=3Z}3P=k.7P(3w?I:2X,3P);q(3w&&y.D<y.1W){y.1W=y.D;x.1W=y.D*2X}q(3P||3w){x.H=x.1J-x.cb+x.3i;x.2N=x.D;k.2O(x,L);y.H=y.1J-y.cb+y.3i;y.2N=y.D;k.2O(y,L);q(k.1u)k.5o()}},7P:C(2X,3P){A x=k.x,y=k.y;q(k.1u&&(k.2I||k.6R)){4Z(y.D>k.6p&&x.D>k.4I&&y.Y(\'2f\')>y.Y(\'52\')){y.D-=10;q(2X)x.D=y.D*2X;k.5o(0,1);3P=L}}E 3P},fq:C(){q(k.2t){A h=/1i/i.1b(k.2t.3E)?(k.8H()+1)+\'F\':\'1P\';q(k.1f)k.1f.G.N=h;k.2t.G.N=h;k.y.6W(k.1s.1U)}},9k:C(){A x=k.x,y=k.y;k.55(\'1q\');m.1z(k,\'ff\');q(k.1p&&k.1p.2K)k.1p.2K.5m();k.9e(1,{T:{M:x.Y(\'2f\'),N:y.Y(\'2f\'),18:x.H,16:y.H},S:{18:x.1H+x.Y(\'2J\'),16:y.1H+y.Y(\'2J\'),M:x.1W||x.D,N:y.1W||y.D}},m.6Z)},9e:C(1K,2d,41){A 5S=k.3k,8U=1K?(k.1j?k.1j.a:I):m.2r,t=(5S[1]&&8U&&m.44(8U,\'3k\')[1]==5S[1])?5S[1]:5S[0];q(k[t]&&t!=\'2F\'){k[t](1K,2d);E}q(k.1e&&!k.3R){q(1K)k.1e.4D();J k.1e.5v((k.2z&&k.4E))}q(!1K)k.72();A B=k,x=B.x,y=B.y,2P=k.2P;q(!1K)2P=k.cp||2P;A 6l=1K?C(){q(B.1e)B.1e.2e.G.1o="1Z";49(C(){B.6S()},50)}:C(){B.5Q()};q(1K)m.R(k.T,{M:x.t+\'F\',N:y.t+\'F\'});q(1K&&k.2z){m.R(k.T,{18:(x.1J-x.cb+x.3i)+\'F\',16:(y.1J-y.cb+y.3i)+\'F\'})}q(k.ct){m.R(k.T,{1A:1K?0:1});m.3L(2d.T,{1A:1K})}m.2x(k.T,2d.T,{4a:41,2P:2P,3C:C(3o,2H){q(B.1e&&B.3R&&2H.1g==\'16\'){A 6m=1K?2H.H:1-2H.H;A H={w:x.t+(x.Y(\'2f\')-x.t)*6m,h:y.t+(y.Y(\'2f\')-y.t)*6m,x:x.1J+(x.H-x.1J)*6m,y:y.1J+(y.H-y.1J)*6m};B.1e.4D(H,0,1)}q(B.2z){q(2H.1g==\'18\')B.48.G.18=(x.H-3o)+\'F\';q(2H.1g==\'16\')B.48.G.16=(y.H-3o)+\'F\'}}});m.2x(k.S,2d.S,41,2P,6l);q(1K){k.T.G.1o=\'1Z\';k.S.G.1o=\'1Z\';q(k.2z)k.1s.G.1o=\'1Z\';k.a.1a+=\' K-4k-4c\'}},5M:C(1K,2d){k.3R=1l;A B=k,t=1K?m.6Z:0;q(1K){m.2x(k.T,2d.T,0);m.R(k.T,{1A:0,1o:\'1Z\'});m.2x(k.S,2d.S,0);k.S.G.1o=\'1Z\';m.2x(k.T,{1A:1},t,I,C(){B.6S()})}q(k.1e){k.1e.2e.G.1G=k.T.G.1G;A 6Y=1K||-1,1y=k.1e.1y,8m=1K?3:1y,8q=1K?1y:3;O(A i=8m;6Y*i<=6Y*8q;i+=6Y,t+=25){(C(){A o=1K?8q-i:8m-i;49(C(){B.1e.4D(0,o,1)},t)})()}}q(1K){}J{49(C(){q(B.1e)B.1e.5v(B.4E);B.72();m.2x(B.T,{1A:0},m.8Y,I,C(){B.5Q()})},t)}},43:C(1K,2d,8r){q(!1K)E;A B=k,1j=k.1j,x=k.x,y=k.y,3q=1j.x,3p=1j.y,T=k.T,S=k.S,1u=k.1u;m.5n(W,\'7F\',m.6X);m.R(S,{M:(x.1W||x.D)+\'F\',N:(y.1W||y.D)+\'F\'});q(1u)1u.G.2j=\'1Z\';k.1e=1j.1e;q(k.1e)k.1e.B=B;1j.1e=I;A 59=m.1c(\'Q\',{1a:\'K-2L\'},{1k:\'2l\',1G:4,2j:\'1q\',1n:\'1B\'});A 8J={co:1j,cn:k};O(A n 3a 8J){k[n]=8J[n].S.6s(1);m.R(k[n],{1k:\'2l\',8v:0,1o:\'1Z\'});59.21(k[n])}T.21(59);q(k.2z)m.R(k.48,{18:0,16:0});q(1u){1u.1a=\'\';T.21(1u)}59.G.1n=\'\';1j.S.G.1n=\'1B\';q(m.4z){A 2s=4n.6d.2s(/cu\\/([0-9]{3})/);q(2s&&3s(2s[1])<cy)k.T.G.1o=\'1Z\'}m.2x(T,{M:x.D},{4a:m.cx,3C:C(3o,2H){A H=2H.H,4o=1-H;A 1g,D={},8k=[\'H\',\'D\',\'1H\',\'2Z\'];O(A n 3a 8k){1g=8k[n];D[\'x\'+1g]=1h.31(4o*3q[1g]+H*x[1g]);D[\'y\'+1g]=1h.31(4o*3p[1g]+H*y[1g]);D.cw=1h.31(4o*(3q.1W||3q.D)+H*(x.1W||x.D));D.6J=1h.31(4o*3q.Y(\'2J\')+H*x.Y(\'2J\'));D.cv=1h.31(4o*(3p.1W||3p.D)+H*(y.1W||y.D));D.6K=1h.31(4o*3p.Y(\'2J\')+H*y.Y(\'2J\'))}q(B.1e)B.1e.4D({x:D.3l,y:D.4N,w:D.6g+D.47+D.8o+2*x.cb,h:D.6h+D.4d+D.8B+2*y.cb});1j.T.G.fo=\'fn(\'+(D.4N-3p.H)+\'F, \'+(D.6g+D.47+D.8o+D.3l+2*3q.cb-3q.H)+\'F, \'+(D.6h+D.4d+D.8B+D.4N+2*3p.cb-3p.H)+\'F, \'+(D.3l-3q.H)+\'F)\';m.R(S,{16:(D.4d+y.Y(\'2J\'))+\'F\',18:(D.47+x.Y(\'2J\'))+\'F\',5g:(y.H-D.4N)+\'F\',4B:(x.H-D.3l)+\'F\'});m.R(T,{16:D.4N+\'F\',18:D.3l+\'F\',M:(D.47+D.8o+D.6g+2*x.cb)+\'F\',N:(D.4d+D.8B+D.6h+2*y.cb)+\'F\'});m.R(59,{M:(D.cw||D.6g)+\'F\',N:(D.cv||D.6h)+\'F\',18:(D.47+D.6J)+\'F\',16:(D.4d+D.6K)+\'F\',1o:\'1Z\'});m.R(B.co,{16:(3p.H-D.4N+3p.1H-D.4d+3p.Y(\'2J\')-D.6K)+\'F\',18:(3q.H-D.3l+3q.1H-D.47+3q.Y(\'2J\')-D.6J)+\'F\'});m.R(B.cn,{1A:H,16:(y.H-D.4N+y.1H-D.4d+y.Y(\'2J\')-D.6K)+\'F\',18:(x.H-D.3l+x.1H-D.47+x.Y(\'2J\')-D.6J)+\'F\'});q(1u)m.R(1u,{M:D.6g+\'F\',N:D.6h+\'F\',18:(D.47+x.cb)+\'F\',16:(D.4d+y.cb)+\'F\'})},6L:C(){T.G.1o=S.G.1o=\'1Z\';S.G.1n=\'3M\';59.G.1n=\'1B\';B.a.1a+=\' K-4k-4c\';B.6S();1j.5Q();B.1j=I}})},c4:C(o,el){q(!k.1j)E 1l;O(A i=0;i<k.1j.1S.V;i++){A 6P=m.$(\'1V\'+k.1j.1S[i]);q(6P&&6P.1V==o.1V){k.a1();6P.fX=k.P;m.2o(k.1S,k.1j.1S[i]);E L}}E 1l},6S:C(){k.6n=L;k.3B();q(k.2z&&k.3Q==\'6l\')k.6A();q(k.1i){1w{A B=k,2A=k.1i.9N||k.1i.5W.W;m.2n(2A,\'88\',C(){q(m.30!=B.P)B.3B()})}1t(e){}q(m.1E&&1F k.5D!=\'fR\')k.1i.G.M=(k.46-1)+\'F\'}q(k.45)m.1x(k);q(m.2r&&m.2r==k.a)m.2r=I;k.cc();A p=m.4u,8F=m.7B.x+p.5w,8E=m.7B.y+p.5z;k.8Z=k.x.H<8F&&8F<k.x.H+k.x.Y(\'2f\')&&k.y.H<8E&&8E<k.y.H+k.y.Y(\'2f\');q(k.1u)k.c6();m.1z(k,\'fV\')},cc:C(){A P=k.P;A 1Y=k.1Y;1I m.5A(1Y,C(){1w{m.14[P].cd()}1t(e){}})},cd:C(){A 1C=k.8V(1);q(1C&&1C.2m.cA().2s(/m\\.2F/))A 1N=m.1c(\'1N\',{1d:m.76(1C)})},8V:C(2p){A 8f=k.7x(),as=m.4G.3e[k.2M||\'1B\'];q(!as[8f+2p]&&k.1p&&k.1p.bt){q(2p==1)E as[0];J q(2p==-1)E as[as.V-1]}E as[8f+2p]||I},7x:C(){A 28=m.5Z().3e[k.2M||\'1B\'];q(28)O(A i=0;i<28.V;i++){q(28[i]==k.a)E i}E I},bQ:C(){q(k[k.66]){A 28=m.4G.3e[k.2M||\'1B\'];q(28){A s=m.11.3G.2h(\'%1\',k.7x()+1).2h(\'%2\',28.V);k[k.66].2g=\'<Q 1X="K-3G">\'+s+\'</Q>\'+k[k.66].2g}}},9l:C(){q(!k.1j){O(A i=0;i<m.6b.V;i++){A 1O=m.6b[i],3b=1O.2M;q(1F 3b==\'1T\'||3b===I||3b===k.2M)k.1p=1I m.84(k.P,1O)}}J{k.1p=k.1j.1p}A 1O=k.1p;q(!1O)E;A P=1O.4h=k.P;1O.bF();1O.58(\'19-2F\');q(1O.2U){A o=1O.ch||{};o.4T=1O.2U;o.1V=\'2U\';k.4P(o)}q(1O.2K)1O.2K.7h(k);q(!k.1j&&k.3V)1O.3O(L);q(1O.3V){1O.3V=49(C(){m.1C(P)},(1O.fe||eG))}},6B:C(){m.3D(k.T);m.14[k.P]=I;q(m.2r==k.a)m.2r=I;m.93(k.P);q(k.2q)m.2q.G.18=\'-4l\';m.1z(k,\'cl\')},bP:C(){q(k.5y)E;k.5y=m.1c(\'a\',{23:m.ck,2G:m.cj,1a:\'K-5y\',2g:m.11.cz,2i:m.11.cL});k.4P({4T:k.5y,1k:k.cJ||\'16 18\',1V:\'5y\'})},a4:C(82,cE){O(A i=0;i<82.V;i++){A U=82[i],s=I;q(U==\'9H\'&&!m.1z(k,\'eF\'))E;J q(U==\'5h\'&&!m.1z(k,\'ez\'))E;q(!k[U+\'5r\']&&k.7O)k[U+\'5r\']=U+\'-O-\'+k.7O;q(k[U+\'5r\'])k[U]=m.4x(k[U+\'5r\']);q(!k[U]&&!k[U+\'8e\']&&k[U+\'cB\'])1w{s=ew(k[U+\'cB\'])}1t(e){}q(!k[U]&&k[U+\'8e\']){s=k[U+\'8e\']}q(!k[U]&&!s){k[U]=m.4x(k.a[\'cH\'+U+\'5r\']);q(!k[U]){A 1C=k.a.cD;4Z(1C&&!m.6M(1C)){q((1I 5p(\'K-\'+U)).1b(1C.1a||I)){q(!1C.1v)k.a[\'cH\'+U+\'5r\']=1C.1v=\'1V\'+m.5I++;k[U]=m.4x(1C.1v);5i}1C=1C.cD}}}q(!k[U]&&!s&&k.66==U)s=\'\\n\';q(!k[U]&&s)k[U]=m.1c(\'Q\',{1a:\'K-\'+U,2g:s});q(cE&&k[U]){A o={1k:(U==\'5h\')?\'6v\':\'7J\'};O(A x 3a k[U+\'cF\'])o[x]=k[U+\'cF\'][x];o.4T=k[U];k.4P(o)}}},55:C(1o){q(m.c9)k.6H(\'fa\',1o);q(m.bz)k.6H(\'f9\',1o);q(m.6f)k.6H(\'*\',1o)},6H:C(3E,1o){A 1m=W.2u(3E);A 1g=3E==\'*\'?\'2j\':\'1o\';O(A i=0;i<1m.V;i++){q(1g==\'1o\'||(W.7S.bx(1m[i],"").ca(\'2j\')==\'1P\'||1m[i].bw(\'1q-by\')!=I)){A 2Q=1m[i].bw(\'1q-by\');q(1o==\'1Z\'&&2Q){2Q=2Q.2h(\'[\'+k.P+\']\',\'\');1m[i].62(\'1q-by\',2Q);q(!2Q)1m[i].G[1g]=1m[i].9Q}J q(1o==\'1q\'){A 3F=m.6C(1m[i]);3F.w=1m[i].1R;3F.h=1m[i].1U;q(!k.45){A bA=(3F.x+3F.w<k.x.Y(\'63\')||3F.x>k.x.Y(\'63\')+k.x.Y(\'9w\'));A bB=(3F.y+3F.h<k.y.Y(\'63\')||3F.y>k.y.Y(\'63\')+k.y.Y(\'9w\'))}A 6F=m.9P(1m[i]);q(!bA&&!bB&&6F!=k.P){q(!2Q){1m[i].62(\'1q-by\',\'[\'+k.P+\']\');1m[i].9Q=1m[i].G[1g];1m[i].G[1g]=\'1q\'}J q(2Q.be(\'[\'+k.P+\']\')==-1){1m[i].62(\'1q-by\',2Q+\'[\'+k.P+\']\')}}J q((2Q==\'[\'+k.P+\']\'||m.30==6F)&&6F!=k.P){1m[i].62(\'1q-by\',\'\');1m[i].G[1g]=1m[i].9Q||\'\'}J q(2Q&&2Q.be(\'[\'+k.P+\']\')>-1){1m[i].62(\'1q-by\',2Q.2h(\'[\'+k.P+\']\',\'\'))}}}}},3B:C(){k.T.G.1G=m.4w+=2;O(A i=0;i<m.14.V;i++){q(m.14[i]&&i==m.30){A 4r=m.14[i];4r.S.1a+=\' K-\'+4r.3g+\'-9M\';q(4r.2I){4r.S.G.4t=m.1E?\'bf\':\'7D\';4r.S.2i=m.11.bk}m.1z(4r,\'eV\')}}q(k.1e)k.1e.2e.G.1G=k.T.G.1G-1;k.S.1a=\'K-\'+k.3g;q(k.2I){k.S.2i=m.11.9E;q(m.6r){m.4W=2c.3T?\'7D\':\'7E(\'+m.4Y+m.6r+\'), 7D\';q(m.1E&&m.3J<6)m.4W=\'bf\';k.S.G.4t=m.4W}}m.30=k.P;m.2n(W,2c.3T?\'9c\':\'9d\',m.6V);m.1z(k,\'eR\')},9B:C(x,y){k.x.9U(x);k.y.9U(y)},3Y:C(e){A w,h,r=e.M/e.N;w=1h.4j(e.M+e.dX,1h.2Y(k.4I,k.x.19));q(k.2I&&1h.a2(w-k.x.19)<12)w=k.x.19;h=k.2z?e.N+e.dY:w/r;q(h<1h.2Y(k.6p,k.y.19)){h=1h.2Y(k.6p,k.y.19);q(k.2I)w=h*r}k.9A(w,h)},9A:C(w,h){k.y.6W(h);k.x.6W(w);k.T.G.N=k.y.Y(\'2f\')+\'F\'},24:C(){q(k.5D||!k.6n)E;q(k.3k[1]==\'43\'&&m.2r){m.2C(m.2r).6B();m.2r=I}q(!m.1z(k,\'f7\'))E;k.5D=L;q(k.1p&&!m.2r)k.1p.3h();m.5n(W,2c.3T?\'9c\':\'9d\',m.6V);1w{q(k.2z)k.bZ();k.S.G.4t=\'f3\';k.9e(0,{T:{M:k.x.t,N:k.y.t,18:k.x.1J-k.x.cb+k.x.3i,16:k.y.1J-k.y.cb+k.y.3i},S:{18:0,16:0,M:k.x.t,N:k.y.t}},m.8Y)}1t(e){k.5Q()}},bZ:C(){q(m.6f){q(!m.5x)m.5x=m.1c(\'Q\',I,{1k:\'2l\'},m.2a);m.R(m.5x,{M:k.x.D+\'F\',N:k.y.D+\'F\',18:k.x.H+\'F\',16:k.y.H+\'F\',1n:\'3M\'})}q(k.2E==\'3t\')1w{m.$(k.1f.1v).f4()}1t(e){}q(k.3Q==\'6l\'&&!k.4E)k.c2();q(k.2t&&k.2t!=k.5q)k.2t.G.2j=\'1q\'},c2:C(){q(m.1E&&k.1i)1w{k.1i.5W.W.1f.2g=\'\'}1t(e){}q(k.2E==\'3t\')9x.f6(k.1f.1v);k.1f.2g=\'\'},bi:C(){q(k.1e)k.1e.2e.G.1n=\'1B\';k.3K=I;k.T.G.1n=\'1B\';m.2o(m.4v,k)},c8:C(){1w{m.14[k.P]=k;q(!m.9t&&m.30!=k.P){1w{m.14[m.30].24()}1t(e){}}A z=m.4w++,5C={1n:\'\',1G:z};m.R(k.T,5C);k.5D=1l;A o=k.1e||0;q(o){q(!k.3R)5C.1o=\'1q\';m.R(o.2e,5C)}q(k.1p){k.9l()}k.9k()}1t(e){}},4P:C(o){A el=o.4T,4U=(o.bN==\'2B\'&&!/7H$/.1b(o.1k));q(1F el==\'9n\')el=m.4x(el);q(o.3A)el=m.1c(\'Q\',{2g:o.3A});q(!el||1F el==\'9n\')E;q(!m.1z(k,\'eN\',{Z:el}))E;el.G.1n=\'3M\';o.1V=o.1V||o.4T;q(k.3k[1]==\'43\'&&k.c4(o,el))E;k.a1();A M=o.M&&/^[0-9]+(F|%)$/.1b(o.M)?o.M:\'1P\';q(/^(18|3m)7H$/.1b(o.1k)&&!/^[0-9]+F$/.1b(o.M))M=\'ex\';A Z=m.1c(\'Q\',{1v:\'1V\'+m.5I++,1V:o.1V},{1k:\'2l\',1o:\'1q\',M:M,9r:m.11.9m||\'\',1A:0},4U?m.2B:k.1u,L);q(4U)Z.6T=k.P;Z.21(el);m.3L(Z,{1A:1,bM:0,bL:0,41:(o.5M===0||o.5M===1l||(o.5M==2&&m.1E))?0:5G});m.3L(Z,o);q(k.bW){k.5E(Z);q(!Z.7f||k.8Z)m.2x(Z,{1A:Z.1A},Z.41)}m.2o(k.1S,m.5I-1)},5E:C(Z){A p=Z.1k||\'9D 4y\',4U=(Z.bN==\'2B\'),71=Z.bM,6y=Z.bL;q(4U){m.2B.G.1n=\'3M\';Z.6T=k.P;q(Z.1R>Z.22.1R)Z.G.M=\'2w%\'}J q(Z.22!=k.1u)k.1u.21(Z);q(/18$/.1b(p))Z.G.18=71+\'F\';q(/4y$/.1b(p))m.R(Z,{18:\'50%\',4B:(71-1h.31(Z.1R/2))+\'F\'});q(/3m$/.1b(p))Z.G.3m=-71+\'F\';q(/^bJ$/.1b(p)){m.R(Z,{3m:\'2w%\',90:k.x.cb+\'F\',16:-k.y.cb+\'F\',4H:-k.y.cb+\'F\',2j:\'1P\'});k.x.1H=Z.1R}J q(/^bK$/.1b(p)){m.R(Z,{18:\'2w%\',4B:k.x.cb+\'F\',16:-k.y.cb+\'F\',4H:-k.y.cb+\'F\',2j:\'1P\'});k.x.2Z=Z.1R}A 98=Z.22.1U;Z.G.N=\'1P\';q(4U&&Z.1U>98)Z.G.N=m.5c?98+\'F\':\'2w%\';q(/^16/.1b(p))Z.G.16=6y+\'F\';q(/^9D/.1b(p))m.R(Z,{16:\'50%\',5g:(6y-1h.31(Z.1U/2))+\'F\'});q(/^4H/.1b(p))Z.G.4H=-6y+\'F\';q(/^6v$/.1b(p)){m.R(Z,{18:(-k.x.1H-k.x.cb)+\'F\',3m:(-k.x.2Z-k.x.cb)+\'F\',4H:\'2w%\',6z:k.y.cb+\'F\',M:\'1P\'});k.y.1H=Z.1U}J q(/^7J$/.1b(p)){m.R(Z,{1k:\'4m\',18:(-k.x.1H-k.x.cb)+\'F\',3m:(-k.x.2Z-k.x.cb)+\'F\',16:\'2w%\',5g:k.y.cb+\'F\',M:\'1P\'});k.y.2Z=Z.1U;Z.G.1k=\'2l\'}},bT:C(){k.a4([\'5h\',\'9H\'],L);k.bQ();q(k.9H)m.1z(k,\'eA\');q(k.5h)m.1z(k,\'eB\');q(k.5h&&k.9L)k.5h.1a+=\' K-3x\';q(m.bR)k.bP();O(A i=0;i<m.1S.V;i++){A o=m.1S[i],6D=o.87,3b=o.2M;q((!6D&&!3b)||(6D&&6D==k.7O)||(3b&&3b===k.2M)){q(k.2I||(k.2z&&o.fd))k.4P(o)}}A 7N=[];O(A i=0;i<k.1S.V;i++){A o=m.$(\'1V\'+k.1S[i]);q(/7H$/.1b(o.1k))k.5E(o);J m.2o(7N,o)}O(A i=0;i<7N.V;i++)k.5E(7N[i]);k.bW=L},a1:C(){q(!k.1u)k.1u=m.1c(\'Q\',{1a:k.9W},{1k:\'2l\',M:(k.x.D||(k.3w?k.M:I)||k.x.19)+\'F\',N:(k.y.D||k.y.19)+\'F\',1o:\'1q\',2j:\'1q\',1G:m.1E?4:\'1P\'},m.2a,L)},5o:C(9g,c5){A 1u=k.1u,x=k.x,y=k.y;m.R(1u,{M:x.D+\'F\',N:y.D+\'F\'});q(9g||c5){O(A i=0;i<k.1S.V;i++){A o=m.$(\'1V\'+k.1S[i]);A 9a=(m.5c||W.7G==\'8S\');q(o&&/^(6v|7J)$/.1b(o.1k)){q(9a){o.G.M=(1u.1R+2*x.cb+x.1H+x.2Z)+\'F\'}y[o.1k==\'6v\'?\'1H\':\'2Z\']=o.1U}q(o&&9a&&/^(18|3m)7H$/.1b(o.1k)){o.G.N=(1u.1U+2*y.cb)+\'F\'}}}q(9g){m.R(k.S,{16:y.1H+\'F\'});m.R(1u,{16:(y.1H+y.cb)+\'F\'})}},c6:C(){A b=k.1u;b.1a=\'\';m.R(b,{16:(k.y.1H+k.y.cb)+\'F\',18:(k.x.1H+k.x.cb)+\'F\',2j:\'1Z\'});q(m.4z)b.G.1o=\'1Z\';k.T.21(b);O(A i=0;i<k.1S.V;i++){A o=m.$(\'1V\'+k.1S[i]);o.G.1G=o.1V==\'2U\'?5:4;q(!o.7f||k.8Z){o.G.1o=\'1Z\';m.R(o,{1o:\'1Z\',1n:\'\'});m.2x(o,{1A:o.1A},o.41)}}},72:C(){q(!k.1S.V)E;q(k.1p){A c=k.1p.2U;q(c&&m.2C(c)==k)c.22.9h(c)}O(A i=0;i<k.1S.V;i++){A o=m.$(\'1V\'+k.1S[i]);q(o&&o.22==m.2B&&m.2C(o)==k)m.3D(o)}q(k.2z&&k.4E){k.1u.G.16=\'-4l\';m.2a.21(k.1u)}J m.3D(k.1u)},bI:C(){q(k.1p&&k.1p.2U){k.1p.4R(\'19-2F\');E}k.7g=m.1c(\'a\',{23:\'bH:m.14[\'+k.P+\'].7v();\',2i:m.11.9j,1a:\'K-19-2F\'});q(!m.1z(k,\'fH\'))E;k.4P({4T:k.7g,1k:m.bn,7f:L,1A:m.bp})},7v:C(){1w{q(!m.1z(k,\'fF\'))E;q(k.7g)m.3D(k.7g);k.3B();A 35=k.x.D;k.9A(k.x.19,k.y.19);A 3l=k.x.H-(k.x.D-35)/2;q(3l<m.4B)3l=m.4B;k.9B(3l,k.y.H);k.55(\'1q\')}1t(e){k.9y(e)}},5Q:C(){k.a.1a=k.a.1a.2h(\'K-4k-4c\',\'\');k.55(\'1Z\');q(k.2z&&k.4E&&k.3k[1]!=\'43\'){k.bi()}J{q(k.1e&&k.3R)k.1e.5v();m.3D(k.T)}q(m.5x)m.5x.G.1n=\'1B\';k.72();q(!m.2B.7K.V)m.2B.G.1n=\'1B\';q(k.45)m.93(k.P);m.1z(k,\'fO\');m.14[k.P]=I;m.bj()}};m.7A=C(a,S,7s){k.a=a;k.S=S;k.7s=7s};m.7A.4V={94:C(){A 2T;q(!k.1d)k.1d=m.76(k.a);q(k.1d.2s(\'#\')){A 28=k.1d.7o(\'#\');k.1d=28[0];k.1v=28[1]}q(m.7m[k.1d]){k.cq=m.7m[k.1d];q(k.1v)k.a5();J k.5X();E}1w{2T=1I cI()}1t(e){1w{2T=1I bs("fU.bE")}1t(e){1w{2T=1I bs("bC.bE")}1t(e){k.8X()}}}A 3z=k;2T.fW=C(){q(3z.2T.bu==4){q(3z.1v)3z.a5();J 3z.5X()}};A 1d=k.1d;k.2T=2T;q(m.fh)1d=1d.2h(/$/,(/\\?/.1b(1d)?\'&\':\'?\')+\'fi=\'+(1I 7a()).79());2T.cC(\'fp\',1d,L);2T.cm(\'X-eo-ft\',\'cI\');2T.cm(\'fu-fB\',\'fz/x-fC-9X-fI\');2T.fK(I)},a5:C(){m.7y();A 3W=2c.3T||m.c0?{1d:\'cV:cS\'}:I;k.1i=m.1c(\'1i\',3W,{1k:\'2l\',16:\'-4l\'},m.2a);k.5X()},5X:C(){A s=k.cq||k.2T.cO,7n;q(k.7s)m.7m[k.1d]=s;q(!m.1E||m.3J>=5.5){s=s.2h(1I 5p(\'<d3[^>]*>\',\'cG\'),\'\').2h(1I 5p(\'<ci[^>]*>.*?</ci>\',\'cG\'),\'\');q(k.1i){A 2A=k.1i.9N;q(!2A&&k.1i.5W)2A=k.1i.5W.W;q(!2A){A 3z=k;49(C(){3z.5X()},25);E}2A.cC();2A.d8(s);2A.24();1w{s=2A.7X(k.1v).2g}1t(e){1w{s=k.1i.W.7X(k.1v).2g}1t(e){}}m.3D(k.1i)}J{7n=/(<1f[^>]*>|<\\/1f>)/d0;q(7n.1b(s))s=s.7o(7n)[m.1E?1:2]}}m.4J(k.S,\'7l\',\'K-1f\').2g=s;k.3u();O(A x 3a k)k[x]=I}};m.84=C(4h,1r){q(m.d6!==1l)m.85();k.4h=4h;O(A x 3a 1r)k[x]=1r[x];q(k.cU)k.bv();q(k.2K)k.2K=m.bo(k)};m.84.4V={bv:C(){k.2U=m.1c(\'Q\',{2g:m.8a(m.8g.2U)},I,m.2a);A 61=[\'3O\',\'3h\',\'3c\',\'1C\',\'3x\',\'19-2F\',\'24\'];k.1Q={};A 3z=k;O(A i=0;i<61.V;i++){k.1Q[61[i]]=m.4J(k.2U,\'1L\',\'K-\'+61[i]);k.4R(61[i])}k.1Q.3h.G.1n=\'1B\'},bF:C(){q(k.bt||!k.2U)E;A B=m.14[k.4h],54=B.7x(),2k=/7w$/;q(54==0)k.58(\'3c\');J q(2k.1b(k.1Q.3c.2u(\'a\')[0].1a))k.4R(\'3c\');q(54+1==m.4G.3e[B.2M||\'1B\'].V){k.58(\'1C\');k.58(\'3O\')}J q(2k.1b(k.1Q.1C.2u(\'a\')[0].1a)){k.4R(\'1C\');k.4R(\'3O\')}},4R:C(1Q){q(!k.1Q)E;A bg=k,a=k.1Q[1Q].2u(\'a\')[0],2k=/7w$/;a.2m=C(){bg[1Q]();E 1l};q(2k.1b(a.1a))a.1a=a.1a.2h(2k,\'\')},58:C(1Q){q(!k.1Q)E;A a=k.1Q[1Q].2u(\'a\')[0];a.2m=C(){E 1l};q(!/7w$/.1b(a.1a))a.1a+=\' 7w\'},bm:C(){q(k.3V)k.3h();J k.3O()},3O:C(bq){q(k.1Q){k.1Q.3O.G.1n=\'1B\';k.1Q.3h.G.1n=\'\'}k.3V=L;q(!bq)m.1C(k.4h)},3h:C(){q(k.1Q){k.1Q.3h.G.1n=\'1B\';k.1Q.3O.G.1n=\'\'}db(k.3V);k.3V=I},3c:C(){k.3h();m.3c(k.1Q.3c)},1C:C(){k.3h();m.1C(k.1Q.1C)},3x:C(){},\'19-2F\':C(){m.2C().7v()},24:C(){m.24(k.1Q.24)}};m.bo=C(1p){C 7h(B){m.3L(1r||{},{4T:4q,1V:\'2K\',1a:\'K-2K-\'+5j+\'-Z \'+(1r.1a||\'\')});q(m.5c)1r.5M=0;B.4P(1r);m.R(4q.22,{2j:\'1q\'})};C 29(3H){5m(1T,1h.31(3H*4q[3I?\'1R\':\'1U\']*0.7))};C 5m(i,8K){q(i===1T)O(A j=0;j<6c.V;j++){q(6c[j]==m.14[1p.4h].a){i=j;5i}}q(i===1T)E;A as=4q.2u(\'a\'),4k=as[i],4e=4k.22,18=3I?\'c1\':\'bX\',3m=3I?\'c3\':\'c7\',M=3I?\'bV\':\'bO\',4F=\'1y\'+18,1R=\'1y\'+M,78=Q.22.22[1R],51=78-2e[1R],5T=3s(2e.G[3I?\'18\':\'16\'])||0,2V=5T,cR=20;q(8K!==1T){2V=5T-8K;q(51>0)51=0;q(2V>0)2V=0;q(2V<51)2V=51}J{O(A j=0;j<as.V;j++)as[j].1a=\'\';4k.1a=\'K-4k-4c\';A 8D=i>0?as[i-1].22[4F]:4e[4F],8G=4e[4F]+4e[1R]+(as[i+1]?as[i+1].22[1R]:0);q(8G>78-5T)2V=78-8G;J q(8D<-5T)2V=-8D}A 8L=4e[4F]+(4e[1R]-74[1R])/2+2V;m.2x(2e,3I?{18:2V}:{16:2V},I,\'8M\');m.2x(74,3I?{18:8L}:{16:8L},I,\'8M\');8P.G.1n=2V<0?\'3M\':\'1B\';8C.G.1n=(2V>51)?\'3M\':\'1B\'};A 6c=m.4G.3e[m.14[1p.4h].2M||\'1B\'],1r=1p.2K,5j=1r.5j||\'bS\',8O=(5j==\'cW\'),4g=8O?[\'Q\',\'5V\',\'1L\',\'1D\']:[\'2e\',\'4M\',\'4b\',\'2D\'],3I=(5j==\'bS\'),4q=m.1c(\'Q\',{1a:\'K-2K K-2K-\'+5j,2g:\'<Q 1X="K-2K-cZ">\'+\'<\'+4g[0]+\'><\'+4g[1]+\'></\'+4g[1]+\'></\'+4g[0]+\'></Q>\'+\'<Q 1X="K-29-1K"><Q></Q></Q>\'+\'<Q 1X="K-29-en"><Q></Q></Q>\'+\'<Q 1X="K-74"><Q></Q></Q>\'},{1n:\'1B\'},m.2a),6x=4q.7K,Q=6x[0],8P=6x[1],8C=6x[2],74=6x[3],2e=Q.e3,4M=4q.2u(4g[1])[0],4b;O(A i=0;i<6c.V;i++){q(i==0||!3I)4b=m.1c(4g[2],I,I,4M);(C(){A a=6c[i],4e=m.1c(4g[3],I,I,4b),e5=i;m.1c(\'a\',{23:a.23,2m:C(){m.2C(k).3B();E m.8Q(a)},2g:m.bU?m.bU(a):a.2g},I,4e)})()}q(!8O){8P.2m=C(){29(-1)};8C.2m=C(){29(1)};m.2n(4M,W.dZ!==1T?\'dW\':\'dQ\',C(e){A 3H=0;e=e||2c.2y;q(e.bY){3H=e.bY/dU;q(m.3T)3H=-3H}J q(e.br){3H=-e.br/3}q(3H)29(-3H*0.2);q(e.4X)e.4X();e.bl=1l})}E{7h:7h,5m:5m}};m.7i=m.11;A ee=m.69;q(m.1E){(C(){1w{W.56.e9(\'18\')}1t(e){49(bh.e8,50);E}m.42()})()}m.2n(W,\'ea\',m.42);m.2n(2c,\'7U\',m.42);m.2n(W,\'42\',C(){q(m.7M||m.45){A G=m.1c(\'G\',{U:\'eb/8t\'},I,W.2u(\'ec\')[0]);C 6k(8z,8l){q(!m.1E){G.21(W.dO(8z+" {"+8l+"}"))}J{A 1j=W.bD[W.bD.V-1];q(1F(1j.6k)=="7z")1j.6k(8z,8l)}}C 5N(1g){E\'dN( ( ( dt = W.56.\'+1g+\' ? W.56.\'+1g+\' : W.1f.\'+1g+\' ) ) + \\\'F\\\' );\'}q(m.7M)6k(\'.K 1N\',\'4t: 7E(\'+m.4Y+m.7M+\'), 7D !dl;\');6k(\'.K-2B-D\',m.1E&&(m.3J<7||W.7G==\'8S\')?\'1k: 2l; \'+\'18:\'+5N(\'5w\')+\'16:\'+5N(\'5z\')+\'M:\'+5N(\'8i\')+\'N:\'+5N(\'cK\'):\'1k: dH; M: 2w%; N: 2w%; 18: 0; 16: 0\')}});m.2n(2c,\'3Y\',C(){m.7I();q(m.2B)O(A i=0;i<m.2B.7K.V;i++){A 1M=m.2B.7K[i],B=m.2C(1M);B.5E(1M);q(1M.1V==\'2K\')B.1p.2K.5m()}});m.2n(W,\'7F\',C(e){m.7B={x:e.7C,y:e.7L}});m.2n(W,\'88\',m.8d);m.2n(W,\'ce\',m.8d);m.2n(W,\'42\',m.cf);m.2n(2c,\'7U\',m.cg);m.2n(2c,\'7U\',m.bG)}',62,990,'||||||||||||||||||||this||hs||||if||||||||||var|exp|function|size|return|px|style|pos|null|else|highslide|true|width|height|for|key|div|setStyles|content|wrapper|type|length|document||get|overlay||lang|||expanders||top||left|full|className|test|createElement|src|outline|body|prop|Math|iframe|last|position|false|els|display|visibility|slideshow|hidden|options|innerContent|catch|overlayBox|id|try|dim|offset|fireEvent|opacity|none|next|span|ie|typeof|zIndex|p1|new|tpos|up|li|node|img|ss|auto|btn|offsetWidth|overlays|undefined|offsetHeight|hsId|imgSize|class|outlineType|visible||appendChild|parentNode|href|close||params||arr|scroll|container|case|window|to|table|wsize|innerHTML|replace|title|overflow|re|absolute|onclick|addEventListener|push|op|loading|upcoming|match|scrollerDiv|getElementsByTagName|dragArgs|100|animate|event|isHtml|doc|viewport|getExpander|td|objectType|expand|target|args|isImage|imgPad|thumbstrip|image|slideshowGroup|minSize|justify|easing|hiddenBy|ajax|dimmer|xhr|controls|tblPos|tgt|ratio|min|p2|focusKey|round||||xSize|elem||||in|sg|previous|name|groups|ucwh|contentType|pause|tb|wh|transitions|xpos|right|marginMin|val|lastY|lastX|custom|parseInt|swf|onLoad|clearing|useBox|move|opt|pThis|html|focus|step|discardElement|tagName|elPos|number|delta|isX|uaVersion|releaseMask|extend|block|graphic|play|changed|objectLoadTime|outlineWhileAnimating|hasDragged|opera|func|autoplay|attribs|timers|resize|ySize||dur|ready|crossfade|getParam|dimmingOpacity|objectWidth|xp1|mediumContent|setTimeout|duration|tr|anchor|yp1|cell|styles|tree|expKey|pendingOutlines|max|active|9999px|relative|navigator|invPos|marginMax|dom|blurExp|unit|cursor|page|sleeping|zIndexCounter|getNode|center|safari|start|marginLeft|objectHeight|setPosition|preserveContent|offsetLeft|anchors|bottom|minWidth|getElementByClass|tgtArr|now|tbody|ypos|onload|createOverlay|clone|enable|clientSize|overlayId|relToVP|prototype|styleRestoreCursor|preventDefault|graphicsDir|while||minTblPos|fitsize|ruler|cur|doShowHide|documentElement|moveOnly|disable|fadeBox|allowReduce|cNode|ieLt7|end|cacheBindings|wDiff|marginTop|heading|break|mode|area|images|selectThumb|removeEventListener|sizeOverlayBox|RegExp|scrollingContent|Id|htmls|hDiff|toLowerCase|destroy|scrollLeft|mask|credits|scrollTop|Outline|uclt|stl|isClosing|positionOverlay|padToMinWidth|250|maxY|idCounter|minX|getParams|iebody|fade|fix|iDoc|param|afterClose|maxX|trans|curTblPos|allowSizeReduction|ul|contentWindow|loadHTML|obj|getAnchors|before|buttons|setAttribute|opos|cache|showLoading|numberPosition|contentLoaded|parent|Expander|filter|slideshows|group|userAgent|owner|geckoMac|xsize|ysize|matches|all|addRule|after|fac|isExpanded|minY|minHeight|currentStyle|restoreCursor|cloneNode|over|preloadTheseImages|above|on|domCh|offY|marginBottom|writeExtendedContent|cancelLoading|getPosition|tId|maincontent|wrapperKey|kdeBugCorr|showHideElements|onLoadStarted|ximgPad|yimgPad|complete|isHsAnchor|maxWidth|Dimension|oDiv|allowWidthReduction|allowHeightReduction|afterExpand|hsKey|lt|keyHandler|setSize|dragHandler|dir|expandDuration||offX|destroyOverlays|imgs|marker||getSrc|onReady|overlayWidth|getTime|Date|element|self|gotoEnd|curAnim|hideOnMouseOut|fullExpandLabel|add|langDefaults|preloadFullImage|rel|DIV|cachedGets|regBody|split|expOnly|previousOrNext|adj|pre|topmostKey|preloadTheseAjax|doFullExpand|disabled|getAnchorIndex|init|object|Ajax|mouse|clientX|pointer|url|mousemove|compatMode|panel|getPageSize|below|childNodes|clientY|expandCursor|os|thumbsUserSetId|fitOverlayBox|htmlGetSize|clones|defaultView|padding|load|topZ|cacheAjax|getElementById|getCacheBinding|preloadAjaxElement|offsetTop|location|types|calcBorders|Slideshow|updateAnchors|calcExpanded|thumbnailId|mousedown|dimmingDuration|replaceLang|hasMovedMin|swfOptions|mouseClickHandler|Text|current|skin|maxsize|clientWidth|moveText|props|dec|startOff|closeTitle|xp2|closeText|endOff|from|moveTitle|css|correctIframeSize|border|previousTitle|previousText|nextText|sel|nextTitle|yp2|scrollDown|activeLeft|mY|mX|activeRight|getIframePageHeight|Click|names|scrollBy|markerPos|easeOutQuad|arrow|floatMode|scrollUp|transit|parseFloat|BackCompat|setObjContainerSize|other|getAdjacentAnchor|oPos|onError|restoreDuration|mouseIsOver|marginRight|openerTagNames|sizeDiff|undim|run|htmlExpand|update|garbageBin|parOff||ie6|numberOfImagesToPreload|keypress|keydown|changeSize|isReady|doWrapper|removeChild|state|fullExpandTitle|show|initSlideshow|cssDirection|string|maxHeight|ucrb|align|direction|done|allowMultipleInstances|startTime|hasAlphaImageLoader|osize|swfobject|error|margin|resizeTo|moveTo|continuePreloading|middle|restoreTitle|loadingPos|loadingPosXfade|caption|connectOutline|Create|background|dragByHeading|blur|contentDocument|getSelfRendered|getWrapperKey|origProp|contentId|hasFocused|evt|setPos|distance|wrapperClassName|form|relatedTarget|calcThumb|srcElement|genOverlayBox|abs|overrides|getInline|getElementContent|playText|JS|Next|preloadGraphic|Highslide|pauseTitle|_default|Move|Previous|call|spacebar|vis|and|onGraphicLoad|getImageMapAreaCorrection|Play|Close|200|appendTo|Pause|switch|hide||playTitle|png|rv|clear|newHeight|hasExtendedContent|attributes|both|thumb|isUnobtrusiveAnchor|loadingTitle|ltr|detachEvent|wrapperMouseHandler|flashvars|enableKeyListener|fixedControls|hasHtmlExpanders|focusTopmost|clickX|clickY|wmode|dimmingGeckoFix|pow|loadingText|hsHasSetClick|KDE|vendor|targetX|targetY|resizeTitle|timerId|fullExpandText|rb|toUpperCase|headingOverlay|captionOverlay|htmlSizeOperations|contentWrapper|easeInQuad|loadingOpacity|offsetParent|alpha|tag|nopad|orig|pauseText|indexOf|hand|sls|arguments|sleep|reOrder|focusTitle|returnValue|hitSpace|fullExpandPosition|Thumbstrip|fullExpandOpacity|wait|detail|ActiveXObject|repeat|readyState|getControls|getAttribute|getComputedStyle||hideIframes|clearsX|clearsY|Microsoft|styleSheets|XMLHTTP|checkFirstAndLast|preloadAjax|javascript|createFullExpand|leftpanel|rightpanel|offsetY|offsetX|relativeTo|Height|writeCredits|getNumber|showCredits|horizontal|getOverlays|stripItemFormatter|Width|gotOverlays|Top|wheelDelta|htmlPrepareClose|ie6SSL|Left|destroyObject|Right|reuseOverlay|doPanels|showOverlays|Bottom|awake|hideSelects|getPropertyValue||prepareNextOutline|preloadNext|mouseup|setClickEvents|preloadImages|overlayOptions|script|creditsTarget|creditsHref|onHideLoading|setRequestHeader|newImg|oldImg|easingClose|cachedGet|correctRatio|tmpMin|fadeInOut|Safari|yimgSize|ximgSize|transitionDuration|525|creditsText|toString|Eval|open|nextSibling|addOverlay|Overlay|gi|_|XMLHttpRequest|creditsPosition|clientHeight|creditsTitle|onKeyDown|sqrt|responseText|pageYOffset|01|mgnRight|blank|dragSensitivity|useControls|about|float|onSetClickEvent|useMap|inner|ig|onImageClick|htmlE|link|xpand|geckodimmer|dynamicallyUpdateAnchors|button|write|addSlideshow|white|clearTimeout|onDrop|dimming|onDimmerClick|registerOverlay|keyCode|maincontentEval|graphics|zoomin|zoomout|important|keys|drag|Use|1001|outlineStartOffset|drop|shadow|ignoreMe|_self|http|com|click|of|Expand|actual|front|bring|Loading|cancel|Powered|Go|fixed|Image|Resize|esc|the|homepage|expression|createTextNode|Macintosh|DOMMouseScroll|Gecko|ra|it|120|Trident|mousewheel|||onmousewheel|innerHeight|pageXOffset|innerWidth|firstChild|removeAttribute|pI|maincontentText|maincontentId|callee|doScroll|DOMContentLoaded|text|HEAD|header|HsExpander|footer|headingText|headingEval|headingId|captionEval|captionId||captionText|down|Requested|AlphaImageLoader|transparent|DXImageTransform|progid|embedSWF|sizingMethod|scale|eval|200px|onDrag|onBeforeGetHeading|onAfterGetCaption|onAfterGetHeading|expressInstallSwfurl|borderCollapse|cellSpacing|onBeforeGetCaption|500|collapse|lineHeight|outlines|outlinesDir|fontSize|version|onCreateOverlay|flash|onBeforeGetContent|onShowLoading|onFocus|onAfterGetContent|onmouseout|htmlCreate|onBlur|oncontextmenu|blockRightClick|imageCreate|flushImgSize|onmouseover|static|newWidth|default|StopPlay|frameborder|removeSWF|onBeforeClose|onInit|IFRAME|SELECT|fit|allowSimultaneousLoading|useOnHtml|interval|onBeforeExpand|shape|forceAjaxReload|dummy|coords|onMouseOver|nodeName|insertBefore|rect|clip|GET|reflow|floor|circle|With|Content|attachEvent|protocol||onMouseOut|application|https|Type|www|300|clearInterval|onDoFullExpand|splice|onCreateFullExpand|urlencoded|mouseover|send|fromElement|toElement|setInterval|onAfterClose|1px|paddingTop|boolean|linearTween|onActivate|Msxml2|onAfterExpand|onreadystatechange|reuse'.split('|'),0,{}))
formcheckLanguage = {
	required: "This field is required.",
	alpha: "This field accepts alphabetic characters only.",
	alphanum: "This field accepts alphanumeric characters only.",
	nodigit: "No digits are accepted.",
	digit: "Please enter a valid integer.",
	digitmin: "The number must be at least %0",
	digitltd: "The value must be between %0 and %1",
	number: "Please enter a valid number.",
	email: "Please enter a valid email: <br /><span>E.g. yourname@domain.com</span>",
	image : 'This field should only contain image types',
	phone: "Please enter a valid phone.",
	url: "Please enter a valid url: <br /><span>E.g. http://www.domain.com</span>",
	
	confirm: "This field is different from %0",
	differs: "This value must be different of %0",
	length_str: "The length is incorrect, it must be between %0 and %1",
	length_fix: "The length is incorrect, it must be exactly %0 characters",
	lengthmax: "The length is incorrect, it must be at max %0",
	lengthmin: "The length is incorrect, it must be at least %0",
	words_min : "This field must concain at least %0 words, currently: %1 words",
	words_range : "This field must contain %0-%1 words, currently: %2 words",
	words_max : "This field must contain at max %0 words, currently: %1 words",
	checkbox: "Please check the box",
	radios: "Please select a radio",
	select: "Please choose a value"
}/*
	Class: FormCheck
		Performs different tests on forms and indicates errors.
		
	Usage:
		Works with these types of fields :
		- input (text, radio, checkbox)
		- textarea
		- select
		
		You just need to add a specific class to each fields you want to check. 
		For example, if you add the class
			(code)
			validate['required','length[4, -1]','differs[email]','digit']
			(end code)
		the value's field must be set (required) with a minimum length of four chars (4, -1), 
		must differs of the input named email (differs[email]), and must be digit. 
		
		You can perform check during the datas entry or on the submit action, shows errors as tips or in a div before or after the field, 
		show errors one by one or all together, show a list of all errors at the top of the form, localize error messages, add new regex check, ...
		
		The layout is design only with css. Now I added a hack to use transparent png with IE6, so you can use png images in formcheck.css (works only for theme, so the file must be named formcheck.css). It can also works with multiple forms on a single html page.
		The class supports now internationalization. To use it, simply specify a new <script> element in your html head, like this : <script type="text/javascript" src="formcheck/lang/fr.js"></script>.

		If you add the class
			(code)
			validate['submit']
			(end code)
		to an element like an anchor (or anything else), this element will act as a submit button.
		
		N.B. : you must load the language script before the formcheck and this method overpass the old way. You can create new languages following existing ones. You can otherwise still specifiy the alerts' strings when you initialize the Class, with options.
		If you don't use a language script, the alert will be displayed in english.
	
	Test type:
		You can perform various test on fields by adding them to the validate class. Be careful to *not use space chars*. Here is the list of them.
			
		required 					- The field becomes required. This is a regex, you can change it with class options.
		alpha 						- The value is restricted to alphabetic chars. This is a regex, you can change it with class options.
		alphanum 					- The value is restricted to alphanumeric characters only. This is a regex, you can change it with class options.
		nodigit 					- The field doesn't accept digit chars. This is a regex, you can change it with class options.
		digit 						- The value is restricted to digit (no floating point number) chars, you can pass two arguments (f.e. digit[21,65]) to limit the number between them. Use -1 as second argument to not set a maximum.
		number 						- The value is restricted to number, including floating point number. This is a regex, you can change it with class options.
		email 						- The value is restricted to valid email. This is a regex, you can change it with class options.
		image						- The value is restricted to images (jpg, jpeg, png, gif, bmp). This is a regex, you can change it with class options.
		phone 						- The value is restricted to phone chars. This is a regex, you can change it with class options.
		phone_inter					- The value is restricted to international phone number. This is a regex, you can change it with class options.
		url: 						- The value is restricted to url. This is a regex, you can change it with class options.
		confirm 					- The value has to be the same as the one passed in argument. f.e. confirm[password].
		differs 					- The value has to be diferent as the one passed in argument. f.e. differs[user].
		length 						- The value length is restricted by argument (f.e. length[6,10]). Use -1 as second argument to not set a maximum.
		words						- The words number is limited by arguments. f.e. words[1,13]. Use -1 as second argument to don't have a max limit.
		target						- It's not really a validation test, but it allows you to attach the error message to an other element, usefull if the input you validate is hidden. You must specifiy target id, f.e. target:myDiv.
		
		You can also use a custom function to check a field. For example, if you have a field with class
			(code)
			validate['required','%customCheck']
			(end code)
		the function customCheck(el) will be called to validate the field. '%customcheck' works with other validate(s) together, and '~customcheck' works if the element pass the other validate(s). 
		Here is an example of what customCheck could look : 
			(code)
			function customCheck(el){
				if (!el.value.test(/^[A-Z]/)) {
					el.errors.push("Username should begin with an uppercase letter"); 
					return false;
				} else {
					return true;
				}
			}
			(end code)
		
		It is now possible to register new fields after a new FormCheck call by using <FormCheck::register> (see <FormCheck::dispose> too). You need first to add the validate class to the element you want to register ( $('myInput').addClass("validate['required']") ).
		
	Parameters:
		When you initialize the class with addEvent, you can set some options. If you want to modify regex, you must do it in a hash, like for display or alert. You can also add new regex check method by adding the regex and an alert with the same name.
		
		Required:
			
			form_id - The id of the formular. This is required.
			
		Optional:
		
			submit					- If you turn this option to false, the FormCheck will only perform a validation, without submitting the form, even on success. You can use validateSuccess event to execute some code.
			
			submitByAjax 			- you can set this to true if you want to submit your form with ajax. You should use provided events to handle the ajax request (see below). By default it is false.
			ajaxResponseDiv 		- id of element to inject ajax response into (can also use onAjaxSuccess). By default it is false.
			ajaxEvalScripts 		- use evalScripts in the Request response. Can be true or false, by default it is false.
			onAjaxRequest 			- Function to fire when the Request event starts.
			onAjaxSuccess 			- Function to fire when the Request receives .  Args: response [the request response] - see Mootools docs for Request.onSuccess.
			onAjaxFailure 			- Function to fire if the Request fails.
			
			onSubmit				- Function to fire when form is submited (so before validation)
			onValidateSuccess 		- Function to fire when validation pass (you should prevent form submission with option submit:false to use this)
			onValidateFailure		- Function to fire when validation fails
			
			tipsClass 				- The class to apply to tipboxes' errors. By default it is 'fc-tbx'.
			errorClass 				- The class to apply to alertbox (not tips). By default it is 'fc-error'.
			fieldErrorClass 		- The class to apply to fields with errors, except for radios. You should also turn on  options.addClassErrorToField. By default it is 'fc-field-error'
			
			trimValue				- If set to true, strip whitespace (or other characters) from the beginning and end of values. By default it is false.
			validateDisabled		- If set to true, disabled input will be validated too, otherwise not.

		Display:
			This is a hash of display settings. in here you can modify.
			
			showErrors 				- 0 : onSubmit, 1 : onSubmit & onBlur, by default it is 0.
			titlesInsteadNames		- 0 : When you do a check using differs or confirm, it takes the field name for the alert. If it's set to 1, it will use the title instead of the name.
			errorsLocation 			- 1 : tips, 2 : before, 3 : after, by default it is 1.
			indicateErrors 			- 0 : none, 1 : one by one, 2 : all, by default it is 1.
			indicateErrorsInit		- 0 : determine if the form must be checked on initialize. Could be usefull to force the user to update fields that don't validate.
			keepFocusOnError 		- 0 : normal behaviour, 1 : the current field keep the focus as it remain errors. By default it is 0.
			checkValueIfEmpty 		- 0 : When you leave a field and you have set the showErrors option to 1, the value is tested only if a value has been set. 1 : The value is tested  in any case.  By default it is 1.
			addClassErrorToField 	- 0 : no class is added to the field, 1 : the options.fieldErrorClass is added to the field with an error (except for radio). By default it is 0.
			removeClassErrorOnTipClosure - 0 : Error class is kept when the tip is closed, 1 : Error class is removed when the tip is closed

			fixPngForIe 			- 0 : do nothing, 1 : fix png alpha for IE6 in formcheck.css. By default it is 1.
			replaceTipsEffect 		- 0 : No effect on tips replace when we resize the broswer, 1: tween transition on browser resize;
			closeTipsButton 		- 0 : the close button of the tipbox is hidden, 1 : the close button of the tipbox is visible. By default it is 1.
			flashTips 				- 0 : normal behaviour, 1 : the tipbox "flash" (disappear and reappear) if errors remain when the form is submitted. By default it is 0.
			tipsPosition 			- 'right' : the tips box is placed on the right part of the field, 'left' to place it on the left part. By default it is 'right'.
			tipsOffsetX 			- Horizontal position of the tips box (margin-left), , by default it is 100 (px).
			tipsOffsetY				- Vertical position of the tips box (margin-bottom), , by default it is -10 (px).
			
			listErrorsAtTop 		- List all errors at the top of the form, , by default it is false.
			scrollToFirst 			- Smooth scroll the page to first error and focus on it, by default it is true.
			fadeDuration 			- Transition duration (in ms), by default it is 300.
		
		Alerts:
			This is a hash of alerts settings. in here you can modify strings to localize or wathever else. %0 and %1 represent the argument.
			
			required 				- "This field is required."
			alpha 					- "This field accepts alphabetic characters only."
			alphanum 				- "This field accepts alphanumeric characters only."
			nodigit 				- "No digits are accepted."
			digit 					- "Please enter a valid integer."
			digitmin 				- "The number must be at least %0"
			digitltd 				- "The value must be between %0 and %1"
			number 					- "Please enter a valid number."
			email 					- "Please enter a valid email: <br /><span>E.g. yourname@domain.com</span>"
			phone 					- "Please enter a valid phone."
			phone_inter 			- "Please enter a valid international phone number."
			url 					- "Please enter a valid url: <br /><span>E.g. http://www.domain.com</span>"
			image					- "This field should only contain image types"
			confirm 				- "This field is different from %0"
			differs 				- "This value must be different of %0"
			length_str 				- "The length is incorrect, it must be between %0 and %1"
			length_fix 				- "The length is incorrect, it must be exactly %0 characters"
			lengthmax 				- "The length is incorrect, it must be at max %0"
			lengthmin 				- "The length is incorrect, it must be at least %0"
			words_min				- "This field must concain at least %0 words, now it has %1 words"
			words_range				- "This field must contain between %0 and %1 words, now it has %2 words"
			words_max				- "This field must contain at max %0 words, now it has %1 words",
			checkbox 				- "Please check the box"
			radios 					- "Please select a radio"
			select 					- "Please choose a value"
		
	Example:
		You can initialize a formcheck (no scroll, custom classes and alert) by adding for example this in your html head this code :
		
		(code)
		<script type="text/javascript">
			window.addEvent('domready', function() {
				var myCheck = new FormCheck('form_id', {
					tipsClass : 'tips_box',
					display : {
						scrollToFirst : false
					},
					alerts : {
						required : 'This field is ablolutely required! Please enter a value'
					}
				})
			});
		</script>
		(end code)
	
	About:
		formcheck.js v.1.5 for mootools v1.2 - 09 / 2009
		
		by Mootools.Floor (http://mootools.floor.ch) MIT-style license
		
		Created by Luca Pillonel, 
		Last modified by Luca Pillonel
		
	Credits:
		This class was inspired by fValidator by Fabio Zendhi Nagao (http://zend.lojcomm.com.br)
		
		Thanks to all contributors from groups.google.com/group/moofloor (and others as well!) providing ideas, fixes and motivation!
*/

var FormCheck = new Class({
	
	Implements: [Options, Events],

	options : {
		
		tipsClass : 'fc-tbx',				//tips error class
		errorClass : 'fc-error',			//div error class
		fieldErrorClass : 'fc-field-error',	//error class for elements
		
		submit : true,						//false : just validate the form and do nothing else. Use onValidateSuccess event to execute some code
		
		trimValue : false,					//trim (remove whitespaces before and after) the value
		validateDisabled : false,			//skip validation on disabled input if set to false.
		
		submitByAjax : false,				//false : standard submit way, true : submit by ajax
		ajaxResponseDiv : false,			//element to inject ajax response into (can also use onAjaxSuccess) [cronix] 
		ajaxEvalScripts : false,			//use evalScripts in the Request response [cronix] 
		onAjaxRequest : $empty,				//Function to fire when the Request event starts 
		onAjaxSuccess : $empty,				//Function to fire when the Request receives .  Args: response [the request response] - see Mootools docs for Request.onSuccess 
		onAjaxFailure : $empty,				//Function to fire if the Request fails
		
		onSubmit		  : $empty,			//Function to fire when user submit the form
		onValidateSuccess : $empty,			//Function to fire when validation pass
		onValidateFailure : $empty,			//Function to fire when validation fails

		display : {
			showErrors : 0,
			titlesInsteadNames : 0,
			errorsLocation : 1,
			indicateErrors : 1,
			indicateErrorsInit : 0,
			keepFocusOnError : 0,
			checkValueIfEmpty : 1,
			addClassErrorToField : 0,
			removeClassErrorOnTipClosure : 0,
			fixPngForIe : 1,
			replaceTipsEffect : 1,
			flashTips : 0,
			closeTipsButton : 1,
			tipsPosition : "right",
			tipsOffsetX : -45,
			tipsOffsetY : 0,
			listErrorsAtTop : false,
			scrollToFirst : true,
			fadeDuration : 300
		},
		
		alerts : {
			required : "This field is required.",
			alpha : "This field accepts alphabetic characters only.",
			alphanum : "This field accepts alphanumeric characters only.",
			nodigit : "No digits are accepted.",
			digit : "Please enter a valid integer.",
			digitltd : "The value must be between %0 and %1",
			number : "Please enter a valid number.",
			email : "Please enter a valid email.",
			image : 'This field should only contain image types', 
			phone : "Please enter a valid phone.",
			phone_inter : "Please enter a valid international phone number.",
			url : "Please enter a valid url.",
			
			confirm : "This field is different from %0",
			differs : "This value must be different of %0",
			length_str : "The length is incorrect, it must be between %0 and %1",
			length_fix : "The length is incorrect, it must be exactly %0 characters",
			lengthmax : "The length is incorrect, it must be at max %0",
			lengthmin : "The length is incorrect, it must be at least %0",
			words_min : "This field must concain at least %0 words, currently: %1 words",
			words_range : "This field must contain %0-%1 words, currently: %2 words",
			words_max : "This field must contain at max %0 words, currently: %1 words",
			checkbox : "Please check the box",
			radios : "Please select a radio",
			select : "Please choose a value"
		},
		
		regexp : {
			required : /[^.*]/,
			alpha : /^[a-z ._-]+$/i,
			alphanum : /^[a-z0-9 ._-]+$/i,
			digit : /^[-+]?[0-9]+$/,
			nodigit : /^[^0-9]+$/,
			number : /^[-+]?\d*\.?\d+$/,
			email : /^([a-zA-Z0-9_\.\-\+%])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
			image : /.(jpg|jpeg|png|gif|bmp)$/i,
			phone : /^[\d\s ().-]+$/, // alternate regex : /^[\d\s ().-]+$/,/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/
			phone_inter : /^\+{0,1}[0-9 \(\)\.\-]+$/,
			url : /^(http|https|ftp)\:\/\/[a-z0-9\-\.]+\.[a-z]{2,3}(:[a-z0-9]*)?\/?([a-z0-9\-\._\?\,\'\/\\\+&amp;%\$#\=~])*$/i
		}
	},
	
	/*
	Constructor: initialize
		Constructor
	
		Add event on formular and perform some stuff, you now, like settings, ...
	*/
	initialize : function(form, options) {
		if (this.form = $(form)) {
			this.form.isValid = true;
			this.regex = ['length'];
			this.setOptions(options);
			
			//internalization
			if (typeof(formcheckLanguage) != 'undefined') this.options.alerts = $merge(this.options.alerts, formcheckLanguage);
			
			this.validations = [];
			this.alreadyIndicated = false;
			this.firstError = false;
			
			var regex = new Hash(this.options.regexp);
			regex.each(function(el, key) {
				this.regex.push(key);
			}, this);

			this.form.getElements("*[class*=validate]").each(function(el) {
				if (el.get('tag') == 'select' || el.get('tag') == 'input' || el.get('tag') == 'textarea') this.register(el);
			}, this);
			
			this.form.addEvents({
				"submit": this.onSubmit.bind(this)
			});
			
			if(this.options.display.fixPngForIe) this.fixIeStuffs();
			document.addEvent('mousewheel', function(){
				this.isScrolling = false;
			}.bind(this));
		}
	},
	
	/*
	Function: register
		Allows you to declare afterward new fields to the formcheck, to check dynamically loaded fields for example.
		By default it will be the last element to be validated as it's added after others inputs, but you can define a position with second parameter.
	
	Example:
		(code)
		<script type="text/javascript">
			window.addEvent('domready', function() {
				formcheck = new FormCheck('form_id');
			});
			
			// ...some code...
			
			var newField = new Element('input', {
				class	: "validate['required']",
				name	: "new-field"
			}).inject('form_id');
			formcheck.register(newField, 3);
			
			new Element('input', {
				class	: "validate['required']",
				name	: "another-field",
				id		: "another-field"
			}).inject('form_id');
			formcheck.register($('another-field'));
		</script>
		(end code)
	
	See also:
		<FormCheck::dispose>
	*/
	register : function(el, position) {
		el.validation = [];
		el.getProperty("class").split(' ').each(function(classX) {
			if(classX.match(/^validate(\[.+\])$/)) {
				var valid = true;
				//we check if group is already registered
				if (el.type == "radio") {
					this.validations.each(function(valider){
						if (valider.name == el.name) valid = false;
					}, this)
				}
				var validators = eval(classX.match(/^validate(\[.+\])$/)[1]);
				for(var i = 0; i < validators.length; i++) {
					el.validation.push(validators[i]);
					if (validators[i].match(/^confirm\[/)) {
						var field = eval(validators[i].match(/^.+(\[.+\])$/)[1].replace(/([A-Z0-9\._-]+)/i, "'$1'"));
						if (this.form[field].validation.contains('required')){
							el.validation.push('required');
						}							
					}
					if(validators[i].match(/^target:.+/)) {
						el.target = validators[i].match(/^target:(.+)/)[1];
					}
				}
				//new push way
				if (position && position <= this.validations.length) {
					var newValidations = [];
					this.validations.each(function(valider, i){
						if (position == i+1 && valid) {
							newValidations.push(el);
							this.addListener(el);
						}
						newValidations.push(valider);
					}, this);
					this.validations = newValidations;
				} else {
					if (valid) {
						this.validations.push(el);
						this.addListener(el);
					}
				}
			}
		}, this);
	},
	
	/*
	Function: dispose
		Allows you to remove a declared field from formCheck
	
	Example:
		(code)
		<script type="text/javascript">
			window.addEvent('domready', function() {
				formcheck = new FormCheck('form_id');
			});
			
			// ...some code...
			
			formcheck.dispose($('obsolete-field'));
		</script>
		(end code)
	
	See also:
		<FormCheck::register>
	*/
	dispose : function(element) {
		this.validations.erase(element);
	},
	
	/*
	Function: addListener
		Private method
		
		Add listener on fields
	*/
	addListener : function(el) {
		el.errors = [];
		
		if (this.options.display.indicateErrorsInit) {
			this.validations.each(function(el) {
				if(!this.manageError(el,'submit')) this.form.isValid = false;
			}, this);
			return true;
		} 
	
		if (el.validation[0] == 'submit') {
			el.addEvent('click', function(e){
				if (this.onSubmit(e)) this.form.submit();
			}.bind(this));
			return true;
		}

		if (this.isChildType(el) == false) el.addEvent('blur', function() {
			(function(){
				if(!this.fxRunning && (el.element || this.options.display.showErrors == 1) && (this.options.display.checkValueIfEmpty || el.value))
				this.manageError(el, 'blur')
			}.bind(this)).delay(100);
		}.bind(this))
		//We manage errors on radio
		else if (this.isChildType(el) == true) {
			//We get all radio from the same group and add a blur option
			var nlButtonGroup = this.form.getElements('input[name="'+ el.getProperty("name") +'"]');
			nlButtonGroup.each(function(radio){
				radio.addEvent('blur', function(){
					(function(){
						if((el.element || this.options.display.showErrors == 1) && (this.options.display.checkValueIfEmpty || el.value)) this.manageError(el, 'click');
					}.bind(this)).delay(100);
				}.bind(this))
			},this);
		}
	},
	
	/*
	Function: validate
		Private method
		
		Dispatch check to other methods
	*/
	validate : function(el) {
		el.errors = [];
		el.isOk = true;
		
		//skip validation and trim if specified
		if (!this.options.validateDisabled && el.get('disabled')) return true;
		if (this.options.trimValue && el.value) el.value = el.value.trim();
		
		el.validation.each(function(rule) {
			if(this.isChildType(el)) {
				if (this.validateGroup(el) == false) {
					el.isOk = false;
				}
			} else {
				var ruleArgs = [];
				
				if(rule.match(/target:.+/)) return;
				
				if(rule.match(/^.+\[/)) {
					var ruleMethod = rule.split('[')[0];
					ruleArgs = eval(rule.match(/^.+(\[.+\])$/)[1].replace(/([A-Z0-9\._-]+)/i, "'$1'"));
				} else var ruleMethod = rule;
				
				if (this.regex.contains(ruleMethod) && el.get('tag') != "select") {
					if (this.validateRegex(el, ruleMethod, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (ruleMethod == 'confirm') {
					if (this.validateConfirm(el, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (ruleMethod == 'differs') {
					if (this.validateDiffers(el, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (ruleMethod == 'words') {
					if (this.validateWords(el, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (el.get('tag') == "select" || (el.type == "checkbox" && ruleMethod == 'required')) {
					if (this.simpleValidate(el) == false) {
						el.isOk = false;
					}
				}
				if(rule.match(/%[A-Z0-9\._-]+$/i) || (el.isOk && rule.match(/~[A-Z0-9\._-]+$/i))) {
					if(eval(rule.slice(1)+'(el)') == false) {
						el.isOk = false;
					}
				}
			}
		}, this);
		
		if (el.isOk) return true;
		else return false;
	},
	
	/*
	Function: simpleValidate
		Private method
		
		Perform simple check for select fields and checkboxes
	*/
	simpleValidate : function(el) {
		if (el.get('tag') == 'select' && el.selectedIndex <= 0) {
			el.errors.push(this.options.alerts.select);
			return false;
		} else if (el.type == "checkbox" && el.checked == false) {
			el.errors.push(this.options.alerts.checkbox);
			return false;
		}
		return true;
	},
	
	/*
	Function: validateRegex
		Private method
		
		Perform regex validations
	*/
	validateRegex : function(el, ruleMethod, ruleArgs) {
		var msg = "";
		if (ruleArgs[1] && ruleMethod == 'length') {
			if (ruleArgs[1] == -1) {
				this.options.regexp.length = new RegExp("^[\\s\\S]{"+ ruleArgs[0] +",}$");
				msg = this.options.alerts.lengthmin.replace("%0",ruleArgs[0]);
			} else if(ruleArgs[0] == ruleArgs[1]) {
				this.options.regexp.length = new RegExp("^[\\s\\S]{"+ ruleArgs[0] +"}$");
				msg = this.options.alerts.length_fix.replace("%0",ruleArgs[0]);
			} else {
				this.options.regexp.length = new RegExp("^[\\s\\S]{"+ ruleArgs[0] +","+ ruleArgs[1] +"}$");
				msg = this.options.alerts.length_str.replace("%0",ruleArgs[0]).replace("%1",ruleArgs[1]);
			}
		} else if (ruleArgs[0] && ruleMethod == 'length') {
			this.options.regexp.length = new RegExp("^.{0,"+ ruleArgs[0] +"}$");
			msg = this.options.alerts.lengthmax.replace("%0",ruleArgs[0]);
		} else {
			msg = this.options.alerts[ruleMethod];
		}
		if (ruleArgs[1] && ruleMethod == 'digit') {
			var regres = true;
			if (!this.options.regexp.digit.test(el.value)) {
				el.errors.push(this.options.alerts[ruleMethod]);
				regres = false;
			}
			if (ruleArgs[1] == -1) {
				var valueres = ( el.value.toInt() >= ruleArgs[0].toInt() ); 
				msg = this.options.alerts.digitmin.replace("%0",ruleArgs[0]);
			} else {
				var valueres = ( el.value.toInt() >= ruleArgs[0].toInt() && el.value.toInt() <= ruleArgs[1].toInt() );
				msg = this.options.alerts.digitltd.replace("%0",ruleArgs[0]).replace("%1",ruleArgs[1]);
			}
			if (regres == false || valueres == false) {
				el.errors.push(msg);
				return false;
			}
		} else if (this.options.regexp[ruleMethod].test(el.value) == false)  {
			el.errors.push(msg);
			return false;
		}
		return true;
	},

	/*
	Function: validateConfirm
		Private method
		
		Perform confirm validations
	*/
	validateConfirm: function(el,ruleArgs) {
		
		var confirm = ruleArgs[0];
		if(el.value != this.form[confirm].value){
			if (this.options.display.titlesInsteadNames)
				var msg = this.options.alerts.confirm.replace("%0",this.form[confirm].getProperty('title'));
			else
				var msg = this.options.alerts.confirm.replace("%0",confirm);
			el.errors.push(msg);
			return false;
		}
		return true;
	},
	
	/*
	Function: validateDiffers
		Private method
		
		Perform differs validations
	*/
	validateDiffers: function(el,ruleArgs) {
		var differs = ruleArgs[0];
		if(el.value == this.form[differs].value){
			if (this.options.display.titlesInsteadNames)
				var msg = this.options.alerts.differs.replace("%0",this.form[differs].getProperty('title'));
			else
				var msg = this.options.alerts.differs.replace("%0",differs);
			el.errors.push(msg);
			return false;
		}
		return true;
	},
	
	/*
	Function: validateWords
		Private method
		
		Perform word count validation
	*/
	validateWords: function(el,ruleArgs) {
		var min = ruleArgs[0];
		var max = ruleArgs[1];
		
		var words = el.value.replace(/[ \t\v\n\r\f\p]/m, ' ').replace(/[,.;:]/g, ' ').clean().split(' ');
		
		if(max == -1) {
			if(words.length < min) {
				el.errors.push(this.options.alerts.words_min.replace("%0", min).replace("%1", words.length));
				return false;
			}
		} else {
			if(min > 0)	{
				if(words.length < min || words.length > max) {
					el.errors.push(this.options.alerts.words_range.replace("%0", min).replace("%1", max).replace("%2", words.length));
					return false;
				}
			} else {
				if(words.length > max) {
					el.errors.push(this.options.alerts.words_max.replace("%0", max).replace("%1", words.length));
					return false;
				}
			}
		}
		return true;
	},


	/*
	Function: isFormValid
		public method
		
		Determine if the form is valid
		
		Return true or false
	*/
    isFormValid: function() {
		this.form.isValid = true;
		this.validations.each(function(el) {
			var validation = this.manageError(el,'testonly');
			if(!validation) this.form.isValid = false;
		}, this);
		return this.form.isValid;
	},
	
	/*
	Function: isChildType
		Private method
		
		Determine if the field is a group of radio or not.
	*/
	isChildType: function(el) {
		return ($defined(el.type) && el.type == 'radio') ? true : false;
	},
	
	/*
	Function: validateGroup
		Private method
		
		Perform radios validations
	*/
	validateGroup : function(el) {
		el.errors = [];
		var nlButtonGroup = this.form[el.getProperty("name")];
		el.group = nlButtonGroup;
		var cbCheckeds = false;
		
		for(var i = 0; i < nlButtonGroup.length; i++) {
			if(nlButtonGroup[i].checked) {
				cbCheckeds = true;
			}
		}
		if(cbCheckeds == false) {
			el.errors.push(this.options.alerts.radios);
			return false;
		} else {
			return true;	
		}
	},
	
	/*
	Function: listErrorsAtTop
		Private method
		
		Display errors
	*/
	listErrorsAtTop : function(obj) {
		if(!this.form.element) {
			 this.form.element = new Element('div', {'id' : 'errorlist', 'class' : this.options.errorClass}).injectTop(this.form);
		}
		if ($type(obj) == 'collection') {
			new Element('p').set('html',"<span>" + obj[0].name + " : </span>" + obj[0].errors[0]).injectInside(this.form.element);
		} else {
			if ((obj.validation.contains('required') && obj.errors.length > 0) || (obj.errors.length > 0 && obj.value && obj.validation.contains('required') == false)) {
				obj.errors.each(function(error) {
					new Element('p').set('html',"<span>" + obj.name + " : </span>" + error).injectInside(this.form.element);
				}, this);
			}
		}
		window.fireEvent('resize');
	},
	
	/*
	Function: manageError
		Private method
		
		Manage display of errors boxes
	*/
	manageError : function(el, method) {
		var isValid = this.validate(el);
		if (method == 'testonly') return isValid;
		if ((!isValid && el.validation.flatten()[0].contains('confirm[')) || (!isValid && el.validation.contains('required')) || (!el.validation.contains('required') && el.value && !isValid)) {
			if(this.options.display.listErrorsAtTop == true && method == 'submit')
				this.listErrorsAtTop(el);
			if (this.options.display.indicateErrors == 2 ||this.alreadyIndicated == false || el.name == this.alreadyIndicated.name)
			{
				if(!this.firstError) this.firstError = el;
				
				this.alreadyIndicated = el;
				
				if (this.options.display.keepFocusOnError && el.name == this.firstError.name) (function(){el.focus()}).delay(20);
				this.addError(el);
				return false;
			}
		} else if ((isValid || (!el.validation.contains('required') && !el.value))) {
			this.removeError(el);
			return true;
		}
		return true;
	},
	
	/*
	Function: addError
		Private method
		
		Add error message
	*/
	addError : function(obj) {
		//determine position
		var coord = obj.target ? $(obj.target).getCoordinates() : obj.getCoordinates();
		
		if(!obj.element && this.options.display.indicateErrors != 0) {
			if (this.options.display.errorsLocation == 1) {
				var pos = (this.options.display.tipsPosition == 'left') ? coord.left : coord.right;
				var options = {
					'opacity' : 0,
					'position' : 'absolute',
					'float' : 'left',
					'left' : pos + this.options.display.tipsOffsetX
				}
				obj.element = new Element('div', {'class' : this.options.tipsClass, 'styles' : options}).injectInside(document.body);
				this.addPositionEvent(obj);
			} else if (this.options.display.errorsLocation == 2){
				obj.element = new Element('div', {'class' : this.options.errorClass, 'styles' : {'opacity' : 0}}).injectBefore(obj);
			} else if (this.options.display.errorsLocation == 3){
				obj.element = new Element('div', {'class' : this.options.errorClass, 'styles' : {'opacity' : 0}});
				if ($type(obj.group) == 'object' || $type(obj.group) == 'collection')
					obj.element.injectAfter(obj.group[obj.group.length-1]);
				else
					obj.element.injectAfter(obj);
			}
		}					
		if (obj.element && obj.element != true) {
			obj.element.empty();
			if (this.options.display.errorsLocation == 1) {
				var errors = [];
				obj.errors.each(function(error) {
					errors.push(new Element('p').set('html', error));
				});
				var tips = this.makeTips(errors).injectInside(obj.element);
				if(this.options.display.closeTipsButton) {
					tips.getElements('a.close').addEvent('mouseup', function(){
						this.removeError(obj, 'tip');
					}.bind(this));
				}
				obj.element.setStyle('top', coord.top - tips.getCoordinates().height + this.options.display.tipsOffsetY);
			} else {
				obj.errors.each(function(error) {
					new Element('p').set('html',error).injectInside(obj.element);
				});
			}
			
			if (!this.options.display.fadeDuration || Browser.Engine.trident && Browser.Engine.version == 5 && this.options.display.errorsLocation < 2) {
				obj.element.setStyle('opacity', 1);
			} else {
				obj.fx = new Fx.Tween(obj.element, {
					'duration' : this.options.display.fadeDuration,
					'ignore' : true,
					'onStart' : function(){
						this.fxRunning = true;
					}.bind(this),
					'onComplete' : function() {
						this.fxRunning = false;
						if (obj.element && obj.element.getStyle('opacity').toInt() == 0) {
							obj.element.destroy();
							obj.element = false;
						}
					}.bind(this)
				})
				if(obj.element.getStyle('opacity').toInt() != 1) obj.fx.start('opacity', 1);
			}
		}
		if (this.options.display.addClassErrorToField && this.isChildType(obj) == false){
			obj.addClass(this.options.fieldErrorClass);
			obj.element = obj.element || true;
		}
			
	},
	
	/*
	Function: addPositionEvent
		
		Update tips position after a browser resize
	*/
	addPositionEvent : function(obj) {
		if(this.options.display.replaceTipsEffect) {
			obj.event = function(){
				var coord = obj.target ? $(obj.target).getCoordinates() : obj.getCoordinates();
				new Fx.Morph(obj.element, {
					'duration' : this.options.display.fadeDuration
				}).start({ 
					'left':[obj.element.getStyle('left'), coord.right + this.options.display.tipsOffsetX],
					'top':[obj.element.getStyle('top'), coord.top - obj.element.getCoordinates().height + this.options.display.tipsOffsetY]
				});
			}.bind(this);
			
		} else {
			obj.event = function(){
				var coord = obj.target ? $(obj.target).getCoordinates() : obj.getCoordinates();
				obj.element.setStyles({ 
					'left':coord.right + this.options.display.tipsOffsetX,
					'top':coord.top - obj.element.getCoordinates().height + this.options.display.tipsOffsetY
				});
			}.bind(this)
		}
		//window.addEvent('resize', obj.event);
	},
	
	/*
	Function: removeError
		Private method
		
		Remove the error display
	*/
	removeError : function(obj, method) {
		if ((this.options.display.addClassErrorToField && !this.isChildType(obj) && this.options.display.removeClassErrorOnTipClosure) || (this.options.display.addClassErrorToField && !this.isChildType(obj) && !this.options.display.removeClassErrorOnTipClosure && method != 'tip'))
			obj.removeClass(this.options.fieldErrorClass);

		if (!obj.element) return;
		this.alreadyIndicated = false;
		obj.errors = [];
		obj.isOK = true;
		window.removeEvent('resize', obj.event);
		if (this.options.display.errorsLocation >= 2 && obj.element) {
			new Fx.Tween(obj.element, {
				'duration': this.options.display.fadeDuration
			}).start('height', 0);
		}
		if (!this.options.display.fadeDuration || Browser.Engine.trident && Browser.Engine.version == 5 && this.options.display.errorsLocation == 1 && obj.element) {
			this.fxRunning = true;
			obj.element.destroy();
			obj.element = false;
			(function(){this.fxRunning = false}.bind(this)).delay(200);
		} else if (obj.element && obj.element != true) {
			obj.fx.start('opacity', 0);
		}
	},
	
	/*
	Function: focusOnError
		Private method
		
		Create set the focus to the first field with an error if needed
	*/
	focusOnError : function (obj) {
		if (this.options.display.scrollToFirst && !this.alreadyFocused && !this.isScrolling) {
			if (!this.options.display.indicateErrors || !this.options.display.errorsLocation) {
				var dest = obj.getCoordinates().top-30;
			} else if (this.alreadyIndicated.element) {
				switch (this.options.display.errorsLocation){
					case 1 : 
						var dest = obj.element.getCoordinates().top;
						break;
					case 2 :
						var dest = obj.element.getCoordinates().top-30;
						break;
					case 3 :
						var dest = obj.getCoordinates().top-30;
						break;
				}
				this.isScrolling = true;
			}
			if (window.getScroll.y != dest) {
				new Fx.Scroll(window, {
					onComplete : function() {
						this.isScrolling = false;
						if (obj.getProperty('type') != 'hidden') obj.focus();
					}.bind(this)
				}).start(0,dest);
			} else {
				this.isScrolling = false;
				obj.focus();
			}
			this.alreadyFocused = true;
		}
	},
	
	/*
	Function: fixIeStuffs
		Private method
		
		Fix png for IE6
	*/
	fixIeStuffs : function () {
		if (Browser.Engine.trident4) {
			//We fix png stuffs
			var rpng = new RegExp('url\\(([\.a-zA-Z0-9_/:-]+\.png)\\)');
			var search = new RegExp('(.+)formcheck\.css');
			for (var i = 0; i < document.styleSheets.length; i++){
				if (document.styleSheets[i].href.match(/formcheck\.css$/)) {
					var root = document.styleSheets[i].href.replace(search, '$1');
					var count = document.styleSheets[i].rules.length;
					for (var j = 0; j < count; j++){
						var cssstyle = document.styleSheets[i].rules[j].style;
						var bgimage = root + cssstyle.backgroundImage.replace(rpng, '$1');
						if (bgimage && bgimage.match(/\.png/i)){
							var scale = (cssstyle.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale';
							cssstyle.filter =  'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\'' + bgimage + '\', sizingMethod=\''+ scale +'\')';
							cssstyle.backgroundImage = "none";
						}
					}
				}
			}
		}
	},
	
	/*
	Function: makeTips
		Private method
		
		Create tips boxes
	*/
	makeTips : function(txt) {
		var table = new Element('table');
			table.cellPadding ='0';
			table.cellSpacing ='0';
			table.border ='0';
			
			var tbody = new Element('tbody').injectInside(table);
				var tr1 = new Element('tr').injectInside(tbody);
					new Element('td', {'class' : 'tl'}).injectInside(tr1);
					new Element('td', {'class' : 't'}).injectInside(tr1);
					new Element('td', {'class' : 'tr'}).injectInside(tr1);
				var tr2 = new Element('tr').injectInside(tbody);
					new Element('td', {'class' : 'l'}).injectInside(tr2);
					var cont = new Element('td', {'class' : 'c'}).injectInside(tr2);
						var errors = new Element('div', {'class' : 'err'}).injectInside(cont);
						txt.each(function(error) {
							error.injectInside(errors);
						});
						if (this.options.display.closeTipsButton) new Element('a',{'class' : 'close'}).injectInside(cont);
					new Element('td', {'class' : 'r'}).injectInside(tr2);
				var tr3 = new Element('tr').injectInside(tbody);
					new Element('td', {'class' : 'bl'}).injectInside(tr3);
					new Element('td', {'class' : 'b'}).injectInside(tr3);
					new Element('td', {'class' : 'br'}).injectInside(tr3);			
		return table;
	},
	
	/*
	Function: reinitialize
		Reinitialize form before submit check. You can use this also to remove all tips from a form, passing the argument "forced" ( formcheck.reinitialize('forced'); )
	*/
	reinitialize: function(forced) {
		this.validations.each(function(el) {
			if (el.element) {
				el.errors = [];
				el.isOK = true;
				if(this.options.display.flashTips == 1 || forced == 'forced') {
					el.element.destroy();
					el.element = false;
				}
			}
		}, this);
		if (this.form.element) this.form.element.empty();
		this.alreadyFocused = false;
		this.firstError = false;
		this.elementToRemove = this.alreadyIndicated;
		this.alreadyIndicated = false;
		this.form.isValid = true;
	},
	
	/*
	Function: submitByAjax
		Private method		
		
		Send the form by ajax, and replace the form with response
	*/
	
	submitByAjax: function() {
		var url = this.form.getProperty('action');
		this.fireEvent('ajaxRequest');
		new Request({
			url: url,
			method: this.form.getProperty('method'),
			data : this.form.toQueryString(),
			evalScripts: this.options.ajaxEvalScripts,
			onFailure: function(instance){
				this.fireEvent('ajaxFailure', instance);
			}.bind(this),
			onSuccess: function(result){
				this.fireEvent('ajaxSuccess', result);
				if(this.options.ajaxResponseDiv) $(this.options.ajaxResponseDiv).set('html',result);
			}.bind(this)
		}).send();
	},
	
	/*
	Function: onSubmit
		Private method		
		
		Perform check on submit action
	*/
	onSubmit: function(event) {
		this.reinitialize();
		this.fireEvent('onSubmit');
		
		this.validations.each(function(el) {
			var validation = this.manageError(el,'submit');
			if(!validation) this.form.isValid = false;
		}, this);
	    
		if (this.form.isValid) {
			if (this.options.submitByAjax) {
				new Event(event).stop();
				this.submitByAjax();
			} else if(!this.options.submit) {
				new Event(event).stop();
			}
			this.fireEvent('validateSuccess');
			return true;
		} else {
			new Event(event).stop();
			if (this.elementToRemove && this.elementToRemove != this.firstError && this.options.display.indicateErrors == 1) {
				this.removeError(this.elementToRemove);
			}
			this.focusOnError(this.firstError);
			this.fireEvent('validateFailure');
			return false;
		}
	}
});var managersClass = ".treload";
var dragdropClass = ".tdragdrop";
var reloadablesClass = ".creloading";

// init domready
var domReady = false;
function waitDomReady()
{
	if ( ! domReady )
		waitDomReady().delay( 50 );
}

// add domready event
window.addEvent( "domready", function() {
	domReady = true;
	onLoad(); // load everything
});

// check browser engine
function checkBrowser()
{
	var engineVersion = Browser.Engine.version; // get version
	if ( ( Browser.Engine.trident ) && ( engineVersion < 5 ) ) // ie6 or lower
		alert( "Please try a newer browser - FireFox, Chrome, Opera" );
}

// init highslide
function initHighSlide()
{
	hs.graphicsDir = 'scripts/highslide/graphics/';
	hs.outlineType = 'rounded-white';
	hs.showCredits = false;
	hs.fadeInOut = true;
	
	if ( hs.registerOverlay ) //??
	{
		// simple semitransparent close button overlay
		hs.registerOverlay({
			html: '<div class="closebutton"	onclick="return hs.close(this)" title="Close"></div>',
			position: 'top right',
			fade: 2 // fading the semi-transparent overlay looks bad in IE
		});
	}
	
	hs.dimmingOpacity = 0;
	hs.onDimmerClick = function() { //??
	  return false;
	}
	
	// add controlbar for gallery
	if ( hs.addSlideshow ) hs.addSlideshow({
		slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: {
			className: 'text-controls',
			position: 'bottom center',
			relativeTo: 'viewport',
			offsetY:-32
		},
		thumbstrip: {
			position: 'top center',
			mode: 'horizontal',
			relativeTo: 'viewport',
			offsetY:16
		}
	});
}

// init form check
function initFormCheck( container )
{
	if ( container && $( container ) ) // check integrity
		var form_check = new FormCheck( container, { display: { tipsPosition:'left', tipsOffsetX:0, tipsOffsetY:24 } } );
	
	if ( form_check ) // show loading
	$( container ).addEvent( "submit", function( ev ) {
		loadSpinner( "form1", "Loading...please wait!" );
	});
}

// init tinymce editor
function initTinyMCE()
{
	tinyMCE_GZ.init({
		plugins : 'style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,'+ 
			'searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras',
		themes : 'simple,advanced',
		languages : 'en',
		disk_cache : true,
		debug : false
	}, function(){
		tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		width : "100%",
		editor_selector : "mceEditor",
		editor_deselector : "mceNoEditor",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,blockquote",
		theme_advanced_buttons2 : "forecolor,backcolor,styleselect,formatselect,fontsizeselect,undo,redo",
		theme_advanced_buttons3 : "link,unlink,anchor,image,media,|,charmap,emotions,iespell,template,fullscreen,code",
		//theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		//theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		//theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		//theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "external",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		//theme_advanced_resizing : false,
		//force_p_newlines : true, // enter -> p
		//forced_root_block : 'p', // p default
		//readonly : true,
		
		// Css content (should be your site CSS)
		content_css : "templates/tinymce/styles.css",
		
		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "templates/tinymce/template_list.js",
		external_link_list_url : "templates/tinymce/link_list.js",
		external_image_list_url : "templates/tinymce/image_list.js",
		media_external_list_url : "templates/tinymce/media_list.js",
		
		// Style formats
		style_formats : [
			{title : "Columns block", block : "div", wrapper:true, classes : "columns"},
			{title : "Insert colmun", block : "div", wrapper:true, classes : "col"},
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		]
		});
	});
}

// toggle editor on or off
function toggle_editor( id )
{
	initTinyMCE(); // load editor
	if ( ! tinyMCE.get( id ) ) // add editor
		tinyMCE.execCommand( 'mceAddControl', false, id );
	else // remove editor
		tinyMCE.execCommand( 'mceRemoveControl', false, id );
}

// load everything
function onLoad()
{
	waitDomReady(); // wait domready
	checkBrowser(); // check browser
	initHighSlide(); // init highslide
	initFormCheck( "form1" ); // init form check
	initTinyMCE(); // init editor
	initCroppers(); // init image croppers 
	
	// initiate all elements with "reload" event
	//initReloading( reloadablesClass );
	//initReloading( managersClass );
	
	//hook4css( collexp, ".lqt_js2collexp" ); // collexp handle
	//idragdrop( dragdropClass, ".handle" ); // drag & drop
	//toggle4rows( managersClass + " .row" ); // select rows
	//ajaxNav();
	//nav2ajax( ".treload", ".navigation a" );
	//ajaxForms();
	evalProp( "lqt_prop" );
	clen_field();
}

function clen_field()
{
	var elements = $$( ".lqt-clean-field" );
	elements.each( function( el, index ){
		el.addEvent( "focus", function( event ){
			this.value = "";
		});
	});
}

function lqt_4man()
{
	hook4css( collexp, ".lqt_js2collexp" );
	idragdrop( dragdropClass, ".handle" );
	toggle4rows( managersClass + " .row" );
	nav2ajax( ".treload", ".navigation a" );
}

function lqt_fonts( css, font, size )
{
	css = "." + css;
	var ob = { fontFamily:font };
	if ( size )
		ob.fontSize = size + "px";
	Cufon.replace( css, ob );
}

/*
function cow_triggers( container, cows_css, triggers_css )
{
	if ( ! ( container = checkel( container ) ) ) return false;
	var cows = container.getElements( cows_css );
	var triggers = container.getElements( triggers_css );
	triggers.each( function( item, index ){
		item.addEvent( "click", function( event ){
			if ( event ) event.stop();
			var active = container.getElement( item.get("name") );
			go_selected( triggers, item, "selected" );
			go_selected( cows, active, "selected" );
			return false;
		});
		if ( item.hasClass( "selected" ) )
			item.fireEvent( "click" );
	});
}
*/

var TickClass = new Class({
	initialize: function( container, selector, triggers, step )
	{
		if ( ! ( container = checkel( container ) ) ) return false;
		this.elements = container.getElements( selector );
		this.triggers = container.getElements( triggers );
		this.curentIndex = 0;
		this.size = this.elements.length;
		var width = this.elements[0].getParent().getSize().x;
		this.elements.each( function(item, index){
			if ( index )
				item.setStyles({'left': width});
		}.bind(this) );
		
		this.triggers.each( function( item, index ){
			item.addEvent( "click", function( event ){
				if ( event ) event.stop();
				this.triggers[this.curentIndex].removeClass('selected');
				this.triggers[index].addClass('selected');
				var prevActiveEl = this.elements[this.curentIndex];
				var newActiveEl = this.elements[index];
				prevActiveEl.set('tween', {
					'link': 'chain',
					'onComplete': function() {
						prevActiveEl.setStyles({ 'left': width });
						prevActiveEl.fade('show');
						prevActiveEl.removeClass('selected');
						newActiveEl.set('tween', {
							'link': 'chain'
						});
						newActiveEl.tween('left', '0px');
						$clear(this.ticker);
						this.ticker = this.tick.periodical( step, this );
					}.bind(this)
				});
				prevActiveEl.fade();

				this.curentIndex = index;
				return false;
			}.bind(this));
		}.bind(this));
		this.ticker = this.tick.periodical( step, this );
	},
	
	tick: function()
	{
		var newIndex = this.curentIndex + 1;
		if ( newIndex >= this.size )
			newIndex = 0;
		this.triggers[newIndex].fireEvent("click");
	}
});	

// debug objects
function debugObject( ob )
{
	var out = "";
	var myHash = new Hash( ob );
	myHash.each( function( val, key ){
		if ( $type( val ) == "object" )
			out += key + "->" + debugObject( val ) + "\n";
		else	
			out += key + "->" + val + "\n";
	});
	return out;
}

function showObject( ob )
{
	$debug = debugObject( ob );
	alert( $debug );
}

// associate a "spinner" type element over a given element. If the element is a form, test for formcheck before
function loadSpinner(el, msg)
{
	var weHaveInput = false;
	var targetEl;
	if ($(el).get('tag') == 'form') // we have a form element with formcheck ON and at least one input of type "file"
	{
		//var iframe = window.parent.hs.getExpander().wrapper;
		targetEl = $(el);
		var inputsOfTypeFile = $(el).getElements('input[type=file]');
		var weHaveFormcheckPopup = $( document.getElement('.fc-tbx') );
		if ( ( !weHaveFormcheckPopup ) && ( inputsOfTypeFile.length ) )
		{
			inputsOfTypeFile.each(function(item){
				if ( item.get('value') )
					weHaveInput = true;
			});
		}
	} else { // other elements, for now nothing ;)
		weHaveInput	= true;
		targetEl = $(el);
	}
	if ( weHaveInput )
	{
		targetEl.set('spinner', {message: msg});
		targetEl.spin();
		(function(){}).delay('1000');
	}	
}


// show HS popups using inline content or Ajax loaded content (instead of all old versions of popups)
// these popups have only a close button. Move and resize are disabled from css. 
// popups are associated to a given "trigger" element and appear when a given "event" happens(default on click)
function showPopup(trigger, event)
{
	if ($chk(event) == false)
		var event = 'click';
	var hsParams = {
		wrapperClassName: 'no-footer no-move'
	};	
	var triggerEl = $(trigger);
	if (triggerEl)
	{
		if ( triggerEl.get('href') ) // ajax content. Trigger looks like this: <a href="address">link</a>
		{
			hsParams.objectType = 'ajax';
		} else { // inline content. Trigger looks like this: <a>link</a><div class="highslide-maincontent">content</div>
		}	
		triggerEl.addEvent(event, function(ev){
			return hs.htmlExpand(this, hsParams );
		});	
	}
}


// a new ideea! If an element has an inner hidden anchor, we intantiate a new event on him called "reload"
// on "reload" fired, the content of the element will be reloaded via ajax. The anchor will be keept after event creation.
// the element will get the class "reloadable" so we can identify him later. All elements with that class will have a "reload" event associated!
// if the element has class "autoReload", the reload event is fired
function makeReloadable( element, href )
{
	var address = ($chk(href)) ? href : "";
	var theElement = $(element);
	if (theElement)
	{
		var theHiddenAnchor = theElement.getFirst('a.hidden_anchor');
		if ( !theHiddenAnchor ) // if we don't have an "hidden_anchor" element, we create one
		{
			theHiddenAnchor = new Element( 'a', {
				'class': 'hidden_anchor'
			}).inject(theElement);
		}
		if ( address )
			theHiddenAnchor.set('href', address);
		if ( theElement.hasClass('reloadable') == false )
		{
			theElement.addEvent('reload', function(){
				var theHiddenAnchor = theElement.getFirst('a.hidden_anchor');
				var myRequest = new Request({
					url: theHiddenAnchor.get('href'),
					method: 'post',
					evalScripts: true,
					link: 'chain',
					'onSuccess': function(responseText, responseXML) {
						theElement.set( "html", responseText);
						theElement.grab(theHiddenAnchor);
						
						onLoad();
						theElement.getElements(reloadablesClass).each( function(item){
							makeReloadable(item);
						} );
						
					}
				});	
				var passedArgs = new Hash(arguments[0]);
				var query = passedArgs.toQueryString();
				myRequest.send(query);
			});
			theElement.addClass('reloadable');
		}
		if ( theElement.hasClass('autoReload') )
		{
			theElement.removeClass('autoReload');
			theElement.fireEvent('reload');
		}	
	}
	return false;	
}


// if the element is found on DOM fires the "reload" event
function reloadElement( element, href, args )
{
	var showAlert = false;
	var theElement = $(element);
	if (theElement)
	{
		makeReloadable( theElement, href );
		if ( $chk(args) )
			theElement.fireEvent('reload', args);
		else
			theElement.fireEvent('reload');
	} else {
		if (showAlert)
			alert('Element '+element+' was not found on DOM!');
	}
	return false;
}


// find the first parent of an element which has class "reloadable" (that means he has a "reload" event associated)
// if the "href" string is provided, the parent element will be loaded with that value
function reloadParent( element, href, args )
{
	var showAlert = false;
	var theElement = $(element);
	if (theElement)
	{
		var theParent = theElement.getParent('.reloadable');
		reloadElement( theParent, href, args );
	} else {
		if (showAlert)
			alert('Element '+element+' was not found on DOM!');
	}
	return false;	
}


// initiate all elements with "reload" event
function initReloading( selector )
{
	$$(selector).each(function(item){
		makeReloadable(item);
	});
}


// Request confirmation and loads by AJAX an url( which usualy deletes a record from manager)
// On succes destroys the coresponding table row from DOM(default behavior) or reloads the first parent of trigger with a "reload" method associated
function deleteRow(trigger, reloadP, parentContainer, confirmation )
{
	var reload = $chk( reloadP );
	var parentContainer = $chk( parentContainer ) ? parentContainer : 'tr';
	var obj = $(trigger);
	var confirmation = $chk( confirmation ) ? confirmation : true;
	
	if ( confirmation )
		var reply = confirm("Are you sure you want to delete this record?");
	else
		var reply = true;
	if ( reply == true )
	{
		var urlToCall = obj.get('href');
		var myRequest = new Request({
			url: urlToCall, 
			method: 'post', 
			onSuccess: function(responseText, responseXML) {
				if ( reload )
				{
					reloadParent(trigger);
				}	
				else 
				{	
					var parentTr = $(trigger).getParent(parentContainer);
					if ( parentContainer == 'tr' )
						parentTr.getNext('tr').dispose();
					parentTr.dispose();
				}	
			}
		});
		myRequest.send();
	}	
	return false;
}


// Because of browser differences, an element can be addopted only in the same DOM like where was created.
// this function is needed when we create elements in two different places like iframes and their parents, HS popups, editor...
// DOM variable tell us where to create the element. Params is an object {'id': value1, 'html': value2, 'styles': {}...}
function CreateElement(DOM, tag, params)
{
	var newElement = false;
	if ( $type(DOM) == 'document' )
	{
		newElement = DOM.createElement(tag);
		var hash1 = new Hash(params);
		hash1.each(function(val, key){
			//alert(key+': '+val);
			if ( key == 'id' )
				newElement.id = val;
			if ( key == 'html' )
				newElement.innerHTML = val;
			if ( key == 'class' )
				newElement.className = val;
			if ( key == 'title' )
				newElement.title = val;
			if ( key == 'styles' )
			{
				var hash2 = new Hash(val);
				hash2.each(function(v, k){
					newElement.style[k] = v;
				});
				
			}
		});
		
	}
	return newElement;
}

// check for a dom element and return it if found
function checkel( name, check4 )
{
	if ( ! name ) return false; // check integrity
	var type = $type( name ); // get type
	if ( check4 ) // check type
	{
		if ( check4 == "element" ) // convert 2 element
		if ( type == "string" )
		{
			name = getel( name );
			if ( name ) type = "element";
		}
		name = type == check4 ? name : false;
	}
	else // no check (auto mode)
	if ( type == "string" ) // convert 2 element
		name = getel( name );
	
	// get dom element based on id using $
	// or even from css using $$ or getElement ;)
	function getel( name )
	{
		if ( name.contains( "." ) ) // from css using $$
			name = document.getElement( name );
		else // based on id using $
			name = $( name );
		return name;
	}
	
	return name;
}

// find all elements identified by prop css class
// they are carrying json code in the prop named html attribute
// you may filter/limit them to a certain container as well
function evalProp( prop, container )
{
	var css = "." + prop; // build css class
	var elements = checkel( container, "element" ) ? container.getElements( css ) : $$( css );
	elements.each( function( item, index ){ // process each element
		if ( ! ( code = item.get( prop ) ) ) // check for html attribute
			return false;
		code = JSON.decode( code ); // decode to object
		code = $H( code ); // convert to Hash
		code.run(); // run all functions (auto)
		
		item.erase( prop ); // remove prop
		item.removeClass( prop ); // remove css
	});
}

// load trigger's url to container by ajax, sending its fields through post as well
// send vs load: load resolve javascript that comes through ajax ;)
function go_request( container, trigger )
{
	// check integrity
	if ( ! ( container = checkel( container ) ) ) return false;
	if ( ! ( trigger = checkel( trigger ) ) ) return false;
	
	// build request object
	container.set( "load", { method:"post", evalScripts:true, async:false, data:"",
		onRequest:function(){ trigger.addClass( "ajax-loading" ); },
		onComplete:function( response ){ // load on complete
			//this.set( "html", response ); // needed for send method
			evalProp( "lqt_prop", container ); // handle ajax
			trigger.removeClass( "ajax-loading" );
		}.bind( container ) // not needed
	}); // end object
	
	// send request if valid url
	if ( url = trigger.get( "href" ) )
		container.load( url );
}

// toggle css class on a collection
// trigger may be a function as well to handle this in a custom way
function go_selected( collection, trigger, css )
{
	if ( checkel( collection, "array" ) ) // check integrity
	collection.each( function( item, index ){ // process each item
		if ( checkel( trigger, "function" ) ) // trigger is a function
			trigger( item, css );
		else // selected item
		if ( trigger == item )
			item.addClass( css );
		else // unselect others
			item.removeClass( css );
	});
}

// handle click events for tabs
function go_tabs( container, css )
{
	// check integrity
	if ( ! ( container = checkel( container ) ) ) return false;
	
	// custom handle for toggle css class for a tab's containers
	// function is bind to the tab to identify containers based on its name as css class
	var showtr = function( item, css )
	{
		var trigger = ""; // check & get bind tab
		if ( trigger = checkel( this, "element" ) )
			trigger = this.get( "name" );
		
		if ( trigger && item.get( "class" ) ) // check integrity
		if ( item.hasClass( trigger ) ) // check container
		{
			if ( ! item.get( "html" ) || ! this.hasClass( "selected" ) )
				go_request( item, this ); // load tab url to container if set
			item.removeClass( css ); // show container
		}
		else // hide container
			item.addClass( css );
	} // end function
	
	var tabs = container.getElements( css ); // get tabs
	var trs = container.getElements( ".tab" ); // get tabs containers
	tabs.each( function( item, index ){ // process each tab
		
		item.addEvent( "click", function( event ){ // add click event
			if ( event ) event.stop(); // stop event if valid
			go_selected( tabs, item, "selected" ); // toggle selected tab
			go_selected( trs, showtr.bind( item ), "dnone" ); // toggle tab's containers
			return false; // stop default event
		}); // end click event
		
		if ( item.hasClass( "default" ) ) // default tab
			item.fireEvent( "click" );
	}); // end each tab
}

// smoth efect to scroll page to a specified element
function scrollPageTo(el)
{
	var myFx = new Fx.Scroll(window).toElement(el);

	return false;
}


// resize an iframe to a given size or to max size to show all content
function resizeIfr(iframeEl, width, height)
{
	iframeEl = new IFrame(iframeEl);
	var toggleVis = false;
	if (iframeEl.getStyle("display") == "none")
		toggleVis = true;
	if (toggleVis)
	{	
		iframeEl.setStyle("visibility", "hidden");
		iframeEl.setStyle("display", "block");
	}
	var doc=(iframeEl.contentWindow || iframeEl.contentDocument);
	var content = doc.document.getElement('#container1');
	
	if (!height)
		var height = Math.max(250, content.getDimensions().height);
	iframeEl.setProperty('height', height);
	if (!width)
		var width = '100%';
	iframeEl.setProperty('width', width);
	if (toggleVis)
	{	
		iframeEl.setStyle("display", "none");
		iframeEl.setStyle("visibility", "");
	}
}


// init drag & drop (sortable) for a container
function idragdrop( hcontainer, helement )
{
	var containers = $$( hcontainer );
	containers.each( function( item ){	
		var sort = new Sortables( item, {
			//constrain: true,
			clone: true,
			handle: helement,
			opacity: 0.25,
			revert: { duration: 500, transition: 'elastic:out' },
			//snap:4,
			//preventDefault:false
		});
	});
}


// return the items order as a string
function getOrder(container, identifier)
{
	var returnList = new Hash();
	if (!$chk(container))
		var container = managersClass;
	if (!$chk(identifier))
		var identifier = "input[id^=cb[]";
	var containerObj = $$(container);
	if ( containerObj )
	containerObj.each(function(item)
	{	
		item.getElements(identifier).each(function(el){
			var id = el.get("id");
			var tmp = id.replace("cb[","");
			tmp = tmp.replace("]","");
			returnList.set(id, tmp);
		});
	});
	return returnList;
}


// decode string params to a hash 
function decode_params( params )
{
	var result = new Hash;
	var groups = params.split("#");
	groups.each(function(item){
		var tmp = item.split("|");
		if (tmp.length == 2)
			result.set(tmp[0],tmp[1]);
	});
	return result;
}


//merge & return a page url with the specified params string
//also cleans variables which have empty values ("..&param2=&.." will remove param2 from query) 
function urlparam( url, params  )
{
	var result = "";
	var myURI = new URI(url);
	var query = myURI.get('query');
	var queryHash = new Hash(query.parseQueryString());
	var paramsHash = new Hash(params.parseQueryString());
	paramsHash.each(function(val, key){
		queryHash.set(key, val);
	});
	result = queryHash.toQueryString().cleanQueryString();
	myURI.set('query', result);
	return myURI.toString();
}


// params is a string with the form field|prompt text#field|prompt text...
// if params is given, will prompt for a value for each field
function doAction(triger, action, params)
{
	if ( triger = $(triger) )
	{	
		var parent = $$(managersClass).shift();
		var url = parent.getChildren('.hidden_anchor').get('href');
		var newUrl = "";
		
		var selectedIds = "";
		if ( action == "order" )
		{
			selectedIds = getOrder();
			var field = $('orderfield');
			var dir = $('orderdir');
			if ( field && dir )
				selectedIds.set('order', field.value+'|'+dir.value);
		} else	
			selectedIds = getOrder(dragdropClass, "input:checked");
		
		if ( triger.get('id') == 'actions' )
		{
			selectedIds.set('doaction', 'action='+action);
			triger.selectedIndex = 0;
		}	
		if ( triger.get('id') == 'labels' )
		{
			selectedIds.set('doaction', 'labels='+action);
			triger.selectedIndex = 0;
		}	
		if ( triger.get('id') == 'rperp' )
		{
			selectedIds.set('rperp', action);
			newUrl = url; //urlparam(url, "rperp="+action);
		}	
		if ( ( triger.get('id') == 'orderfield' ) || ( triger.get('id') == 'orderdir' ) )
		{
			selectedIds.empty();
			var field = $('orderfield');
			var dir = $('orderdir');
			if ( field && dir )
				selectedIds.set('order', field.value+'|'+dir.value);
		}
		
		if ($chk(params))
		{
			var paramsH = decode_params(params);
			paramsH.each(function(val,key){
				var answer = prompt(val);
				if (answer)
					selectedIds.set(key, answer);
			});
		}	
		selectedIds.set('ajax', 'ajax');
		selectedIds.set('layout', 'off');
		
		reloadElement( parent, newUrl, selectedIds );
	}
	return false;
}

function ajaxForms(identifier)
{
	var selector = ( $chk(identifier) ) ? identifier : ".ajaxsubmit";
	$$(selector).each(function(form){
		var parent = form.getParent('.reloadable');
		var url = parent.getElement('.hidden_anchor').getAttribute('href');
		form.setAttribute('action', url);
		new FormCheck( form, { 
			submitByAjax: true,
			ajaxEvalScripts: true,
			//ajaxResponseDiv: parent,
			onAjaxSuccess: function(response){
				response += "<a class=\"hidden_anchor\" href=\""+url+"\"></a>";
				parent.set('html', response);
				onLoad();
			},
			display: { tipsPosition:'left', tipsOffsetX:-16, tipsOffsetY:24 } 
		} );
	});
}


//handle checkboxes from the parent element of the triger which has class = managersClass
function cbcheck( how, el )
{
	var check = "invert";
	switch( how )
	{
		case "all":
			check = true;
			break;
		case "none":
			check = false;
			break;
			
		default:
			check = "invert";
			break;
	}
	if ( domReady )
	{
		var el = $( el );
		if ( el )
		{
			var parentReloadable = el.getParent(managersClass);
			if ( parentReloadable )
			parentReloadable.getElements( 'input[type=checkbox]' ).each( function( el ){
				var row = el.getParent('.row');
				if ( !el.getProperty( 'disabled' ) )
				{
					if ( check == "invert" )
						el.setProperty( 'checked', !el.getProperty( 'checked' ) );
					else
						el.setProperty( 'checked', check );
					if ( el.getProperty('checked') )
						row.addClass('selected');
					else
						row.removeClass('selected');
				}	
			} );
		}	
	}
	return false;
}


// togle a container css class based on a child checkbox. 
function toggle4rows( css, container )
{
	// get elements based on css
	var elements = container ? container.getElements( css ) : $$( css );
	elements.each( function( item ){ // process each element
		var cb = item.getElement( 'input[id^=cb]' ); // get check box
		if ( ! cb ) // check integrity
			return false;
		
		// add click event for check box
		cb.addEvent( "click", function( ev ){
			var checked = this.checked; // get cb status
			if ( ! ev ) // toggle it manually if no click on cb
				this.checked = checked = ! checked;
			if ( checked ) // add selected class
				item.addClass( "selected" );
			else // remove selected class
				item.removeClass( "selected" )
		});
		
		// click on container will fire cb click event as well
		item.addEvent( "click", function( event ){
			var tag = $( event.target ).get( "tag" );
			if ( ( tag != "a" ) && ( tag != "input" ) )
				cb.fireEvent( "click" );
		});
	});
}


// add a new option to a parent element
function addElement(parent, params)
{
	parent = $(parent);
	if (parent)
		new Element('option', params).inject(parent);
}

// convert default navigation to run with ajax
function nav2ajax( hcontainer, hcss )
{
	if ( ! hcss ) hcss = ".navigation a"; // default css for navigation
	if ( hcontainer ) // check css for containers
	$$( hcontainer ).each( function( co ){ // process containers
		co.getElements( hcss ).each( function( item ){ // process navigation elements
			if ( ! item.get( "href" ) ) // check url
				return false;
			var url = item.get( "href" ).toURI(); // get url params
			url.setData( { layout:"off", ajax:"" }, true ); // add ajax params
			item.set( "href", url.toAbsolute() ); // convert back to url
			
			item.addEvent( "click", function( event ){ // add click event
				if ( event ) event.stop(); // stop defult event
				go_request( co, item ); // load item url to container
				return false;
			});
		});
	});
}

// change the default flow for navigation links to work with ajax loading
function ajaxNav()
{
	$$(managersClass+' .navigation a').each(function(item){ // treload
		var url = item.get('href');
		if ( item && url && (url.indexOf("javascript") < 0) )
		{
			item.addEvent('click', function(ev){
				ev.stop();
				var newUrl = url;//urlparam( url, "ajax=ajax&layout=off" );
				selectedIds = new Hash();
				selectedIds.set('ajax', 'ajax');
				selectedIds.set('layout', 'off');
				reloadParent( item, newUrl, selectedIds );
				return false;
			});
		}	
	});
}


// show/hide container with animation
// keep its default size as well
function collexp( id, prop )
{
	// check integrity
	if ( !( id = $( id ) ) )
		return false;
	
	if ( id.get( "rel" ) ) // switch to container if set
		id = $( id.get( "rel" ) );
	
	if ( ! prop ) // default animation
		prop = { duration: "short" };
	
	// get container size
	if ( id.getStyle( "display" ) == "none" )
	{
		id.setStyle( "display", "" ); // show it
		if ( ! id.get( "name" ) ) // get & save its size
			id.set( "name", id.getSize().y );
	}

	// switch to item parent for morph
	var size = id.get( "name" ); // get size
	id = id.getParent( ".collexp" );
	if ( ! id ) return false; // invalid parent
	id.set( "morph", prop );
	if ( id.getSize().y > 8 ) // morph to zero
		id.morph( { "height": "0px" } );
	else // morph to container size
		id.morph( { "height": size } );
	
	return false;
}

// add click events for specified css elements
// and call specified callback function for them
function hook4css( hook, css, container )
{
	var check = css && hook && ( $type( hook ) == "function" );
	if ( ! check ) // check integrity
		return false;
	
	// get elements based on css
	var elements = container ? container.getElements( css ) : $$( css );
	elements.each( function( item ){ // process each element
		item.addEvent( "click", function( event ){ // add click event
			return hook( item );
		});
	});
}

function sendRequest( trigger, values, callback )
{
	// check integrity
	if ( ! ( trigger = checkel( trigger ) ) ) return false;
	if ( !trigger.get( "href" ) ) return false;
	
	new Request({
		url: trigger.get( "href" ),
		evalScripts: true,
		link: 'chain',
		'onRequest': function(){ trigger.addClass( "ajax-loading" ); },
		'onComplete': function(){ trigger.removeClass( "ajax-loading" ); },
		'onSuccess': function(responseText, responseXML) {
			if ( $chk( callback ) ) // callback function
				eval(callback);
		}.bind(this)
	}).send(values);
	return false;	
}

function initCroppers()
{
	$$('.cropper.manual_crop').each(function(item){
		new Cropper(item);
	});
}

var Cropper = new Class({
	initialize: function( el )
	{
		if ( !( this.element = checkel( el ) ) ) return false;
		this.source = this.element.getElement('.source');
		this.saveButton = this.element.getElement('.save');
		this.slider = this.element.getElement('.slider');
		
		if ( this.slider ) // we have zooming
		{
			this.osizes = this.source.getSize(); // original sizes
			this.sizes = this.slider.getAttribute('sizes').parseQueryString(); // smallest sizes
		}
		
		this.init();
		
		// Create drag&drop instance
		this.dragEffect = new Drag(this.source, {
			snap: 0,
			onDrag: function(el, ev){
				this.corectPosition();
				if ( this.saveButton )
					this.saveButton.removeClass('disabled');
			}.bind(this)
		});
		
		// add Save function
		if ( this.saveButton )
		this.saveButton.addEvent( 'click', function(ev){
			ev.stop();
			if ( this.saveButton.hasClass('disabled') == false )
			{
				var resultHash = new Hash( {
					w: this.w,
					h: this.h,
					sx: this.sx,
					sy: this.sy,
					sw: this.sw,
					sh: this.sh,
					action: 'imageCrop'
				} );
				/*
				if ( this.osizes ) // on zoom image sizes could be send to results page. Feature not implemented yet!
				{
					resultHash.set( 'width', this.osizes.x );
					resultHash.set( 'height', this.osizes.y );
				}
				*/
				sendRequest( this.saveButton, resultHash.toQueryString(), "trigger.addClass('disabled');" );
			}
			return false;
		}.bind(this));
		
		if ( this.slider ) // we have zooming
		{
			// Create the horizontal slider instance
			this.sliderEffect = new Slider(this.slider, this.slider.getElement('.knob'), {
				onChange: function(value){
					this.source.setStyles({
						'width' : Math.ceil( value * ( parseInt( this.osizes.x ) - parseInt( this.sizes.sw ) ) / 100 + parseInt( this.sizes.sw ) ), 
						'height': Math.ceil( value * ( parseInt( this.osizes.y ) - parseInt( this.sizes.sh ) ) / 100 + parseInt( this.sizes.sh ) )
					});
					this.init();
				}.bind(this)
			}).set(100);
			
			// add Zoom Out function
			var zoom_out = this.element.getElement('.zoom_out');
			if ( zoom_out )
			zoom_out.addEvent( 'click', function(){
				if ( this.sliderEffect.step > 0 )
					this.sliderEffect.set( this.sliderEffect.step - 1 );
				return false;
			}.bind(this));
			
			// add Zoom In function
			var zoom_in = this.element.getElement('.zoom_in');
			if ( zoom_in )
			zoom_in.addEvent( 'click', function(){
				if ( this.sliderEffect.step < 100 )
					this.sliderEffect.set( this.sliderEffect.step + 1 );
				return false;
			}.bind(this));
		}
	},
	
	// function called on initialize or after zooming, to recompute all needed params. NEEDED!
	init: function()
	{
		this.w = this.source.getSize().x;
		this.h = this.source.getSize().y;
		this.sw = this.element.getSize().x;
		this.sh = this.element.getSize().y;
		this.corectPosition();
	},
	
	// on drag limit image positions to fill always the visible crop area
	corectPosition: function()
	{
		this.sy = parseInt(this.source.getStyle('top'));
		this.sx = parseInt(this.source.getStyle('left'));
		if ( this.sx < -this.w + this.sw ) // restrict movement to left
			this.sx = -this.w + this.sw;
		if ( this.sx > 0 ) // restrict movement to right
			this.sx = 0;
		if ( this.sy < -this.h + this.sh ) // restrict movement to top
			this.sy = -this.h + this.sh;
		if ( this.sy > 0 ) // restrict movement to bottom
			this.sy = 0;
		this.source.setStyles({'top': this.sy+'px', 'left': this.sx+'px'});
	}
});	
