/**
 * This file holds javscript functions that are used by the templates in the Theme
 * 
 */
 
 // AJAX FUNCTIONS 
function loadNewPage( el, url ) {
	
	var theEl = $(el);
	var callback = {
		success : function(responseText) {
			theEl.innerHTML = responseText;
			if( Lightbox ) Lightbox.init();
		}
	}
	var opt = {
	    // Use POST
	    method: 'post',
	    // Handle successful response
	    onComplete: callback.success
    }
	new Ajax( url + '&only_page=1', opt ).request();
}

function handleGoToCart() { document.location = 'index.php?option=com_virtuemart&page=shop.cart&product_id=' + formCartAdd.product_id.value ; }

function handleAddToCart( formId, parameters ) {
	formCartAdd = document.getElementById( formId );
	
	var callback = function(responseText) {
		updateMiniCarts();
		document.boxB = new MooPrompt(notice_lbl, responseText, {
				buttons: 2,
				width:400,
				height:150,
				overlay: false,
				button1: ok_lbl,
				button2: cart_title,
				onButton2: 	handleGoToCart
			});
			
		setTimeout( 'document.boxB.close()', 3000 );
	}
	
	var opt = {
	    // Use POST
	    method: 'post',
	    // Send this lovely data
	    data: $(formId),
	    // Handle successful response
	    onComplete: callback,
	    
	    evalScripts: true
	}

	new Ajax('index2.php?ajax_request=1', opt).request();
}
/**
* This function searches for all elements with the class name "vmCartModule" and
* updates them with the contents of the page "shop.basket_short" after a cart modification event
*/
function updateMiniCarts() {
	var callbackCart = function(responseText) {
		carts = $$( '.vmCartModule' );
		if( carts ) {
			try { 
				for (var i=0; i<carts.length; i++){
					carts[i].innerHTML = responseText;
					color = carts[i].getStyle( 'color' );
					bgcolor = carts[i].getStyle( 'background-color' );
					if( bgcolor == 'transparent' ) {
						// If the current element has no background color, it is transparent.
						// We can't make a highlight without knowing about the real background color,
						// so let's loop up to the next parent that has a BG Color
						parent = carts[i].getParent();
						while( parent && bgcolor == 'transparent' ) {
							bgcolor = parent.getStyle( 'background-color' );
							parent = parent.getParent();
						}
					}
					var fxc = new Fx.Style(carts[i], 'color', {duration: 1000});
					var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000});

					fxc.start( '#222', color );							
					fxbgc.start( '#fff68f', bgcolor );
					if( parent ) {
						setTimeout( "carts[" + i + "].setStyle( 'background-color', 'transparent' )", 1000 );
					}
				}
			} catch(e) {}
		}
	}
	option = { method: 'get', onComplete: callbackCart }
	new Ajax('index2.php?only_page=1&page=shop.basket_short&option=com_virtuemart', option).request();
}
/**
* This function allows you to present contents of a URL in a really nice stylish dhtml Window
* It uses the WindowJS, so make sure you have called
* vmCommonHTML::loadWindowsJS();
* before
*/
function fancyPop( url, parameters ) {
	
	parameters = parameters || {};
	popTitle = parameters.title || '';
	popWidth = parameters.width || 700;
	popHeight = parameters.height || 600;
	popModal = parameters.modal || false;
	
	window_id = new Window('window_id', {className: "mac_os_x", 
										title: popTitle,
										showEffect: Element.show,
										hideEffect: Element.hide,
										width: popWidth, height: popHeight}); 
	window_id.setAjaxContent( url, {evalScripts:true}, true, popModal );
	window_id.setCookie('window_size');
	window_id.setDestroyOnClose();
}

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip 

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="/new/components/com_virtuemart/themes/default/images/arrow2.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip/*==================================================
  $Id: tabber.js,v 1.9 2006/04/27 20:51:51 pat Exp $
  tabber.js by Patrick Fitzgerald pat@barelyfitz.com

  Documentation can be found at the following URL:
  http://www.barelyfitz.com/projects/tabber/

  License (http://www.opensource.org/licenses/mit-license.php)

  Copyright (c) 2006 Patrick Fitzgerald

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
  ==================================================*/

function tabberObj(argsObj)
{
  var arg; /* name of an argument to override */

  /* Element for the main tabber div. If you supply this in argsObj,
     then the init() method will be called.
  */
  this.div = null;

  /* Class of the main tabber div */
  this.classMain = "tabber";

  /* Rename classMain to classMainLive after tabifying
     (so a different style can be applied)
  */
  this.classMainLive = "tabberlive";

  /* Class of each DIV that contains a tab */
  this.classTab = "tabbertab";

  /* Class to indicate which tab should be active on startup */
  this.classTabDefault = "tabbertabdefault";

  /* Class for the navigation UL */
  this.classNav = "tabbernav";

  /* When a tab is to be hidden, instead of setting display='none', we
     set the class of the div to classTabHide. In your screen
     stylesheet you should set classTabHide to display:none.  In your
     print stylesheet you should set display:block to ensure that all
     the information is printed.
  */
  this.classTabHide = "tabbertabhide";

  /* Class to set the navigation LI when the tab is active, so you can
     use a different style on the active tab.
  */
  this.classNavActive = "tabberactive";

  /* Elements that might contain the title for the tab, only used if a
     title is not specified in the TITLE attribute of DIV classTab.
  */
  this.titleElements = ['h2','h3','h4','h5','h6'];

  /* Should we strip out the HTML from the innerHTML of the title elements?
     This should usually be true.
  */
  this.titleElementsStripHTML = true;

  /* If the user specified the tab names using a TITLE attribute on
     the DIV, then the browser will display a tooltip whenever the
     mouse is over the DIV. To prevent this tooltip, we can remove the
     TITLE attribute after getting the tab name.
  */
  this.removeTitle = true;

  /* If you want to add an id to each link set this to true */
  this.addLinkId = false;

  /* If addIds==true, then you can set a format for the ids.
     <tabberid> will be replaced with the id of the main tabber div.
     <tabnumberzero> will be replaced with the tab number
       (tab numbers starting at zero)
     <tabnumberone> will be replaced with the tab number
       (tab numbers starting at one)
     <tabtitle> will be replaced by the tab title
       (with all non-alphanumeric characters removed)
   */
  this.linkIdFormat = '<tabberid>nav<tabnumberone>';

  /* You can override the defaults listed above by passing in an object:
     var mytab = new tabber({property:value,property:value});
  */
  for (arg in argsObj) { this[arg] = argsObj[arg]; }

  /* Create regular expressions for the class names; Note: if you
     change the class names after a new object is created you must
     also change these regular expressions.
  */
  this.REclassMain = new RegExp('\\b' + this.classMain + '\\b', 'gi');
  this.REclassMainLive = new RegExp('\\b' + this.classMainLive + '\\b', 'gi');
  this.REclassTab = new RegExp('\\b' + this.classTab + '\\b', 'gi');
  this.REclassTabDefault = new RegExp('\\b' + this.classTabDefault + '\\b', 'gi');
  this.REclassTabHide = new RegExp('\\b' + this.classTabHide + '\\b', 'gi');

  /* Array of objects holding info about each tab */
  this.tabs = new Array();

  /* If the main tabber div was specified, call init() now */
  if (this.div) {

    this.init(this.div);

    /* We don't need the main div anymore, and to prevent a memory leak
       in IE, we must remove the circular reference between the div
       and the tabber object. */
    this.div = null;
  }
}


/*--------------------------------------------------
  Methods for tabberObj
  --------------------------------------------------*/


tabberObj.prototype.init = function(e)
{
  /* Set up the tabber interface.

     e = element (the main containing div)

     Example:
     init(document.getElementById('mytabberdiv'))
   */

  var
  childNodes, /* child nodes of the tabber div */
  i, i2, /* loop indices */
  t, /* object to store info about a single tab */
  defaultTab=0, /* which tab to select by default */
  DOM_ul, /* tabbernav list */
  DOM_li, /* tabbernav list item */
  DOM_a, /* tabbernav link */
  aId, /* A unique id for DOM_a */
  headingElement; /* searching for text to use in the tab */

  /* Verify that the browser supports DOM scripting */
  if (!document.getElementsByTagName) { return false; }

  /* If the main DIV has an ID then save it. */
  if (e.id) {
    this.id = e.id;
  }

  /* Clear the tabs array (but it should normally be empty) */
  this.tabs.length = 0;

  /* Loop through an array of all the child nodes within our tabber element. */
  childNodes = e.childNodes;
  for(i=0; i < childNodes.length; i++) {

    /* Find the nodes where class="tabbertab" */
    if(childNodes[i].className &&
       childNodes[i].className.match(this.REclassTab)) {
      
      /* Create a new object to save info about this tab */
      t = new Object();
      
      /* Save a pointer to the div for this tab */
      t.div = childNodes[i];
      
      /* Add the new object to the array of tabs */
      this.tabs[this.tabs.length] = t;

      /* If the class name contains classTabDefault,
	 then select this tab by default.
      */
      if (childNodes[i].className.match(this.REclassTabDefault)) {
	defaultTab = this.tabs.length-1;
      }
    }
  }

  /* Create a new UL list to hold the tab headings */
  DOM_ul = document.createElement("ul");
  DOM_ul.className = this.classNav;
  
  /* Loop through each tab we found */
  for (i=0; i < this.tabs.length; i++) {

    t = this.tabs[i];

    /* Get the label to use for this tab:
       From the title attribute on the DIV,
       Or from one of the this.titleElements[] elements,
       Or use an automatically generated number.
     */
    t.headingText = t.div.title;

    /* Remove the title attribute to prevent a tooltip from appearing */
    if (this.removeTitle) { t.div.title = ''; }

    if (!t.headingText) {

      /* Title was not defined in the title of the DIV,
	 So try to get the title from an element within the DIV.
	 Go through the list of elements in this.titleElements
	 (typically heading elements ['h2','h3','h4'])
      */
      for (i2=0; i2<this.titleElements.length; i2++) {
	headingElement = t.div.getElementsByTagName(this.titleElements[i2])[0];
	if (headingElement) {
	  t.headingText = headingElement.innerHTML;
	  if (this.titleElementsStripHTML) {
	    t.headingText.replace(/<br>/gi," ");
	    t.headingText = t.headingText.replace(/<[^>]+>/g,"");
	  }
	  break;
	}
      }
    }

    if (!t.headingText) {
      /* Title was not found (or is blank) so automatically generate a
         number for the tab.
      */
      t.headingText = i + 1;
    }

    /* Create a list element for the tab */
    DOM_li = document.createElement("li");

    /* Save a reference to this list item so we can later change it to
       the "active" class */
    t.li = DOM_li;

    /* Create a link to activate the tab */
    DOM_a = document.createElement("a");
    DOM_a.appendChild(document.createTextNode(t.headingText));
    DOM_a.href = "javascript:void(null);";
    DOM_a.title = t.headingText;
    DOM_a.onclick = this.navClick;

    /* Add some properties to the link so we can identify which tab
       was clicked. Later the navClick method will need this.
    */
    DOM_a.tabber = this;
    DOM_a.tabberIndex = i;

    /* Do we need to add an id to DOM_a? */
    if (this.addLinkId && this.linkIdFormat) {

      /* Determine the id name */
      aId = this.linkIdFormat;
      aId = aId.replace(/<tabberid>/gi, this.id);
      aId = aId.replace(/<tabnumberzero>/gi, i);
      aId = aId.replace(/<tabnumberone>/gi, i+1);
      aId = aId.replace(/<tabtitle>/gi, t.headingText.replace(/[^a-zA-Z0-9\-]/gi, ''));

      DOM_a.id = aId;
    }

    /* Add the link to the list element */
    DOM_li.appendChild(DOM_a);

    /* Add the list element to the list */
    DOM_ul.appendChild(DOM_li);
  }

  /* Add the UL list to the beginning of the tabber div */
  e.insertBefore(DOM_ul, e.firstChild);

  /* Make the tabber div "live" so different CSS can be applied */
  e.className = e.className.replace(this.REclassMain, this.classMainLive);

  /* Activate the default tab, and do not call the onclick handler */
  this.tabShow(defaultTab);

  /* If the user specified an onLoad function, call it now. */
  if (typeof this.onLoad == 'function') {
    this.onLoad({tabber:this});
  }

  return this;
};


tabberObj.prototype.navClick = function(event)
{
  /* This method should only be called by the onClick event of an <A>
     element, in which case we will determine which tab was clicked by
     examining a property that we previously attached to the <A>
     element.

     Since this was triggered from an onClick event, the variable
     "this" refers to the <A> element that triggered the onClick
     event (and not to the tabberObj).

     When tabberObj was initialized, we added some extra properties
     to the <A> element, for the purpose of retrieving them now. Get
     the tabberObj object, plus the tab number that was clicked.
  */

  var
  rVal, /* Return value from the user onclick function */
  a, /* element that triggered the onclick event */
  self, /* the tabber object */
  tabberIndex, /* index of the tab that triggered the event */
  onClickArgs; /* args to send the onclick function */

  a = this;
  if (!a.tabber) { return false; }

  self = a.tabber;
  tabberIndex = a.tabberIndex;

  /* Remove focus from the link because it looks ugly.
     I don't know if this is a good idea...
  */
  a.blur();

  /* If the user specified an onClick function, call it now.
     If the function returns false then do not continue.
  */
  if (typeof self.onClick == 'function') {

    onClickArgs = {'tabber':self, 'index':tabberIndex, 'event':event};

    /* IE uses a different way to access the event object */
    if (!event) { onClickArgs.event = window.event; }

    rVal = self.onClick(onClickArgs);
    if (rVal === false) { return false; }
  }

  self.tabShow(tabberIndex);

  return false;
};


tabberObj.prototype.tabHideAll = function()
{
  var i; /* counter */

  /* Hide all tabs and make all navigation links inactive */
  for (i = 0; i < this.tabs.length; i++) {
    this.tabHide(i);
  }
};


tabberObj.prototype.tabHide = function(tabberIndex)
{
  var div;

  if (!this.tabs[tabberIndex]) { return false; }

  /* Hide a single tab and make its navigation link inactive */
  div = this.tabs[tabberIndex].div;

  /* Hide the tab contents by adding classTabHide to the div */
  if (!div.className.match(this.REclassTabHide)) {
    div.className += ' ' + this.classTabHide;
  }
  this.navClearActive(tabberIndex);

  return this;
};


tabberObj.prototype.tabShow = function(tabberIndex)
{
  /* Show the tabberIndex tab and hide all the other tabs */

  var div;

  if (!this.tabs[tabberIndex]) { return false; }

  /* Hide all the tabs first */
  this.tabHideAll();

  /* Get the div that holds this tab */
  div = this.tabs[tabberIndex].div;

  /* Remove classTabHide from the div */
  div.className = div.className.replace(this.REclassTabHide, '');

  /* Mark this tab navigation link as "active" */
  this.navSetActive(tabberIndex);

  /* If the user specified an onTabDisplay function, call it now. */
  if (typeof this.onTabDisplay == 'function') {
    this.onTabDisplay({'tabber':this, 'index':tabberIndex});
  }

  return this;
};

tabberObj.prototype.navSetActive = function(tabberIndex)
{
  /* Note: this method does *not* enforce the rule
     that only one nav item can be active at a time.
  */

  /* Set classNavActive for the navigation list item */
  this.tabs[tabberIndex].li.className = this.classNavActive;

  return this;
};


tabberObj.prototype.navClearActive = function(tabberIndex)
{
  /* Note: this method does *not* enforce the rule
     that one nav should always be active.
  */

  /* Remove classNavActive from the navigation list item */
  this.tabs[tabberIndex].li.className = '';

  return this;
};


/*==================================================*/


function tabberAutomatic(tabberArgs)
{
  /* This function finds all DIV elements in the document where
     class=tabber.classMain, then converts them to use the tabber
     interface.

     tabberArgs = an object to send to "new tabber()"
  */
  var
    tempObj, /* Temporary tabber object */
    divs, /* Array of all divs on the page */
    i; /* Loop index */

  if (!tabberArgs) { tabberArgs = {}; }

  /* Create a tabber object so we can get the value of classMain */
  tempObj = new tabberObj(tabberArgs);

  /* Find all DIV elements in the document that have class=tabber */

  /* First get an array of all DIV elements and loop through them */
  divs = document.getElementsByTagName("div");
  for (i=0; i < divs.length; i++) {
    
    /* Is this DIV the correct class? */
    if (divs[i].className &&
	divs[i].className.match(tempObj.REclassMain)) {
      
      /* Now tabify the DIV */
      tabberArgs.div = divs[i];
      divs[i].tabber = new tabberObj(tabberArgs);
    }
  }
  
  return this;
}


/*==================================================*/


function tabberAutomaticOnLoad(tabberArgs)
{
  /* This function adds tabberAutomatic to the window.onload event,
     so it will run after the document has finished loading.
  */
  var oldOnLoad;

  if (!tabberArgs) { tabberArgs = {}; }

  /* Taken from: http://simon.incutio.com/archive/2004/05/26/addLoadEvent */

  oldOnLoad = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = function() {
      tabberAutomatic(tabberArgs);
    };
  } else {
    window.onload = function() {
      oldOnLoad();
      tabberAutomatic(tabberArgs);
    };
  }
}


