function FFSuggest() {
 
 var pRequest;
 var pLayer;
 var pDebug = false;
 var pInstanceName = '';
 var pSearchURL = '';
 var pQueryParamName = '';
 var pFormname = '';
 var pLayerName = '';
 var pQueryInput;
 var pSuggest = new Array();
 var pLastQuery;
 var pCurrentSelection = 0;
 var submitted = false;

 var pSuggestQueryClass = 'suggestTextQuery';
 var pSuggestTypeClass = 'suggestTextType';
 var pSuggestAmountClass = 'suggestTextAmount';
 var pSuggestQueryTypedClass = 'suggestTextQueryTyped';
 var pSuggestFooterClass = 'suggestFooter';
 var pSuggestHeaderClass = 'suggestHeader';
 var pSuggestRowClass = 'suggestRow';
 var pSuggestHighlightClass = 'suggestHighlight';

 this.init = function(searchURL, formname, queryParamName, divLayername, instanceName, debugMode, channelParamName, channel) {
 pSearchURL = searchURL;
 pFormname = formname;
 pQueryParamName = queryParamName;
 pChannelParamName = channelParamName;
 pChannel = channel;
 pLayerName = divLayername;
 pInstanceName = instanceName;
 pDebug = debugMode;
 if (pSearchURL == '') { 
 if (pDebug) alert('no searchurl defined');
 return null;
 } else if (pInstanceName == '') {
 if (pDebug) alert('no instancename defined');
 return null;
 } else if (pFormname == '') {
 if (pDebug) alert('no formname defined');
 return null;
 } else if (pQueryParamName == '') {
 if (pDebug) alert('no queryparamname defined');
 return null;
 } else if (pLayerName == '') {
 if (pDebug) alert('need a layer for output');
 }
 pQueryInput = document[pFormname][pQueryParamName];
 pQueryInput.onkeyup = handleKeyPress;
 pQueryInput.onfocus = showLayer;
 pQueryInput.onblur = hideLayer;
 document[pFormname].onsubmit = handleSubmit;
 }
 
 function handleSubmit() {
 submitted = true;
 if (pSuggest[pCurrentSelection] != undefined) {
 document[pFormname][pQueryParamName].value = pSuggest[pCurrentSelection].split('###')[0];
 if(document[pFormname]['queryFromSuggest'] != null){
 document[pFormname]['queryFromSuggest'].value = true;
 }
 }
 }
 
 this.handleClick = function() {
 if (pSuggest[pCurrentSelection] != undefined) {
 document[pFormname][pQueryParamName].value = pSuggest[pCurrentSelection].split('###')[0];
 if(document[pFormname]['queryFromSuggest'] != null){
 document[pFormname]['queryFromSuggest'].value = true;
 }
 document[pFormname].submit();
 }
 }
 
 this.handleMouseOver = function(pos) {
 var tblCell = getTableCell(pos);
 unmarkAll();
 if (tblCell != null) {
 highlightSuggest(tblCell);
 pCurrentSelection = pos;
 }
 }
 
 this.handleMouseOut = function(pos) {
 var tblCell = getTableCell(pos);
 if (tblCell != null) {
 unmarkSuggest(tblCell);
 pCurrentSelection = -1
 }
 }
 
 function handleKeyPress(evt) {
 evt = (evt) ? evt : ((event) ? event : null);
 var keyCode = evt.keyCode;
 if (keyCode == 38) {
 moveSelection('up')
 } else if (keyCode == 27) { 
 hideLayer();
 } else if (keyCode == 40) {
 moveSelection('down');
 } else {
 if (pQueryInput.value == '') {
 hideLayer();
 if (pLayer != null){ pLayer.innerHTML = ''; }
 return null;
 }
 if (pLastQuery != pQueryInput.value){ startAjax(); }
 pLastQuery = pQueryInput.value;
 }
 }
 
 function moveSelection(direction) {
 var pos = pCurrentSelection;
 if (direction == 'up'){ pos--; }
 else{ pos += 1; }
 
 if (pos < 0) {
 unmarkAll();
 pQueryInput.focus();
 pCurrentSelection = -1;
 } else {
 var tblCell = getTableCell(pos);
 if (tblCell != null) {
 unmarkAll();
 highlightSuggest(tblCell);
 pCurrentSelection = pos;
 }
 }
 
 var query = pQueryInput.value;
 pQueryInput.value = '';
 pQueryInput.focus();
 pQueryInput.value = query; 
 }
 
 function startAjax() {
 var query = pQueryInput.value;
 var requestURL = pSearchURL +'?'+ pQueryParamName +'='+ escape(query) +'&'+ pChannelParamName +'='+ pChannel;
 
 try {
 if( window.XMLHttpRequest ) {
 pRequest = new XMLHttpRequest();
 } else if( window.ActiveXObject ) {
 pRequest = new ActiveXObject( "Microsoft.XMLHTTP" );
 } else {
 if (pDebug) alert( 'no ajax connection' );
 }
 
 pLayer = document.getElementById(pLayerName);
 if (pLayer != null) {
 if (query != '') {

 pRequest.open( "GET", requestURL, true );
 pRequest.onreadystatechange = callbackAjax;
 pRequest.send( null );
 } else {
 hideLayer();
 }
 } else {
 if (pDebug) alert( 'no layer for output found' );
 }
 } catch( ex ) {
 hideLayer();
 if (ex == undefined) {
 if (pDebug) alert( 'Error: ' + ex.getmessage );
 } else {
 if (pDebug) alert( 'Error: ' + ex );
 }
 }
 }
 
 function hideLayer() {
 if (pLayer != null) {
 pLayer.style.display = 'none';
 fireSuggestLayerHidden();
 }
 }
 
 this.hideLayerOutsideCall = function() {
 if (pLayer != null) {
 pLayer.style.display = 'none';
 fireSuggestLayerHidden();
 }
 }
 
 function showLayer() {
 if (pLayer != null && pSuggest != null && pSuggest.length >= 1) {
 pLayer.style.display = 'block';
 }
 }
 
 function callbackAjax() {
 if (submitted == false) {
 if (pRequest.readyState == 4) {
 if (pRequest.status != 200) {
 hideLayer();
 if (pDebug) alert( 'Error (' + pRequest.status + '): ' + pRequest.statusText );
 } else {
 handleResponse(pRequest.responseText);
 }
 }
 }
 }

 // calls the callback for "outside" listeners if the callback is implemented
 function fireSuggestCompleted(suggestLayerIsVisible) {
 if (typeof(onSuggestCompleted) == 'function') {
 onSuggestCompleted(suggestLayerIsVisible);
 }
 }
 
 // calls the callback for "outside" listeners if the callback is implemented
 function fireSuggestLayerHidden() {
 if (typeof(onSuggestLayerHidden) == 'function') {
 onSuggestLayerHidden();
 }
 }

 function handleResponse(text) {
 pCurrentSelection = -1;
 pSuggest = new Array();
 pSuggest = text.split('\n');
 var outputText = '<table cellpadding="0" cellspacing="0" class="' + pLayerName + '" width="100%" border="0" onMouseDown="' + pInstanceName + '.handleClick();">';
 outputText += '<tr class="'+pSuggestHeaderClass+'" ><td nowrap="nowrap" colspan="3"><ff:jsescape><bean:message bundle="Suggest" key="header" /></ff:jsescape></td></tr>';
 
 var pNewSuggest = new Array();
 //for (var i in pSuggest) {
 for (var i = 0; i < pSuggest.length; i++) {
 var firstChar = pSuggest[i].charCodeAt(0);
 
 if (firstChar != 13 && firstChar != 10 && pSuggest[i].length >= 1) {
 pNewSuggest.push(pSuggest[i]);
 }
 }
 pSuggest = pNewSuggest;
 var query = pQueryInput.value;
 
 for (var i = 0; i < pSuggest.length; i++) {
 pSuggestParts = new Array();
 pSuggestParts = pSuggest[i].split("###");
 
 outputText += '<tr id="' + pLayerName + '_' + i + '" class="'+pSuggestRowClass+'" onMouseOver="' + pInstanceName + '.handleMouseOver(' + i + ');" onMouseOut="' + pInstanceName + '.handleMouseOut(' + i + ');">'
 +'<td nowrap="nowrap" class="'+ pSuggestQueryClass +'">' + pSuggestParts[0].replace(new RegExp("("+query+")","ig"),'<span class="'+pSuggestQueryTypedClass+'">$1</span>') + '</td>'
 +'<td nowrap="nowrap" class="'+ pSuggestTypeClass +'">' + pSuggestParts[2] + '</td>'
 +'</tr>';
 }
 outputText += '<tr><td class="'+pSuggestFooterClass+'" colspan="3">&nbsp;</td></tr></table>';
 if (pSuggest.length >= 1) {
 showLayer();
 pLayer.innerHTML = outputText;

 // calback for "outside" listeners
 fireSuggestCompleted(true);
 } else {
 hideLayer();
 pLayer.innerHTML = '';
 
 // calback for "outside" listeners
 fireSuggestCompleted(false);
 }
 
 }
 
 function highlightSuggest(tblCell) {
 tblCell.className = pSuggestHighlightClass; 
 }
 
 function unmarkSuggest(tblCell) {
 tblCell.className = pSuggestRowClass; 
 }
 
 function unmarkAll() {
 var tblCell;
 //for (var i in pSuggest) {
 for (var i = 0; i < pSuggest.length; i++) {
 tblCell = getTableCell(i);
 if (tblCell != null) {
 unmarkSuggest(tblCell);
 }
 }
 }
 
 function getTableCell(pos) {
 var tblCell;
 tblCell = document.getElementById(pLayerName + '_' + pos);
 return tblCell;
 }
}
var LiveChatPeriodUpdater = null;

String.prototype.trim = function()
{
 return this.replace(/(?:^\s+|\s+$)/g, "");
}

function SendMessage()
{
 var customermessage = document.getElementById('textmessage').value.trim();
 document.getElementById('textmessage').value = '';
 if (customermessage != '')
 {
 var img = document.getElementById('livachat_ajax_loader');
 if (img != null)
 {
 img.style.display = 'inline';
 }
 
 if (LiveChatPeriodUpdater != null) {
 LiveChatPeriodUpdater.stop();
 }
 
 var setBottom = isScrollAtBottom();
 Insertion.Bottom('livechat_messages', "<b>" + customerName + "</b> : " + customermessage + "<br />");
 if (setBottom) {
 ScrollChatWindowToBottom();
 }
 
 var request = new Ajax.Request(
 urlSendMessage,
 {
 method: 'get',
 parameters: { message: customermessage },
 onSuccess: function(transport, json) {
 SetUpdater();
 if (LiveChatPeriodUpdater != null) {
 LiveChatPeriodUpdater.stop();
 }
 LiveChatPeriodUpdater.start();
 
 var img = document.getElementById('livechat_ajax_loader');
 if (img != null) {
 img.style.display = 'none';
 }
 
 }
 }
 );
 }
}

function SetUpdater()
{
 var setBottom = false;
 ScrollChatWindowToBottom(true);
 
 if (LiveChatPeriodUpdater == null)
 {
 LiveChatPeriodUpdater = new Ajax.PeriodicalUpdater(
 'livechat_messages',
 urlUpdater,
 {
 frequency: frequency,
 decay: decay,
 onSuccess: 
 function() {
 setBottom = isScrollAtBottom();
 },
 onComplete: 
 function() { 
 if(setBottom) {
 ScrollChatWindowToBottom();
 }
 }
 }
 );
 }
}

function isScrollAtBottom() {
 return $('livechat_messages').scrollTop >= $('livechat_messages').scrollHeight - $('livechat_messages').getHeight();
}

function ScrollChatWindowToBottom() { 
 $('livechat_messages').scrollTop = $('livechat_messages').scrollHeight;
}

function LiveChatKeyPress(e) {
 if (e.keyCode == 13) {
 SendMessage();
 }
}

function chatOpen() {
 var request = new Ajax.Request('/flivechat/chat/openchat',
 {
 method: 'get',
 parameters: { open: 'true' },
 onSuccess: function(transport) {
 location.reload();
 }
 }
 );
}

/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 */
if(typeof Product=='undefined') {
 var Product = {};
}

/********************* IMAGE ZOOMER ***********************/

Product.Zoom = Class.create();
/**
 * Image zoom control
 *
 * @author Magento Core Team <core@magentocommerce.com>
 */
Product.Zoom.prototype = {
 initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){
 this.containerEl = $(imageEl).parentNode;
 this.imageEl = $(imageEl);
 this.handleEl = $(handleEl);
 this.trackEl = $(trackEl);
 this.hintEl = $(hintEl);

 this.containerDim = Element.getDimensions(this.containerEl);
 this.imageDim = Element.getDimensions(this.imageEl);

 this.imageDim.ratio = this.imageDim.width/this.imageDim.height;

 this.floorZoom = 1;

 if (this.imageDim.width > this.imageDim.height) {
 this.ceilingZoom = this.imageDim.width / this.containerDim.width;
 } else {
 this.ceilingZoom = this.imageDim.height / this.containerDim.height;
 }

 if (this.imageDim.width <= this.containerDim.width
 && this.imageDim.height <= this.containerDim.height) {
 this.trackEl.up().hide();
 this.hintEl.hide();
 this.containerEl.removeClassName('product-image-zoom');
 return;
 }

 this.imageX = 0;
 this.imageY = 0;
 this.imageZoom = 1;

 this.sliderSpeed = 0;
 this.sliderAccel = 0;
 this.zoomBtnPressed = false;

 this.showFull = false;

 this.selects = document.getElementsByTagName('select');

 this.draggable = new Draggable(imageEl, {
 starteffect:false,
 reverteffect:false,
 endeffect:false,
 snap:this.contain.bind(this)
 });

 this.slider = new Control.Slider(handleEl, trackEl, {
 axis:'horizontal',
 minimum:0,
 maximum:Element.getDimensions(this.trackEl).width,
 alignX:0,
 increment:1,
 sliderValue:0,
 onSlide:this.scale.bind(this),
 onChange:this.scale.bind(this)
 });

 this.scale(0);

 Event.observe(this.imageEl, 'dblclick', this.toggleFull.bind(this));

 Event.observe($(zoomInEl), 'mousedown', this.startZoomIn.bind(this));
 Event.observe($(zoomInEl), 'mouseup', this.stopZooming.bind(this));
 Event.observe($(zoomInEl), 'mouseout', this.stopZooming.bind(this));

 Event.observe($(zoomOutEl), 'mousedown', this.startZoomOut.bind(this));
 Event.observe($(zoomOutEl), 'mouseup', this.stopZooming.bind(this));
 Event.observe($(zoomOutEl), 'mouseout', this.stopZooming.bind(this));
 },

 toggleFull: function () {
 this.showFull = !this.showFull;
 //TODO: hide selects for IE only

 for (i=0; i<this.selects.length; i++) {
 this.selects[i].style.visibility = this.showFull ? 'hidden' : 'visible';
 }
 val_scale = !this.showFull ? this.slider.value : 1;
 this.scale(val_scale);

 this.trackEl.style.visibility = this.showFull ? 'hidden' : 'visible';
 this.containerEl.style.overflow = this.showFull ? 'visible' : 'hidden';
 this.containerEl.style.zIndex = this.showFull ? '1000' : '9';

 return this;
 },

 scale: function (v) {

 var centerX = (this.containerDim.width*(1-this.imageZoom)/2-this.imageX)/this.imageZoom;
 var centerY = (this.containerDim.height*(1-this.imageZoom)/2-this.imageY)/this.imageZoom;

 this.imageZoom = this.floorZoom+(v*(this.ceilingZoom-this.floorZoom));

 this.imageEl.style.width = (this.imageZoom*this.containerDim.width)+'px';
 if(this.containerDim.ratio){
 this.imageEl.style.height = (this.imageZoom*this.containerDim.width*this.containerDim.ratio)+'px'; // for safari
 }

 this.imageX = this.containerDim.width*(1-this.imageZoom)/2-centerX*this.imageZoom;
 this.imageY = this.containerDim.height*(1-this.imageZoom)/2-centerY*this.imageZoom;

 this.contain(this.imageX, this.imageY, this.draggable);

 return true;
 },

 startZoomIn: function()
 {
 this.zoomBtnPressed = true;
 this.sliderAccel = .002;
 this.periodicalZoom();
 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05);
 return this;
 },

 startZoomOut: function()
 {
 this.zoomBtnPressed = true;
 this.sliderAccel = -.002;
 this.periodicalZoom();
 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05);
 return this;
 },

 stopZooming: function()
 {
 if (!this.zoomer || this.sliderSpeed==0) {
 return;
 }
 this.zoomBtnPressed = false;
 this.sliderAccel = 0;
 },

 periodicalZoom: function()
 {
 if (!this.zoomer) {
 return this;
 }

 if (this.zoomBtnPressed) {
 this.sliderSpeed += this.sliderAccel;
 } else {
 this.sliderSpeed /= 1.5;
 if (Math.abs(this.sliderSpeed)<.001) {
 this.sliderSpeed = 0;
 this.zoomer.stop();
 this.zoomer = null;
 }
 }
 this.slider.value += this.sliderSpeed;

 this.slider.setValue(this.slider.value);
 this.scale(this.slider.value);

 return this;
 },

 contain: function (x,y,draggable) {

 var dim = Element.getDimensions(draggable.element);

 var xMin = 0, xMax = this.containerDim.width-dim.width;
 var yMin = 0, yMax = this.containerDim.height-dim.height;

 x = x>xMin ? xMin : x;
 x = x<xMax ? xMax : x;
 y = y>yMin ? yMin : y;
 y = y<yMax ? yMax : y;

 this.imageX = x;
 this.imageY = y;

 this.imageEl.style.left = this.imageX+'px';
 this.imageEl.style.top = this.imageY+'px';

 return [x,y];
 }
}

