

// JavaScript Document
function addElement() {
	if(!document.getElementById("LoginDiv")){
		var newDiv = document.createElement('div');
		newDiv.setAttribute("id", "LoginDiv");
		newDiv.innerHTML = "<p>&nbsp;</p><form action=\"login.php\" method=\"post\" ><form id=\"form1\" name=\"form1\" method=\"post\" action=\"submitcomments.php?id=$mapid\">User Name:<input name=\"username\" type=\"text\" id=\"username\"><br/>&nbsp;&nbsp;Password:<input name=\"password\" type=\"password\" id=\"password\"><br /><input name=\"btnLogin\" type=\"submit\" id=\"btnLogin\" value=\"Login\"></form>";
		document.body.appendChild(newDiv);
	}
	//onsubmit=\"new Ajax.Updater('LoginDiv', 'login.php', {asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;\"
}
function ForumJump(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

/*  Prototype JavaScript framework, version 1.5.0
 *  (c) 2005-2007 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/

var Prototype = {
  Version: '1.5.0',
  BrowserFeatures: {
    XPath: !!document.evaluate
  },

  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
  emptyFunction: function() {},
  K: function(x) { return x }
}

var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

var Abstract = new Object();

Object.extend = function(destination, source) {
  for (var property in source) {
    destination[property] = source[property];
  }
  return destination;
}

Object.extend(Object, {
  inspect: function(object) {
    try {
      if (object === undefined) return 'undefined';
      if (object === null) return 'null';
      return object.inspect ? object.inspect() : object.toString();
    } catch (e) {
      if (e instanceof RangeError) return '...';
      throw e;
    }
  },

  keys: function(object) {
    var keys = [];
    for (var property in object)
      keys.push(property);
    return keys;
  },

  values: function(object) {
    var values = [];
    for (var property in object)
      values.push(object[property]);
    return values;
  },

  clone: function(object) {
    return Object.extend({}, object);
  }
});

Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}

Function.prototype.bindAsEventListener = function(object) {
  var __method = this, args = $A(arguments), object = args.shift();
  return function(event) {
    return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
  }
}

Object.extend(Number.prototype, {
  toColorPart: function() {
    var digits = this.toString(16);
    if (this < 16) return '0' + digits;
    return digits;
  },

  succ: function() {
    return this + 1;
  },

  times: function(iterator) {
    $R(0, this, true).each(iterator);
    return this;
  }
});

var Try = {
  these: function() {
    var returnValue;

    for (var i = 0, length = arguments.length; i < length; i++) {
      var lambda = arguments[i];
      try {
        returnValue = lambda();
        break;
      } catch (e) {}
    }

    return returnValue;
  }
}

/*--------------------------------------------------------------------------*/

var PeriodicalExecuter = Class.create();
PeriodicalExecuter.prototype = {
  initialize: function(callback, frequency) {
    this.callback = callback;
    this.frequency = frequency;
    this.currentlyExecuting = false;

    this.registerCallback();
  },

  registerCallback: function() {
    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  stop: function() {
    if (!this.timer) return;
    clearInterval(this.timer);
    this.timer = null;
  },

  onTimerEvent: function() {
    if (!this.currentlyExecuting) {
      try {
        this.currentlyExecuting = true;
        this.callback(this);
      } finally {
        this.currentlyExecuting = false;
      }
    }
  }
}
String.interpret = function(value){
  return value == null ? '' : String(value);
}

Object.extend(String.prototype, {
  gsub: function(pattern, replacement) {
    var result = '', source = this, match;
    replacement = arguments.callee.prepareReplacement(replacement);

    while (source.length > 0) {
      if (match = source.match(pattern)) {
        result += source.slice(0, match.index);
        result += String.interpret(replacement(match));
        source  = source.slice(match.index + match[0].length);
      } else {
        result += source, source = '';
      }
    }
    return result;
  },

  sub: function(pattern, replacement, count) {
    replacement = this.gsub.prepareReplacement(replacement);
    count = count === undefined ? 1 : count;

    return this.gsub(pattern, function(match) {
      if (--count < 0) return match[0];
      return replacement(match);
    });
  },

  scan: function(pattern, iterator) {
    this.gsub(pattern, iterator);
    return this;
  },

  truncate: function(length, truncation) {
    length = length || 30;
    truncation = truncation === undefined ? '...' : truncation;
    return this.length > length ?
      this.slice(0, length - truncation.length) + truncation : this;
  },

  strip: function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  },

  stripTags: function() {
    return this.replace(/<\/?[^>]+>/gi, '');
  },

  stripScripts: function() {
    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
  },

  extractScripts: function() {
    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
  },

  evalScripts: function() {
    return this.extractScripts().map(function(script) { return eval(script) });
  },

  escapeHTML: function() {
    var div = document.createElement('div');
    var text = document.createTextNode(this);
    div.appendChild(text);
    return div.innerHTML;
  },

  unescapeHTML: function() {
    var div = document.createElement('div');
    div.innerHTML = this.stripTags();
    return div.childNodes[0] ? (div.childNodes.length > 1 ?
      $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
      div.childNodes[0].nodeValue) : '';
  },

  toQueryParams: function(separator) {
    var match = this.strip().match(/([^?#]*)(#.*)?$/);
    if (!match) return {};

    return match[1].split(separator || '&').inject({}, function(hash, pair) {
      if ((pair = pair.split('='))[0]) {
        var name = decodeURIComponent(pair[0]);
        var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;

        if (hash[name] !== undefined) {
          if (hash[name].constructor != Array)
            hash[name] = [hash[name]];
          if (value) hash[name].push(value);
        }
        else hash[name] = value;
      }
      return hash;
    });
  },

  toArray: function() {
    return this.split('');
  },

  succ: function() {
    return this.slice(0, this.length - 1) +
      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
  },

  camelize: function() {
    var parts = this.split('-'), len = parts.length;
    if (len == 1) return parts[0];

    var camelized = this.charAt(0) == '-'
      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
      : parts[0];

    for (var i = 1; i < len; i++)
      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);

    return camelized;
  },

  capitalize: function(){
    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
  },

  underscore: function() {
    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
  },

  dasherize: function() {
    return this.gsub(/_/,'-');
  },

  inspect: function(useDoubleQuotes) {
    var escapedString = this.replace(/\\/g, '\\\\');
    if (useDoubleQuotes)
      return '"' + escapedString.replace(/"/g, '\\"') + '"';
    else
      return "'" + escapedString.replace(/'/g, '\\\'') + "'";
  }
});

String.prototype.gsub.prepareReplacement = function(replacement) {
  if (typeof replacement == 'function') return replacement;
  var template = new Template(replacement);
  return function(match) { return template.evaluate(match) };
}

String.prototype.parseQuery = String.prototype.toQueryParams;

var Template = Class.create();
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype = {
  initialize: function(template, pattern) {
    this.template = template.toString();
    this.pattern  = pattern || Template.Pattern;
  },

  evaluate: function(object) {
    return this.template.gsub(this.pattern, function(match) {
      var before = match[1];
      if (before == '\\') return match[2];
      return before + String.interpret(object[match[3]]);
    });
  }
}

var $break    = new Object();
var $continue = new Object();

var Enumerable = {
  each: function(iterator) {
    var index = 0;
    try {
      this._each(function(value) {
        try {
          iterator(value, index++);
        } catch (e) {
          if (e != $continue) throw e;
        }
      });
    } catch (e) {
      if (e != $break) throw e;
    }
    return this;
  },

  eachSlice: function(number, iterator) {
    var index = -number, slices = [], array = this.toArray();
    while ((index += number) < array.length)
      slices.push(array.slice(index, index+number));
    return slices.map(iterator);
  },

  all: function(iterator) {
    var result = true;
    this.each(function(value, index) {
      result = result && !!(iterator || Prototype.K)(value, index);
      if (!result) throw $break;
    });
    return result;
  },

  any: function(iterator) {
    var result = false;
    this.each(function(value, index) {
      if (result = !!(iterator || Prototype.K)(value, index))
        throw $break;
    });
    return result;
  },

  collect: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      results.push((iterator || Prototype.K)(value, index));
    });
    return results;
  },

  detect: function(iterator) {
    var result;
    this.each(function(value, index) {
      if (iterator(value, index)) {
        result = value;
        throw $break;
      }
    });
    return result;
  },

  findAll: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      if (iterator(value, index))
        results.push(value);
    });
    return results;
  },

  grep: function(pattern, iterator) {
    var results = [];
    this.each(function(value, index) {
      var stringValue = value.toString();
      if (stringValue.match(pattern))
        results.push((iterator || Prototype.K)(value, index));
    })
    return results;
  },

  include: function(object) {
    var found = false;
    this.each(function(value) {
      if (value == object) {
        found = true;
        throw $break;
      }
    });
    return found;
  },

  inGroupsOf: function(number, fillWith) {
    fillWith = fillWith === undefined ? null : fillWith;
    return this.eachSlice(number, function(slice) {
      while(slice.length < number) slice.push(fillWith);
      return slice;
    });
  },

  inject: function(memo, iterator) {
    this.each(function(value, index) {
      memo = iterator(memo, value, index);
    });
    return memo;
  },

  invoke: function(method) {
    var args = $A(arguments).slice(1);
    return this.map(function(value) {
      return value[method].apply(value, args);
    });
  },

  max: function(iterator) {
    var result;
    this.each(function(value, index) {
      value = (iterator || Prototype.K)(value, index);
      if (result == undefined || value >= result)
        result = value;
    });
    return result;
  },

  min: function(iterator) {
    var result;
    this.each(function(value, index) {
      value = (iterator || Prototype.K)(value, index);
      if (result == undefined || value < result)
        result = value;
    });
    return result;
  },

  partition: function(iterator) {
    var trues = [], falses = [];
    this.each(function(value, index) {
      ((iterator || Prototype.K)(value, index) ?
        trues : falses).push(value);
    });
    return [trues, falses];
  },

  pluck: function(property) {
    var results = [];
    this.each(function(value, index) {
      results.push(value[property]);
    });
    return results;
  },

  reject: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      if (!iterator(value, index))
        results.push(value);
    });
    return results;
  },

  sortBy: function(iterator) {
    return this.map(function(value, index) {
      return {value: value, criteria: iterator(value, index)};
    }).sort(function(left, right) {
      var a = left.criteria, b = right.criteria;
      return a < b ? -1 : a > b ? 1 : 0;
    }).pluck('value');
  },

  toArray: function() {
    return this.map();
  },

  zip: function() {
    var iterator = Prototype.K, args = $A(arguments);
    if (typeof args.last() == 'function')
      iterator = args.pop();

    var collections = [this].concat(args).map($A);
    return this.map(function(value, index) {
      return iterator(collections.pluck(index));
    });
  },

  size: function() {
    return this.toArray().length;
  },

  inspect: function() {
    return '#<Enumerable:' + this.toArray().inspect() + '>';
  }
}

Object.extend(Enumerable, {
  map:     Enumerable.collect,
  find:    Enumerable.detect,
  select:  Enumerable.findAll,
  member:  Enumerable.include,
  entries: Enumerable.toArray
});
var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0, length = iterable.length; i < length; i++)
      results.push(iterable[i]);
    return results;
  }
}

Object.extend(Array.prototype, Enumerable);

if (!Array.prototype._reverse)
  Array.prototype._reverse = Array.prototype.reverse;

Object.extend(Array.prototype, {
  _each: function(iterator) {
    for (var i = 0, length = this.length; i < length; i++)
      iterator(this[i]);
  },

  clear: function() {
    this.length = 0;
    return this;
  },

  first: function() {
    return this[0];
  },

  last: function() {
    return this[this.length - 1];
  },

  compact: function() {
    return this.select(function(value) {
      return value != null;
    });
  },

  flatten: function() {
    return this.inject([], function(array, value) {
      return array.concat(value && value.constructor == Array ?
        value.flatten() : [value]);
    });
  },

  without: function() {
    var values = $A(arguments);
    return this.select(function(value) {
      return !values.include(value);
    });
  },

  indexOf: function(object) {
    for (var i = 0, length = this.length; i < length; i++)
      if (this[i] == object) return i;
    return -1;
  },

  reverse: function(inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  },

  reduce: function() {
    return this.length > 1 ? this : this[0];
  },

  uniq: function() {
    return this.inject([], function(array, value) {
      return array.include(value) ? array : array.concat([value]);
    });
  },

  clone: function() {
    return [].concat(this);
  },

  size: function() {
    return this.length;
  },

  inspect: function() {
    return '[' + this.map(Object.inspect).join(', ') + ']';
  }
});

Array.prototype.toArray = Array.prototype.clone;

function $w(string){
  string = string.strip();
  return string ? string.split(/\s+/) : [];
}

if(window.opera){
  Array.prototype.concat = function(){
    var array = [];
    for(var i = 0, length = this.length; i < length; i++) array.push(this[i]);
    for(var i = 0, length = arguments.length; i < length; i++) {
      if(arguments[i].constructor == Array) {
        for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
          array.push(arguments[i][j]);
      } else {
        array.push(arguments[i]);
      }
    }
    return array;
  }
}
var Hash = function(obj) {
  Object.extend(this, obj || {});
};

Object.extend(Hash, {
  toQueryString: function(obj) {
    var parts = [];

	  this.prototype._each.call(obj, function(pair) {
      if (!pair.key) return;

      if (pair.value && pair.value.constructor == Array) {
        var values = pair.value.compact();
        if (values.length < 2) pair.value = values.reduce();
        else {
        	key = encodeURIComponent(pair.key);
          values.each(function(value) {
            value = value != undefined ? encodeURIComponent(value) : '';
            parts.push(key + '=' + encodeURIComponent(value));
          });
          return;
        }
      }
      if (pair.value == undefined) pair[1] = '';
      parts.push(pair.map(encodeURIComponent).join('='));
	  });

    return parts.join('&');
  }
});

Object.extend(Hash.prototype, Enumerable);
Object.extend(Hash.prototype, {
  _each: function(iterator) {
    for (var key in this) {
      var value = this[key];
      if (value && value == Hash.prototype[key]) continue;

      var pair = [key, value];
      pair.key = key;
      pair.value = value;
      iterator(pair);
    }
  },

  keys: function() {
    return this.pluck('key');
  },

  values: function() {
    return this.pluck('value');
  },

  merge: function(hash) {
    return $H(hash).inject(this, function(mergedHash, pair) {
      mergedHash[pair.key] = pair.value;
      return mergedHash;
    });
  },

  remove: function() {
    var result;
    for(var i = 0, length = arguments.length; i < length; i++) {
      var value = this[arguments[i]];
      if (value !== undefined){
        if (result === undefined) result = value;
        else {
          if (result.constructor != Array) result = [result];
          result.push(value)
        }
      }
      delete this[arguments[i]];
    }
    return result;
  },

  toQueryString: function() {
    return Hash.toQueryString(this);
  },

  inspect: function() {
    return '#<Hash:{' + this.map(function(pair) {
      return pair.map(Object.inspect).join(': ');
    }).join(', ') + '}>';
  }
});

function $H(object) {
  if (object && object.constructor == Hash) return object;
  return new Hash(object);
};
ObjectRange = Class.create();
Object.extend(ObjectRange.prototype, Enumerable);
Object.extend(ObjectRange.prototype, {
  initialize: function(start, end, exclusive) {
    this.start = start;
    this.end = end;
    this.exclusive = exclusive;
  },

  _each: function(iterator) {
    var value = this.start;
    while (this.include(value)) {
      iterator(value);
      value = value.succ();
    }
  },

  include: function(value) {
    if (value < this.start)
      return false;
    if (this.exclusive)
      return value < this.end;
    return value <= this.end;
  }
});

var $R = function(start, end, exclusive) {
  return new ObjectRange(start, end, exclusive);
}

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new XMLHttpRequest()},
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
    ) || false;
  },

  activeRequestCount: 0
}

Ajax.Responders = {
  responders: [],

  _each: function(iterator) {
    this.responders._each(iterator);
  },

  register: function(responder) {
    if (!this.include(responder))
      this.responders.push(responder);
  },

  unregister: function(responder) {
    this.responders = this.responders.without(responder);
  },

  dispatch: function(callback, request, transport, json) {
    this.each(function(responder) {
      if (typeof responder[callback] == 'function') {
        try {
          responder[callback].apply(responder, [request, transport, json]);
        } catch (e) {}
      }
    });
  }
};

Object.extend(Ajax.Responders, Enumerable);

Ajax.Responders.register({
  onCreate: function() {
    Ajax.activeRequestCount++;
  },
  onComplete: function() {
    Ajax.activeRequestCount--;
  }
});

Ajax.Base = function() {};
Ajax.Base.prototype = {
  setOptions: function(options) {
    this.options = {
      method:       'post',
      asynchronous: true,
      contentType:  'application/x-www-form-urlencoded',
      encoding:     'UTF-8',
      parameters:   ''
    }
    Object.extend(this.options, options || {});

    this.options.method = this.options.method.toLowerCase();
    if (typeof this.options.parameters == 'string')
      this.options.parameters = this.options.parameters.toQueryParams();
  }
}

Ajax.Request = Class.create();
Ajax.Request.Events =
  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];

Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
  _complete: false,

  initialize: function(url, options) {
    this.transport = Ajax.getTransport();
    this.setOptions(options);
    this.request(url);
  },

  request: function(url) {
    this.url = url;
    this.method = this.options.method;
    var params = this.options.parameters;

    if (!['get', 'post'].include(this.method)) {
      // simulate other verbs over post
      params['_method'] = this.method;
      this.method = 'post';
    }

    params = Hash.toQueryString(params);
    if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='

    // when GET, append parameters to URL
    if (this.method == 'get' && params)
      this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params;

    try {
      Ajax.Responders.dispatch('onCreate', this, this.transport);

      this.transport.open(this.method.toUpperCase(), this.url,
        this.options.asynchronous);

      if (this.options.asynchronous)
        setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);

      this.transport.onreadystatechange = this.onStateChange.bind(this);
      this.setRequestHeaders();

      var body = this.method == 'post' ? (this.options.postBody || params) : null;

      this.transport.send(body);

      /* Force Firefox to handle ready state 4 for synchronous requests */
      if (!this.options.asynchronous && this.transport.overrideMimeType)
        this.onStateChange();

    }
    catch (e) {
      this.dispatchException(e);
    }
  },

  onStateChange: function() {
    var readyState = this.transport.readyState;
    if (readyState > 1 && !((readyState == 4) && this._complete))
      this.respondToReadyState(this.transport.readyState);
  },

  setRequestHeaders: function() {
    var headers = {
      'X-Requested-With': 'XMLHttpRequest',
      'X-Prototype-Version': Prototype.Version,
      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    };

    if (this.method == 'post') {
      headers['Content-type'] = this.options.contentType +
        (this.options.encoding ? '; charset=' + this.options.encoding : '');

      /* Force "Connection: close" for older Mozilla browsers to work
       * around a bug where XMLHttpRequest sends an incorrect
       * Content-length header. See Mozilla Bugzilla #246651.
       */
      if (this.transport.overrideMimeType &&
          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
            headers['Connection'] = 'close';
    }

    // user-defined headers
    if (typeof this.options.requestHeaders == 'object') {
      var extras = this.options.requestHeaders;

      if (typeof extras.push == 'function')
        for (var i = 0, length = extras.length; i < length; i += 2)
          headers[extras[i]] = extras[i+1];
      else
        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
    }

    for (var name in headers)
      this.transport.setRequestHeader(name, headers[name]);
  },

  success: function() {
    return !this.transport.status
        || (this.transport.status >= 200 && this.transport.status < 300);
  },

  respondToReadyState: function(readyState) {
    var state = Ajax.Request.Events[readyState];
    var transport = this.transport, json = this.evalJSON();

    if (state == 'Complete') {
      try {
        this._complete = true;
        (this.options['on' + this.transport.status]
         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
         || Prototype.emptyFunction)(transport, json);
      } catch (e) {
        this.dispatchException(e);
      }

      if ((this.getHeader('Content-type') || 'text/javascript').strip().
        match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
          this.evalResponse();
    }

    try {
      (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
      Ajax.Responders.dispatch('on' + state, this, transport, json);
    } catch (e) {
      this.dispatchException(e);
    }

    if (state == 'Complete') {
      // avoid memory leak in MSIE: clean up
      this.transport.onreadystatechange = Prototype.emptyFunction;
    }
  },

  getHeader: function(name) {
    try {
      return this.transport.getResponseHeader(name);
    } catch (e) { return null }
  },

  evalJSON: function() {
    try {
      var json = this.getHeader('X-JSON');
      return json ? eval('(' + json + ')') : null;
    } catch (e) { return null }
  },

  evalResponse: function() {
    try {
      return eval(this.transport.responseText);
    } catch (e) {
      this.dispatchException(e);
    }
  },

  dispatchException: function(exception) {
    (this.options.onException || Prototype.emptyFunction)(this, exception);
    Ajax.Responders.dispatch('onException', this, exception);
  }
});

Ajax.Updater = Class.create();

Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
  initialize: function(container, url, options) {
    this.container = {
      success: (container.success || container),
      failure: (container.failure || (container.success ? null : container))
    }

    this.transport = Ajax.getTransport();
    this.setOptions(options);

    var onComplete = this.options.onComplete || Prototype.emptyFunction;
    this.options.onComplete = (function(transport, param) {
      this.updateContent();
      onComplete(transport, param);
    }).bind(this);

    this.request(url);
  },

  updateContent: function() {
    var receiver = this.container[this.success() ? 'success' : 'failure'];
    var response = this.transport.responseText;

    if (!this.options.evalScripts) response = response.stripScripts();

    if (receiver = $(receiver)) {
      if (this.options.insertion)
        new this.options.insertion(receiver, response);
      else
        receiver.update(response);
    }

    if (this.success()) {
      if (this.onComplete)
        setTimeout(this.onComplete.bind(this), 10);
    }
  }
});