/*==================================================*/


/* Run tabberAutomaticOnload() unless the "manualStartup" option was specified */

if (typeof tabberOptions == 'undefined') {

    tabberAutomaticOnLoad();

} else {

  if (!tabberOptions['manualStartup']) {
    tabberAutomaticOnLoad(tabberOptions);
  }

}/**********************************************************
Sleight
(c) 2001, Aaron Boodman
http://www.youngpup.net
**********************************************************/

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent
	&& (navigator.appVersion.indexOf("msie 5") > -1 || navigator.appVersion.indexOf("msie 6") > -1) ) {
    document.writeln('<style type="text/css">img, input.image { visibility:hidden; } </style>');
    window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs() {
    var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
    var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

    for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
        if (itsAllGood && img.src.match(/(.*)\/com_virtuemart\/(.*)\.png$/i) != null) {
            fnFixPng(img);
            img.attachEvent("onpropertychange", fnPropertyChanged);
        }
        img.style.visibility = "visible";
    }

    var nl = document.getElementsByTagName("INPUT");
    for (var i = nl.length - 1, e = null; (e = nl[i]); i--) {
        if (e.className && e.className.match(/\bimage\b/i) != null) {
            if (e.src.match(/\.png$/i) != null) {
                fnFixPng(e);
                e.attachEvent("onpropertychange", fnPropertyChanged);
            }
            e.style.visibility = "visible";
        }
    }
}

function fnPropertyChanged() {
    if (window.event.propertyName == "src") {
        var el = window.event.srcElement;
        if (!el.src.match(/x\.gif$/i)) {
            el.filters.item(0).src = el.src;
            el.src = "x.gif";
        }
    }
}

function dbg(o) {
    var s = "";
    var i = 0;
    for (var p in o) {
        s += p + ": " + o[p] + "\n";
        if (++i % 10 == 0) {
            alert(s);
            s = "";
        }
    }
    alert(s);
}