/**************************** CONFIGURABLE PRODUCT **************************/
Product.Config = Class.create();
Product.Config.prototype = {
 initialize: function(config){
 this.config = config;
 this.taxConfig = this.config.taxConfig;
 this.settings = $$('.super-attribute-select');
 this.state = new Hash();
 this.priceTemplate = new Template(this.config.template);
 this.prices = config.prices;

 this.settings.each(function(element){
 Event.observe(element, 'change', this.configure.bind(this))
 }.bind(this));

 // fill state
 this.settings.each(function(element){
 var attributeId = element.id.replace(/[a-z]*/, '');
 if(attributeId && this.config.attributes[attributeId]) {
 element.config = this.config.attributes[attributeId];
 element.attributeId = attributeId;
 this.state[attributeId] = false;
 }
 }.bind(this))

 // Init settings dropdown
 var childSettings = [];
 for(var i=this.settings.length-1;i>=0;i--){
 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
 if(i==0){
 this.fillSelect(this.settings[i])
 }
 else {
 this.settings[i].disabled=true;
 }
 $(this.settings[i]).childSettings = childSettings.clone();
 $(this.settings[i]).prevSetting = prevSetting;
 $(this.settings[i]).nextSetting = nextSetting;
 childSettings.push(this.settings[i]);
 }

 // try retireve options from url
 var separatorIndex = window.location.href.indexOf('#');
 if (separatorIndex!=-1) {
 var paramsStr = window.location.href.substr(separatorIndex+1);
 this.values = paramsStr.toQueryParams();
 this.settings.each(function(element){
 var attributeId = element.attributeId;
 element.value = this.values[attributeId];
 this.configureElement(element);
 }.bind(this));
 }
 },

 configure: function(event){
 var element = Event.element(event);
 this.configureElement(element);
 },

 configureElement : function(element) {
 this.reloadOptionLabels(element);
 if(element.value){
 this.state[element.config.id] = element.value;
 if(element.nextSetting){
 element.nextSetting.disabled = false;
 this.fillSelect(element.nextSetting);
 this.resetChildren(element.nextSetting);
 }
 }
 else {
 this.resetChildren(element);
 }
 this.reloadPrice();
// Calculator.updatePrice();
 },

 reloadOptionLabels: function(element){
 var selectedPrice;
 if(element.options[element.selectedIndex].config){
 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price)
 }
 else{
 selectedPrice = 0;
 }
 for(var i=0;i<element.options.length;i++){
 if(element.options[i].config){
 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice);
 }
 }
 },

 resetChildren : function(element){
 if(element.childSettings) {
 for(var i=0;i<element.childSettings.length;i++){
 element.childSettings[i].selectedIndex = 0;
 element.childSettings[i].disabled = true;
 if(element.config){
 this.state[element.config.id] = false;
 }
 }
 }
 },

 fillSelect: function(element){
 var attributeId = element.id.replace(/[a-z]*/, '');
 var options = this.getAttributeOptions(attributeId);
 this.clearSelect(element);
 element.options[0] = new Option(this.config.chooseText, '');

 var prevConfig = false;
 if(element.prevSetting){
 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
 }

 if(options) {
 var index = 1;
 for(var i=0;i<options.length;i++){
 var allowedProducts = [];
 if(prevConfig) {
 for(var j=0;j<options[i].products.length;j++){
 if(prevConfig.config.allowedProducts
 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
 allowedProducts.push(options[i].products[j]);
 }
 }
 } else {
 allowedProducts = options[i].products.clone();
 }

 if(allowedProducts.size()>0){
 options[i].allowedProducts = allowedProducts;
 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id);
 element.options[index].config = options[i];
 index++;
 }
 }
 }
 },

 getOptionLabel: function(option, price){
 var price = parseFloat(price);
 if (this.taxConfig.includeTax) {
 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax;
 var excl = price - tax;
 var incl = excl*(1+(this.taxConfig.currentTax/100));
 } else {
 var tax = price * (this.taxConfig.currentTax / 100);
 var excl = price;
 var incl = excl + tax;
 }

 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) {
 price = incl;
 } else {
 price = excl;
 }

 var str = option.label;
 if(price){
 if (this.taxConfig.showBothPrices) {
 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')';
 } else {
 str+= ' ' + this.formatPrice(price, true);
 }
 }
 return str;
 },

 formatPrice: function(price, showSign){
 var str = '';
 price = parseFloat(price);
 if(showSign){
 if(price<0){
 str+= '-';
 price = -price;
 }
 else{
 str+= '+';
 }
 }

 var roundedPrice = (Math.round(price*100)/100).toString();

 if (this.prices && this.prices[roundedPrice]) {
 str+= this.prices[roundedPrice];
 }
 else {
 str+= this.priceTemplate.evaluate({price:price.toFixed(2)});
 }
 return str;
 },

 clearSelect: function(element){
 for(var i=element.options.length-1;i>=0;i--){
 element.remove(i);
 }
 },

 getAttributeOptions: function(attributeId){
 if(this.config.attributes[attributeId]){
 return this.config.attributes[attributeId].options;
 }
 },

 reloadPrice: function(){
 var price = 0;
 for(var i=this.settings.length-1;i>=0;i--){
 var selected = this.settings[i].options[this.settings[i].selectedIndex];
 if(selected.config){
 price += parseFloat(selected.config.price);
 }
 }

 optionsPrice.changePrice('config', price);
 optionsPrice.reload();

 return price;

 if($('product-price-'+this.config.productId)){
 $('product-price-'+this.config.productId).innerHTML = price;
 }
 this.reloadOldPrice();
 },

 reloadOldPrice: function(){
 if ($('old-price-'+this.config.productId)) {

 var price = parseFloat(this.config.oldPrice);
 for(var i=this.settings.length-1;i>=0;i--){
 var selected = this.settings[i].options[this.settings[i].selectedIndex];
 if(selected.config){
 price+= parseFloat(selected.config.price);
 }
 }
 if (price < 0)
 price = 0;
 price = this.formatPrice(price);

 if($('old-price-'+this.config.productId)){
 $('old-price-'+this.config.productId).innerHTML = price;
 }

 }
 }
}


/**************************** SUPER PRODUCTS ********************************/

Product.Super = {};
Product.Super.Configurable = Class.create();

Product.Super.Configurable.prototype = {
 initialize: function(container, observeCss, updateUrl, updatePriceUrl, priceContainerId) {
 this.container = $(container);
 this.observeCss = observeCss;
 this.updateUrl = updateUrl;
 this.updatePriceUrl = updatePriceUrl;
 this.priceContainerId = priceContainerId;
 this.registerObservers();
 },
 registerObservers: function() {
 var elements = this.container.getElementsByClassName(this.observeCss);
 elements.each(function(element){
 Event.observe(element, 'change', this.update.bindAsEventListener(this));
 }.bind(this));
 return this;
 },
 update: function(event) {
 var elements = this.container.getElementsByClassName(this.observeCss);
 var parameters = Form.serializeElements(elements, true);

 new Ajax.Updater(this.container, this.updateUrl + '?ajax=1', {
 parameters:parameters,
 onComplete:this.registerObservers.bind(this)
 });
 var priceContainer = $(this.priceContainerId);
 if(priceContainer) {
 new Ajax.Updater(priceContainer, this.updatePriceUrl + '?ajax=1', {
 parameters:parameters
 });
 }
 }
}

/**************************** PRICE RELOADER ********************************/
Product.OptionsPrice = Class.create();
Product.OptionsPrice.prototype = {
 initialize: function(config) {
 this.productId = config.productId;
 this.priceFormat = config.priceFormat;
 this.includeTax = config.includeTax;
 this.defaultTax = config.defaultTax;
 this.currentTax = config.currentTax;
 this.productPrice = config.productPrice;
 this.showIncludeTax = config.showIncludeTax;
 this.showBothPrices = config.showBothPrices;
 this.productPrice = config.productPrice;
 this.productOldPrice = config.productOldPrice;
 this.skipCalculate = config.skipCalculate;
 this.duplicateIdSuffix = config.idSuffix;

 this.oldPlusDisposition = config.oldPlusDisposition;
 this.plusDisposition = config.plusDisposition;

 this.oldMinusDisposition = config.oldMinusDisposition;
 this.minusDisposition = config.minusDisposition;

 this.optionPrices = {};
 this.containers = {};

 this.displayZeroPrice = true;

 this.initPrices();
 },

 setDuplicateIdSuffix: function(idSuffix) {
 this.duplicateIdSuffix = idSuffix;
 },

 initPrices: function() {
 this.containers[0] = 'product-price-' + this.productId;
 this.containers[1] = 'bundle-price-' + this.productId;
 this.containers[2] = 'price-including-tax-' + this.productId;
 this.containers[3] = 'price-excluding-tax-' + this.productId;
 this.containers[4] = 'old-price-' + this.productId;
 this.containers[5] = 'ps-product-price';
 this.containers[6] = 'ps-old-price';
 },

 changePrice: function(key, price) {
 this.optionPrices[key] = parseFloat(price);
 },

 getOptionPrices: function() {
 var result = 0;
 var nonTaxable = 0;
 $H(this.optionPrices).each(function(pair) {
 if (pair.key == 'nontaxable') {
 nonTaxable = pair.value;
 } else {
 result += pair.value;
 }
 });
 var r = new Array(result, nonTaxable);
 return r;
 },

 reload: function() {
 var price;
 var formattedPrice;
 var optionPrices = this.getOptionPrices();
 var nonTaxable = optionPrices[1];
 optionPrices = optionPrices[0];

 $H(this.containers).each(function(pair) {
 var _productPrice;
 var _plusDisposition;
 var _minusDisposition;
 if ($(pair.value)) {
 if ((pair.value == 'ps-old-price' || pair.value == 'old-price-'+this.productId) && this.productOldPrice != this.productPrice) {
 _productPrice = this.productOldPrice;
 _plusDisposition = this.oldPlusDisposition;
 _minusDisposition = this.oldMinusDisposition;
 } else {
 _productPrice = this.productPrice;
 _plusDisposition = this.plusDisposition;
 _minusDisposition = this.minusDisposition;
 }

 var price = optionPrices+parseFloat(_productPrice)
 if (this.includeTax == 'true') {
 // tax = tax included into product price by admin
 var tax = price / (100 + this.defaultTax) * this.defaultTax;
 var excl = price - tax;
 var incl = excl*(1+(this.currentTax/100));
 } else {
 var tax = price * (this.currentTax / 100);
 var excl = price;
 var incl = excl + tax;
 }

 excl += parseFloat(_plusDisposition);
 incl += parseFloat(_plusDisposition);
 excl -= parseFloat(_minusDisposition);
 incl -= parseFloat(_minusDisposition);

 //adding nontaxlable part of options
 excl += parseFloat(nonTaxable);
 incl += parseFloat(nonTaxable);

 if (pair.value == 'price-including-tax-'+this.productId) {
 price = incl;
 } else if (pair.value == 'old-price-'+this.productId || pair.value == 'ps-old-price') {
 if (this.showIncludeTax || this.showBothPrices) {
 price = incl;
 } else {
 price = excl;
 }
 } else {
 if (this.showIncludeTax) {
 price = incl;
 } else {
 if (!this.skipCalculate || _productPrice == 0) {
 price = excl;
 } else {
 price = optionPrices+parseFloat(_productPrice);
 }
 }
 }

 if (price < 0) price = 0;

 if (price > 0 || this.displayZeroPrice) {
 formattedPrice = this.formatPrice(price);
 } else {
 formattedPrice = '';
 }

 if ($(pair.value).select('.price')[0]) {
 $(pair.value).select('.price')[0].innerHTML = formattedPrice;
 if ($(pair.value+this.duplicateIdSuffix) && $(pair.value+this.duplicateIdSuffix).select('.price')[0]) {
 $(pair.value+this.duplicateIdSuffix).select('.price')[0].innerHTML = formattedPrice;
 }
 } else {
 $(pair.value).innerHTML = formattedPrice;
 if ($(pair.value+this.duplicateIdSuffix)) {
 $(pair.value+this.duplicateIdSuffix).innerHTML = formattedPrice;
 }
 }
 };
 }.bind(this));
 },
 formatPrice: function(price) {
 return formatCurrency(price, this.priceFormat);
 }
}

/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo
 * -----------------------------------------------------------
 *
 * The DHTML Calendar, version 1.0 "It is happening again"
 *
 * Details and latest version at:
 * www.dynarch.com/projects/calendar
 *
 * This script is developed by Dynarch.com. Visit us at www.dynarch.com.
 *
 * This script is distributed under the GNU Lesser General Public License.
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
 */

// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $

/** The Calendar object constructor. */
Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
 // member variables
 this.activeDiv = null;
 this.currentDateEl = null;
 this.getDateStatus = null;
 this.getDateToolTip = null;
 this.getDateText = null;
 this.timeout = null;
 this.onSelected = onSelected || null;
 this.onClose = onClose || null;
 this.dragging = false;
 this.hidden = false;
 this.minYear = 1970;
 this.maxYear = 2050;
 this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
 this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
 this.isPopup = true;
 this.weekNumbers = true;
 this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
 this.showsOtherMonths = false;
 this.dateStr = dateStr;
 this.ar_days = null;
 this.showsTime = false;
 this.time24 = true;
 this.yearStep = 2;
 this.hiliteToday = true;
 this.multiple = null;
 // HTML elements
 this.table = null;
 this.element = null;
 this.tbody = null;
 this.firstdayname = null;
 // Combo boxes
 this.monthsCombo = null;
 this.yearsCombo = null;
 this.hilitedMonth = null;
 this.activeMonth = null;
 this.hilitedYear = null;
 this.activeYear = null;
 // Information
 this.dateClicked = false;

 // one-time initializations
 if (typeof Calendar._SDN == "undefined") {
 // table of short day names
 if (typeof Calendar._SDN_len == "undefined")
 Calendar._SDN_len = 3;
 var ar = new Array();
 for (var i = 8; i > 0;) {
 ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
 }
 Calendar._SDN = ar;
 // table of short month names
 if (typeof Calendar._SMN_len == "undefined")
 Calendar._SMN_len = 3;
 ar = new Array();
 for (var i = 12; i > 0;) {
 ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
 }
 Calendar._SMN = ar;
 }
};

// ** constants

/// "static", needed for event handlers.
Calendar._C = null;

/// detect a special case of "web browser"
Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
 !/opera/i.test(navigator.userAgent) );

Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );

/// detect Opera browser
Calendar.is_opera = /opera/i.test(navigator.userAgent);

/// detect KHTML-based browsers
Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);

/// detect Gecko browsers
Calendar.is_gecko = navigator.userAgent.match(/gecko/i);

// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
// library, at some point.

// Returns CSS property for element
Calendar.getStyle = function(element, style) {
 if (element.currentStyle) {
 var y = element.currentStyle[style];
 } else if (window.getComputedStyle) {
 var y = document.defaultView.getComputedStyle(element,null).getPropertyValue(style);
 }

 return y;
};

/*
 * Different ways to find element's absolute position
 */
Calendar.getAbsolutePos = function(element) {

 var res = new Object();
 res.x = 0; res.y = 0;

 // variant 1 (working best, copy-paste from prototype library)
 do {
 res.x += element.offsetLeft || 0;
 res.y += element.offsetTop || 0;
 element = element.offsetParent;
 if (element) {
 if (element.tagName.toUpperCase() == 'BODY') break;
 var p = Calendar.getStyle(element, 'position');
 if (p !== 'static') break;
 }
 } while (element);

 return res;

 // variant 2 (good solution, but lost in IE8)
 if (element !== null) {
 res.x = element.offsetLeft;
 res.y = element.offsetTop;

 var offsetParent = element.offsetParent;
 var parentNode = element.parentNode;

 while (offsetParent !== null) {
 res.x += offsetParent.offsetLeft;
 res.y += offsetParent.offsetTop;

 if (offsetParent != document.body && offsetParent != document.documentElement) {
 res.x -= offsetParent.scrollLeft;
 res.y -= offsetParent.scrollTop;
 }
 //next lines are necessary to support FireFox problem with offsetParent
 if (Calendar.is_gecko) {
 while (offsetParent != parentNode && parentNode !== null) {
 res.x -= parentNode.scrollLeft;
 res.y -= parentNode.scrollTop;
 parentNode = parentNode.parentNode;
 }
 }
 parentNode = offsetParent.parentNode;
 offsetParent = offsetParent.offsetParent;
 }
 }
 return res;

 // variant 2 (not working)

// var SL = 0, ST = 0;
// var is_div = /^div$/i.test(el.tagName);
// if (is_div && el.scrollLeft)
// SL = el.scrollLeft;
// if (is_div && el.scrollTop)
// ST = el.scrollTop;
// var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
// if (el.offsetParent) {
// var tmp = this.getAbsolutePos(el.offsetParent);
// r.x += tmp.x;
// r.y += tmp.y;
// }
// return r;
};

Calendar.isRelated = function (el, evt) {
 var related = evt.relatedTarget;
 if (!related) {
 var type = evt.type;
 if (type == "mouseover") {
 related = evt.fromElement;
 } else if (type == "mouseout") {
 related = evt.toElement;
 }
 }
 while (related) {
 if (related == el) {
 return true;
 }
 related = related.parentNode;
 }
 return false;
};

Calendar.removeClass = function(el, className) {
 if (!(el && el.className)) {
 return;
 }
 var cls = el.className.split(" ");
 var ar = new Array();
 for (var i = cls.length; i > 0;) {
 if (cls[--i] != className) {
 ar[ar.length] = cls[i];
 }
 }
 el.className = ar.join(" ");
};

Calendar.addClass = function(el, className) {
 Calendar.removeClass(el, className);
 el.className += " " + className;
};

// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately.
Calendar.getElement = function(ev) {
 var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget;
 while (f.nodeType != 1 || /^div$/i.test(f.tagName))
 f = f.parentNode;
 return f;
};

Calendar.getTargetElement = function(ev) {
 var f = Calendar.is_ie ? window.event.srcElement : ev.target;
 while (f.nodeType != 1)
 f = f.parentNode;
 return f;
};