Ajax.PeriodicalUpdater = Class.create();
Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
  initialize: function(container, url, options) {
    this.setOptions(options);
    this.onComplete = this.options.onComplete;

    this.frequency = (this.options.frequency || 2);
    this.decay = (this.options.decay || 1);

    this.updater = {};
    this.container = container;
    this.url = url;

    this.start();
  },

  start: function() {
    this.options.onComplete = this.updateComplete.bind(this);
    this.onTimerEvent();
  },

  stop: function() {
    this.updater.options.onComplete = undefined;
    clearTimeout(this.timer);
    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
  },

  updateComplete: function(request) {
    if (this.options.decay) {
      this.decay = (request.responseText == this.lastText ?
        this.decay * this.options.decay : 1);

      this.lastText = request.responseText;
    }
    this.timer = setTimeout(this.onTimerEvent.bind(this),
      this.decay * this.frequency * 1000);
  },

  onTimerEvent: function() {
    this.updater = new Ajax.Updater(this.container, this.url, this.options);
  }
});
function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (typeof element == 'string')
    element = document.getElementById(element);
  return Element.extend(element);
}

if (Prototype.BrowserFeatures.XPath) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, $(parentElement) || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(query.snapshotItem(i));
    return results;
  };
}

document.getElementsByClassName = function(className, parentElement) {
  if (Prototype.BrowserFeatures.XPath) {
    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
    return document._getElementsByXPath(q, parentElement);
  } else {
    var children = ($(parentElement) || document.body).getElementsByTagName('*');
    var elements = [], child;
    for (var i = 0, length = children.length; i < length; i++) {
      child = children[i];
      if (Element.hasClassName(child, className))
        elements.push(Element.extend(child));
    }
    return elements;
  }
};

/*--------------------------------------------------------------------------*/

if (!window.Element)
  var Element = new Object();

Element.extend = function(element) {
  if (!element || _nativeExtensions || element.nodeType == 3) return element;

  if (!element._extended && element.tagName && element != window) {
    var methods = Object.clone(Element.Methods), cache = Element.extend.cache;

    if (element.tagName == 'FORM')
      Object.extend(methods, Form.Methods);
    if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName))
      Object.extend(methods, Form.Element.Methods);

    Object.extend(methods, Element.Methods.Simulated);

    for (var property in methods) {
      var value = methods[property];
      if (typeof value == 'function' && !(property in element))
        element[property] = cache.findOrStore(value);
    }
  }

  element._extended = true;
  return element;
};

Element.extend.cache = {
  findOrStore: function(value) {
    return this[value] = this[value] || function() {
      return value.apply(null, [this].concat($A(arguments)));
    }
  }
};

Element.Methods = {
  visible: function(element) {
    return $(element).style.display != 'none';
  },

  toggle: function(element) {
    element = $(element);
    Element[Element.visible(element) ? 'hide' : 'show'](element);
    return element;
  },

  hide: function(element) {
    $(element).style.display = 'none';
    return element;
  },

  show: function(element) {
    $(element).style.display = '';
    return element;
  },

  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
    return element;
  },

  update: function(element, html) {
    html = typeof html == 'undefined' ? '' : html.toString();
    $(element).innerHTML = html.stripScripts();
    setTimeout(function() {html.evalScripts()}, 10);
    return element;
  },

  replace: function(element, html) {
    element = $(element);
    html = typeof html == 'undefined' ? '' : html.toString();
    if (element.outerHTML) {
      element.outerHTML = html.stripScripts();
    } else {
      var range = element.ownerDocument.createRange();
      range.selectNodeContents(element);
      element.parentNode.replaceChild(
        range.createContextualFragment(html.stripScripts()), element);
    }
    setTimeout(function() {html.evalScripts()}, 10);
    return element;
  },

  inspect: function(element) {
    element = $(element);
    var result = '<' + element.tagName.toLowerCase();
    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
      var property = pair.first(), attribute = pair.last();
      var value = (element[property] || '').toString();
      if (value) result += ' ' + attribute + '=' + value.inspect(true);
    });
    return result + '>';
  },

  recursivelyCollect: function(element, property) {
    element = $(element);
    var elements = [];
    while (element = element[property])
      if (element.nodeType == 1)
        elements.push(Element.extend(element));
    return elements;
  },

  ancestors: function(element) {
    return $(element).recursivelyCollect('parentNode');
  },

  descendants: function(element) {
    return $A($(element).getElementsByTagName('*'));
  },

  immediateDescendants: function(element) {
    if (!(element = $(element).firstChild)) return [];
    while (element && element.nodeType != 1) element = element.nextSibling;
    if (element) return [element].concat($(element).nextSiblings());
    return [];
  },

  previousSiblings: function(element) {
    return $(element).recursivelyCollect('previousSibling');
  },

  nextSiblings: function(element) {
    return $(element).recursivelyCollect('nextSibling');
  },

  siblings: function(element) {
    element = $(element);
    return element.previousSiblings().reverse().concat(element.nextSiblings());
  },

  match: function(element, selector) {
    if (typeof selector == 'string')
      selector = new Selector(selector);
    return selector.match($(element));
  },

  up: function(element, expression, index) {
    return Selector.findElement($(element).ancestors(), expression, index);
  },

  down: function(element, expression, index) {
    return Selector.findElement($(element).descendants(), expression, index);
  },

  previous: function(element, expression, index) {
    return Selector.findElement($(element).previousSiblings(), expression, index);
  },

  next: function(element, expression, index) {
    return Selector.findElement($(element).nextSiblings(), expression, index);
  },

  getElementsBySelector: function() {
    var args = $A(arguments), element = $(args.shift());
    return Selector.findChildElements(element, args);
  },

  getElementsByClassName: function(element, className) {
    return document.getElementsByClassName(className, element);
  },

  readAttribute: function(element, name) {
    element = $(element);
    if (document.all && !window.opera) {
      var t = Element._attributeTranslations;
      if (t.values[name]) return t.values[name](element, name);
      if (t.names[name])  name = t.names[name];
      var attribute = element.attributes[name];
      if(attribute) return attribute.nodeValue;
    }
    return element.getAttribute(name);
  },

  getHeight: function(element) {
    return $(element).getDimensions().height;
  },

  getWidth: function(element) {
    return $(element).getDimensions().width;
  },

  classNames: function(element) {
    return new Element.ClassNames(element);
  },

  hasClassName: function(element, className) {
    if (!(element = $(element))) return;
    var elementClassName = element.className;
    if (elementClassName.length == 0) return false;
    if (elementClassName == className ||
        elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
      return true;
    return false;
  },

  addClassName: function(element, className) {
    if (!(element = $(element))) return;
    Element.classNames(element).add(className);
    return element;
  },

  removeClassName: function(element, className) {
    if (!(element = $(element))) return;
    Element.classNames(element).remove(className);
    return element;
  },

  toggleClassName: function(element, className) {
    if (!(element = $(element))) return;
    Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
    return element;
  },

  observe: function() {
    Event.observe.apply(Event, arguments);
    return $A(arguments).first();
  },

  stopObserving: function() {
    Event.stopObserving.apply(Event, arguments);
    return $A(arguments).first();
  },

  // removes whitespace-only text node children
  cleanWhitespace: function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  },

  empty: function(element) {
    return $(element).innerHTML.match(/^\s*$/);
  },

  descendantOf: function(element, ancestor) {
    element = $(element), ancestor = $(ancestor);
    while (element = element.parentNode)
      if (element == ancestor) return true;
    return false;
  },

  scrollTo: function(element) {
    element = $(element);
    var pos = Position.cumulativeOffset(element);
    window.scrollTo(pos[0], pos[1]);
    return element;
  },

  getStyle: function(element, style) {
    element = $(element);
    if (['float','cssFloat'].include(style))
      style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
    style = style.camelize();
    var value = element.style[style];
    if (!value) {
      if (document.defaultView && document.defaultView.getComputedStyle) {
        var css = document.defaultView.getComputedStyle(element, null);
        value = css ? css[style] : null;
      } else if (element.currentStyle) {
        value = element.currentStyle[style];
      }
    }

    if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
      value = element['offset'+style.capitalize()] + 'px';

    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
      if (Element.getStyle(element, 'position') == 'static') value = 'auto';
    if(style == 'opacity') {
      if(value) return parseFloat(value);
      if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
        if(value[1]) return parseFloat(value[1]) / 100;
      return 1.0;
    }
    return value == 'auto' ? null : value;
  },

  setStyle: function(element, style) {
    element = $(element);
    for (var name in style) {
      var value = style[name];
      if(name == 'opacity') {
        if (value == 1) {
          value = (/Gecko/.test(navigator.userAgent) &&
            !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
          if(/MSIE/.test(navigator.userAgent) && !window.opera)
            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
        } else if(value === '') {
          if(/MSIE/.test(navigator.userAgent) && !window.opera)
            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
        } else {
          if(value < 0.00001) value = 0;
          if(/MSIE/.test(navigator.userAgent) && !window.opera)
            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
              'alpha(opacity='+value*100+')';
        }
      } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
      element.style[name.camelize()] = value;
    }
    return element;
  },

  getDimensions: function(element) {
    element = $(element);
    var display = $(element).getStyle('display');
    if (display != 'none' && display != null) // Safari bug
      return {width: element.offsetWidth, height: element.offsetHeight};

    // All *Width and *Height properties give 0 on elements with display none,
    // so enable the element temporarily
    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    return {width: originalWidth, height: originalHeight};
  },

  makePositioned: function(element) {
    element = $(element);
    var pos = Element.getStyle(element, 'position');
    if (pos == 'static' || !pos) {
      element._madePositioned = true;
      element.style.position = 'relative';
      // Opera returns the offset relative to the positioning context, when an
      // element is position relative but top and left have not been defined
      if (window.opera) {
        element.style.top = 0;
        element.style.left = 0;
      }
    }
    return element;
  },

  undoPositioned: function(element) {
    element = $(element);
    if (element._madePositioned) {
      element._madePositioned = undefined;
      element.style.position =
        element.style.top =
        element.style.left =
        element.style.bottom =
        element.style.right = '';
    }
    return element;
  },

  makeClipping: function(element) {
    element = $(element);
    if (element._overflow) return element;
    element._overflow = element.style.overflow || 'auto';
    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
      element.style.overflow = 'hidden';
    return element;
  },

  undoClipping: function(element) {
    element = $(element);
    if (!element._overflow) return element;
    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
    element._overflow = null;
    return element;
  }
};

Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf});

Element._attributeTranslations = {};

Element._attributeTranslations.names = {
  colspan:   "colSpan",
  rowspan:   "rowSpan",
  valign:    "vAlign",
  datetime:  "dateTime",
  accesskey: "accessKey",
  tabindex:  "tabIndex",
  enctype:   "encType",
  maxlength: "maxLength",
  readonly:  "readOnly",
  longdesc:  "longDesc"
};

Element._attributeTranslations.values = {
  _getAttr: function(element, attribute) {
    return element.getAttribute(attribute, 2);
  },

  _flag: function(element, attribute) {
    return $(element).hasAttribute(attribute) ? attribute : null;
  },

  style: function(element) {
    return element.style.cssText.toLowerCase();
  },

  title: function(element) {
    var node = element.getAttributeNode('title');
    return node.specified ? node.nodeValue : null;
  }
};

Object.extend(Element._attributeTranslations.values, {
  href: Element._attributeTranslations.values._getAttr,
  src:  Element._attributeTranslations.values._getAttr,
  disabled: Element._attributeTranslations.values._flag,
  checked:  Element._attributeTranslations.values._flag,
  readonly: Element._attributeTranslations.values._flag,
  multiple: Element._attributeTranslations.values._flag
});

Element.Methods.Simulated = {
  hasAttribute: function(element, attribute) {
    var t = Element._attributeTranslations;
    attribute = t.names[attribute] || attribute;
    return $(element).getAttributeNode(attribute).specified;
  }
};

// IE is missing .innerHTML support for TABLE-related elements
if (document.all && !window.opera){
  Element.Methods.update = function(element, html) {
    element = $(element);
    html = typeof html == 'undefined' ? '' : html.toString();
    var tagName = element.tagName.toUpperCase();
    if (['THEAD','TBODY','TR','TD'].include(tagName)) {
      var div = document.createElement('div');
      switch (tagName) {
        case 'THEAD':
        case 'TBODY':
          div.innerHTML = '<table><tbody>' +  html.stripScripts() + '</tbody></table>';
          depth = 2;
          break;
        case 'TR':
          div.innerHTML = '<table><tbody><tr>' +  html.stripScripts() + '</tr></tbody></table>';
          depth = 3;
          break;
        case 'TD':
          div.innerHTML = '<table><tbody><tr><td>' +  html.stripScripts() + '</td></tr></tbody></table>';
          depth = 4;
      }
      $A(element.childNodes).each(function(node){
        element.removeChild(node)
      });
      depth.times(function(){ div = div.firstChild });

      $A(div.childNodes).each(
        function(node){ element.appendChild(node) });
    } else {
      element.innerHTML = html.stripScripts();
    }
    setTimeout(function() {html.evalScripts()}, 10);
    return element;
  }
};

Object.extend(Element, Element.Methods);

var _nativeExtensions = false;

if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
  ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
    var className = 'HTML' + tag + 'Element';
    if(window[className]) return;
    var klass = window[className] = {};
    klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
  });

Element.addMethods = function(methods) {
  Object.extend(Element.Methods, methods || {});

  function copy(methods, destination, onlyIfAbsent) {
    onlyIfAbsent = onlyIfAbsent || false;
    var cache = Element.extend.cache;
    for (var property in methods) {
      var value = methods[property];
      if (!onlyIfAbsent || !(property in destination))
        destination[property] = cache.findOrStore(value);
    }
  }

  if (typeof HTMLElement != 'undefined') {
    copy(Element.Methods, HTMLElement.prototype);
    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
    copy(Form.Methods, HTMLFormElement.prototype);
    [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
      copy(Form.Element.Methods, klass.prototype);
    });
    _nativeExtensions = true;
  }
}

var Toggle = new Object();
Toggle.display = Element.toggle;

/*--------------------------------------------------------------------------*/

Abstract.Insertion = function(adjacency) {
  this.adjacency = adjacency;
}

Abstract.Insertion.prototype = {
  initialize: function(element, content) {
    this.element = $(element);
    this.content = content.stripScripts();

    if (this.adjacency && this.element.insertAdjacentHTML) {
      try {
        this.element.insertAdjacentHTML(this.adjacency, this.content);
      } catch (e) {
        var tagName = this.element.tagName.toUpperCase();
        if (['TBODY', 'TR'].include(tagName)) {
          this.insertContent(this.contentFromAnonymousTable());
        } else {
          throw e;
        }
      }
    } else {
      this.range = this.element.ownerDocument.createRange();
      if (this.initializeRange) this.initializeRange();
      this.insertContent([this.range.createContextualFragment(this.content)]);
    }

    setTimeout(function() {content.evalScripts()}, 10);
  },

  contentFromAnonymousTable: function() {
    var div = document.createElement('div');
    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
    return $A(div.childNodes[0].childNodes[0].childNodes);
  }
}

var Insertion = new Object();

Insertion.Before = Class.create();
Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
  initializeRange: function() {
    this.range.setStartBefore(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment, this.element);
    }).bind(this));
  }
});

Insertion.Top = Class.create();
Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
  initializeRange: function() {
    this.range.selectNodeContents(this.element);
    this.range.collapse(true);
  },

  insertContent: function(fragments) {
    fragments.reverse(false).each((function(fragment) {
      this.element.insertBefore(fragment, this.element.firstChild);
    }).bind(this));
  }
});

Insertion.Bottom = Class.create();
Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
  initializeRange: function() {
    this.range.selectNodeContents(this.element);
    this.range.collapse(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.appendChild(fragment);
    }).bind(this));
  }
});

Insertion.After = Class.create();
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
  initializeRange: function() {
    this.range.setStartAfter(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment,
        this.element.nextSibling);
    }).bind(this));
  }
});

/*--------------------------------------------------------------------------*/

Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
  initialize: function(element) {
    this.element = $(element);
  },

  _each: function(iterator) {
    this.element.className.split(/\s+/).select(function(name) {
      return name.length > 0;
    })._each(iterator);
  },

  set: function(className) {
    this.element.className = className;
  },

  add: function(classNameToAdd) {
    if (this.include(classNameToAdd)) return;
    this.set($A(this).concat(classNameToAdd).join(' '));
  },

  remove: function(classNameToRemove) {
    if (!this.include(classNameToRemove)) return;
    this.set($A(this).without(classNameToRemove).join(' '));
  },

  toString: function() {
    return $A(this).join(' ');
  }
};

Object.extend(Element.ClassNames.prototype, Enumerable);
var Selector = Class.create();
Selector.prototype = {
  initialize: function(expression) {
    this.params = {classNames: []};
    this.expression = expression.toString().strip();
    this.parseExpression();
    this.compileMatcher();
  },

  parseExpression: function() {
    function abort(message) { throw 'Parse error in selector: ' + message; }

    if (this.expression == '')  abort('empty expression');

    var params = this.params, expr = this.expression, match, modifier, clause, rest;
    while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
      params.attributes = params.attributes || [];
      params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
      expr = match[1];
    }

    if (expr == '*') return this.params.wildcard = true;

    while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
      modifier = match[1], clause = match[2], rest = match[3];
      switch (modifier) {
        case '#':       params.id = clause; break;
        case '.':       params.classNames.push(clause); break;
        case '':
        case undefined: params.tagName = clause.toUpperCase(); break;
        default:        abort(expr.inspect());
      }
      expr = rest;
    }

    if (expr.length > 0) abort(expr.inspect());
  },

  buildMatchExpression: function() {
    var params = this.params, conditions = [], clause;

    if (params.wildcard)
      conditions.push('true');
    if (clause = params.id)
      conditions.push('element.readAttribute("id") == ' + clause.inspect());
    if (clause = params.tagName)
      conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
    if ((clause = params.classNames).length > 0)
      for (var i = 0, length = clause.length; i < length; i++)
        conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
    if (clause = params.attributes) {
      clause.each(function(attribute) {
        var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
        var splitValueBy = function(delimiter) {
          return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
        }

        switch (attribute.operator) {
          case '=':       conditions.push(value + ' == ' + attribute.value.inspect()); break;
          case '~=':      conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
          case '|=':      conditions.push(
                            splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
                          ); break;
          case '!=':      conditions.push(value + ' != ' + attribute.value.inspect()); break;
          case '':
          case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
          default:        throw 'Unknown operator ' + attribute.operator + ' in selector';
        }
      });
    }

    return conditions.join(' && ');
  },

  compileMatcher: function() {
    this.match = new Function('element', 'if (!element.tagName) return false; \
      element = $(element); \
      return ' + this.buildMatchExpression());
  },

  findElements: function(scope) {
    var element;

    if (element = $(this.params.id))
      if (this.match(element))
        if (!scope || Element.childOf(element, scope))
          return [element];

    scope = (scope || document).getElementsByTagName(this.params.tagName || '*');

    var results = [];
    for (var i = 0, length = scope.length; i < length; i++)
      if (this.match(element = scope[i]))
        results.push(Element.extend(element));

    return results;
  },

  toString: function() {
    return this.expression;
  }
}