function fnFixPng(img) {
    var src = img.src;
    img.style.width = img.width + "px";
    img.style.height = img.height + "px";
    img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
    img.src = "components/com_virtuemart/shop_image/blank.gif";
}//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

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}('o bz={bq:\'1.11\'};k $6Y(N){m(N!=ae)};k $F(N){B(!$6Y(N))m P;B(N.4P)m\'I\';o F=6S N;B(F==\'2G\'&&N.bs){25(N.8A){Y 1:m\'I\';Y 3:m(/\\S/).2u(N.aM)?\'bD\':\'bF\'}}B(F==\'2G\'||F==\'k\'){25(N.a8){Y 2x:m\'1z\';Y 7D:m\'5A\';Y 19:m\'4R\'}B(6S N.U==\'4X\'){B(N.3g)m\'bG\';B(N.7L)m\'1b\'}}m F};k $26(){o 4E={};M(o i=0;i<1b.U;i++){M(o K 1c 1b[i]){o ap=1b[i][K];o 72=4E[K];B(72&&$F(ap)==\'2G\'&&$F(72)==\'2G\')4E[K]=$26(72,ap);15 4E[K]=ap}}m 4E};o $T=k(){o 1p=1b;B(!1p[1])1p=[c,1p[0]];M(o K 1c 1p[1])1p[0][K]=1p[1][K];m 1p[0]};o $5e=k(){M(o i=0,l=1b.U;i<l;i++){1b[i].T=k(1S){M(o 1U 1c 1S){B(!c.1H[1U])c.1H[1U]=1S[1U];B(!c[1U])c[1U]=$5e.63(1U)}}}};$5e.63=k(1U){m k(12){m c.1H[1U].49(12,2x.1H.aS.1R(1b,1))}};$5e(8C,2x,6k,an);k $2D(N){m!!(N||N===0)};k $5h(N,9v){m $6Y(N)?N:9v};k $7N(3l,1G){m 1d.aD(1d.7N()*(1G-3l+1)+3l)};k $3K(){m L ay().ad()};k $5S(1X){bl(1X);be(1X);m 1n};o 3t=k(N){N=N||{};N.T=$T;m N};o bP=L 3t(W);o cK=L 3t(R);R.79=R.34(\'79\')[0];W.3W=!!(R.5i);B(W.a3)W.2N=W[W.66?\'cN\':\'a0\']=1f;15 B(R.aE&&!R.cC&&!c1.cJ)W.4n=W[W.3W?\'cb\':\'6M\']=1f;15 B(R.bV!=1n)W.8f=1f;W.bT=W.4n;8a.T=$T;B(6S 5o==\'ae\'){o 5o=k(){};B(W.4n)R.aH("cE");5o.1H=(W.4n)?W["[[cI.1H]]"]:{}}5o.1H.4P=k(){};B(W.a0)55{R.cr("cp",P,1f)}57(e){};o 19=k(1E){o 5m=k(){m(1b[0]!==1n&&c.1l&&$F(c.1l)==\'k\')?c.1l.49(c,1b):c};$T(5m,c);5m.1H=1E;5m.a8=19;m 5m};19.1m=k(){};19.1H={T:k(1E){o 71=L c(1n);M(o K 1c 1E){o aF=71[K];71[K]=19.aq(aF,1E[K])}m L 19(71)},3z:k(){M(o i=0,l=1b.U;i<l;i++)$T(c.1H,1b[i])}};19.aq=k(2k,2i){B(2k&&2k!=2i){o F=$F(2i);B(F!=$F(2k))m 2i;25(F){Y\'k\':o 8d=k(){c.1C=1b.7L.1C;m 2i.49(c,1b)};8d.1C=2k;m 8d;Y\'2G\':m $26(2k,2i)}}m 2i};o 8H=L 19({bI:k(V){c.4e=c.4e||[];c.4e.1i(V);m c},7v:k(){B(c.4e&&c.4e.U)c.4e.9B().2g(10,c)},bE:k(){c.4e=[]}});o 2p=L 19({1O:k(F,V){B(V!=19.1m){c.$1a=c.$1a||{};c.$1a[F]=c.$1a[F]||[];c.$1a[F].61(V)}m c},1h:k(F,1p,2g){B(c.$1a&&c.$1a[F]){c.$1a[F].1q(k(V){V.3e({\'12\':c,\'2g\':2g,\'1b\':1p})()},c)}m c},5c:k(F,V){B(c.$1a&&c.$1a[F])c.$1a[F].2O(V);m c}});o 4b=L 19({33:k(){c.C=$26.49(1n,[c.C].T(1b));B(c.1O){M(o 3u 1c c.C){B($F(c.C[3u]==\'k\')&&(/^5I[A-Z]/).2u(3u))c.1O(3u,c.C[3u])}}m c}});2x.T({6m:k(V,12){M(o i=0,j=c.U;i<j;i++)V.1R(12,c[i],i,c)},2Y:k(V,12){o 59=[];M(o i=0,j=c.U;i<j;i++){B(V.1R(12,c[i],i,c))59.1i(c[i])}m 59},2z:k(V,12){o 59=[];M(o i=0,j=c.U;i<j;i++)59[i]=V.1R(12,c[i],i,c);m 59},4m:k(V,12){M(o i=0,j=c.U;i<j;i++){B(!V.1R(12,c[i],i,c))m P}m 1f},bu:k(V,12){M(o i=0,j=c.U;i<j;i++){B(V.1R(12,c[i],i,c))m 1f}m P},3L:k(3g,17){o 3N=c.U;M(o i=(17<0)?1d.1G(0,3N+17):17||0;i<3N;i++){B(c[i]===3g)m i}m-1},8B:k(1j,U){1j=1j||0;B(1j<0)1j=c.U+1j;U=U||(c.U-1j);o 8q=[];M(o i=0;i<U;i++)8q[i]=c[1j++];m 8q},2O:k(3g){o i=0;o 3N=c.U;6r(i<3N){B(c[i]===3g){c.6B(i,1);3N--}15{i++}}m c},1k:k(3g,17){m c.3L(3g,17)!=-1},bw:k(1M){o N={},U=1d.3l(c.U,1M.U);M(o i=0;i<U;i++)N[1M[i]]=c[i];m N},T:k(1z){M(o i=0,j=1z.U;i<j;i++)c.1i(1z[i]);m c},26:k(1z){M(o i=0,l=1z.U;i<l;i++)c.61(1z[i]);m c},61:k(3g){B(!c.1k(3g))c.1i(3g);m c},bx:k(){m c[$7N(0,c.U-1)]||1n},7i:k(){m c[c.U-1]||1n}});2x.1H.1q=2x.1H.6m;2x.1q=2x.6m;k $A(1z){m 2x.8B(1z)};k $1q(47,V,12){B(47&&6S 47.U==\'4X\'&&$F(47)!=\'2G\'){2x.6m(47,V,12)}15{M(o 1w 1c 47)V.1R(12||47,47[1w],1w)}};2x.1H.2u=2x.1H.1k;6k.T({2u:k(6n,2V){m(($F(6n)==\'2r\')?L 7D(6n,2V):6n).2u(c)},36:k(){m 5r(c,10)},b3:k(){m 5G(c)},81:k(){m c.3f(/-\\D/g,k(2Z){m 2Z.8s(1).7p()})},b7:k(){m c.3f(/\\w[A-Z]/g,k(2Z){m(2Z.8s(0)+\'-\'+2Z.8s(1).5B())})},8u:k(){m c.3f(/\\b[a-z]/g,k(2Z){m 2Z.7p()})},5Z:k(){m c.3f(/^\\s+|\\s+$/g,\'\')},7m:k(){m c.3f(/\\s{2,}/g,\' \').5Z()},5n:k(1z){o 1s=c.2Z(/\\d{1,3}/g);m(1s)?1s.5n(1z):P},5q:k(1z){o 3r=c.2Z(/^#?(\\w{1,2})(\\w{1,2})(\\w{1,2})$/);m(3r)?3r.aS(1).5q(1z):P},1k:k(2r,s){m(s)?(s+c+s).3L(s+2r+s)>-1:c.3L(2r)>-1},aN:k(){m c.3f(/([.*+?^${}()|[\\]\\/\\\\])/g,\'\\\\$1\')}});2x.T({5n:k(1z){B(c.U<3)m P;B(c.U==4&&c[3]==0&&!1z)m\'by\';o 3r=[];M(o i=0;i<3;i++){o 54=(c[i]-0).4x(16);3r.1i((54.U==1)?\'0\'+54:54)}m 1z?3r:\'#\'+3r.2b(\'\')},5q:k(1z){B(c.U!=3)m P;o 1s=[];M(o i=0;i<3;i++){1s.1i(5r((c[i].U==1)?c[i]+c[i]:c[i],16))}m 1z?1s:\'1s(\'+1s.2b(\',\')+\')\'}});8C.T({3e:k(C){o V=c;C=$26({\'12\':V,\'G\':P,\'1b\':1n,\'2g\':P,\'4C\':P,\'6o\':P},C);B($2D(C.1b)&&$F(C.1b)!=\'1z\')C.1b=[C.1b];m k(G){o 1p;B(C.G){G=G||W.G;1p=[(C.G===1f)?G:L C.G(G)];B(C.1b)1p.T(C.1b)}15 1p=C.1b||1b;o 3B=k(){m V.49($5h(C.12,V),1p)};B(C.2g)m af(3B,C.2g);B(C.4C)m bv(3B,C.4C);B(C.6o)55{m 3B()}57(bo){m P};m 3B()}},bn:k(1p,12){m c.3e({\'1b\':1p,\'12\':12})},6o:k(1p,12){m c.3e({\'1b\':1p,\'12\':12,\'6o\':1f})()},12:k(12,1p){m c.3e({\'12\':12,\'1b\':1p})},bH:k(12,1p){m c.3e({\'12\':12,\'G\':1f,\'1b\':1p})},2g:k(2g,12,1p){m c.3e({\'2g\':2g,\'12\':12,\'1b\':1p})()},4C:k(aC,12,1p){m c.3e({\'4C\':aC,\'12\':12,\'1b\':1p})()}});an.T({36:k(){m 5r(c)},b3:k(){m 5G(c)},1D:k(3l,1G){m 1d.3l(1G,1d.1G(3l,c))},2n:k(5l){5l=1d.3A(10,5l||0);m 1d.2n(c*5l)/5l},bf:k(V){M(o i=0;i<c;i++)V(i)}});o O=L 19({1l:k(el,1S){B($F(el)==\'2r\'){B(W.2N&&1S&&(1S.1w||1S.F)){o 1w=(1S.1w)?\' 1w="\'+1S.1w+\'"\':\'\';o F=(1S.F)?\' F="\'+1S.F+\'"\':\'\';4I 1S.1w;4I 1S.F;el=\'<\'+el+1w+F+\'>\'}el=R.aH(el)}el=$(el);m(!1S||!el)?el:el.2f(1S)}});o 21=L 19({1l:k(Q){m(Q)?$T(Q,c):c}});21.T=k(1S){M(o 1U 1c 1S){c.1H[1U]=1S[1U];c[1U]=$5e.63(1U)}};k $(el){B(!el)m 1n;B(el.4P)m 2A.52(el);B([W,R].1k(el))m el;o F=$F(el);B(F==\'2r\'){el=R.6x(el);F=(el)?\'I\':P}B(F!=\'I\')m 1n;B(el.4P)m 2A.52(el);B([\'2G\',\'bk\'].1k(el.6I.5B()))m el;$T(el,O.1H);el.4P=k(){};m 2A.52(el)};R.6D=R.34;k $$(){o Q=[];M(o i=0,j=1b.U;i<j;i++){o 1Q=1b[i];25($F(1Q)){Y\'I\':Q.1i(1Q);Y\'cO\':1A;Y P:1A;Y\'2r\':1Q=R.6D(1Q,1f);5Q:Q.T(1Q)}}m $$.5p(Q)};$$.5p=k(1z){o Q=[];M(o i=0,l=1z.U;i<l;i++){B(1z[i].$67)6v;o I=$(1z[i]);B(I&&!I.$67){I.$67=1f;Q.1i(I)}}M(o n=0,d=Q.U;n<d;n++)Q[n].$67=1n;m L 21(Q)};21.6W=k(K){m k(){o 1p=1b;o 1y=[];o Q=1f;M(o i=0,j=c.U,3B;i<j;i++){3B=c[i][K].49(c[i],1p);B($F(3B)!=\'I\')Q=P;1y.1i(3B)};m(Q)?$$.5p(1y):1y}};O.T=k(1E){M(o K 1c 1E){5o.1H[K]=1E[K];O.1H[K]=1E[K];O[K]=$5e.63(K);o au=(2x.1H[K])?K+\'21\':K;21.1H[au]=21.6W(K)}};O.T({2f:k(1S){M(o 1U 1c 1S){o 4h=1S[1U];25(1U){Y\'7F\':c.4i(4h);1A;Y\'1a\':B(c.78)c.78(4h);1A;Y\'1E\':c.76(4h);1A;5Q:c.6P(1U,4h)}}m c},23:k(el,az){el=$(el);25(az){Y\'ar\':el.3n.7t(c,el);1A;Y\'aj\':o 3G=el.7k();B(!3G)el.3n.7o(c);15 el.3n.7t(c,3G);1A;Y\'1o\':o 7u=el.7P;B(7u){el.7t(c,7u);1A}5Q:el.7o(c)}m c},8z:k(el){m c.23(el,\'ar\')},6Q:k(el){m c.23(el,\'aj\')},cH:k(el){m c.23(el,\'3H\')},cB:k(el){m c.23(el,\'1o\')},ba:k(){o Q=[];$1q(1b,k(4g){Q=Q.7q(4g)});$$(Q).23(c);m c},2O:k(){m c.3n.bd(c)},a4:k(ax){o el=$(c.cG(ax!==P));B(!el.$1a)m el;el.$1a={};M(o F 1c c.$1a)el.$1a[F]={\'1M\':$A(c.$1a[F].1M),\'2q\':$A(c.$1a[F].2q)};m el.6E()},cl:k(el){el=$(el);c.3n.ck(el,c);m el},9d:k(1F){c.7o(R.c0(1F));m c},7f:k(1B){m c.1B.1k(1B,\' \')},a6:k(1B){B(!c.7f(1B))c.1B=(c.1B+\' \'+1B).7m();m c},9W:k(1B){c.1B=c.1B.3f(L 7D(\'(^|\\\\s)\'+1B+\'(?:\\\\s|$)\'),\'$1\').7m();m c},c2:k(1B){m c.7f(1B)?c.9W(1B):c.a6(1B)},1P:k(K,J){25(K){Y\'1V\':m c.aX(5G(J));Y\'bY\':K=(W.2N)?\'bS\':\'bU\'}K=K.81();25($F(J)){Y\'4X\':B(![\'bX\',\'aZ\'].1k(K))J+=\'4T\';1A;Y\'1z\':J=\'1s(\'+J.2b(\',\')+\')\'}c.1J[K]=J;m c},4i:k(1W){25($F(1W)){Y\'2G\':O.6y(c,\'1P\',1W);1A;Y\'2r\':c.1J.84=1W}m c},aX:k(1V){B(1V==0){B(c.1J.4v!="4k")c.1J.4v="4k"}15{B(c.1J.4v!="7V")c.1J.4v="7V"}B(!c.6w||!c.6w.bW)c.1J.aZ=1;B(W.2N)c.1J.2Y=(1V==1)?\'\':"73(1V="+1V*2X+")";c.1J.1V=c.$1T.1V=1V;m c},2e:k(K){K=K.81();o 1K=c.1J[K];B(!$2D(1K)){B(K==\'1V\')m c.$1T.1V;1K=[];M(o 1J 1c O.3V){B(K==1J){O.3V[1J].1q(k(s){o 1J=c.2e(s);1K.1i(5r(1J)?1J:\'9q\')},c);B(K==\'2Q\'){o 4m=1K.4m(k(54){m(54==1K[0])});m(4m)?1K[0]:P}m 1K.2b(\' \')}}B(K.1k(\'2Q\')){B(O.3V.2Q.1k(K)){m[\'9C\',\'7G\',\'2I\'].2z(k(p){m c.2e(K+p)},c).2b(\' \')}15 B(O.9y.1k(K)){m[\'9r\',\'9p\',\'9o\',\'9l\'].2z(k(p){m c.2e(\'2Q\'+p+K.3f(\'2Q\',\'\'))},c).2b(\' \')}}B(R.bb)1K=R.bb.c6(c,1n).cg(K.b7());15 B(c.6w)1K=c.6w[K]}B(W.2N)1K=O.9D(K,1K,c);B(1K&&K.2u(/2B/i)&&1K.1k(\'1s\')){m 1K.5V(\'1s\').6B(1,4).2z(k(2B){m 2B.5n()}).2b(\' \')}m 1K},bc:k(){m O.7l(c,\'2e\',1b)},5k:k(6R,1j){6R+=\'cf\';o el=(1j)?c[1j]:c[6R];6r(el&&$F(el)!=\'I\')el=el[6R];m $(el)},9Z:k(){m c.5k(\'2k\')},7k:k(){m c.5k(\'3G\')},ch:k(){m c.5k(\'3G\',\'7P\')},7i:k(){m c.5k(\'2k\',\'ci\')},cj:k(){m $(c.3n)},88:k(){m $$(c.aE)},8n:k(el){m!!$A(c.34(\'*\')).1k(el)},5z:k(K){o 1Z=O.6A[K];B(1Z)m c[1Z];o 7K=O.9T[K]||0;B(!W.2N||7K)m c.ce(K,7K);o 7H=c.cd[K];m(7H)?7H.aM:1n},c8:k(K){o 1Z=O.6A[K];B(1Z)c[1Z]=\'\';15 c.9M(K);m c},c7:k(){m O.7l(c,\'5z\',1b)},6P:k(K,J){o 1Z=O.6A[K];B(1Z)c[1Z]=J;15 c.c9(K,J);m c},76:k(1W){m O.6y(c,\'6P\',1W)},5W:k(){c.9G=$A(1b).2b(\'\');m c},cc:k(1F){o 3i=c.4s();B([\'1J\',\'2v\'].1k(3i)){B(W.2N){B(3i==\'1J\')c.8S.84=1F;15 B(3i==\'2v\')c.6P(\'1F\',1F);m c}15{c.bd(c.7P);m c.9d(1F)}}c[$6Y(c.7E)?\'7E\':\'9O\']=1F;m c},ca:k(){o 3i=c.4s();B([\'1J\',\'2v\'].1k(3i)){B(W.2N){B(3i==\'1J\')m c.8S.84;15 B(3i==\'2v\')m c.5z(\'1F\')}15{m c.9G}}m($5h(c.7E,c.9O))},4s:k(){m c.6I.5B()},1m:k(){2A.3T(c.34(\'*\'));m c.5W(\'\')}});O.9D=k(K,1K,I){B($2D(5r(1K)))m 1K;B([\'2L\',\'2t\'].1k(K)){o 2q=(K==\'2t\')?[\'1r\',\'4j\']:[\'1o\',\'3H\'];o 5D=0;2q.1q(k(J){5D+=I.2e(\'2Q-\'+J+\'-2t\').36()+I.2e(\'4l-\'+J).36()});m I[\'1I\'+K.8u()]-5D+\'4T\'}15 B(K.2u(/2Q(.+)9C|3d|4l/)){m\'9q\'}m 1K};O.3V={\'2Q\':[],\'4l\':[],\'3d\':[]};[\'9r\',\'9p\',\'9o\',\'9l\'].1q(k(9u){M(o 1J 1c O.3V)O.3V[1J].1i(1J+9u)});O.9y=[\'bZ\',\'c4\',\'c3\'];O.7l=k(el,22,1M){o 1K={};$1q(1M,k(1t){1K[1t]=el[22](1t)});m 1K};O.6y=k(el,22,7y){M(o 1t 1c 7y)el[22](1t,7y[1t]);m el};O.6A=L 3t({\'4R\':\'1B\',\'M\':\'cF\',\'cD\':\'cM\',\'cL\':\'bR\',\'cA\':\'cz\',\'cq\':\'cm\',\'cn\':\'cs\',\'ct\':\'cy\',\'cx\':\'cw\',\'J\':\'J\',\'7e\':\'7e\',\'7z\':\'7z\',\'7A\':\'7A\',\'89\':\'89\'});O.9T={\'6O\':2,\'4t\':2};O.2H={6F:{2J:k(F,V){B(c.8x)c.8x(F,V,P);15 c.cu(\'5I\'+F,V);m c},3p:k(F,V){B(c.9Q)c.9Q(F,V,P);15 c.cv(\'5I\'+F,V);m c}}};W.T(O.2H.6F);R.T(O.2H.6F);O.T(O.2H.6F);o 2A={Q:[],52:k(el){B(!el.$1T){2A.Q.1i(el);el.$1T={\'1V\':1}}m el},3T:k(Q){M(o i=0,j=Q.U,el;i<j;i++){B(!(el=Q[i])||!el.$1T)6v;B(el.$1a)el.1h(\'3T\').6E();M(o p 1c el.$1T)el.$1T[p]=1n;M(o d 1c O.1H)el[d]=1n;2A.Q[2A.Q.3L(el)]=1n;el.4P=el.$1T=el=1n}2A.Q.2O(1n)},1m:k(){2A.52(W);2A.52(R);2A.3T(2A.Q)}};W.2J(\'9A\',k(){W.2J(\'8i\',2A.1m);B(W.2N)W.2J(\'8i\',bg)});o 2W=L 19({1l:k(G){B(G&&G.$9z)m G;c.$9z=1f;G=G||W.G;c.G=G;c.F=G.F;c.4Z=G.4Z||G.bh;B(c.4Z.8A==3)c.4Z=c.4Z.3n;c.9B=G.bi;c.bj=G.bQ;c.bJ=G.bK;c.bm=G.bO;B([\'8b\',\'6G\'].1k(c.F)){c.bN=(G.8P)?G.8P/bL:-(G.bM||0)/3}15 B(c.F.1k(\'1t\')){c.6X=G.93||G.bC;M(o 1w 1c 2W.1M){B(2W.1M[1w]==c.6X){c.1t=1w;1A}}B(c.F==\'9s\'){o 6U=c.6X-bB;B(6U>0&&6U<13)c.1t=\'f\'+6U}c.1t=c.1t||6k.bt(c.6X).5B()}15 B(c.F.2u(/(8j|3k|bp)/)){c.2P={\'x\':G.8w||G.9b+R.2S.5F,\'y\':G.8r||G.98+R.2S.5E};c.bA={\'x\':G.8w?G.8w-W.9H:G.9b,\'y\':G.8r?G.8r-W.9K:G.98};c.c5=(G.93==3)||(G.dp==2);25(c.F){Y\'8D\':c.2o=G.2o||G.f3;1A;Y\'8m\':c.2o=G.2o||G.eN}c.8T()}m c},2m:k(){m c.6c().6Z()},6c:k(){B(c.G.6c)c.G.6c();15 c.G.eP=1f;m c},6Z:k(){B(c.G.6Z)c.G.6Z();15 c.G.eR=P;m c}});2W.6T={2o:k(){B(c.2o&&c.2o.8A==3)c.2o=c.2o.3n},8R:k(){55{2W.6T.2o.1R(c)}57(e){c.2o=c.4Z}}};2W.1H.8T=(W.8f)?2W.6T.8R:2W.6T.2o;2W.1M=L 3t({\'eI\':13,\'6g\':38,\'ei\':40,\'1r\':37,\'4j\':39,\'eu\':27,\'ex\':32,\'eE\':8,\'eh\':9,\'4I\':46});O.2H.2p={1O:k(F,V){c.$1a=c.$1a||{};c.$1a[F]=c.$1a[F]||{\'1M\':[],\'2q\':[]};B(c.$1a[F].1M.1k(V))m c;c.$1a[F].1M.1i(V);o 6L=F;o 2s=O.2p[F];B(2s){B(2s.7j)2s.7j.1R(c,V);B(2s.2z)V=2s.2z;B(2s.F)6L=2s.F}B(!c.8x)V=V.3e({\'12\':c,\'G\':1f});c.$1a[F].2q.1i(V);m(O.8c.1k(6L))?c.2J(6L,V):c},5c:k(F,V){B(!c.$1a||!c.$1a[F])m c;o 1v=c.$1a[F].1M.3L(V);B(1v==-1)m c;o 1t=c.$1a[F].1M.6B(1v,1)[0];o J=c.$1a[F].2q.6B(1v,1)[0];o 2s=O.2p[F];B(2s){B(2s.2O)2s.2O.1R(c,V);B(2s.F)F=2s.F}m(O.8c.1k(F))?c.3p(F,J):c},78:k(1W){m O.6y(c,\'1O\',1W)},6E:k(F){B(!c.$1a)m c;B(!F){M(o 6H 1c c.$1a)c.6E(6H);c.$1a=1n}15 B(c.$1a[F]){c.$1a[F].1M.1q(k(V){c.5c(F,V)},c);c.$1a[F]=1n}m c},1h:k(F,1p,2g){B(c.$1a&&c.$1a[F]){c.$1a[F].1M.1q(k(V){V.3e({\'12\':c,\'2g\':2g,\'1b\':1p})()},c)}m c},9U:k(17,F){B(!17.$1a)m c;B(!F){M(o 6H 1c 17.$1a)c.9U(17,6H)}15 B(17.$1a[F]){17.$1a[F].1M.1q(k(V){c.1O(F,V)},c)}m c}};W.T(O.2H.2p);R.T(O.2H.2p);O.T(O.2H.2p);O.2p=L 3t({\'7R\':{F:\'8D\',2z:k(G){G=L 2W(G);B(G.2o!=c&&!c.8n(G.2o))c.1h(\'7R\',G)}},\'7M\':{F:\'8m\',2z:k(G){G=L 2W(G);B(G.2o!=c&&!c.8n(G.2o))c.1h(\'7M\',G)}},\'6G\':{F:(W.8f)?\'8b\':\'6G\'}});O.8c=[\'8j\',\'eL\',\'5U\',\'5d\',\'6G\',\'8b\',\'8D\',\'8m\',\'31\',\'9s\',\'eT\',\'eF\',\'3Z\',\'8i\',\'9A\',\'eG\',\'4S\',\'eb\',\'ez\',\'92\',\'ev\',\'ek\',\'3U\',\'b8\',\'7Y\',\'ew\',\'5R\'];8C.T({3F:k(12,1p){m c.3e({\'12\':12,\'1b\':1p,\'G\':2W})}});21.T({es:k(3i){m L 21(c.2Y(k(el){m(O.4s(el)==3i)}))},9F:k(1B,2F){o Q=c.2Y(k(el){m(el.1B&&el.1B.1k(1B,\' \'))});m(2F)?Q:L 21(Q)},9S:k(4z,2F){o Q=c.2Y(k(el){m(el.4z==4z)});m(2F)?Q:L 21(Q)},9k:k(1w,8G,J,2F){o Q=c.2Y(k(el){o 2i=O.5z(el,1w);B(!2i)m P;B(!8G)m 1f;25(8G){Y\'=\':m(2i==J);Y\'*=\':m(2i.1k(J));Y\'^=\':m(2i.7O(0,J.U)==J);Y\'$=\':m(2i.7O(2i.U-J.U)==J);Y\'!=\':m(2i!=J);Y\'~=\':m 2i.1k(J,\' \')}m P});m(2F)?Q:L 21(Q)}});k $E(1Q,2Y){m($(2Y)||R).9c(1Q)};k $ey(1Q,2Y){m($(2Y)||R).6D(1Q)};$$.3C={\'5A\':/^(\\w*|\\*)(?:#([\\w-]+)|\\.([\\w-]+))?(?:\\[(\\w+)(?:([!*^$]?=)["\']?([^"\'\\]]*)["\']?)?])?$/,\'3W\':{7s:k(1y,3a,1e,i){o 2l=[3a.eD?\'8K:\':\'\',1e[1]];B(1e[2])2l.1i(\'[@4z="\',1e[2],\'"]\');B(1e[3])2l.1i(\'[1k(7q(" ", @4R, " "), " \',1e[3],\' ")]\');B(1e[4]){B(1e[5]&&1e[6]){25(1e[5]){Y\'*=\':2l.1i(\'[1k(@\',1e[4],\', "\',1e[6],\'")]\');1A;Y\'^=\':2l.1i(\'[eC-eA(@\',1e[4],\', "\',1e[6],\'")]\');1A;Y\'$=\':2l.1i(\'[eB(@\',1e[4],\', 2r-U(@\',1e[4],\') - \',1e[6].U,\' + 1) = "\',1e[6],\'"]\');1A;Y\'=\':2l.1i(\'[@\',1e[4],\'="\',1e[6],\'"]\');1A;Y\'!=\':2l.1i(\'[@\',1e[4],\'!="\',1e[6],\'"]\')}}15{2l.1i(\'[@\',1e[4],\']\')}}1y.1i(2l.2b(\'\'));m 1y},7r:k(1y,3a,2F){o Q=[];o 3W=R.5i(\'.//\'+1y.2b(\'//\'),3a,$$.3C.91,er.eq,1n);M(o i=0,j=3W.ef;i<j;i++)Q.1i(3W.eg(i));m(2F)?Q:L 21(Q.2z($))}},\'9e\':{7s:k(1y,3a,1e,i){B(i==0){B(1e[2]){o el=3a.6x(1e[2]);B(!el||((1e[1]!=\'*\')&&(O.4s(el)!=1e[1])))m P;1y=[el]}15{1y=$A(3a.34(1e[1]))}}15{1y=$$.3C.34(1y,1e[1]);B(1e[2])1y=21.9S(1y,1e[2],1f)}B(1e[3])1y=21.9F(1y,1e[3],1f);B(1e[4])1y=21.9k(1y,1e[4],1e[5],1e[6],1f);m 1y},7r:k(1y,3a,2F){m(2F)?1y:$$.5p(1y)}},91:k(9a){m(9a==\'8K\')?\'aR://av.ee.ed/ec/8K\':P},34:k(3a,6I){o 8h=[];M(o i=0,j=3a.U;i<j;i++)8h.T(3a[i].34(6I));m 8h}};$$.3C.22=(W.3W)?\'3W\':\'9e\';O.2H.7B={6z:k(1Q,2F){o 1y=[];1Q=1Q.5Z().5V(\' \');M(o i=0,j=1Q.U;i<j;i++){o 97=1Q[i];o 1e=97.2Z($$.3C.5A);B(!1e)1A;1e[1]=1e[1]||\'*\';o 2l=$$.3C[$$.3C.22].7s(1y,c,1e,i);B(!2l)1A;1y=2l}m $$.3C[$$.3C.22].7r(1y,c,2F)},9c:k(1Q){m $(c.6z(1Q,1f)[0]||P)},6D:k(1Q,2F){o Q=[];1Q=1Q.5V(\',\');M(o i=0,j=1Q.U;i<j;i++)Q=Q.7q(c.6z(1Q[i],1f));m(2F)?Q:$$.5p(Q)}};O.T({6x:k(4z){o el=R.6x(4z);B(!el)m P;M(o 1C=el.3n;1C!=c;1C=1C.3n){B(!1C)m P}m el},ep:k(1B){m c.6z(\'.\'+1B)}});R.T(O.2H.7B);O.T(O.2H.7B);O.T({4a:k(){25(c.4s()){Y\'3U\':o 2q=[];$1q(c.C,k(3u){B(3u.89)2q.1i($5h(3u.J,3u.1F))});m(c.7A)?2q:2q[0];Y\'9P\':B(!(c.7z&&[\'en\',\'em\'].1k(c.F))&&![\'4k\',\'1F\',\'ej\'].1k(c.F))1A;Y\'9n\':m c.J}m P},9t:k(){m $$(c.34(\'9P\'),c.34(\'3U\'),c.34(\'9n\'))},5y:k(){o 58=[];c.9t().1q(k(el){o 1w=el.1w;o J=el.4a();B(J===P||!1w||el.7e)m;o 7n=k(4h){58.1i(1w+\'=\'+6t(4h))};B($F(J)==\'1z\')J.1q(7n);15 7n(J)});m 58.2b(\'&\')}});O.T({cP:k(x,y){c.5F=x;c.5E=y},9i:k(){m{\'5R\':{\'x\':c.5F,\'y\':c.5E},\'5D\':{\'x\':c.3R,\'y\':c.3E},\'8X\':{\'x\':c.6V,\'y\':c.5Y}}},4A:k(2C){2C=2C||[];o el=c,1r=0,1o=0;do{1r+=el.eZ||0;1o+=el.f0||0;el=el.eY}6r(el);2C.1q(k(I){1r-=I.5F||0;1o-=I.5E||0});m{\'x\':1r,\'y\':1o}},ab:k(2C){m c.4A(2C).y},ac:k(2C){m c.4A(2C).x},4r:k(2C){o 1u=c.4A(2C);o N={\'2t\':c.3R,\'2L\':c.3E,\'1r\':1u.x,\'1o\':1u.y};N.4j=N.1r+N.2t;N.3H=N.1o+N.2L;m N}});O.2p.80={7j:k(V){B(W.6K){V.1R(c);m}o 5K=k(){B(W.6K)m;W.6K=1f;W.1X=$5S(W.1X);c.1h(\'80\')}.12(c);B(R.4H&&W.4n){W.1X=k(){B([\'6K\',\'8I\'].1k(R.4H))5K()}.4C(50)}15 B(R.4H&&W.2N){B(!$(\'7Z\')){o 4t=(W.eX.eW==\'f1:\')?\'://0\':\'8O:f2(0)\';R.f7(\'<2v 4z="7Z" f5 4t="\'+4t+\'"><\\/2v>\');$(\'7Z\').64=k(){B(c.4H==\'8I\')5K()}}}15{W.2J("3Z",5K);R.2J("f4",5K)}}};W.eK=k(V){m c.1O(\'80\',V)};W.T({83:k(){B(c.6M)m c.eJ;B(c.9R)m R.4O.9N;m R.2S.9N},85:k(){B(c.6M)m c.eH;B(c.9R)m R.4O.9L;m R.2S.9L},8W:k(){B(c.2N)m 1d.1G(R.2S.3R,R.2S.6V);B(c.4n)m R.4O.6V;m R.2S.6V},8Z:k(){B(c.2N)m 1d.1G(R.2S.3E,R.2S.5Y);B(c.4n)m R.4O.5Y;m R.2S.5Y},86:k(){m c.9H||R.2S.5F},87:k(){m c.9K||R.2S.5E},9i:k(){m{\'5D\':{\'x\':c.83(),\'y\':c.85()},\'8X\':{\'x\':c.8W(),\'y\':c.8Z()},\'5R\':{\'x\':c.86(),\'y\':c.87()}}},4A:k(){m{\'x\':0,\'y\':0}}});o 1g={};1g.3c=L 19({C:{4B:19.1m,1Y:19.1m,8E:19.1m,2d:k(p){m-(1d.b5(1d.82*p)-1)/2},3X:eM,2y:\'4T\',44:1f,8U:50},1l:k(C){c.I=c.I||1n;c.33(C);B(c.C.1l)c.C.1l.1R(c)},2j:k(){o 3K=$3K();B(3K<c.3K+c.C.3X){c.4w=c.C.2d((3K-c.3K)/c.C.3X);c.51();c.4U()}15{c.2m(1f);c.2f(c.14);c.1h(\'1Y\',c.I,10);c.7v()}},2f:k(14){c.18=14;c.4U();m c},51:k(){c.18=c.4V(c.17,c.14)},4V:k(17,14){m(14-17)*c.4w+17},1j:k(17,14){B(!c.C.44)c.2m();15 B(c.1X)m c;c.17=17;c.14=14;c.92=c.14-c.17;c.3K=$3K();c.1X=c.2j.4C(1d.2n(aV/c.C.8U),c);c.1h(\'4B\',c.I);m c},2m:k(28){B(!c.1X)m c;c.1X=$5S(c.1X);B(!28)c.1h(\'8E\',c.I);m c},2s:k(17,14){m c.1j(17,14)},eS:k(28){m c.2m(28)}});1g.3c.3z(L 8H,L 2p,L 4b);1g.3h={3U:k(K,14){B(K.2u(/2B/i))m c.2I;o F=$F(14);B((F==\'1z\')||(F==\'2r\'&&14.1k(\' \')))m c.6W;m c.9f},2R:k(el,K,5b){B(!5b.1i)5b=[5b];o 17=5b[0],14=5b[1];B(!$2D(14)){14=17;17=el.2e(K)}o 1x=c.3U(K,14);m{\'17\':1x.2R(17),\'14\':1x.2R(14),\'1x\':1x}}};1g.3h.9f={2R:k(J){m 5G(J)},5a:k(17,14,2M){m 2M.4V(17,14)},4a:k(J,2y,K){B(2y==\'4T\'&&K!=\'1V\')J=1d.2n(J);m J+2y}};1g.3h.6W={2R:k(J){m J.1i?J:J.5V(\' \').2z(k(v){m 5G(v)})},5a:k(17,14,2M){o 18=[];M(o i=0;i<17.U;i++)18[i]=2M.4V(17[i],14[i]);m 18},4a:k(J,2y,K){B(2y==\'4T\'&&K!=\'1V\')J=J.2z(1d.2n);m J.2b(2y+\' \')+2y}};1g.3h.2I={2R:k(J){m J.1i?J:J.5q(1f)},5a:k(17,14,2M){o 18=[];M(o i=0;i<17.U;i++)18[i]=1d.2n(2M.4V(17[i],14[i]));m 18},4a:k(J){m\'1s(\'+J.2b(\',\')+\')\'}};1g.7G=1g.3c.T({1l:k(el,K,C){c.I=$(el);c.K=K;c.1C(C)},48:k(){m c.2f(0)},51:k(){c.18=c.1x.5a(c.17,c.14,c)},2f:k(14){c.1x=1g.3h.3U(c.K,14);m c.1C(c.1x.2R(14))},1j:k(17,14){B(c.1X&&c.C.44)m c;o 2a=1g.3h.2R(c.I,c.K,[17,14]);c.1x=2a.1x;m c.1C(2a.17,2a.14)},4U:k(){c.I.1P(c.K,c.1x.4a(c.18,c.C.2y,c.K))}});O.T({eQ:k(K,C){m L 1g.7G(c,K,C)}});1g.3V=1g.3c.T({1l:k(el,C){c.I=$(el);c.1C(C)},51:k(){M(o p 1c c.17)c.18[p]=c.1x[p].5a(c.17[p],c.14[p],c)},2f:k(14){o 2a={};c.1x={};M(o p 1c 14){c.1x[p]=1g.3h.3U(p,14[p]);2a[p]=c.1x[p].2R(14[p])}m c.1C(2a)},1j:k(N){B(c.1X&&c.C.44)m c;c.18={};c.1x={};o 17={},14={};M(o p 1c N){o 2a=1g.3h.2R(c.I,p,N[p]);17[p]=2a.17;14[p]=2a.14;c.1x[p]=2a.1x}m c.1C(17,14)},4U:k(){M(o p 1c c.18)c.I.1P(p,c.1x[p].4a(c.18[p],c.C.2y,p))}});O.T({3y:k(C){m L 1g.3V(c,C)}});1g.21=1g.3c.T({1l:k(Q,C){c.Q=$$(Q);c.1C(C)},51:k(){M(o i 1c c.17){o 5s=c.17[i],42=c.14[i],3I=c.1x[i],5H=c.18[i]={};M(o p 1c 5s)5H[p]=3I[p].5a(5s[p],42[p],c)}},2f:k(14){o 2a={};c.1x={};M(o i 1c 14){o 42=14[i],3I=c.1x[i]={},99=2a[i]={};M(o p 1c 42){3I[p]=1g.3h.3U(p,42[p]);99[p]=3I[p].2R(42[p])}}m c.1C(2a)},1j:k(N){B(c.1X&&c.C.44)m c;c.18={};c.1x={};o 17={},14={};M(o i 1c N){o 7S=N[i],5s=17[i]={},42=14[i]={},3I=c.1x[i]={};M(o p 1c 7S){o 2a=1g.3h.2R(c.Q[i],p,7S[p]);5s[p]=2a.17;42[p]=2a.14;3I[p]=2a.1x}}m c.1C(17,14)},4U:k(){M(o i 1c c.18){o 5H=c.18[i],3I=c.1x[i];M(o p 1c 5H)c.Q[i].1P(p,3I[p].4a(5H[p],c.C.2y,p))}}});1g.f6=1g.3c.T({C:{2c:\'8y\'},1l:k(el,C){c.I=$(el);c.35=L O(\'4Q\',{\'7F\':$T(c.I.bc(\'3d\'),{\'aa\':\'4k\'})}).6Q(c.I).ba(c.I);c.I.1P(\'3d\',0);c.33(C);c.18=[];c.1C(c.C);c.5f=1f;c.1O(\'1Y\',k(){c.5f=(c.18[0]===0)});B(W.6M)c.1O(\'1Y\',k(){B(c.5f)c.I.2O().23(c.35)})},51:k(){M(o i=0;i<2;i++)c.18[i]=c.4V(c.17[i],c.14[i])},8y:k(){c.3d=\'3d-1o\';c.5C=\'2L\';c.1I=c.I.3E},8o:k(){c.3d=\'3d-1r\';c.5C=\'2t\';c.1I=c.I.3R},aQ:k(2c){c[2c||c.C.2c]();m c.1j([c.I.2e(c.3d).36(),c.35.2e(c.5C).36()],[0,c.1I])},aP:k(2c){c[2c||c.C.2c]();m c.1j([c.I.2e(c.3d).36(),c.35.2e(c.5C).36()],[-c.1I,0])},48:k(2c){c[2c||c.C.2c]();c.5f=P;m c.2f([-c.1I,0])},43:k(2c){c[2c||c.C.2c]();c.5f=1f;m c.2f([0,c.1I])},eU:k(2c){B(c.35.3E==0||c.35.3R==0)m c.aQ(2c);m c.aP(2c)},4U:k(){c.I.1P(c.3d,c.18[0]+c.C.2y);c.35.1P(c.5C,c.18[1]+c.C.2y)}});1g.7W=k(2d,2V){2V=2V||[];B($F(2V)!=\'1z\')2V=[2V];m $T(2d,{eV:k(1v){m 2d(1v,2V)},et:k(1v){m 1-2d(1-1v,2V)},e9:k(1v){m(1v<=0.5)?2d(2*1v,2V)/2:(2-2d(2*(1-1v),2V))/2}})};1g.3j=L 3t({dh:k(p){m p}});1g.3j.T=k(7I){M(o 2d 1c 7I){1g.3j[2d]=L 1g.7W(7I[2d]);1g.3j.7X(2d)}};1g.3j.7X=k(2d){[\'di\',\'df\',\'de\'].1q(k(7T){1g.3j[2d.5B()+7T]=1g.3j[2d][\'db\'+7T]})};1g.3j.T({dc:k(p,x){m 1d.3A(p,x[0]||6)},dd:k(p){m 1d.3A(2,8*(p-1))},dj:k(p){m 1-1d.aW(1d.dk(p))},dr:k(p){m 1-1d.aW((1-p)*1d.82/2)},ds:k(p,x){x=x[0]||1.dt;m 1d.3A(p,2)*((x+1)*p-x)},dq:k(p){o J;M(o a=0,b=1;1;a+=b,b/=2){B(p>=(7-4*a)/11){J=-1d.3A((11-6*a-11*p)/4,2)+b*b;1A}}m J},ea:k(p,x){m 1d.3A(2,10*--p)*1d.b5(20*p*1d.82*(x[0]||1)/3)}});[\'dl\',\'dm\',\'dn\',\'da\'].1q(k(2d,i){1g.3j[2d]=L 1g.7W(k(p){m 1d.3A(p,[i+2])});1g.3j.7X(2d)});o 3O={};3O.3c=L 19({C:{3w:P,2y:\'4T\',4B:19.1m,b4:19.1m,1Y:19.1m,aK:19.1m,8v:19.1m,1D:P,3M:{x:\'1r\',y:\'1o\'},4u:P,69:6},1l:k(el,C){c.33(C);c.I=$(el);c.3w=$(c.C.3w)||c.I;c.3k={\'18\':{},\'1v\':{}};c.J={\'1j\':{},\'18\':{}};c.1N={\'1j\':c.1j.3F(c),\'41\':c.41.3F(c),\'3s\':c.3s.3F(c),\'2m\':c.2m.12(c)};c.6e();B(c.C.1l)c.C.1l.1R(c)},6e:k(){c.3w.1O(\'5d\',c.1N.1j);m c},aB:k(){c.3w.5c(\'5d\',c.1N.1j);m c},1j:k(G){c.1h(\'b4\',c.I);c.3k.1j=G.2P;o 1D=c.C.1D;c.1D={\'x\':[],\'y\':[]};M(o z 1c c.C.3M){B(!c.C.3M[z])6v;c.J.18[z]=c.I.2e(c.C.3M[z]).36();c.3k.1v[z]=G.2P[z]-c.J.18[z];B(1D&&1D[z]){M(o i=0;i<2;i++){B($2D(1D[z][i]))c.1D[z][i]=($F(1D[z][i])==\'k\')?1D[z][i]():1D[z][i]}}}B($F(c.C.4u)==\'4X\')c.C.4u={\'x\':c.C.4u,\'y\':c.C.4u};R.2J(\'31\',c.1N.41);R.2J(\'5U\',c.1N.2m);c.1h(\'4B\',c.I);G.2m()},41:k(G){o b2=1d.2n(1d.d9(1d.3A(G.2P.x-c.3k.1j.x,2)+1d.3A(G.2P.y-c.3k.1j.y,2)));B(b2>c.C.69){R.3p(\'31\',c.1N.41);R.2J(\'31\',c.1N.3s);c.3s(G);c.1h(\'aK\',c.I)}G.2m()},3s:k(G){c.5v=P;c.3k.18=G.2P;M(o z 1c c.C.3M){B(!c.C.3M[z])6v;c.J.18[z]=c.3k.18[z]-c.3k.1v[z];B(c.1D[z]){B($2D(c.1D[z][1])&&(c.J.18[z]>c.1D[z][1])){c.J.18[z]=c.1D[z][1];c.5v=1f}15 B($2D(c.1D[z][0])&&(c.J.18[z]<c.1D[z][0])){c.J.18[z]=c.1D[z][0];c.5v=1f}}B(c.C.4u[z])c.J.18[z]-=(c.J.18[z]%c.C.4u[z]);c.I.1P(c.C.3M[z],c.J.18[z]+c.C.2y)}c.1h(\'8v\',c.I);G.2m()},2m:k(){R.3p(\'31\',c.1N.41);R.3p(\'31\',c.1N.3s);R.3p(\'5U\',c.1N.2m);c.1h(\'1Y\',c.I)}});3O.3c.3z(L 2p,L 4b);O.T({cW:k(C){m L 3O.3c(c,$26({3M:{x:\'2t\',y:\'2L\'}},C))}});3O.a1=3O.3c.T({C:{6b:[],29:P,2C:[]},1l:k(el,C){c.33(C);c.I=$(el);c.6b=$$(c.C.6b);c.29=$(c.C.29);c.1u={\'I\':c.I.2e(\'1u\'),\'29\':P};B(c.29)c.1u.29=c.29.2e(\'1u\');B(![\'6l\',\'45\',\'4W\'].1k(c.1u.I))c.1u.I=\'45\';o 1o=c.I.2e(\'1o\').36();o 1r=c.I.2e(\'1r\').36();B(c.1u.I==\'45\'&&![\'6l\',\'45\',\'4W\'].1k(c.1u.29)){1o=$2D(1o)?1o:c.I.ab(c.C.2C);1r=$2D(1r)?1r:c.I.ac(c.C.2C)}15{1o=$2D(1o)?1o:0;1r=$2D(1r)?1r:0}c.I.4i({\'1o\':1o,\'1r\':1r,\'1u\':c.1u.I});c.1C(c.I)},1j:k(G){c.3b=1n;B(c.29){o 4o=c.29.4r();o el=c.I.4r();B(c.1u.I==\'45\'&&![\'6l\',\'45\',\'4W\'].1k(c.1u.29)){c.C.1D={\'x\':[4o.1r,4o.4j-el.2t],\'y\':[4o.1o,4o.3H-el.2L]}}15{c.C.1D={\'y\':[0,4o.2L-el.2L],\'x\':[0,4o.2t-el.2t]}}}c.1C(G)},3s:k(G){c.1C(G);o 3b=c.5v?P:c.6b.2Y(c.a5,c).7i();B(c.3b!=3b){B(c.3b)c.3b.1h(\'cY\',[c.I,c]);c.3b=3b?3b.1h(\'cV\',[c.I,c]):1n}m c},a5:k(el){el=el.4r(c.C.2C);o 18=c.3k.18;m(18.x>el.1r&&18.x<el.4j&&18.y<el.3H&&18.y>el.1o)},2m:k(){B(c.3b&&!c.5v)c.3b.1h(\'cU\',[c.I,c]);15 c.I.1h(\'cQ\',c);c.1C();m c}});O.T({cR:k(C){m L 3O.a1(c,C)}});o 7a=L 19({C:{22:\'4Y\',ao:1f,aw:19.1m,4J:19.1m,6a:19.1m,ag:1f,5u:\'cS-8\',am:P,4f:{}},8F:k(){c.2w=(W.66)?L 66():(W.2N?L a3(\'cT.cZ\'):P);m c},1l:k(C){c.8F().33(C);c.C.5L=c.C.5L||c.5L;c.4f={};B(c.C.ag&&c.C.22==\'4Y\'){o 5u=(c.C.5u)?\'; d0=\'+c.C.5u:\'\';c.4F(\'aI-F\',\'aU/x-av-d6-d7\'+5u)}B(c.C.1l)c.C.1l.1R(c)},ak:k(){B(c.2w.4H!=4||!c.5g)m;c.5g=P;o 4c=0;55{4c=c.2w.4c}57(e){};B(c.C.5L.1R(c,4c))c.4J();15 c.6a();c.2w.64=19.1m},5L:k(4c){m((4c>=d8)&&(4c<d5))},4J:k(){c.3x={\'1F\':c.2w.d4,\'5w\':c.2w.d1};c.1h(\'4J\',[c.3x.1F,c.3x.5w]);c.7v()},6a:k(){c.1h(\'6a\',c.2w)},4F:k(1w,J){c.4f[1w]=J;m c},5t:k(2K,1L){B(c.C.am)c.ah();15 B(c.5g)m c;c.5g=1f;B(1L&&c.C.22==\'4K\'){2K=2K+(2K.1k(\'?\')?\'&\':\'?\')+1L;1L=1n}c.2w.5f(c.C.22.7p(),2K,c.C.ao);c.2w.64=c.ak.12(c);B((c.C.22==\'4Y\')&&c.2w.d2)c.4F(\'d3\',\'du\');$T(c.4f,c.C.4f);M(o F 1c c.4f)55{c.2w.dv(F,c.4f[F])}57(e){};c.1h(\'aw\');c.2w.5t($5h(1L,1n));m c},ah:k(){B(!c.5g)m c;c.5g=P;c.2w.7Y();c.2w.64=19.1m;c.8F();c.1h(\'8E\');m c}});7a.3z(L 8H,L 2p,L 4b);o ai=7a.T({C:{1L:1n,8J:1n,1Y:19.1m,6h:P,8M:P},1l:k(2K,C){c.1O(\'4J\',c.1Y);c.33(C);c.C.1L=c.C.1L||c.C.dW;B(![\'4Y\',\'4K\'].1k(c.C.22)){c.5x=\'5x=\'+c.C.22;c.C.22=\'4Y\'}c.1C();c.4F(\'X-dX-dY\',\'66\');c.4F(\'dV\',\'1F/8O, 1F/dU, aU/5w, 1F/5w, */*\');c.2K=2K},1Y:k(){B(c.C.8J)$(c.C.8J).1m().5W(c.3x.1F);B(c.C.6h||c.C.8M)c.6h();c.1h(\'1Y\',[c.3x.1F,c.3x.5w],20)},at:k(1L){1L=1L||c.C.1L;25($F(1L)){Y\'I\':1L=$(1L).5y();1A;Y\'2G\':1L=8a.5y(1L)}B(c.5x)1L=(1L)?[c.5x,1L].2b(\'&\'):c.5x;m c.5t(c.2K,1L)},6h:k(){o 2v,3v;B(c.C.8M||(/(dR|dS)2v/).2u(c.9Y(\'aI-F\')))3v=c.3x.1F;15{3v=[];o 5A=/<2v[^>]*>([\\s\\S]*?)<\\/2v>/dT;6r((2v=5A.dZ(c.3x.1F)))3v.1i(2v[1]);3v=3v.2b(\'\\n\')}B(3v)(W.a7)?W.a7(3v):W.af(3v,0)},9Y:k(1w){55{m c.2w.e0(1w)}57(e){};m 1n}});8a.5y=k(1W){o 58=[];M(o K 1c 1W)58.1i(6t(K)+\'=\'+6t(1W[K]));m 58.2b(\'&\')};O.T({5t:k(C){m L ai(c.5z(\'e6\'),$26({1L:c.5y()},C,{22:\'4Y\'})).at()}});o 3q=L 3t({C:{6u:P,6p:P,3X:P,4G:P},2f:k(1t,J,C){C=$26(c.C,C);J=6t(J);B(C.6u)J+=\'; 6u=\'+C.6u;B(C.6p)J+=\'; 6p=\'+C.6p;B(C.3X){o 6j=L ay();6j.e7(6j.ad()+C.3X*24*60*60*aV);J+=\'; e8=\'+6j.e5()}B(C.4G)J+=\'; 4G\';R.4d=1t+\'=\'+J;m $T(C,{\'1t\':1t,\'J\':J})},4K:k(1t){o J=R.4d.2Z(\'(?:^|;)\\\\s*\'+1t.aN()+\'=([^;]*)\');m J?e4(J[1]):P},2O:k(4d,C){B($F(4d)==\'2G\')c.2f(4d.1t,\'\',$26(4d,{3X:-1}));15 c.2f(4d,\'\',$26(C,{3X:-1}))}});o 3D={4x:k(N){25($F(N)){Y\'2r\':m\'"\'+N.3f(/(["\\\\])/g,\'\\\\$1\')+\'"\';Y\'1z\':m\'[\'+N.2z(3D.4x).2b(\',\')+\']\';Y\'2G\':o 2r=[];M(o K 1c N)2r.1i(3D.4x(K)+\':\'+3D.4x(N[K]));m\'{\'+2r.2b(\',\')+\'}\';Y\'4X\':B(e1(N))1A;Y P:m\'1n\'}m 6k(N)},5i:k(4q,4G){m(($F(4q)!=\'2r\')||(4G&&!4q.2u(/^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+e2-u \\n\\r\\t])+?$/)))?1n:e3(\'(\'+4q+\')\')}};3D.dQ=7a.T({1l:k(2K,C){c.2K=2K;c.1O(\'4J\',c.1Y);c.1C(C);c.4F(\'X-dP\',\'dC\')},5t:k(N){m c.1C(c.2K,\'dD=\'+3D.4x(N))},1Y:k(){c.1h(\'1Y\',[3D.5i(c.3x.1F,c.C.4G)])}});o 9V=L 3t({8O:k(1W,1E){1E=$26({\'5J\':19.1m},1E);o 2v=L O(\'2v\',{\'4t\':1W}).78({\'3Z\':1E.5J,\'dE\':k(){B(c.4H==\'8I\')c.1h(\'3Z\')}});4I 1E.5J;m 2v.76(1E).23(R.79)},1x:k(1W,1E){m L O(\'dB\',$26({\'aT\':\'dA\',\'dw\':\'dx\',\'F\':\'1F/1x\',\'6O\':1W},1E)).23(R.79)},4M:k(1W,1E){1E=$26({\'5J\':19.1m,\'dy\':19.1m,\'dz\':19.1m},1E);o 4M=L dF();4M.4t=1W;o I=L O(\'7J\',{\'4t\':1W});[\'3Z\',\'7Y\',\'b8\'].1q(k(F){o G=1E[\'5I\'+F];4I 1E[\'5I\'+F];I.1O(F,k(){c.5c(F,1b.7L);G.1R(c)})});B(4M.2t&&4M.2L)I.1h(\'3Z\',I,1);m I.76(1E)},74:k(4L,C){C=$26({1Y:19.1m,9h:19.1m},C);B(!4L.1i)4L=[4L];o 74=[];o 75=0;4L.1q(k(1W){o 7J=L 9V.4M(1W,{\'5J\':k(){C.9h.1R(c,75);75++;B(75==4L.U)C.1Y()}});74.1i(7J)});m L 21(74)}});o 3o=L 19({U:0,1l:k(2G){c.N=2G||{};c.5j()},4K:k(1t){m(c.77(1t))?c.N[1t]:1n},77:k(1t){m(1t 1c c.N)},2f:k(1t,J){B(!c.77(1t))c.U++;c.N[1t]=J;m c},5j:k(){c.U=0;M(o p 1c c.N)c.U++;m c},2O:k(1t){B(c.77(1t)){4I c.N[1t];c.U--}m c},1q:k(V,12){$1q(c.N,V,12)},T:k(N){$T(c.N,N);m c.5j()},26:k(){c.N=$26.49(1n,[c.N].T(1b));m c.5j()},1m:k(){c.N={};c.U=0;m c},1M:k(){o 1M=[];M(o K 1c c.N)1M.1i(K);m 1M},2q:k(){o 2q=[];M(o K 1c c.N)2q.1i(c.N[K]);m 2q}});k $H(N){m L 3o(N)};3o.3q=3o.T({1l:k(1w,C){c.1w=1w;c.C=$T({\'9E\':1f},C||{});c.3Z()},9J:k(){B(c.U==0){3q.2O(c.1w,c.C);m 1f}o 4q=3D.4x(c.N);B(4q.U>dM)m P;3q.2f(c.1w,4q,c.C);m 1f},3Z:k(){c.N=3D.5i(3q.4K(c.1w),1f)||{};c.5j()}});3o.3q.2H={};[\'T\',\'2f\',\'26\',\'1m\',\'2O\'].1q(k(22){3o.3q.2H[22]=k(){3o.1H[22].49(c,1b);B(c.C.9E)c.9J();m c}});3o.3q.3z(3o.3q.2H);o 2I=L 19({1l:k(2B,F){F=F||(2B.1i?\'1s\':\'3r\');o 1s,2h;25(F){Y\'1s\':1s=2B;2h=1s.8N();1A;Y\'2h\':1s=2B.9g();2h=2B;1A;5Q:1s=2B.5q(1f);2h=1s.8N()}1s.2h=2h;1s.3r=1s.5n();m $T(1s,2I.1H)},4E:k(){o 62=$A(1b);o 73=($F(62[62.U-1])==\'4X\')?62.dJ():50;o 1s=c.8B();62.1q(k(2B){2B=L 2I(2B);M(o i=0;i<3;i++)1s[i]=1d.2n((1s[i]/ 2X * (2X - 73)) + (2B[i] /2X*73))});m L 2I(1s,\'1s\')},dI:k(){m L 2I(c.2z(k(J){m 4D-J}))},dH:k(J){m L 2I([J,c.2h[1],c.2h[2]],\'2h\')},dK:k(7b){m L 2I([c.2h[0],7b,c.2h[2]],\'2h\')},dL:k(7b){m L 2I([c.2h[0],c.2h[1],7b],\'2h\')}});k $dO(r,g,b){m L 2I([r,g,b],\'1s\')};k $dN(h,s,b){m L 2I([h,s,b],\'2h\')};2x.T({8N:k(){o 5O=c[0],5M=c[1],7c=c[2];o 2U,7d,7h;o 1G=1d.1G(5O,5M,7c),3l=1d.3l(5O,5M,7c);o 4w=1G-3l;7h=1G/4D;7d=(1G!=0)?4w/1G:0;B(7d==0){2U=0}15{o 7x=(1G-5O)/4w;o 7w=(1G-5M)/4w;o br=(1G-7c)/4w;B(5O==1G)2U=br-7w;15 B(5M==1G)2U=2+7x-br;15 2U=4+7w-7x;2U/=6;B(2U<0)2U++}m[1d.2n(2U*96),1d.2n(7d*2X),1d.2n(7h*2X)]},9g:k(){o br=1d.2n(c[2]/2X*4D);B(c[1]==0){m[br,br,br]}15{o 2U=c[0]%96;o f=2U%60;o p=1d.2n((c[2]*(2X-c[1]))/dG*4D);o q=1d.2n((c[2]*(aY-c[1]*f))/aJ*4D);o t=1d.2n((c[2]*(aY-c[1]*(60-f)))/aJ*4D);25(1d.aD(2U/60)){Y 0:m[br,t,p];Y 1:m[q,br,p];Y 2:m[p,br,t];Y 3:m[p,q,br];Y 4:m[t,p,br];Y 5:m[br,p,q]}}m P}});o 8L=L 19({C:{a2:19.1m,1Y:19.1m,8e:k(1v){c.3P.1P(c.p,1v)},2c:\'8o\',6f:2X,1I:0},1l:k(el,3P,C){c.I=$(el);c.3P=$(3P);c.33(C);c.8g=-1;c.8l=-1;c.2j=-1;c.I.1O(\'5d\',c.aG.3F(c));o 6i,1I;25(c.C.2c){Y\'8o\':c.z=\'x\';c.p=\'1r\';6i={\'x\':\'1r\',\'y\':P};1I=\'3R\';1A;Y\'8y\':c.z=\'y\';c.p=\'1o\';6i={\'x\':P,\'y\':\'1o\'};1I=\'3E\'}c.1G=c.I[1I]-c.3P[1I]+(c.C.1I*2);c.al=c.3P[1I]/2;c.as=c.I[\'4K\'+c.p.8u()].12(c.I);c.3P.1P(\'1u\',\'6l\').1P(c.p,-c.C.1I);o 8p={};8p[c.z]=[-c.C.1I,c.1G-c.C.1I];c.3s=L 3O.3c(c.3P,{1D:8p,3M:6i,69:0,4B:k(){c.6s()}.12(c),8v:k(){c.6s()}.12(c),1Y:k(){c.6s();c.28()}.12(c)});B(c.C.1l)c.C.1l.1R(c)},2f:k(2j){c.2j=2j.1D(0,c.C.6f);c.6q();c.28();c.1h(\'8e\',c.b6(c.2j));m c},aG:k(G){o 1u=G.2P[c.z]-c.as()-c.al;1u=1u.1D(-c.C.1I,c.1G-c.C.1I);c.2j=c.8k(1u);c.6q();c.28();c.1h(\'8e\',1u)},6s:k(){c.2j=c.8k(c.3s.J.18[c.z]);c.6q()},6q:k(){B(c.8g!=c.2j){c.8g=c.2j;c.1h(\'a2\',c.2j)}},28:k(){B(c.8l!==c.2j){c.8l=c.2j;c.1h(\'1Y\',c.2j+\'\')}},8k:k(1u){m 1d.2n((1u+c.C.1I)/c.1G*c.C.6f)},b6:k(2j){m c.1G*2j/c.C.6f}});8L.3z(L 2p);8L.3z(L 4b);o b0=L 19({C:{4p:P,4B:19.1m,1Y:19.1m,2T:1f,69:3,9X:k(I,2T){2T.1P(\'1V\',0.7);I.1P(\'1V\',0.7)},b1:k(I,2T){I.1P(\'1V\',1);2T.2O();c.3T.2O()}},1l:k(53,C){c.33(C);c.53=$(53);c.Q=c.53.88();c.4p=(c.C.4p)?$$(c.C.4p):c.Q;c.1N={\'1j\':[],\'5T\':c.5T.3F(c)};M(o i=0,l=c.4p.U;i<l;i++){c.1N.1j[i]=c.1j.3F(c,c.Q[i])}c.6e();B(c.C.1l)c.C.1l.1R(c);c.1N.4S=c.4S.3F(c);c.1N.28=c.28.12(c)},6e:k(){c.4p.1q(k(3w,i){3w.1O(\'5d\',c.1N.1j[i])},c)},aB:k(){c.4p.1q(k(3w,i){3w.5c(\'5d\',c.1N.1j[i])},c)},1j:k(G,el){c.4y=el;c.7g=c.53.4r();B(c.C.2T){o 1u=el.4A();c.1I=G.2P.y-1u.y;c.3T=L O(\'4Q\').23(R.4O);c.2T=el.a4().23(c.3T).4i({\'1u\':\'45\',\'1r\':1u.x,\'1o\':G.2P.y-c.1I});R.2J(\'31\',c.1N.5T);c.1h(\'9X\',[el,c.2T])}R.2J(\'31\',c.1N.4S);R.2J(\'5U\',c.1N.28);c.1h(\'4B\',el);G.2m()},5T:k(G){o J=G.2P.y-c.1I;J=J.1D(c.7g.1o,c.7g.3H-c.2T.3E);c.2T.1P(\'1o\',J);G.2m()},4S:k(G){o 18=G.2P.y;c.2k=c.2k||18;o 6g=((c.2k-18)>0);o 6d=c.4y.9Z();o 3G=c.4y.7k();B(6d&&6g&&18<6d.4r().3H)c.4y.8z(6d);B(3G&&!6g&&18>3G.4r().1o)c.4y.6Q(3G);c.2k=18},cX:k(a9){m c.53.88().2z(a9||k(el){m c.Q.3L(el)},c)},28:k(){c.2k=1n;R.3p(\'31\',c.1N.4S);R.3p(\'5U\',c.1N.28);B(c.C.2T){R.3p(\'31\',c.1N.5T);c.1h(\'b1\',[c.4y,c.2T])}c.1h(\'1Y\',c.4y)}});b0.3z(L 2p,L 4b);o 9j=L 19({C:{90:k(3Q){3Q.1P(\'4v\',\'7V\')},8V:k(3Q){3Q.1P(\'4v\',\'4k\')},7Q:30,94:2X,8Q:2X,1B:\'dg\',5N:{\'x\':16,\'y\':16},4W:P},1l:k(Q,C){c.33(C);c.3Y=L O(\'4Q\',{\'4R\':c.C.1B+\'-3Q\',\'7F\':{\'1u\':\'45\',\'1o\':\'0\',\'1r\':\'0\',\'4v\':\'4k\'}}).23(R.4O);c.35=L O(\'4Q\').23(c.3Y);$$(Q).1q(c.aO,c);B(c.C.1l)c.C.1l.1R(c)},aO:k(el){el.$1T.3S=(el.6O&&el.4s()==\'a\')?el.6O.3f(\'aR://\',\'\'):(el.aT||P);B(el.4N){o 6N=el.4N.5V(\'::\');B(6N.U>1){el.$1T.3S=6N[0].5Z();el.$1T.5X=6N[1].5Z()}15{el.$1T.5X=el.4N}el.9M(\'4N\')}15{el.$1T.5X=P}B(el.$1T.3S&&el.$1T.3S.U>c.C.7Q)el.$1T.3S=el.$1T.3S.7O(0,c.C.7Q-1)+"&eO;";el.1O(\'7R\',k(G){c.1j(el);B(!c.C.4W)c.7U(G);15 c.1u(el)}.12(c));B(!c.C.4W)el.1O(\'31\',c.7U.3F(c));o 28=c.28.12(c);el.1O(\'7M\',28);el.1O(\'3T\',28)},1j:k(el){c.35.1m();B(el.$1T.3S){c.4N=L O(\'95\').23(L O(\'4Q\',{\'4R\':c.C.1B+\'-4N\'}).23(c.35)).5W(el.$1T.3S)}B(el.$1T.5X){c.1F=L O(\'95\').23(L O(\'4Q\',{\'4R\':c.C.1B+\'-1F\'}).23(c.35)).5W(el.$1T.5X)}$5S(c.1X);c.1X=c.43.2g(c.C.94,c)},28:k(G){$5S(c.1X);c.1X=c.48.2g(c.C.8Q,c)},1u:k(I){o 1v=I.4A();c.3Y.4i({\'1r\':1v.x+c.C.5N.x,\'1o\':1v.y+c.C.5N.y})},7U:k(G){o 9x={\'x\':W.83(),\'y\':W.85()};o 5R={\'x\':W.86(),\'y\':W.87()};o 3Q={\'x\':c.3Y.3R,\'y\':c.3Y.3E};o 1U={\'x\':\'1r\',\'y\':\'1o\'};M(o z 1c 1U){o 1v=G.2P[z]+c.C.5N[z];B((1v+3Q[z]-5R[z])>9x[z])1v=G.2P[z]-c.C.5N[z]-3Q[z];c.3Y.1P(1U[z],1v)}},43:k(){B(c.C.8Y)c.1X=c.48.2g(c.C.8Y,c);c.1h(\'90\',[c.3Y])},48:k(){c.1h(\'8V\',[c.3Y])}});9j.3z(L 2p,L 4b);o eo=L 19({1l:k(){c.6J=$A(1b);c.1a={};c.56={}},1O:k(F,V){c.56[F]=c.56[F]||{};c.1a[F]=c.1a[F]||[];B(c.1a[F].1k(V))m P;15 c.1a[F].1i(V);c.6J.1q(k(5P,i){5P.1O(F,c.41.12(c,[F,5P,i]))},c);m c},41:k(F,5P,i){c.56[F][i]=1f;o 4m=c.6J.4m(k(2i,j){m c.56[F][j]||P},c);B(!4m)m;c.56[F]={};c.1a[F].1q(k(G){G.1R(c,c.6J,5P)},c)}});o 7C=1g.21.T({C:{8t:19.1m,b9:19.1m,3J:0,43:P,2L:1f,2t:P,1V:1f,65:P,70:P,44:P,68:P},1l:k(){o C,2E,Q,29;$1q(1b,k(4g,i){25($F(4g)){Y\'2G\':C=4g;1A;Y\'I\':29=$(4g);1A;5Q:o 2l=$$(4g);B(!2E)2E=2l;15 Q=2l}});c.2E=2E||[];c.Q=Q||[];c.29=$(29);c.33(C);c.2k=-1;B(c.C.68)c.C.44=1f;B($2D(c.C.43)){c.C.3J=P;c.2k=c.C.43}B(c.C.1j){c.C.3J=P;c.C.43=P}c.3y={};B(c.C.1V)c.3y.1V=\'9m\';B(c.C.2t)c.3y.2t=c.C.70?\'aL\':\'3R\';B(c.C.2L)c.3y.2L=c.C.65?\'aA\':\'5Y\';M(o i=0,l=c.2E.U;i<l;i++)c.9w(c.2E[i],c.Q[i]);c.Q.1q(k(el,i){B(c.C.43===i){c.1h(\'8t\',[c.2E[i],el])}15{M(o 2M 1c c.3y)el.1P(2M,0)}},c);c.1C(c.Q);B($2D(c.C.3J))c.3J(c.C.3J)},9w:k(3m,I,1v){3m=$(3m);I=$(I);o 2u=c.2E.1k(3m);o 3N=c.2E.U;c.2E.61(3m);c.Q.61(I);B(3N&&(!2u||1v)){1v=$5h(1v,3N-1);3m.8z(c.2E[1v]);I.6Q(3m)}15 B(c.29&&!2u){3m.23(c.29);I.23(c.29)}o 9I=c.2E.3L(3m);3m.1O(\'8j\',c.3J.12(c,9I));B(c.C.2L)I.4i({\'4l-1o\':0,\'2Q-1o\':\'6C\',\'4l-3H\':0,\'2Q-3H\':\'6C\'});B(c.C.2t)I.4i({\'4l-1r\':0,\'2Q-1r\':\'6C\',\'4l-4j\':0,\'2Q-4j\':\'6C\'});I.9m=1;B(c.C.70)I.aL=c.C.70;B(c.C.65)I.aA=c.C.65;I.1P(\'aa\',\'4k\');B(!2u){M(o 2M 1c c.3y)I.1P(2M,0)}m c},3J:k(1Z){1Z=($F(1Z)==\'I\')?c.Q.3L(1Z):1Z;B((c.1X&&c.C.44)||(1Z===c.2k&&!c.C.68))m c;c.2k=1Z;o N={};c.Q.1q(k(el,i){N[i]={};o 48=(i!=1Z)||(c.C.68&&(el.3E>0));c.1h(48?\'b9\':\'8t\',[c.2E[i],el]);M(o 2M 1c c.3y)N[i][2M]=48?0:el[c.3y[2M]]},c);m c.1j(N)},co:k(1Z){m c.3J(1Z)}});1g.7C=7C;',62,938,'||||||||||||this||||||||function||return||var|||||||||||||if|options|||type|event||element|value|property|new|for|obj|Element|false|elements|document||extend|length|fn|window||case||||bind||to|else||from|now|Class|events|arguments|in|Math|param|true|Fx|fireEvent|push|start|contains|initialize|empty|null|top|args|each|left|rgb|key|position|pos|name|css|items|array|break|className|parent|limit|properties|text|max|prototype|offset|style|result|data|keys|bound|addEvent|setStyle|selector|call|props|tmp|prop|opacity|source|timer|onComplete|index||Elements|method|inject||switch|merge||end|container|parsed|join|mode|transition|getStyle|set|delay|hsb|current|step|previous|temp|stop|round|relatedTarget|Events|values|string|custom|width|test|script|transport|Array|unit|map|Garbage|color|overflown|chk|togglers|nocash|object|Methods|Color|addListener|url|height|fx|ie|remove|page|border|parse|documentElement|ghost|hue|params|Event|100|filter|match||mousemove||setOptions|getElementsByTagName|wrapper|toInt||||context|overed|Base|margin|create|replace|item|CSS|tag|Transitions|mouse|min|toggler|parentNode|Hash|removeListener|Cookie|hex|drag|Abstract|option|scripts|handle|response|effects|implement|pow|returns|shared|Json|offsetHeight|bindWithEvent|next|bottom|iCss|display|time|indexOf|modifiers|len|Drag|knob|tip|offsetWidth|myTitle|trash|select|Styles|xpath|duration|toolTip|load||check|iTo|show|wait|absolute||iterable|hide|apply|getValue|Options|status|cookie|chains|headers|argument|val|setStyles|right|hidden|padding|every|webkit|cont|handles|str|getCoordinates|getTag|src|grid|visibility|delta|toString|active|id|getPosition|onStart|periodical|255|mix|setHeader|secure|readyState|delete|onSuccess|get|sources|image|title|body|htmlElement|div|class|move|px|increase|compute|fixed|number|post|target||setNow|collect|list|bit|try|checker|catch|queryString|results|getNow|fromTo|removeEvent|mousedown|native|open|running|pick|evaluate|setLength|walk|precision|klass|rgbToHex|HTMLElement|unique|hexToRgb|parseInt|iFrom|send|encoding|out|xml|_method|toQueryString|getProperty|regexp|toLowerCase|layout|size|scrollTop|scrollLeft|parseFloat|iNow|on|onload|domReady|isSuccess|green|offsets|red|instance|default|scroll|clear|moveGhost|mouseup|split|setHTML|myText|scrollHeight|trim||include|colors|generic|onreadystatechange|fixedHeight|XMLHttpRequest|included|alwaysHide|snap|onFailure|droppables|stopPropagation|prev|attach|steps|up|evalScripts|mod|date|String|relative|forEach|regex|attempt|path|checkStep|while|draggedKnob|encodeURIComponent|domain|continue|currentStyle|getElementById|setMany|getElements|Properties|splice|none|getElementsBySelector|removeEvents|Listeners|mousewheel|evType|tagName|instances|loaded|realType|webkit419|dual|href|setProperty|injectAfter|brother|typeof|fix|fKey|scrollWidth|Multi|code|defined|preventDefault|fixedWidth|proto|mp|alpha|images|counter|setProperties|hasKey|addEvents|head|XHR|percent|blue|saturation|disabled|hasClass|coordinates|brightness|getLast|add|getNext|getMany|clean|qs|appendChild|toUpperCase|concat|getItems|getParam|insertBefore|first|callChain|gr|rr|pairs|checked|multiple|Dom|Accordion|RegExp|innerText|styles|Style|node|transitions|img|flag|callee|mouseleave|random|substr|firstChild|maxTitleChars|mouseenter|iProps|easeType|locate|visible|Transition|compat|abort|ie_ready|domready|camelCase|PI|getWidth|cssText|getHeight|getScrollLeft|getScrollTop|getChildren|selected|Object|DOMMouseScroll|NativeEvents|merged|onTick|gecko|previousChange|found|unload|click|toStep|previousEnd|mouseout|hasChild|horizontal|lim|newArray|pageY|charAt|onActive|capitalize|onDrag|pageX|addEventListener|vertical|injectBefore|nodeType|copy|Function|mouseover|onCancel|setTransport|operator|Chain|complete|update|xhtml|Slider|evalResponse|rgbToHsb|javascript|wheelDelta|hideDelay|relatedTargetGecko|styleSheet|fixRelatedTarget|fps|onHide|getScrollWidth|scrollSize|timeout|getScrollHeight|onShow|resolver|change|which|showDelay|span|360|sel|clientY|iParsed|prefix|clientX|getElement|appendText|normal|Single|hsbToRgb|onProgress|getSize|Tips|filterByAttribute|Left|fullOpacity|textarea|Bottom|Right|0px|Top|keydown|getFormElements|direction|picked|addSection|win|borderShort|extended|beforeunload|shift|Width|fixStyle|autoSave|filterByClass|innerHTML|pageXOffset|idx|save|pageYOffset|clientHeight|removeAttribute|clientWidth|textContent|input|removeEventListener|opera|filterById|PropertiesIFlag|cloneEvents|Asset|removeClass|onDragStart|getHeader|getPrevious|ie6|Move|onChange|ActiveXObject|clone|checkAgainst|addClass|execScript|constructor|converter|overflow|getTop|getLeft|getTime|undefined|setTimeout|urlEncoded|cancel|Ajax|after|onStateChange|half|autoCancel|Number|async||Merge|before|getPos|request|elementsProperty|www|onRequest|contents|Date|where|fullHeight|detach|interval|floor|childNodes|pp|clickedElement|createElement|Content|600000|onSnap|fullWidth|nodeValue|escapeRegExp|build|slideOut|slideIn|http|slice|rel|application|1000|sin|setOpacity|6000|zoom|Sortables|onDragComplete|distance|toFloat|onBeforeStart|cos|toPosition|hyphenate|error|onBackground|adopt|defaultView|getStyles|removeChild|clearInterval|times|CollectGarbage|srcElement|shiftKey|control|embed|clearTimeout|meta|pass|err|menu|version||nodeName|fromCharCode|some|setInterval|associate|getRandom|transparent|MooTools|client|111|keyCode|textnode|clearChain|whitespace|collection|bindAsEventListener|chain|alt|altKey|120|detail|wheel|metaKey|Window|ctrlKey|rowSpan|styleFloat|khtml|cssFloat|getBoxObjectFor|hasLayout|zIndex|float|borderWidth|createTextNode|navigator|toggleClass|borderColor|borderStyle|rightClick|getComputedStyle|getProperties|removeProperty|setAttribute|getText|webkit420|setText|attributes|getAttribute|Sibling|getPropertyValue|getFirst|lastChild|getParent|replaceChild|replaceWith|tabIndex|maxlength|showThisHideOpen|BackgroundImageCache|tabindex|execCommand|maxLength|readonly|attachEvent|detachEvent|frameBorder|frameborder|readOnly|accessKey|accesskey|injectTop|all|colspan|iframe|htmlFor|cloneNode|injectInside|DOMElement|taintEnabled|Document|rowspan|colSpan|ie7|boolean|scrollTo|emptydrop|makeDraggable|utf|Microsoft|drop|over|makeResizable|serialize|leave|XMLHTTP|charset|responseXML|overrideMimeType|Connection|responseText|300|form|urlencoded|200|sqrt|Quint|ease|Pow|Expo|InOut|Out|tool|linear|In|Circ|acos|Quad|Cubic|Quart||button|Bounce|Sine|Back|618|close|setRequestHeader|media|screen|onabort|onerror|stylesheet|link|JSON|json|readystatechange|Image|10000|setHue|invert|pop|setSaturation|setBrightness|4096|HSB|RGB|Request|Remote|ecma|java|gi|html|Accept|postBody|Requested|With|exec|getResponseHeader|isFinite|Eaeflnr|eval|decodeURIComponent|toGMTString|action|setTime|expires|easeInOut|Elastic|focus|1999|org|w3|snapshotLength|snapshotItem|tab|down|password|reset||radio|checkbox|Group|getElementsByClassName|UNORDERED_NODE_SNAPSHOT_TYPE|XPathResult|filterByTag|easeOut|esc|submit|contextmenu|space|ES|blur|with|substring|starts|namespaceURI|backspace|keyup|resize|innerHeight|enter|innerWidth|onDomReady|dblclick|500|toElement|hellip|cancelBubble|effect|returnValue|clearTimer|keypress|toggle|easeIn|protocol|location|offsetParent|offsetLeft|offsetTop|https|void|fromElement|DOMContentLoaded|defer|Slide|write'.split('|'),0,{}))
var MooPrompt = box = new Class({
	setOptions: function(options){
		this.options = {
			buttons: 1,
			width: 300, // Set width of the box
			height: 0, // Set height of the box (0 = sized to content)
			maxHeight:100, // Maximum height of the dialog box
			vertical: 'middle', // top middle bottom
			horizontal: 'center', // left center right
			delay: 0, // Delay before closing (0=no delay)
			overlay: true, // Cover the page
			showCloseBtn: true,
			effect: 'grow'
				// 'grow' - Expands box from a middle point and fades in content
				// 'slide' - Slides in the box from the nearest side.
			// button1: 'Ok' --- supply this for setting button text
			// onButton1: function --- supply function for button action
		};
		Object.extend(this.options, options || {});
	},
	
	initialize: function(title, content, options){
		this.setOptions(options);
		this.title = title;
		this.text = content;
		if (this.options.overlay) {
			this.overlay = new Element('div').setProperty('class', 'cbOverlay');
			this.overlay.setStyles({
				'position': 'absolute', 'top': 0, 'left': 0, 'width': '100%', 'visibility': 'hidden'
			}).injectInside(document.body);
		}
		this.container = new Element('div').setProperty('class', 'cbContainer');
		this.container.setStyles({
			'position': 'absolute', 'visibility': 'hidden'
		}).injectInside(document.body);
		
		this.box = new Element('div').setProperty('class', 'cbBox');
		this.box.setStyles({
			'width': this.options.width+'px',
			'overflow': 'auto'
		}).injectInside(this.container);
		
		if (this.box.getStyle('background-color') == '' || this.box.getStyle('background-color') == 'transparent') {
			this.box.setStyle('background-color', this.container.getStyle('background-color'));
		}
		if( this.options.showCloseBtn ) {
			this.closeBtn = new Element('div').setProperty('class', 'cbCloseButton');
			this.closeBtn.onclick = this.close.pass(['close'], this);
			this.closeBtn.injectInside(this.box);
		}
		
		this.header = new Element('h3').setProperty('class', 'cbHeader').appendText(this.title).injectInside(this.box);
				
		this.content = new Element('div').setProperty('class', 'cbContent').injectInside(this.box);
		if ($type(content) == 'element' ) {
			content.injectInside(this.content);
		} else {
			this.content.setHTML(this.text);
		}
		this.buttons = new Element('div').setProperty('class', 'cbButtons').injectInside(this.box);
		if (this.buttons.getStyle('background-color') == '' || this.buttons.getStyle('background-color') == 'transparent') {
			this.buttons.setStyle('background-color', this.box.getStyle('background-color'));
		}
		for (var i = 1; i <= this.options.buttons; i++) {
			if (typeof(this.options['button'+i]) == 'undefined') {
				this.options['button'+i] = 'Button';
			}
			if ($type(this.options['button'+i]) == 'element') {
				this['button'+i] = this.options['button'+i]
				this['button'+i].injectInside(this.buttons);
			} else {
				this['button'+i] = new Element('input').setProperties({type: 'button', value: this.options['button'+i]}).injectInside(this.buttons);
			}
			if (typeof(this.options['button'+i]) == 'undefined') {
				this.options['onButton'+i] = Class.empty;
			}
			this['button'+i].setProperty('class', 'button cbButton');
			this['button'+i].onclick = this.close.pass([this.options['onButton'+i]], this);
		}
		this.boxHeight = (this.box.offsetHeight < this.options.maxHeight) ? this.box.offsetHeight : this.options.maxHeight;
		this.boxHeight = (this.options.height > 0) ? this.options.height : this.boxHeight;
		this._position();
		this.eventPosition = this._position.bind(this);
		window.addEvent('scroll', this.eventPosition).addEvent('resize', this.eventPosition);
		this.box.setStyle('display', 'none');
		if (this.options.overlay) {
			this.fx1 = new Fx.Style(this.overlay, 'opacity', {duration:100}).custom(0, .8);
		}
		if (this.options.effect == 'grow') {
			this.container.setStyle('top', (Window.getScrollTop()+(Window.getHeight()/2))+'px');
			var style = {}; style.height = 0; style.width = 0;
			if (this.options.horizontal != 'center') {
				style[this.options.horizontal] = (this.options.width/2)+'px';
			}
			if (this.options.vertical == 'top') {
				style[this.options.vertical] = (Window.getScrollTop()+(this.boxHeight/2))+'px';
			} else if (this.options.vertical == 'bottom') {
				style.top = (Window.getScrollTop()+Window.getHeight()-(this.boxHeight/2)-25)+'px';
			}
			this.container.setStyles(style);
			this.container.setStyle('visibility', '');
			this.fx2 = new Fx.Styles(this.container, {duration:100});
			this.fx2.custom({
				'width': [0, this.options.width], 'margin-left': [0, -this.options.width/2], 'margin-right': [0, -this.options.width/2],
				'height': [0, this.boxHeight], 'margin-top': [0, -this.boxHeight/2], 'margin-bottom': [0, -this.boxHeight/2]
			}).chain(function() {
				this.box.setStyles({
					'visibility': 'hidden', 'display': '', 'height': this.boxHeight+'px'
				});
				new Fx.Style(this.box, 'opacity', {duration:100}).custom(0, 1).chain(function() {
					if (this.options.delay > 0) {
						var fn = function () {
							this.close()
						}.bind(this).delay(this.options.delay);
					}
				}.bind(this));
			}.bind(this));
		} else {
			this.container.setStyles({
				'height': this.boxHeight, 'width': this.options.width,
				'left': '', 'visibility': 'hidden'
			});
			this.box.setStyles({
				'visibility': '', 'display': '', 'height': this.boxHeight+'px'
			});
			this.fx2 = new Fx.Styles(this.container, {duration:100});
			var special = {};
			if (this.options.horizontal != 'center') {
				special[this.options.horizontal] = [-this.options.width, 0];
			} else {
				this.container.setStyles({
					'left': '50%', 'margin-left': (-this.options.width/2)+'px', 'margin-right': (-this.options.width/2)+'px'
				});
			}
			if (this.options.vertical == 'top') {
				special[this.options.vertical] = [Window.getScrollTop()-this.boxHeight, Window.getScrollTop()];
			} else if (this.options.vertical == 'bottom') {
				special.top = [Window.getScrollTop()+Window.getHeight(), Window.getScrollTop()+Window.getHeight()-this.boxHeight-25];
			} else {
				this.container.setStyles({
					'top': (Window.getScrollTop()+(Window.getHeight()/2))+'px', 'margin-top': (-this.boxHeight/2)+'px', 'margin-bottom': (-this.boxHeight/2)+'px'
				});
			}
			special.opacity = [0, 1];
			this.fx2.custom(special).chain(function() {
				if (this.options.delay > 0) {
					var fn = function () {
						this.close()
					}.bind(this).delay(this.options.delay);
				}
			}.bind(this));
		}
	},
	
	_position: function() {
		var wHeight = (Window.getScrollHeight() > Window.getHeight()) ? Window.getScrollHeight() : Window.getHeight();
		//var bHeight = this.container.getStyle('height').toInt();
		var lr = (this.options.effect == 'grow') ? this.options.width/2 : 0;
		var tb = (this.options.effect == 'grow') ? this.boxHeight/2 : 0;
		if (this.options.overlay) {
			this.overlay.setStyles({height: wHeight+'px'});
		}
		switch(this.options.vertical) {
			case 'top':
				this.container.setStyle('top', (Window.getScrollTop()+tb)+'px');
				break;
			case 'middle':
				this.container.setStyle('top', (Window.getScrollTop()+(Window.getHeight()/2))+'px');
				break;
			case 'bottom':
				this.container.setStyle('top', (Window.getScrollTop()+Window.getHeight()-this.boxHeight+tb-25)+'px');
				break;
		}
		if (this.options.horizontal == 'center') {
			this.container.setStyle('left', '50%');
		} else {
			this.container.setStyle(this.options.horizontal, lr+'px');
		}
	},
	
	close: function(fn) {
		for (var i = 1; i <= this.options.buttons; i++) {
			this['button'+i].onclick = null;
		}
		if (this.options.overlay) {this.fx1.clearTimer();}
		this.fx2.clearTimer();
		if (typeof(fn) == 'function') {
			fn();
		}
		if (this.options.overlay) {new Fx.Style(this.overlay, 'opacity', {duration:250}).custom(.8, 0);}
		new Fx.Style(this.container, 'opacity', {
			duration:250,
			onComplete: function() {
				window.removeEvent('scroll', this.eventPosition).removeEvent('resize', this.eventPosition);
				if (this.options.overlay) {
					this.overlay.remove();
					}
				try{ this.container.remove(); } catch(e){}
			}.bind(this)
		}).custom(1, 0);
	}
});