Calendar.stopEvent = function(ev) {
 ev || (ev = window.event);
 if (Calendar.is_ie) {
 ev.cancelBubble = true;
 ev.returnValue = false;
 } else {
 ev.preventDefault();
 ev.stopPropagation();
 }
 return false;
};

Calendar.addEvent = function(el, evname, func) {
 if (el.attachEvent) { // IE
 el.attachEvent("on" + evname, func);
 } else if (el.addEventListener) { // Gecko / W3C
 el.addEventListener(evname, func, true);
 } else {
 el["on" + evname] = func;
 }
};

Calendar.removeEvent = function(el, evname, func) {
 if (el.detachEvent) { // IE
 el.detachEvent("on" + evname, func);
 } else if (el.removeEventListener) { // Gecko / W3C
 el.removeEventListener(evname, func, true);
 } else {
 el["on" + evname] = null;
 }
};

Calendar.createElement = function(type, parent) {
 var el = null;
 if (document.createElementNS) {
 // use the XHTML namespace; IE won't normally get here unless
 // _they_ "fix" the DOM2 implementation.
 el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
 } else {
 el = document.createElement(type);
 }
 if (typeof parent != "undefined") {
 parent.appendChild(el);
 }
 return el;
};

// END: UTILITY FUNCTIONS

// BEGIN: CALENDAR STATIC FUNCTIONS

/** Internal -- adds a set of events to make some element behave like a button. */
Calendar._add_evs = function(el) {
 with (Calendar) {
 addEvent(el, "mouseover", dayMouseOver);
 addEvent(el, "mousedown", dayMouseDown);
 addEvent(el, "mouseout", dayMouseOut);
 if (is_ie) {
 addEvent(el, "dblclick", dayMouseDblClick);
 el.setAttribute("unselectable", true);
 }
 }
};

Calendar.findMonth = function(el) {
 if (typeof el.month != "undefined") {
 return el;
 } else if (typeof el.parentNode.month != "undefined") {
 return el.parentNode;
 }
 return null;
};

Calendar.findYear = function(el) {
 if (typeof el.year != "undefined") {
 return el;
 } else if (typeof el.parentNode.year != "undefined") {
 return el.parentNode;
 }
 return null;
};

Calendar.showMonthsCombo = function () {
 var cal = Calendar._C;
 if (!cal) {
 return false;
 }
 var cal = cal;
 var cd = cal.activeDiv;
 var mc = cal.monthsCombo;
 if (cal.hilitedMonth) {
 Calendar.removeClass(cal.hilitedMonth, "hilite");
 }
 if (cal.activeMonth) {
 Calendar.removeClass(cal.activeMonth, "active");
 }
 var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
 Calendar.addClass(mon, "active");
 cal.activeMonth = mon;
 var s = mc.style;
 s.display = "block";
 if (cd.navtype < 0)
 s.left = cd.offsetLeft + "px";
 else {
 var mcw = mc.offsetWidth;
 if (typeof mcw == "undefined")
 // Konqueror brain-dead techniques
 mcw = 50;
 s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
 }
 s.top = (cd.offsetTop + cd.offsetHeight) + "px";
};

Calendar.showYearsCombo = function (fwd) {
 var cal = Calendar._C;
 if (!cal) {
 return false;
 }
 var cal = cal;
 var cd = cal.activeDiv;
 var yc = cal.yearsCombo;
 if (cal.hilitedYear) {
 Calendar.removeClass(cal.hilitedYear, "hilite");
 }
 if (cal.activeYear) {
 Calendar.removeClass(cal.activeYear, "active");
 }
 cal.activeYear = null;
 var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
 var yr = yc.firstChild;
 var show = false;
 for (var i = 12; i > 0; --i) {
 if (Y >= cal.minYear && Y <= cal.maxYear) {
 yr.innerHTML = Y;
 yr.year = Y;
 yr.style.display = "block";
 show = true;
 } else {
 yr.style.display = "none";
 }
 yr = yr.nextSibling;
 Y += fwd ? cal.yearStep : -cal.yearStep;
 }
 if (show) {
 var s = yc.style;
 s.display = "block";
 if (cd.navtype < 0)
 s.left = cd.offsetLeft + "px";
 else {
 var ycw = yc.offsetWidth;
 if (typeof ycw == "undefined")
 // Konqueror brain-dead techniques
 ycw = 50;
 s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
 }
 s.top = (cd.offsetTop + cd.offsetHeight) + "px";
 }
};

// event handlers

Calendar.tableMouseUp = function(ev) {
 var cal = Calendar._C;
 if (!cal) {
 return false;
 }
 if (cal.timeout) {
 clearTimeout(cal.timeout);
 }
 var el = cal.activeDiv;
 if (!el) {
 return false;
 }
 var target = Calendar.getTargetElement(ev);
 ev || (ev = window.event);
 Calendar.removeClass(el, "active");
 if (target == el || target.parentNode == el) {
 Calendar.cellClick(el, ev);
 }
 var mon = Calendar.findMonth(target);
 var date = null;
 if (mon) {
 date = new CalendarDateObject(cal.date);
 if (mon.month != date.getMonth()) {
 date.setMonth(mon.month);
 cal.setDate(date);
 cal.dateClicked = false;
 cal.callHandler();
 }
 } else {
 var year = Calendar.findYear(target);
 if (year) {
 date = new CalendarDateObject(cal.date);
 if (year.year != date.getFullYear()) {
 date.setFullYear(year.year);
 cal.setDate(date);
 cal.dateClicked = false;
 cal.callHandler();
 }
 }
 }
 with (Calendar) {
 removeEvent(document, "mouseup", tableMouseUp);
 removeEvent(document, "mouseover", tableMouseOver);
 removeEvent(document, "mousemove", tableMouseOver);
 cal._hideCombos();
 _C = null;
 return stopEvent(ev);
 }
};

Calendar.tableMouseOver = function (ev) {
 var cal = Calendar._C;
 if (!cal) {
 return;
 }
 var el = cal.activeDiv;
 var target = Calendar.getTargetElement(ev);
 if (target == el || target.parentNode == el) {
 Calendar.addClass(el, "hilite active");
 Calendar.addClass(el.parentNode, "rowhilite");
 } else {
 if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
 Calendar.removeClass(el, "active");
 Calendar.removeClass(el, "hilite");
 Calendar.removeClass(el.parentNode, "rowhilite");
 }
 ev || (ev = window.event);
 if (el.navtype == 50 && target != el) {
 var pos = Calendar.getAbsolutePos(el);
 var w = el.offsetWidth;
 var x = ev.clientX;
 var dx;
 var decrease = true;
 if (x > pos.x + w) {
 dx = x - pos.x - w;
 decrease = false;
 } else
 dx = pos.x - x;

 if (dx < 0) dx = 0;
 var range = el._range;
 var current = el._current;
 var count = Math.floor(dx / 10) % range.length;
 for (var i = range.length; --i >= 0;)
 if (range[i] == current)
 break;
 while (count-- > 0)
 if (decrease) {
 if (--i < 0)
 i = range.length - 1;
 } else if ( ++i >= range.length )
 i = 0;
 var newval = range[i];
 el.innerHTML = newval;

 cal.onUpdateTime();
 }
 var mon = Calendar.findMonth(target);
 if (mon) {
 if (mon.month != cal.date.getMonth()) {
 if (cal.hilitedMonth) {
 Calendar.removeClass(cal.hilitedMonth, "hilite");
 }
 Calendar.addClass(mon, "hilite");
 cal.hilitedMonth = mon;
 } else if (cal.hilitedMonth) {
 Calendar.removeClass(cal.hilitedMonth, "hilite");
 }
 } else {
 if (cal.hilitedMonth) {
 Calendar.removeClass(cal.hilitedMonth, "hilite");
 }
 var year = Calendar.findYear(target);
 if (year) {
 if (year.year != cal.date.getFullYear()) {
 if (cal.hilitedYear) {
 Calendar.removeClass(cal.hilitedYear, "hilite");
 }
 Calendar.addClass(year, "hilite");
 cal.hilitedYear = year;
 } else if (cal.hilitedYear) {
 Calendar.removeClass(cal.hilitedYear, "hilite");
 }
 } else if (cal.hilitedYear) {
 Calendar.removeClass(cal.hilitedYear, "hilite");
 }
 }
 return Calendar.stopEvent(ev);
};

Calendar.tableMouseDown = function (ev) {
 if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
 return Calendar.stopEvent(ev);
 }
};

Calendar.calDragIt = function (ev) {
 var cal = Calendar._C;
 if (!(cal && cal.dragging)) {
 return false;
 }
 var posX;
 var posY;
 if (Calendar.is_ie) {
 posY = window.event.clientY + document.body.scrollTop;
 posX = window.event.clientX + document.body.scrollLeft;
 } else {
 posX = ev.pageX;
 posY = ev.pageY;
 }
 cal.hideShowCovered();
 var st = cal.element.style;
 st.left = (posX - cal.xOffs) + "px";
 st.top = (posY - cal.yOffs) + "px";
 return Calendar.stopEvent(ev);
};

Calendar.calDragEnd = function (ev) {
 var cal = Calendar._C;
 if (!cal) {
 return false;
 }
 cal.dragging = false;
 with (Calendar) {
 removeEvent(document, "mousemove", calDragIt);
 removeEvent(document, "mouseup", calDragEnd);
 tableMouseUp(ev);
 }
 cal.hideShowCovered();
};

Calendar.dayMouseDown = function(ev) {
 var el = Calendar.getElement(ev);
 if (el.disabled) {
 return false;
 }
 var cal = el.calendar;
 cal.activeDiv = el;
 Calendar._C = cal;
 if (el.navtype != 300) with (Calendar) {
 if (el.navtype == 50) {
 el._current = el.innerHTML;
 addEvent(document, "mousemove", tableMouseOver);
 } else
 addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
 addClass(el, "hilite active");
 addEvent(document, "mouseup", tableMouseUp);
 } else if (cal.isPopup) {
 cal._dragStart(ev);
 }
 if (el.navtype == -1 || el.navtype == 1) {
 if (cal.timeout) clearTimeout(cal.timeout);
 cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
 } else if (el.navtype == -2 || el.navtype == 2) {
 if (cal.timeout) clearTimeout(cal.timeout);
 cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
 } else {
 cal.timeout = null;
 }
 return Calendar.stopEvent(ev);
};

Calendar.dayMouseDblClick = function(ev) {
 Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
 if (Calendar.is_ie) {
 document.selection.empty();
 }
};

Calendar.dayMouseOver = function(ev) {
 var el = Calendar.getElement(ev);
 if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
 return false;
 }
 if (el.ttip) {
 if (el.ttip.substr(0, 1) == "_") {
 el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
 }
 el.calendar.tooltips.innerHTML = el.ttip;
 }
 if (el.navtype != 300) {
 Calendar.addClass(el, "hilite");
 if (el.caldate) {
 Calendar.addClass(el.parentNode, "rowhilite");
 }
 }
 return Calendar.stopEvent(ev);
};

Calendar.dayMouseOut = function(ev) {
 with (Calendar) {
 var el = getElement(ev);
 if (isRelated(el, ev) || _C || el.disabled)
 return false;
 removeClass(el, "hilite");
 if (el.caldate)
 removeClass(el.parentNode, "rowhilite");
 if (el.calendar)
 el.calendar.tooltips.innerHTML = _TT["SEL_DATE"];
 return stopEvent(ev);
 }
};

/**
 * A generic "click" handler :) handles all types of buttons defined in this
 * calendar.
 */
Calendar.cellClick = function(el, ev) {
 var cal = el.calendar;
 var closing = false;
 var newdate = false;
 var date = null;
 if (typeof el.navtype == "undefined") {
 if (cal.currentDateEl) {
 Calendar.removeClass(cal.currentDateEl, "selected");
 Calendar.addClass(el, "selected");
 closing = (cal.currentDateEl == el);
 if (!closing) {
 cal.currentDateEl = el;
 }
 }
 cal.date.setDateOnly(el.caldate);
 date = cal.date;
 var other_month = !(cal.dateClicked = !el.otherMonth);
 if (!other_month && !cal.currentDateEl)
 cal._toggleMultipleDate(new CalendarDateObject(date));
 else
 newdate = !el.disabled;
 // a date was clicked
 if (other_month)
 cal._init(cal.firstDayOfWeek, date);
 } else {
 if (el.navtype == 200) {
 Calendar.removeClass(el, "hilite");
 cal.callCloseHandler();
 return;
 }
 date = new CalendarDateObject(cal.date);
 if (el.navtype == 0)
 date.setDateOnly(new CalendarDateObject()); // TODAY
 // unless "today" was clicked, we assume no date was clicked so
 // the selected handler will know not to close the calenar when
 // in single-click mode.
 // cal.dateClicked = (el.navtype == 0);
 cal.dateClicked = false;
 var year = date.getFullYear();
 var mon = date.getMonth();
 function setMonth(m) {
 var day = date.getDate();
 var max = date.getMonthDays(m);
 if (day > max) {
 date.setDate(max);
 }
 date.setMonth(m);
 };
 switch (el.navtype) {
 case 400:
 Calendar.removeClass(el, "hilite");
 var text = Calendar._TT["ABOUT"];
 if (typeof text != "undefined") {
 text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
 } else {
 // FIXME: this should be removed as soon as lang files get updated!
 text = "Help and about box text is not translated into this language.\n" +
 "If you know this language and you feel generous please update\n" +
 "the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
 "and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)\n\n" +
 "Thank you!\n" +
 "http://dynarch.com/mishoo/calendar.epl\n";
 }
 alert(text);
 return;
 case -2:
 if (year > cal.minYear) {
 date.setFullYear(year - 1);
 }
 break;
 case -1:
 if (mon > 0) {
 setMonth(mon - 1);
 } else if (year-- > cal.minYear) {
 date.setFullYear(year);
 setMonth(11);
 }
 break;
 case 1:
 if (mon < 11) {
 setMonth(mon + 1);
 } else if (year < cal.maxYear) {
 date.setFullYear(year + 1);
 setMonth(0);
 }
 break;
 case 2:
 if (year < cal.maxYear) {
 date.setFullYear(year + 1);
 }
 break;
 case 100:
 cal.setFirstDayOfWeek(el.fdow);
 return;
 case 50:
 var range = el._range;
 var current = el.innerHTML;
 for (var i = range.length; --i >= 0;)
 if (range[i] == current)
 break;
 if (ev && ev.shiftKey) {
 if (--i < 0)
 i = range.length - 1;
 } else if ( ++i >= range.length )
 i = 0;
 var newval = range[i];
 el.innerHTML = newval;
 cal.onUpdateTime();
 return;
 case 0:
 // TODAY will bring us here
 if ((typeof cal.getDateStatus == "function") &&
 cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
 return false;
 }
 break;
 }
 if (!date.equalsTo(cal.date)) {
 cal.setDate(date);
 newdate = true;
 } else if (el.navtype == 0)
 newdate = closing = true;
 }
 if (newdate) {
 ev && cal.callHandler();
 }
 if (closing) {
 Calendar.removeClass(el, "hilite");
 ev && cal.callCloseHandler();
 }
};

// END: CALENDAR STATIC FUNCTIONS

// BEGIN: CALENDAR OBJECT FUNCTIONS

/**
 * This function creates the calendar inside the given parent. If _par is
 * null than it creates a popup calendar inside the BODY element. If _par is
 * an element, be it BODY, then it creates a non-popup calendar (still
 * hidden). Some properties need to be set before calling this function.
 */