Object.extend(Selector, {
  matchElements: function(elements, expression) {
    var selector = new Selector(expression);
    return elements.select(selector.match.bind(selector)).map(Element.extend);
  },

  findElement: function(elements, expression, index) {
    if (typeof expression == 'number') index = expression, expression = false;
    return Selector.matchElements(elements, expression || '*')[index || 0];
  },

  findChildElements: function(element, expressions) {
    return expressions.map(function(expression) {
      return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
        var selector = new Selector(expr);
        return results.inject([], function(elements, result) {
          return elements.concat(selector.findElements(result || element));
        });
      });
    }).flatten();
  }
});

function $$() {
  return Selector.findChildElements(document, $A(arguments));
}
var Form = {
  reset: function(form) {
    $(form).reset();
    return form;
  },

  serializeElements: function(elements, getHash) {
    var data = elements.inject({}, function(result, element) {
      if (!element.disabled && element.name) {
        var key = element.name, value = $(element).getValue();
        if (value != undefined) {
          if (result[key]) {
            if (result[key].constructor != Array) result[key] = [result[key]];
            result[key].push(value);
          }
          else result[key] = value;
        }
      }
      return result;
    });

    return getHash ? data : Hash.toQueryString(data);
  }
};

Form.Methods = {
  serialize: function(form, getHash) {
    return Form.serializeElements(Form.getElements(form), getHash);
  },

  getElements: function(form) {
    return $A($(form).getElementsByTagName('*')).inject([],
      function(elements, child) {
        if (Form.Element.Serializers[child.tagName.toLowerCase()])
          elements.push(Element.extend(child));
        return elements;
      }
    );
  },

  getInputs: function(form, typeName, name) {
    form = $(form);
    var inputs = form.getElementsByTagName('input');

    if (!typeName && !name) return $A(inputs).map(Element.extend);

    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
      var input = inputs[i];
      if ((typeName && input.type != typeName) || (name && input.name != name))
        continue;
      matchingInputs.push(Element.extend(input));
    }

    return matchingInputs;
  },

  disable: function(form) {
    form = $(form);
    form.getElements().each(function(element) {
      element.blur();
      element.disabled = 'true';
    });
    return form;
  },

  enable: function(form) {
    form = $(form);
    form.getElements().each(function(element) {
      element.disabled = '';
    });
    return form;
  },

  findFirstElement: function(form) {
    return $(form).getElements().find(function(element) {
      return element.type != 'hidden' && !element.disabled &&
        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
    });
  },

  focusFirstElement: function(form) {
    form = $(form);
    form.findFirstElement().activate();
    return form;
  }
}

Object.extend(Form, Form.Methods);

/*--------------------------------------------------------------------------*/

Form.Element = {
  focus: function(element) {
    $(element).focus();
    return element;
  },

  select: function(element) {
    $(element).select();
    return element;
  }
}

Form.Element.Methods = {
  serialize: function(element) {
    element = $(element);
    if (!element.disabled && element.name) {
      var value = element.getValue();
      if (value != undefined) {
        var pair = {};
        pair[element.name] = value;
        return Hash.toQueryString(pair);
      }
    }
    return '';
  },

  getValue: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    return Form.Element.Serializers[method](element);
  },

  clear: function(element) {
    $(element).value = '';
    return element;
  },

  present: function(element) {
    return $(element).value != '';
  },

  activate: function(element) {
    element = $(element);
    element.focus();
    if (element.select && ( element.tagName.toLowerCase() != 'input' ||
      !['button', 'reset', 'submit'].include(element.type) ) )
      element.select();
    return element;
  },

  disable: function(element) {
    element = $(element);
    element.disabled = true;
    return element;
  },

  enable: function(element) {
    element = $(element);
    element.blur();
    element.disabled = false;
    return element;
  }
}

Object.extend(Form.Element, Form.Element.Methods);
var Field = Form.Element;
var $F = Form.Element.getValue;

/*--------------------------------------------------------------------------*/

Form.Element.Serializers = {
  input: function(element) {
    switch (element.type.toLowerCase()) {
      case 'checkbox':
      case 'radio':
        return Form.Element.Serializers.inputSelector(element);
      default:
        return Form.Element.Serializers.textarea(element);
    }
  },

  inputSelector: function(element) {
    return element.checked ? element.value : null;
  },

  textarea: function(element) {
    return element.value;
  },

  select: function(element) {
    return this[element.type == 'select-one' ?
      'selectOne' : 'selectMany'](element);
  },

  selectOne: function(element) {
    var index = element.selectedIndex;
    return index >= 0 ? this.optionValue(element.options[index]) : null;
  },

  selectMany: function(element) {
    var values, length = element.length;
    if (!length) return null;

    for (var i = 0, values = []; i < length; i++) {
      var opt = element.options[i];
      if (opt.selected) values.push(this.optionValue(opt));
    }
    return values;
  },

  optionValue: function(opt) {
    // extend element because hasAttribute may not be native
    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
  }
}

/*--------------------------------------------------------------------------*/

Abstract.TimedObserver = function() {}
Abstract.TimedObserver.prototype = {
  initialize: function(element, frequency, callback) {
    this.frequency = frequency;
    this.element   = $(element);
    this.callback  = callback;

    this.lastValue = this.getValue();
    this.registerCallback();
  },

  registerCallback: function() {
    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  onTimerEvent: function() {
    var value = this.getValue();
    var changed = ('string' == typeof this.lastValue && 'string' == typeof value
      ? this.lastValue != value : String(this.lastValue) != String(value));
    if (changed) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  }
}

Form.Element.Observer = Class.create();
Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.Observer = Class.create();
Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
  getValue: function() {
    return Form.serialize(this.element);
  }
});

/*--------------------------------------------------------------------------*/

Abstract.EventObserver = function() {}
Abstract.EventObserver.prototype = {
  initialize: function(element, callback) {
    this.element  = $(element);
    this.callback = callback;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {
    Form.getElements(this.element).each(this.registerCallback.bind(this));
  },

  registerCallback: function(element) {
    if (element.type) {
      switch (element.type.toLowerCase()) {
        case 'checkbox':
        case 'radio':
          Event.observe(element, 'click', this.onElementEvent.bind(this));
          break;
        default:
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
      }
    }
  }
}

Form.Element.EventObserver = Class.create();
Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.EventObserver = Class.create();
Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
  getValue: function() {
    return Form.serialize(this.element);
  }
});
if (!window.Event) {
  var Event = new Object();
}

Object.extend(Event, {
  KEY_BACKSPACE: 8,
  KEY_TAB:       9,
  KEY_RETURN:   13,
  KEY_ESC:      27,
  KEY_LEFT:     37,
  KEY_UP:       38,
  KEY_RIGHT:    39,
  KEY_DOWN:     40,
  KEY_DELETE:   46,
  KEY_HOME:     36,
  KEY_END:      35,
  KEY_PAGEUP:   33,
  KEY_PAGEDOWN: 34,

  element: function(event) {
    return event.target || event.srcElement;
  },

  isLeftClick: function(event) {
    return (((event.which) && (event.which == 1)) ||
            ((event.button) && (event.button == 1)));
  },

  pointerX: function(event) {
    return event.pageX || (event.clientX +
      (document.documentElement.scrollLeft || document.body.scrollLeft));
  },

  pointerY: function(event) {
    return event.pageY || (event.clientY +
      (document.documentElement.scrollTop || document.body.scrollTop));
  },

  stop: function(event) {
    if (event.preventDefault) {
      event.preventDefault();
      event.stopPropagation();
    } else {
      event.returnValue = false;
      event.cancelBubble = true;
    }
  },

  // find the first node with the given tagName, starting from the
  // node the event was triggered on; traverses the DOM upwards
  findElement: function(event, tagName) {
    var element = Event.element(event);
    while (element.parentNode && (!element.tagName ||
        (element.tagName.toUpperCase() != tagName.toUpperCase())))
      element = element.parentNode;
    return element;
  },

  observers: false,

  _observeAndCache: function(element, name, observer, useCapture) {
    if (!this.observers) this.observers = [];
    if (element.addEventListener) {
      this.observers.push([element, name, observer, useCapture]);
      element.addEventListener(name, observer, useCapture);
    } else if (element.attachEvent) {
      this.observers.push([element, name, observer, useCapture]);
      element.attachEvent('on' + name, observer);
    }
  },

  unloadCache: function() {
    if (!Event.observers) return;
    for (var i = 0, length = Event.observers.length; i < length; i++) {
      Event.stopObserving.apply(this, Event.observers[i]);
      Event.observers[i][0] = null;
    }
    Event.observers = false;
  },

  observe: function(element, name, observer, useCapture) {
    element = $(element);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
        || element.attachEvent))
      name = 'keydown';

    Event._observeAndCache(element, name, observer, useCapture);
  },

  stopObserving: function(element, name, observer, useCapture) {
    element = $(element);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
        || element.detachEvent))
      name = 'keydown';

    if (element.removeEventListener) {
      element.removeEventListener(name, observer, useCapture);
    } else if (element.detachEvent) {
      try {
        element.detachEvent('on' + name, observer);
      } catch (e) {}
    }
  }
});

/* prevent memory leaks in IE */
if (navigator.appVersion.match(/\bMSIE\b/))
  Event.observe(window, 'unload', Event.unloadCache, false);
var Position = {
  // set to true if needed, warning: firefox performance problems
  // NOT neeeded for page scrolling, only if draggable contained in
  // scrollable elements
  includeScrollOffsets: false,

  // must be called before calling withinIncludingScrolloffset, every time the
  // page is scrolled
  prepare: function() {
    this.deltaX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    this.deltaY =  window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
  },

  realOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.scrollTop  || 0;
      valueL += element.scrollLeft || 0;
      element = element.parentNode;
    } while (element);
    return [valueL, valueT];
  },

  cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return [valueL, valueT];
  },

  positionedOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
      if (element) {
        if(element.tagName=='BODY') break;
        var p = Element.getStyle(element, 'position');
        if (p == 'relative' || p == 'absolute') break;
      }
    } while (element);
    return [valueL, valueT];
  },

  offsetParent: function(element) {
    if (element.offsetParent) return element.offsetParent;
    if (element == document.body) return element;

    while ((element = element.parentNode) && element != document.body)
      if (Element.getStyle(element, 'position') != 'static')
        return element;

    return document.body;
  },

  // caches x/y coordinate pair to use with overlap
  within: function(element, x, y) {
    if (this.includeScrollOffsets)
      return this.withinIncludingScrolloffsets(element, x, y);
    this.xcomp = x;
    this.ycomp = y;
    this.offset = this.cumulativeOffset(element);

    return (y >= this.offset[1] &&
            y <  this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x <  this.offset[0] + element.offsetWidth);
  },

  withinIncludingScrolloffsets: function(element, x, y) {
    var offsetcache = this.realOffset(element);

    this.xcomp = x + offsetcache[0] - this.deltaX;
    this.ycomp = y + offsetcache[1] - this.deltaY;
    this.offset = this.cumulativeOffset(element);

    return (this.ycomp >= this.offset[1] &&
            this.ycomp <  this.offset[1] + element.offsetHeight &&
            this.xcomp >= this.offset[0] &&
            this.xcomp <  this.offset[0] + element.offsetWidth);
  },

  // within must be called directly before
  overlap: function(mode, element) {
    if (!mode) return 0;
    if (mode == 'vertical')
      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
        element.offsetHeight;
    if (mode == 'horizontal')
      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
        element.offsetWidth;
  },

  page: function(forElement) {
    var valueT = 0, valueL = 0;

    var element = forElement;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;

      // Safari fix
      if (element.offsetParent==document.body)
        if (Element.getStyle(element,'position')=='absolute') break;

    } while (element = element.offsetParent);

    element = forElement;
    do {
      if (!window.opera || element.tagName=='BODY') {
        valueT -= element.scrollTop  || 0;
        valueL -= element.scrollLeft || 0;
      }
    } while (element = element.parentNode);

    return [valueL, valueT];
  },

  clone: function(source, target) {
    var options = Object.extend({
      setLeft:    true,
      setTop:     true,
      setWidth:   true,
      setHeight:  true,
      offsetTop:  0,
      offsetLeft: 0
    }, arguments[2] || {})

    // find page position of source
    source = $(source);
    var p = Position.page(source);

    // find coordinate system to use
    target = $(target);
    var delta = [0, 0];
    var parent = null;
    // delta [0,0] will do fine with position: fixed elements,
    // position:absolute needs offsetParent deltas
    if (Element.getStyle(target,'position') == 'absolute') {
      parent = Position.offsetParent(target);
      delta = Position.page(parent);
    }

    // correct by body offsets (fixes Safari)
    if (parent == document.body) {
      delta[0] -= document.body.offsetLeft;
      delta[1] -= document.body.offsetTop;
    }

    // set position
    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
  },

  absolutize: function(element) {
    element = $(element);
    if (element.style.position == 'absolute') return;
    Position.prepare();

    var offsets = Position.positionedOffset(element);
    var top     = offsets[1];
    var left    = offsets[0];
    var width   = element.clientWidth;
    var height  = element.clientHeight;

    element._originalLeft   = left - parseFloat(element.style.left  || 0);
    element._originalTop    = top  - parseFloat(element.style.top || 0);
    element._originalWidth  = element.style.width;
    element._originalHeight = element.style.height;

    element.style.position = 'absolute';
    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.width  = width + 'px';
    element.style.height = height + 'px';
  },

  relativize: function(element) {
    element = $(element);
    if (element.style.position == 'relative') return;
    Position.prepare();

    element.style.position = 'relative';
    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);

    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.height = element._originalHeight;
    element.style.width  = element._originalWidth;
  }
}

// Safari returns margins on body which is incorrect if the child is absolutely
// positioned.  For performance reasons, redefine Position.cumulativeOffset for
// KHTML/WebKit only.
if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
  Position.cumulativeOffset = function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      if (element.offsetParent == document.body)
        if (Element.getStyle(element, 'position') == 'absolute') break;

      element = element.offsetParent;
    } while (element);

    return [valueL, valueT];
  }
}

Element.addMethods();

/************************************************************************************************
* Floatbox v3.24
* December 01, 2008
*
* Copyright (C) 2008 Byron McGregor
* Website: http://randomous.com/tools/floatbox/
* License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
* This comment block must be retained in all deployments and distributions
*************************************************************************************************/
function Floatbox() {
this.defaultOptions = {
/***** BEGIN OPTIONS CONFIGURATION *****/

// see docs/options.html for detailed descriptions



/*** <General Options> ***/

theme:          'auto'    ,// 'auto'|'black'|'white'|'blue'|'yellow'|'red'|'custom'
padding:         12       ,// pixels
panelPadding:    8        ,// pixels
outerBorder:     4        ,// pixels
innerBorder:     1        ,// pixels
overlayOpacity:  55       ,// 0-100
controlOpacity:  60       ,// 0-100
autoSizeImages:  true     ,// true|false
autoSizeOther:   false    ,// true|false
resizeImages:    true     ,// true|false
resizeOther:     false    ,// true|false
resizeTool:     'cursor'  ,// 'cursor'|'topleft'|'both'
infoPos:        'bl'      ,// 'tl'|'tc'|'tr'|'bl'|'bc'|'br'
controlPos:     'br'      ,// 'tl'|'tr'|'bl'|'br'
boxLeft:        'auto'    ,// 'auto'|pixels|'[-]xx%'
boxTop:         'auto'    ,// 'auto'|pixels|'[-]xx%'
shadowType:     'drop'    ,// 'drop'|'halo'|'none'
shadowSize:      12       ,// 8|12|16|24
enableDrag:      false     ,// true|false
showCaption:     true     ,// true|false
showItemNumber:  true     ,// true|flse
showClose:       true     ,// true|false
hideFlash:       true     ,// true|false
hideJava:        true     ,// true|false
disableScroll:   false    ,// true|false
autoGallery:     false    ,// true|false

preloadAll:      true     ,// true|false

enableCookies:   false    ,// true|false

cookieScope:    'site'    ,// 'site'|'folder'

language:       'auto'    ,// 'auto'|'en'|... (see the languages folder)

graphicsType:   'auto'    ,// 'auto'|'international'|'english'

urlGraphics:    '/floatbox/graphics/'   ,// change this if you install in another folder

urlLanguages:   '/floatbox/languages/'  ,// change this if you install in another folder

/*** </General Options> ***/



/*** <Navigation Options> ***/

navType:           'both'    ,// 'overlay'|'button'|'both'|'none'

navOverlayWidth:    35       ,// 0-50

navOverlayPos:      30       ,// 0-100

showNavOverlay:    'never'   ,// 'always'|'once'|'never'

showHints:         'once'    ,// 'always'|'once'|'never'

enableWrap:         true     ,// true|false

enableKeyboardNav:  true     ,// true|false

outsideClickCloses: true     ,// true|false

numIndexLinks:      0        ,// number, -1 = no limit

indexLinksPanel:   'control' ,// 'info'|'control'

showIndexThumbs:    true     ,// true|false

/*** </Navigation Options> ***/



/*** <Animation Options> ***/

doAnimations:         true   ,// true|false

resizeDuration:       3.5    ,// 0-10

imageFadeDuration:    3.5    ,// 0-10

overlayFadeDuration:  4      ,// 0-10

splitResize:         'no'    ,// 'no'|'auto'|'wh'|'hw'

startAtClick:         true   ,// true|false

zoomImageStart:       true   ,// true|false

liveImageResize:      false  ,// true|false

/*** </Animation Options> ***/



/*** <Slideshow Options> ***/

slideInterval:  4.5    ,// seconds

endTask:       'exit'  ,// 'stop'|'exit'|'loop'

showPlayPause:  true   ,// true|false

startPaused:    false  ,// true|false

pauseOnResize:  true   ,// true|false

pauseOnPrev:    true   ,// true|false

pauseOnNext:    false   // true|false

/*** </Slideshow Options> ***/

};



/*** <New Child Window Options> ***/

// Will inherit from the primary floatbox options unless overridden here

// Add any you like

this.childOptions = {
overlayOpacity:      45,
resizeDuration:       3,
imageFadeDuration:    3,
overlayFadeDuration:  0
};
/*** </New Child Window Options> ***/



/***** END OPTIONS CONFIGURATION *****/

this.init();

}