MooPrompt.implement(new Chain);/*
	Slimbox v1.41 - The ultimate lightweight Lightbox clone
	by Christophe Beyls (http://www.digitalia.be) - MIT-style license.
	Inspired by the original Lightbox v2 by Lokesh Dhakar.
*/

var Lightbox = {

	init: function(options){
		this.options = $extend({
			resizeDuration: 400,
			resizeTransition: false,	// default transition
			initialWidth: 250,
			initialHeight: 250,
			animateCaption: true,
			showCounter: true
		}, options || {});

		this.anchors = [];
		$each(document.links, function(el){
			if (el.rel && el.rel.test(/^lightbox/i)){
				el.onclick = this.click.pass(el, this);
				this.anchors.push(el);
			}
		}, this);
		this.eventKeyDown = this.keyboardListener.bindAsEventListener(this);
		this.eventPosition = this.position.bind(this);

		this.overlay = new Element('div', {'id': 'lbOverlay'}).injectInside(document.body);

		this.center = new Element('div', {'id': 'lbCenter', 'styles': {'width': this.options.initialWidth, 'height': this.options.initialHeight, 'marginLeft': -(this.options.initialWidth/2), 'display': 'none'}}).injectInside(document.body);
		this.image = new Element('div', {'id': 'lbImage'}).injectInside(this.center);
		this.prevLink = new Element('a', {'id': 'lbPrevLink', 'href': '#', 'styles': {'display': 'none'}}).injectInside(this.image);
		this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);
		this.prevLink.onclick = this.previous.bind(this);
		this.nextLink.onclick = this.next.bind(this);

		this.bottomContainer = new Element('div', {'id': 'lbBottomContainer', 'styles': {'display': 'none'}}).injectInside(document.body);
		this.bottom = new Element('div', {'id': 'lbBottom'}).injectInside(this.bottomContainer);
		new Element('a', {'id': 'lbCloseLink', 'href': '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);
		this.caption = new Element('div', {'id': 'lbCaption'}).injectInside(this.bottom);
		this.number = new Element('div', {'id': 'lbNumber'}).injectInside(this.bottom);
		new Element('div', {'styles': {'clear': 'both'}}).injectInside(this.bottom);

		var nextEffect = this.nextEffect.bind(this);
		this.fx = {
			overlay: this.overlay.effect('opacity', {duration: 500}).hide(),
			resize: this.center.effects($extend({duration: this.options.resizeDuration, onComplete: nextEffect}, this.options.resizeTransition ? {transition: this.options.resizeTransition} : {})),
			image: this.image.effect('opacity', {duration: 500, onComplete: nextEffect}),
			bottom: this.bottom.effect('margin-top', {duration: 400, onComplete: nextEffect})
		};

		this.preloadPrev = new Image();
		this.preloadNext = new Image();
	},

	click: function(link){
		if (link.rel.length == 8) return this.show(link.href, link.title);

		var j, imageNum, images = [];
		this.anchors.each(function(el){
			if (el.rel == link.rel){
				for (j = 0; j < images.length; j++) if(images[j][0] == el.href) break;
				if (j == images.length){
					images.push([el.href, el.title]);
					if (el.href == link.href) imageNum = j;
				}
			}
		}, this);
		return this.open(images, imageNum);
	},

	show: function(url, title){
		return this.open([[url, title]], 0);
	},

	open: function(images, imageNum){
		this.images = images;
		this.position();
		this.setup(true);
		this.top = window.getScrollTop() + (window.getHeight() / 15);
		this.center.setStyles({top: this.top, display: ''});
		this.fx.overlay.start(0.8);
		return this.changeImage(imageNum);
	},

	position: function(){
		this.overlay.setStyles({'top': window.getScrollTop(), 'height': window.getHeight()});
	},

	setup: function(open){
		var elements = $A(document.getElementsByTagName('object'));
		elements.extend(document.getElementsByTagName(window.ie ? 'select' : 'embed'));
		elements.each(function(el){
			if (open) el.lbBackupStyle = el.style.visibility;
			el.style.visibility = open ? 'hidden' : el.lbBackupStyle;
		});
		var fn = open ? 'addEvent' : 'removeEvent';
		window[fn]('scroll', this.eventPosition)[fn]('resize', this.eventPosition);
		document[fn]('keydown', this.eventKeyDown);
		this.step = 0;
	},

	keyboardListener: function(event){
		switch (event.keyCode){
			case 27: case 88: case 67: this.close(); break;
			case 37: case 80: this.previous(); break;	
			case 39: case 78: this.next();
		}
	},

	previous: function(){
		return this.changeImage(this.activeImage-1);
	},

	next: function(){
		return this.changeImage(this.activeImage+1);
	},

	changeImage: function(imageNum){
		if (this.step || (imageNum < 0) || (imageNum >= this.images.length)) return false;
		this.step = 1;
		this.activeImage = imageNum;

		this.bottomContainer.style.display = this.prevLink.style.display = this.nextLink.style.display = 'none';
		this.fx.image.hide();
		this.center.className = 'lbLoading';

		this.preload = new Image();
		this.preload.onload = this.nextEffect.bind(this);
		this.preload.src = this.images[imageNum][0];
		return false;
	},

	nextEffect: function(){
		switch (this.step++){
		case 1:
			this.center.className = '';
			this.image.style.backgroundImage = 'url('+this.images[this.activeImage][0]+')';
			this.image.style.width = this.bottom.style.width = this.preload.width+'px';
			this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';

			this.caption.setHTML(this.images[this.activeImage][1] || '');
			this.number.setHTML((!this.options.showCounter || (this.images.length == 1)) ? '' : 'Image '+(this.activeImage+1)+' of '+this.images.length);

			if (this.activeImage) this.preloadPrev.src = this.images[this.activeImage-1][0];
			if (this.activeImage != (this.images.length - 1)) this.preloadNext.src = this.images[this.activeImage+1][0];
			if (this.center.clientHeight != this.image.offsetHeight){
				this.fx.resize.start({height: this.image.offsetHeight});
				break;
			}
			this.step++;
		case 2:
			if (this.center.clientWidth != this.image.offsetWidth){
				this.fx.resize.start({width: this.image.offsetWidth, marginLeft: -this.image.offsetWidth/2});
				break;
			}
			this.step++;
		case 3:
			this.bottomContainer.setStyles({top: this.top + this.center.clientHeight, height: 0, marginLeft: this.center.style.marginLeft, display: ''});
			this.fx.image.start(1);
			break;
		case 4:
			if (this.options.animateCaption){
				this.fx.bottom.set(-this.bottom.offsetHeight);
				this.bottomContainer.style.height = '';
				this.fx.bottom.start(0);
				break;
			}
			this.bottomContainer.style.height = '';
		case 5:
			if (this.activeImage) this.prevLink.style.display = '';
			if (this.activeImage != (this.images.length - 1)) this.nextLink.style.display = '';
			this.step = 0;
		}
	},

	close: function(){
		if (this.step < 0) return;
		this.step = -1;
		if (this.preload){
			this.preload.onload = Class.empty;
			this.preload = null;
		}
		for (var f in this.fx) this.fx[f].stop();
		this.center.style.display = this.bottomContainer.style.display = 'none';
		this.fx.overlay.chain(this.setup.pass(false, this)).start(0);
		return false;
	}
};

window.addEvent('load', Lightbox.init.bind(Lightbox));