Calendar.prototype.create = function (_par) {
 var parent = null;
 if (! _par) {
 // default parent is the document body, in which case we create
 // a popup calendar.
 parent = document.getElementsByTagName("body")[0];
 this.isPopup = true;
 } else {
 parent = _par;
 this.isPopup = false;
 }
 this.date = this.dateStr ? new CalendarDateObject(this.dateStr) : new CalendarDateObject();

 var table = Calendar.createElement("table");
 this.table = table;
 table.cellSpacing = 0;
 table.cellPadding = 0;
 table.calendar = this;
 Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);

 var div = Calendar.createElement("div");
 this.element = div;
 div.className = "calendar";
 if (this.isPopup) {
 div.style.position = "absolute";
 div.style.display = "none";
 }
 div.appendChild(table);

 var thead = Calendar.createElement("thead", table);
 var cell = null;
 var row = null;

 var cal = this;
 var hh = function (text, cs, navtype) {
 cell = Calendar.createElement("td", row);
 cell.colSpan = cs;
 cell.className = "button";
 if (navtype != 0 && Math.abs(navtype) <= 2)
 cell.className += " nav";
 Calendar._add_evs(cell);
 cell.calendar = cal;
 cell.navtype = navtype;
 cell.innerHTML = "<div unselectable='on'>" + text + "</div>";
 return cell;
 };

 row = Calendar.createElement("tr", thead);
 var title_length = 6;
 (this.isPopup) && --title_length;
 (this.weekNumbers) && ++title_length;

 hh("?", 1, 400).ttip = Calendar._TT["INFO"];
 this.title = hh("", title_length, 300);
 this.title.className = "title";
 if (this.isPopup) {
 this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
 this.title.style.cursor = "move";
 hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
 }

 row = Calendar.createElement("tr", thead);
 row.className = "headrow";

 this._nav_py = hh("&#x00ab;", 1, -2);
 this._nav_py.ttip = Calendar._TT["PREV_YEAR"];

 this._nav_pm = hh("&#x2039;", 1, -1);
 this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];

 this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
 this._nav_now.ttip = Calendar._TT["GO_TODAY"];

 this._nav_nm = hh("&#x203a;", 1, 1);
 this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];

 this._nav_ny = hh("&#x00bb;", 1, 2);
 this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];

 // day names
 row = Calendar.createElement("tr", thead);
 row.className = "daynames";
 if (this.weekNumbers) {
 cell = Calendar.createElement("td", row);
 cell.className = "name wn";
 cell.innerHTML = Calendar._TT["WK"];
 }
 for (var i = 7; i > 0; --i) {
 cell = Calendar.createElement("td", row);
 if (!i) {
 cell.navtype = 100;
 cell.calendar = this;
 Calendar._add_evs(cell);
 }
 }
 this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
 this._displayWeekdays();

 var tbody = Calendar.createElement("tbody", table);
 this.tbody = tbody;

 for (i = 6; i > 0; --i) {
 row = Calendar.createElement("tr", tbody);
 if (this.weekNumbers) {
 cell = Calendar.createElement("td", row);
 }
 for (var j = 7; j > 0; --j) {
 cell = Calendar.createElement("td", row);
 cell.calendar = this;
 Calendar._add_evs(cell);
 }
 }

 if (this.showsTime) {
 row = Calendar.createElement("tr", tbody);
 row.className = "time";

 cell = Calendar.createElement("td", row);
 cell.className = "time";
 cell.colSpan = 2;
 cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;";

 cell = Calendar.createElement("td", row);
 cell.className = "time";
 cell.colSpan = this.weekNumbers ? 4 : 3;

 (function(){
 function makeTimePart(className, init, range_start, range_end) {
 var part = Calendar.createElement("span", cell);
 part.className = className;
 part.innerHTML = init;
 part.calendar = cal;
 part.ttip = Calendar._TT["TIME_PART"];
 part.navtype = 50;
 part._range = [];
 if (typeof range_start != "number")
 part._range = range_start;
 else {
 for (var i = range_start; i <= range_end; ++i) {
 var txt;
 if (i < 10 && range_end >= 10) txt = '0' + i;
 else txt = '' + i;
 part._range[part._range.length] = txt;
 }
 }
 Calendar._add_evs(part);
 return part;
 };
 var hrs = cal.date.getHours();
 var mins = cal.date.getMinutes();
 var t12 = !cal.time24;
 var pm = (hrs > 12);
 if (t12 && pm) hrs -= 12;
 var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
 var span = Calendar.createElement("span", cell);
 span.innerHTML = ":";
 span.className = "colon";
 var M = makeTimePart("minute", mins, 0, 59);
 var AP = null;
 cell = Calendar.createElement("td", row);
 cell.className = "time";
 cell.colSpan = 2;
 if (t12)
 AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
 else
 cell.innerHTML = "&nbsp;";

 cal.onSetTime = function() {
 var pm, hrs = this.date.getHours(),
 mins = this.date.getMinutes();
 if (t12) {
 pm = (hrs >= 12);
 if (pm) hrs -= 12;
 if (hrs == 0) hrs = 12;
 AP.innerHTML = pm ? "pm" : "am";
 }
 H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs;
 M.innerHTML = (mins < 10) ? ("0" + mins) : mins;
 };

 cal.onUpdateTime = function() {
 var date = this.date;
 var h = parseInt(H.innerHTML, 10);
 if (t12) {
 if (/pm/i.test(AP.innerHTML) && h < 12)
 h += 12;
 else if (/am/i.test(AP.innerHTML) && h == 12)
 h = 0;
 }
 var d = date.getDate();
 var m = date.getMonth();
 var y = date.getFullYear();
 date.setHours(h);
 date.setMinutes(parseInt(M.innerHTML, 10));
 date.setFullYear(y);
 date.setMonth(m);
 date.setDate(d);
 this.dateClicked = false;
 this.callHandler();
 };
 })();
 } else {
 this.onSetTime = this.onUpdateTime = function() {};
 }

 var tfoot = Calendar.createElement("tfoot", table);

 row = Calendar.createElement("tr", tfoot);
 row.className = "footrow";

 cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
 cell.className = "ttip";
 if (this.isPopup) {
 cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
 cell.style.cursor = "move";
 }
 this.tooltips = cell;

 div = Calendar.createElement("div", this.element);
 this.monthsCombo = div;
 div.className = "combo";
 for (i = 0; i < Calendar._MN.length; ++i) {
 var mn = Calendar.createElement("div");
 mn.className = Calendar.is_ie ? "label-IEfix" : "label";
 mn.month = i;
 mn.innerHTML = Calendar._SMN[i];
 div.appendChild(mn);
 }

 div = Calendar.createElement("div", this.element);
 this.yearsCombo = div;
 div.className = "combo";
 for (i = 12; i > 0; --i) {
 var yr = Calendar.createElement("div");
 yr.className = Calendar.is_ie ? "label-IEfix" : "label";
 div.appendChild(yr);
 }

 this._init(this.firstDayOfWeek, this.date);
 parent.appendChild(this.element);
};

/** keyboard navigation, only for popup calendars */
Calendar._keyEvent = function(ev) {
 var cal = window._dynarch_popupCalendar;
 if (!cal || cal.multiple)
 return false;
 (Calendar.is_ie) && (ev = window.event);
 var act = (Calendar.is_ie || ev.type == "keypress"),
 K = ev.keyCode;
 if (ev.ctrlKey) {
 switch (K) {
 case 37: // KEY left
 act && Calendar.cellClick(cal._nav_pm);
 break;
 case 38: // KEY up
 act && Calendar.cellClick(cal._nav_py);
 break;
 case 39: // KEY right
 act && Calendar.cellClick(cal._nav_nm);
 break;
 case 40: // KEY down
 act && Calendar.cellClick(cal._nav_ny);
 break;
 default:
 return false;
 }
 } else switch (K) {
 case 32: // KEY space (now)
 Calendar.cellClick(cal._nav_now);
 break;
 case 27: // KEY esc
 act && cal.callCloseHandler();
 break;
 case 37: // KEY left
 case 38: // KEY up
 case 39: // KEY right
 case 40: // KEY down
 if (act) {
 var prev, x, y, ne, el, step;
 prev = K == 37 || K == 38;
 step = (K == 37 || K == 39) ? 1 : 7;
 function setVars() {
 el = cal.currentDateEl;
 var p = el.pos;
 x = p & 15;
 y = p >> 4;
 ne = cal.ar_days[y][x];
 };setVars();
 function prevMonth() {
 var date = new CalendarDateObject(cal.date);
 date.setDate(date.getDate() - step);
 cal.setDate(date);
 };
 function nextMonth() {
 var date = new CalendarDateObject(cal.date);
 date.setDate(date.getDate() + step);
 cal.setDate(date);
 };
 while (1) {
 switch (K) {
 case 37: // KEY left
 if (--x >= 0)
 ne = cal.ar_days[y][x];
 else {
 x = 6;
 K = 38;
 continue;
 }
 break;
 case 38: // KEY up
 if (--y >= 0)
 ne = cal.ar_days[y][x];
 else {
 prevMonth();
 setVars();
 }
 break;
 case 39: // KEY right
 if (++x < 7)
 ne = cal.ar_days[y][x];
 else {
 x = 0;
 K = 40;
 continue;
 }
 break;
 case 40: // KEY down
 if (++y < cal.ar_days.length)
 ne = cal.ar_days[y][x];
 else {
 nextMonth();
 setVars();
 }
 break;
 }
 break;
 }
 if (ne) {
 if (!ne.disabled)
 Calendar.cellClick(ne);
 else if (prev)
 prevMonth();
 else
 nextMonth();
 }
 }
 break;
 case 13: // KEY enter
 if (act)
 Calendar.cellClick(cal.currentDateEl, ev);
 break;
 default:
 return false;
 }
 return Calendar.stopEvent(ev);
};

/**
 * (RE)Initializes the calendar to the given date and firstDayOfWeek
 */
Calendar.prototype._init = function (firstDayOfWeek, date) {
 var today = new CalendarDateObject(),
 TY = today.getFullYear(),
 TM = today.getMonth(),
 TD = today.getDate();
 this.table.style.visibility = "hidden";
 var year = date.getFullYear();
 if (year < this.minYear) {
 year = this.minYear;
 date.setFullYear(year);
 } else if (year > this.maxYear) {
 year = this.maxYear;
 date.setFullYear(year);
 }
 this.firstDayOfWeek = firstDayOfWeek;
 this.date = new CalendarDateObject(date);
 var month = date.getMonth();
 var mday = date.getDate();
 var no_days = date.getMonthDays();

 // calendar voodoo for computing the first day that would actually be
 // displayed in the calendar, even if it's from the previous month.
 // WARNING: this is magic. ;-)
 date.setDate(1);
 var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
 if (day1 < 0)
 day1 += 7;
 date.setDate(-day1);
 date.setDate(date.getDate() + 1);

 var row = this.tbody.firstChild;
 var MN = Calendar._SMN[month];
 var ar_days = this.ar_days = new Array();
 var weekend = Calendar._TT["WEEKEND"];
 var dates = this.multiple ? (this.datesCells = {}) : null;
 for (var i = 0; i < 6; ++i, row = row.nextSibling) {
 var cell = row.firstChild;
 if (this.weekNumbers) {
 cell.className = "day wn";
 cell.innerHTML = date.getWeekNumber();
 cell = cell.nextSibling;
 }
 row.className = "daysrow";
 var hasdays = false, iday, dpos = ar_days[i] = [];
 for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
 iday = date.getDate();
 var wday = date.getDay();
 cell.className = "day";
 cell.pos = i << 4 | j;
 dpos[j] = cell;
 var current_month = (date.getMonth() == month);
 if (!current_month) {
 if (this.showsOtherMonths) {
 cell.className += " othermonth";
 cell.otherMonth = true;
 } else {
 cell.className = "emptycell";
 cell.innerHTML = "&nbsp;";
 cell.disabled = true;
 continue;
 }
 } else {
 cell.otherMonth = false;
 hasdays = true;
 }
 cell.disabled = false;
 cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
 if (dates)
 dates[date.print("%Y%m%d")] = cell;
 if (this.getDateStatus) {
 var status = this.getDateStatus(date, year, month, iday);
 if (this.getDateToolTip) {
 var toolTip = this.getDateToolTip(date, year, month, iday);
 if (toolTip)
 cell.title = toolTip;
 }
 if (status === true) {
 cell.className += " disabled";
 cell.disabled = true;
 } else {
 if (/disabled/i.test(status))
 cell.disabled = true;
 cell.className += " " + status;
 }
 }
 if (!cell.disabled) {
 cell.caldate = new CalendarDateObject(date);
 cell.ttip = "_";
 if (!this.multiple && current_month
 && iday == mday && this.hiliteToday) {
 cell.className += " selected";
 this.currentDateEl = cell;
 }
 if (date.getFullYear() == TY &&
 date.getMonth() == TM &&
 iday == TD) {
 cell.className += " today";
 cell.ttip += Calendar._TT["PART_TODAY"];
 }
 if (weekend.indexOf(wday.toString()) != -1)
 cell.className += cell.otherMonth ? " oweekend" : " weekend";
 }
 }
 if (!(hasdays || this.showsOtherMonths))
 row.className = "emptyrow";
 }
 this.title.innerHTML = Calendar._MN[month] + ", " + year;
 this.onSetTime();
 this.table.style.visibility = "visible";
 this._initMultipleDates();
 // PROFILE
 // this.tooltips.innerHTML = "Generated in " + ((new CalendarDateObject()) - today) + " ms";
};

Calendar.prototype._initMultipleDates = function() {
 if (this.multiple) {
 for (var i in this.multiple) {
 var cell = this.datesCells[i];
 var d = this.multiple[i];
 if (!d)
 continue;
 if (cell)
 cell.className += " selected";
 }
 }
};

Calendar.prototype._toggleMultipleDate = function(date) {
 if (this.multiple) {
 var ds = date.print("%Y%m%d");
 var cell = this.datesCells[ds];
 if (cell) {
 var d = this.multiple[ds];
 if (!d) {
 Calendar.addClass(cell, "selected");
 this.multiple[ds] = date;
 } else {
 Calendar.removeClass(cell, "selected");
 delete this.multiple[ds];
 }
 }
 }
};

Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
 this.getDateToolTip = unaryFunction;
};

/**
 * Calls _init function above for going to a certain date (but only if the
 * date is different than the currently selected one).
 */
Calendar.prototype.setDate = function (date) {
 if (!date.equalsTo(this.date)) {
 this._init(this.firstDayOfWeek, date);
 }
};

/**
 * Refreshes the calendar. Useful if the "disabledHandler" function is
 * dynamic, meaning that the list of disabled date can change at runtime.
 * Just * call this function if you think that the list of disabled dates
 * should * change.
 */
Calendar.prototype.refresh = function () {
 this._init(this.firstDayOfWeek, this.date);
};

/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
 this._init(firstDayOfWeek, this.date);
 this._displayWeekdays();
};

/**
 * Allows customization of what dates are enabled. The "unaryFunction"
 * parameter must be a function object that receives the date (as a JS Date
 * object) and returns a boolean value. If the returned value is true then
 * the passed date will be marked as disabled.
 */
Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
 this.getDateStatus = unaryFunction;
};

/** Customization of allowed year range for the calendar. */
Calendar.prototype.setRange = function (a, z) {
 this.minYear = a;
 this.maxYear = z;
};

/** Calls the first user handler (selectedHandler). */
Calendar.prototype.callHandler = function () {
 if (this.onSelected) {
 this.onSelected(this, this.date.print(this.dateFormat));
 }
};

/** Calls the second user handler (closeHandler). */
Calendar.prototype.callCloseHandler = function () {
 if (this.onClose) {
 this.onClose(this);
 }
 this.hideShowCovered();
};

/** Removes the calendar object from the DOM tree and destroys it. */
Calendar.prototype.destroy = function () {
 var el = this.element.parentNode;
 el.removeChild(this.element);
 Calendar._C = null;
 window._dynarch_popupCalendar = null;
};

/**
 * Moves the calendar element to a different section in the DOM tree (changes
 * its parent).
 */
Calendar.prototype.reparent = function (new_parent) {
 var el = this.element;
 el.parentNode.removeChild(el);
 new_parent.appendChild(el);
};

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown. If the click was outside the open
// calendar this function closes it.
Calendar._checkCalendar = function(ev) {
 var calendar = window._dynarch_popupCalendar;
 if (!calendar) {
 return false;
 }
 var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
 for (; el != null && el != calendar.element; el = el.parentNode);
 if (el == null) {
 // calls closeHandler which should hide the calendar.
 window._dynarch_popupCalendar.callCloseHandler();
 return Calendar.stopEvent(ev);
 }
};

/** Shows the calendar. */
Calendar.prototype.show = function () {
 var rows = this.table.getElementsByTagName("tr");
 for (var i = rows.length; i > 0;) {
 var row = rows[--i];
 Calendar.removeClass(row, "rowhilite");
 var cells = row.getElementsByTagName("td");
 for (var j = cells.length; j > 0;) {
 var cell = cells[--j];
 Calendar.removeClass(cell, "hilite");
 Calendar.removeClass(cell, "active");
 }
 }
 this.element.style.display = "block";
 this.hidden = false;
 if (this.isPopup) {
 window._dynarch_popupCalendar = this;
 Calendar.addEvent(document, "keydown", Calendar._keyEvent);
 Calendar.addEvent(document, "keypress", Calendar._keyEvent);
 Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
 }
 this.hideShowCovered();
};

/**
 * Hides the calendar. Also removes any "hilite" from the class of any TD
 * element.
 */
Calendar.prototype.hide = function () {
 if (this.isPopup) {
 Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
 Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
 Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
 }
 this.element.style.display = "none";
 this.hidden = true;
 this.hideShowCovered();
};

/**
 * Shows the calendar at a given absolute position (beware that, depending on
 * the calendar element style -- position property -- this might be relative
 * to the parent's containing rectangle).
 */
Calendar.prototype.showAt = function (x, y) {
 var s = this.element.style;
 s.left = x + "px";
 s.top = y + "px";
 this.show();
};

/** Shows the calendar near a given element. */
Calendar.prototype.showAtElement = function (el, opts) {
 var self = this;
 var p = Calendar.getAbsolutePos(el);
 if (!opts || typeof opts != "string") {
 this.showAt(p.x, p.y + el.offsetHeight);
 return true;
 }
 function fixPosition(box) {
 if (box.x < 0)
 box.x = 0;
 if (box.y < 0)
 box.y = 0;
 var cp = document.createElement("div");
 var s = cp.style;
 s.position = "absolute";
 s.right = s.bottom = s.width = s.height = "0px";
 document.body.appendChild(cp);
 var br = Calendar.getAbsolutePos(cp);
 document.body.removeChild(cp);
 if (Calendar.is_ie) {
 br.y += document.body.scrollTop;
 br.x += document.body.scrollLeft;
 } else {
 br.y += window.scrollY;
 br.x += window.scrollX;
 }
 var tmp = box.x + box.width - br.x;
 if (tmp > 0) box.x -= tmp;
 tmp = box.y + box.height - br.y;
 if (tmp > 0) box.y -= tmp;
 };
 this.element.style.display = "block";
 Calendar.continuation_for_the_fucking_khtml_browser = function() {
 var w = self.element.offsetWidth;
 var h = self.element.offsetHeight;
 self.element.style.display = "none";
 var valign = opts.substr(0, 1);
 var halign = "l";
 if (opts.length > 1) {
 halign = opts.substr(1, 1);
 }
 // vertical alignment
 switch (valign) {
 case "T": p.y -= h; break;
 case "B": p.y += el.offsetHeight; break;
 case "C": p.y += (el.offsetHeight - h) / 2; break;
 case "t": p.y += el.offsetHeight - h; break;
 case "b": break; // already there
 }
 // horizontal alignment
 switch (halign) {
 case "L": p.x -= w; break;
 case "R": p.x += el.offsetWidth; break;
 case "C": p.x += (el.offsetWidth - w) / 2; break;
 case "l": p.x += el.offsetWidth - w; break;
 case "r": break; // already there
 }
 p.width = w;
 p.height = h + 40;
 self.monthsCombo.style.display = "none";
 fixPosition(p);
 self.showAt(p.x, p.y);
 };
 if (Calendar.is_khtml)
 setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
 else
 Calendar.continuation_for_the_fucking_khtml_browser();
};

/** Customizes the date format. */
Calendar.prototype.setDateFormat = function (str) {
 this.dateFormat = str;
};