Floatbox.prototype = {

	panelGap: 22,

	infoLinkGap: 16,

	showHintsTime: 1600,

	zoomPopBorder: 1,

	controlSpacing: 8,

	minInfoWidth: 80,

	minIndexWidth: 120,

	ctrlJump: 5,

	slowLoadDelay: 750,

	loaderDelay: 200,

	autoSizeSpace: 4,

	initialSize: 120,

	defaultWidth: '85%',

	defaultHeight: '82%',

init: function() {

	this.setOptions(this.defaultOptions);

	if (typeof fbPageOptions === 'object') this.setOptions(fbPageOptions);

	this.setOptions(this.parseOptionString(location.search.substring(1)));

	this.items = [];

	this.nodeNames = [];

	this.hiddenEls = [];

	this.timeouts = {};

	this.pos = {};

	var path = this.urlGraphics;

	this.slowZoomImg = path + 'loading_white.gif';

	this.slowLoadImg = path + 'loading_black.gif';

	this.iframeSrc = path + 'loading_iframe.html';

	this.resizeUpCursor = path + 'magnify_plus.cur';

	this.resizeDownCursor = path + 'magnify_minus.cur';

	this.notFoundImg = path + '404.jpg';

	var agent = navigator.userAgent,

		version = navigator.appVersion;

	this.mac = version.indexOf('Macintosh') !== -1;

	if (window.opera) {

		this.opera = true;

		this.operaOld = parseFloat(version) < 9.5;

		this.operaMac = this.mac;

	} else if (document.all) {

		this.ie = true;

		this.ieOld = parseInt(version.substr(version.indexOf('MSIE') + 5), 10) < 7;

		this.ie8b2 = version.indexOf('MSIE 8.0') !== -1 && navigator.appMinorVersion === 'beta 2';

		this.ieXP = parseInt(version.substr(version.indexOf('Windows NT') + 11), 10) < 6;

	} else if (agent.indexOf('Firefox') !== -1) {

		this.ff = true;

		this.ffOld = parseInt(agent.substr(agent.indexOf('Firefox') + 8), 10) < 3;

		this.ffNew = !this.ffOld;

		this.ffMac = this.mac;

	} else if (version.indexOf('WebKit') !== -1) {

		this.webkit = true;

		this.webkitNew = parseInt(version.substr(version.indexOf('WebKit') + 7), 10) >= 500;

		this.webkitOld = !this.webkitNew;

		this.webkitMac = this.mac;

	}

	this.isChild = !!(self.fb && self.fb.fbBox);

	if (!this.isChild) {

		this.fbParent = this.lastChild = this;

		this.anchors = [];

		this.children = [];

		this.preloads = {};

		this.preloads.count = 0;

		this.html = document.documentElement;

		this.bod = document.body || document.getElementsByTagName('body')[0];

		this.rtl = this.getStyle(this.bod, 'direction') === 'rtl' || this.getStyle(this.html, 'direction') === 'rtl';

		this.xhr = this.getXMLHttpRequest();

		this.strings = {

			hintClose: 'Exit (key: Esc)',

			hintPrev: 'Previous (key: <--)',

			hintNext: 'Next (key: -->)',

			hintPlay: 'Play (key: spacebar)',

			hintPause: 'Pause (key: spacebar)',

			hintResize: 'Resize (key: Tab)',

			imgCount: 'Image %1 of %2',

			nonImgCount: 'Page %1 of %2',

			mixedCount: '(%1 of %2)',

			infoText: 'Info...',

			printText: 'Print...'

		};

  	} else {

		this.fbParent = fb.lastChild;

		fb.lastChild = this;

		fb.children.push(this);

		if (this.fbParent.isSlideshow) this.fbParent.setPause(true);

		this.anchors = fb.anchors;

		this.children = fb.children;

		this.html = fb.html;

		this.bod = fb.bod;

		this.rtl = fb.rtl;

		this.xhr = fb.xhr;

		this.strings = fb.strings;

	}

	this.browserLanguage = (navigator.language || navigator.userLanguage || navigator.systemLanguage || navigator.browserLanguage || 'en').substring(0, 2);

	if (!this.isChild) {

		var lang = this.language === 'auto' ? this.browserLanguage : this.language;

		if (this.xhr) {

			var that = this;

			this.xhr.getResponse(this.urlLanguages + lang + '.json', function(xhr) {

				if ((xhr.status === 200 || xhr.status === 203 || xhr.status === 304) && xhr.responseText) {

					var ltArrow = String.fromCharCode(8592),

						rtArrow = String.fromCharCode(8594),

						text = xhr.responseText;

					if (that.ieXP) {

						text = text.replace(ltArrow, '<--').replace(rtArrow, '-->');

					}

					try {

						var obj = eval('(' + text + ')');

						if (obj && obj.hintClose) that.strings = obj;

					} catch(e) {}

				}

				if (that.rtl) {

					if (!/^(ar|he)$/.test(that.language)) {

						that.strings.infoText = that.strings.infoText.replace('...', '');

						that.strings.printText = that.strings.printText.replace('...', '');

					}

					that.strings.hintPrev = that.strings.hintPrev.replace(ltArrow, rtArrow).replace('-->', '<--');

					that.strings.hintNext = that.strings.hintNext.replace(rtArrow, ltArrow).replace('<--', '-->');

					var t = that.strings.hintPrev;

					that.strings.hintPrev = that.strings.hintNext;

					that.strings.hintNext = t;

				}

			});

		}

	}

	if (!this.rtl && (this.graphicsType.toLowerCase() === 'english' || (this.graphicsType === 'auto' && this.browserLanguage === 'en'))) {

		this.offPos = 'top left';

		this.onPos = 'bottom left';

	} else {

		this.offPos = 'top right';

		this.onPos = 'bottom right';

		this.controlSpacing = 0;

	}

	this.zIndex = {

		base: 90000 + 10*this.children.length,

		fbOverlay: 1,

		fbBox: 2,

		fbCanvas: 3,

		fbMainDiv: 4,

		fbLeftNav: 5,

		fbRightNav: 5,

		fbOverlayPrev: 6,

		fbOverlayNext: 6,

		fbResizer: 7,

		fbZoomDiv: 8,

		fbInfoPanel: 8,

		fbControlPanel: 8

	};

	var match = /\bautoStart=(.+?)(?:&|$)/i.exec(location.search);

	this.autoHref = match ? match[1] : false;

},

tagAnchors: function(baseEl) {

	var that = fb.lastChild,

		doOutline = this.ieOld && /^fb/.test(baseEl.id);

	function tag(tagName) {

		var elements = baseEl.getElementsByTagName(tagName);

		for (var i = 0, len = elements.length; i < len; i++) {

			var el = elements[i],

				revOptions = that.parseOptionString(el.getAttribute('rev')),

				href = revOptions.href || el.getAttribute('href');

			if (that.autoGallery && that.fileType(href) === 'img' && el.getAttribute('rel') !== 'nofloatbox') {

				el.setAttribute('rel', 'floatbox.autoGallery');

				if (that.autoTitle && !el.getAttribute('title')) el.setAttribute('title', that.autoTitle);

			}

			if (doOutline) el.setAttribute('hideFocus', 'true');

			that.tagOneAnchor(el, revOptions);

		}

	}

	tag('a');

	tag('area');

},

tagOneAnchor: function(anchor, revOptions) {

	var that = this,

		isAnchor = !!anchor.getAttribute;

	if (isAnchor) {

		var a = {

			rel: anchor.getAttribute('rel'),

			rev: anchor.getAttribute('rev'),

			title: anchor.getAttribute('title'),

			anchor: anchor,

			thumb: this.getThumb(anchor)

		};

		var match;

		if (a.thumb && (match = /(?:^|\s)fbPop(up|down)(?:\s|$)/i.exec(anchor.className))) {

			var up = (match[1] === 'up');

			a.popup = true;

			a.thumb.style.borderWidth = this.zoomPopBorder + 'px';

			anchor.onmouseover = function () {

				a.thumb.style.display = 'none';

				var aPos = that.getLeftTop(this, true),

					aLeft = aPos.left,

					aTop = aPos.top;

				aPos = that.getLayout(this);

				a.thumb.style.display = '';

				var relLeft = (aPos.width - a.thumb.offsetWidth)/2,

					relTop = up ? 2 - a.thumb.offsetHeight : aPos.height,

					scroll = that.getScroll(),

					screenRight = scroll.left + that.getDisplayWidth();

				var spill = aPos.left + relLeft + a.thumb.offsetWidth - screenRight;

				if (spill > 0) relLeft -= spill;

				var spill = aPos.left + relLeft - scroll.left;

				if (spill < 0) relLeft -= spill;

				if (up) {

					if (aPos.top + relTop < scroll.top) relTop = aPos.height;

				} else {

					if (aPos.top + relTop + a.thumb.offsetHeight > scroll.top + that.getDisplayHeight()) relTop = 2 - a.thumb.offsetHeight;

				}

				a.thumb.style.left = (aLeft + relLeft) + 'px';

				a.thumb.style.top = (aTop + relTop) + 'px';

			};

			anchor.onmouseout = function () {

				a.thumb.style.left = '0';

				a.thumb.style.top = '-9999px';

			};

			if (!anchor.onclick) anchor.onclick = anchor.onmouseout;

		}

	} else {

		var a = anchor;

	}

	if (/^(floatbox|gallery|iframe|slideshow|lytebox|lyteshow|lyteframe|lightbox)/i.test(a.rel)) {

		a.revOptions = revOptions || this.parseOptionString(a.rev);

		a.href = a.revOptions.href || anchor.href || anchor.getAttribute('href');

		a.level = this.children.length + (fb.lastChild.fbBox && !a.revOptions.sameBox ? 1 : 0);

		var a_i, i = this.anchors.length;

		while (i--) {

			a_i = this.anchors[i];

			if (a_i.href === a.href && a_i.rel === a.rel && a_i.rev === a.rev && a_i.title === a.title && a_i.level === a.level) {

				a_i.anchor = anchor;

				break;

			}

		}

		if (i === -1) {

			a.type = a.revOptions.type || this.fileType(a.href);

			if (a.type === 'html') {

				a.type = 'iframe';

				var match = /#(\w+)/.exec(a.href);

				if (match) {

					var doc = document;

					if (a.anchor) {

						doc = a.anchor.ownerDocument || a.anchor.document || doc;

					}

					if (doc === document && this.currentItem && this.currentItem.anchor) {

						doc = this.currentItem.anchor.ownerDocument || this.currentItem.anchor.document || doc;

					}

					var el = doc.getElementById(match[1]);

					if (el) {

						a.type = 'inline';

						a.sourceEl = el;

					}

				}

			}

			this.anchors.push(a);

			if (this.autoHref) {

				if (a.revOptions.showThis !== false && this.autoHref === a.href.substr(a.href.length - this.autoHref.length)) this.autoStart = a;

			} else if (a.revOptions.autoStart === true) {

				this.autoStart = a;

			} else if (a.revOptions.autoStart === 'once') {

				var match = /fbAutoShown=(.+?)(?:;|$)/.exec(document.cookie),

					val = match ? match[1] : '',

					href = escape(a.href);

				if (val.indexOf(href) === -1) {

					this.autoStart = a;

					document.cookie = 'fbAutoShown=' + val + href + '; path=/';

				}

			}

		}

		if (isAnchor) {

			anchor.onclick = function(e) {

				e = e || window.event;

				if (this.ie && !e) {

					var iframes = self.frames, i = iframes.length;

					while (i-- && !e) {

						try {

							if (typeof iframes[i].window === 'object') e = iframes[i].window.event;

						} catch(err) {}

					}

				}

				if (!(e && (e.ctrlKey || e.metaKey || e.shiftKey)) || a.revOptions.showThis === false || !/img|iframe/.test(a.type)) {

					fb.start(this);

					if (this.ie && e) e.returnValue = false;

					return false;

				}

			};

		}

	}

	return a;

},

fileType: function(href) {

	var s = href.toLowerCase(),

		i = s.indexOf('?');

	if (i !== -1) s = s.substr(0, i);

	s = s.substr(s.lastIndexOf('.') + 1);

	if (/^(jpe?g|png|gif|bmp)$/.test(s)) return 'img';

	if (s === 'swf' || /^(http:)?\/\/(www.)?youtube.com\/v\//i.test(href)) return 'flash';

	if (/^(mov|mpe?g|movie)$/.test(s)) return 'quicktime';

	return 'html';

},

preloadImages: function(href, chain) {

	if (this !== fb) return fb.preloadImages(href, chain);

	if (typeof chain !== 'undefined') arguments.callee.chain = chain;

	if (!href && arguments.callee.chain && (this.preloadAll || !this.preloads.count)) {

		for (var i = 0, len = this.anchors.length; i < len; i++) {

			var a = this.anchors[i];

			if (a.type === 'img' && !this.preloads[a.href]) {

				href = a.href;

				break;

			}

		}

	}

	if (href) {

		if (this.preloads[href]) {

			this.preloadImages();

		} else {

			var img = this.preloads[href] = new Image();

			img.onerror = function() {

				setTimeout(function() { fb.preloadImages(); }, 50);

				fb.preloads[href] = true;

			};

			img.onload = function() {

				fb.preloads.count++;

				this.onerror();

			};

			img.src = href;

		}

	}

},

start: function(anchor) {

	if (this !== fb.lastChild) return fb.lastChild.start(anchor);

	var that = this;

	this.preloadImages('', false);

	if (anchor.getAttribute) {

		var a = {

			rel: anchor.getAttribute('rel'),

			rev: anchor.getAttribute('rev'),

			title: anchor.getAttribute('title')

		};

		a.revOptions = this.parseOptionString(a.rev);

		a.href = a.revOptions.href || anchor.href || anchor.getAttribute('href');

		anchor.blur();

	} else {

		var a = anchor;

	}

	this.isRestart = !!this.fbBox;

	if (this.isRestart) {

		if (!a.revOptions.sameBox) return new Floatbox().start(anchor);

		this.setOptions(a.revOptions);

	} else {

		this.clickedAnchor = anchor.getAttribute ? anchor : false;

	}

	a.level = this.children.length + (fb.lastChild.fbBox && !a.revOptions.sameBox ? 1 : 0);

	this.itemsShown = 0;

	fb.previousAnchor = this.currentItem;

	this.buildItemArray(a);

	if (!this.itemCount) return;

	if (this.itemCount === 1 && this.fbNavControls) this.fbNavControls.style.display = 'none';

	self.focus();

	this.revOptions = a.revOptions;

	if (!this.isRestart) {

		this.getOptions();

		this.buildDOM();

		this.addEventHandlers();

		this.initState();

	}

	this.collapse();

	this.updatePanels();

	var fetchAndGo = function() {

		that.fetchContent(function() {

			that.clearTimeout('slowLoad');

			that.calcSize();

		} );

	};

	if (this.fbBox.style.visibility  || this.isRestart) {

		fetchAndGo();

	} else {

		var offset = this.initialSize/2,

			size = { id: 'fbBox', left: that.pos.fbBox.left - offset, top: that.pos.fbBox.top - offset,

			width: that.initialSize, height: that.initialSize, borderWidth: that.outerBorder };

		if (this.splitResize) {

			var oncomplete = function() {

				that.setSize(fetchAndGo, size);

			};

		} else {

			this.timeouts.slowLoad = setTimeout(function() {

				that.setSize(size);

			}, this.slowLoadDelay);

			var oncomplete = fetchAndGo;

		}

		this.fadeOpacity(this.fbOverlay, this.overlayOpacity, this.overlayFadeDuration, oncomplete);

	}

},

buildItemArray: function(a) {

	this.itemCount = this.items.length = this.currentIndex = 0;

	this.justImages = true;

	this.hasImages = false;

	var isSingle = /^(floatbox|gallery|iframe|lytebox|lyteframe|lightbox)$/i.test(a.rel);

	for (var i = 0, len = this.anchors.length; i < len; i++) {

		var a_i = this.anchors[i];

		if (a_i.rel === a.rel && a_i.level === a.level) {

			if (a_i.revOptions.showThis !== false) {

				var isMatch = a_i.rev === a.rev && a_i.title === a.title && a_i.href === a.href.substr(a.href.length - a_i.href.length);

				if (isMatch || !isSingle) {

					a_i.seen = false;

					this.items.push(a_i);

					if (a_i.type === 'img') {

						this.hasImages = true;

					} else {

						this.justImages = false;

					}

					if (isMatch) this.currentIndex = this.items.length - 1;

				}

			}

		}

	}

	if (a.revOptions.showThis === false && a.href) {

		i = this.items.length;

		while (i--) {

			var href = this.items[i].href;

			if (href === a.href.substr(a.href.length - href.length)) {

				this.currentIndex = i;

			}

		}

	}

  	this.itemCount = this.items.length;

  	this.currentItem = this.items[this.currentIndex];

},

getOptions: function() {

	if (this.isChild) {

		for (var name in this.defaultOptions) {

			if (this.defaultOptions.hasOwnProperty(name)) this[name] = this.fbParent[name];

		}

		this.setOptions(this.childOptions);

	} else {

		this.setOptions(this.defaultOptions);

	}

	this.doSlideshow = this.loadPageOnClose = this.sameBox = false;

	if (!(this.isChild || this.fbBox)) {

		if (typeof setFloatboxOptions === 'function') setFloatboxOptions();

		if (typeof fbPageOptions === 'object') this.setOptions(fbPageOptions);

		if (this.enableCookies) {

			var match = /fbOptions=(.+?)(;|$)/.exec(document.cookie);

			if (match) this.setOptions(this.parseOptionString(match[1]));

			var strOptions = '';

			for (var name in this.defaultOptions) {

				if (this.defaultOptions.hasOwnProperty(name)) {

					strOptions += ' ' + name + ':' + this[name];

				}

			}

			var strPath = '/';

			if (this.cookieScope === 'folder') {

				strPath = location.pathname;

				strPath = strPath.substring(0, strPath.lastIndexOf('/') + 1);

			}

			document.cookie = 'fbOptions=' + strOptions + '; path=' + strPath;

		}

	}

	this.setOptions(this.revOptions);

	this.setOptions(this.parseOptionString(location.search.substring(1)));

	if (this.theme === 'grey') this.theme = 'white';

	if (this.endTask === 'cont') this.endTask = 'loop';

	if (this.navType === 'upper') this.navType = 'overlay';

	if (this.navType === 'lower') this.navType = 'button';

	if (this.upperOpacity) this.controlOpacity = this.upperOpacity;

	if (this.upperNavWidth) this.navOverlayWidth = this.upperNavWidth;

	if (this.upperNavPos) this.navOverlayPos = this.upperNavPos;

	if (this.showUpperNav) this.showNavOverlay = this.showUpperNav;

	if (this.dropShadow) this.shadowType = 'drop';

	if (!/^(auto|black|white|blue|yellow|red|custom)$/.test(this.theme)) this.theme='auto';

	if (!/^(overlay|button|both|none)$/i.test(this.navType)) this.navType = 'button';

	if (!/^(auto|wh|hw)$/.test(this.splitResize)) this.splitResize = false;

	if (this.webkitOld && (this.navType === 'overlay' || this.navType === 'both') ) {

		this.navType = 'button';

	}

	if (this.itemCount > 1) {

		this.isSlideshow = this.doSlideshow || /^(slideshow|lyteshow)/i.test(this.currentItem.rel);

		var overlayRequest = /overlay|both/i.test(this.navType),

			buttonRequest = /button|both/i.test(this.navType);

		this.navOverlay = this.justImages && overlayRequest;

		this.navButton = buttonRequest || (!this.justImages && overlayRequest);

		this.lclShowItemNumber = this.showItemNumber;

		this.lclNumIndexLinks = this.numIndexLinks;

	} else {

		this.isSlideshow = this.navOverlay = this.navButton = this.lclShowItemNumber = this.lclNumIndexLinks = false;

	}

	this.isPaused = this.startPaused;

	if ((this.lclTheme = this.theme) === 'auto') {

		this.lclTheme = this.currentItem.type === 'img' ? 'black' : /flash|quicktime/.test(this.currentItem.type) ? 'blue' : 'white';

	}

	if (!this.doAnimations) {

		this.resizeDuration = this.imageFadeDuration = this.overlayFadeDuration = 0;

	}

	if (!this.resizeDuration) this.zoomImageStart = false;

	if (!/[tb][lr]/.test(this.controlPos)) this.controlPos = '';

	if (!/[tb][lcr]/.test(this.infoPos)) this.infoPos = '';

	this.controlTop = this.controlPos.charAt(0) === 't';

	this.controlLeft = this.controlPos.charAt(1) === 'l';

	this.infoTop = this.infoPos.charAt(0) === 't';

	this.infoCenter = this.infoPos.charAt(1) === 'c';

	this.infoLeft = this.infoPos.charAt(1) === 'l' || (this.infoCenter && this.controlTop === this.infoTop && !this.controlLeft);

	if (this.infoLeft === this.controlLeft && this.infoTop === this.controlTop) {

		this.infoLeft = true;

		this.controlLeft = false;

	}

	if (this.indexLinksPanel === 'info') {

		this.indexCenter = this.infoCenter;

		this.indexLeft = this.infoLeft;

		this.indexTop = this.infoTop;

	} else {

		this.indexLeft = this.controlLeft;

		this.indexTop = this.controlTop;

	}

	if (!/^(drop|halo|none)$/.test(this.shadowType)) this.shadowType='drop';

	if (!/^(8|12|16|24)$/.test(this.shadowSize + '')) this.shadowSize = 8;

	this.shadowSize = +this.shadowSize;

	if (this.opera || (this.mac && !this.webkitNew)) {

		this.resizeTool = 'topleft';

	} else {

		this.resizeTool = this.resizeTool.toLowerCase();

		if (!/topleft|cursor|both/.test(this.resizeTool)) this.resizeTool = 'cursor';

	}

	if (this.ieOld) this.shadowType = 'none';

	if (this.padding + this.outerBorder === 0) this.zoomPopBorder = 0;

	if (this.overlayOpacity > 1) this.overlayOpacity /= 100;

	if (this.controlOpacity > 1) this.controlOpacity /= 100;

},

parseOptionString: function(str) {

	if (!str) return {};

	var quotes = [], match,

		rex = /`([^`]*?)`/g;

	while ((match = rex.exec(str))) quotes.push(match[1]);

	if (quotes.length) str = str.replace(rex, '``');

	str = str.replace(/\s*[:=]\s*/g, ':');

	str = str.replace(/\s*[;&]\s*/g, ' ');

	str = str.replace(/^\s+|\s+$/g, '');

	var pairs = {},

		aVars = str.split(' '),

		i = aVars.length;

	while (i--) {

		var aThisVar = aVars[i].split(':'),

			name = aThisVar[0],

			value = aThisVar[1];

		if (typeof value === 'string') {

			if (!isNaN(value)) value = +value;

			else if (value === 'true') value = true;

			else if (value === 'false') value = false;

		}

		if (value === '``') value = quotes.pop() || '';

		pairs[name] = value;

	}

	return pairs;

},

setOptions: function(pairs) {

	for (var name in pairs) {

		if (pairs.hasOwnProperty(name)) this[name] = pairs[name];

	}

},

buildDOM: function() {

	this.fbOverlay		= this.newNode('div', 'fbOverlay', this.bod);

	this.fbZoomDiv		= this.newNode('div', 'fbZoomDiv', this.bod);

	this.fbZoomImg		= this.newNode('img', 'fbZoomImg', this.fbZoomDiv);

	this.fbBox			= this.newNode('div', 'fbBox');

	this.fbShadowTop	= this.newNode('div', 'fbShadowTop', this.fbBox);

	this.fbShadowRight	= this.newNode('div', 'fbShadowRight', this.fbBox);

	this.fbShadowBottom	= this.newNode('div', 'fbShadowBottom', this.fbBox);

	this.fbShadowLeft	= this.newNode('div', 'fbShadowLeft', this.fbBox);

	this.fbShadowCorner	= this.newNode('div', 'fbShadowCorner', this.fbBox);

	this.fbLoader		= this.newNode('div', 'fbLoader', this.fbBox);

	this.fbCanvas		= this.newNode('div', 'fbCanvas', this.fbBox);

	this.fbMainDiv		= this.newNode('div', 'fbMainDiv', this.fbCanvas);

	this.fbLeftNav		= this.newNode('a', 'fbLeftNav', this.fbMainDiv);

	this.fbRightNav		= this.newNode('a', 'fbRightNav', this.fbMainDiv);

	this.fbOverlayPrev	= this.newNode('a', 'fbOverlayPrev', this.fbMainDiv, this.strings.hintPrev);

	this.fbOverlayNext	= this.newNode('a', 'fbOverlayNext', this.fbMainDiv, this.strings.hintNext);

	this.fbResizer		= this.newNode('a', 'fbResizer', this.fbMainDiv, this.strings.hintResize);

	this.fbInfoPanel	= this.newNode('div', 'fbInfoPanel', this.fbCanvas);

	this.fbCaptionDiv	= this.newNode('div', 'fbCaptionDiv', this.fbInfoPanel);

	this.fbCaption		= this.newNode('span', 'fbCaption', this.fbCaptionDiv);

	this.fbInfoDiv		= this.newNode('div', 'fbInfoDiv', this.fbInfoPanel);

	if (this.infoLeft || this.infoCenter) {

		this.fbInfoLink		= this.newNode('span', 'fbInfoLink', this.fbInfoDiv);

		this.fbPrintLink	= this.newNode('span', 'fbPrintLink', this.fbInfoDiv);

		this.fbItemNumber	= this.newNode('span', 'fbItemNumber', this.fbInfoDiv);

	} else {

		this.fbItemNumber	= this.newNode('span', 'fbItemNumber', this.fbInfoDiv);

		this.fbPrintLink	= this.newNode('span', 'fbPrintLink', this.fbInfoDiv);

		this.fbInfoLink		= this.newNode('span', 'fbInfoLink', this.fbInfoDiv);

	}

	this.fbControlPanel	= this.newNode('div', 'fbControlPanel', this.fbCanvas);

	this.fbControls		= this.newNode('div', 'fbControls', this.fbControlPanel);

	this.fbNavControls	= this.newNode('div', 'fbNavControls', this.fbControls);

	this.fbPrev			= this.newNode('a', 'fbPrev', this.fbNavControls, this.strings.hintPrev);

	this.fbNext			= this.newNode('a', 'fbNext', this.fbNavControls, this.strings.hintNext);

	this.fbSubControls	= this.newNode('div', 'fbSubControls', this.fbControls);

	this.fbPlayPause	= this.newNode('div', 'fbPlayPause', this.fbSubControls);

	this.fbPlay			= this.newNode('a', 'fbPlay', this.fbPlayPause, this.strings.hintPlay);

	this.fbPause		= this.newNode('a', 'fbPause', this.fbPlayPause, this.strings.hintPause);

	this.fbClose		= this.newNode('a', 'fbClose', this.fbSubControls, this.strings.hintClose);

	this.fbIndexLinks	= this.newNode('span', 'fbIndexLinks', this.indexLinksPanel === 'info' ? this.fbInfoPanel : this.fbControlPanel);

	this.bod.appendChild(this.fbBox);

},

newNode: function(nodeType, id, parentNode, title) {

	if (this[id] && this[id].parentNode) {

		this[id].parentNode.removeChild(this[id]);

	}

	var node = document.createElement(nodeType);

	node.id = id;

	node.className = id + '_' + (id.indexOf('fbShadow') === -1 ? this.lclTheme : this.shadowType + this.shadowSize);

	if (nodeType === 'a') {

		if (!this.operaOld) node.setAttribute('href', '');

		if (this.ieOld) node.setAttribute('hideFocus', 'true');

		node.style.outline = 'none';

	} else if (nodeType === 'iframe') {

		node.setAttribute('scrolling', this.itemScroll);

		node.setAttribute('frameBorder', '0');

		node.setAttribute('align', 'middle');

		node.src = this.iframeSrc;

	}

	if (this.isChild && this.fbParent[id]) title = this.fbParent[id].getAttribute('title');

	if (title && this.showHints !== 'never') node.setAttribute('title', title);

	if (this.zIndex[id]) node.style.zIndex = this.zIndex.base + this.zIndex[id];

	node.style.display = 'none';

	if (parentNode) parentNode.appendChild(node);

	this.nodeNames.push(id);

	return node;

},

addEventHandlers: function() {

	var that = this,

	leftNav = this.fbLeftNav.style,

	rightNav = this.fbRightNav.style,

	overlayPrev = this.fbOverlayPrev.style,

	overlayNext = this.fbOverlayNext.style,

	prev = this.fbPrev.style,

	next = this.fbNext.style;

	if (this.showHints === 'once') {

		this.hideHint = function(id) {

			if (that[id].title) {

				that.timeouts[id] = setTimeout(function() {

					that[id].title = that.fbParent[id].title = '';

					var id2 = '';

					if (/fbOverlay(Prev|Next)/.test(id)) {

						id2 = id.replace('Overlay', '');

					} else if (/fb(Prev|Next)/.test(id)) {

						id2 = id.replace('fb', 'fbOverlay');

					}

					if (id2) that[id2].title = that.fbParent[id2].title = '';

				}, that.showHintsTime);

			}

		};

	} else {

		this.hideHint = function() {};

	}

	this.fbPlay.onclick = function() {

		that.setPause(false);

		if (window.event) event.returnValue = false;

		return false;

	};

	this.fbPause.onclick = function() {

		that.setPause(true);

		if (window.event) event.returnValue = false;

		return false;

	};

	this.fbClose.onclick = function() {

		that.end();

		if (window.event) event.returnValue = false;

		return false;

	};

	if (this.outsideClickCloses) {

		this.fbOverlay.onclick = this.fbShadowTop.onclick = this.fbShadowRight.onclick =

		this.fbShadowBottom.onclick = this.fbShadowLeft.onclick = this.fbShadowCorner.onclick = this.fbClose.onclick;

	}

	this[this.rtl ? 'fbNext' : 'fbPrev'].onclick = function(step) {

		if (typeof step !== 'number') step = 1;

		var newIndex = (that.currentIndex - step) % that.itemCount;

		if (newIndex < 0) newIndex += that.itemCount;

		if (that.enableWrap || newIndex < that.currentIndex) {

			that.newContent(newIndex);

			if (that.isSlideshow && that.pauseOnPrev && !that.isPaused) {

				that.setPause(true);

			}

		}

		if (window.event) event.returnValue = false;

		return false;

	};

	this[this.rtl ? 'fbPrev' : 'fbNext'].onclick = function(step) {

		if (typeof step !== 'number') step = 1;

		var newIndex = (that.currentIndex + step) % that.itemCount;

		if (that.enableWrap || newIndex > that.currentIndex) {

			that.newContent(newIndex);

			if (that.isSlideshow && that.pauseOnNext && !that.isPaused) {

				that.setPause(true);

			}

		}

		if (window.event) event.returnValue = false;

		return false;

	};

	this.fbLeftNav.onclick = this.fbOverlayPrev.onclick = this.fbPrev.onclick;

	this.fbRightNav.onclick = this.fbOverlayNext.onclick = this.fbNext.onclick;

	this.fbLeftNav.onmouseover = this.fbLeftNav.onmousemove =

	this.fbOverlayPrev.onmousemove = function() {

		if (!that.timeouts.fbCanvas) overlayPrev.visibility = '';

		if (that.navButton) prev.backgroundPosition = that.onPos;

		return true;

	};

	this.fbRightNav.onmouseover = this.fbRightNav.onmousemove =

	this.fbOverlayNext.onmousemove = function() {

		if (!that.timeouts.fbCanvas) overlayNext.visibility = '';

		if (that.navButton) next.backgroundPosition = that.onPos;

		return true;

	};

	this.fbOverlayPrev.onmouseover = this.fbOverlayNext.onmouseover = function() {

		this.onmousemove();

		that.hideHint(this.id);

		return true;

	};

	this.fbLeftNav.onmouseout = function() {

		overlayPrev.visibility = 'hidden';

		if (that.navButton) prev.backgroundPosition = that.offPos;

	};

	this.fbRightNav.onmouseout = function() {

		overlayNext.visibility = 'hidden';

		if (that.navButton) next.backgroundPosition = that.offPos;

	};

	this.fbOverlayPrev.onmouseout = this.fbOverlayNext.onmouseout = function() {

		this.style.visibility = 'hidden';

		that.clearTimeout(this.id);

	};

	this.fbLeftNav.onmousedown = this.fbRightNav.onmousedown = function(e) {

		e = e || window.event;

		if (e.button === 2) {

			leftNav.visibility = rightNav.visibility = 'hidden';

			that.timeouts.hideNavOverlay = setTimeout(function() {

				leftNav.visibility = rightNav.visibility = '';

			}, 600);

		}

	};

	this.fbPlay.onmouseover = this.fbPause.onmouseover = this.fbClose.onmouseover =

	this.fbPrev.onmouseover = this.fbNext.onmouseover = function() {

		this.style.backgroundPosition = that.onPos;

		that.hideHint(this.id);

		return true;

	};

	this.fbResizer.onmouseover = function() {

		that.hideHint(this.id);

		return true;

	};

	this.fbPlay.onmouseout = this.fbPause.onmouseout = this.fbClose.onmouseout =

	this.fbPrev.onmouseout = this.fbNext.onmouseout = function() {

		this.style.backgroundPosition = that.offPos;

		that.clearTimeout(this.id);

	};

	this.fbResizer.onmouseout = function() {

		that.clearTimeout(this.id);

	};

	if (this.enableKeyboardNav) {

		if (!document.keydownSet) {

			this.priorOnkeydown = document.onkeydown;

			document.onkeydown = this.keydownHandler;

			document.keydownSet = true;

		}

	} else if (document.keydownSet) {

		document.onkeydown = this.priorOnkeydown;

		document.keydownSet = false;

	}

	if (this.opera && !document.keypressSet) {

		this.priorOnkeypress = document.onkeypress;

		document.onkeypress = function() { return false; };

		document.keypressSet = true;

	}

	if (this.enableDrag) this.fbBox.onmousedown = this.dragonDrop();

},

keydownHandler: function(e) {

	e = e || window.event;

	var that = fb.lastChild,

		keyCode = e.keyCode || e.which;

	switch (keyCode) {

		case 37: case 39:

			if (that.itemCount > 1) {

				that[keyCode === 37 ? 'fbPrev' : 'fbNext'].onclick((e.ctrlKey || e.metaKey) ? that.ctrlJump : 1);

				if (that.showHints === 'once') {

					that.fbPrev.title = that.fbNext.title =

					that.fbOverlayPrev.title = that.fbOverlayNext.title = '';

				}

			}

			return false;

		case 32:

			if (that.isSlideshow) {

				that.setPause(!that.isPaused);

				if (that.showHints === 'once') that.fbPlay.title = that.fbPause.title = '';

			}

			return false;

		case 9:

			if (that.fbResizer.onclick) {

				that.fbResizer.onclick();

				if (that.showHints === 'once') that.fbResizer.title = '';

			}

			return false;

		case 27:

			if (that.showHints === 'once') that.fbClose.title = '';

			that.end();

			return false;

		case 13:

			return false;

	}

},

dragonDrop: function() {

	var that = this,

		fbBox = this.fbBox;

	return function(e) {

		e = e || window.event;

		if (/fb(Box|Canvas|Info|Caption|Item|Control|Index)/.test((e.target || e.srcElement).id)) {

			var startX = e.clientX,

				startY = e.clientY,

				box = that.fbBox.style,

				content = that.fbContent.style,

				pos = that.pos.fbBox,

				boxX = pos.left,

				boxY = pos.top;

			pos.dx = pos.dy = 0;

			var moveHandler = function(e) {

				if (that.currentItem.type === 'iframe' && !(that.ie || that.opera) && !content.visibility) content.visibility = 'hidden';

				if (that.isSlideshow && !that.isPaused) that.setPause(true);

				e = e || window.event;

				pos.dx = e.clientX - startX;

				pos.dy = e.clientY - startY;

				box.left = (boxX + pos.dx) + 'px';

				box.top = (boxY + pos.dy) + 'px';

				(e.stopPropagation && e.stopPropagation()) || (e.cancelBubble = true);

				that.clearTimeout('dragonDrop');

				that.timeouts.dragonDrop = setTimeout(upHandler, 1500);

				return false;

			};

			var upHandler = function(e) {

				that.clearTimeout('dragonDrop');

				e = e || window.event;

				if (document.removeEventListener) {

					document.removeEventListener("mouseup", upHandler, true);

					document.removeEventListener("mousemove", moveHandler, true);

				} else if (fbBox.detachEvent) {

					fbBox.detachEvent("onlosecapture", upHandler);

					fbBox.detachEvent("onmouseup", upHandler);

					fbBox.detachEvent("onmousemove", moveHandler);

					fbBox.releaseCapture();

				}

				if (e) (e.stopPropagation && e.stopPropagation()) || (e.cancelBubble = true);

				pos.left += pos.dx;

				pos.top += pos.dy;

				content.visibility = '';

				return false;

			};

			if (document.addEventListener) {

				document.addEventListener("mousemove", moveHandler, true);

				document.addEventListener("mouseup", upHandler, true);

			} else if (fbBox.attachEvent) {

				fbBox.setCapture();

				fbBox.attachEvent("onmousemove", moveHandler);

				fbBox.attachEvent("onmouseup", upHandler);

				fbBox.attachEvent("onlosecapture", upHandler);

			}

			return false;

		}

	};

},

initState: function() {

	var that = this,

		box = this.fbBox.style,

		mainDiv = this.fbMainDiv.style,

		canvas = this.fbCanvas.style,

		zoomDiv = this.fbZoomDiv.style,

		zoomImg = this.fbZoomImg.style;

	if (this.currentItem.popup) this.currentItem.anchor.onmouseover();

	var anchorPos = this.getAnchorPos(this.clickedAnchor, this.currentItem.anchor === this.clickedAnchor && this.currentItem.type === 'img');

	if (anchorPos.width) {

		this.pos.fbZoomDiv = anchorPos;

		zoomDiv.borderWidth = this.zoomPopBorder + 'px';

		zoomDiv.left = (anchorPos.left - this.zoomPopBorder) + 'px';

		zoomDiv.top = (anchorPos.top - this.zoomPopBorder) + 'px';

		zoomDiv.width = (this.fbZoomImg.width = anchorPos.width) + 'px';

		zoomDiv.height = (this.fbZoomImg.height = anchorPos.height) + 'px';

		this.fbZoomImg.src = anchorPos.src;

		box.visibility = 'hidden';

		this.timeouts.slowLoad = setTimeout(function() {

			if (that.fbOverlay.style.display) that.fadeOpacity(that.fbOverlay, that.overlayOpacity, that.overlayFadeDuration);

			that.fbZoomImg.src = that.slowZoomImg;

			zoomDiv.display = zoomImg.display = '';

		}, this.slowLoadDelay);

	} else {

		this.pos.fbBox = anchorPos;

		this.pos.fbBox.borderWidth = 0;

		this.pos.fbMainDiv = { width:0, height:0 };

	}

	box.position = 'absolute';

	box.left = box.top = box.width = box.height = box.borderWidth = '0';

	mainDiv.borderWidth = this.innerBorder + 'px';

	mainDiv.left = this.padding + 'px';

	this.fbControlPanel.style[this.controlLeft ? 'left' : 'right'] =

	this.fbInfoPanel.style[this.infoLeft ? 'left' : 'right'] = Math.max(this.padding, this.panelPadding) + 'px';

	canvas.visibility = 'hidden';

	box.display = canvas.display = '';

	if (this.shadowType === 'none') {

		this.shadowSize = 0;

	} else {

		var shadowTop = this.fbShadowTop.style,

			shadowRight = this.fbShadowRight.style,

			shadowBottom = this.fbShadowBottom.style,

			shadowLeft = this.fbShadowLeft.style,

			shadowCorner = this.fbShadowCorner.style;

		shadowRight.top = shadowBottom.left = shadowLeft.top = -this.outerBorder + 'px';

		shadowRight.paddingRight = shadowBottom.paddingBottom =

		shadowCorner.paddingRight = shadowCorner.paddingBottom = (this.outerBorder + this.shadowSize) + 'px';

		if (this.shadowType === 'halo') {

			shadowTop.paddingRight = shadowRight.paddingBottom =

			shadowBottom.paddingRight = shadowLeft.paddingBottom = (this.outerBorder*2 + this.shadowSize) + 'px';

			shadowTop.top = shadowTop.left = shadowRight.top = shadowLeft.left = -(this.outerBorder + this.shadowSize) + 'px';

		} else {

			shadowBottom.backgroundPosition = 'bottom left';

			shadowRight.paddingBottom = shadowBottom.paddingRight = this.outerBorder*2 + 'px';

		}

	}

	if (this.navOverlay) {

		if (fb.showNavOverlay === 'never' || (fb.showNavOverlay === 'once' && fb.navOverlayShown)) {

			fb.showNavOverlay = false;

		} else {

			this.fbOverlayPrev.style.backgroundPosition = this.fbOverlayNext.style.backgroundPosition = this.onPos;

			this.fadeOpacity(this.fbOverlayPrev, this.controlOpacity);

			this.fadeOpacity(this.fbOverlayNext, this.controlOpacity);

		}

	}

	this.initPanels();

	this.lastShown = false;

	if (this.hideFlash) this.hideElements('flash');

	if (this.hideJava) this.hideElements('applet');

	if (this.ieOld) {

		this.hideElements('select');

		this.fbOverlay.style.position = 'absolute';

		this.stretchOverlay()();

		attachEvent('onresize', this.stretchOverlay());

		attachEvent('onscroll', this.stretchOverlay());

	}

},

hideElements: function(type, thisWindow) {

	if (!thisWindow) {

		this.hideElements(type, self);

	} else {

		var tagName, tagNames = type === 'flash' ? ['object', 'embed'] : [type];

		try {

			while ((tagName = tagNames.pop())) {

				var els = thisWindow.document.getElementsByTagName(tagName),

					i = els.length;

				while (i--) {

					var el = els[i];

					if (el.style.visibility !== 'hidden' && (tagName !== 'object' ||

					(el.getAttribute('type') && el.getAttribute('type').toLowerCase() === 'application/x-shockwave-flash') ||

					(el.getAttribute('classid') && el.getAttribute('classid').toLowerCase() === 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000') ||

					/data\s*=\s*"?[^>"]+\.swf\b/i.test(el.innerHTML) ||

					/param\s+name\s*=\s*"?(movie|src)("|\s)[^>]+\.swf\b/i.test(el.innerHTML))) {

						this.hiddenEls.push(el);

						el.style.visibility = 'hidden';

					}

				}

			}

		} catch(e) {}

		var iframes = thisWindow.frames, i = iframes.length;

		while (i--) {

			try {

				if (typeof iframes[i].window === 'object') this.hideElements(type, iframes[i].window);

			} catch(e) {}

		}

	}

},

getAnchorPos: function(anchor, useThumb) {

	var display = this.getDisplaySize(),

		scroll = this.getScroll(),

		noAnchorPos = { left: display.width/2 + scroll.left, top: display.height/3 + scroll.top, width: 0, height: 0 };

	var thumb = useThumb ? this.getThumb(anchor) : false;

	if (thumb && this.zoomImageStart) {

		var pos = this.getLeftTop(thumb),

			border = (thumb.offsetWidth - thumb.width)/2;

		pos.left += border;

		pos.top += border;

		pos.width = thumb.width;

		pos.height = thumb.height;

		pos.src = thumb.src;

	} else if (this.startAtClick && anchor && anchor.offsetWidth && anchor.tagName.toLowerCase() === 'a') {

		var pos = this.getLayout(thumb || anchor);

	} else {

		return noAnchorPos;

	}

	var centerPos = { left: pos.left + pos.width/2, top: pos.top + pos.height/2, width: 0, height: 0 };

	if (centerPos.left < scroll.left || centerPos.left > (scroll.left + display.width) ||

	centerPos.top < scroll.top || centerPos.top > (scroll.top + display.height)) {

		return noAnchorPos;

	}

	return (thumb && this.zoomImageStart ? pos : centerPos);

},

getThumb: function(anchor) {

	var nodes = anchor && anchor.childNodes, i = (nodes && nodes.length) || 0;

	while (i--) {

		if ((nodes[i].tagName || '').toLowerCase() === 'img') return nodes[i];

	}

	return false;

},

initPanels: function() {

	var infoPanel = this.fbInfoPanel.style,

		infoLink = this.fbInfoLink.style,

		printLink = this.fbPrintLink.style,

		itemNumber = this.fbItemNumber.style;

	if (this.infoCenter) {

		var infoPos = ' posCenter';

		infoPanel.textAlign = 'center';

		infoLink.paddingLeft = printLink.paddingLeft = itemNumber.paddingLeft =

		infoLink.paddingRight = printLink.paddingRight = itemNumber.paddingRight = (this.infoLinkGap/2) + 'px';

	} else if (this.infoLeft) {

		var infoPos = ' posLeft';

		infoPanel.textAlign = 'left';

		infoLink.paddingRight = printLink.paddingRight = this.infoLinkGap + 'px';

	} else {

		var infoPos = ' posRight';

		infoPanel.textAlign = 'right';

		infoLink.paddingLeft = printLink.paddingLeft = this.infoLinkGap + 'px';

	}

	this.fbInfoPanel.className += infoPos;

	this.fbInfoDiv.className += infoPos;

	infoPanel.width = '400px';

	var controlPanel = this.fbControlPanel.style,

		controls = this.fbControls.style,

		subControls = this.fbSubControls.style;

	if (this.controlLeft) {

		var controlPos = ' posLeft';

		controlPanel.textAlign = 'left';

	} else {

		var controlPos = ' posRight';

		controlPanel.textAlign = 'right';

		controls.right = '0';

	}

	this.fbControlPanel.className += controlPos;

	this.fbSubControls.className += controlPos;

	if (!this.ieOld) this.fbControls.className += controlPos;

	if (this.navButton) {

		var prev = this.fbPrev.style,

			next = this.fbNext.style,

			navControls = this.fbNavControls.style;

		prev.backgroundPosition = next.backgroundPosition = this.offPos;

		navControls['padding' + (this.controlLeft ? 'Left' : 'Right')] = this.controlSpacing + 'px';

		this.fbNavControls.className += controlPos;

		controlPanel.display = navControls.display = prev.display = next.display = '';

	}

	var width = 0;

	if (this.showClose) {

		var close = this.fbClose.style;

		close.backgroundPosition = this.offPos;

		this.fbClose.className += controlPos;

		controlPanel.display = controls.display = subControls.display = close.display = '';

		width = this.fbClose.offsetWidth;

	}

	if (this.showPlayPause && this.isSlideshow) {

		var play = this.fbPlay.style,

			pause = this.fbPause.style,

			playPause = this.fbPlayPause.style;

		play.backgroundPosition = pause.backgroundPosition = this.offPos;

		playPause['padding' + (this.controlLeft ? 'Left' : 'Right')] = this.controlSpacing + 'px';

		this.fbPlayPause.className += controlPos;

		controlPanel.display = controls.display = subControls.display = playPause.display = play.display = pause.display = '';

		play.top = this.isPaused ? '' : '-9999px';

		pause.top = this.isPaused ? '-9999px' : '';

		width += this.fbPlayPause.offsetWidth;

	}

	subControls.width = width + 'px';

	controlPanel.width = controls.width = (width + this.fbNavControls.offsetWidth) + 'px';

	if (this.lclNumIndexLinks) {

		var indexLinks = this.fbIndexLinks.style;

		if (this.indexLinksPanel === 'info') {

			this.fbIndexLinks.className += infoPos;

			infoPanel.display = '';

			if (this.showIndexThumbs) infoPanel.overflow = 'visible';

		} else {

			this.fbIndexLinks.className += controlPos;

			controlPanel.display = '';

			if (this.showIndexThumbs) controlPanel.overflow = 'visible';

			indexLinks['padding' + (this.indexLeft ? 'Left' : 'Right')] = '2px';

		}

		indexLinks.width = '250px';

		indexLinks.display = '';

	}

},

fetchContent: function(callback, phase) {

	var that = this;

	if (!phase) {

		if (this.fbContent) {

			this.fbMainDiv.removeChild(this.fbContent);

			delete this.fbContent;

			return this.timeouts.fetch = setTimeout(function() { that.fetchContent(callback, 1); }, 10);

		}

	}

	var item = this.currentItem;

	item.nativeWidth = item.revOptions.width;

	item.nativeHeight = item.revOptions.height;

	if (item.type !== 'img') {

		item.nativeWidth = item.nativeWidth || (fb.previousAnchor && fb.previousAnchor.nativeWidth) || this.defaultWidth;

		item.nativeHeight = item.nativeHeight || (fb.previousAnchor && fb.previousAnchor.nativeHeight) || this.defaultHeight;

	}

	if (this.ieOld) this.fbMainDiv.style.backgroundColor = item.type === 'img' ? '#000' : '';

	this.itemScroll = item.revOptions.scrolling || item.revOptions.scroll || 'auto';

	if (/img|iframe/.test(item.type)) {

		this.fbContent = this.newNode(item.type, 'fbContent', this.fbMainDiv);

		if (item.type === 'img') {

			var loader = new Image();

			loader.onload = function() {

				item.nativeWidth = item.nativeWidth || loader.width;

				item.nativeHeight = item.nativeHeight || loader.height;

				that.fbContent.src = loader.src;

				if (callback) callback();

			};

			loader.onerror = function() {

				if (this.src !== that.notFoundImg) this.src = that.notFoundImg;

			};

			loader.src = item.href;

		}

	} else {

		this.fbContent = this.newNode('div', 'fbContent', this.fbMainDiv);

		this.fbContent.style.overflow = this.itemScroll === 'yes' ? 'scroll' : (this.itemScroll === 'no' ? 'hidden' : 'auto');

		if (item.type === 'inline') {

			var el = item.sourceEl.cloneNode(true);

			el.style.display = el.style.visibility = '';

			try { this.fbContent.appendChild(el); }

			catch(e) { this.setInnerHTML(this.fbContent, el.innerHTML); }

			this.tagAnchors(this.fbContent);

		} else if (item.type === 'ajax') {

			this.xhr.getResponse(item.href, function(xhr) {

				if ((xhr.status === 200 || xhr.status === 203 || xhr.status === 304) && xhr.responseText) {

					that.setInnerHTML(that.fbContent, xhr.responseText);

					that.tagAnchors(that.fbContent);

				} else {

					that.setInnerHTML(that.fbContent, '<p style="color:#000; background:#fff; margin:1em; padding:1em;">' +

					'Unable to fetch content from ' + item.href + '</p>');

				}

			});

		}

	}

	this.fbContent.style.border = '0';

	this.fbContent.style.display = '';

	if (item.type !== 'img' && callback) callback();

},

updatePanels: function() {

	var infoPanel = this.fbInfoPanel.style,

		captionDiv = this.fbCaptionDiv.style,

		caption = this.fbCaption.style,

		infoDiv = this.fbInfoDiv.style,

		infoLink = this.fbInfoLink.style,

		printLink = this.fbPrintLink.style,

		itemNumber = this.fbItemNumber.style,

		item = this.currentItem,

		str;

	infoPanel.display = captionDiv.display = caption.display = infoDiv.display = infoLink.display = printLink.display = itemNumber.display = 'none';

	if (this.showCaption) {

		str = item.revOptions.caption || item.title || '';

		if (str === 'href') {

			str = this.encodeHTML(this.currentItem.href);

		} else {

		//	str = this.decodeHTML(str).replace(/&/g, '&amp;');

		}

		if (this.setInnerHTML(this.fbCaption, str) && str) infoPanel.display = captionDiv.display = caption.display = '';

	}

	if (item.revOptions.info) {

		str = this.encodeHTML(this.decodeHTML(item.revOptions.info));

		var options = item.revOptions.infoOptions || '';

		if (options) options = this.encodeHTML(this.decodeHTML(options));

		str = '<a href="' + str + '" rel="floatbox" rev="' + options + '"><b>' +

		(item.revOptions.infoText || this.strings.infoText) + '</b></a>';

		if (this.setInnerHTML(this.fbInfoLink, str)) infoPanel.display = infoDiv.display = infoLink.display = '';

	}

	if (item.revOptions.showPrint) {

		var css = item.revOptions.printCSS || '';

		str = '<a href="' + this.encodeHTML(this.currentItem.href) +

		'" onclick="fb.printContents(null, \'' + css + '\'); if (window.event) event.returnValue = false; return false;"><b>' +

		(item.revOptions.printText || this.strings.printText) + '</b></a>';

		if (this.setInnerHTML(this.fbPrintLink, str)) infoPanel.display = infoDiv.display = printLink.display = '';

	}

	if (this.lclShowItemNumber) {

		str = this.justImages ? this.strings.imgCount : (this.hasImages ? this.strings.mixedCount : this.strings.nonImgCount);

		str = str.replace('%1', this.currentIndex + 1);

		str = str.replace('%2', this.itemCount);

		if (this.setInnerHTML(this.fbItemNumber, str)) infoPanel.display = infoDiv.display = itemNumber.display = '';

	}

	var w = this.fbInfoLink.offsetWidth + this.fbPrintLink.offsetWidth + this.fbItemNumber.offsetWidth;

	if (this.ie) {

		if (this.fbInfoLink.offsetWidth) w += this.infoLinkGap;

		if (this.fbPrintLink.offsetWidth) w += this.infoLinkGap;

		if (this.fbItemNumber.offsetWidth) w += this.infoLinkGap;

	}

	infoDiv.width = w + 'px';

	if (this.lclNumIndexLinks) {

		str = '';

		var max = this.itemCount - 1,

			loRange, hiRange;

		if (this.lclNumIndexLinks === -1) {

			loRange = 0;

			hiRange = max;

		} else {

			var range = Math.floor(this.lclNumIndexLinks/2) - 1;

			loRange = this.currentIndex - range;

			hiRange = this.currentIndex + range;

			if (loRange <= 0) hiRange += Math.min(1 - loRange, range);

			if (this.currentIndex === 0) hiRange++;

			if (hiRange - max >= 0) loRange -= Math.min(1 + hiRange - max, range);

			if (this.currentIndex === max) loRange--;

		}

		var pos = this.indexTop ? 'down' : 'up',

			i = 0;

		while (i < this.itemCount) {

			if (i !== 0 && i < loRange) {

				str += '... ';

				i = loRange;

			} else if (i !== max && i > hiRange) {

				str += '... ';

				i = max;

			} else {

				if (i !== this.currentIndex) {

					var item = this.items[i];

					str += '<a class="fbPop' + pos + '" rel="nofloatbox" href="' + item.href +

					'" onclick="fb.newContent(' + i + '); if (window.event) event.returnValue = false; return false;">' + ++i;

					try {

						if (this.showIndexThumbs && item.thumb) {

							str += '<img src="' + item.thumb.src + '" />';

						}

					} catch(e) {}

					str += '</a> ';

				} else {

					str += ++i + ' ';

				}

			}

		}

		if (this.setInnerHTML(this.fbIndexLinks, str)) {

			if (this.indexLinksPanel === 'info') {

				infoPanel.display = '';

			} else {

				this.tagAnchors(this.fbIndexLinks);

			}

		}

	}

	if (!infoPanel.display) this.tagAnchors(this.fbInfoPanel);

},

calcSize: function(fit, pass) {

	var that = this;

	if (!this.fbBox) return;

	var boxX, boxY, boxW, boxH, mainW, mainH ;

	if (typeof fit === 'undefined') {

		fit = this.currentItem.type === 'img' ? this.autoSizeImages : this.autoSizeOther;

	}

	var box = this.fbBox.style,

		infoPanel = this.fbInfoPanel.style,

		controlPanel = this.fbControlPanel.style,

		indexLinks = this.fbIndexLinks.style,

		captionDiv = this.fbCaptionDiv.style,

		itemNumber = this.fbItemNumber.style;

	if (!pass) {

		this.displaySize = this.getDisplaySize();

		if (this.showCaption && this.fbCaption.innerHTML) captionDiv.display = '';

		if (this.lclShowItemNumber) itemNumber.display = '';

	}

	this.upperSpace = Math.max(this.infoTop ? this.fbInfoPanel.offsetHeight : 0, this.controlTop ? this.fbControlPanel.offsetHeight : 0);

	this.lowerSpace = Math.max(this.infoTop ? 0 : this.fbInfoPanel.offsetHeight, this.controlTop ? 0 : this.fbControlPanel.offsetHeight);

	if (this.upperSpace) this.upperSpace += 2*this.panelPadding;

	if (this.lowerSpace) this.lowerSpace += 2*this.panelPadding;

	this.upperSpace = Math.max(this.upperSpace, this.padding);

	this.lowerSpace = Math.max(this.lowerSpace, this.padding);

	var extraSpace;

	if (this.shadowType === 'none') {

		extraSpace = 2*this.autoSizeSpace;

	} else if (this.shadowType === 'halo') {

		extraSpace = 2*this.shadowSize + this.autoSizeSpace;

	} else {

		extraSpace = this.shadowSize + 1.5*this.autoSizeSpace;

	}

	var pad = 2*(this.outerBorder + this.innerBorder) + extraSpace,

		maxW = Math.floor(this.displaySize.width - pad - 2*this.padding),

		maxH = Math.floor(this.displaySize.height - pad - this.upperSpace - this.lowerSpace),

		hardW = false, hardH = false;

	mainW = this.currentItem.nativeWidth + '';

	if (mainW === 'max') {

		mainW = maxW;

	} else if (mainW.substr(mainW.length - 1) === '%') {

		mainW = Math.floor(maxW * parseInt(mainW, 10) / 100);

	} else {

		mainW = parseInt(mainW, 10);

		hardW = true;

	}

	mainH = this.currentItem.nativeHeight + '';

	if (mainH === 'max') {

		mainH = maxH;

	} else if (mainH.substr(mainH.length - 1) === '%') {

		mainH = Math.floor(maxH * parseInt(mainH, 10) / 100);

	} else {

		mainH = parseInt(mainH, 10);

		hardH = true;

	}

	this.scaledBy = this.oversizedBy = 0;

	if (fit) {

		var scaleW = maxW/mainW,

			scaleH = maxH/mainH,

			fullW = mainW, fullH = mainH;

		if (hardW && hardH) scaleW = scaleH = Math.min(scaleW, scaleH);

		if (scaleW < 1) mainW = Math.round(mainW * scaleW);

		if (scaleH < 1) mainH = Math.round(mainH * scaleH);

		this.scaledBy = Math.max(fullW - mainW, fullH - mainH);

		if (this.scaledBy && this.scaledBy < this.outerBorder + extraSpace + this.panelPadding) {

			mainW = fullW;

			mainH = fullH;

			this.scaledBy = 0;

		}

	}

	boxW = mainW + 2*(this.innerBorder + this.padding);

	boxH = mainH + 2*this.innerBorder + this.upperSpace + this.lowerSpace;

	var infoH = this.fbInfoPanel.offsetHeight,

		controlH = this.fbControlPanel.offsetHeight;

	var infoW = boxW - 2*Math.max(this.padding, this.panelPadding);

	if (this.infoTop === this.controlTop && this.fbControls.offsetWidth) {

		infoW -= this.fbControls.offsetWidth + this.panelGap;

	}

	if (infoW < 0) infoW = 0;

	infoPanel.width = infoW + 'px';

	if (!this.lclNumIndexLinks) {

		var indexW = 0;

	} else if (this.indexLinksPanel === 'info' || this.infoTop !== this.controlTop) {

		var indexW = infoW;

	} else if (this.indexLinksPanel !== 'info' && this.infoTop === this.controlTop && this.infoCenter) {

		var indexW = Math.max(this.minIndexWidth, this.fbControls.offsetWidth);

	} else {

		var infoUsed = Math.max(this.fbCaption.offsetWidth, this.fbInfoLink.offsetWidth + this.fbPrintLink.offsetWidth + this.fbItemNumber.offsetWidth);

		var indexW = Math.max(this.minIndexWidth, this.fbControls.offsetWidth, (boxW - infoUsed - 2*Math.max(this.padding, this.panelPadding)));

		if (infoUsed) indexW -= this.panelGap;

	}

	if (indexW) indexLinks.width = (indexW - (this.indexLinksPanel !== 'info' ? 2 : 0)) + 'px';

	controlPanel.width = Math.max(indexW, this.fbControls.offsetWidth) + 'px';

	var changed = this.fbInfoPanel.offsetHeight !== infoH || this.fbControlPanel.offsetHeight !== controlH;

	if (this.showCaption) {

		if (this.minInfoWidth > infoW && !captionDiv.display) {

			captionDiv.display = 'none';

			changed = true;

		}

	}

	if (this.lclShowItemNumber) {

		if (this.fbInfoLink.offsetWidth + this.fbPrintLink.offsetWidth + this.fbItemNumber.offsetWidth > infoW && !itemNumber.display) {

			itemNumber.display = 'none';

			changed = true;

		}

	}

	if (changed && pass !== 3) return this.calcSize(fit, (pass || 0) + 1);

	if (!fit) this.oversizedBy = Math.max(boxW - this.displaySize.width, boxH - this.displaySize.height) + 2*this.outerBorder + extraSpace;

	if (this.oversizedBy < 0) this.oversizedBy = 0;

	if (this.shadowType === 'halo') {

		extraSpace = this.shadowSize + this.autoSizeSpace/2;

	} else {

		extraSpace = this.autoSizeSpace;

	}

	if (typeof this.boxLeft === 'number') {

		boxX = this.boxLeft;

	} else if (mainW === maxW) {

		boxX = extraSpace;

	} else {

		var freeSpace = this.displaySize.width - boxW - 2*this.outerBorder;

		boxX = Math.floor(freeSpace/2);

		if (boxX < this.autoSizeSpace) {

			boxX = this.autoSizeSpace;

		} else {

			if (typeof this.boxLeft === 'string' && this.boxLeft.substr(this.boxLeft.length - 1) === '%') {

				boxX += parseInt(this.boxLeft, 10)/100 * boxX;

			}

		}

	}

	if (typeof this.boxTop === 'number') {

		boxY = this.boxTop;

	} else if (mainH === maxH) {

		boxY = extraSpace;

	} else {

		var freeSpace = this.displaySize.height - boxH - 2*this.outerBorder,

			ratio = freeSpace / this.displaySize.height, factor;

		if (ratio <= 0.15) {

			factor = 2;

		} else if (ratio >= 0.3) {

			factor = 3;

		} else {

			factor = 1 + ratio/0.15;

		}

		boxY = Math.floor(freeSpace/factor);

		if (boxY < this.autoSizeSpace) {

			boxY = this.autoSizeSpace;

		} else {

			if (typeof this.boxTop === 'string' && this.boxTop.substr(this.boxTop.length - 1) === '%') {

				boxY += parseInt(this.boxTop, 10)/100 * boxY;

			}

		}

	}

	var boxPosition = box.position;

	if (this.ieOld) {

		box.display = 'none';

		this.stretchOverlay()();

	} else {

		this.setPosition(this.fbBox, 'fixed');

	}

	var scroll = this.getScroll();

	this.setPosition(this.fbBox, boxPosition);

	box.display = '';

	boxX += scroll.left;

	boxY += scroll.top;

	if (this.isChild) {

		var rex = /max|%/i,

			pos = this.fbParent.pos.fbBox,

			childX = rex.test(this.currentItem.nativeWidth) ? 99999 : (pos.left + boxX)/2,

			childY = rex.test(this.currentItem.nativeHeight) ? 99999 : (pos.top + boxY)/2;

		if (scroll.left < childX && scroll.top < childY) {

			boxX = Math.min(boxX, childX);

			boxY = Math.min(boxY, childY);

		}

	}

	var split = (pos = this.pos.fbBox) && !this.liveResize && this.splitResize;

	if (split === 'auto') split = boxW - pos.width <= boxH - pos.height ? 'wh' : 'hw';

	var oncomplete2 = function() {

		that.fbBox.style.visibility ? that.zoomIn() : that.showContent();

	};

	var oncomplete = function() {

		that.setSize(split,

			{ id: 'fbBox', left: boxX, top: boxY, width: boxW, height: boxH, borderWidth: that.outerBorder },

			{ id: 'fbMainDiv', width: mainW, height: mainH, top: that.upperSpace },

			function() { that.timeouts.showContent = setTimeout(oncomplete2, 10); }

		);

	};

	this.timeouts.setSize = setTimeout(oncomplete, 10);

},

setPosition: function(el, position) {

	if (el.style.position === position) return;

	var scroll = this.getScroll();

	if (position === 'fixed') {

		scroll.left = -scroll.left;

		scroll.top = -scroll.top;

	}

	if (this.pos[el.id]) {

		this.pos[el.id].left += scroll.left;

		this.pos[el.id].top += scroll.top;

	}

	el.style.left = (el.offsetLeft + scroll.left) + 'px';

	el.style.top = (el.offsetTop + scroll.top) + 'px';

	el.style.position = position;

},

collapse: function(callback, phase) {

	var that = this;

	if (!phase) {

		this.setPosition(this.fbBox, 'absolute');

		this.fbResizer.onclick = null;

		this.fbResizer.style.display = 'none';

		if (this.fbContent) {

			this.fbContent.onclick = null;

			this.fbContent.style.cursor = '';

		}

		if (this.navOverlay) {

			this.fbLeftNav.style.display = this.fbRightNav.style.display =

			this.fbOverlayPrev.style.display = this.fbOverlayNext.style.display = 'none';

		}

		var opacity = 0, duration = 0;

		if (this.currentItem.type === 'img' && !this.fbCanvas.style.visibility) {

			if (this.currentItem === this.lastShown && this.liveImageResize) opacity = 1;

			duration = this.imageFadeDuration;

		}

		this.liveResize = (opacity === 1);

		var oncomplete = function() { that.collapse(callback, 1); };

		return this.fadeOpacity(this.fbCanvas, opacity, duration, oncomplete);

	}

	if (!this.liveResize) {

		this.fbMainDiv.style.display = 'none';

		if (this.fbContent) this.fbContent.style.display = 'none';

		this.clearTimeout('loader');

		this.timeouts.loader = setTimeout(function() { that.fbLoader.style.display = ''; }, this.loaderDelay);

	}

	var infoPanel = this.fbInfoPanel.style,

		controlPanel = this.fbControlPanel.style;

	infoPanel.visibility = controlPanel.visibility = 'hidden';

	infoPanel.left = controlPanel.left = '0';

	infoPanel.top = controlPanel.top = '-9999px';

	if (callback) callback();

},

restore: function(callback, phase) {

	var that = this;

	if (!phase) {

		if (this.fbShadowRight.style.display && this.shadowType !== 'none') {

			this.fbShadowRight.style.display = this.fbShadowBottom.style.display = '';

			if (this.shadowType === 'halo') {

				this.fbShadowTop.style.display = this.fbShadowLeft.style.display = '';

			} else {

				this.fbShadowCorner.style.display = '';

			}

		}

		var infoPanel = this.fbInfoPanel.style,

			controlPanel = this.fbControlPanel.style,

			pad = this.upperSpace + this.pos.fbMainDiv.height + 2*this.innerBorder;

		infoPanel.top = (((this.infoTop ? this.upperSpace : this.lowerSpace) - this.fbInfoPanel.offsetHeight) / 2 - 1 + (this.infoTop ? 0 : pad)) + 'px';

		controlPanel.top = (((this.controlTop ? this.upperSpace : this.lowerSpace) - this.fbControlPanel.offsetHeight) / 2 + (this.controlTop ? 0 : pad)) + 'px';

		var pad = Math.max(this.padding, this.panelPadding) + 'px';

		infoPanel.left = [this.infoLeft ? pad : ''];

		controlPanel.left = [this.controlLeft ? pad : ''];

		infoPanel.visibility = controlPanel.visibility = '';

		this.clearTimeout('loader');

		this.fbLoader.style.display = 'none';

		this.fbMainDiv.style.display = this.fbContent.style.display = '';

		var duration = (this.currentItem.type === 'img' && !this.fbCanvas.style.visibility) ? this.imageFadeDuration : 0,

			oncomplete = function() { that.restore(callback, 1); };

		return this.fadeOpacity(this.fbCanvas, 1, duration, oncomplete);

	}

	if (this.currentItem.type === 'img' ? this.resizeImages : this.resizeOther) {

		var scale = 0;

		if (this.scaledBy > 35) {

			scale = 1;

		} else if (this.oversizedBy > 28){

			scale = -1;

		}

		if (scale) {

			this.fbResizer.onclick = function() {

				if (that.isSlideshow && that.pauseOnResize && !that.isPaused) {

					that.setPause(true);

				}

				that.collapse(function() { that.calcSize(scale === -1); });

				if (window.event) event.returnValue = false;

				return false;

			};

			if (this.currentItem.type === 'img' && /cursor|both/.test(this.resizeTool)) {

				this.fbContent.style.cursor = 'url(' + (scale === -1 ? this.resizeDownCursor : this.resizeUpCursor) +'), default';

				this.fbContent.onclick = this.fbResizer.onclick;

			}

			if (this.currentItem.type !== 'img' || /topleft|both/.test(this.resizeTool)) {

				this.fbResizer.style.backgroundPosition = (scale === -1 ? 'bottom' : 'top');

				this.fadeOpacity(this.fbResizer, this.controlOpacity);

			}

		}

	}

	if (this.navOverlay) {

		var leftNav = this.fbLeftNav.style,

			rightNav = this.fbRightNav.style,

			overlayPrev = this.fbOverlayPrev.style,

			overlayNext = this.fbOverlayNext.style;

		leftNav.width = rightNav.width = Math.max(this.navOverlayWidth/100 * this.pos.fbMainDiv.width, this.fbOverlayPrev.offsetWidth) + 'px';

		leftNav.display = rightNav.display = '';

		if (fb.showNavOverlay) {

			overlayPrev.visibility = overlayNext.visibility = 'hidden';

			overlayPrev.display = overlayNext.display = '';

			overlayPrev.top = overlayNext.top = ((this.pos.fbMainDiv.height - this.fbOverlayPrev.offsetHeight) * this.navOverlayPos/100) + 'px';

		}

	}

	if (callback) callback();

},

setSize: function(order) {

	var that = this,

		oncomplete = function() {},

		arr = [[], []],

		defer = {},

		node,

		i = arguments.length;

	if (order === 'wh') {

		defer.top = 1;

		defer.height = 1;

	} else if (order === 'hw') {

		defer.left = 1;

		defer.width = 1;

	}

	while (i--) {

		if (typeof arguments[i] === 'object' && (node = this[arguments[i].id])) {

			var obj = arguments[i];

			if (!this.pos[obj.id]) this.pos[obj.id] = {};

			for (var property in obj) {

				if (obj.hasOwnProperty(property) && property !== 'id') {

					var idx = defer[property] || 0;

					var start = this.pos[obj.id][property];

					if (typeof start !== 'number' || node.style.display || node.style.visibility) {

						start = obj[property];

					}

					arr[idx].push({ node: node, property: property, start: start, finish: obj[property] });

					if (obj.id === 'fbMainDiv') {

						arr[idx].push({ node: this.fbContent, property: property, start: start, finish: obj[property] });

					}

					if (obj.id === 'fbZoomDiv' && /\b(width|height)\b/i.test(property)) {

						arr[idx].push({ node: this.fbZoomImg, property: property, start: start, finish: obj[property] });

					}

					this.pos[obj.id][property] = obj[property];

				}

			}

		} else if (typeof arguments[i] === 'function') {

			oncomplete = arguments[i];

		}

	}

	this.resizeGroup(arr[0], function() { that.resizeGroup(arr[1], oncomplete); });

},

showContent: function(phase) {

	var that = this;

	if (!phase) {

		var displaySize = this.getDisplaySize();

		if (!this.resized) {

			var vscrollChanged = displaySize.width !== this.displaySize.width,

				hscrollChanged = displaySize.height !== this.displaySize.height;

			if ((vscrollChanged && Math.abs(this.pos.fbBox.width - displaySize.width) < 50) ||

			(hscrollChanged && Math.abs(this.pos.fbBox.height - displaySize.height) < 50)) {

				this.resized = true;

				return this.calcSize(this.scaledBy);

			}

		}

		this.resized = false;

		self.focus();

		if (this.ieOld) this.stretchOverlay()();

		if ((this.disableScroll || (this.ffOld && /iframe|quicktime/i.test(this.currentItem.type))) && !(this.ieOld || this.webkitOld || this.ie8b2)) {

			if (this.pos.fbBox.width <= displaySize.width && this.pos.fbBox.height <= displaySize.height) {

				this.setPosition(this.fbBox, 'fixed');

			}

		}

		if (this.currentItem.type === 'iframe') {

			this.fbContent.src = this.currentItem.href;

		} else if (/flash|quicktime/.test(this.currentItem.type)) {

			this.setInnerHTML(this.fbContent, this.objectHTML(this.currentItem.href,

			this.currentItem.type, this.pos.fbMainDiv.width, this.pos.fbMainDiv.height));

		}

		this.prevIndex = this.currentIndex ? this.currentIndex - 1 : this.itemCount - 1;

		this.nextIndex = this.currentIndex < this.itemCount - 1 ? this.currentIndex + 1 : 0;

		var prevHref = this.enableWrap || this.currentIndex !== 0 ? this.items[this.prevIndex].href : '',

			nextHref = this.enableWrap || this.currentIndex !== this.itemCount - 1 ?  this.items[this.nextIndex].href : '';

		if (this.navButton) {

			if (prevHref) {

				if (!this.operaOld) this.fbPrev.href = prevHref;

				this.fbPrev.title = this.fbOverlayPrev.title;

			} else {

				this.fbPrev.removeAttribute('href');

				this.fbPrev.title = '';

			}

			if (nextHref) {

				if (!this.operaOld) this.fbNext.href = nextHref;

				this.fbNext.title = this.fbOverlayNext.title;

			} else {

				this.fbNext.removeAttribute('href');

				this.fbNext.title = '';

			}

			var prevOn = this.fbPrev.className.replace('_off', ''),

				nextOn = this.fbNext.className.replace('_off', '');

			this.fbPrev.className = prevOn + (prevHref ? '' : '_off');

			this.fbNext.className = nextOn + (nextHref ? '' : '_off');

		}

		if (this.navOverlay) {

			if (!this.operaOld) {

				this.fbLeftNav.href = this.fbOverlayPrev.href = prevHref;

				this.fbRightNav.href = this.fbOverlayNext.href = nextHref;

			}

			this.fbLeftNav.style.visibility = prevHref ? '' : 'hidden';

			this.fbRightNav.style.visibility = nextHref ? '' : 'hidden';

			fb.navOverlayShown = true;

		}

		this.fbCanvas.style.visibility = '';

		return this.restore(function() {

			that.timeouts.showContent = setTimeout(function() { that.showContent(1); }, 10);

		} );

	}

	this.lastShown = this.currentItem;

	if (!this.currentItem.seen) {

		this.currentItem.seen = true;

		this.itemsShown++;

	}

	if (this.isSlideshow && !this.isPaused) {

		this.timeouts.slideshow = setTimeout(function() {

			if (that.endTask === 'loop' || that.itemsShown < that.itemCount) {

				that.newContent(that.nextIndex);

			} else if (that.endTask === 'exit') {

				that.end();

			} else {

				that.setPause(true);

				var i = that.itemCount;

				while (i--) that.items[i].seen = false;

				that.itemsShown = 0;

			}

		}, this.slideInterval*1000);

	}

	this.timeouts.preload = setTimeout(function() {

			that.preloadImages(nextHref || prevHref || '', true);

	}, 10);

},

objectHTML: function(href, type, width, height) {

	if (type === 'flash') {

		var classid = 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"',

			mime = 'type="application/x-shockwave-flash"',

			pluginurl = 'http://get.adobe.com/flashplayer/',

			match = /\bwmode=(\w+?)\b/i.exec(href),

			wmode = match ? match[1] : 'window',

			match = /\bbgcolor=(#\w+?)\b/i.exec(href),

			bgcolor = match ? match[1] : '',

			match = /\bscale=(\w+?)\b/i.exec(href),

			scale = match ? match[1] : 'exactfit',

			params = { wmode:wmode, bgcolor:bgcolor, scale:scale, quality:'high',

			flashvars:'autoplay=1&amp;ap=true&amp;border=0&amp;rel=0' };

		if (this.ffOld) params.wmode = this.ffMac ? 'window' : 'opaque';

		if (this.ffNew && href.indexOf('YV_YEP.swf') !== -1) params.wmode = 'window';

	} else {

		var classid = 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"',

			mime = 'type="video/quicktime"',

			pluginurl = 'http://www.apple.com/quicktime/download/',

			params = { autoplay:'true', controller:'true', showlogo:'false', scale:'tofit' };

	}

	var html = '<object id="fbObject" name="fbObject" width="' + width + '" height="' + height + '" ';

	if (this.ie) {

		html += classid + '>';

		params[type === 'flash' ? 'movie' : 'src'] = this.encodeHTML(href);

	} else {

		html += mime + ' data="' + this.encodeHTML(href) + '">';

	}

	for (var name in params) {

		if (params.hasOwnProperty(name)) {

			html += '<param name="' + name + '" value="' + params[name] + '" />';

		}

	}

	if (type === 'quicktime' && this.webkitMac) {

		html += '<embed src="' + this.encodeHTML(href) +

		'" width="' + width + '" height="' + height + '" autoplay="true" controller="true" showlogo="false" scale="tofit" pluginspage="' +

		pluginurl + '"></embed></object>';

	} else {

		html += '<embed src="' + this.encodeHTML(href) +

		'" width="' + width + '" height="' + height + '" autoplay="true" controller="true" showlogo="false"  wmode="windows" scale="tofit" pluginspage="' +

		pluginurl + '"></embed></object>';

	}

	return html;

},

newContent: function(index) {

	var that = this;

	this.clearTimeout('slideshow');

	this.clearTimeout('resize');

	this.currentIndex = index;

	fb.previousAnchor = this.currentItem;

	this.currentItem = this.items[index];

	if (this.showNavOverlay == 'once' && this.navOverlayShown) this.showNavOverlay = false;

	var oncomplete = function() {

		that.updatePanels();

		that.fetchContent(function() { that.calcSize(); });

	};

	this.collapse(function() {

		that.timeouts.fetch = setTimeout(oncomplete, 10);

	} );

},

end: function(all) {

	if (this !== fb.lastChild) return fb.lastChild.end(all);

	var that = this;

	this.endAll = this.endAll || all;

	this.fbOverlay.onclick = null;

	if (this.isChild) {

		if (this.endAll) this.imageFadeDuration = this.overlayFadeDuration = this.resizeDuration = 0;

	} else {

		if (document.keydownSet) {

			document.onkeydown = this.priorOnkeydown;

			document.keydownSet = false;

		}

		if (document.keypressSet) {

			document.onkeypress = this.priorOnkeypress;

			document.keypressSet = false;

		}

		parent.focus();

	}

	if (this.ieOld) {

		detachEvent('onresize', this.stretchOverlay());

		detachEvent('onscroll', this.stretchOverlay());

	}

	for (var key in this.timeouts) {

		if (this.timeouts.hasOwnProperty(key)) this.clearTimeout(key);

	}

	if (this.fbBox.style.visibility) {

		if (!this.lastShown) this.fbZoomDiv.style.display = 'none';

	} else if (this.currentItem.type === 'img' && this.zoomImageStart) {

		if (this.currentItem.popup) this.currentItem.anchor.onmouseover();

		var anchorPos = this.getAnchorPos(this.currentItem.anchor, true);

		if (this.currentItem.popup) this.currentItem.anchor.onmouseout();

		if (anchorPos.width) {

			this.fbZoomDiv.style.borderWidth = this.zoomPopBorder + 'px';

			anchorPos.left -= this.zoomPopBorder;

			anchorPos.top -= this.zoomPopBorder;

			this.pos.thumb = anchorPos;

			return this.zoomOut();

		}

	}

	if (!this.fbBox.style.visibility) {

		var anchorPos = this.getAnchorPos(this.currentItem.anchor, !this.currentItem.popup),

			offset = this.initialSize/2,

			initialPos = { id: 'fbBox', left: anchorPos.left - offset, top: anchorPos.top - offset, width: this.initialSize, height: this.initialSize },

			zeroPos = { id: 'fbBox', left: anchorPos.left, top: anchorPos.top, width: 0, height: 0, borderWidth: 0 },

			split = this.splitResize;

		if (split === 'wh') {

			split = 'hw';

		} else if (split === 'hw') {

			split = 'wh';

		} else if (split === 'auto') {

			split = this.pos.fbBox.width <= this.pos.fbBox.height ? 'hw' : 'wh';

		}

		var oncomplete3 = function() {

			setTimeout(function() {

				that.fbBox.style.visibility = 'hidden';

				that.end();

			}, 10);

		};

		if (split) {

			var oncomplete2 = function() {

				that.setSize(split, initialPos, function() {

					that.setSize(zeroPos, oncomplete3);

				});

			};

		} else {

			var oncomplete2 = function() {

				that.setSize(zeroPos, oncomplete3);

			};

		}

		var oncomplete = function() {

			if (that.fbContent) {

				that.fbMainDiv.removeChild(that.fbContent);

				delete that.fbContent;

			}

			that.fbLoader.style.display = '';

			that.fbCanvas.style.display = that.fbShadowTop.style.display = that.fbShadowRight.style.display =

			that.fbShadowBottom.style.display = that.fbShadowLeft.style.display = that.fbShadowCorner.style.display = 'none';

			oncomplete2();

		};

		return this.collapse(oncomplete);

	}

	this.fbBox.style.display = 'none';

	var level = this.children.length + 1,

		i = this.anchors.length;

	while(i && this.anchors[i-1].level >= level) i--;

	this.anchors.length = i;

	if (this.isChild) this.children.length--;

	fb.lastChild = this.children[this.children.length-1] || fb;

	var oncomplete2 = function() {

		setTimeout(function() {

			while (that.nodeNames.length) {

				var id = that.nodeNames.pop();

				if (that[id] && that[id].parentNode) {

					that[id].parentNode.removeChild(that[id]);

					delete that[id];

				}

			}

			if (that.endAll && that.isChild) {

				return fb.end(true);

			} else if (that.loadPageOnClose) {

				if (that.loadPageOnClose === 'self' || that.loadPageOnClose === 'this') {

					location.reload(true);

				} else if (that.loadPageOnClose === 'back') {

					history.back();

				} else {

					location.replace(that.loadPageOnClose);

				}

			}

		}, 10);

	};

	var oncomplete = function() {

		while(that.hiddenEls.length) {

			var el = that.hiddenEls.pop();

			el.style.visibility = 'visible';

			if (this.ffOld && this.ffMac) {

				el.focus();

				el.blur();

			}

		}

		var overlay = that.fbOverlay.style;

		overlay.display = 'none';

		overlay.width = overlay.height = '0';

		var duration = that.currentItem.popup ? 6.5 : 0;

		that.fbZoomDiv.style.opacity = '1';

		that.fadeOpacity( that.fbZoomDiv, 0, duration, oncomplete2);

		that.currentItem = fb.previousAnchor = null;

	};

	this.fadeOpacity(this.fbOverlay, 0, this.overlayFadeDuration, oncomplete);

},

zoomIn: function(phase) {

	var that = this,

		zoomDiv = this.fbZoomDiv.style;

	if (!phase) {

		this.clearTimeout('slowLoad');

		zoomDiv.display = this.fbZoomImg.style.display = '';

		if (this.currentItem.popup) this.currentItem.anchor.onmouseout();

		var pad = this.outerBorder + this.innerBorder - this.zoomPopBorder;

		var oncomplete = function () {

			that.fbZoomImg.src = that.currentItem.href;

			that.setSize(

				{ id: 'fbZoomDiv', width: that.pos.fbMainDiv.width, height: that.pos.fbMainDiv.height,

				left: that.pos.fbBox.left + pad + that.padding, top: that.pos.fbBox.top + pad + that.upperSpace },

				function() { that.zoomIn(1); } );

		};

		return this.fadeOpacity(this.fbOverlay, this.overlayOpacity, this.overlayFadeDuration, oncomplete);

	}

	if (phase === 1) {

		var boxPos = {

			left: this.pos.fbBox.left, top: this.pos.fbBox.top,

			width: this.pos.fbBox.width, height: this.pos.fbBox.height

		};

		var pad = 2*(this.zoomPopBorder - this.outerBorder);

		this.pos.fbBox = {

			left: this.pos.fbZoomDiv.left, top: this.pos.fbZoomDiv.top,

			width: this.pos.fbZoomDiv.width + pad, height: this.pos.fbZoomDiv.height + pad

		};

		this.fbBox.style.visibility = '';

		var oncomplete = function() {

			that.restore(function() { that.zoomIn(2); });

		};

		return this.setSize(

			{ id: 'fbBox', left: boxPos.left, top: boxPos.top,

			width: boxPos.width, height: boxPos.height},

			oncomplete);

	}

	var show = function() {

		zoomDiv.display = 'none';

		that.fbZoomImg.src = '';

		zoomDiv.left = zoomDiv.top = zoomDiv.width = zoomDiv.height = that.fbZoomImg.width = that.fbZoomImg.height = '0';

		that.showContent();

	};

	this.timeouts.showContent = setTimeout(show, 10);

},

zoomOut: function(phase) {

	var that = this;

	if (!phase) {

		this.fbZoomImg.src = this.currentItem.href;

		var pad = this.outerBorder + this.innerBorder - this.zoomPopBorder;

		this.setSize(

		{ id: 'fbZoomDiv', width: this.pos.fbMainDiv.width, height: this.pos.fbMainDiv.height,

		left: this.pos.fbBox.left + pad + this.padding, top: this.pos.fbBox.top + pad + this.upperSpace },

		function() { that.zoomOut(1); } );

	}

	if (phase === 1) {

		this.fbZoomDiv.style.display = this.fbZoomImg.style.display = '';

		this.fbCanvas.style.visibility = 'hidden';

		return this.collapse(function() { that.zoomOut(2); });

	}

	if (phase === 2) {

		var pad = 2*(this.zoomPopBorder - this.outerBorder);

		return this.setSize(

			{ id: 'fbBox', left: this.pos.fbZoomDiv.left, top: this.pos.fbZoomDiv.top,

			width: this.pos.fbZoomDiv.width + pad, height: this.pos.fbZoomDiv.height + pad },

			function() { that.zoomOut(3); }

		);

	}

	this.fbBox.style.visibility = 'hidden';

	var end = function() {

		that.fbZoomImg.src = that.pos.thumb.src;

		that.end();

	};

	this.setSize(

		{ id: 'fbZoomDiv', left: this.pos.thumb.left, top: this.pos.thumb.top,

		width: this.pos.thumb.width, height: this.pos.thumb.height },

		end);

},

setPause: function(pause) {

	this.isPaused = pause;

	if (pause) {

		this.clearTimeout('slideshow');

	} else {

		this.newContent(this.nextIndex);

	}

	if (this.showPlayPause) {

		this.fbPlay.style.top = pause ? '' : '-9999px';

		this.fbPause.style.top = pause ? '-9999px' : '';

	}

},

fadeOpacity: function(el, opacity, duration, callback) {

	var startOp = +(el.style.opacity || 0);

	duration = duration || 0;

	this.clearTimeout['fade' + el.id];

	var fadeIn = (startOp <= opacity && opacity > 0);

	if (duration > 10) duration = 10;

	if (duration < 0) duration = 0;

	if (duration === 0) {

		startOp = opacity;

		var incr = 1;

	} else {

		var root = Math.pow(100, 0.1),

			power = duration + ((10 - duration)/9) * (Math.log(2)/Math.log(root) - 1),

			incr = 1/Math.pow(root, power);

	}

	if (fadeIn) {

		el.style.display = el.style.visibility = '';

	} else {

		incr = -incr;

	}

	this.stepFade(el, startOp, opacity, incr, fadeIn, callback);

},

stepFade: function(el, thisOp, finishOp, incr, fadeIn, callback) {

	if (!el) return;

	var that = this;

	if ((fadeIn && thisOp >= finishOp) || (!fadeIn && thisOp <= finishOp)) thisOp = finishOp;

	if (this.ie) el.style.filter = 'alpha(opacity=' + thisOp*100 + ')';

	el.style.opacity = thisOp + '';

	if (thisOp === finishOp) {

		if (this.ie && finishOp >= 1) el.style.removeAttribute('filter');

		if (callback) callback();

	} else {

		this.timeouts['fade' + el.id] = setTimeout(function() { that.stepFade(el, thisOp + incr, finishOp, incr, fadeIn, callback); }, 20);

	}

},

resizeGroup: function(arr, callback) {

	var i = arr.length;

	if (!i) return callback ? callback() : null;

	this.clearTimeout('resize');

	var diff = 0;

	while (i--) {

		diff = Math.max(diff, Math.abs(arr[i].finish - arr[i].start));

	}

	var duration = this.resizeDuration * (this.liveResize ? 0.65 : 1);

	var rate = diff && duration ? Math.pow(Math.max(1, 2.2 - duration/10), (Math.log(diff))) / diff : 1;

	i = arr.length;

	while (i--) arr[i].diff = arr[i].finish - arr[i].start;

	this.stepResize(rate, rate, arr, callback);

},

stepResize: function(increment, rate, arr, callback) {

	var that = this;

	if (increment > 1) increment = 1;

	var i = arr.length;

	while (i--) {

		var node = arr[i].node,

			prop = arr[i].property,

			val = Math.round(arr[i].start + arr[i].diff * increment),

			tag = node.tagName.toLowerCase();

		if (tag === 'img' || tag === 'iframe') {

			node[prop] = val;

		} else {

			node.style[prop] = val + 'px';

		}

	}

	if (increment >= 1) {

		delete this.timeouts.resize;

		if (callback) callback();

	} else {

		this.timeouts.resize = setTimeout(function() { that.stepResize(increment + rate, rate, arr, callback); }, 20);

	}

},

getDisplaySize: function() {

	return { width: this.getDisplayWidth(), height: this.getDisplayHeight() };

},

getDisplayWidth: function() {

	return this.html.clientWidth || this.bod.clientWidth;

},

getDisplayHeight: function() {

	if (this.webkitOld) return window.innerHeight;

	if (!this.html.clientHeight || this.operaOld || document.compatMode === 'BackCompat') {

		return this.bod.clientHeight;

	}

	return this.html.clientHeight;

},

getScroll: function(win) {

	if (!(win && win.document)) win = self;

	var doc = win.document,

		html = doc.documentElement,

		bod = doc.body || doc.getElementsByTagName('body')[0],

		left = win.pageXOffset || bod.scrollLeft || doc.documentElement.scrollLeft || 0;

	if (this.ie && this.rtl) left -= html.scrollWidth - html.clientWidth;

	return {

		left: left,

		top: win.pageYOffset || bod.scrollTop || doc.documentElement.scrollTop || 0

	};

},

getLeftTop: function(el, local) {

	var left = el.offsetLeft || 0,

		top = el.offsetTop || 0,

		doc = el.ownerDocument || el.document,

		bod = doc.body || doc.getElementsByTagName('body')[0],

		win = doc.defaultView || doc.parentWindow || doc.contentWindow,

		scroll = this.getScroll(win),

		position = this.getStyle(el, 'position', win),

		rex = /absolute|fixed/,

		elFlow = !rex.test(position),

		inFlow = elFlow,

		node = el;

	if (position === 'fixed') {

		left += scroll.left;

		top += scroll.top;

	}

	while (position !== 'fixed' && (node = node.offsetParent)) {

		var borderLeft = 0,

			borderTop = 0,

			nodeFlow = true,

			position = this.getStyle(node, 'position', win),

			nodeFlow = !rex.test(position);

		if (this.opera) {

			if (local && node !== bod) {

				left += node.scrollLeft - node.clientLeft;

				top += node.scrollTop - node.clientTop;

			}

		} else if (this.ie) {

			if (node.currentStyle.hasLayout && node !== doc.documentElement) {

				borderLeft = node.clientLeft;

				borderTop = node.clientTop;

			}

		} else {

			borderLeft = parseInt(this.getStyle(node, 'border-left-width', win), 10);

			borderTop = parseInt(this.getStyle(node, 'border-top-width', win), 10);

			if (this.ff && node === el.offsetParent && !nodeFlow && (this.ffOld || !elFlow)) {

				left += borderLeft;

				top += borderTop;

			}

		}

		if (!nodeFlow) {

			if (local) return { left: left, top: top };

			inFlow = false;

		}

		if (node.offsetLeft > 0) left += node.offsetLeft;

		left += borderLeft;

		top += node.offsetTop + borderTop;

		if (position === 'fixed') {

			left += scroll.left;

			top += scroll.top;

		}

		if (!(this.opera && elFlow) && node !== bod && node !== doc.documentElement) {

			left -= node.scrollLeft;

			top -= node.scrollTop;

		}

	}

	if (this.ff && inFlow) {

		left += parseInt(this.getStyle(bod, 'border-left-width', win), 10);

		top += parseInt(this.getStyle(bod, 'border-top-width', win), 10);

	}

	if (this.webkitOld) {

		var scriptElement = doc.createElement('script');

		scriptElement.innerHTML = 'document.parentWindow=self';

		doc.documentElement.appendChild(scriptElement);

		doc.documentElement.removeChild(scriptElement);

		win = doc.parentWindow;

	}

	if (!local && win !== self) {

		var iframes = win.parent.document.getElementsByTagName('iframe'),

			i = iframes.length;

		while (i--) {

			var node = iframes[i],

				idoc = false;

			try {

				idoc = node.contentDocument || node.contentWindow;

				idoc = idoc.document || idoc;

			} catch(e) {}

			if (idoc === doc || (typeof idoc !== 'object' && node.src === win.location.href.substr(win.location.href.length - node.src.length))) {

				if (this.webkitOld) win = doc.defaultView;

				var pos = this.getLeftTop(node);

				left += pos.left - scroll.left;

				top += pos.top - scroll.top;

				if (this.ie || this.opera) {

					var padLeft = 0, padTop = 0;

					if (!this.ie || elFlow) {

						padLeft = parseInt(this.getStyle(node, 'padding-left', win), 10);

						padTop = parseInt(this.getStyle(node, 'padding-top', win), 10);

					}

					left += node.clientLeft + padLeft;

					top += node.clientTop + padTop;

				} else {

					left += parseInt(this.getStyle(node, 'border-left-width', win), 10) +

					parseInt(this.getStyle(node, 'padding-left', win), 10);

					top += parseInt(this.getStyle(node, 'border-top-width', win), 10) +

					parseInt(this.getStyle(node, 'padding-top', win), 10);

				}

				break;

			}

		}

	}

	return { left: left, top: top };

},

getStyle: function(el, prop, win) {

	if (!(el && prop)) return '';

	if (!win) {

		var doc = el.ownerDocument || el.document;

		win = doc.defaultView || doc.parentWindow || doc.contentWindow;

	}

	if (el.currentStyle) {

		return el.currentStyle[prop.replace(/-(\w)/g, function(match, p1) { return p1.toUpperCase(); })] || '';

	} else {

		if (!win) {

			var doc = el.ownerDocument || el.document;

			win = doc.defaultView || doc.parentWindow || doc.contentWindow;

		}

		return (win.getComputedStyle && win.getComputedStyle(el, '').getPropertyValue(prop)) || '';

	}

},

getLayout: function(el) {

	var lay = this.getLeftTop(el);

	lay.width = el.offsetWidth;

	lay.height = el.offsetHeight;

	return lay;

},

clearTimeout: function(key) {

	if (this.timeouts[key]) {

		clearTimeout(this.timeouts[key]);

		delete this.timeouts[key];

	}

},

stretchOverlay: function() {

	var that = this;

	return function() {

		if (arguments.length === 1) {

			that.clearTimeout('stretch');

			that.timeouts.stretch = setTimeout(function() { that.stretchOverlay()(); }, 25);

		} else {

			delete that.timeouts.stretch;

			if (!that.fbBox) return;

			var width = that.fbBox.offsetLeft + that.fbBox.offsetWidth,

				height = that.fbBox.offsetTop + that.fbBox.offsetHeight,

				display = that.getDisplaySize(),

				scroll = that.getScroll(),

				overlay = that.fbOverlay.style;

			overlay.width = overlay.height = '0';

			var rtlAdjust = (that.rtl && scroll.left) ? that.html.clientWidth - that.html.scrollWidth : 0;

			overlay.left = rtlAdjust + 'px';

			overlay.width = Math.max(width, that.bod.scrollWidth, that.bod.clientWidth, that.html.clientWidth, display.width + scroll.left) + 'px';

			overlay.height = Math.max(height, that.bod.scrollHeight, that.bod.clientHeight, that.html.clientHeight, display.height + scroll.top) + 'px';

		}

	};

},

encodeHTML: function(str) {

	return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');

},

decodeHTML: function(str) {

	return str.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&#39;/g, "'");

},

getXMLHttpRequest: function() {

	var xhr, that = this;

	if (window.XMLHttpRequest) {

		if (!(xhr = new XMLHttpRequest())) return false;

	} else {

		try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {

			try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { return false; }

		}

	}

	return {

		getResponse: function(url, callback) {

			try {

				xhr.open('GET', url, true);

				xhr.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT');

				xhr.setRequestHeader('Cache-Control', 'no-cache');

				xhr.onreadystatechange = function() {

					if (xhr.readyState === 4) {

						xhr.onreadystatechange = function() {};

						callback(xhr);

					}

				};

				xhr.send(null);

			} catch(e) {}

		}

	};

},

setInnerHTML: function(el, strHTML) {

	try {

		var range = document.createRange();

		range.selectNodeContents(el);

		range.deleteContents();

		if (strHTML) {

		//	var xmlDiv = new DOMParser().parseFromString('<div xmlns="http://www.w3.org/1999/xhtml">' + strHTML + '</div>', 'application/xhtml+xml'),

				childNodes = xmlDiv.documentElement.childNodes;

			for (var i = 0, len = childNodes.length; i < len; i++) {

				el.appendChild(document.importNode(childNodes[i], true));

			}

		}

		return true;

	} catch (e) {}

	try {

		el.innerHTML = strHTML;

		return true;

	} catch(e) {}

	return false;

},

printContents: function(el, style) {

	if (el && el.offsetWidth) {

		var width = el.offsetWidth,

			height = el.offsetHeight;

	} else {

		el = fb.lastChild.fbContent;

		var pos = fb.lastChild.pos.fbMainDiv,

			width = pos.width,

			height = pos.height;

	}

	var win = window.open('', '', 'width=' + width + ', height=' + height),

		doc = win && win.document;

	if (!doc) {

		alert('Popup windows are being blocked by your browser.\nUnable to print.');

		return false;

	}

	if (/\.css$/i.test(style)) {

		style = '<link rel="stylesheet" type="text/css" href="' + style + '" />';

	} else {

		style = '<style type="text/css"> html,body{border:0;margin:0;padding:0;}' + (style || '') + '</style>';

	}

	var div = document.createElement('div');

	div.appendChild(el.cloneNode(true));

	doc.open('text/html');

	doc.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"' +

	' "http://www.w3.org/TR/html4/loose.dtd"><html><head>' +

	style + '</head><body><div>' + div.innerHTML + '</div></body></html>');

	doc.close();

	setTimeout(function() { win && win.print(); win && win.close(); }, 200);

	return true;

},

loadAnchor: function(href, rev, title) {

	if (href.setAttribute) {

		var anchor = href;

		if (!anchor.getAttribute('rel')) anchor.setAttribute('rel', 'floatbox');

		fb.lastChild.start(this.tagOneAnchor(anchor));

	} else {

		fb.lastChild.start(this.tagOneAnchor({ href: href, rev: rev, title: title, rel: 'floatbox' }));

	}

},

goBack: function() {

	var a = fb.previousAnchor;

	if (a) this.loadAnchor(a.href, a.rev + ' sameBox:true', a.title);

},

resize: function(width, height) {

	var changed = false;

	if (width && fb.lastChild.currentItem && fb.lastChild.currentItem.nativeWidth != width) {

		fb.lastChild.currentItem.nativeWidth = width;

		changed = true;

	}

	if (height && fb.lastChild.currentItem && fb.lastChild.currentItem.nativeHeight != height) {

		fb.lastChild.currentItem.nativeHeight = height;

		changed = true;

	}

	if (changed) fb.lastChild.calcSize(false);

}

};

function initfb() {

	if (arguments.callee.done) return;

	var fbWindow = 'self';

	if (self !== parent) {

		try {

			if (self.location.host === parent.location.host && self.location.protocol === parent.location.protocol) fbWindow = 'parent';

		} catch(e) {}

		if (fbWindow === 'parent' && !parent.fb) return setTimeout(initfb, 50);

	}

	arguments.callee.done = true;

	if (document.compatMode === 'BackCompat') {

		alert('Floatbox does not support quirks mode.\nPage needs to have a valid a doc type.');

		return;

	}
	fb = (fbWindow === 'self' ? new Floatbox() : parent.fb);
	fb.tagAnchors(self.document.body || self.document.getElementsByTagName('body')[0]);
	if (fb.autoStart) {
		fb.start(fb.autoStart);
		if (typeof fb !== 'undefined') delete fb.autoStart;
	} else {
		fb.preloadImages('', true);
	}
}
if (document.addEventListener) {
	document.addEventListener('DOMContentLoaded', initfb, false);
}
(function() {
	/*@cc_on
	if (document.body) {
		try {
			document.createElement('div').doScroll('left');
			return initfb();
		} catch(e) {}
	}
	/*@if (false) @*/
	if (/loaded|complete/.test(document.readyState)) return initfb();
	/*@end @*/
	if (!initfb.done) setTimeout(arguments.callee, 50);
})();
fb_prevOnload = window.onload;
window.onload = function() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	if (typeof fb_prevOnload === 'function') fb_prevOnload();
	initfb();
};