/** Customizes the tooltip date format. */
Calendar.prototype.setTtDateFormat = function (str) {
 this.ttDateFormat = str;
};

/**
 * Tries to identify the date represented in a string. If successful it also
 * calls this.setDate which moves the calendar to the given date.
 */
Calendar.prototype.parseDate = function(str, fmt) {
 if (!fmt)
 fmt = this.dateFormat;
 this.setDate(Date.parseDate(str, fmt));
};

Calendar.prototype.hideShowCovered = function () {
 if (!Calendar.is_ie && !Calendar.is_opera)
 return;
 function getVisib(obj){
 var value = obj.style.visibility;
 if (!value) {
 if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
 if (!Calendar.is_khtml)
 value = document.defaultView.
 getComputedStyle(obj, "").getPropertyValue("visibility");
 else
 value = '';
 } else if (obj.currentStyle) { // IE
 value = obj.currentStyle.visibility;
 } else
 value = '';
 }
 return value;
 };

 var tags = new Array("applet", "iframe", "select");
 var el = this.element;

 var p = Calendar.getAbsolutePos(el);
 var EX1 = p.x;
 var EX2 = el.offsetWidth + EX1;
 var EY1 = p.y;
 var EY2 = el.offsetHeight + EY1;

 for (var k = tags.length; k > 0; ) {
 var ar = document.getElementsByTagName(tags[--k]);
 var cc = null;

 for (var i = ar.length; i > 0;) {
 cc = ar[--i];

 p = Calendar.getAbsolutePos(cc);
 var CX1 = p.x;
 var CX2 = cc.offsetWidth + CX1;
 var CY1 = p.y;
 var CY2 = cc.offsetHeight + CY1;

 if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
 if (!cc.__msh_save_visibility) {
 cc.__msh_save_visibility = getVisib(cc);
 }
 cc.style.visibility = cc.__msh_save_visibility;
 } else {
 if (!cc.__msh_save_visibility) {
 cc.__msh_save_visibility = getVisib(cc);
 }
 cc.style.visibility = "hidden";
 }
 }
 }
};

/** Internal function; it displays the bar with the names of the weekday. */
Calendar.prototype._displayWeekdays = function () {
 var fdow = this.firstDayOfWeek;
 var cell = this.firstdayname;
 var weekend = Calendar._TT["WEEKEND"];
 for (var i = 0; i < 7; ++i) {
 cell.className = "day name";
 var realday = (i + fdow) % 7;
 if (i) {
 cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
 cell.navtype = 100;
 cell.calendar = this;
 cell.fdow = realday;
 Calendar._add_evs(cell);
 }
 if (weekend.indexOf(realday.toString()) != -1) {
 Calendar.addClass(cell, "weekend");
 }
 cell.innerHTML = Calendar._SDN[(i + fdow) % 7];
 cell = cell.nextSibling;
 }
};

/** Internal function. Hides all combo boxes that might be displayed. */
Calendar.prototype._hideCombos = function () {
 this.monthsCombo.style.display = "none";
 this.yearsCombo.style.display = "none";
};

/** Internal function. Starts dragging the element. */
Calendar.prototype._dragStart = function (ev) {
 if (this.dragging) {
 return;
 }
 this.dragging = true;
 var posX;
 var posY;
 if (Calendar.is_ie) {
 posY = window.event.clientY + document.body.scrollTop;
 posX = window.event.clientX + document.body.scrollLeft;
 } else {
 posY = ev.clientY + window.scrollY;
 posX = ev.clientX + window.scrollX;
 }
 var st = this.element.style;
 this.xOffs = posX - parseInt(st.left);
 this.yOffs = posY - parseInt(st.top);
 with (Calendar) {
 addEvent(document, "mousemove", calDragIt);
 addEvent(document, "mouseup", calDragEnd);
 }
};

// BEGIN: DATE OBJECT PATCHES

/** Adds the number of days array to the Date object. */
Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

/** Constants used for time computations */
Date.SECOND = 1000 /* milliseconds */;
Date.MINUTE = 60 * Date.SECOND;
Date.HOUR = 60 * Date.MINUTE;
Date.DAY = 24 * Date.HOUR;
Date.WEEK = 7 * Date.DAY;

Date.parseDate = function(str, fmt) {
 var today = new CalendarDateObject();
 var y = 0;
 var m = -1;
 var d = 0;

 // translate date into en_US, because split() cannot parse non-latin stuff
 var a = str;
 var i;
 for (i = 0; i < Calendar._MN.length; i++) {
 a = a.replace(Calendar._MN[i], enUS.m.wide[i]);
 }
 for (i = 0; i < Calendar._SMN.length; i++) {
 a = a.replace(Calendar._SMN[i], enUS.m.abbr[i]);
 }
 a = a.replace(Calendar._am, 'am');
 a = a.replace(Calendar._am.toLowerCase(), 'am');
 a = a.replace(Calendar._pm, 'pm');
 a = a.replace(Calendar._pm.toLowerCase(), 'pm');

 a = a.split(/\W+/);

 var b = fmt.match(/%./g);
 var i = 0, j = 0;
 var hr = 0;
 var min = 0;
 for (i = 0; i < a.length; ++i) {
 if (!a[i])
 continue;
 switch (b[i]) {
 case "%d":
 case "%e":
 d = parseInt(a[i], 10);
 break;

 case "%m":
 m = parseInt(a[i], 10) - 1;
 break;

 case "%Y":
 case "%y":
 y = parseInt(a[i], 10);
 (y < 100) && (y += (y > 29) ? 1900 : 2000);
 break;

 case "%b":
 for (j = 0; j < 12; ++j) {
 if (enUS.m.abbr[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
 }
 break;

 case "%B":
 for (j = 0; j < 12; ++j) {
 if (enUS.m.wide[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
 }
 break;

 case "%H":
 case "%I":
 case "%k":
 case "%l":
 hr = parseInt(a[i], 10);
 break;

 case "%P":
 case "%p":
 if (/pm/i.test(a[i]) && hr < 12)
 hr += 12;
 else if (/am/i.test(a[i]) && hr >= 12)
 hr -= 12;
 break;

 case "%M":
 min = parseInt(a[i], 10);
 break;
 }
 }
 if (isNaN(y)) y = today.getFullYear();
 if (isNaN(m)) m = today.getMonth();
 if (isNaN(d)) d = today.getDate();
 if (isNaN(hr)) hr = today.getHours();
 if (isNaN(min)) min = today.getMinutes();
 if (y != 0 && m != -1 && d != 0)
 return new CalendarDateObject(y, m, d, hr, min, 0);
 y = 0; m = -1; d = 0;
 for (i = 0; i < a.length; ++i) {
 if (a[i].search(/[a-zA-Z]+/) != -1) {
 var t = -1;
 for (j = 0; j < 12; ++j) {
 if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
 }
 if (t != -1) {
 if (m != -1) {
 d = m+1;
 }
 m = t;
 }
 } else if (parseInt(a[i], 10) <= 12 && m == -1) {
 m = a[i]-1;
 } else if (parseInt(a[i], 10) > 31 && y == 0) {
 y = parseInt(a[i], 10);
 (y < 100) && (y += (y > 29) ? 1900 : 2000);
 } else if (d == 0) {
 d = a[i];
 }
 }
 if (y == 0)
 y = today.getFullYear();
 if (m != -1 && d != 0)
 return new CalendarDateObject(y, m, d, hr, min, 0);
 return today;
};

/** Returns the number of days in the current month */
Date.prototype.getMonthDays = function(month) {
 var year = this.getFullYear();
 if (typeof month == "undefined") {
 month = this.getMonth();
 }
 if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
 return 29;
 } else {
 return Date._MD[month];
 }
};

/** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function() {
 var now = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
 var then = new CalendarDateObject(this.getFullYear(), 0, 0, 0, 0, 0);
 var time = now - then;
 return Math.floor(time / Date.DAY);
};

/** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function() {
 var d = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
 var DoW = d.getDay();
 d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
 var ms = d.valueOf(); // GMT
 d.setMonth(0);
 d.setDate(4); // Thu in Week 1
 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
};

/** Checks date and time equality */
Date.prototype.equalsTo = function(date) {
 return ((this.getFullYear() == date.getFullYear()) &&
 (this.getMonth() == date.getMonth()) &&
 (this.getDate() == date.getDate()) &&
 (this.getHours() == date.getHours()) &&
 (this.getMinutes() == date.getMinutes()));
};

/** Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function(date) {
 var tmp = new CalendarDateObject(date);
 this.setDate(1);
 this.setFullYear(tmp.getFullYear());
 this.setMonth(tmp.getMonth());
 this.setDate(tmp.getDate());
};

/** Prints the date in a string according to the given format. */
Date.prototype.print = function (str) {
 var m = this.getMonth();
 var d = this.getDate();
 var y = this.getFullYear();
 var wn = this.getWeekNumber();
 var w = this.getDay();
 var s = {};
 var hr = this.getHours();
 var pm = (hr >= 12);
 var ir = (pm) ? (hr - 12) : hr;
 var dy = this.getDayOfYear();
 if (ir == 0)
 ir = 12;
 var min = this.getMinutes();
 var sec = this.getSeconds();
 s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
 s["%A"] = Calendar._DN[w]; // full weekday name
 s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
 s["%B"] = Calendar._MN[m]; // full month name
 // FIXME: %c : preferred date and time representation for the current locale
 s["%C"] = 1 + Math.floor(y / 100); // the century number
 s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
 s["%e"] = d; // the day of the month (range 1 to 31)
 // FIXME: %D : american date style: %m/%d/%y
 // FIXME: %E, %F, %G, %g, %h (man strftime)
 s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
 s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
 s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
 s["%k"] = hr; // hour, range 0 to 23 (24h format)
 s["%l"] = ir; // hour, range 1 to 12 (12h format)
 s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
 s["%n"] = "\n"; // a newline character
 s["%p"] = pm ? Calendar._pm.toUpperCase() : Calendar._am.toUpperCase();
 s["%P"] = pm ? Calendar._pm.toLowerCase() : Calendar._am.toLowerCase();
 // FIXME: %r : the time in am/pm notation %I:%M:%S %p
 // FIXME: %R : the time in 24-hour notation %H:%M
 s["%s"] = Math.floor(this.getTime() / 1000);
 s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
 s["%t"] = "\t"; // a tab character
 // FIXME: %T : the time in 24-hour notation (%H:%M:%S)
 s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
 s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON)
 s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
 // FIXME: %x : preferred date representation for the current locale without the time
 // FIXME: %X : preferred time representation for the current locale without the date
 s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
 s["%Y"] = y; // year with the century
 s["%%"] = "%"; // a literal '%' character

 var re = /%./g;
 if (!Calendar.is_ie5 && !Calendar.is_khtml)
 return str.replace(re, function (par) { return s[par] || par; });

 var a = str.match(re);
 for (var i = 0; i < a.length; i++) {
 var tmp = s[a[i]];
 if (tmp) {
 re = new RegExp(a[i], 'g');
 str = str.replace(re, tmp);
 }
 }

 return str;
};

Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
Date.prototype.setFullYear = function(y) {
 var d = new CalendarDateObject(this);
 d.__msh_oldSetFullYear(y);
 if (d.getMonth() != this.getMonth())
 this.setDate(28);
 this.__msh_oldSetFullYear(y);
};

CalendarDateObject.prototype = new Date();
CalendarDateObject.prototype.constructor = CalendarDateObject;
CalendarDateObject.prototype.parent = Date.prototype;
function CalendarDateObject() {
 var dateObj;
 if (arguments.length > 1) {
 dateObj = eval("new this.parent.constructor("+Array.prototype.slice.call(arguments).join(",")+");");
 } else if (arguments.length > 0) {
 dateObj = new this.parent.constructor(arguments[0]);
 } else {
 dateObj = new this.parent.constructor();
 if (typeof(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS) != "undefined") {
 dateObj.setTime(dateObj.getTime()+(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS - dateObj.getTimezoneOffset())*1000);
 }
 }
 return dateObj;
}

// END: DATE OBJECT PATCHES


// global object that remembers the calendar
window._dynarch_popupCalendar = null;

/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/
 * ---------------------------------------------------------------------------
 *
 * The DHTML Calendar
 *
 * Details and latest version at:
 * http://dynarch.com/mishoo/calendar.epl
 *
 * This script is distributed under the GNU Lesser General Public License.
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
 *
 * This file defines helper functions for setting up the calendar. They are
 * intended to help non-programmers get a working calendar on their site
 * quickly. This script should not be seen as part of the calendar. It just
 * shows you what one can do with the calendar, while in the same time
 * providing a quick and simple method for setting it up. If you need
 * exhaustive customization of the calendar creation process feel free to
 * modify this code to suit your needs (this is recommended and much better
 * than modifying calendar.js itself).
 */
 Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;};
/**
 * @author Ryan Johnson <http://syntacticx.com/>
 * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
 * @package LivePipe UI
 * @license MIT
 * @url http://livepipe.net/core
 * @require prototype.js
 */

if(typeof(Control) == 'undefined')
 Control = {};
 
var $proc = function(proc){
 return typeof(proc) == 'function' ? proc : function(){return proc};
};

var $value = function(value){
 return typeof(value) == 'function' ? value() : value;
};

Object.Event = {
 extend: function(object){
 object._objectEventSetup = function(event_name){
 this._observers = this._observers || {};
 this._observers[event_name] = this._observers[event_name] || [];
 };
 object.observe = function(event_name,observer){
 if(typeof(event_name) == 'string' && typeof(observer) != 'undefined'){
 this._objectEventSetup(event_name);
 if(!this._observers[event_name].include(observer))
 this._observers[event_name].push(observer);
 }else
 for(var e in event_name)
 this.observe(e,event_name[e]);
 };
 object.stopObserving = function(event_name,observer){
 this._objectEventSetup(event_name);
 if(event_name && observer)
 this._observers[event_name] = this._observers[event_name].without(observer);
 else if(event_name)
 this._observers[event_name] = [];
 else
 this._observers = {};
 };
 object.observeOnce = function(event_name,outer_observer){
 var inner_observer = function(){
 outer_observer.apply(this,arguments);
 this.stopObserving(event_name,inner_observer);
 }.bind(this);
 this._objectEventSetup(event_name);
 this._observers[event_name].push(inner_observer);
 };
 object.notify = function(event_name){
 this._objectEventSetup(event_name);
 var collected_return_values = [];
 var args = $A(arguments).slice(1);
 try{
 for(var i = 0; i < this._observers[event_name].length; ++i)
 collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
 }catch(e){
 if(e == $break)
 return false;
 else
 throw e;
 }
 return collected_return_values;
 };
 if(object.prototype){
 object.prototype._objectEventSetup = object._objectEventSetup;
 object.prototype.observe = object.observe;
 object.prototype.stopObserving = object.stopObserving;
 object.prototype.observeOnce = object.observeOnce;
 object.prototype.notify = function(event_name){
 if(object.notify){
 var args = $A(arguments).slice(1);
 args.unshift(this);
 args.unshift(event_name);
 object.notify.apply(object,args);
 }
 this._objectEventSetup(event_name);
 var args = $A(arguments).slice(1);
 var collected_return_values = [];
 try{
 if(this.options && this.options[event_name] && typeof(this.options[event_name]) == 'function')
 collected_return_values.push(this.options[event_name].apply(this,args) || null);
 for(var i = 0; i < this._observers[event_name].length; ++i)
 collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
 }catch(e){
 if(e == $break)
 return false;
 else
 throw e;
 }
 return collected_return_values;
 };
 }
 }
};

/* Begin Core Extensions */

//Element.observeOnce
Element.addMethods({
 observeOnce: function(element,event_name,outer_callback){
 var inner_callback = function(){
 outer_callback.apply(this,arguments);
 Element.stopObserving(element,event_name,inner_callback);
 };
 Element.observe(element,event_name,inner_callback);
 }
});

//mouseenter, mouseleave
//from http://dev.rubyonrails.org/attachment/ticket/8354/event_mouseenter_106rc1.patch
Object.extend(Event, (function() {
 var cache = Event.cache;

 function getEventID(element) {
 if (element._prototypeEventID) return element._prototypeEventID[0];
 arguments.callee.id = arguments.callee.id || 1;
 return element._prototypeEventID = [++arguments.callee.id];
 }

 function getDOMEventName(eventName) {
 if (eventName && eventName.include(':')) return "dataavailable";
 //begin extension
 if(!Prototype.Browser.IE){
 eventName = {
 mouseenter: 'mouseover',
 mouseleave: 'mouseout'
 }[eventName] || eventName;
 }
 //end extension
 return eventName;
 }

 function getCacheForID(id) {
 return cache[id] = cache[id] || { };
 }

 function getWrappersForEventName(id, eventName) {
 var c = getCacheForID(id);
 return c[eventName] = c[eventName] || [];
 }

 function createWrapper(element, eventName, handler) {
 var id = getEventID(element);
 var c = getWrappersForEventName(id, eventName);
 if (c.pluck("handler").include(handler)) return false;

 var wrapper = function(event) {
 if (!Event || !Event.extend ||
 (event.eventName && event.eventName != eventName))
 return false;

 Event.extend(event);
 handler.call(element, event);
 };
 
 //begin extension
 if(!(Prototype.Browser.IE) && ['mouseenter','mouseleave'].include(eventName)){
 wrapper = wrapper.wrap(function(proceed,event) { 
 var rel = event.relatedTarget;
 var cur = event.currentTarget; 
 if(rel && rel.nodeType == Node.TEXT_NODE)
 rel = rel.parentNode; 
 if(rel && rel != cur && !rel.descendantOf(cur)) 
 return proceed(event); 
 }); 
 }
 //end extension

 wrapper.handler = handler;
 c.push(wrapper);
 return wrapper;
 }

 function findWrapper(id, eventName, handler) {
 var c = getWrappersForEventName(id, eventName);
 return c.find(function(wrapper) { return wrapper.handler == handler });
 }

 function destroyWrapper(id, eventName, handler) {
 var c = getCacheForID(id);
 if (!c[eventName]) return false;
 c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
 }

 function destroyCache() {
 for (var id in cache)
 for (var eventName in cache[id])
 cache[id][eventName] = null;
 }

 if (window.attachEvent) {
 window.attachEvent("onunload", destroyCache);
 }

 return {
 observe: function(element, eventName, handler) {
 element = $(element);
 var name = getDOMEventName(eventName);

 var wrapper = createWrapper(element, eventName, handler);
 if (!wrapper) return element;

 if (element.addEventListener) {
 element.addEventListener(name, wrapper, false);
 } else {
 element.attachEvent("on" + name, wrapper);
 }

 return element;
 },

 stopObserving: function(element, eventName, handler) {
 element = $(element);
 var id = getEventID(element), name = getDOMEventName(eventName);

 if (!handler && eventName) {
 getWrappersForEventName(id, eventName).each(function(wrapper) {
 element.stopObserving(eventName, wrapper.handler);
 });
 return element;

 } else if (!eventName) {
 Object.keys(getCacheForID(id)).each(function(eventName) {
 element.stopObserving(eventName);
 });
 return element;
 }

 var wrapper = findWrapper(id, eventName, handler);
 if (!wrapper) return element;

 if (element.removeEventListener) {
 element.removeEventListener(name, wrapper, false);
 } else {
 element.detachEvent("on" + name, wrapper);
 }

 destroyWrapper(id, eventName, handler);

 return element;
 },

 fire: function(element, eventName, memo) {
 element = $(element);
 if (element == document && document.createEvent && !element.dispatchEvent)
 element = document.documentElement;

 var event;
 if (document.createEvent) {
 event = document.createEvent("HTMLEvents");
 event.initEvent("dataavailable", true, true);
 } else {
 event = document.createEventObject();
 event.eventType = "ondataavailable";
 }

 event.eventName = eventName;
 event.memo = memo || { };

 if (document.createEvent) {
 element.dispatchEvent(event);
 } else {
 element.fireEvent(event.eventType, event);
 }

 return Event.extend(event);
 }
 };
})());

Object.extend(Event, Event.Methods);

Element.addMethods({
 fire: Event.fire,
 observe: Event.observe,
 stopObserving: Event.stopObserving
});

Object.extend(document, {
 fire: Element.Methods.fire.methodize(),
 observe: Element.Methods.observe.methodize(),
 stopObserving: Element.Methods.stopObserving.methodize()
});

//mouse:wheel
(function(){
 function wheel(event){
 var delta;
 // normalize the delta
 if(event.wheelDelta) // IE & Opera
 delta = event.wheelDelta / 120;
 else if (event.detail) // W3C
 delta =- event.detail / 3;
 if(!delta)
 return;
 var custom_event = Event.element(event).fire('mouse:wheel',{
 delta: delta
 });
 if(custom_event.stopped){
 Event.stop(event);
 return false;
 }
 }
 document.observe('mousewheel',wheel);
 document.observe('DOMMouseScroll',wheel);
})();

/* End Core Extensions */

//from PrototypeUI
var IframeShim = Class.create({
 initialize: function() {
 this.element = new Element('iframe',{
 style: 'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',
 src: 'javascript:void(0);',
 frameborder: 0 
 });
 $(document.body).insert(this.element);
 },
 hide: function() {
 this.element.hide();
 return this;
 },
 show: function() {
 this.element.show();
 return this;
 },
 positionUnder: function(element) {
 var element = $(element);
 var offset = element.cumulativeOffset();
 var dimensions = element.getDimensions();
 this.element.setStyle({
 left: offset[0] + 'px',
 top: offset[1] + 'px',
 width: dimensions.width + 'px',
 height: dimensions.height + 'px',
 zIndex: element.getStyle('zIndex') - 1
 }).show();
 return this;
 },
 setBounds: function(bounds) {
 for(prop in bounds)
 bounds[prop] += 'px';
 this.element.setStyle(bounds);
 return this;
 },
 destroy: function() {
 if(this.element)
 this.element.remove();
 return this;
 }
});
/**
 * @author Ryan Johnson <http://syntacticx.com/>
 * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
 * @package LivePipe UI
 * @license MIT
 * @url http://livepipe.net/control/scrollbar
 * @require prototype.js, slider.js, livepipe.js
 */

if(typeof(Prototype) == "undefined")
 throw "Control.ScrollBar requires Prototype to be loaded.";
if(typeof(Control.Slider) == "undefined")
 throw "Control.ScrollBar requires Control.Slider to be loaded.";
if(typeof(Object.Event) == "undefined")
 throw "Control.ScrollBar requires Object.Event to be loaded.";

Control.ScrollBar = Class.create();
Control.ScrollBar.prototype = {
 initialize : function(container,track,handle,options){ 
 this.enabled = false;
 this.notificationTimeout = false;
 this.container = $(container);
 this.boundMouseWheelEvent = this.onMouseWheel.bindAsEventListener(this);
 this.boundResizeObserver = this.onWindowResize.bind(this);
 this.track = $(track);
 this.handle = $(handle);
 this.handle_middle = this.handle.getElementsBySelector('[class="scrollbar_handle_middle"]')[0];
 this.options = Object.extend({
 active_class_name: 'scrolling',
 apply_active_class_name_to: this.container,
 notification_timeout_length: 125,
 handle_minimum_width: 40,
 scroll_to_smoothing: 0.01,
 scroll_to_steps: 15,
 proportional: true,
 slider_options: {}
 },options || {});
 this.slider = new Control.Slider(this.handle,this.track,Object.extend({
 axis: 'horizontal',
 onSlide: this.onChange.bind(this),
 onChange: this.onChange.bind(this)
 },this.options.slider_options));
 this.recalculateLayout();
 Event.observe(window,'resize',this.boundResizeObserver);
 this.handle.observe('mousedown',function(){
 if(this.auto_sliding_executer)
 this.auto_sliding_executer.stop();
 }.bind(this));
 },
 
 destroy: function(){
 Event.stopObserving(window,'resize',this.boundResizeObserver);
 },
 
 enable: function(){
 this.enabled = true;
 this.container.observe('mouse:wheel',this.boundMouseWheelEvent);
 this.slider.setEnabled();
 this.track.show();
 if(this.options.active_class_name)
 $(this.options.apply_active_class_name_to).addClassName(this.options.active_class_name);
 this.notify('enabled');
 },
 
 disable: function(){
 this.enabled = false;
 this.container.stopObserving('mouse:wheel',this.boundMouseWheelEvent);
 this.slider.setDisabled();
 this.track.hide();
 if(this.options.active_class_name)
 $(this.options.apply_active_class_name_to).removeClassName(this.options.active_class_name);
 this.notify('disabled');
 this.reset();
 },
 
 reset: function(){
 this.slider.setValue(0);
 },
 
 recalculateLayout: function(){
 if(this.container.scrollWidth <= this.container.offsetWidth)
 this.disable();
 else{
 this.slider.trackLength = this.slider.maximumOffset() - this.slider.minimumOffset();
 if(this.options.proportional){
 this.handle.style.width = Math.max(this.container.offsetWidth * (this.container.offsetWidth / this.container.scrollWidth),this.options.handle_minimum_width) + 'px';
 this.slider.handleLength = this.handle.style.width.replace(/px/,'');
 this.handle_middle.style.width = (this.slider.handleLength - 36) + 'px';
 }
 this.enable();
 }
 },
 
 onWindowResize: function(){
 this.recalculateLayout();
 this.scrollBy(0);
 },
 
 onMouseWheel: function(event){
 if(this.auto_sliding_executer)
 this.auto_sliding_executer.stop();
 this.slider.setValueBy(-(event.memo.delta / 20)); //put in math to account for the window height
 event.stop();
 return false;
 },
 
 onChange: function(value){
 this.container.scrollLeft = Math.round(value / this.slider.maximum * (this.container.scrollWidth - this.container.offsetWidth));
 if(this.notification_timeout)
 window.clearTimeout(this.notificationTimeout);
 this.notificationTimeout = window.setTimeout(function(){
 this.notify('change',value);
 }.bind(this),this.options.notification_timeout_length);
 },
 
 getCurrentMaximumDelta: function(){
 return this.slider.maximum * (this.container.scrollWidth - this.container.offsetWidth);
 },
 
 getDeltaToElement: function(element){
 return this.slider.maximum * ((element.positionedOffset().top + (element.getWidth() / 2)) - (this.container.getWidth() / 2));
 },
 
 scrollTo: function(y,animate){
 var current_maximum_delta = this.getCurrentMaximumDelta();
 if(x == 'left')
 x = 0;
 else if(x == 'right')
 x = current_maximum_delta;
 else if(typeof(x) != "number")
 x = this.getDeltaToElement($(x));
 if(this.enabled){
 x = Math.max(0,Math.min(x,current_maximum_delta));
 if(this.auto_sliding_executer)
 this.auto_sliding_executer.stop();
 var target_value = x / current_maximum_delta;
 var original_slider_value = this.slider.value;
 var delta = (target_value - original_slider_value) * current_maximum_delta;
 if(animate){
 this.auto_sliding_executer = new PeriodicalExecuter(function(){
 if(Math.round(this.slider.value * 100) / 100 < Math.round(target_value * 100) / 100 || Math.round(this.slider.value * 100) / 100 > Math.round(target_value * 100) / 100){
 this.scrollBy(delta / this.options.scroll_to_steps);
 }else{
 this.auto_sliding_executer.stop();
 this.auto_sliding_executer = null;
 if(typeof(animate) == "function")
 animate();
 } 
 }.bind(this),this.options.scroll_to_smoothing);
 }else
 this.scrollBy(delta);
 }else if(typeof(animate) == "function")
 animate();
 },
 
 scrollBy: function(x){
 if(!this.enabled)
 return false;
 this.slider.setValueBy(x / this.getCurrentMaximumDelta());
 }
}
Object.Event.extend(Control.ScrollBar);
eval(function(p,a,c,k,e,r){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--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('q 1f=\'1S\';q W=54.55.2y();m(W.2q("2z")!=-1){1f=\'2z\'}U m(W.2q("1S")!=-1){1f=\'1S\'}U m(W.2q("43")!=-1){1f=\'43\'}U m(W.2q("9L")!=-1){1f=\'4o\'}q 44=1I 5O();v 3u$(1O){G C.7L(1O)};v 1H(F,5P){m(F.4p){q y=F.4p[5P];y=K(y)?y:\'1J\'}U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.72=\'2.3\';7.4v=P;7.1K=3u$(7S);7.1d=3u$(7T);7.X=3u$(7U);7.1l=3u$(7V);7.1D=0;7.17=17;m(!7.17["3O"]){7.17["3O"]=""}7.3i=0;7.2M=0;7.9M=0;7.9N=0;7.26=0;7.2m=0;7.2r=20;7.9O=20;7.3z=0;7.3P=0;7.3Q=\'\';7.28=1a;m(7.17["4w"]!=\'\'){7.28=C.1r(\'58\');7.28.B.T=\'1s\';7.28.B.1h=\'1t\';7.28.2X=\'7W\';7.28.B.1p=\'1L\';7.28.B.7X=\'4x\';7.28.2Y=7.17["4y"]+\'<br/><1m 1A="0" 4z="\'+7.17["4y"]+\'" 1T="\'+7.17["4w"]+\'"/>\';7.1K.1n(7.28)}7.9P=\'\';7.5T=P;44.3y(7);7.73=3h(7,"5U");7.74=3h(7,"4A")};25.29.7Y=v(){6W(1g.C,"4A",7.73);6W(7.1K,"4A",7.74);m(7.17["T"]=="4B"){3u$(7.1K.1O+"-7Z").2Z(7.X)}U{7.1K.2Z(7.X)}7.1K.2Z(7.1D)};25.29.5U=v(e){q r=6R(e);q x=r[\'x\'];q y=r[\'y\'];q 2B=0;q 2C=0;q 2n=7.1d;3j(2n&&2n.31!="81"&&2n.31!="82"){2B+=2n.5V;2C+=2n.5W;2n=2n.59}m(1f==\'1S\'){q r=5Q(7.1d);2C=r[\'M\'];2B=r[\'L\']}2C+=K(1H(7.1d,\'5a\'));2B+=K(1H(7.1d,\'76\'));m(1f!=\'1S\'||!(C.21&&\'3A\'==C.21.2y())){2C+=K(1H(7.1d,\'3B\'));2B+=K(1H(7.1d,\'5X\'))}m(x>K(2C+7.26)){7.4C();G P}m(x<K(2C)){7.4C();G P}m(y>K(2B+7.2m)){7.4C();G P}m(y<K(2B)){7.4C();G P}m(1f==\'1S\'){7.1K.B.1B=1}G V};25.29.5Y=v(e){4u(e);7.1K.B.5b=\'83\'};25.29.77=v(e){4u(e);7.1K.B.5b=\'78\'};25.29.4A=v(e){4u(e);1x(i=0;i<44.1c;i++){m(44[i]!=7){44[i].5U(e)}}m(7.17&&7.17["48"]==V){m(7.1K.B.5b!=\'83\'){G}}m(7.4v){G}m(!7.5U(e)){G}7.4v=V;q 1E=7.1d;q 2C=0;q 2B=0;m(1f==\'4o\'||1f==\'2z\'||1f==\'43\'){q 2n=1E;3j(2n.31!="81"&&2n.31!="82"){2B+=2n.5V;2C+=2n.5W;2n=2n.59}}U{q r=5Q(7.1d);2C=r[\'M\'];2B=r[\'L\']}2C+=K(1H(7.1d,\'5a\'));2B+=K(1H(7.1d,\'76\'));m(1f!=\'1S\'||!(C.21&&\'3A\'==C.21.2y())){2C+=K(1H(7.1d,\'3B\'));2B+=K(1H(7.1d,\'5X\'))}q r=6R(e);q x=r[\'x\'];q y=r[\'y\'];7.3z=x-2C;7.3P=y-2B;m((7.3z+7.2r/2)>=7.26){7.3z=7.26-7.2r/2}m((7.3P+7.2D/2)>=7.2m){7.3P=7.2m-7.2D/2}m((7.3z-7.2r/2)<=0){7.3z=7.2r/2}m((7.3P-7.2D/2)<=0){7.3P=7.2D/2}2N(3h(7,"79"),10)};25.29.79=v(){q 5c=7.3z-7.2r/2;q 5d=7.3P-7.2D/2;q 5e=5c*(7.3i/7.26);q 5Z=5d*(7.2M/7.2m);m(C.1P.9Q==\'9R\'){5e=(7.3z+7.2r/2-7.26)*(7.3i/7.26)}5c+=K(1H(7.1d,\'5a\'));5d+=K(1H(7.1d,\'76\'));m(1f!=\'1S\'||!(C.21&&\'3A\'==C.21.2y())){5c+=K(1H(7.1d,\'3B\'));5d+=K(1H(7.1d,\'5X\'))}7.1D.B.M=5c+\'1u\';7.1D.B.L=5d+\'1u\';7.1D.B.1h="2a";m((7.3i+89-5e)<K(7.X.B.H)){5e=7.3i-K(7.X.B.H)+89}q 5f=0;m(7.17&&7.17["3O"]!=""){q 5f=19}m(7.2M+80>(K(7.X.B.N)-5f)){m((7.2M+80-5Z)<(K(7.X.B.N)-5f)){5Z=7.2M-K(7.X.B.N)+5f+80}}7.1l.B.M=(-5e)+\'1u\';7.1l.B.L=(-5Z)+\'1u\';7.X.B.L=7.3Q;7.X.B.1p=\'1L\';7.X.B.1h=\'2a\';7.1l.B.1p=\'1L\';7.1l.B.1h=\'2a\';7.4v=P};v 60(4D){q 4E="";1x(i=0;i<4D.1c;i++){4E+=49.84(14^4D.85(i))}G 4E};25.29.4C=v(){m(7.17&&7.17["4F"]==V)G;m(7.1D){7.1D.B.1h="1t"}7.X.B.L=\'-4G\';m(1f==\'1S\'){7.1K.B.1B=0}};25.29.7a=v(){7.2r=K(7.X.B.H)/(7.3i/7.26)-30;m(7.17&&7.17["3O"]!=""){7.2D=(K(7.X.B.N)-19)/(7.2M/7.2m)-23}U{7.2D=K(7.X.B.N)/(7.2M/7.2m)-23}m(7.2r>7.26){7.2r=7.26}m(7.2D>7.2m){7.2D=7.2m}7.2r=1j.2g(7.2r);7.2D=1j.2g(7.2D);m(!(C.21&&\'3A\'==C.21.2y())){q bw=K(1H(7.1D,\'5a\'));7.1D.B.H=((7.2r-2*bw))+\'1u\';7.1D.B.N=(7.2D-2*bw)+\'1u\'}U{7.1D.B.H=(7.2r)+\'1u\';7.1D.B.N=7.2D+\'1u\'}};25.29.86=v(){7.1D=C.1r("58");7.1D.2X=\'9S\';7.1D.B.1B=10;7.1D.B.1h=\'1t\';7.1D.B.T=\'1s\';7.1D.B["16"]=4a(7.17[\'16\']/2h.0);7.1D.B["-9T-16"]=4a(7.17[\'16\']/2h.0);7.1D.B["-87-16"]=4a(7.17[\'16\']/2h.0);7.1D.B["4H"]="88(9U="+7.17[\'16\']+")";7.1K.1n(7.1D);7.7a();7.1K.9V="4s";7.1K.B.9W="2s";7.1K.9X=6S;7.1K.9Y=6S};25.29.8a=v(){q 8b=7.1l.1T;m(7.2M<K(7.X.B.N)){7.X.B.N=7.2M+\'1u\';m(7.17&&7.17["3O"]!=""){7.X.B.N=(19+7.2M)+\'1u\'}}m(7.3i<K(7.X.B.H)){7.X.B.H=7.3i+\'1u\'}3j(7.X.2E){7.X.2Z(7.X.2E)}m(1f==\'1S\'){q f=C.1r("9Z");f.B.M=\'1J\';f.B.L=\'1J\';f.B.T=\'1s\';f.1T="7b:\'\'";f.B.4H=\'8c:8d.8e.a0(B=0,16=0)\';f.B.H=7.X.B.H;f.B.N=7.X.B.N;f.a1=0;7.X.1n(f)}m(7.17&&7.17["3O"]!=""){q f=C.1r("58");f.2X=\'61\';f.1O=\'61\'+7.X.1O;f.B.T=\'1U\';f.B.1B=10;f.B.M=\'1J\';f.B.L=\'1J\';f.B.2i=\'a2\';f.2Y=7.17["3O"];7.X.1n(f)}q 62=C.1r("58");62.B.3R="1t";7.X.1n(62);7.1l=C.1r("3S");7.1l.1T=8b;7.1l.B.T=\'1U\';7.1l.B.8f=\'1J\';7.1l.B.2i=\'1J\';7.1l.B.M=\'1J\';7.1l.B.L=\'1J\';62.1n(7.1l);m(\'1M\'!==4I(2t)){q 4J=60(2t[0]);q f=C.1r("3C");f.B.63=2t[1];f.B.a3=2t[2]+\'1u\';f.B.a4=2t[3];f.B.a5=\'8g\';f.B.T=\'1s\';f.B.H=2t[5];f.B.7X=2t[4];f.2Y=4J;f.B.M=\'1J\';f.B.L=K(7.X.B.N)-2t[6]+\'1u\';7.X.1n(f)}};25.29.4K=v(){m(7.28!=1a&&(!7.1l.64||0==7.1l.H||0==7.1l.N)&&7.1d.H!=0&&7.1d.N!=0){7.28.B.M=(K(7.1d.H)/2-K(7.28.65)/2)+\'1u\';7.28.B.L=(K(7.1d.N)/2-K(7.28.66)/2)+\'1u\';7.28.B.1h=\'2a\'}m(1f==\'43\'){m(!7.5T){3g(7.1l,"4b",3h(7,"4K"));7.5T=V;G}}U{m(!7.1l.64||!7.1d.64){2N(3h(7,"4K"),2h);G}}7.1l.B.8f=\'1J\';7.1l.B.2i=\'1J\';7.3i=7.1l.H;7.2M=7.1l.N;7.26=7.1d.H;7.2m=7.1d.N;m(7.3i==0||7.2M==0||7.26==0||7.2m==0){2N(3h(7,"4K"),2h);G}m(1f==\'2z\'||(1f==\'1S\'&&!(C.21&&\'3A\'==C.21.2y()))){7.26-=K(1H(7.1d,\'3B\'));7.26-=K(1H(7.1d,\'4L\'));7.2m-=K(1H(7.1d,\'5X\'));7.2m-=K(1H(7.1d,\'a6\'))}m(7.28!=1a)7.28.B.1h=\'1t\';7.1K.B.H=7.1d.H+\'1u\';7.X.B.L=\'-4G\';7.3Q=\'1J\';q r=5Q(7.1d);m(!r){7.X.B.M=7.26+K(1H(7.1d,\'5a\'))+K(1H(7.1d,\'a7\'))+K(1H(7.1d,\'3B\'))+K(1H(7.1d,\'4L\'))+15+\'1u\'}U{7.X.B.M=(r[\'1b\']-r[\'M\']+15)+\'1u\'}5g(7.17[\'T\']){1y\'M\':7.X.B.M=\'-\'+(15+K(7.X.B.H))+\'1u\';1w;1y\'1q\':m(r){7.3Q=r[\'1q\']-r[\'L\']+15+\'1u\'}U{7.3Q=7.1d.N+15+\'1u\'}7.X.B.M=\'1J\';1w;1y\'L\':7.3Q=\'-\'+(15+K(7.X.B.N))+\'1u\';7.X.B.M=\'1J\';1w;1y\'4B\':7.X.B.M=\'1J\';7.3Q=\'1J\';1w;1y\'67\':7.X.B.M=\'1J\';7.3Q=\'1J\';m(7.17[\'5h\']==-1){7.X.B.H=7.26+\'1u\'}m(7.17[\'5i\']==-1){7.X.B.N=7.2m+\'1u\'}1w}m(7.1D){7.7a();G}7.8a();7.86();3g(1g.C,"4A",7.73);3g(7.1K,"4A",7.74);m(7.17&&7.17["48"]==V){3g(7.1K,"5Y",3h(7,"5Y"));3g(7.1K,"77",3h(7,"77"))}m(7.17&&(7.17["48"]==V||7.17["4F"]==V)){7.3z=7.26/2;7.3P=7.2m/2;7.79()}};25.29.7c=v(4c,e){m(4c.3T==7.1l.1T)G;q 5j=C.1r("3S");5j.1O=7.1l.1O;5j.1T=4c.3T;q p=7.1l.8h;p.a8(5j,7.1l);7.1l=5j;7.1l.B.T=\'1U\';7.1d.1T=4c.8i;m(4c.2O!=\'\'&&3u$(\'61\'+7.X.1O)){3u$(\'61\'+7.X.1O).2E.8j=4c.2O}7.5T=P;7.4K();7.1K.3T=4c.3T;3v{E.4M()}3w(e){}};v 8k(1O,1C){q Y=1g.C.36("A");1x(q i=0;i<Y.1c;i++){m(Y[i].3a==1O){3g(Y[i],"2P",v(13){m(1f!=\'1S\'){7.8l()}U{1g.5k()}4u(13);G P});3g(Y[i],1C.17[\'5l\'],3h(1C,"7c",Y[i]));Y[i].B.7d=\'0\';Y[i].68=6T;Y[i].68({1C:1C,a9:v(){7.1C.7c(1a,7)}});q 1m=C.1r("3S");1m.1T=Y[i].3T;1m.B.T=\'1s\';1m.B.M=\'-4G\';1m.B.L=\'-4G\';C.Z.1n(1m);1m=C.1r("3S");1m.1T=Y[i].8i;1m.B.T=\'1s\';1m.B.M=\'-4G\';1m.B.L=\'-4G\';C.Z.1n(1m)}}};v aa(){3j(44.1c>0){q 1C=44.5m();1C.7Y();69 1C}};v 8m(){q 4y=\'8n ab\';q 4w=\'\';q 4N=1g.C.36("3S");1x(q i=0;i<4N.1c;i++){m(/7W/.3k(4N[i].2X)){m(4N[i].4z!=\'\')4y=4N[i].4z;4w=4N[i].1T;1w}}q Y=1g.C.36("A");1x(q i=0;i<Y.1c;i++){m(/25/.3k(Y[i].2X)){3j(Y[i].2E){m(Y[i].2E.31!=\'3S\'){Y[i].2Z(Y[i].2E)}U{1w}}m(Y[i].2E.31!=\'3S\')ac"ad 25 ae!";q 4d=1j.2g(1j.af()*ag);Y[i].B.T="1U";Y[i].B.1p=\'1L\';Y[i].B.7d=\'0\';Y[i].B.ah=\'2s\';3g(Y[i],"2P",v(13){m(1f!=\'1S\'){7.8l()}4u(13);G P});m(Y[i].1O==\'\'){Y[i].1O="ai"+4d}m(1f==\'1S\'){Y[i].B.1B=0}q 1E=Y[i].2E;1E.1O="8o"+4d;q 2j=C.1r("58");2j.1O="bc"+4d;2u=1I 3U(/16(\\s+)?:(\\s+)?(\\d+)/i);1z=2u.3V(Y[i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G.6i:(C.1P.6i||2d.5s);2b=(2d.46)?2d.46:2G.2K;2c=(2d.45)?2d.45:2G.2L;m(5r<6h){4e=6h}U{4e=5r}m(5q<6g){4f=6g}U{4f=5q}G{4f:4f,4e:4e,H:k.1v.2Q?2G.7h:(C.1P.7h||2d.6e),N:k.1v.2Q?2G.6i:(k.1v.2z)?2d.5s:(2d.5s||C.1P.6i),2b:2b,2c:2c,aD:5q,aE:5r}},1i:{3b:v(F,13,2H){m(F===C&&\'8C\'==13){m(k.1v.6b){2H.aF(7);G}k.5t.3y(2H);m(k.5t.1c<=1){k.8D()}}F=k.$(F);m(F.6V){F.6V(13,2H,P)}U{F.5S("4s"+13,2H)}},3W:v(F,13,2H){F=k.$(F);m(F.6X){F.6X(13,2H,P)}U{F.7N("4s"+13,2H)}},2w:v(13){m(13.71){13.71()}U{13.6Z=V}m(13.70){13.70()}U{13.aG=P}},7i:v(F,7j,7k){F=k.$(F);m(F==C&&C.6j&&!F.8E)F=C.1P;q 13;m(C.6j){13=C.6j(7j);13.aH(7k,V,V)}U{13=C.aI();13.aJ=7j}m(C.6j){F.8E(13)}U{F.aK(\'4s\'+7k,13)}G 13}},49:{8F:v(s){G s.3E(/^\\s+|\\s+$/g,\'\')},6k:v(s){G s.3E(/-(\\D)/g,v(aL,8G){G 8G.aM()})}},u:{6l:v(F,4g){m(!(F=k.$(F))){G}G((\' \'+F.2X+\' \').2q(\' \'+4g+\' \')>-1)},3c:v(F,4g){m(!(F=k.$(F))){G}m(!k.u.6l(F,4g)){F.2X+=(F.2X?\' \':\'\')+4g}},6m:v(F,4g){m(!(F=k.$(F))){G}F.2X=k.49.8F(F.2X.3E(1I 3U(\'(^|\\\\s)\'+4g+\'(?:\\\\s|$)\'),\'$1\'))},1e:v(F,B){F=k.$(F);B=B==\'7l\'?\'8H\':k.49.6k(B);q 2v=F.B[B];m(!2v&&C.6Q){q 4q=C.6Q.6P(F,1a);2v=4q?4q[B]:1a}U m(!2v&&F.4p){2v=F.4p[B]}m(\'16\'==B)G 2v?4a(2v):1.0;m(/^(1A(8I|8J|8K|8L)aN)|((2i|5u)(8I|8J|8K|8L))$/.3k(B)){2v=K(2v)?2v:\'1J\'}G 2v==\'3F\'?1a:2v},O:v(F,2R){v 8M(s,n){m(\'aO\'===4I(n)&&!(\'1B\'===s||\'1C\'===s)){G\'1u\'}G\'\'}F=k.$(F);q 2S=F.B;1x(q s 5R 2R){3v{m(\'16\'===s){k.u.8N(F,2R[s]);6n}m(\'7l\'===s){2S[(\'1M\'===4I(2S.8O))?\'8H\':\'8O\']=2R[s];6n}2S[k.49.6k(s)]=2R[s]+8M(k.49.6k(s),2R[s])}3w(e){}}G F},8N:v(F,16){F=k.$(F);q 2S=F.B;16=4a(16);m(16==0){m(\'1t\'!=2S.1h)2S.1h=\'1t\'}U{m(16>1){16=4a(16/2h)}m(\'2a\'!=2S.1h)2S.1h=\'2a\'}m(!F.4p||!F.4p.aP){2S.1C=1}m(k.1v.2Q){2S.4H=(16==1)?\'\':\'88(16=\'+16*2h+\')\'}2S.16=16;G F},22:v(F){F=k.$(F);G{\'H\':F.65,\'N\':F.66}},8P:v(F){F=k.$(F);q p={x:0,y:0};3j(F&&!k.8y(F)){p.x+=F.2K;p.y+=F.2L;F=F.8h}G p},3d:v(F,1U){1U=1U||P;F=k.$(F);q s=k.u.8P(F);q l=0,t=0;aQ{l+=F.5W||0;t+=F.5V||0;F=F.59;m(1U){3j(F&&\'1U\'==F.B.T){F=F.59}}}3j(F);G{\'L\':t-s.y,\'M\':l-s.x}},3X:v(F,1U){q p=k.u.3d(F,1U);q s=k.u.22(F);G{\'L\':p.L,\'1q\':p.L+s.N,\'M\':p.M,\'1b\':p.M+s.H}},aS:v(F,c){F=k.$(F);m(F){F.2Y=c}}},2T:{5v:v(x){G x},6o:v(x){G-(1j.8Q(1j.8R*x)-1)/2},7m:v(p){G 1j.6p(p,2)},aT:v(p){G 1-k.2T.7m(1-p)},8S:v(p){G 1j.6p(p,3)},aU:v(p){G 1-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.2R[s],5y))}}7.J.8X(5z);k.u.O(7.F,5z)}};m(!5O.29.2q){k.2F(5O.29,{\'2q\':v(3I,6u){q 5o=7.1c;1x(q i=(6u<0)?1j.91(0,5o+6u):6u||0;i<5o;i++){m(7[i]===3I)G i}G-1}})}})();q E={72:\'1.5.b6\',3e:[],3f:[],1B:92,2l:P,6s:{2p:k.2T.7m,1B:92,2I:0.5,7r:P,4j:P,2U:\'4x\',2e:{\'L\':0,\'M\':0,\'1q\':0,\'1b\':0},4S:\'2P\',6v:0.5,6w:0,93:\'#b7\',7s:0.2,94:V,7t:P,4T:0.b8,5A:\'6x\',7u:V,4k:\'L 1b\',7v:[\'6y\',\'3J\',\'6z\'],95:V,96:\'8n...\',97:0.75,98:V,99:V},J:{},9a:{\'6y\':{1o:0,2O:\'b9\'},\'3J\':{1o:1,2O:\'ba\'},\'6z\':{1o:2,2O:\'bb\'}},4h:v(4M){4M=4M||P;7.J=k.2F(7.6s,7.J);q 1z=/(3F|4x|1s|1U)/i.3V(7.J.2U);5g(1z[1]){1y\'3F\':7.J.2U=\'3F\';1w;1y\'1s\':7.J.2U=\'1s\';1w;1y\'1U\':7.J.2U=\'1U\';1w;1y\'4x\':78:7.J.2U=\'4x\';1w}7.J.4S=/3l/i.3k(7.J.4S)?\'3l\':\'2P\';7.1B=7.J.1B;q as=C.36("a");q l=as.1c;q 9b=0;1x(q i=0;i<l;i++){m(k.u.6l(as[i],\'E\')){E.3e.3y(1I E.6A(as[i],1a,9b++,{9c:(7.J.bd||7.J.2I),9d:(7.J.be||7.J.2I),4T:7.J.4T,5A:7.J.5A,2p:7.J.2p,4j:7.J.4j,4S:7.J.4S,6v:7.J.6v,2U:7.J.2U,2e:7.J.2e}))}}m(!4M&&E.J.95){k.1i.3b(C,\'bf\',v(e){q t=E.3o();m(t!=1a&&1M!=t){q r=k.u.3X(t.I);m((e.3N>=r.M&&e.3N<=r.1b)&&(e.3M>=r.L&&e.3M<=r.1q)){k.1i.2w(e);G P}}})}},2w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e.9l||e.9m):V){w=1}1w;1y 37:1y 38:m((E.J.7t)?(e.9l||e.9m):V){w=-1}1w}m(1a!==w){m(E.3f.1c>0){k.1i.2w(e)}3v{q 3G=E.3o();q 3J=1a;m(0==w){3G.3Z(1a)}U m(-1==w){3J=E.7x(3G.1k,r)}U m(1==w){3J=E.7w(3G.1k,r)}m(1M!=3J){3G.3Z(1a,3J)}}3w(e){m(9n){9n.bi(e.bj)}}}},6C:v(F){m(k.1v.2z){k.u.O(F,{\'5b\':\'9o\'})}},9p:v(){m(E.2l&&\'2s\'!=k.u.1e(E.2l,\'1p\')){G}m(!E.2l){E.2l=C.1r(\'3C\');k.u.3c(E.2l,\'E-bk\');q R=k.5p();k.u.O(E.2l,{\'T\':\'1s\',\'1p\':\'1L\',\'L\':0,\'M\':0,\'z-1o\':(E.1B-1),\'H\':R.4f,\'N\':R.4e,\'4V-63\':E.J.93,\'16\':0});q 6D=C.1r(\'4W\');6D.1T=\'7b:"";\';k.u.O(6D,{\'H\':\'2h%\',\'N\':\'2h%\',\'1p\':\'1L\',\'4H\':\'9q()\',\'L\':0,\'bl\':0,\'T\':\'1s\',\'z-1o\':-1,\'1A\':\'2s\'});E.2l.1n(6D);C.Z.1n(E.2l);k.1i.3b(1g,\'bm\',v(){q R=k.5p();k.u.O(E.2l,{\'H\':R.H,\'N\':R.N});2N(v(){q R=k.5p();k.u.O(E.2l,{\'H\':R.4f,\'N\':R.4e})},1)})}1I k.3n(E.2l,{2I:E.J.7s,2p:k.2T.5v,4i:v(){k.u.O(E.2l,{\'1p\':\'1L\',\'16\':0})}}).3H({\'16\':[0,E.J.6w]})},9r:v(){1I k.3n(E.2l,{2I:E.J.7s,2p:k.2T.5v,3Y:v(){k.u.O(E.2l,{\'1p\':\'2s\'})}}).3H({\'16\':[E.J.6w,0]})}};E.6A=v(){7.4h.4t(7,1Z)};E.6A.29={4h:v(a,1k,2V,6t){7.J={};7.1F=a;7.1o=2V;7.1k=1k;7.2J=P;7.4X=P;7.5D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2H\':2H})},9u:v(){7.I=C.1r(\'1m\');7.2W(7.I,\'4b\',7.7A);7.5F=2N(k.2o(v(){7.I.1T=7.1F.3T},7),1)},bt:v(){7.1N=C.1r("3C");k.u.O(7.1N,{\'T\':\'1s\',\'L\':-3q,\'1h\':\'1t\',\'z-1o\':11});k.u.3c(7.1N,\'E-1N\');7.S.1n(7.1N);q bu=[];q 4Z=7.J.7v||E.J.7v;q 9w=4Z.1c;1x(q i=0;i<9w;i++){m(\'3J\'==4Z[i]&&E.9j(7.1k)===7){6n}m(\'6y\'==4Z[i]&&E.9i(7.1k)===7){6n}q 7B=E.9a[4Z[i]];q 1V=C.1r(\'a\');1V.2O=7B.2O;1V.3T=\'#\';1V.3a=4Z[i];k.u.O(1V,{\'7l\':\'M\',\'T\':\'1U\'});1V=7.1N.1n(1V);q w=-7B.1o*K(k.u.1e(1V,\'H\'));q h=K(k.u.1e(1V,\'N\'));q 3r=C.1r(\'6x\');k.u.O(3r,{\'M\':w,\'5b\':\'9o\'});1V.1n(3r);q 4l=C.1r(\'1m\');k.u.O(4l,{\'T\':\'1s\',\'L\':-bv});4l=C.Z.1n(4l);k.1i.3b(4l,\'4b\',k.2o(v(1m){k.1i.3W(1m,\'4b\',1Z.6r);k.u.O(7,{\'H\':1m.H,\'N\':1m.N});C.Z.2Z(1m)},3r,4l));4l.1T=k.u.1e(3r,\'4V-4m\').3E(/7C\\s*\\(\\s*\\"{0,1}([^\\"]*)\\"{0,1}\\s*\\)/i,\'$1\');m(k.1v.4O){q 6F=k.u.1e(3r,\'4V-4m\');6F=6F.3E(/7C\\s*\\(\\s*"(.*)"\\s*\\)/i,\'$1\');3r.B.1p=\'7D-1L\';k.u.O(3r,{\'z-1o\':1,\'T\':\'1U\'});3r.B.4H="8c:8d.8e.bx(1T=\'"+6F+"\', by=\'bz\')";3r.B.bA=\'2s\'}7.2W(1V,\'3l\',k.3m(v(e,w,h){k.u.O(7.2E,{\'M\':w,\'L\':h})},1V,w,-h));7.2W(1V,\'7E\',k.3m(v(e,w,h){k.u.O(7.2E,{\'M\':w,\'L\':0})},1V,w));7.2W(1V,\'2P\',k.3m(7.9x,7));m(\'6z\'==1V.3a&&/M/i.3k(7.J.4k||E.J.4k)&&7.1N.2E!==1V){1V=7.1N.9y(1V,7.1N.2E)}}m(k.1v.4O){7.51=C.1r(\'3C\');k.u.O(7.51,{\'T\':\'1s\',\'L\':-3q,\'z-1o\':4,\'H\':18,\'N\':18,\'4V-4m\':\'7C(\'+7.I.1T+\')\',\'1h\':\'2a\',\'1p\':\'1L\',\'4V-3p\':\'bB-3p\'});7.S.1n(7.51)}},9t:v(){v 60(4D){q 4E="";1x(i=0;i<4D.1c;i++){4E+=49.84(14^4D.85(i))}G 4E}v 6G(4J){q 9z=/\\[a([^\\]]+)\\](.*?)\\[\\/a\\]/bC;G 4J.3E(9z,"<a $1>$2</a>")}k.1i.3W(7.I,\'4b\',7.7A);7.S=C.1r("3C");k.u.O(7.S,{\'T\':\'1s\',\'1p\':\'1L\',\'1h\':\'1t\'});k.u.3c(7.S,\'E-bD\');C.Z.1n(7.S);7.1E=7.1F.36(\'1m\')[0];m(!7.1E){7.1E=C.1r(\'1m\');7.1E.1T=\'8j:4m/bE;bF,bG==\';k.u.O(7.1E,{\'H\':0,\'N\':0,\'16\':0});7.1F.1n(7.1E)}7.Q=C.1r(\'3C\');m(\'1m:4z\'==7.J.5A.2y()&&\'\'!=(7.1E.4z||\'\')){7.Q.2Y=6G(7.1E.4z);7.5D=V;k.u.O(7.Q,{\'T\':\'1s\',\'1p\':\'1L\',\'3R\':\'1t\',\'L\':-3q});k.u.3c(7.Q,\'E-Q\')}U m(\'1m:2O\'==7.J.5A.2y()&&\'\'!=(7.1E.2O||\'\')){7.Q.2Y=6G(7.1E.2O);7.5D=V;k.u.O(7.Q,{\'T\':\'1s\',\'1p\':\'1L\',\'3R\':\'1t\',\'L\':-3q});k.u.3c(7.Q,\'E-Q\')}U m(7.1F.36(\'6x\').1c){7.5D=V;7.Q.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.I.41=7.I.2f;7.7I();7.9D(R);m(7.4Y){k.u.O(7.4Y,{\'H\':7.I.3L*0.9,\'L\':7.I.41-20});k.u.O(7.S,{\'1p\':\'1L\'});k.u.O(7.4Y,{\'H\':\'90%\',\'L\':7.I.41-k.u.22(7.4Y).N-8})}}k.2F(7H,{\'H\':7.I.6I});q 7J=7.9C(R);q 9E={\'16\':[(7.J.4j)?0:1,1],\'L\':[7.I.5I,7J.L],\'M\':[7.I.5J,7J.M],\'H\':[7.I.6I,7.I.3L]};1I k.3n(7.I,{2I:7.J.9c,2p:7.J.2p,4i:k.2o(v(){7.6E(P);k.u.O(7.I,7H);m(!7.J.4j){k.u.O(7.1E,{\'1h\':\'1t\'})}q f=E.3o();m(1M!=f){7.1B=f.1B+1}k.u.O(7.I,{\'z-1o\':7.1B});7.4n=C.1r(\'3C\');k.u.O(7.4n,{\'1p\':\'1L\',\'T\':\'1s\',\'L\':0,\'M\':0,\'z-1o\':-1,\'3R\':\'1t\',\'1A\':\'2s\',\'H\':\'2h%\',\'N\':\'2h%\'});7.4W=C.1r(\'4W\');7.4W.1T=\'7b: "";\';k.u.O(7.4W,{\'H\':\'2h%\',\'N\':\'2h%\',\'1A\':\'2s\',\'1p\':\'1L\',\'T\':\'9F\',\'z-1o\':0,\'4H\':\'9q()\',\'1C\':1});7.4n.1n(7.4W);7.S.1n(7.4n)},7),3Y:k.2o(v(){k.u.3c(7.1F,\'E-2J\');k.u.3c(7.I,\'E-4m-2J\');q 1G=k.u.22(7.I);k.u.O(7.S,{\'M\':k.u.3d(7.I).M,\'L\':k.u.3d(7.I).L,\'H\':1G.H,\'1h\':\'2a\'});7.S.9y(7.I,7.S.2E);k.u.O(7.S,{\'1p\':\'1L\',\'z-1o\':7.1B});k.u.O(7.I,{\'T\':\'1U\',\'L\':0,\'M\':0,\'z-1o\':2});m(k.1v.2Q){k.u.O(7.4n,{\'H\':k.u.22(7.S).H,\'N\':k.u.22(7.S).N})}m(7.1N){q 5L=k.u.22(7.1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7.1N){k.u.O(7.1N,{\'M\':0})}},7),3Y:k.2o(v(){k.u.O(7.1E,{\'1h\':\'2a\'});k.u.O(7.I,{\'L\':-3q});k.u.6m(7.1F,\'E-2J\');k.u.O(7.1E,{\'1h\':\'2a\'});E.6C(7.1F);7.4X=P;7.2J=P;E.9h(7.1o);m(1M!=5M){E.4U(1a,5M.1o)}U m(E.2l){E.9r()}7.6E()},7)}).3H({\'16\':[1,7.J.4j?0:1],\'H\':[7.I.3L,7.I.6I],\'N\':[7.I.41,7.I.9B],\'L\':[1Q.L,7.I.5I],\'M\':[1Q.M,7.I.5J]})},7)}).3H({\'5u-L\':[0,-7.Q.2f||0]})},5k:v(t){t=t||0;q f=E.3o();m(1M!=f){7.1B=f.1B+1;k.u.O(7.S,{\'z-1o\':7.1B})}E.9f(7.1o);2N(v(){k.1i.3W(C,"6B",E.5C);k.1i.3b(C,"6B",E.5C)},t)},9H:v(){1I k.3n(7.Q,{2I:7.J.4T,2p:k.2T.6o,4i:k.2o(v(){k.u.O(7.Q,{\'5u-L\':-7.Q.2f});k.u.O(7.Q,{\'1h\':\'2a\',\'T\':\'9F\'})},7),3Y:k.2o(v(){m(k.1v.2Q){k.u.O(7.4n,{\'H\':k.u.22(7.S).H,\'N\':k.u.22(7.S).N})}},7)}).3H({\'5u-L\':[-7.Q.2f,0]})},6K:v(e,2k){m(e){k.1i.2w(e)}2k=2k||P;q 3s=k.u.3X(7.S);q 2G=(C.21&&\'3A\'!=C.21.2y())?C.1P:C.Z;q 52=e.3N+K((2d.46)?2d.46:2G.2K);q 53=e.3M+K((2d.45)?2d.45:2G.2L);q 3t=/3l/i.3k(e.9I);q 42=k.u.1e(7.1N,\'1h\');m((!3t||\'1t\'!=42)&&(52>3s.M&&52<3s.1b)&&(53>3s.L&&53<3s.1q)){G}m(3t&&\'1t\'!=42&&!2k){G}m(!3t&&\'1t\'==42){G}q 6O=(2k||3t)?[0,1]:[1,0];1I k.3n(7.1N,{2I:0.3,2p:k.2T.5v}).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!(\'1t\'!=42))&&(52>3s.M&&52<3s.1b)&&(53>3s.L&&53<3s.1q)){G}m(3t&&!(\'1t\'!=42)&&!2k){G}m(!3t&&\'1t\'!=42){G}q 6O=(2k||3t)?[1,0]:[0,1];1I k.3n(7.51,{2I:0.3,2p:k.2T.5v}).3H({\'16\':6O});G};3v{C.8r(\'8s\',P,V)}3w(e){}}k.1i.3b(C,\'8C\',v(){E.4h()});',62,737,'|||||||this|||||||||||||MagicTools||if||||var||||Element|function||||||style|document||MagicThumb|el|return|width|bigImg|options|parseInt|top|left|height|setStyle|false|caption|ps|cont|position|else|true||bigImageCont|aels|body||||event|||opacity|settings|||null|right|length|smallImage|getStyle|MagicZoom_ua|window|visibility|Event|Math|group|bigImage|img|appendChild|index|display|bottom|createElement|absolute|hidden|px|browser|break|for|case|matches|border|zIndex|zoom|pup|smallImg|anchor|imgSize|MagicZoom_getStyle|new|0px|smallImageCont|block|undefined|controlbar|id|documentElement|pos|items|msie|src|relative|cbA|destTop|destLeft|args|arguments||compatMode|getSize||sRect|MagicZoom|smallImageSizeX||loadingCont|prototype|visible|scrollX|scrollY|self|zoomPositionOffset|fullHeight|round|100|padding|bigCont|show|bgFader|smallImageSizeY|tag|bind|transition|indexOf|popupSizeX|none|gd56f7fsgd|re|val|stop|loader|toLowerCase|opera|obj|smallY|smallX|popupSizeY|firstChild|extend|ieBody|handler|duration|zoomed|scrollLeft|scrollTop|bigImageSizeY|setTimeout|title|click|ie|styles|elStyle|Transition|zoomPosition|idx|addEvent|className|innerHTML|removeChild||tagName|||||getElementsByTagName||||rel|add|addClass|getPosition|thumbs|activeIndexes|MagicZoom_addEventListener|MagicZoom_createMethodReference|bigImageSizeX|while|test|mouseover|bindAsEvent|Render|getFocused|repeat|9999|cbBgWrapper|rect|ov|MagicZoom_|try|catch|result|push|positionX|backcompat|paddingLeft|div|arr|replace|auto|ft|start|item|next|getItem|displayWidth|clientY|clientX|header|positionY|bigImageContStyleTop|overflow|IMG|href|RegExp|exec|remove|getRect|onComplete|collapse||displayHeight|vis|safari|MagicZoom_zooms|pageYOffset|pageXOffset|object|drag_mode|String|parseFloat|load|ael|rand|pageHeight|pageWidth|klass|init|onStart|keepThumbnail|controlbarPosition|bgIMG|image|overlap|gecko|currentStyle|css|listener|on|apply|MagicZoom_stopEventPropagation|recalculating|loadingImg|center|loadingText|alt|mousemove|custom|hiderect|vc67|vc68|bigImage_always_visible|10000px|filter|typeof|str|initZoom|paddingRight|refresh|iels|ie6|now|onDomReadyTimer|onDomReady|zoomTrigger|captionSlideDuration|expand|background|iframe|rendering|cr|buttons||cbOverlay|eX|eY|navigator|userAgent|wx|wy|DIV|offsetParent|borderLeftWidth|cursor|pleft|ptop|perX|headerH|switch|zoomWidth|zoomHeight|newBigImage|focus|thumb_change|pop|inArray|len|getPageSize|xScroll|yScroll|innerHeight|onDomReadyList|margin|linear|timer|1000|dx|to_css|captionSrc|getGroupItems|onKey|hasCaption|eventsCache|initTimer|size|sd|initTop|initLeft|ratio|cbSize|nextThumb|hide|Array|styleProp|MagicZoom_getBounds|in|attachEvent|safariOnLoadStarted|checkcoords|offsetTop|offsetLeft|paddingTop|mousedown|perY|xgdf7fsgd56|MagicZoomHeader|ar1|color|complete|offsetWidth|offsetHeight|inner|mzextend|delete|backCompatMode|domLoaded|__method|shift|innerWidth|scrollWidth|windowWidth|windowHeight|clientHeight|createEvent|camelize|hasClass|removeClass|continue|sin|pow|loaded|callee|defaults|opt|from|zoomTriggerDelay|backgroundFadingOpacity|span|prev|close|Item|keydown|fixCursor|frame|toggleMZ|bgURL|formatCaptionText|font|initWidth|completeWidth|toggleControlBar|hoverTimer|padW|padH|op|getComputedStyle|defaultView|MagicZoom_getEventBounds|MagicView_ia|MagicZoom_extendElement|property|addEventListener|MagicZoom_removeEventListener|removeEventListener|sequence|cancelBubble|preventDefault|stopPropagation|version|checkcoords_ref|mousemove_ref||borderTopWidth|mouseup|default|showrect|recalculatePopupDimensions|javascript|replaceZoom|outline|results|props|concat|clientWidth|fire|evType|evName|float|quadIn|clearTimeout|calc|startTime|render|allowMultipleImages|backgroundFadingDuration|useCtrlKey|controlbarEnable|controlbarButtons|getNext|getPrev|firstRun|preventClick|onImgLoad|cbBtn|url|inline|mouseout|lastChild|startPosition|startProps|resizeCaption|destPos|stopEvent|getElementById|getBoundingClientRect|detachEvent|MagicZoom_concat|MagicZoom_withoutFirst|skip|methodName|smallImageContId|smallImageId|bigImageContId|bigImageId|MagicZoomLoading|textAlign|stopZoom|big||BODY|HTML|move|fromCharCode|charCodeAt|initPopup|html|alpha||initBigContainer|bigimgsrc|progid|DXImageTransform|Microsoft|borderWidth|Tahoma|parentNode|rev|data|MagicZoom_findSelectors|blur|MagicZoom_findZooms|Loading|sim|436px|bim|execCommand|BackgroundImageCache|XMLHttpRequest|webkit|toArray|arglen|arrlen|isBody|scrollMaxX|scrollMaxY|scrollHeight|domready|bindDomReady|dispatchEvent|trim|m2|cssFloat|Top|Bottom|Left|Right|addpx|setOpacity|styleFloat|getScrolls|cos|PI|cubicIn|backIn|DOMContentLoaded|styleSheets|fps|onBeforeRender|finishTime|loop||max|1001|backgroundFadingColor|allowKeyboard|disableContextMenu|loadingMsg|loadingOpacity|fitToScreen|autoInit|cbButtons|thumbIndex|expandDuration|collapseDuration|destroy|setFocused|splice|unsetFocused|getFirst|getLast|code|ctrlKey|metaKey|console|pointer|fadeInBackground|mask|fadeOutBackground|align|prepare|preload|evt|cbLength|onCBClick|insertBefore|pat|fullWidth|initHeight|adjustPosition|resizeImage|effectProps|static|MouseEvents|toggleCaption|type|min|ceil|mozilla|layerImageSizeX|layerImageSizeY|popupSizey|baseuri|dir|rtl|MagicZoomPup|moz|Opacity|unselectable|MozUserSelect|onselectstart|oncontextmenu|IFRAME|Alpha|frameBorder|3px|fontSize|fontWeight|fontFamily|paddingBottom|borderRightWidth|replaceChild|selectThisZoom|MagicZoom_stopZooms|Zoom|throw|Invalid|invocation|random|1000000|textDecoration|sc|thumb|change|drag|mode|always|MagicZoomBigImageCont|ie7|ActiveXObject|AppleWebKit||Gecko|KHTML|mobilesafari|match|Apple|Mobile|Safari|string|Date|getTime|viewWidth|viewHeight|call|returnValue|initEvent|createEventObject|eventType|fireEvent|m1|toUpperCase|Width|number|hasLayout|do||update|quadOut|cubicOut|618|backOut|elastic|readyState|doScroll|disabled|duraton|state|curFrame|setInterval|clearInterval|04|000000|250|Previous|Next|Close||zoomDuration|restoreDuration|contextmenu|sort|keyCode|warn|description|bgfader|lef|resize|loading|vertical|middle|createTextNode||peventClick|createControlBar|icons|999||AlphaImageLoader|sizingMethod|crop|backgroundImage|no|ig|container|gif|base64|R0lGODlhAQABAIAAACqk1AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw|amp|lt|gt|line|completeHeight|weight|family|text|nodeType|collapseEvent|currentTarget|srcElement'.split('|'),0,{}))
