/*  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();

//

// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
//  Justin Palmer (http://encytemedia.com/)
//  Mark Pilgrim (http://diveintomark.org/)
//  Martin Bialasinki
// 
// See scriptaculous.js for full license.  

// converts rgb() and #xxx to #xxxxxx format,  
// returns self (or first argument) if not convertable 


String.prototype.parseColor = function() {  
  var color = '#';  
  if(this.slice(0,4) == 'rgb(') {  
    var cols = this.slice(4,this.length-1).split(',');  
    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
  } else {  
    if(this.slice(0,1) == '#') {  
      if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
      if(this.length==7) color = this.toLowerCase();  
    }  
  }  
  return(color.length==7 ? color : (arguments[0] || this));  
}

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

Element.collectTextNodes = function(element) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
  }).flatten().join('');
}

Element.collectTextNodesIgnoreClass = function(element, className) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
        Element.collectTextNodesIgnoreClass(node, className) : ''));
  }).flatten().join('');
}

Element.setContentZoom = function(element, percent) {
  element = $(element);  
  Element.setStyle(element, {fontSize: (percent/100) + 'em'});   
  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
}

Element.getOpacity = function(element){  
  var opacity;
  if (opacity = Element.getStyle(element, 'opacity'))  
    return parseFloat(opacity);  
  if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))  
    if(opacity[1]) return parseFloat(opacity[1]) / 100;  
  return 1.0;  
}

Element.setOpacity = function(element, value){  
  element= $(element);  
  if (value == 1){
    Element.setStyle(element, { opacity: 
      (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 
      0.999999 : null });
    if(/MSIE/.test(navigator.userAgent))  
      Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});  
  } else {  
    if(value < 0.00001) value = 0;  
    Element.setStyle(element, {opacity: value});
    if(/MSIE/.test(navigator.userAgent))  
     Element.setStyle(element, 
       { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
                 'alpha(opacity='+value*100+')' });  
  }
}  
 
Element.getInlineOpacity = function(element){  
  return $(element).style.opacity || '';
}  

Element.childrenWithClassName = function(element, className, findFirst) {
  var classNameRegExp = new RegExp("(^|\\s)" + className + "(\\s|$)");
  var results = $A($(element).getElementsByTagName('*'))[findFirst ? 'detect' : 'select']( function(c) { 
    return (c.className && c.className.match(classNameRegExp));
  });
  if(!results) results = [];
  return results;
}

Element.forceRerendering = function(element) {
  try {
    element = $(element);
    var n = document.createTextNode(' ');
    element.appendChild(n);
    element.removeChild(n);
  } catch(e) { }
};

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

Array.prototype.call = function() {
  var args = arguments;
  this.each(function(f){ f.apply(this, args) });
}

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

var Effect = {
  tagifyText: function(element) {
    var tagifyStyle = 'position:relative';
    if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
    element = $(element);
    $A(element.childNodes).each( function(child) {
      if(child.nodeType==3) {
        child.nodeValue.toArray().each( function(character) {
          element.insertBefore(
            Builder.node('span',{style: tagifyStyle},
              character == ' ' ? String.fromCharCode(160) : character), 
              child);
        });
        Element.remove(child);
      }
    });
  },
  multiple: function(element, effect) {
    var elements;
    if(((typeof element == 'object') || 
        (typeof element == 'function')) && 
       (element.length))
      elements = element;
    else
      elements = $(element).childNodes;
      
    var options = Object.extend({
      speed: 0.1,
      delay: 0.0
    }, arguments[2] || {});
    var masterDelay = options.delay;

    $A(elements).each( function(element, index) {
      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
    });
  },
  PAIRS: {
    'slide':  ['SlideDown','SlideUp'],
    'blind':  ['BlindDown','BlindUp'],
    'appear': ['Appear','Fade']
  },
  toggle: function(element, effect) {
    element = $(element);
    effect = (effect || 'appear').toLowerCase();
    var options = Object.extend({
      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    }, arguments[2] || {});
    Effect[element.visible() ? 
      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
  }
};

var Effect2 = Effect; // deprecated

/* ------------- transitions ------------- */

Effect.Transitions = {}

Effect.Transitions.linear = function(pos) {
  return pos;
}
Effect.Transitions.sinoidal = function(pos) {
  return (-Math.cos(pos*Math.PI)/2) + 0.5;
}
Effect.Transitions.reverse  = function(pos) {
  return 1-pos;
}
Effect.Transitions.flicker = function(pos) {
  return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
}
Effect.Transitions.wobble = function(pos) {
  return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
}
Effect.Transitions.pulse = function(pos) {
  return (Math.floor(pos*10) % 2 == 0 ? 
    (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
}
Effect.Transitions.none = function(pos) {
  return 0;
}
Effect.Transitions.full = function(pos) {
  return 1;
}

/* ------------- core effects ------------- */

Effect.ScopedQueue = Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
  initialize: function() {
    this.effects  = [];
    this.interval = null;
  },
  _each: function(iterator) {
    this.effects._each(iterator);
  },
  add: function(effect) {
    var timestamp = new Date().getTime();
    
    var position = (typeof effect.options.queue == 'string') ? 
      effect.options.queue : effect.options.queue.position;
    
    switch(position) {
      case 'front':
        // move unstarted effects after this effect  
        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
            e.startOn  += effect.finishOn;
            e.finishOn += effect.finishOn;
          });
        break;
      case 'end':
        // start effect after last queued effect has finished
        timestamp = this.effects.pluck('finishOn').max() || timestamp;
        break;
    }
    
    effect.startOn  += timestamp;
    effect.finishOn += timestamp;

    if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
      this.effects.push(effect);
    
    if(!this.interval) 
      this.interval = setInterval(this.loop.bind(this), 40);
  },
  remove: function(effect) {
    this.effects = this.effects.reject(function(e) { return e==effect });
    if(this.effects.length == 0) {
      clearInterval(this.interval);
      this.interval = null;
    }
  },
  loop: function() {
    var timePos = new Date().getTime();
    this.effects.invoke('loop', timePos);
  }
});

Effect.Queues = {
  instances: $H(),
  get: function(queueName) {
    if(typeof queueName != 'string') return queueName;
    
    if(!this.instances[queueName])
      this.instances[queueName] = new Effect.ScopedQueue();
      
    return this.instances[queueName];
  }
}
Effect.Queue = Effect.Queues.get('global');

Effect.DefaultOptions = {
  transition: Effect.Transitions.sinoidal,
  duration:   1.0,   // seconds
  fps:        25.0,  // max. 25fps due to Effect.Queue implementation
  sync:       false, // true for combining
  from:       0.0,
  to:         1.0,
  delay:      0.0,
  queue:      'parallel'
}

Effect.Base = function() {};
Effect.Base.prototype = {
  position: null,
  start: function(options) {
    this.options      = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
    this.currentFrame = 0;
    this.state        = 'idle';
    this.startOn      = this.options.delay*1000;
    this.finishOn     = this.startOn + (this.options.duration*1000);
    this.event('beforeStart');
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).add(this);
  },
  loop: function(timePos) {
    if(timePos >= this.startOn) {
      if(timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if(this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / (this.finishOn - this.startOn);
      var frame = Math.round(pos * this.options.fps * this.options.duration);
      if(frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  render: function(pos) {
    if(this.state == 'idle') {
      this.state = 'running';
      this.event('beforeSetup');
      if(this.setup) this.setup();
      this.event('afterSetup');
    }
    if(this.state == 'running') {
      if(this.options.transition) pos = this.options.transition(pos);
      pos *= (this.options.to-this.options.from);
      pos += this.options.from;
      this.position = pos;
      this.event('beforeUpdate');
      if(this.update) this.update(pos);
      this.event('afterUpdate');
    }
  },
  cancel: function() {
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {
    if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
    if(this.options[eventName]) this.options[eventName](this);
  },
  inspect: function() {
    return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
  }
}

Effect.Parallel = Class.create();
Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
  initialize: function(effects) {
    this.effects = effects || [];
    this.start(arguments[1]);
  },
  update: function(position) {
    this.effects.invoke('render', position);
  },
  finish: function(position) {
    this.effects.each( function(effect) {
      effect.render(1.0);
      effect.cancel();
      effect.event('beforeFinish');
      if(effect.finish) effect.finish(position);
      effect.event('afterFinish');
    });
  }
});

Effect.Opacity = Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    // make this work on IE on elements without 'layout'
    if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
      this.element.setStyle({zoom: 1});
    var options = Object.extend({
      from: this.element.getOpacity() || 0.0,
      to:   1.0
    }, arguments[1] || {});
    this.start(options);
  },
  update: function(position) {
    this.element.setOpacity(position);
  }
});

Effect.Move = Class.create();
Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'relative'
    }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Bug in Opera: Opera returns the "real" position of a static element or
    // relative element that does not have top/left explicitly set.
    // ==> Always set top and left for position relative elements in your stylesheets 
    // (to 0 if you do not need them) 
    this.element.makePositioned();
    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
    if(this.options.mode == 'absolute') {
      // absolute movement, so we need to calc deltaX and deltaY
      this.options.x = this.options.x - this.originalLeft;
      this.options.y = this.options.y - this.originalTop;
    }
  },
  update: function(position) {
    this.element.setStyle({
      left: this.options.x  * position + this.originalLeft + 'px',
      top:  this.options.y  * position + this.originalTop  + 'px'
    });
  }
});

// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
  return new Effect.Move(element, 
    Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
};

Effect.Scale = Class.create();
Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
  initialize: function(element, percent) {
    this.element = $(element)
    var options = Object.extend({
      scaleX: true,
      scaleY: true,
      scaleContent: true,
      scaleFromCenter: false,
      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
      scaleFrom: 100.0,
      scaleTo:   percent
    }, arguments[2] || {});
    this.start(options);
  },
  setup: function() {
    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    this.elementPositioning = this.element.getStyle('position');
    
    this.originalStyle = {};
    ['top','left','width','height','fontSize'].each( function(k) {
      this.originalStyle[k] = this.element.style[k];
    }.bind(this));
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
    
    var fontSize = this.element.getStyle('font-size') || '100%';
    ['em','px','%'].each( function(fontSizeType) {
      if(fontSize.indexOf(fontSizeType)>0) {
        this.fontSize     = parseFloat(fontSize);
        this.fontSizeType = fontSizeType;
      }
    }.bind(this));
    
    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
    
    this.dims = null;
    if(this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
    if(/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if(!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
  },
  update: function(position) {
    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
    if(this.options.scaleContent && this.fontSize)
      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
  },
  finish: function(position) {
    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
  },
  setDimensions: function(height, width) {
    var d = {};
    if(this.options.scaleX) d.width = width + 'px';
    if(this.options.scaleY) d.height = height + 'px';
    if(this.options.scaleFromCenter) {
      var topd  = (height - this.dims[0])/2;
      var leftd = (width  - this.dims[1])/2;
      if(this.elementPositioning == 'absolute') {
        if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
        if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
      } else {
        if(this.options.scaleY) d.top = -topd + 'px';
        if(this.options.scaleX) d.left = -leftd + 'px';
      }
    }
    this.element.setStyle(d);
  }
});

Effect.Highlight = Class.create();
Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Prevent executing on elements not in the layout flow
    if(this.element.getStyle('display')=='none') { this.cancel(); return; }
    // Disable background image during the effect
    this.oldStyle = {
      backgroundImage: this.element.getStyle('background-image') };
    this.element.setStyle({backgroundImage: 'none'});
    if(!this.options.endcolor)
      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
    if(!this.options.restorecolor)
      this.options.restorecolor = this.element.getStyle('background-color');
    // init color calculations
    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
  },
  update: function(position) {
    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
      return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
  },
  finish: function() {
    this.element.setStyle(Object.extend(this.oldStyle, {
      backgroundColor: this.options.restorecolor
    }));
  }
});

Effect.ScrollTo = Class.create();
Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    this.start(arguments[1] || {});
  },
  setup: function() {
    Position.prepare();
    var offsets = Position.cumulativeOffset(this.element);
    if(this.options.offset) offsets[1] += this.options.offset;
    var max = window.innerHeight ? 
      window.height - window.innerHeight :
      document.body.scrollHeight - 
        (document.documentElement.clientHeight ? 
          document.documentElement.clientHeight : document.body.clientHeight);
    this.scrollStart = Position.deltaY;
    this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
  },
  update: function(position) {
    Position.prepare();
    window.scrollTo(Position.deltaX, 
      this.scrollStart + (position*this.delta));
  }
});

/* ------------- combination effects ------------- */

Effect.Fade = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  var options = Object.extend({
  from: element.getOpacity() || 1.0,
  to:   0.0,
  afterFinishInternal: function(effect) { 
    if(effect.options.to!=0) return;
    effect.element.hide();
    effect.element.setStyle({opacity: oldOpacity}); 
  }}, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

Effect.Appear = function(element) {
  element = $(element);
  var options = Object.extend({
  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
  to:   1.0,
  // force Safari to render floated elements properly
  afterFinishInternal: function(effect) {
    effect.element.forceRerendering();
  },
  beforeSetup: function(effect) {
    effect.element.setOpacity(effect.options.from);
    effect.element.show(); 
  }}, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

Effect.Puff = function(element) {
  element = $(element);
  var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position') };
  return new Effect.Parallel(
   [ new Effect.Scale(element, 200, 
      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
     Object.extend({ duration: 1.0, 
      beforeSetupInternal: function(effect) {
        effect.effects[0].element.setStyle({position: 'absolute'}); },
      afterFinishInternal: function(effect) {
         effect.effects[0].element.hide();
         effect.effects[0].element.setStyle(oldStyle); }
     }, arguments[1] || {})
   );
}

Effect.BlindUp = function(element) {
  element = $(element);
  element.makeClipping();
  return new Effect.Scale(element, 0, 
    Object.extend({ scaleContent: false, 
      scaleX: false, 
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.hide();
        effect.element.undoClipping();
      } 
    }, arguments[1] || {})
  );
}

Effect.BlindDown = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, 
    Object.extend({ scaleContent: false, 
      scaleX: false,
      scaleFrom: 0,
      scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
      restoreAfterFinish: true,
      afterSetup: function(effect) {
        effect.element.makeClipping();
        effect.element.setStyle({height: '0px'});
        effect.element.show(); 
      },  
      afterFinishInternal: function(effect) {
        effect.element.undoClipping();
      }
    }, arguments[1] || {})
  );
}

Effect.SwitchOff = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  return new Effect.Appear(element, { 
    duration: 0.4,
    from: 0,
    transition: Effect.Transitions.flicker,
    afterFinishInternal: function(effect) {
      new Effect.Scale(effect.element, 1, { 
        duration: 0.3, scaleFromCenter: true,
        scaleX: false, scaleContent: false, restoreAfterFinish: true,
        beforeSetup: function(effect) { 
          effect.element.makePositioned();
          effect.element.makeClipping();
        },
        afterFinishInternal: function(effect) {
          effect.element.hide();
          effect.element.undoClipping();
          effect.element.undoPositioned();
          effect.element.setStyle({opacity: oldOpacity});
        }
      })
    }
  });
}

Effect.DropOut = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left'),
    opacity: element.getInlineOpacity() };
  return new Effect.Parallel(
    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
    Object.extend(
      { duration: 0.5,
        beforeSetup: function(effect) {
          effect.effects[0].element.makePositioned(); 
        },
        afterFinishInternal: function(effect) {
          effect.effects[0].element.hide();
          effect.effects[0].element.undoPositioned();
          effect.effects[0].element.setStyle(oldStyle);
        } 
      }, arguments[1] || {}));
}

Effect.Shake = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left') };
    return new Effect.Move(element, 
      { x:  20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
        effect.element.undoPositioned();
        effect.element.setStyle(oldStyle);
  }}) }}) }}) }}) }}) }});
}

Effect.SlideDown = function(element) {
  element = $(element);
  element.cleanWhitespace();
  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
  var oldInnerBottom = $(element.firstChild).getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false, 
    scaleFrom: window.opera ? 0 : 1,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.firstChild.makePositioned();
      if(window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping();
      effect.element.setStyle({height: '0px'});
      effect.element.show(); },
    afterUpdateInternal: function(effect) {
      effect.element.firstChild.setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
    },
    afterFinishInternal: function(effect) {
      effect.element.undoClipping(); 
      // IE will crash if child is undoPositioned first
      if(/MSIE/.test(navigator.userAgent)){
        effect.element.undoPositioned();
        effect.element.firstChild.undoPositioned();
      }else{
        effect.element.firstChild.undoPositioned();
        effect.element.undoPositioned();
      }
      effect.element.firstChild.setStyle({bottom: oldInnerBottom}); }
    }, arguments[1] || {})
  );
}
  
Effect.SlideUp = function(element) {
  element = $(element);
  element.cleanWhitespace();
  var oldInnerBottom = $(element.firstChild).getStyle('bottom');
  return new Effect.Scale(element, window.opera ? 0 : 1,
   Object.extend({ scaleContent: false, 
    scaleX: false, 
    scaleMode: 'box',
    scaleFrom: 100,
    restoreAfterFinish: true,
    beforeStartInternal: function(effect) {
      effect.element.makePositioned();
      effect.element.firstChild.makePositioned();
      if(window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping();
      effect.element.show(); },  
    afterUpdateInternal: function(effect) {
      effect.element.firstChild.setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); },
    afterFinishInternal: function(effect) {
      effect.element.hide();
      effect.element.undoClipping();
      effect.element.firstChild.undoPositioned();
      effect.element.undoPositioned();
      effect.element.setStyle({bottom: oldInnerBottom}); }
   }, arguments[1] || {})
  );
}

// Bug in opera makes the TD containing this element expand for a instance after finish 
Effect.Squish = function(element) {
  return new Effect.Scale(element, window.opera ? 1 : 0, 
    { restoreAfterFinish: true,
      beforeSetup: function(effect) {
        effect.element.makeClipping(effect.element); },  
      afterFinishInternal: function(effect) {
        effect.element.hide(effect.element); 
        effect.element.undoClipping(effect.element); }
  });
}

Effect.Grow = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.full
  }, arguments[1] || {});
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();    
  var initialMoveX, initialMoveY;
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      initialMoveX = initialMoveY = moveX = moveY = 0; 
      break;
    case 'top-right':
      initialMoveX = dims.width;
      initialMoveY = moveY = 0;
      moveX = -dims.width;
      break;
    case 'bottom-left':
      initialMoveX = moveX = 0;
      initialMoveY = dims.height;
      moveY = -dims.height;
      break;
    case 'bottom-right':
      initialMoveX = dims.width;
      initialMoveY = dims.height;
      moveX = -dims.width;
      moveY = -dims.height;
      break;
    case 'center':
      initialMoveX = dims.width / 2;
      initialMoveY = dims.height / 2;
      moveX = -dims.width / 2;
      moveY = -dims.height / 2;
      break;
  }
  
  return new Effect.Move(element, {
    x: initialMoveX,
    y: initialMoveY,
    duration: 0.01, 
    beforeSetup: function(effect) {
      effect.element.hide();
      effect.element.makeClipping();
      effect.element.makePositioned();
    },
    afterFinishInternal: function(effect) {
      new Effect.Parallel(
        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
          new Effect.Scale(effect.element, 100, {
            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
        ], Object.extend({
             beforeSetup: function(effect) {
               effect.effects[0].element.setStyle({height: '0px'});
               effect.effects[0].element.show(); 
             },
             afterFinishInternal: function(effect) {
               effect.effects[0].element.undoClipping();
               effect.effects[0].element.undoPositioned();
               effect.effects[0].element.setStyle(oldStyle); 
             }
           }, options)
      )
    }
  });
}

Effect.Shrink = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.none
  }, arguments[1] || {});
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      moveX = moveY = 0;
      break;
    case 'top-right':
      moveX = dims.width;
      moveY = 0;
      break;
    case 'bottom-left':
      moveX = 0;
      moveY = dims.height;
      break;
    case 'bottom-right':
      moveX = dims.width;
      moveY = dims.height;
      break;
    case 'center':  
      moveX = dims.width / 2;
      moveY = dims.height / 2;
      break;
  }
  
  return new Effect.Parallel(
    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
    ], Object.extend({            
         beforeStartInternal: function(effect) {
           effect.effects[0].element.makePositioned();
           effect.effects[0].element.makeClipping(); },
         afterFinishInternal: function(effect) {
           effect.effects[0].element.hide();
           effect.effects[0].element.undoClipping();
           effect.effects[0].element.undoPositioned();
           effect.effects[0].element.setStyle(oldStyle); }
       }, options)
  );
}

Effect.Pulsate = function(element) {
  element = $(element);
  var options    = arguments[1] || {};
  var oldOpacity = element.getInlineOpacity();
  var transition = options.transition || Effect.Transitions.sinoidal;
  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
  reverser.bind(transition);
  return new Effect.Opacity(element, 
    Object.extend(Object.extend({  duration: 3.0, from: 0,
      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
    }, options), {transition: reverser}));
}

Effect.Fold = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height };
  Element.makeClipping(element);
  return new Effect.Scale(element, 5, Object.extend({   
    scaleContent: false,
    scaleX: false,
    afterFinishInternal: function(effect) {
    new Effect.Scale(element, 1, { 
      scaleContent: false, 
      scaleY: false,
      afterFinishInternal: function(effect) {
        effect.element.hide();
        effect.element.undoClipping(); 
        effect.element.setStyle(oldStyle);
      } });
  }}, arguments[1] || {}));
};

['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each( 
  function(f) { Element.Methods[f] = Element[f]; }
);

Element.Methods.visualEffect = function(element, effect, options) {
  s = effect.gsub(/_/, '-').camelize();
  effect_class = s.charAt(0).toUpperCase() + s.substring(1);
  new Effect[effect_class](element, options);
  return $(element);
};

Element.addMethods();

//

// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================

// HISTORY
// ------------------------------------------------------------------
// March 18, 2004: Updated to include max depth limit, ignoring standard
//    objects, ignoring references to itself, and following only
//    certain object properties.
// March 17, 2004: Created
/* 
DESCRIPTION: These functions let you easily and quickly view the data
structure of javascript objects and variables

COMPATABILITY: Will work in any javascript-enabled browser

USAGE:

// Return the output as a string, and you can do with it whatever you want
var out = Dumper(obj);

// When starting to traverse through the object, only follow certain top-
// level properties. Ignore the others
var out = Dumper(obj,'value','text');

// Sometimes the object you are dumping has a huge number of properties, like
// form fields. If you are only interested in certain properties of certain 
// types of tags, you can restrict that like Below. Then if DataDumper finds
// an object that is a tag of type "OPTION" it will only examine the properties
// of that object that are specified.
DumperTagProperties["OPTION"] = [ 'text','value','defaultSelected' ]

// View the structure of an object in a window alert
DumperAlert(obj);

// Popup a new window and write the Dumper output to that window
DumperPopup(obj);

// Write the Dumper output to a document using document.write()
DumperWrite(obj);
// Optionall, give it a different document to write to
DumperWrite(obj,documentObject);

NOTES: Be Careful! Some objects hold references to their parent nodes, other
objects, etc. Data Dumper will keep traversing these nodes as well, until you
have a really, really huge tree built up. If the object you are passing in has
references to other document objects, you should either:
	1) Set the maximum depth that Data Dumper will search (set DumperMaxDepth)
or
	2) Pass in only certain object properties to traverse
or
	3) Set the object properties to traverse for each type of tag
	
*/ 
var DumperIndent = 1;
var DumperIndentText = " ";
var DumperNewline = "\n";
var DumperObject = null; // Keeps track of the root object passed in
var DumperMaxDepth = -1; // Max depth that Dumper will traverse in object
var DumperIgnoreStandardObjects = true; // Ignore top-level objects like window, document
var DumperProperties = null; // Holds properties of top-level object to traverse - others are igonred
var DumperTagProperties = new Object(); // Holds properties to traverse for certain HTML tags
function DumperGetArgs(a,index) {
	var args = new Array();
	// This is kind of ugly, but I don't want to use js1.2 functions, just in case...
	for (var i=index; i<a.length; i++) {
		args[args.length] = a[i];
	}
	return args;
}
function DumperPopup(o) {
	var w = window.open("about:blank");
	w.document.open();
	w.document.writeln("<HTML><BODY><PRE>");
	w.document.writeln(Dumper(o,DumperGetArgs(arguments,1)));
	w.document.writeln("</PRE></BODY></HTML>");
	w.document.close();
}
function DumperAlert(o) {
	alert(Dumper(o,DumperGetArgs(arguments,1)));
}
function DumperWrite(o) {
	var argumentsIndex = 1;
	var d = document;
	if (arguments.length>1 && arguments[1]==window.document) {
		d = arguments[1];
		argumentsIndex = 2;
	}
	var temp = DumperIndentText;
	var args = DumperGetArgs(arguments,argumentsIndex)
	DumperIndentText = "&nbsp;";
	d.write(Dumper(o,args));
	DumperIndentText = temp;
}
function DumperPad(len) {
	var ret = "";
	for (var i=0; i<len; i++) {
		ret += DumperIndentText;
	}
	return ret;
}
function Dumper(o) {
	var level = 1;
	var indentLevel = DumperIndent;
	var ret = "";
	if (arguments.length>1 && typeof(arguments[1])=="number") {
		level = arguments[1];
		indentLevel = arguments[2];
		if (o == DumperObject) {
			return "[original object]";
		}
	}
	else {
		DumperObject = o;
		// If a list of properties are passed in
		if (arguments.length>1) {
			var list = arguments;
			var listIndex = 1;
			if (typeof(arguments[1])=="object") {
				list = arguments[1];
				listIndex = 0;
			}
			for (var i=listIndex; i<list.length; i++) {
				if (DumperProperties == null) { DumperProperties = new Object(); }
				DumperProperties[list[i]]=1;
			}
		}
	}
	if (DumperMaxDepth != -1 && level > DumperMaxDepth) {
		return "...";
	}
	if (DumperIgnoreStandardObjects) {
		if (o==window || o==window.document) {
			return "[Ignored Object]";
		}
	}
	// NULL
	if (o==null) {
		ret = "null";
		return ret;
	}
	// FUNCTION
	if (typeof(o)=="function") {
		ret = "[function]";
		return ret;
	} 
	// BOOLEAN
	if (typeof(o)=="boolean") {
		ret = (o)?"true":"false";
		return ret;
	} 
	// STRING
	if (typeof(o)=="string") {
		ret = "'" + o + "'";
		return ret;
	} 
	// NUMBER	
	if (typeof(o)=="number") {
		ret = o;
		return ret;
	}
	if (typeof(o)=="object") {
		if (typeof(o.length)=="number" ) {
			// ARRAY
			ret = "[";
			for (var i=0; i<o.length;i++) {
				if (i>0) {
					ret += "," + DumperNewline + DumperPad(indentLevel);
				}
				else {
					ret += DumperNewline + DumperPad(indentLevel);
				}
				ret += Dumper(o[i],level+1,indentLevel-0+DumperIndent);
			}
			if (i > 0) {
				ret += DumperNewline + DumperPad(indentLevel-DumperIndent);
			}
			ret += "]";
			return ret;
		}
		else {
			// OBJECT
			ret = "{";
			var count = 0;
			for (i in o) {
				if (o==DumperObject && DumperProperties!=null && DumperProperties[i]!=1) {
					// do nothing with this node
				}
				else {
					if (typeof(o[i]) != "unknown") {
						var processAttribute = true;
						// Check if this is a tag object, and if so, if we have to limit properties to look at
						if (typeof(o.tagName)!="undefined") {
							if (typeof(DumperTagProperties[o.tagName])!="undefined") {
								processAttribute = false;
								for (var p=0; p<DumperTagProperties[o.tagName].length; p++) {
									if (DumperTagProperties[o.tagName][p]==i) {
										processAttribute = true;
										break;
									}
								}
							}
						}
						if (processAttribute) {
							if (count++>0) {
								ret += "," + DumperNewline + DumperPad(indentLevel);
							}
							else {
								ret += DumperNewline + DumperPad(indentLevel);
							}
							//ret += "'" + i + "' => " + Dumper(o[i],level+1,indentLevel-0+i.length+6+DumperIndent);
							//MDM changed
							ret += "'" + i + "': " + Dumper(o[i],level+1,indentLevel-0+i.length+6+DumperIndent);
						}
					}
				}
			}
			if (count > 0) {
				ret += DumperNewline + DumperPad(indentLevel-DumperIndent);
			}
			ret += "}";
			return ret;
		}
	}
}

//

// This code was written by Tyler Akins and has been placed in the
// public domain.  It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
//--
// Thanks Tyler! :)

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}

function decode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}


if(![].push){ Array.prototype.push=function(){ for(var i=0;i<arguments.length;i++){ this[this.length-1]=arguments[i]; } return this.length; }; } if(typeof unFocus=="undefined"){ var unFocus={}; } if(!unFocus.Utilities){ unFocus.Utilities={}; } unFocus.Utilities.EventManager=function(_2){ this._listeners={}; for(var i=arguments.length;-1<--i;){ this._listeners[arguments[i]]=[]; } }; unFocus.Utilities.EventManager.prototype.addEventListener=function(_4,_5){ for(var i=this._listeners[_4].length;-1<--i;){ if(this._listeners[_4][i]==_5){ return; } } this._listeners[_4].push(_5); }; unFocus.Utilities.EventManager.prototype.removeEventListener=function(_7,_8){ for(var i=this._listeners[_7].length;-1<--i;){ if(this._listeners[_7][i]==_8){ this._listeners.splice(i,1); break; } } }; unFocus.Utilities.EventManager.prototype.notifyListeners=function(_a,_b){ for(var i=this._listeners[_a].length;-1<--i;){ this._listeners[_a][i](_b); } }; if(typeof unFocus=="undefined"){ var unFocus={}; } unFocus.History=(function(){ function Keeper(){ var _d=this,_pollInterval=200,_intervalID,_currentHash=_getHash(); function _getHash(){ return location.hash.substring(1); } function _setHash(_e){ window.location.hash=_e; } function _watchHash(){ var _f=_getHash(); if(_currentHash!=_f){ _currentHash=_f; _d.notifyListeners("historyChange",_f); } } if(setInterval){ _intervalID=setInterval(_watchHash,_pollInterval); } _d.getCurrent=function(){ return _currentHash; }; function _createAnchor(_10){ if(!_checkAnchorExists(_10)){ var _11=document.createElement("a"); _11.setAttribute("name",_10); if(/MSIE/.test(navigator.userAgent)&&!window.opera){ _11=document.createElement("<a name=\""+_10+"\">"+_10+"</a>"); } _11.style.position="absolute"; _11.style.top=getScrollY()+"px"; _11.style.left=getScrollX()+"px"; document.body.insertBefore(_11,document.body.firstChild); } } function _checkAnchorExists(_12){ var _13=document.anchors; for(var i=0;i<_13.length;i++){ if(_13[i].name==_12){ return true; } } return false; } if(typeof self.pageYOffset=="number"){ function getScrollY(){ return self.pageYOffset; } }else{ if(document.documentElement&&document.documentElement.scrollTop){ function getScrollY(){ return document.documentElement.scrollTop; } }else{ if(document.body){ function getScrollY(){ return document.body.scrollTop; } } } } eval(String(getScrollY).toString().replace(/Top/g,"Left").replace(/Y/g,"X")); _d.addHistory=function(){ }; if(navigator.appVersion.indexOf("Safari")!=-1){ var _15=history.length,_historyArray=[],_recentlyAdded=false; _historyArray[_15]=location.hash; _d.addHistory=function(_16){ if(_currentHash!=_16){ _createAnchor(_16); _currentHash=_16; _setHash(_16); _15=history.length+1; _historyArray[_15]=_16; _recentlyAdded=true; _d.notifyListeners("historyChange",_16); } }; var _17=function(){ if(!_recentlyAdded){ var _18=history.length; if(_18!=_15){ _15=_18; var _19=_historyArray[_15]; if(_currentHash!=_19){ _currentHash=_19; _d.notifyListeners("historyChange",_19); } } }else{ _recentlyAdded=false; } }; clearInterval(_intervalID); _intervalID=setInterval(_17,_pollInterval); }else{ if(typeof ActiveXObject!="undefined"&&window.print&&!window.opera&&navigator.userAgent.match(/MSIE (\d\.\d)/)[1]>=5.5){ var _1a,_historyFrameRef; function _createHistoryFrame(){ var _1b="unFocusHistoryFrame"; _1a=document.createElement("iframe"); _1a.setAttribute("name",_1b); _1a.setAttribute("id",_1b); _1a.style.position="absolute"; _1a.style.top="-900px"; document.body.insertBefore(_1a,document.body.firstChild); _historyFrameRef=frames[_1b]; _createHistoryHTML(_currentHash,true); } function _createHistoryHTML(_1c){ _historyFrameRef.document.open("text/html"); _historyFrameRef.document.write("<html><head></head><body onl","oad=\"parent.unFocus.History._updateFromHistory('"+_1c+"');\">",_1c+"</body></html>"); _historyFrameRef.document.close(); } _d._updateFromHistory=function(){ _d._updateFromHistory=function(_1d){ _currentHash=_1d; _d.notifyListeners("historyChange",_1d); }; }; _d.addHistory=function(_1e){ _createHistoryFrame(); _d.addHistory=function(_1f){ if(_currentHash!=_1f){ _currentHash=_1f; _createHistoryHTML(_1f); } }; _d.addHistory(_1e); }; _d.addEventListener("historyChange",function(_20){ _setHash(_20); }); }else{ _d.addHistory=function(_21){ _createAnchor(_currentHash); _d.addHistory=function(_22){ if(_currentHash!=_22){ _createAnchor(_22); _currentHash=_22; _setHash(_22); _d.notifyListeners("historyChange",_22); } }; _d.addHistory(_21); }; } } } Keeper.prototype=new unFocus.Utilities.EventManager("historyChange"); return new Keeper(); })(); 
function GeojoeyMarker(_1,_2,_3){ this._point=_1; this._txt=_2; this._params=_3?_3:{}; } GeojoeyMarker.prototype=new GOverlay(); GeojoeyMarker.prototype.initialize=function(_4){ var _5=document.createElement("div"); _5.style.border="0px solid #000"; _5.style.position="absolute"; _5.style.zIndex=100000000; if(this._params.onmouseover){ _5.onmouseover=this._params.onmouseover; } var _6=document.createElement("div"); if(this._params.divId){ _6.id=this._params.divId; } _6.style.position="relative"; _6.style.left="5px"; _6.style.top="4px"; _6.style.width="101px"; _6.style.fontFamily="Verdana, Arial"; _6.style.textAlign="center"; _6.style.fontSize="10px"; _6.style.fontWeight="normal"; _6.style.border="0px solid #F00"; _6.style.color="#333"; _6.innerHTML=this._txt; _5.appendChild(_6); _4.getPane(G_MAP_MARKER_PANE).appendChild(_5); var _7=false; while(_6.offsetHeight>42){ _7=true; _6.innerHTML=_6.innerHTML.substr(0,_6.innerHTML.length-2); } if(_7){ _6.innerHTML=_6.innerHTML.substr(0,_6.innerHTML.length-4)+"..."; } if(_6.offsetHeight<20){ _5.style.width="135px"; _5.style.height="38px"; this._xAnchor=57; this._yAnchor=34; this._iconFile="searchMarker5.png"; }else{ if(_6.offsetHeight>20&&_6.offsetHeight<30){ _5.style.width="137px"; _5.style.height="50px"; this._xAnchor=57; this._yAnchor=48; this._iconFile="searchMarker6.png"; }else{ _5.style.width="137px"; _5.style.height="62px"; this._xAnchor=57; this._yAnchor=59; this._iconFile="searchMarker7.png"; } } if(isIE){ _5.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/images/"+this._iconFile+"\", sizingMethod=\"scale\")"; }else{ _5.style.backgroundImage="url(/images/"+this._iconFile+")"; } this._map=_4; this.div=_5; }; GeojoeyMarker.prototype.remove=function(){ if(this.div&&this.div.parentNode){ this.div.parentNode.removeChild(this.div); } }; GeojoeyMarker.prototype.copy=function(){ return new GeojoeyMarker(this._point,this._txt); }; GeojoeyMarker.prototype.redraw=function(_8){ if(!_8){ return; } var _9=this._map.fromLatLngToDivPixel(this._point); this.div.style.left=(_9.x-this._xAnchor)+"px"; this.div.style.top=(_9.y-this._yAnchor)+"px"; }; 
function GJMarker2(_1,_2){ this._point=_1; this._markerOpts=_2; this._map=null; this._zIndex=null; this.listeners={}; this.blankImg="/images/transparent.gif"; } GJMarker2.prototype=new GOverlay(); GJMarker2.prototype.getPoint=function(){ return this._point; }; GJMarker2.prototype.getIcon=function(){ return this._icon; }; GJMarker2.prototype.initialize=function(_3){ this._map=_3; this._icon=null; if(this._markerOpts==null||typeof (this._markerOpts.icon)=="undefined"||this._markerOpts.icon==null){ this._icon=new GIcon(G_DEFAULT_ICON); }else{ this._icon=this._markerOpts.icon; } var _4=isIE?"hand":"pointer"; this._shadow=document.createElement("IMG"); this._shadow.width=this._icon.shadowSize.width; this._shadow.height=this._icon.shadowSize.height; this._shadow.style.position="absolute"; this._transparent=document.createElement("IMG"); this._transparent.border="0"; this._transparent.width=this._icon.iconSize.width; this._transparent.height=this._icon.iconSize.height; this._transparent.style.position="absolute"; this._transparent.style.cursor=_4; this.div=document.createElement("DIV"); this.divId="icoDvId"+GJUNID++; this.div.id=this.divId; this.div.style.position="absolute"; this.div.style.display="block"; this.div.style.width=this._icon.iconSize.width+"px"; var _5=0; if(this._markerOpts.divStyle&&this._markerOpts.divStyle.paddingTop){ _5=parseInt(this._markerOpts.divStyle.paddingTop); } this.div.style.height=(this._icon.iconSize.height-_5)+"px"; if(isIE&&/\.png$/.test(this._icon.image)){ this.div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+this._icon.image+"\", sizingMethod=\"scale\")"; }else{ this.div.style.backgroundImage="url("+this._icon.image+")"; } if(this._markerOpts.divStyle){ for(var k in this._markerOpts.divStyle){ this.div.style[k]=this._markerOpts.divStyle[k]; } } if(this._markerOpts.text){ this.div.innerHTML=this._markerOpts.text; } if(this._icon.imageMap){ var _7="imageMap_"+GJUNID++; this._imgMap=document.createElement("map"); this._imgMap.id=_7; this._imgMap.name=_7; if(isIE&&this._markerOpts!=null&&typeof (this._markerOpts.title)!="undefined"&&this._markerOpts.title!=null){ this._transparent.title=this._markerOpts.title; }else{ if(this._markerOpts!=null&&typeof (this._markerOpts.title)!="undefined"&&this._markerOpts.title!=null){ this._imgMap.setAttribute("title",this._markerOpts.title); } } this.areaId="mapAreaElem_"+GJUNID++; this._imgMap.innerHTML="<area id=\""+this.areaId+"\" alt=\"\" shape=\"poly\" coords=\""+this._icon.imageMap.join()+"\" href=\"javascript:void(0);\" />"; _3.getContainer().appendChild(this._imgMap); for(var _8 in this.listeners){ $(this.areaId)["on"+_8]=this.listeners[_8]; } this._imgMap.style.zIndex=0; this._transparent.useMap="#"+_7; } _3.getPane(G_MAP_MARKER_PANE).appendChild(this.div); _3.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(this._shadow); _3.getPane(G_MAP_MARKER_MOUSE_TARGET_PANE).appendChild(this._transparent); if(isIE&&/\.png$/.test(this._icon.shadow)){ this._shadow.src=this.blankImg; this._shadow.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._icon.shadow+"')"; }else{ this._shadow.src=this._icon.shadow; } if(isIE&&/\.png$/.test(this._icon.transparent)){ this._transparent.src=this.blankImg; this._transparent.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._icon.transparent+"')"; }else{ this._transparent.src=this._icon.transparent; } }; GJMarker2.prototype.addListener=function(_9,fn){ this.listeners[_9]=function(e){ if(e){ Event.stop(e); }else{ if(event){ Event.stop(event); } } fn(); }; }; GJMarker2.prototype.redraw=function(_c){ if(!_c){ return; } var _d=this._map.fromLatLngToDivPixel(this._point); _d.x-=this._icon.iconAnchor.x; _d.y-=this._icon.iconAnchor.y; var _e=_d.x+"px"; var _f=_d.y+"px"; var _10=this._markerOpts.stackPadding?this._markerOpts.stackPadding:1; if(this._markerOpts.stackVal||this._markerOpts.stackVal===0){ this._zIndex=this._markerOpts.stackVal; }else{ this._zIndex=_d.y; } this._shadow.style.left=_e; this._shadow.style.top=_f; this._shadow.style.zIndex=this._zIndex; this._transparent.style.left=_e; this._transparent.style.top=_f; this._transparent.style.zIndex=this._zIndex; this.div.style.left=_e; this.div.style.top=_f; this.div.style.zIndex=this._zIndex+1; }; GJMarker2.prototype.remove=function(){ this._shadow.parentNode.removeChild(this._shadow); this._transparent.parentNode.removeChild(this._transparent); if(this.div){ this.div.parentNode.removeChild(this.div); } this._imgMap.parentNode.removeChild(this._imgMap); }; GJMarker2.prototype.copy=function(){ return new GJMarker2(this._point,this._markerOpts); }; GJMarker2.prototype.getZIndex=function(){ return this._zIndex; }; GJMarker2.prototype.setZIndex=function(_11){ this._zIndex=_11; this._shadow.style.zIndex=this._zIndex; this._transparent.style.zIndex=this._zIndex; this.div.style.zIndex=this._zIndex; }; GJMarker2.prototype.popIcon=function(){ this._beforePopZ=this._zIndex; var _12=this._map.fromLatLngToDivPixel(this._point); _12.x-=this._icon.iconAnchor.x; _12.y-=this._icon.iconAnchor.y; this.animWidth=parseInt(this.div.style.width); this.animX=_12.x; this.animStart=_12.x; this.animInt=setInterval(function(){ this._shadow.style.left=this.animX+"px"; this._transparent.style.left=this.animX+"px"; this.div.style.left=this.animX+"px"; this.animX+=10; if(this.animX>=this.animStart+this.animWidth){ clearInterval(this.animInt); this.setZIndex(100000000); this.animInt=setInterval(function(){ this.animX-=10; if(this.animX<=this.animStart){ this.animX=this.animStart; clearInterval(this.animInt); } this._shadow.style.left=this.animX+"px"; this._transparent.style.left=this.animX+"px"; this.div.style.left=this.animX+"px"; }.bind(this),1); } }.bind(this),1); }; GJMarker2.prototype.unPopIcon=function(){ clearInterval(this.animInt); this.setZIndex(this._beforePopZ); this.redraw(true); }; GJMarker2.prototype.resetZIndex=function(){ this._zIndex=GOverlay.getZIndex(this._point.lat()); if(this._markerOpts.stackVal){ this._zIndex-=this._markerOpts.stackVal; } this._shadow.style.zIndex=this._zIndex; this._transparent.style.zIndex=this._zIndex; }; GJMarker2.prototype.getPoint=function(){ return this._point; }; 
function GJTxtMarker1(_1,_2){ this._point=_1; this._map=null; this._borderColor=_2.borderColor; this._text=_2.text; this._markerOpts=_2; } GJTxtMarker1.prototype=new GOverlay(); GJTxtMarker1.prototype.initialize=function(_3){ this._map=_3; this.div=document.createElement("DIV"); this.divId="icoDvId"+GJUNID++; this.div.id=this.divId; this.div.style.position="absolute"; this.div.style.display="block"; this.div.style.border="0px solid #000"; this.div.style.padding="0px"; this.div.style.margin="0px"; this.div.style.textAlign="center"; this.div.style.fontFamily="Arial"; this.div.style.fontSize="7px"; this.div.style.opacity="0.65"; this.div.style.filter="alpha(opacity=65)"; this.div.style.MozOpacity="0.65"; if(isIE){ }else{ this.div.style.cursor="-moz-grab"; } this.innerId="icoInDv"+GJUNID++; this.div.innerHTML="<div style=\"border: 2px solid #"+this._borderColor+"; background-color: #FFF; padding: 1px; margin-bottom: -1px; font-family: Arial; font-size: 11px;\" id=\""+this.innerId+"\"></div><span style=\"border: 0px solid #"+this._borderColor+"; padding: 0px; margin: 0px; background-color: #"+this._borderColor+"; color: #"+this._borderColor+"; font-family: Arial; font-size: 7px; text-align: center; vertical-align: top;\">|</span>"; _3.getPane(G_MAP_MARKER_PANE).appendChild(this.div); var _4=this._text; var _5=_4.replace(/\s+/g,"&nbsp;"); $(this.innerId).innerHTML=_5; if(Element.getDimensions($(this.innerId)).width>100){ this.div.style.width="100px"; $(this.innerId).innerHTML=_4; this.txt=_4; }else{ this.txt=_5; } }; GJTxtMarker1.prototype.redraw=function(_6){ if(!_6){ return; } var _7=this._map.fromLatLngToDivPixel(this._point); _7.x-=Math.floor(Element.getDimensions(this.div).width/2); _7.y-=Element.getDimensions(this.div).height; var _8=_7.x+"px"; var _9=_7.y+"px"; this.div.style.left=_8; this.div.style.top=_9; }; GJTxtMarker1.prototype.remove=function(){ if(this.div){ this.div.parentNode.removeChild(this.div); } }; GJTxtMarker1.prototype.copy=function(){ return new GJTxtMarker1(this._point,this._markerOpts); }; 
var gjutilsClass=Class.create(); gjutilsClass.prototype={initialize:function(){ },postGoogleInit:function(){ },getMaxZIndexDiv:function(){ maxZ=0; documentDivs=$$("div").each(function(_1){ maxZ=(maxZ<_1.zIndex)?_1.zIndex:maxZ; }); return maxZ; },getWindowSize:function(){ var _2=0,myHeight=0; if(typeof (window.innerWidth)=="number"){ _2=window.innerWidth; myHeight=window.innerHeight; }else{ if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){ _2=document.documentElement.clientWidth; myHeight=document.documentElement.clientHeight; }else{ if(document.body&&(document.body.clientWidth||document.body.clientHeight)){ _2=document.body.clientWidth; myHeight=document.body.clientHeight; } } } return [_2,myHeight]; },getInternetExplorerVersion:function(){ var rv=false; if(navigator.appName=="Microsoft Internet Explorer"){ var ua=navigator.userAgent; var re=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"); if(re.exec(ua)!=null){ rv=parseFloat(RegExp.$1); } } return rv; },URLencode:function(_6){ return escape(_6).replace(/\+/g,"%2B").replace(/\"/g,"%22").replace(/\'/g,"%27").replace(/\//g,"%2F"); },bench:function(){ if(benchTime>0){ elapsed=((new Date()).getTime()-benchTime)/1000; benchTime=(new Date()).getTime(); if(outElem){ GLog.write(outElem,"bench: "+elapsed); } }else{ benchTime=(new Date()).getTime(); } },limitTextArea:function(_7){ var _8=_7.getAttribute?parseInt(_7.getAttribute("maxlength")):""; if(_7.getAttribute&&_7.value.length>_8){ _7.value=_7.value.substring(0,_8); } },getLineDistance:function(_9){ var _a=_9[0]; var _b=0; for(var i=1;i<_9.length;i++){ _b+=_9[i].distanceFrom(_a); _a=_9[i]; } return _b; },getPixelDistance:function(p1,p2){ return Math.sqrt(Math.pow((p1.x-p2.x),2)+Math.pow((p1.y-p2.y),2)); },getLinePixelDistance:function(_f,_10){ var _11=_10[0]; var _12=0; for(var i=1;i<_10.length;i++){ _12+=this.getPixelDistance(_f.fromLatLngToDivPixel(_10[i]),_f.fromLatLngToDivPixel(_11)); _11=_10[i]; } return _12; },findLineCenter:function(_14,_15){ var _16=_15/2; var _17=0; var _18=_14[0]; for(var i=1;i<_14.length;i++){ _17+=_14[i].distanceFrom(_18); if(_17>=_16){ return new GLatLng((_14[i].lat()+_18.lat())/2,(_14[i].lng()+_18.lng())/2); } _18=_14[i]; } },numbersOnly:function(_1a,e,dec){ var key; var _1e; if(window.event){ key=window.event.keyCode; }else{ if(e){ key=e.which; }else{ return true; } } _1e=String.fromCharCode(key); if((key==null)||(key==0)||(key==8)||(key==9)||(key==13)||(key==27)){ return true; }else{ if((("0123456789").indexOf(_1e)>-1)){ return true; }else{ if(dec&&(_1e==".")){ _1a.form.elements[dec].focus(); return false; }else{ return false; } } } },makeBlogIcon:function(_1f,num){ var _21=new GIcon(); _21.image="/images/blogIconOrange.png"; _21.shadow="/images/blogIconShadow.png"; _21.iconSize=new GSize(27,29); _21.shadowSize=new GSize(35,31); _21.iconAnchor=new GPoint(14,29); _21.infoWindowAnchor=new GPoint(14,29); _21.imageMap=[1,6,3,3,6,1,21,1,24,3,26,6,26,17,24,20,21,22,18,22,15,25,14,29,12,25,10,22,6,22,3,20,1,17,1,6,1,6]; _21.transparent="/images/blogIconTrans.png"; var _22={fontFamily:"Arial",fontSize:"14px",fontWeight:"bold",color:"#FFF",paddingTop:"3px",textAlign:"center"}; return new GJMarker2(_1f,{title:num,icon:_21,text:num,stackVal:num,stackPadding:0,divStyle:_22}); },colorRGBtoHex:function(col){ col=col.replace("rgb",""); col=col.replace("(",""); col=col.replace(")",""); col=col.replace(" ",""); var _24=col.split(","); return "#"+this.RGBtoHex(_24[0],_24[1],_24[2]); },RGBtoHex:function(R,G,B){ return this.toHex(R)+this.toHex(G)+this.toHex(B); },toHex:function(N){ if(N==null){ return "00"; } N=parseInt(N); if(N==0||isNaN(N)){ return "00"; } N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N); return "0123456789ABCDEF".charAt((N-N%16)/16)+"0123456789ABCDEF".charAt(N%16); },scrollToElement:function(_29,_2a){ _29=$(_29); _2a=$(_2a); if(_29.scrollHeight-_29.offsetHeight>_2a.offsetTop){ _29.scrollTop=_2a.offsetTop-50; }else{ _29.scrollTop=_29.scrollHeight; } },drawBlogEntryOverlays:function(map,_2c){ var _2d=new Array(); for(var i=0;i<_2c.length;i++){ if(_2c[i].points){ _2d.push(new GPolyline.fromEncoded(_2c[i])); }else{ _2d.push(new GJTxtMarker1(new GLatLng(parseFloat(_2c[i].lat),parseFloat(_2c[i].lon)),_2c[i])); } } _2d.each(function(_2f){ map.addOverlay(_2f); }); return _2d; },optionCreateAndSelect:function(_30,val,txt){ var _33=document.createElement("option"); _33.text=txt; _33.value=val; try{ $(_30).add(_33,null); } catch(ex){ $(_30).add(_33); } $(_30).selectedIndex=$(_30).length-1; }}; var loadingMessage=Class.create(); loadingMessage.prototype={initialize:function(_34,_35,_36){ if(!$(_34)){ return; } this.elemId=_34; this.loadingMessage=_35; this.loadingStyle=_36; $(_34).innerHTML="<div id=\"loadingMessage\" style=\"display: none;\">"+_35+"</div>"; _36.display="block"; $("loadingMessage").setStyle(_36); this.lCount=1; var _37=function(){ if(!$(this.elemId)){ clearInterval(this.intId); return; } var htm=this.loadingMessage; var _39=this.lCount%10; for(var i=0;i<=_39;i++){ htm+="."; } $("loadingMessage").innerHTML=htm; this.lCount++; }.bind(this); this.intId=setInterval(_37,100); },stop:function(){ clearInterval(this.intId); $(this.elemId).innerHTML=""; }}; var gjutils=new gjutilsClass(); var isIE=gjutils.getInternetExplorerVersion(); var fipsToISOD={AG:"DZ",AN:"AD",AC:"AG",AS:"AU",AU:"AT",AJ:"AZ",BF:"BS",BA:"BH",BG:"BD",BO:"BY",BH:"BZ",BN:"BJ",BL:"BO",BK:"BA",BC:"BW",BX:"BN",BU:"BG",UV:"BF",BM:"MM",BY:"BI",CB:"KH",CT:"CF",CD:"TD",CI:"CL",CH:"CN",CN:"KM",CF:"CG",CG:"CD",CS:"CR",IV:"CI",EZ:"CZ",DA:"DK",DO:"DM",DR:"DO",ES:"SV",EK:"GQ",EN:"EE",GB:"GA",GA:"GM",GG:"GE",GM:"DE",GJ:"GD",GV:"GN",PU:"GW",HA:"HT",HO:"HN",IC:"IS",IZ:"IQ",EI:"IE",IS:"IL",JA:"JP",KR:"KI",KN:"KP",KS:"KR",KU:"KW",LG:"LV",LE:"LB",LT:"LS",LI:"LR",LS:"LI",LH:"LT",MA:"MG",MI:"MW",RM:"MH",MP:"MU",MN:"MC",MG:"MN",MO:"MA",WA:"NA",NU:"NI",NG:"NE",NI:"NG",MU:"OM",PS:"PW",PM:"PA",PP:"PG",PA:"PY",RP:"PH",PO:"PT",RS:"RU",SC:"KN",ST:"LC",TP:"ST",SG:"SN",SE:"SC",SN:"SG",LO:"SK",BP:"SB",SF:"ZA",SP:"ES",CE:"LK",SU:"SD",NS:"SR",WZ:"SZ",SW:"SE",SZ:"CH",TI:"TJ",TO:"TG",TN:"TO",TD:"TT",TS:"TN",TU:"TR",TX:"TM",UP:"UA",UK:"GB",NH:"VU",VT:"VA",VM:"VN",YM:"YE",YI:"CS",ZA:"ZM",ZI:"ZW",AY:"AQ"}; function fipsToISO(_3b){ return fipsToISOD[_3b]?fipsToISOD[_3b]:_3b; } 
var PageContainer=Class.create(); PageContainer.prototype={initialize:function(_1){ this.elemId=_1; },loadPage:function(_2,_3,_4){ if(this.currentReq){ this.currentReq.transport.abort(); this._stopLoadingMsg(); } this._startLoadingMsg(); var p; if(typeof (_3)=="object"){ p=$H(_3).toQueryString(); }else{ p=_3; } var _6=_4?_4:function(){ }; this.currentReq=new Ajax.Updater(this.elemId,_2,{method:"post",evalScripts:true,parameters:p,onComplete:function(){ this._stopLoadingMsg(); _6(); }.bind(this),onException:function(r,e){ }.bind(this)}); },scrollUp:function(){ $(this.elemId).scrollTop=0; },scrollToTop:function(){ $(this.elemId).scrollTop=0; },scrollToBottom:function(){ $(this.elemId).scrollTop=$(this.elemId).scrollHeight; },isElementVisible:function(_9){ if(!$(_9)){ return; } if($(_9).offsetTop>$(this.elemId).scrollTop+20&&$(_9).offsetTop<($(this.elemId).scrollTop+$(this.elemId).offsetHeight-20)){ return true; }else{ return false; } },_startLoadingMsg:function(){ var _a=Element.getDimensions(this.elemId); $(this.elemId).innerHTML="<div style=\"width: 32px; height: 32px; position: relative; left: 20px; top: 20px;\"><img src=\"/images/loading2.gif\" width=\"32\" height=\"32\" border=\"0\" /></div>"; },_stopLoadingMsg:function(){ },getContainerDiv:function(){ return $(this.elemId); }}; 
var Suggest=Class.create(); Suggest.prototype={initialize:function(_1){ this.inputId=_1.inputElem||alert("missing inputId"); this.baseURL=_1.baseURL||alert("missing baseURL"); this.template=_1.template||alert("missing template"); this.selectedClass=_1.selectedClass||alert("missing selectedClass"); this.unselectedClass=_1.unselectedClass||alert("missing unselectedClass"); this.zIndex=_1.zIndex?parseInt(_1.zIndex):11; this.otherElems=_1.otherElems?_1.otherElems:[]; this.otherElems.each(function(_2){ $(_2)||alert("Element \""+_2+"\" does not exist!"); }); this.otherElems.each(function(_3){ Event.observe($(_3),"click",this.otherElementClick.bindAsEventListener(this),true); }.bind(this)); this.otherValues=_1.otherValues?_1.otherValues:{}; this.onListClick=_1.onListClick?_1.onListClick:false; this.onLoseFocus=_1.onLoseFocus?_1.onLoseFocus:false; this.onListOver=_1.onListOver?_1.onListOver:false; this.listCaches=new Array(); this.listHTMLCaches=new Array(); this.fetchesInProgress=new Array(); this.ajaxRequests=new Array(); this.validInputMatch=/[^\s\t\r\n]+/i; this.AjaxRequestsBusy=0; this.numLoadingDots=1; this.inputHasFocus=false; this.listSelected=false; this.lastArrowKeyTime=0; this.messages=new Array(); this.isIE=navigator.userAgent.indexOf("MSIE")>-1; Event.observe($(this.inputId),"focus",this.inputOnFocus.bindAsEventListener(this),false); Event.observe($(this.inputId),"blur",this.inputOnBlur.bindAsEventListener(this),false); Event.observe($(this.inputId),"keydown",this.inputOnKeyDown.bindAsEventListener(this),false); this.refreshInputPositions(); this.sBoxName="GJSResults"; new Insertion.Top($$("html body")[0],"<div id=\""+this.sBoxName+"\" style=\"display:none; position: absolute; left: "+this.inputPosLeft+"px; top: "+(this.inputPosTop+this.inputDimHeight)+"px; width: "+(this.inputDimWidth-8)+"px; height: 100px; overflow: auto; border: 4px solid #666; z-index: "+this.zIndex+"; background-color: #FFF;\" class=\"fb\">Loading...<br />asdf<br />asdf<br />asdf</div>"); Event.observe($(this.sBoxName),"click",this.sBoxOnClick.bindAsEventListener(this),false); Event.observe($(this.inputId),"click",this.inputOnClick.bindAsEventListener(this),false); Event.observe($(this.sBoxName),"scroll",this.sBoxOnScroll.bindAsEventListener(this),false); $(this.inputId).value=""; this.initialSBoxHeight=this.calculateSBoxHeight(); window.gjsOMO=this.listOnMouseOver.bindAsEventListener(this); window.gjsCLK=this.listOnClick.bindAsEventListener(this); this.disabled=false; },refreshInputPositions:function(){ var _4=Position.cumulativeOffset($(this.inputId)); this.inputPosLeft=_4[0]; this.inputPosTop=_4[1]; var _5=$(this.inputId).getDimensions(); this.inputDimWidth=_5.width; this.inputDimHeight=_5.height; },repositionSBox:function(){ this.refreshInputPositions(); $(this.sBoxName).style.left=this.inputPosLeft+"px"; $(this.sBoxName).style.top=(this.inputPosTop+this.inputDimHeight)+"px"; },disable:function(){ this.disabled=true; this.stopLoadingMessage(); this.hideList(); },enable:function(){ this.disabled=false; },otherElementClick:function(_6){ Event.stop(_6); },dumpMessages:function(){ this.messages.each(function(_7){ GLog.write(_7); }); },addMessage:function(_8){ this.messages.push(_8); },inputOnKeyDown:function(_9){ this.inputHasFocus=true; if(this.disabled){ return; } switch(_9.keyCode){ case 13: if(this.onListClick){ var _a=this.makeReqKey(); var _b=this.listCaches[_a][this.listSelected-1]; this.onListClick(_b); this.loseFocus(); } return; case 27: this.loseFocus(); return; case 9: this.loseFocus(); return; case 38: this.handleUp(); Event.stop(_9); return; case 40: this.handleDown(); Event.stop(_9); return; case 34: this.handlePageDown(); Event.stop(_9); return; case 33: this.handlePageUp(); Event.stop(_9); return; default: setTimeout(function(){ this.handleInputChange(); }.bind(this),1); } },handleUp:function(){ this.lastArrowKeyTime=(new Date()).getTime(); if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } if(this.selectPrevOption()){ this.scrollIntoView(); this._onListOverForCurrentSelection(); } },_onListOverForCurrentSelection:function(){ var _c=this.makeReqKey(); if(this.listCaches[_c]){ var _d=this.listCaches[_c][this.listSelected-1]; this.onListOver(_d); } },handleDown:function(){ this.lastArrowKeyTime=(new Date()).getTime(); if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } if(this.selectNextOption()){ this.scrollIntoView(); this._onListOverForCurrentSelection(); } },handlePageDown:function(){ this.lastArrowKeyTime=(new Date()).getTime(); if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } var i=this.listSelected; var _f=0; while($("gjsel"+i)&&_f<$(this.sBoxName).clientHeight){ _f+=$("gjsel"+i).offsetHeight; i++; } this.selectListOption(i-1); this.scrollIntoView(); this._onListOverForCurrentSelection(); },handlePageUp:function(){ this.lastArrowKeyTime=(new Date()).getTime(); if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } var i=this.listSelected; var _11=0; while(i>0&&_11<$(this.sBoxName).clientHeight){ _11+=$("gjsel"+i).offsetHeight; i--; } this.selectListOption(i+1); this.scrollIntoView(); this._onListOverForCurrentSelection(); },scrollIntoView:function(){ if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } var _12=$("gjsel"+this.listSelected); var _13=Position.positionedOffset(_12); var _14=_13[1]; var _15=Element.getDimensions(_12); var _16=_14+_15.height; var _17=$(this.sBoxName).scrollTop; var _18=_17+$(this.sBoxName).clientHeight; var _19=this.makeReqKey(); if($("gjLastNotice")&&this.listSelected>this.listCaches[_19].length-5){ this.scrollToBottom(); }else{ if(_16>_18){ $(this.sBoxName).scrollTop+=_16-_18; }else{ if(_14<_17){ $(this.sBoxName).scrollTop-=_17-_14; } } } },makeReqKey:function(){ var k=""; this.otherElems.each(function(_1b){ k+=$F(_1b); }); k+=$F(this.inputId); return k.replace(/\s/,"_"); },inputIsValid:function(){ if(this.validInputMatch.test($F(this.inputId))){ return true; }else{ return false; } },isListComplete:function(_1c){ if(this.listCaches[_1c]&&this.listCaches[_1c].length>0&&this.listCaches[_1c].last().cc=="0"){ return true; }else{ return false; } },makeSVals:function(){ var _1d={}; if(this.otherElems){ this.otherElems.each(function(_1e){ _1d[_1e]=$F(_1e); }); } if(this.otherValues){ for(var k in this.otherValues){ _1d[k]=this.otherValues[k](); } } return _1d; },handleInputChange:function(){ if(this.disabled){ return; } if(this.inputIsValid()){ var _20=this.makeReqKey(); if(this.currentlyDrawnList!=_20||$(this.sBoxName).style.display=="none"){ if(this.listCaches[_20]){ this.stopLoadingMessage(); this.drawList(_20,0); return; }else{ if(this.fetchesInProgress[_20]){ return; }else{ this.loadList($F(this.inputId),this.makeSVals(),_20,0); return; } } }else{ } }else{ this.stopLoadingMessage(); this.hideList(); return; } },calculateSBoxHeight:function(){ var _21=Position.cumulativeOffset($(this.sBoxName)); var _22=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight; _22-=_21[1]; if(_22<240){ boxHeight=200; }else{ boxHeight=Math.floor(_22*0.8); } return boxHeight; },reportError:function(msg){ this.reset(); if(this.lastErrorTime&&(new Date()).getTime()-this.lastErrorTime<1000){ return; } this.lastErrorTime=(new Date()).getTime(); alert("We encountered an error. Please ensure your Internet connection is working.\nRetype your search request to try again. If you continue to experience problems, click your browsers \"Reload\" button.\n\nThe error message was:\n"+msg); this.lastErrorTime=(new Date()).getTime(); return; },loadList:function(_24,_25,_26,_27){ this.fetchesInProgress[_26]=true; if(_27==0){ this.startLoadingMessage(); }else{ this.startLoadingMessage(true); } var _28=(this.AjaxRequestsBusy*200+1); _28=(_28<=1000)?_28:1000; setTimeout(function(){ if(_24==$F(this.inputId)){ this.startAjax(_26,_24,_25,_27); }else{ this.fetchesInProgress[_26]=false; } }.bind(this),(this.AjaxRequestsBusy*200+1)); },startAjax:function(_29,_2a,_2b,_2c){ var _2d={q:_2a,l:_2c}; for(var k in _2b){ _2d[k]=_2b[k]; } var _2f=$H(_2d).toQueryString(); this.AjaxRequestsBusy++; this.ajaxRequests[_29]=new Ajax.Request(this.baseURL,{method:"post",parameters:_2f,onComplete:function(_30,_31){ this.completeAjax(_30,_29,_2c,_31); }.bind(this),onException:function(_32,e){ this.AjaxException(_29,_32,e); }.bind(this),onFailure:function(){ this.AjaxFailure(_29); }.bind(this)}); },AjaxException:function(_34,_35,e){ if(GJ_DEBUG){ alert("Ajax exception for key \""+_34+"\":"+e.toString()); } if(!this.inputHasFocus){ return; } this.abortThisRequest(_34); return; },AjaxFailure:function(_37,b){ if(GJ_DEBUG){ alert("Ajax failure for key \""+_37+":"+b.toString()); } if(!this.inputHasFocus){ return; } this.abortThisRequest(_37); return; },reset:function(){ this.stopLoadingMessage(); this.hideList(); $(this.inputId).value=""; $(this.inputId).focus(); for(var _39 in this.ajaxRequests){ if(this.ajaxRequests[_39].abort){ this.ajaxRequests[_39].abort(); } } this.ajaxRequests=new Array(); this.inputHasFocus=true; this.listSelected=false; this.lastArrowKeyTime=0; this.listCaches=new Array(); this.listHTMLCaches=new Array(); this.fetchesInProgress=new Array(); this.AjaxRequestsBusy=0; this.numLoadingDots=1; },abortThisRequest:function(_3a){ if(this.makeReqKey()==_3a&&this.inputHasFocus){ this.stopLoadingMessage(); this.listCaches[_3a]=[{cc:2}]; this.drawList(_3a,0); } this.fetchesInProgress[_3a]=false; return; },completeAjax:function(_3b,_3c,_3d){ if(_3b.status!=200){ this.abortThisRequest(_3c); return; } this.AjaxRequestsBusy--; if(!_3c){ return; } var _3e=0; if(_3d>0){ if(!this.listCaches[_3c]){ return; } var _3f; try{ _3f=eval("("+_3b.responseText+")"); } catch(e){ this.abortThisRequest(_3c); return; } _3e=this.listCaches[_3c].length; this.listCaches[_3c]=this.listCaches[_3c].concat(_3f); }else{ if(this.listCaches[_3c]){ return; } try{ this.listCaches[_3c]=eval("("+_3b.responseText+")"); } catch(e){ this.abortThisRequest(_3c); return; } } if(this.makeReqKey()==_3c){ this.stopLoadingMessage(); this.drawList(_3c,_3e); } this.fetchesInProgress[_3c]=false; },startLoadingMessage:function(_40){ $("SearchLoading").style.display="block"; this.repositionSBox(); if(!this.loadingMessageInterval){ if(_40){ this.loadingMoreElem="gjLM"; new Insertion.Top($$("html body")[0],"<div id=\""+this.loadingMoreElem+"\" style=\"display: none; z-index: "+(this.zIndex+1)+"; position: absolute;\" class=\"lmore\"></div>"); var _41=Position.positionedOffset($(this.sBoxName)); var _42=$(this.sBoxName).getDimensions(); $(this.loadingMoreElem).style.left=_41[0]+"px"; $(this.loadingMoreElem).style.top=(_41[1]+_42.height)+"px"; $(this.loadingMoreElem).style.display="block"; $(this.loadingMoreElem).style.width="200px"; } this.loadingMessageInterval=setInterval(function(){ if(!this.loadingMessageInterval){ return; } var _43=this.numLoadingDots%10; var msg=_40?"Loading more results.":"Searching."; for(var i=0;i<=_43;i++){ msg+="."; } if(_40){ $(this.loadingMoreElem).innerHTML=msg; }else{ $(this.sBoxName).style.display="block"; $(this.sBoxName).innerHTML=msg; $(this.sBoxName).style.height="20px"; } this.numLoadingDots++; }.bind(this),50); } },stopLoadingMessage:function(){ $("SearchLoading").style.display="none"; if(this.loadingMessageInterval){ clearInterval(this.loadingMessageInterval); this.loadingMessageInterval=false; if($(this.loadingMoreElem)){ $(this.loadingMoreElem).remove(); }else{ $(this.sBoxName).style.display="none"; $(this.sBoxName).innerHTML=""; } } },redrawList:function(){ if($(this.sBoxName).style.display=="block"){ var _46=this.makeReqKey(); if(this.listCaches[_46]){ this.stopLoadingMessage(); this.drawList(_46,0); return; } } },drawList:function(_47,_48){ this.repositionSBox(); if(!this.listCaches[_47]){ return; } if(_48>this.listCaches[_47].length-1){ return; } if(_48>0&&(!$(this.sBoxName).firstChild)){ return; } if(_48==0){ this.scrollToTop(); this.listSelected=false; $(this.sBoxName).innerHTML=""; var _49=this.listCaches[_47][0]; if(_49&&_49.cc!="0"&&_49.cc!="1"){ this.onListOver(_49); } } $(this.sBoxName).style.display="block"; if(this.listCaches[_47].length>1){ var htm=""; if(_48==0&&this.listHTMLCaches[_47]){ $(this.sBoxName).innerHTML=this.listHTMLCaches[_47]; }else{ for(var i=_48;i<this.listCaches[_47].length;i++){ if(this.listCaches[_47][i].cc=="0"){ break; } var _4c; var txt; if(this.listCaches[_47][i].cc=="1"){ _4c="gjLastNotice"; txt="<b>You've reached the maximum number of search results that Geojoey displays.</b>"; }else{ _4c="gjsel"+(i+1); txt=this.template.evaluate(this.listCaches[_47][i]); } htm+="<div id=\""+_4c+"\" class=\""+this.unselectedClass+"\" onmouseover=\"window.gjsOMO(event);\" onclick=\"window.gjsCLK(event);\">"+txt+"</div>"; } if(_48==0){ $(this.sBoxName).innerHTML=htm; this.listHTMLCaches[_47]=htm; }else{ $(this.sBoxName).innerHTML+=htm; this.listHTMLCaches[_47]+=htm; } } }else{ if(_48==0&&this.listCaches[_47].length==1&&this.listCaches[_47][0].cc==2){ $(this.sBoxName).style.height="20px"; $(this.sBoxName).innerHTML="<div id=\"gjNoMatchNotice\">Search failed! Please check your Internet connection.</div>"; this.listCaches[_47]=false; }else{ this.listSelected=false; $(this.sBoxName).style.height="20px"; $(this.sBoxName).innerHTML="<span id=\"gjNoMatchNotice\">No matching landmarks found</span>"; } } this.resizeSBox(); if(_48==0){ if(this.listCaches[_47].length>0){ this.selectListOption(1); } }else{ if($("gjLastNotice")){ this.scrollToBottom(); } } this.currentlyDrawnList=_47; },showMessage:function(msg){ this.repositionSBox(); $(this.sBoxName).innerHTML=msg; $(this.sBoxName).style.height="20px"; $(this.sBoxName).style.display="block"; },removeMessage:function(){ this.repositionSBox(); $(this.sBoxName).style.display="none"; $(this.sBoxName).innerHTML=""; },resizeSBox:function(){ var _4f=this.calculateSBoxHeight(); var _50=this.getListHeight(); $(this.sBoxName).style.height=(_50>_4f?_4f:_50)+"px"; },getListHeight:function(){ var i=1; var _52=0; while($("gjsel"+i)){ _52+=$("gjsel"+i).offsetHeight; i++; } if($("gjLastNotice")){ _52+=$("gjLastNotice").offsetHeight; } if($("gjNoMatchNotice")){ _52+=$("gjNoMatchNotice").offsetHeight; } return _52; },scrollToBottom:function(){ $(this.sBoxName).scrollTop=$(this.sBoxName).scrollHeight-$(this.sBoxName).clientHeight; },scrollToTop:function(){ $(this.sBoxName).scrollTop=0; },getTotalListEntries:function(){ var i=1; while($("gjsel"+i)){ i++; } return i-1; },sBoxOnScroll:function(evt){ $(this.inputId).focus(); this.appendIfNeeded(); },appendIfNeeded:function(){ var _55=this.makeReqKey(); if(this.fetchesInProgress[_55]){ return; } if(this.isListComplete(_55)){ return; } var _56=$(this.sBoxName).scrollTop+$(this.sBoxName).clientHeight; var _57=$(this.sBoxName).scrollHeight-_56; if(_57<$(this.sBoxName).firstChild.offsetHeight*1){ this.loadList($F(this.inputId),this.makeSVals(),_55,this.getTotalListEntries()); return; } },extractInt:function(str){ var reg=new RegExp("^[a-zA-Z]*(\\d+$)"); mymatch=reg.exec(str); return parseInt(mymatch[1]); },listOnMouseOver:function(_5a){ var evt=_5a||window.event; Event.stop(evt); if((new Date()).getTime()-this.lastArrowKeyTime<100){ return; } var _5c=this.getParentListItem(evt); if(this.lastListMOEvt==_5c.id){ return; }else{ this.lastListMOEvt=_5c.id; } if(this.listSelected){ if(!$("gjsel"+this.listSelected)){ return; } $("gjsel"+this.listSelected).className=this.unselectedClass; } _5c.className=this.selectedClass; this.listSelected=this.extractInt(_5c.id); $(this.inputId).focus(); if(this.onListOver){ var key=this.makeReqKey(); if(this.listCaches[key]){ var _5e=this.listCaches[key][this.listSelected-1]; this.onListOver(_5e); } } },listOnClick:function(_5f){ var evt=_5f||window.event; var _61=this.getParentListItem(evt); Event.stop(evt); var _62=this.extractInt(_61.id)-1; var key=this.makeReqKey(); var _64=this.listCaches[key][_62]; this.loseFocus(); if(this.onListClick){ this.onListClick(_64); } },selectListOption:function(sel){ if(!$("gjsel"+sel)){ return; } if($("gjsel"+this.listSelected)){ $("gjsel"+this.listSelected).className=this.unselectedClass; } this.listSelected=sel; $("gjsel"+this.listSelected).className=this.selectedClass; },selectNextOption:function(){ if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } var n=this.listSelected+1; if($("gjsel"+n)){ $("gjsel"+this.listSelected).className=this.unselectedClass; this.listSelected++; $("gjsel"+this.listSelected).className=this.selectedClass; return true; }else{ return false; } },selectPrevOption:function(){ if(!this.listSelected){ return; } if(!$("gjsel"+this.listSelected)){ return; } if(this.listSelected>1){ $("gjsel"+this.listSelected).className=this.unselectedClass; this.listSelected--; $("gjsel"+this.listSelected).className=this.selectedClass; return true; }else{ return false; } },hideList:function(){ this.listSelected=false; $(this.sBoxName).style.display="none"; },inputOnFocus:function(evt){ this.inputHasFocus=true; if(!this.documentClickObserver){ this.documentClickObserver=this.documentOnClick.bindAsEventListener(this); Event.observe(document,"click",this.documentClickObserver,false); } this.handleInputChange(); gjTracker("/click/landmarkSearchInput"); },inputOnBlur:function(evt){ this.inputHasFocus=false; },inputOnClick:function(evt){ Event.stop(evt); },sBoxOnClick:function(evt){ Event.stop(evt); },documentOnClick:function(evt){ this.loseFocus(); },loseFocus:function(){ this.inputHasFocus=false; this.stopLoadingMessage(); if(this.inputHasFocus){ $(this.inputId).blur(); } $(this.sBoxName).style.display="none"; if(this.documentClickObserver){ Event.stopObserving(document,"click",this.documentClickObserver,false); this.documentClickObserver=false; } this.listCaches=new Array(); this.listHTMLCaches=new Array(); if(this.onLoseFocus){ this.onLoseFocus(); } },getParentListItem:function(evt){ var _6d=Event.element(evt); while(_6d&&_6d.id.indexOf("gjsel")!=0){ _6d=_6d.parentNode; } if(!_6d){ alert("Could not find parent list element"); } return _6d; },isSBoxOpen:function(){ return $(this.sBoxName).style.display=="block"?true:false; }}; 
var glassPanel=Class.create(); glassPanel.prototype={initialize:function(_1){ ["panelImage","panelImageWidth","panelImageHeight","panelIcon","panelIconWidth","panelIconHeight","panelContent"].each(function(_2){ _1[_2]||alert("\""+_2+"\" is a required parameter for glassPanel"); }); this.useLoader=false; this.panelContent=_1.panelContent; if(typeof (this.panelContent)=="object"&&this.panelContent.loadContent){ this.useLoader=true; } this.panelImage=_1.panelImage; this.panelImageWidth=_1.panelImageWidth; this.panelImageHeight=_1.panelImageHeight; this.panelIcon=_1.panelIcon; this.panelIconWidth=_1.panelIconWidth; this.panelIconHeight=_1.panelIconHeight; this.onionSkinColor=_1.onionSkinColor?_1.onionSkinColor:"#DDD"; this.onionSkinOpacity=_1.onionSkinOpacity?_1.onionSkinOpacity:0.7; this.panelIconRight=_1.panelIconRight?_1.panelIconRight:20; this.panelIconTop=_1.panelIconTop?_1.panelIconTop:20; var _3=gjutils.getWindowSize(); var _4=gjutils.getInternetExplorerVersion(); this.windowWidth=_3[0]; this.windowHeight=_3[1]; this.panelLeft=parseInt((this.windowWidth/2)-(this.panelImageWidth/2)); this.panelTop=parseInt((this.windowHeight/2)-(this.panelImageHeight/2)); this.topZ=gjutils.getMaxZIndexDiv()+1; var _5=""; if(!this.useLoader){ _5=this.panelContent; } var _6=_4?"hand":"pointer"; new Insertion.Top($$("html body")[0],"<div id=\"onionskin\" class=\"onionSkin\" style=\"background-color: "+this.onionSkinColor+"; width: "+this.windowWidth+"px; height: "+this.windowHeight+"px; z-index: "+GJ_ONION_PANE+"; display: none;\"></div>"); $("onionskin").setOpacity(0.8); $("onionskin").setStyle({display:"block"}); new Insertion.Top($$("html body")[0],"<div id=\"overlayOuter\" style=\"position: absolute; left: "+this.panelLeft+"px; top: "+this.panelTop+"px; z-index: "+(GJ_ONION_PANE+1)+";\"> <!-- static div with normal flow --> <div id=\"overlay\" style=\"position: static; border: 0px solid #000; width: "+this.panelImageWidth+"px; height: "+this.panelImageHeight+"px; overflow: hidden;\"> <!-- relative div --> <div style=\"position: relative; border: 0px solid #FF0000; padding: 30px;\"> <div style=\"position: absolute; right: "+this.panelIconRight+"px; top: "+this.panelIconTop+"px;\"><div id=\"overlayClose\" style=\"position: static; width: "+this.panelIconWidth+"px; height: "+this.panelIconHeight+"px;\"> <div style=\"position: relative; cursor: "+_6+"; border: 0px solid #00FF00; width: 100%; height: 100%;\" id=\"overlayCloseTop\"> </div> </div> </div> <div id=\"panelContentDiv\">"+_5+"</div></div></div>"); if(_4){ $("overlay").setStyle({backgroundColor:"transparent",backgroundImage:"url(blank.gif)",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+this.panelImage+"\", sizingMethod=\"scale\")"}); $("overlayClose").setStyle({backgroundColor:"transparent",backgroundImage:"url(blank.gif)",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+this.panelIcon+"\", sizingMethod=\"scale\")"}); }else{ $("overlay").setStyle({backgroundImage:"url("+this.panelImage+")"}); $("overlayClose").setStyle({backgroundImage:"url("+this.panelIcon+")"}); } $$("select").each(function(_7){ _7.style.visibility="hidden"; }); $("overlayCloseTop").onclick=function(){ this.closePanel(); }.bind(this); if(this.useLoader){ this.panelContent.loadContent("panelContentDiv"); } },closePanel:function(){ $$("select").each(function(_8){ _8.style.visibility="visible"; }); if($("overlayOuter")){ $("overlayOuter").remove(); } if($("onionskin")){ $("onionskin").remove(); } },getContentElem:function(){ return "panelContentDiv"; }}; var contentLoader=Class.create(); contentLoader.prototype={initialize:function(_9,_a,_b,_c){ this.url=_9; this.params=_a; this.showLoading=_b?true:false; this.onComplete=_c?_c:false; this.ajax=false; this.elemId=false; this.myInterval=false; this.tCounter=false; },loadContent:function(_d){ this.elemId=_d; this.tCounter=0; var _e=function(){ var _f=this.tCounter%50; var _10=""; for(var i=1;i<=_f;i++){ _10+="."; } $(this.elemId).innerHTML="<span class=\"fhw\">Loading"+_10+"</span>"; this.tCounter++; }.bind(this); if(this.showLoading){ this.myInterval=setInterval(_e,100); } this.ajax=new Ajax.Updater(this.elemId,this.url,{method:"post",evalScripts:true,onInteractive:function(){ if(this.showLoading){ clearInterval(this.myInterval); } }.bind(this),onException:function(){ if(this.myInterval){ clearInterval(this.myInterval); } }.bind(this),onComplete:function(){ if(this.myInterval){ clearInterval(this.myInterval); } if(this.onComplete){ this.onComplete(); } }.bind(this),parameters:$H(this.params).toQueryString()}); }}; 
var photoBox=Class.create(); photoBox.prototype={initialize:function(_1,_2,_3){ this.imageFile=_1; this.width=_2; this.height=_3; this.onionSkinColor="#FFF"; this.onionSkinOpacity=0.7; var _4=gjutils.getWindowSize(); var _5=gjutils.getInternetExplorerVersion(); this.windowWidth=_4[0]; this.windowHeight=_4[1]; this.panelLeft=parseInt((this.windowWidth/2)-(this.width/2)); this.panelTop=parseInt((this.windowHeight/2)-(this.height/2)); $$("select").each(function(_6){ _6.style.visibility="hidden"; }); var _7=_5?"hand":"pointer"; new Insertion.Top($$("html body")[0],"<div id=\"onionskin\" style=\"background-color: "+this.onionSkinColor+"; position: absolute; left: 0px; top: 0px; width: "+this.windowWidth+"px; height: "+this.windowHeight+"px; z-index: "+GJ_MID_PANE+"; display: none;\"></div>"); $("onionskin").setOpacity(0.8); $("onionskin").setStyle({display:"block"}); new Insertion.Top($$("html body")[0],"<div id=\"overlayOuter\" style=\"position: absolute; left: "+this.panelLeft+"px; top: "+this.panelTop+"px; z-index: "+(GJ_MID_PANE+1)+";\"><div style=\"border-top: 0px solid #000; border-bottom: 0px solid #000; border-left: 4px solid #000; border-right: 4px solid #000; background-color: #000; width: "+this.width+"px; text-align: right;\"><a href=\"#\" onclick=\"gjapp.closeDisplayPhoto(); return false;\" style=\"font-family: Arial; color: #FFF; font-size: 12px;\">close</a></div><img src=\""+this.imageFile+"\" width=\""+this.width+"\" height=\""+this.height+"\" style=\"border-top: 0px solid #000; border-left: 4px solid #000; border-right: 4px solid #000; border-bottom: 4px solid #000;\" /></div>"); },closePanel:function(){ $$("select").each(function(_8){ _8.style.visibility="visible"; }); if($("overlayOuter")){ $("overlayOuter").remove(); } if($("onionskin")){ $("onionskin").remove(); } }}; 
var videoBox=Class.create(); videoBox.prototype={initialize:function(_1){ this.width=425; this.height=350; this.onionSkinColor="#FFF"; this.onionSkinOpacity=0.7; var _2=gjutils.getWindowSize(); var _3=gjutils.getInternetExplorerVersion(); this.windowWidth=_2[0]; this.windowHeight=_2[1]; this.panelLeft=parseInt((this.windowWidth/2)-(this.width/2)); this.panelTop=parseInt((this.windowHeight/2)-(this.height/2)); this.topZ=gjutils.getMaxZIndexDiv()+1; $$("select").each(function(_4){ _4.style.visibility="hidden"; }); new Insertion.Top($$("html body")[0],"<div id=\"onionskin\" style=\"background-color: "+this.onionSkinColor+"; position: absolute; left: 0px; top: 0px; width: "+this.windowWidth+"px; height: "+this.windowHeight+"px; z-index: "+GJ_ONION_PANE+"; display: none;\"></div>"); $("onionskin").setOpacity(0.8); $("onionskin").setStyle({display:"block"}); new Insertion.Top($$("html body")[0],"<div id=\"overlayOuter\" style=\"position: absolute; left: "+this.panelLeft+"px; top: "+this.panelTop+"px; z-index: "+(GJ_ONION_PANE+1)+"; border: 0px solid #F00; background-color: #000; text-align: center;\"><div style=\"border-top: 0px solid #000; border-bottom: 0px solid #000; border-left: 4px solid #000; border-right: 4px solid #000; background-color: #000; width: "+this.width+"px; text-align: right;\"><a href=\"#\" onclick=\"gjapp.closeDisplayVideo(); return false;\" style=\"font-family: Arial; color: #FFF; font-size: 12px;\">close</a></div><object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/"+_1+"\"></param><embed src=\"http://www.youtube.com/v/"+_1+"\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"350\"></embed></object></div>"); },closePanel:function(){ $$("select").each(function(_5){ _5.style.visibility="visible"; }); if($("overlayOuter")){ $("overlayOuter").remove(); } if($("onionskin")){ $("onionskin").remove(); } }}; 
var ColorPicker=Class.create(); ColorPicker.prototype={initialize:function(e,_2,_3){ this.onPick=_2; this.noColorNext=_3; var _4=["FFFFFF","FFFFCC","FFFF99","FFFF66","FFFF33","FFFF00","CCFFFF","CCFFCC","CCFF99","CCFF66","CCFF33","CCFF00","99FFFF","99FFCC","99FF99","66FFFF","99FF66","99FF33","66FFCC","FFCCFF","99FF00","33FFFF","FFCCCC","33FFCC","00FFFF","66FF99","FFCC99","66FF66","66FF33","00FFCC","66FF00","33FF99","FFCC66","FFCC33","CCCCFF","33FF66","33FF33","00FF99","FFCC00","33FF00","00FF66","00FF33","00FF00","CCCCCC","CCCC99","99CCFF","CCCC66","CCCC00","CCCC33","99CCCC","FF99FF","99CC99","66CCFF","FF99CC","99CC66","66CCCC","99CC33","00CCFF","33CCFF","99CC00","FF9999","66CC99","FF9966","66CC66","33CCCC","CC99FF","00CCCC","FF9933","FF9900","66CC33","66CC00","33CC99","00CC99","CC99CC","33CC66","00CC66","CC9999","FF66FF","33CC33","33CC00","CC9966","00CC33","9999FF","00CC00","CC9933","CC9900","FF66CC","9999CC","FF6699","999999","6699FF","FF6666","CC66FF","999966","6699CC","999933","FFCC33","FF6600","FF33FF","3399FF","999900","669999","CC66CC","0099FF","FF33CC","3399CC","CC6699","669966","FF00FF","339999","669933","669900","FF3399","0099CC","9966FF","CC6666","009999","CC6633","CC6600","339966","FF00CC","FF3366","009966","CC33FF","FF3333","339933","009933","9966CC","FF3300","FF0099","339900","009900","6666FF","CC33CC","FF0066","996699","FF0033","FF0000","CC00FF","CC3399","996666","6666CC","996633","996600","3366FF","CC3366","CC00CC","9933FF","0066FF","666699","CC3333","CC3300","3366CC","CC0099","9933CC","666666","666633","0066CC","9900FF","666600","CC0066","336699","993399","CC0033","6633FF","336666","006699","CC0000","993366","9900CC","336633","006666","336600","6633CC","3333FF","006633","993333","993300","6600FF","990099","006600","0033FF","663399","009966","3333CC","663366","6600CC","990033","0033CC","990000","3300FF","663333","663300","660099","0000FF","333399","3300CC","003399","333300","660066","333333","003366","0000CC","660033","333300","660000","330099","003333","003300","000099","330066","330033","000066","330000","000033","000000"]; var _5=""; var _6=10; var _7=18; GJ_GS.onColorPick=function(_8){ this.onPick(_8); GJ_GS.onColorPick=null; }.bind(this); for(var i=0;i<_4.length;i++){ if(i!=0&&i%_7==0){ _5+="<br style=\"clear: both;\" />"; } _5+="<div style=\"border-width: 0px 1px 1px 0px; border-style: solid; border-color: #000; background-color: #"+_4[i]+"; width: "+_6+"px; height: "+_6+"px; font-size: 8px; float: left; _cursor: hand; cursor: pointer;\" onclick=\"GJ_GS.onColorPick('#"+_4[i]+"');\"></div>"; } if(_3){ _5+="<br clear=\"all\" /><center><a href=\"#\" style=\"text-decoration: underline; font-size: 10px; font-family: Arial; color: #00F;\" onclick=\"GJ_GS.onColorPick(false); return false;\">"+_3+"</a></center>"; } this.popupDiv=new PopupDiv(e,{width:"",padding:"0px",borderStyle:"solid",borderColor:"#000",borderWidth:"1px 0px 0px 1px",backgroundColor:"#FFF",fontSize:"1px"},_5,"bottomRight",false); },remove:function(){ if(this.popupDiv&&this.popupDiv.remove){ this.popupDiv.remove(); } this.onPick=null; this.noColorNext=null; }}; 
var PopupDiv=Class.create(); PopupDiv.prototype={initialize:function(_1,_2,_3,_4,_5,_6){ if(GJ_GS.popup){ GJ_GS.popup.remove(); } GJ_GS.popup=this; this.corner=_4?_4:"topLeft"; this.html=_3; this.style=_2; this.addClosingX=_5; this.cancelBubble=_6?true:false; var x; var y; var _9=_1?_1:window.event; Event.stop(_9); x=Event.pointerX(_9); y=Event.pointerY(_9); var _a=document.createElement("div"); _a.style.position="absolute"; _a.style.left=x+"px"; _a.style.top=y+"px"; _a.style.width="100px"; _a.style.border="1px solid #000"; _a.style.zIndex=GJ_ONION_PANE-1; _a.style.backgroundColor="#FFFFFF"; for(var _b in this.style){ _a.style[_b]=this.style[_b]; } if(this.addClosingX){ this.html="<a href=\"#\" style=\"float: right; font-weight: bold; font-family: Arial; font-size: 12px;\" onclick=\"GJ_GS.popup.remove(); return false;\">X</a>"+this.html; } _a.innerHTML=this.html; document.body.appendChild(_a); if(this.corner!="topLeft"){ var _c=Element.getDimensions(_a); if(this.corner=="topRight"||this.corner=="bottomRight"){ _a.style.left=(parseInt(_a.style.left)-_c.width)+"px"; } if(this.corner=="bottomLeft"||this.corner=="bottomRight"){ _a.style.top=(parseInt(_a.style.top)-_c.height)+"px"; } } this.div=_a; this.remObserver=function(){ this.remove(); }.bind(this); if(this.cancelBubble){ Event.observe(this.div,"click",function(e){ e.cancelBubble=true; }.bindAsEventListener(this),false); } Event.observe(document,"click",this.remObserver,false); },remove:function(){ if(this.div){ Element.remove(this.div); } this.div=false; Event.stopObserving(document,"click",this.remObserver,false); this.remObserver=false; GJ_GS.popup=false; }}; 
var MiddlePanel=Class.create(); MiddlePanel.prototype={initialize:function(id,_2,_3){ if(GJ_GS.middlePanel&&GJ_GS.middlePanel.remove){ GJ_GS.middlePanel.remove(); } GJ_GS.middlePanel=this; var _4=gjutils.getWindowSize(); this.windowWidth=_4[0]; this.windowHeight=_4[1]; var _5=parseInt(this.windowWidth/2); var _6=parseInt(this.windowHeight/2); this.div=document.createElement("div"); this.div.style.display="none"; this.div.id=id; this.div.style.position="absolute"; this.div.style.zIndex=GJ_ONION_PANE-1; this.div.innerHTML=_3; this.div.style.left="-1000px"; this.div.style.top="-1000px"; for(var k in _2){ this.div.style[k]=_2[k]; } document.body.appendChild(this.div); this.div.style.display="block"; var _8=Element.getDimensions(this.div); this.div.style.left=_5-_8.width/2+"px"; this.div.style.top=_6-_8.height/2+"px"; },remove:function(){ if(this.div&&this.div.parentNode){ Element.remove(this.div); } }}; 
var gjmapClass=Class.create(); gjmapClass.prototype={initialize:function(_1){ this.mapElem=_1.mapElem; this.belowMapElem=_1.belowMapElem; this.panelElem=_1.panelElem; this.lockDiv=false; if(_1.redrawCallback){ this.redrawCallback=_1.redrawCallback; }else{ this.redrawCallback=function(){ }; } this.map=new GMap2($(this.mapElem)); this.map.addMapType(G_PHYSICAL_MAP); this.map.setCenter(new GLatLng(0,0),1,G_HYBRID_MAP); this.smallMapControl=new GLargeMapControl(); this.mapTypeControl=new GMapTypeControl(); this.addGeneralMapControls(); this.lastClickPoint=false; this.lastMapClickTime=0; this.generalMarker=false; this.generalPoint=false; },addGeneralMapControls:function(){ this.map.addControl(this.mapTypeControl); this.map.addControl(this.smallMapControl,new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(10,7))); },removeGeneralMapControls:function(){ this.map.removeControl(this.smallMapControl); this.map.removeControl(this.mapTypeControl); },hasMapBoundsChanged:function(){ var _2=this.map.getBounds(); if(this.lastBounds&&this.lastBounds.equals(_2)){ return false; }else{ this.lastBounds=_2; return true; } },unload:function(){ $(this.mapElem).ondblclick=null; },modMap:function(_3){ var _4; if(_3.mapType){ _4=_3.mapType; }else{ _4=this.map.getCurrentMapType(); } var _5; if(typeof (_3.lat)!="undefined"&&typeof (_3.lon)!="undefined"){ _5=new GLatLng(parseFloat(_3.lat),parseFloat(_3.lon)); }else{ if(_3.gPoint){ _5=_3.gPoint; }else{ _5=this.map.getCenter(); } } var _6; if(_3.zoomLevel){ _6=_3.zoomLevel; }else{ _6=this.map.getZoom(); } this.map.setCenter(_5,_6,_4); },zoomTo:function(_7,_8,_9,_a){ this.map.setCenter(new GLatLng(parseFloat(_7),parseFloat(_8)),_9,_a); },smartSetCenter:function(_b,_c,_d){ if(this.willMapMove(_b,_c)){ this.map.setCenter(_b,_c,_d); } },willMapMove:function(_e,_f){ if(_f!=this.map.getZoom()){ return true; } var _10=this.map.fromLatLngToDivPixel(_e); var _11=this.map.fromLatLngToDivPixel(this.map.getCenter()); return _10.equals(_11)?false:true; },clearIcons:function(){ var _12=this.currentInfoWindow?this.currentInfoWindow:false; this.map.clearOverlays(); if(_12){ this.openInfoWindow(_12.point,_12.html,_12.opts); } },openInfoWindow:function(_13,_14,_15){ if(typeof (_15)!="object"){ _15={}; } _15.onCloseFn=function(){ this.currentInfoWindow=false; }.bind(this); this.map.closeInfoWindow(); this.map.openInfoWindow(_13,_14,_15); this.currentInfoWindow={point:_13,html:_14,opts:_15}; },closeInfoWindow:function(){ this.map.closeInfoWindow(); this.currentInfoWindow=false; },showGeneralMarker:function(_16,txt,_18){ if(this.generalMarker){ this.map.removeOverlay(this.generalMarker); this.generalPoint=false; } this.generalPoint=_16; if(_18){ this.generalMarker=_18; }else{ this.generalMarker=new GeojoeyMarker(this.generalPoint,txt,{onmouseover:function(){ this.removeGeneralMarker(); }.bind(this)}); } this.map.addOverlay(this.generalMarker); },redrawGeneralMarker:function(){ if(this.generalMarker){ this.map.addOverlay(this.generalMarker); } },removeGeneralMarker:function(){ if(this.generalMarker){ this.map.removeOverlay(this.generalMarker); this.generalPoint=false; this.generalMarker=false; }else{ } },getCommaBounds:function(){ var _19=this.map.getBounds(); var sw=_19.getSouthWest(); var ne=_19.getNorthEast(); if(ne.lat()>75&&sw.lat()<-75&&ne.lng()>170&&sw.lng()<-170){ return "FULL"; } var b=ne.lat()+","+ne.lng()+","+sw.lat()+","+sw.lng(); return b; },centerWorld:function(){ this.map.setCenter(new GLatLng(15,0),1,G_HYBRID_MAP); },panTo:function(_1d){ this.map.panTo(_1d); },stringifyMapPosition:function(){ var cnt=this.map.getCenter(); var ret=cnt.lat()+":"+cnt.lng()+":"+this.map.getZoom()+":"+this.map.getCurrentMapType().getName(); return ret; },centerCountry:function(_20){ if(_20=="ALL"){ this.centerWorld(); }else{ new Ajax.Request("/e/centerCountry",{method:"post",onComplete:this.finishCenterCountry.bind(this),parameters:$H({c:_20}).toQueryString()}); } },finishCenterCountry:function(req,_22){ if(typeof (_22)!="object"){ return; } var ne=new GLatLng(parseFloat(_22.ne_lat),parseFloat(_22.ne_lon)); var sw=new GLatLng(parseFloat(_22.sw_lat),parseFloat(_22.sw_lon)); var _25=new GLatLngBounds(sw,ne); var _26=_25.getCenter(); var _27=this.map.getBoundsZoomLevel(_25); this.modMap({mapType:G_HYBRID_MAP,gPoint:_26,zoomLevel:_27}); },getHeightPad:function(_28){ var _29=_28; _28=$(_28); if(_28.style.width){ return _28.offsetHeight-parseInt(_28.style.width); } var _2a=_28.style.padding?parseInt(_28.style.padding)*2:0; var _2b=_28.style.marginTop?parseInt(_28.style.marginTop):0; var _2c=_28.style.marginBottom?parseInt(_28.style.marginBottom):0; var _2d=0; if(isIE){ if(_28.style.borderWidth){ _2d=parseInt(_28.style.borderWidth); } }else{ if(_28.style.border){ _2d=parseInt(_28.style.border); } } var _2e=0; var _2f=0; if(_28.style.borderTop){ _2e=parseInt(_28.style.borderTop); } if(_28.style.borderBottom){ _2f=parseInt(_28.style.borderBottom); } var _30=0; if(_2e&&_2f){ _30=_2e+_2f; }else{ if(_2e||_2f){ _30=_2d+_2e+_2f; }else{ _30=_2d*2; } } var res=_2b+_2c+_30; if(_28.style.overflow!="auto"){ res+=_2a; } if(isNaN(res)){ return 0; }else{ return res; } },getMapState:function(){ return {center:this.map.getCenter(),zoom:this.map.getZoom(),type:this.map.getCurrentMapType()}; },restoreMapState:function(_32){ this.map.setCenter(_32.center,_32.zoom,_32.type); },getCenterRandOffset:function(_33){ var _34=this.map.fromLatLngToDivPixel(this.map.getCenter()); var _35=_34.x+Math.floor(_33/2)-Math.floor(Math.random()*_33); var _36=_34.y+Math.floor(_33/2)-Math.floor(Math.random()*_33); return this.map.fromDivPixelToLatLng(new GPoint(_35,_36)); }}; 
function GJLabeledLine(_1,_2,_3,_4,_5,_6,_7){ this._points=_1; this._color=_2; this._weight=_3; this._opacity=_4; this._label=_5; this._img=_6; this._imageDimensions=_7?_7:{width:32,height:32}; this.totalDistance=gjutils.getLineDistance(_1); } GJLabeledLine.prototype=new GOverlay(); GJLabeledLine.prototype.initialize=function(_8){ this._map=_8; if(this._img||this._label){ this._div=document.createElement("DIV"); this._div.style.position="absolute"; this._div.style.display="block"; this._div.style.zIndex=1; if(this._img){ this._div.style.width=this._imageDimensions.width; this._div.style.height=this._imageDimensions.height; if(isIE&&/\.png$/.test(this._img)){ this._div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+this._img+"\", sizingMethod=\"scale\")"; }else{ this._div.innerHTML="<img src=\""+this._img+"\" border=\"0\" alt=\""+this._label+"\" width=\""+this._imageDimensions.width+"\" height=\""+this._imageDimensions.height+"\" />"; } }else{ var _9=30; this._div.style.width="60px"; this._div.style.textAlign="center"; this._div.style.background="#FFF"; this._div.style.fontFamily="Arial"; this._div.style.fontSize="10px"; this._div.style.color=this._color; this._div.style.border="1px solid "+this._color; this._div.innerHTML=this._label; } this._map.getPane(G_MAP_MAP_PANE).appendChild(this._div); }else{ this._div=false; } }; GJLabeledLine.prototype.redraw=function(_a){ if(!_a){ return; } if(this._line){ this._map.removeOverlay(this._line); } if(this._div){ if(gjutils.getLinePixelDistance(this._map,this._points)>=40){ var _b=gjutils.findLineCenter(this._points,this.totalDistance); var _c=this._map.fromLatLngToDivPixel(_b); var _d=Element.getDimensions(this._div); var _e=Math.floor(_d.width/2); var _f=Math.floor(_d.height/2); this._div.style.display="block"; this._div.style.top=(_c.y-_f)+"px"; this._div.style.left=(_c.x-_e)+"px"; }else{ this._div.style.display="none"; } } this._line=new GPolyline(this._points,this._color,this._weight,this._opacity); this._map.addOverlay(this._line); }; GJLabeledLine.prototype.remove=function(){ if(this._line){ this._map.removeOverlay(this._line); } if(this._div&&this._div.parentNode){ this._div.parentNode.removeChild(this._div); } }; GJLabeledLine.prototype.copy=function(){ return new GJLabeledLine(this._points,this._color,this._weight,this.opacity); }; 
var GJLineEncoder=Class.create(); GJLineEncoder.prototype={initialize:function(){ this.encoded_points=""; this.encoded_levels=""; this.plat=0; this.plon=0; },getEncodedPoints:function(){ return this.encoded_points; },getEncodedLevels:function(){ return this.encoded_levels; },addPoint:function(_1,_2,_3){ var _4=Math.floor(_1*100000); var _5=Math.floor(_2*100000); var _6=_4-this.plat; var _7=_5-this.plon; this.plat=_4; this.plon=_5; this.encoded_points+=this.encodeSignedNumber(_6)+this.encodeSignedNumber(_7); this.encoded_levels+=this.encodeNumber(_3); },encodeSignedNumber:function(_8){ var _9=_8<<1; if(_8<0){ _9=~(_9); } return (this.encodeNumber(_9)); },encodeNumber:function(_a){ var _b=""; while(_a>=32){ _b+=(String.fromCharCode((32|(_a&31))+63)); _a>>=5; } _b+=(String.fromCharCode(_a+63)); return _b; },decodeLine:function(_c){ var _d=_c.length; var _e=0; var _f=[]; var lat=0; var lng=0; while(_e<_d){ var b; var _13=0; var _14=0; do{ b=_c.charCodeAt(_e++)-63; _14|=(b&31)<<_13; _13+=5; }while(b>=32); var _15=((_14&1)?~(_14>>1):(_14>>1)); lat+=_15; _13=0; _14=0; do{ b=_c.charCodeAt(_e++)-63; _14|=(b&31)<<_13; _13+=5; }while(b>=32); var _16=((_14&1)?~(_14>>1):(_14>>1)); lng+=_16; _f.push([lat*0.00001,lng*0.00001]); } return _f; },decodeLevels:function(_17){ var _18=[]; for(var _19=0;_19<_17.length;++_19){ var _1a=_17.charCodeAt(_19)-63; _18.push(_1a); } return _18; }}; 
function GJMapControl(_1,_2,_3,_4){ this._innerHTML=_1; this._onclick=_4; this._style=_2; this._position=_3; } GJMapControl.prototype=new GControl(); GJMapControl.prototype.initialize=function(_5){ var _6=document.createElement("div"); var _7=document.createElement("div"); this.setButtonStyle_(_7); _6.appendChild(_7); _7.innerHTML=this._innerHTML; GEvent.addDomListener(_7,"click",this._onclick); _5.getContainer().appendChild(_6); return _6; }; GJMapControl.prototype.getDefaultPosition=function(){ return this._position; }; GJMapControl.prototype.setButtonStyle_=function(_8){ for(var _9 in this._style){ _8.style[_9]=this._style[_9]; } }; 
var RankIcons=Class.create(); RankIcons.prototype={initialize:function(_1){ this.gjmap=_1; this.mapHandlers={}; this.listHandlers={}; this.mapMarkerFactory=function(){ alert("setMapMarkerFactory(fn) not called"); }; this.markers=$A([]); },unload:function(){ this.gjmap=null; this.mapHandlers=null; this.listHandlers=null; this.mapMarkerFactory=null; this.markers=null; },handleListEvent:function(_2,_3){ this.listHandlers[_2](this.getDataByRank(_3),this.getMarkerByRank(_3)); },addListListener:function(_4,fn){ this.listHandlers[_4]=fn; },setMapMarkerFactory:function(_6){ this.mapMarkerFactory=_6; },_makeGMarker:function(_7){ var _8=this.mapMarkerFactory(_7); $A(["mouseover","mouseout","click"]).each(function(_9){ this._registerMapEventListener(_8,_9,_7); }.bind(this)); return _8; },_registerMapEventListener:function(_a,_b,_c){ _a.addListener(_b,function(){ this._handleMapMarkerEvent.call(this,_b,_c,_a); }.bind(this)); },_handleMapMarkerEvent:function(_d,_e,_f){ if(this.mapHandlers[_d]){ this.mapHandlers[_d](_e,_f); } },addMapListener:function(evt,fn){ this.mapHandlers[evt]=fn; },removeMapListener:function(evt){ this.mapHandlers[evt]=false; },removeAllListeners:function(){ for(var k in this.mapHandlers){ this.mapHandlers[k]=false; } for(var k in this.listHandlers){ this.listHandlers[k]=false; } },drawMarkers:function(){ this.markers.each(function(_14){ this.gjmap.map.addOverlay(_14.marker); }.bind(this)); },getDataByRank:function(_15){ return this.markers[_15]; },getMarkerByRank:function(_16){ return this.markers[_16].marker; },redrawMarker:function(_17,_18){ this.gjmap.map.removeOverlay(this.markers[_17].marker); for(var k in _18){ this.markers[_17][k]=_18[k]; } this.markers[_17].marker=this._makeGMarker(this.markers[_17]); this.gjmap.map.addOverlay(this.markers[_17].marker); },popIcon:function(_1a){ this.markers[_1a].marker.popIcon(); },unPopIcon:function(_1b){ this.markers[_1b].marker.unPopIcon(); },reinitialize:function(){ this.removeAllListeners(); this.markers.each(function(_1c){ this.gjmap.map.removeOverlay(_1c.marker); }.bind(this)); },completeRedrawMap:function(_1d){ this.reinitialize(); for(var _1e=0;_1e<_1d.length;_1e++){ _1d[_1e].point=new GLatLng(parseFloat(_1d[_1e].lat),parseFloat(_1d[_1e].lon)); _1d[_1e].rank=_1e; _1d[_1e].marker=this._makeGMarker(_1d[_1e]); } this.markers=$A(_1d); this.drawMarkers(); }}; 
var GJViewParent=Class.create(); GJViewParent.prototype={GJView:true,unloadOK:function(_1){ this._mustImplement("unloadOK"); },redraw:function(_2,_3){ this._mustImplement("redraw"); },canRestore:function(){ this._mustImplement("canRestore"); },getRestoreParams:function(){ this._mustImplement("getRestoreParams"); },getClassName:function(){ this._mustImplement("getClassName"); },fetchIMsOnRedraw:function(){ this._mustImplement("fetchIMsOnRedraw"); },initialize:function(_4){ if(typeof (_4)=="object"){ this.params=_4; }else{ this.params={}; } this._colors=["Red","Orange","Yellow","Green","Blue"]; },viewPortInit:function(_5,_6,_7){ this.pageContainer=_6; this.gjmap=_7; this.redraw(_5,true); },unload:function(){ this.destroyed=true; this.pageContainer=null; this.gjmap=null; this._colors=null; this.params=null; },drawLoadingAnimation:function(_8){ $(_8).innerHTML="<div style=\"width: 32px; height: 32px; position: relative; left: 20px; top: 20px;\"><img src=\"/images/loading2.gif\" width=\"32\" height=\"32\" border=\"0\" /></div>"; },makeRankColor:function(_9){ return (_9<this._colors.length-1)?this._colors[_9]:"Blue"; },mergeJSON:function(){ var _a={}; for(var i=0;i<this.mergeJSON.arguments.length;++i){ for(var k in this.mergeJSON.arguments[i]){ _a[k]=this.mergeJSON.arguments[i][k]; } } return _a; },makeVoteMapIcon:function(_d,_e,_f,_10){ var _11=new GIcon(); _11.image="/images/expCons3/eam"+_e+".png"; _11.shadow="/images/expCons3/eamShad.png"; _11.iconSize=new GSize(41,41); _11.shadowSize=new GSize(50,43); _11.iconAnchor=new GPoint(21,41); _11.infoWindowAnchor=new GPoint(21,41); _11.imageMap=[1,8,3,3,8,1,33,1,38,3,40,8,40,24,38,29,33,31,27,31,23,36,21,40,19,36,14,31,8,31,3,29,1,24,1,8,1,8]; _11.transparent="/images/expCons3/eamTrans.png"; divStyle={fontFamily:"Arial",fontSize:_f.length>4?"12px":"16px",fontWeight:"bold",color:"#F60",paddingTop:"2px",textAlign:"center"}; var _12; if(_f=="0"){ _12="<div style=\"font-size: 10px; color: #333; font-family: Arial; padding: 0px; margin: 0px; border: 0px solid #000;\">"+"<div style=\"margin-top: -1px;\">No</div>"+"<div style=\"margin-top: -4px;\">votes</div>"+"<div style=\"margin-top: -4px;\">yet</div>"+"</div>"; }else{ _12=_f+"<div style=\"font-size: 10px; color: #333; font-family: Arial; padding: 0px; margin: 0px; margin-top: -4px; border: 0px solid #000;\">votes</div>"; } var _13=false; if((_10||_10===0)&&_10<5){ _13=9999-_10; } return new GJMarker2(_d,{title:_f+" votes",icon:_11,text:_12,divStyle:divStyle,stackVal:_13}); },_mustImplement:function(_14){ alert("Child class must implement "+_14+"() when inheriting from GJViewParent."); }}; 
var GJViewUserList=Class.create(); Object.extend(GJViewUserList.prototype,GJViewParent.prototype); Object.extend(GJViewUserList.prototype,{redraw:function(_1,_2){ if(_2){ this.gjmap.map.clearOverlays(); this.rankIcons=new RankIcons(this.gjmap); this.rankIcons.setMapMarkerFactory(this.mapMarkerFactory.bind(this)); gjapp.viewPort.hideBelowMap(); this.mapMoveListener=GEvent.addListener(this.gjmap.map,"moveend",function(){ gjapp.viewPort.logHistory(); }.bind(this)); gjapp.viewPort.logHistory(); }else{ this.rankIcons.reinitialize(); this.gjmap.map.clearOverlays(); } this.pageContainer.loadPage("/view/GJViewUserList",this.mergeJSON(_1,this.params)); },fetchIMsOnRedraw:function(){ return true; },canRestore:function(){ return true; },getRestoreParams:function(){ return {filter:this.params.filter}; },getClassName:function(){ return "GJViewUserList"; },showUsersTrekExperiences:function(_3,_4,_5){ var _6=new GPolyline.fromEncoded({color:"#00FFFF",weight:5,points:_4,levels:_5,zoomFactor:16,numLevels:4}); this.showUsersExperiences(_3,_6); },showUsersExperiences:function(_7,_8){ this.gjmap.map.clearOverlays(); new Ajax.Request("/view/GJViewUserList",{method:"post",parameters:$H(this.mergeJSON(gjapp.viewPort.makeViewState(),{encid:_7,mode:"userExp",filter:"topUsers"})).toQueryString(),onComplete:function(_9,_a){ this.completeShowUsersExperiences(_9,_a,_8); }.bind(this)}); },completeShowUsersExperiences:function(_b,_c,_d){ this.rankIcons.completeRedrawMap(_c); this.rankIcons.addMapListener("click",function(_e,_f){ gjapp.viewPort.setView(new GJViewExperience({id:_e.id})); }.bind(this)); if(_d){ this.gjmap.map.addOverlay(_d); } },handleListEvent:function(evt,_11){ if(!this.loadComplete){ return; } return this.rankIcons.handleListEvent(evt,_11); },completeRedrawMap:function(_12){ this.rankIcons.completeRedrawMap(_12); this.rankIcons.addMapListener("mouseover",this.handleMapIconMouseOver.bind(this)); this.rankIcons.addMapListener("mouseout",this.handleMapIconMouseOut.bind(this)); this.rankIcons.addMapListener("click",this.handleMapIconClick.bind(this)); this.rankIcons.addListListener("mouseover",this.handleListItemMouseOver.bind(this)); this.rankIcons.addListListener("mouseout",this.handleListItemMouseOut.bind(this)); this.rankIcons.addListListener("click",this.handleListItemClick.bind(this)); this.loadComplete=true; },handleMapIconMouseOver:function(_13,_14){ },handleMapIconMouseOut:function(_15,_16){ },handleMapIconClick:function(_17,_18){ },handleListItemMouseOver:function(_19,_1a){ _1a.popIcon(); },handleListItemMouseOut:function(_1b,_1c){ _1c.unPopIcon(); },handleListItemClick:function(_1d,_1e){ },mapMarkerFactory:function(_1f){ return this.makeVoteMapIcon(_1f.point,this.makeRankColor(_1f.rank),_1f.text); },unloadOK:function(_20){ GEvent.removeListener(this.mapMoveListener); this.rankIcons.unload(); this.rankIcons=null; return true; }}); 
var GJViewExpList=Class.create(); Object.extend(GJViewExpList.prototype,GJViewParent.prototype); Object.extend(GJViewExpList.prototype,{redraw:function(_1,_2,_3){ if(!_3){ this.page=1; } if(_2){ this.gjmap.map.clearOverlays(); this.loadComplete=false; this.rankIcons=new RankIcons(this.gjmap); this.rankIcons.setMapMarkerFactory(this.mapMarkerFactory.bind(this)); gjapp.viewPort.unhideBelowMap(); gjapp.viewPort.closeBelowMap(); this.searchExperiencesOpen=false; this.tagCloudOpen=false; this.tagFilter=""; this.page=1; this.mapMoveListener=GEvent.addListener(this.gjmap.map,"moveend",function(){ gjapp.viewPort.logHistory(); }.bind(this)); this.openTagCloud(); gjapp.viewPort.logHistory(); } this.lastFilter=this.params.filter; var _4={filter:this.params.filter,page:this.page,userid:this.userProfileMode()?this.params.userid:""}; var _5; if(this.searchExperiencesOpen){ _5=this.mergeJSON(_1,_4,{searchExperiencesOpen:1,searchTxt:$F("expSearchTxt")}); }else{ if(this.tagCloudOpen){ _5=this.mergeJSON(_1,_4,{tagCloudOpen:1,tagFilter:this.tagFilter?this.tagFilter:""}); }else{ _5=this.mergeJSON(_1,_4); } } _5.loadPage=1; this.pageContainer.loadPage("/view/GJViewExpList",_5); },fetchIMsOnRedraw:function(){ return true; },canRestore:function(){ return true; },getRestoreParams:function(){ return {userid:this.params.userid,filter:this.params.filter}; },getClassName:function(){ return "GJViewExpList"; },incPage:function(){ this.page++; this.redraw(gjapp.viewPort.makeViewState(),false,true); },decPage:function(){ this.page--; this.redraw(gjapp.viewPort.makeViewState(),false,true); },clearTagFilter:function(){ $("ClearTagFilterMsg").style.display="block"; this.tagFilter=""; this.redraw(gjapp.viewPort.makeViewState()); },setTagFilter:function(_6){ this.tagFilter=_6; },setFilter:function(_7){ this.params.filter=_7; },completeRedrawTags:function(_8,_9,_a){ var _b=isIE?"20":"5"; var _c=""; var _d=this.tagFilter?"block":"none"; var _e="<div style=\"float: right; border: 0px solid #000; padding: 0 2px 2px 5px;\"><a href=\"#\" style=\"font-family: Verdana, Arial; font-size: 12px; color: #000;\" onclick=\"gjapp.viewPort.getView().closeTagCloud(); gjTracker('/click/expList/closeTagCloud'); return false;\">Close Tag Cloud</a></div><div style=\"float: right; display: "+_d+"; padding: 0 10px 2px 5px;\" id=\"ClearTagFilterMsg\"><a href=\"#\" style=\"font-family: Verdana, Arial; font-size: 12px; color: #000;\" onclick=\"gjapp.viewPort.getView().clearTagFilter(); gjTracker('/click/expList/clearTagFilter'); return false;\">Clear Tag Filter</a></div>"; if(_8.length==0){ _e+="<br />&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"fb\">There are no tags in this area of the map.</span><br />"; }else{ for(var i=0;i<_8.length;i++){ var _10=(_8[i].cnt==_a&&_a-_9>1)?" color: #FF6600;":""; if(this.tagFilter&&_8[i].tag!=this.tagFilter){ _10=" color: #BFBFBF;"; } _e+="&nbsp;<a id=\"tag"+i+"\" href=\"#\" class=\"tag\" style=\"text-decoration: none; font-size: "+this.makeFontSize(_8[i].cnt,_9,_a)+"px;"+_10+"\" onclick=\"gjapp.viewPort.getView().handleTagClick("+i+","+_8.length+",'"+_8[i].tag.escapeHTML()+"'); gjTracker('/click/expList/tagClicked'); return false;\">"+_8[i].tag+"</a>&nbsp; "; } } $("belowMap").innerHTML=_e; },makeFontSize:function(val,_12,_13){ var _14=16/(_13-_12); _14=(_14>3)?3:_14; var ret=12+Math.round((val-_12)*_14); return ret; },drawTagsDisabled:function(_16){ $(_16).innerHTML="<center><span id=\"tagCloudDisabled\" style=\"font-size: 70px; font-weight: bold; color: #CCC; font-family: Verdana, Arial;\">Geojoey</span></center>"; },handleTagClick:function(_17,len,tag){ this.setTagFilter(tag); this.redraw(gjapp.viewPort.makeViewState()); },openSearchExperiences:function(){ if(this.tagCloudOpen){ this.closeTagCloud(); } gjapp.viewPort.openBelowMap(); $("belowMap").innerHTML=gjapp.viewPort.getLoadingHTML(); new Ajax.Updater("belowMap","/static/searchExperiences.html",{method:"get",onComplete:function(){ this.searchExperiencesOpen=true; this.redraw(gjapp.viewPort.makeViewState()); }.bind(this)}); },closeSearchExperiences:function(){ gjapp.viewPort.closeBelowMap(); this.searchExperiencesOpen=false; this.redraw(gjapp.viewPort.makeViewState()); },openTagCloud:function(){ if(this.searchExperiencesOpen){ this.closeSearchExperiences(); } gjapp.viewPort.openBelowMap(); $("belowMap").innerHTML=gjapp.viewPort.getLoadingHTML(); this.tagCloudOpen=true; this.tagFilter=""; this.redraw(gjapp.viewPort.makeViewState()); },closeTagCloud:function(){ $("belowMap").style.height="22px"; $("map").style.height=(parseInt($("map").style.height)+78)+"px"; gjapp.gjmap.map.checkResize(); this.tagCloudOpen=false; this.tagFilter=""; this.redraw(gjapp.viewPort.makeViewState()); },setSearchStats:function(_1a,_1b){ this.foundRows=_1a; this.returnedRows=_1b; },userProfileMode:function(){ return this.params.userid?true:false; },mapMarkerFactory:function(_1c){ if(this.userProfileMode()){ var _1d=new GIcon(); _1d.image="/images/userCon"+this.makeRankColor(_1c.rank)+".png"; _1d.shadow="/images/userConShad.png"; _1d.iconSize=new GSize(104,35); _1d.shadowSize=new GSize(121,35); _1d.iconAnchor=new GPoint(51,34); _1d.infoWindowAnchor=new GPoint(51,34); _1d.imageMap=[1,8,3,3,8,1,96,1,101,3,103,8,103,11,101,16,96,18,64,18,59,20,55,26,51,34,46,26,42,20,37,18,8,18,3,16,1,11,1,8,1,8]; _1d.transparent="/images/userConTrans.png"; var _1e={fontFamily:"Verdana, Arial",fontSize:"10px",color:"#333",paddingTop:"3px",textAlign:"center"}; var _1f=false; if((_1c.rank||_1c.rank===0)&&_1c.rank<5){ _1f=9999-_1c.rank; } return new GJMarker2(_1c.point,{title:_1c.text,icon:_1d,text:_1c.text,stackVal:_1f,stackPadding:3,divStyle:_1e}); }else{ return this.makeVoteMapIcon(_1c.point,this.makeRankColor(_1c.rank),_1c.text,_1c.rank); } },handleListEvent:function(evt,_21){ if(!this.loadComplete){ return; } return this.rankIcons.handleListEvent(evt,_21); },completeRedrawMap:function(_22){ this.rankIcons.completeRedrawMap(_22); this.rankIcons.addMapListener("mouseover",this.handleMapIconMouseOver.bind(this)); this.rankIcons.addMapListener("mouseout",this.handleMapIconMouseOut.bind(this)); this.rankIcons.addMapListener("click",this.handleMapIconClick.bind(this)); this.rankIcons.addListListener("mouseover",this.handleListItemMouseOver.bind(this)); this.rankIcons.addListListener("mouseout",this.handleListItemMouseOut.bind(this)); this.rankIcons.addListListener("click",this.handleListItemClick.bind(this)); this.loadComplete=true; },handleMapIconMouseOver:function(_23,_24){ if(_23.rank==0){ this.pageContainer.scrollToTop(); }else{ if("votesSubEl"+_23.rank){ if(!this.pageContainer.isElementVisible("votesSubEl"+_23.rank)){ gjutils.scrollToElement(this.pageContainer.getContainerDiv(),"votesSubEl"+_23.rank); } } } if($("expListTitle"+_23.rank)){ $("expListTitle"+_23.rank).style.color="#F00"; } },handleMapIconMouseOut:function(_25,_26){ if($("expListTitle"+_25.rank)){ $("expListTitle"+_25.rank).style.color=""; } },handleMapIconClick:function(_27,_28){ gjapp.viewPort.setView(new GJViewExperience({id:_27.id})); gjTracker("/click/expList/mapMarker"); return; },handleListItemClick:function(_29,_2a){ gjapp.viewPort.setView(new GJViewExperience({id:_29.id})); return; },handleListItemMouseOut:function(_2b,_2c){ _2c.unPopIcon(); },handleListItemMouseOver:function(_2d,_2e){ _2e.popIcon(); },unloadOK:function(_2f){ GEvent.removeListener(this.mapMoveListener); this.rankIcons.unload(); this.rankIcons=null; return true; },finishVote:function(_30,_31){ if(!this.userProfileMode()){ this.rankIcons.redrawMarker(_31,{text:_30}); } }}); 
var GJViewAddExp=Class.create(); Object.extend(GJViewAddExp.prototype,GJViewParent.prototype); Object.extend(GJViewAddExp.prototype,{unloadHandler:function(e){ e.returnValue="You are busy "+(this.editMode?"editing":"adding")+" this entry and have not saved your changes."; },redraw:function(_2,_3){ if(_3){ this.firstSnap=true; this.boundUnloadHandler=this.unloadHandler.bindAsEventListener(this); Event.observe(window,"beforeunload",this.boundUnloadHandler,true); this.transTypes={}; if(this.params.edit){ this.editMode=true; this.editId=this.params.edit; }else{ this.editMode=false; } this.inDiv=false; this.tempTxtMarker=false; this.drawColors=["000000","666666","FFFFFF","FF0000","00FF00","0000FF","FFFF00","00FFFF","FF00FF"]; this.drawColor="000000"; this.pencilWeights=[1,2,3,5,7,10,16]; this.addExpIcon=new GIcon(); this.addExpIcon.image="/images/dragMe2.png"; this.addExpIcon.shadow="/images/dragMe2Shad.png"; this.addExpIcon.iconSize=new GSize(70,60); this.addExpIcon.shadowSize=new GSize(70,60); this.addExpIcon.iconAnchor=new GPoint(29,56); this.addExpIcon.infoWindowAnchor=new GPoint(29,56); this.addExpIcon.imageMap=[1,12,2,8,4,4,12,1,46,1,53,4,55,8,56,12,56,33,55,37,53,41,46,44,38,44,35,46,32,50,29,56,26,50,23,46,20,44,12,44,4,41,2,37,1,33,1,12,1,12]; this.addExpIcon.transparent="/images/dragMe2Trans.png"; this.drawControl=new GJMapControl("Click here to draw on the map.",{textDecoration:"underline",color:"#3366CC",backgroundColor:"#FFF",fontFamily:"Arial",fontSize:"14px",border:"1px solid black",padding:"4px",textAlign:"center",cursor:"pointer"},new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(7,32)),function(){ this.startDrawMode(); }.bind(this)); this.allOverlays=new Array(); this.finished=false; gjapp.viewPort.hideBelowMap(); this.addDrawControl(); this.addExpGroupId=Math.round(Math.random()*999999999); this.photonumber=1; this.progressDotCounter=new Array(); this.gjmap.map.clearOverlays(); this.pageContainer.loadPage("/view/GJViewAddExp",this.mergeJSON(_2,{mode:this.editMode?"startEdit":"startAdd",editId:this.editId})); if(!this.editMode){ this.finishExpMarkerDraw(this.gjmap.getCenterRandOffset(100)); } if($("addExpText")&&$("addExpText").parentNode){ $("addExpText").innerHTML=(this.editMode?"Cancel&nbsp;Editing&nbsp;Blog&nbsp;Entry</a>":"Cancel&nbsp;Adding&nbsp;Blog&nbsp;Entry"); $("addExpText").onclick=function(){ gjapp.viewPort.setView(new GJViewExpList({filter:"mostRecent"})); return false; }; } } },setAddExpLink:function(_4){ _4.innerHTML=(this.editMode?"Cancel&nbsp;Editing&nbsp;Blog&nbsp;Entry</a>":"Cancel&nbsp;Adding&nbsp;Blog&nbsp;Entry"); _4.onclick=function(){ gjapp.viewPort.setView(new GJViewExpList({filter:"mostRecent"})); return false; }; },drawSnapMarkers:function(_5,_6){ this.snapMarkers=[]; for(var i=0;i<_5.length;i++){ if(_6==_5[i].id){ this.markerSnappedTo=_5[i].id; } var _8=new GIcon(); _8.image="/images/snapIcon.png"; _8.iconSize=new GSize(27,29); _8.iconAnchor=new GPoint(14,29); _8.infoWindowAnchor=new GPoint(14,29); var _9=new GMarker(new GLatLng(parseFloat(_5[i].lat),parseFloat(_5[i].lon)),{icon:_8}); _9["expPointId"]=_5[i].id; this.snapMarkers.push(_9); this.gjmap.map.addOverlay(_9); } },finishExpMarkerDraw:function(_a){ this.addExpMarker=new GMarker(_a,{icon:this.addExpIcon,draggable:true,bouncy:false}); GEvent.addListener(this.addExpMarker,"dragend",this.finishMarkerDrag.bind(this)); this.gjmap.map.addOverlay(this.addExpMarker); this.moveEndListener=GEvent.addListener(this.gjmap.map,"moveend",function(){ var _b=this.gjmap.map.getBounds(); var _c=this.addExpMarker.getPoint(); if(!_b.contains(_c)){ this.addExpMarker.setPoint(this.gjmap.getCenterRandOffset(100)); } }.bind(this)); },finishMarkerDrag:function(){ var _d=this.gjmap.map.fromLatLngToDivPixel(this.addExpMarker.getPoint()); var _e=10000; var _f=false; for(var i=0;i<this.snapMarkers.length;i++){ var pix=this.gjmap.map.fromLatLngToDivPixel(this.snapMarkers[i].getPoint()); var _12=Math.sqrt(Math.pow(pix.x-_d.x,2)+Math.pow(pix.y-_d.y,2)); if(_12<16&&_12<_e){ _f=this.snapMarkers[i]; _e=_12; } } if(_f){ this.addExpMarker.setPoint(_f.getPoint()); this.markerSnappedTo=_f.expPointId; if(this.firstSnap){ alert("Your marker has just snapped on to one of your other blog entries. \n"+"That means that these entries will be grouped together and displayed \n"+"using an icon labeled \"Multi\" that indicates multiple blog entries at \n"+"the same location."); this.firstSnap=false; } }else{ this.markerSnappedTo=false; } },fetchIMsOnRedraw:function(){ return true; },startDrawMode:function(){ if(this.drawModeActive){ return; } this.drawModeActive=true; this.linePointsArray=new Array(); this.lineEncoder=false; this.lastPolyDraw=0; this.createDrawCover(); this.addDrawTools(); },createDrawCover:function(){ var _13=document.createElement("div"); _13.style.position="absolute"; _13.style.padding="0px"; _13.style.margin="0px"; _13.style.borderWidth="0px"; _13.style.backgroundColor="#FFF"; _13.style.opacity=".01"; _13.style.filter="alpha(opacity=01)"; _13.style.MozOpacity="0.01"; _13.style.left="0px"; _13.style.top="0px"; var _14=this.gjmap.map.getSize(); _13.style.width=_14.width+"px"; _13.style.height=_14.height+"px"; _13.style.zIndex=9999999990; this.cover=_13; var _15=Position.cumulativeOffset(this.gjmap.map.getContainer()); this.mapLeft=_15[0]; this.mapTop=_15[1]; var _16=this.gjmap.map.getContainer().getDimensions(); this.mapWidth=_16.width; this.mapHeight=_16.height; this.cover.onmousedown=function(ev2){ this.linePointsArray=new Array(); var e2=ev2?ev2:window.event; var _19=Event.pointerX(e2)-(isIE?4:2); var _1a=Event.pointerY(e2)-(isIE?2:-1); if(!Position.within(this.gjmap.map.getContainer(),_19,_1a)){ return; } this.mouseMoveDraw(e2); var _1b=function(evt){ var e=evt?evt:window.event; Event.stop(e); gjapp.viewPort.getView().mouseMoveDraw(e); }.bind(this); document.onmousemove=_1b; }.bind(this); document.onmouseup=this.handleDrawMouseUp.bind(this); this.removeDrawControl(); this.gjmap.removeGeneralMapControls(); this.gjmap.map.getContainer().appendChild(this.cover); },removeDrawCover:function(){ if(this.cover){ this.cover.onmousedown=null; document.onmousemove=null; document.onmouseup=null; this.removeDrawControl(); this.gjmap.map.getContainer().removeChild(this.cover); this.gjmap.addGeneralMapControls(); this.cover=false; } },addDrawTools:function(){ var _1e=isIE?"hand":"pointer"; var _1f={position:"absolute",margin:"0px",padding:"1px",border:"1px solid #000",backgroundColor:"#FFF",zIndex:9999999995,fontFamily:"Arial",fontSize:"12px",cursor:_1e}; var _20=document.createElement("div"); for(var key in _1f){ _20.style[key]=_1f[key]; } _20.style.left="12px"; _20.style.top="12px"; _20.style.width="25px"; var htm=""; for(var i=0;i<this.drawColors.length;i++){ htm+="<div style=\"cursor: "+_1e+"; border: 1px solid #000; width: 15px; margin-left: 4px; margin-right: 4px; background-color: #"+this.drawColors[i]+"; font-size: 4px; margin-bottom: 1px;\" id=\"colorSwatch"+i+"\" onclick=\"gjapp.viewPort.getView().setDrawColor('"+this.drawColors[i]+"', "+i+"); return false;\">&nbsp;</div>"; } for(var i=0;i<this.pencilWeights.length;i++){ htm+="<div id=\"pencilWeight"+this.pencilWeights[i]+"\" style=\"cursor: "+_1e+"; margin-bottom: 1px; border: 0px solid #000;\"><img src=\"/images/pencil"+this.pencilWeights[i]+"px.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Pencil Weight "+this.pencilWeights[i]+"\" onclick=\"gjapp.viewPort.getView().setPencilWeight("+this.pencilWeights[i]+"); return false;\" /></div>"; } _20.innerHTML=htm; this.drawTools=_20; this.gjmap.map.getContainer().appendChild(this.drawTools); var _24=document.createElement("div"); for(var key in _1f){ _24.style[key]=_1f[key]; } _24.style.right="7px"; _24.style.top="7px"; _24.style.padding="4px"; _24.style.fontSize="14px"; var _25="<select name=\"type\" style=\"font-size: 10px;\">"+"<option value=\"baroiq\">Brauniger IQ Series Barograph Download </option><option value=\"cambridge\">Cambridge/Winpilot glider software </option><option value=\"cst\">CarteSurTable data file </option><option value=\"cetus\">Cetus for Palm/OS </option><option value=\"coastexp\">CoastalExplorer XML </option><option value=\"csv\">Comma separated values </option><option value=\"compegps\">CompeGPS data files (.wpt/.trk/.rte) </option><option value=\"copilot\">CoPilot Flight Planner for Palm/OS </option><option value=\"coto\">cotoGPS for Palm/OS </option><option value=\"axim_gpb\">Dell Axim Navigation System (.gpb) file format </option><option value=\"an1\">DeLorme .an1 (drawing) file </option><option value=\"gpl\">DeLorme GPL </option><option value=\"saplus\">DeLorme Street Atlas Plus </option><option value=\"saroute\">DeLorme Street Atlas Route </option><option value=\"xmap\">DeLorme XMap HH Native .WPT </option><option value=\"xmap2006\">DeLorme XMap/SAHH 2006 Native .TXT </option><option value=\"xmapwpt\">DeLorme XMat HH Street Atlas USA .WPT (PPC) </option><option value=\"easygps\">EasyGPS binary format </option><option value=\"igc\">FAI/IGC Flight Recorder Data Format </option><option value=\"gpssim\">Franson GPSGate Simulation </option><option value=\"fugawi\">Fugawi </option><option value=\"garmin301\">Garmin 301 Custom position and heartrate </option><option value=\"glogbook\">Garmin Logbook XML </option><option value=\"gdb\">Garmin MapSource - gdb </option><option value=\"mapsource\">Garmin MapSource - mps </option><option value=\"garmin_txt\">Garmin MapSource - txt </option><option value=\"pcx\">Garmin PCX5 </option><option value=\"garmin_poi\">Garmin POI database </option><option value=\"garmin\">Garmin serial/USB protocol </option><option value=\"geo\">Geocaching.com .loc </option><option value=\"gcdb\">GeocachingDB for Palm/OS </option><option value=\"geonet\">GEOnet Names Server (GNS) </option><option value=\"geoniche\">GeoNiche .pdb </option><option value=\"google\">Google Maps XML </option><option value=\"kml\">Google Keyhole Markup Language(KML or KMZ)</option><option value=\"gpilots\">GpilotS </option><option value=\"gtm\">GPS TrackMaker </option><option value=\"arc\">GPSBabel arc filter file </option><option value=\"gpsdrive\">GpsDrive Format </option><option value=\"gpsdrivetrack\">GpsDrive Format for Tracks </option><option value=\"gpsman\">GPSman </option><option value=\"gpspilot\">GPSPilot Tracker for Palm/OS </option><option value=\"gpsutil\">gpsutil </option><option value=\"gpx\">GPX XML </option><option value=\"hiketech\">HikeTech </option><option value=\"holux\">Holux (gm-100) .wpo Format </option><option value=\"hsandv\">HSA Endeavour Navigator export File </option><option value=\"html\">HTML Output </option><option value=\"ignrando\">IGN Rando track files </option><option value=\"ktf2\">Kartex 5 Track File </option><option value=\"kwf2\">Kartex 5 Waypoint File </option><option value=\"psitrex\">KuDaTa PsiTrex text </option><option value=\"lowranceusr\">Lowrance USR </option><option value=\"maggeo\">Magellan Explorist Geocaching </option><option value=\"mapsend\">Magellan Mapsend </option><option value=\"magnav\">Magellan NAV Companion for Palm/OS </option><option value=\"magellanx\">Magellan SD files (as for eXplorist) </option><option value=\"magellan\">Magellan SD files (as for Meridian) </option><option value=\"magellan\">Magellan serial protocol </option><option value=\"tef\">Map&amp;Guide 'TourExchangeFormat' XML </option><option value=\"mag_pdb\">Map&amp;Guide to Palm/OS exported files (.pdb) </option><option value=\"mapconverter\">Mapopolis.com Mapconverter CSV </option><option value=\"mxf\">MapTech Exchange Format </option><option value=\"msroute\">Microsoft AutoRoute 2002 (pin/route reader) </option><option value=\"msroute\">Microsoft Streets and Trips (pin/route reader) </option><option value=\"s_and_t\">Microsoft Streets and Trips 2002-2006 </option><option value=\"bcr\">Motorrad Routenplaner (Map&amp;Guide) .bcr files </option><option value=\"psp\">MS PocketStreets 2002 Pushpin </option><option value=\"tpg\">National Geographic Topo .tpg (waypoints) </option><option value=\"tpo2\">National Geographic Topo 2.x .tpo </option><option value=\"tpo3\">National Geographic Topo 3.x .tpo </option><option value=\"navicache\">Navicache.com XML </option><option value=\"nmn4\">Navigon Mobile Navigator .rte files </option><option value=\"dna\">Navitrak DNA marker format </option><option value=\"netstumbler\">NetStumbler Summary File (text) </option><option value=\"nima\">NIMA/GNIS Geographic Names File </option><option value=\"nmea\">NMEA 0183 sentences </option><option value=\"ozi\">OziExplorer </option><option value=\"palmdoc\">PalmDoc Output </option><option value=\"pathaway\">PathAway Database for Palm/OS </option><option value=\"quovadis\">Quovadis </option><option value=\"cup\">See You flight analysis data </option><option value=\"stmwpp\">Suunto Trek Manager (STM) WaypointPlus files </option><option value=\"openoffice\">Tab delimited fields useful for OpenOffice, Ploticus etc. </option><option value=\"text\">Textual Output </option><option value=\"tomtom\">TomTom POI file </option><option value=\"tmpro\">TopoMapPro Places File </option><option value=\"vcard\">Vcard Output (for iPod) </option><option value=\"vitosmt\">Vito Navigator II tracks </option><option value=\"wfff\">WiFiFoFum 2.0 for PocketPC XML </option><option value=\"wbt\">Wintec WBT-100/200 GPS Download </option><option value=\"yahoo\">Yahoo Geocode API data </option>"+"</select>"; var _26="<span class=\"fba\"><b>Click and drag</b> the pointer<br />on the map to draw a line.<br /><b>Click once</b> to add a text marker.</span><br />"; _26+="<a href=\"#\" onclick=\"gjapp.viewPort.getView().undoLastDraw(); $('gpsImportCompleteMsg').innerHTML = ''; gjTracker('/click/addExp/undoLastDraw'); return false;\" class=\"fba\">Erase last item</a><br />"; _26+="<a href=\"#\" onclick=\"if(confirm('Are you sure you want to clear all items from the map?')) { gjapp.viewPort.getView().clearAllLines(); $('gpsImportCompleteMsg').innerHTML = ''; } gjTracker('/click/addExp/clearAllDrawings'); return false;\" class=\"fba\">Clear all items</a><br />"; _26+="<a href=\"#\" onclick=\"gjapp.viewPort.getView().stopDrawMode(); gjTracker('/click/addExp/finishedDrawing'); return false;\" class=\"fba\">Finished drawing</a><br /><br />"; _26+="<span id=\"gpsTrackMsg1\" style=\"display: block;\"><a href=\"#\" onclick=\"gjapp.viewPort.getView().showGPSImportForm(); gjTracker('/click/addExp/startGPSImport'); return false;\" class=\"fba\">Import a GPS track.</a></span>"; _26+="<span id=\"gpsImportCompleteMsg\" class=\"fba\"></span>"; _26+="<span id=\"gpsTrackMsg2\" style=\"display: none;\"><a href=\"#\" onclick=\"$('gpsTrackImportForm').style.display = 'none'; $('gpsTrackMsg1').style.display = 'block'; $('gpsTrackMsg2').style.display = 'none'; $('gpsImportCompleteMsg').innerHTML = ''; gjTracker('/click/addExp/hideGPSForm'); return false;\" class=\"fba\">Hide GPS import form</a></span>"; _26+="<div id=\"gpsImportLoadingDiv\" style=\"width: 32px; height: 32px; display: none;\"><img src=\"/images/loading2.gif\" width=\"32\" height=\"32\" border=\"0\" class=\"fba\" /></div>"; _26+="<div id=\"gpsTrackImportForm\" style=\"display: none;\" class=\"fba\"><form action=\"/e/gpsImport\" method=\"POST\" enctype=\"multipart/form-data\" target=\"gpsIframeUp\" id=\"gpsUploadForm\" name=\"gpsUploadForm\"><br />Select a file:<br /><input type=\"file\" id=\"gpsTrackFile\" name=\"gpsTrackFile\" size=\"20\" style=\"font-size: 10px;\" /><br />Select a format:<br />"+_25+"<br /><br />Your GPS track will be drawn in the<br />selected color and line thickness."+"<br /><input type=\"button\" name=\"gpsTrackSubmit\" value=\"Click to start import\" onclick=\"$('gpsUploadForm').submit(); $('gpsTrackImportForm').style.display = 'none'; $('gpsImportLoadingDiv').style.display = 'block';\" /></form></div><iframe name=\"gpsIframeUp\" height=\"0\" width=\"0\" frameborder=\"1\" style=\"visibility: hidden;\">sdf</iframe>"; _24.innerHTML=_26; this.drawMenuDiv=_24; this.gjmap.map.getContainer().appendChild(this.drawMenuDiv); this.setDrawColor("FF0000",3); this.setPencilWeight(5); },showGPSImportForm:function(){ $("gpsTrackImportForm").style.display="block"; $("gpsTrackMsg1").style.display="none"; $("gpsTrackMsg2").style.display="block"; $("gpsImportCompleteMsg").innerHTML=""; },finishGPSUpload:function(_27){ var _28={color:"#"+this.drawColor,weight:this.pencilWeight,points:_27.ePoints,levels:_27.eLevels,zoomFactor:16,numLevels:4}; this.allOverlays.push([_28,new GPolyline.fromEncoded(_28)]); this.gjmap.map.addOverlay(this.allOverlays[this.allOverlays.length-1][1]); $("gpsTrackMsg1").style.display="block"; $("gpsTrackMsg2").style.display="none"; $("gpsImportLoadingDiv").style.display="none"; $("gpsTrackImportForm").style.display="none"; $("gpsImportCompleteMsg").innerHTML="Successfully imported <b>"+_27.totalPoints+"</b><br /> points with a total<br /> distance of <b>"+_27.totalDistance+" miles</b>.<br />You can zoom to <a href=\"#\" onclick=\"gjapp.gjmap.map.setCenter(new GLatLng(parseFloat("+_27.startLat+"), parseFloat("+_27.startLon+")), 13); gjTracker('/click/addExp/gpsZoomStart'); return false;\">the start</a><br />or <a href=\"#\" onclick=\"gjapp.gjmap.map.setCenter(new GLatLng(parseFloat("+_27.endLat+"), parseFloat("+_27.endLon+")), 13); gjTracker('/click/addExp/gpsZoomEnd'); return false;\">the end</a> of your track."; },cancelGPSUpload:function(){ $("gpsImportCompleteMsg").innerHTML=""; $("gpsTrackMsg1").style.display="block"; $("gpsTrackMsg2").style.display="none"; $("gpsImportLoadingDiv").style.display="none"; $("gpsTrackImportForm").style.display="none"; },removeDrawTools:function(){ if(this.drawTools){ this.gjmap.map.getContainer().removeChild(this.drawTools); this.drawTools=false; } if(this.drawMenuDiv){ this.gjmap.map.getContainer().removeChild(this.drawMenuDiv); this.drawMenuDiv=false; } },handleDrawMouseUp:function(){ document.onmousemove=null; if(this.linePointsArray.length==0){ this.linePointsArray=new Array(); return; } if(this.inDiv){ for(var i=0;i<this.linePointsArray.length;i++){ $("mainBodyDiv").removeChild($(this.linePointsArray[i][2])); this.linePointsArray=new Array(); } return; } if(this.linePointsArray.length==1){ if(this.linePointsArray[0]&&this.linePointsArray[0][2]&&$(this.linePointsArray[0][2])){ var _2a=new GPoint(this.linePointsArray[0][0],this.linePointsArray[0][1]); var _2b=this.gjmap.map.fromContainerPixelToLatLng(_2a); $("mainBodyDiv").removeChild($(this.linePointsArray[0][2])); var _2c=document.createElement("div"); _2c.style.position="absolute"; _2c.style.border="2px solid #3366CC"; _2c.style.backgroundColor="#FFF"; _2c.style.fontSize="10px"; _2c.style.opacity="0.80"; _2c.style.filter="alpha(opacity=80)"; _2c.style.MozOpacity="0.80"; _2c.style.left=(Math.floor(this.gjmap.map.getSize().width/2)-50)+"px"; _2c.style.top=(Math.floor(this.gjmap.map.getSize().height/2)-50)+"px"; _2c.style.zIndex=9999999999; _2c.style.width="200px"; _2c.innerHTML="<span class=\"fb\">Enter&nbsp;text&nbsp;for&nbsp;your&nbsp;marker:<br /><input autocomplete=\"off\" type=\"text\" name=\"markerMarkerTxt\" id=\"markerMakerTxt\" value=\"\" size=\"20\" maxlength=\"255\" onkeydown=\"if(event.keyCode == 13){gjapp.viewPort.getView().addDrawableMarker("+_2a.x+","+_2a.y+"); return false; }\" /><br /><input type=\"button\" name=\"Add Marker\" value=\"Add Marker\" onclick=\"gjapp.viewPort.getView().addDrawableMarker("+_2a.x+","+_2a.y+"); return false;\" />&nbsp;<input type=\"button\" name=\"CancelMarkerAdd\" value=\"Cancel\" onclick=\"gjapp.viewPort.getView().removeMarkerEditBits(); return false;\" /></span>"; this.inDiv=_2c; this.gjmap.map.getContainer().appendChild(_2c); this.tempTxtMarker=new GJTxtMarker1(_2b,{text:"New Marker",borderColor:this.drawColor}); this.gjmap.map.addOverlay(this.tempTxtMarker); if(isIE){ setTimeout(function(){ $("markerMakerTxt").focus(); },300); }else{ $("markerMakerTxt").focus(); } } this.linePointsArray=new Array(); return; } var _2d=new GJLineEncoder(); for(var i=0;i<this.linePointsArray.length;i++){ var _2e=this.gjmap.map.fromContainerPixelToLatLng(new GPoint(this.linePointsArray[i][0],this.linePointsArray[i][1])); _2d.addPoint(_2e.lat(),_2e.lng(),3); $("mainBodyDiv").removeChild($(this.linePointsArray[i][2])); } var _2f={color:"#"+this.drawColor,weight:this.pencilWeight,points:_2d.getEncodedPoints(),levels:_2d.getEncodedLevels(),zoomFactor:32,numLevels:4}; this.allOverlays.push([_2f,new GPolyline.fromEncoded(_2f)]); this.gjmap.map.addOverlay(this.allOverlays[this.allOverlays.length-1][1]); this.linePointsArray=new Array(); return; },addDrawableMarker:function(x,y){ if(!$F("markerMakerTxt")){ this.removeMarkerEditBits(); return; } var _32=new GPoint(x,y); var _33=this.gjmap.map.fromContainerPixelToLatLng(_32); var _34=$F("markerMakerTxt"); _34=_34.replace(/'/,""); this.removeMarkerEditBits(); var _35={text:_34,borderColor:this.drawColor,lat:_33.lat(),lon:_33.lng()}; this.allOverlays.push([_35,new GJTxtMarker1(_33,_35)]); this.gjmap.map.addOverlay(this.allOverlays[this.allOverlays.length-1][1]); },removeMarkerEditBits:function(){ if(this.inDiv){ this.gjmap.map.getContainer().removeChild(this.inDiv); this.inDiv=false; } if(this.tempTxtMarker){ this.gjmap.map.removeOverlay(this.tempTxtMarker); this.tempTxtMarker=false; } },clearAllLines:function(){ for(var i=0;i<this.allOverlays.length;i++){ this.gjmap.map.removeOverlay(this.allOverlays[i][1]); } this.allOverlays=new Array(); },undoLastDraw:function(){ if(this.allOverlays.length>0){ this.gjmap.map.removeOverlay(this.allOverlays[this.allOverlays.length-1][1]); this.allOverlays.pop(); } },setDrawColor:function(col,i){ this.drawColor=col; for(var j=0;j<this.drawColors.length;j++){ $("colorSwatch"+j).style.border="1px solid #000"; $("colorSwatch"+j).style.marginLeft="4px"; $("colorSwatch"+j).style.marginRight="4px"; } $("colorSwatch"+i).style.border="3px solid #000"; $("colorSwatch"+i).style.marginLeft="2px"; $("colorSwatch"+i).style.marginRight="2px"; },setPencilWeight:function(_3a){ this.pencilWeight=_3a; for(var i=0;i<this.pencilWeights.length;i++){ $("pencilWeight"+this.pencilWeights[i]).style.border="0px solid #000"; } $("pencilWeight"+_3a).style.border="2px solid #000"; },isEventOutsideElem:function(_3c,e){ },mouseMoveDraw:function(e){ var _3f=Event.pointerX(e)-(isIE?4:2); var _40=Event.pointerY(e)-(isIE?2:-1); if(!Position.within(this.gjmap.map.getContainer(),_3f,_40)){ this.handleDrawMouseUp(); return; } var x=_3f-this.mapLeft; var y=_40-this.mapTop; var _43="mapPixelDiv"+_3f+"-"+_40; if(!$(_43)){ var pix=document.createElement("div"); pix.id=_43; pix.style.position="absolute"; pix.style.border="1px solid #"+this.drawColor; pix.style.backgroundColor="#"+this.drawColor; pix.style.fontSize="1px"; pix.style.width="1px"; pix.style.height="1px"; pix.style.left=(_3f+2)+"px"; pix.style.top=(_40-1)+"px"; pix.style.zIndex=99999999999; pix.onmouseup=this.handleDrawMouseUp.bind(this); $("mainBodyDiv").appendChild(pix); this.linePointsArray.push([x,y,_43]); } return; },stopDrawMode:function(){ this.removeMarkerEditBits(); this.drawModeActive=false; this.removeDrawTools(); this.removeDrawCover(); this.gjmap.addGeneralMapControls(); this.addDrawControl(); },expandPanel:function(){ this.stopDrawMode(); this.gjmap.removeGeneralMapControls(); this.removeDrawControl(); this.savedAboveMap=$("aboveMap").innerHTML; $("aboveMap").innerHTML="<div style=\"border: 1px solid #CCC; background-color: #EAF2FF; padding: 3px 3px 30px 3px; text-align: center;\"><a href=\"#\" onclick=\"gjapp.viewPort.getView().shrinkPanel(); return false;\" class=\"fb\">Expand Map</a></div>"; $("mainTableLeft").style.width="10%"; $("mainTableRight").style.width="90%"; $("expandPanelDiv").style.display="none"; $("shrinkPanelDiv").style.display="block"; this.gjmap.map.checkResize(); },shrinkPanel:function(){ $("aboveMap").innerHTML=this.savedAboveMap; this.gjmap.addGeneralMapControls(); this.addDrawControl(); $("mainTableLeft").style.width="50%"; $("mainTableRight").style.width="50%"; $("expandPanelDiv").style.display="block"; $("shrinkPanelDiv").style.display="none"; this.gjmap.map.checkResize(); },canRestore:function(){ return false; },getRestoreParams:function(){ },getClassName:function(){ return "GJViewAddExp"; },unloadOK:function(_45){ var msg; if(this.editMode){ msg="Are you sure you want to stop editing this entry?"; }else{ msg="Are you sure you want to stop adding this entry?"; } if(_45||this.finished||confirm(msg)){ this.stopDrawMode(); this.gjmap.map.enableDragging(); this.gjmap.map.clearOverlays(); this.removeDrawCover(); this.removeDrawControl(); this.removeDrawTools(); this.gjmap.removeGeneralMapControls(); this.gjmap.addGeneralMapControls(); GEvent.removeListener(this.moveEndListener); $("addExpText").innerHTML="Post a Blog Entry"; $("addExpText").onclick=function(){ gjapp.startAddExperience(); gjTracker("/click/addAnExperience"); return false; }; gjapp.viewPort.unhideBelowMap(); Event.stopObserving(window,"beforeunload",this.boundUnloadHandler,true); return true; }else{ return false; } },editExperience:function(_47){ this.viewPort.setView(new GJViewEditExperience({id:_47})); return; },validatePhotoUpload:function(){ $("pgroupid").value=this.addExpGroupId; return true; },startUpload:function(){ $("uploadForm").style.display="none"; $("uploadStatus").style.display="block"; },_stopProgressMessage:function(_48){ clearInterval(_48); },drawOverlays:function(_49){ if(_49&&_49.length){ this.allOverlays=new Array(); for(var i=0;i<_49.length;i++){ if(_49[i].points){ this.allOverlays.push([_49[i],new GPolyline.fromEncoded(_49[i])]); }else{ this.allOverlays.push([_49[i],new GJTxtMarker1(new GLatLng(parseFloat(_49[i].lat),parseFloat(_49[i].lon)),_49[i])]); } } this.allOverlays.each(function(_4b){ this.gjmap.map.addOverlay(_4b[1]); }.bind(this)); } },finishUpload:function(_4c,_4d,_4e,_4f,_50,_51,_52){ this.currentImageData={smallImg:_4c,smallWidth:_4d,smallHeight:_4e,bigImg:_4f,bigWidth:_50,bigHeight:_51,title:_52}; this._stopProgressMessage(this.uploadInt); $("uploadStatus").style.display="none"; $("photoPreview").innerHTML="<div id=\"currentPhotoPreview\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" align=\"left\"><div style=\"width: "+_4d+"px; height: "+_4e+"px; border: 2px solid #000;\" id=\"photoInnerDiv\"><img src=\""+_4c+"?b="+Math.floor(Math.random()*99999999)+"\" alt=\""+_52.replace(/"/,"\\\"")+"\" border=\"0\" width=\""+_4d+"\" height=\""+_4e+"\" /></div></td><td valign=\"top\" align=\"left\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><a href=\"#\" onclick=\"gjapp.viewPort.getView().modPhoto('"+_4c+"','del','Deleting'); gjTracker('/click/addExp/delPhoto'); return false;\"><img src=\"/images/icons/pmClose.gif\" width=\"19\" height=\"19\" style=\"border: 1px solid #000;\" /></a></td></tr><tr><td><a href=\"#\" onclick=\"gjapp.viewPort.getView().modPhoto('"+_4c+"','rcw', 'Rotating'); gjTracker('/click/addExp/rotatePhoto'); return false;\"><img src=\"/images/icons/pmRotCW.gif\" width=\"19\" height=\"19\" style=\"border: 1px solid #000;\" /></a></td></tr><tr><td><a href=\"#\" onclick=\"gjapp.viewPort.getView().modPhoto('"+_4c+"','rccw', 'Rotating'); gjTracker('/click/addExp/rotatePhoto'); return false;\"><img src=\"/images/icons/pmRotCCW.gif\" width=\"19\" height=\"19\" style=\"border: 1px solid #000;\" /></a></td></tr><tr><td><a href=\"#\" onclick=\"gjapp.viewPort.getView().modPhoto('"+_4c+"','lght', 'Lightening'); gjTracker('/click/addExp/lightenPhoto'); return false;\"><img src=\"/images/icons/pmBrighten.gif\" width=\"19\" height=\"19\" style=\"border: 1px solid #000;\" /></a></td></tr><tr><td><a href=\"#\" onclick=\"gjapp.viewPort.getView().modPhoto('"+_4c+"','drkn', 'Darkening'); gjTracker('/click/addExp/darkenPhoto'); return false;\"><img src=\"/images/icons/pmDarken.gif\" width=\"19\" height=\"19\" style=\"border: 1px solid #000;\" /></a></td></tr></table></td></tr></table></div>"; $("photoAttributes").style.display="block"; },cancelUpload:function(){ this._stopProgressMessage(this.uploadInt); $("uploadStatus").style.display="none"; $("uploadForm").style.display="block"; },_photoBusy:function(){ if(this.photoChangeInProgress){ alert("You are already making a change to one of your photos.\nPlease wait until this is completed."); return true; } return false; },modPhoto:function(img,_54,msg){ if(this._photoBusy()){ return; } var _56=function(_57,_58){ this.currentImageData=_58; this._stopPhotoProgress(); $("photoInnerDiv").style.width=_58.smallWidth+"px"; $("photoInnerDiv").style.height=_58.smallHeight+"px"; $("photoInnerDiv").innerHTML="<img src=\""+_58.smallImg+"?b="+Math.floor(Math.random()*99999999)+"\" border=\"0\" alt=\""+_58.title.replace(/"/,"\\\"")+"\" width=\""+_58.smallWidth+"\" height=\""+_58.smallHeight+"\" />"; }.bind(this); if(_54=="del"){ if(!confirm("Are you sure you want to remove this photo?")){ return; } _56=function(){ this._stopPhotoProgress(); this.currentImageData=false; Element.remove($("currentPhotoPreview")); $("photoAttributes").style.display="none"; $("uploadForm").style.display="block"; }.bind(this); } this._startPhotoProgress(msg); new Ajax.Request("/view/GJViewAddExp",{method:"post",parameters:$H({"p":img,"mode":"modphoto","a":_54,editMode:this.editMode?1:0,editId:this.editMode?this.editId:0}).toQueryString(),onComplete:_56}); },_startPhotoProgress:function(msg){ $("photoInnerDiv").style.backgroundColor="#999"; this.pStatCnt=1; msg="<br />&nbsp;&nbsp;<span style=\"font-size: 12px;\">"+msg+"</span>"; this.photoChangeInProgress=setInterval(function(){ var _5a=msg; for(var i=1;i<=this.pStatCnt;i++){ _5a+="."; } $("photoInnerDiv").innerHTML=_5a; this.pStatCnt++; if(this.pStatCnt%10==0){ this.pStatCnt=1; } }.bind(this),100); },_stopPhotoProgress:function(){ clearInterval(this.photoChangeInProgress); this.photoChangeInProgress=false; $("photoInnerDiv").innerHTML=""; $("photoInnerDiv").style.backgroundColor="#FFF"; },insertPhoto:function(){ if(!this.currentImageData){ gjapp.closePanel(); return; } var _5c; if($F("imageSizeToInsert")=="thumbnail"){ _5c="<img border=\"0\" src=\""+this.currentImageData.smallImg+"\" width=\""+this.currentImageData.smallWidth+"\" height=\""+this.currentImageData.smallHeight+"\" openlargeonclick=\"true\""; }else{ if($F("imageSizeToInsert")=="big"){ _5c="<img border=\"0\" src=\""+this.currentImageData.bigImg+"\" width=\""+this.currentImageData.bigWidth+"\" height=\""+this.currentImageData.bigHeight+"\""; }else{ alert("Please select a valid image size to insert."); return; } } _5c+=" alt=\""+this.currentImageData.title.replace(/"/,"\\\"")+"\""; if($F("imageRFL")){ _5c+=" style=\"float: left;\""; }else{ if($F("imageRFR")){ _5c+=" style=\"float: right;\""; }else{ if($F("imageRNF")){ _5c+=""; }else{ alert("Please select a valid text wrapping method."); return; } } } _5c+=" />"; this.editor.InsertHtml(_5c); gjapp.closePanel(); return; },submitExpForm:function(){ if(this.gjmap.map.getZoom()<4){ alert("The map is zoomed out too far. You need to zoom in\ncloser to the location where you are posting this entry.\nOnce you have zoomed closer, drag the blue icon\non the map onto the spot where you are posting this entry.\n\nYou can use the Landmark and Address search at the top right\nof this page to find the place where you're posting this entry.\nYou can also use the slider on the left of the map to zoom in further.\nClick and drag the map to move it around manually."); $("submitExpButton").disabled=false; return; } var _5d=new Array(); for(var i=0;i<this.allOverlays.length;i++){ _5d[i]=this.allOverlays[i][0]; } var _5f=this.gjmap.map.getCenter(); var _60=_5f.lng(); var _61=_5f.lat(); var _62=Form.serialize("addExpForm")+"&"+$H({description:this.editor.GetXHTML(),editMode:this.editMode?1:0,editId:this.editMode?this.editId:0,groupid:this.addExpGroupId,lat:this.addExpMarker.getPoint().lat(),lon:this.addExpMarker.getPoint().lng(),snappedTo:this.markerSnappedTo?this.markerSnappedTo:0,moverlays:Dumper(_5d),centerLat:this.gjmap.map.getCenter().lat(),centerLon:this.gjmap.map.getCenter().lng(),zoomLevel:this.gjmap.map.getZoom(),mapType:this.gjmap.map.getCurrentMapType().getName(true),journeyLineColor:/rgb/.test($("journeyColorSample").style.backgroundColor)?gjutils.colorRGBtoHex($("journeyColorSample").style.backgroundColor):$("journeyColorSample").style.backgroundColor}).toQueryString(); new Ajax.Request("/view/GJViewAddExp",{method:"post",parameters:_62,onComplete:this._finishAddExpForm.bind(this)}); },_finishAddExpForm:function(req,_64){ if(!_64){ alert("We encountered an application error while trying to add your entry.\n\nTry again in a few minutes, or click the Geojoey logo (top left) to reload Geojoey and try again.\n\nYou may want to save your blog entry using cut and paste into notepad or another application.\nWe appologize for any inconvenience."); $("submitExpButton").disabled=false; return; } if(_64.err){ $("submitExpButton").disabled=false; _64.nonErrFields.each(function(_65){ $(_65).style.display="none"; }); _64.errFields.each(function(_66){ $(_66).style.display="inline"; }); var _67="<ul>"; _64.errMsgs.each(function(msg){ _67+="<li>"+msg+"</li>"; }); _67+="</ul>"; $("errMessage").style.display="block"; $("errMessage").innerHTML=_67; this.pageContainer.scrollUp(); return; }else{ this.finished=true; gjapp.viewPort.setView(new GJViewExperience({id:_64.id})); return; } },addDrawControl:function(){ this.gjmap.map.addControl(this.drawControl); },removeDrawControl:function(){ this.gjmap.map.removeControl(this.drawControl); },mapMarkerFactory:function(){ },redrawJourneyForm:function(_69){ if(_69){ for(var i=0;i<$("journeyTravelMethod").length;i++){ if($("journeyTravelMethod").options[i].value=="CUSTOM"){ $("journeyTravelMethod").selectedIndex=i; break; } } } if($F("journeyId")=="ADD"){ gjapp.loadSPanel("/e/manageJourneys"); $("journeyId").selectedIndex=0; $("travelMethodDiv").style.display="none"; $("travSampleContainer").style.display="none"; }else{ if(/^\d+$/.test($F("journeyId"))){ $("travelMethodDiv").style.display="block"; $("travSampleContainer").style.display="block"; }else{ $("travelMethodDiv").style.display="none"; $("travSampleContainer").style.display="none"; } } if($F("journeyTravelMethod")=="CUSTOM"){ $("advancedAddExpOptions").style.display="block"; $("addExpAdvOptLnk2").style.display="inline"; $("addExpAdvOptLnk").style.display="none"; $("addExpMapMsg1").style.display="block"; $("addExpMapMsg2").style.display="none"; }else{ if($F("journeyTravelMethod")=="START"){ $("advancedAddExpOptions").style.display="none"; $("addExpAdvOptLnk2").style.display="none"; $("addExpAdvOptLnk").style.display="none"; $("addExpMapMsg1").style.display="none"; $("addExpMapMsg2").style.display="block"; }else{ if($F("journeyTravelMethod")=="NONE"){ $("journeyLineThickness").selectedIndex=4; $("journeyColorSample").style.backgroundColor="#00F"; $("advancedAddExpOptions").style.display="none"; $("addExpAdvOptLnk2").style.display="none"; $("addExpAdvOptLnk").style.display="inline"; $("addExpMapMsg1").style.display="block"; $("addExpMapMsg2").style.display="none"; }else{ if(this.transTypes[$F("journeyTravelMethod")]){ var t=$F("journeyTravelMethod"); $("advancedAddExpOptions").style.display="none"; $("addExpAdvOptLnk2").style.display="none"; $("addExpAdvOptLnk").style.display="inline"; $("addExpMapMsg1").style.display="block"; $("addExpMapMsg2").style.display="none"; $("textLabelOptions").style.display="none"; $("imageLabelOptions").style.display="block"; $("journeyLabelType").selectedIndex=1; $("journeyTextLabel").value=""; $("journeyImageURL").value=this.transTypes[t].url; $("journeyImageWidth").value=this.transTypes[t].width; $("journeyImageHeight").value=this.transTypes[t].height; $("journeyLineThickness").selectedIndex=this.transTypes[t].lineT-1; $("journeyColorSample").style.backgroundColor=this.transTypes[t].lineC; } } } } if($F("journeyLabelType")=="none"){ $("textLabelOptions").style.display="none"; $("imageLabelOptions").style.display="none"; }else{ if($F("journeyLabelType")=="image"){ $("textLabelOptions").style.display="none"; $("imageLabelOptions").style.display="block"; }else{ if($F("journeyLabelType")=="text"){ $("textLabelOptions").style.display="block"; $("imageLabelOptions").style.display="none"; } } } this.drawSampleLineFromForm(); },onJourneyChange:function(){ this.redrawJourneyForm(); return; },onTravMethodChange:function(){ this.redrawJourneyForm(); },drawSampleLineFromForm:function(){ this.travSampleMap.checkResize(); this.travSampleMap.setCenter(new GLatLng(51,0),7,G_SATELLITE_MAP); if(this.sampleLine){ this.travSampleMap.removeOverlay(this.sampleLine); } if(this.sampleBlogIcon1){ this.travSampleMap.removeOverlay(this.sampleBlogIcon1); } if(this.sampleBlogIcon2){ this.travSampleMap.removeOverlay(this.sampleBlogIcon2); } if($F("journeyTravelMethod")=="START"){ this.sampleBlogIcon1=gjutils.makeBlogIcon(new GLatLng(51,0),"1"); this.travSampleMap.addOverlay(this.sampleBlogIcon1); return; } var p1=new GLatLng(51,-1); var p2=new GLatLng(51,1); if($F("journeyLabelType")=="none"||$F("journeyTravelMethod")=="NONE"){ this.sampleLine=new GPolyline([p1,p2],$("journeyColorSample").style.backgroundColor,parseInt($F("journeyLineThickness")),0.8); }else{ if($F("journeyLabelType")=="image"){ this.sampleLine=new GJLabeledLine([p1,p2],$("journeyColorSample").style.backgroundColor,parseInt($F("journeyLineThickness")),0.8,"",$F("journeyImageURL"),{width:parseInt($F("journeyImageWidth")),height:parseInt($F("journeyImageHeight"))}); }else{ if($F("journeyLabelType")=="text"){ this.sampleLine=new GJLabeledLine([p1,p2],$("journeyColorSample").style.backgroundColor,parseInt($F("journeyLineThickness")),0.8,$F("journeyTextLabel")); } } } this.sampleBlogIcon1=gjutils.makeBlogIcon(p1,"1"); this.sampleBlogIcon2=gjutils.makeBlogIcon(p2,"2"); this.travSampleMap.addOverlay(this.sampleLine); this.travSampleMap.addOverlay(this.sampleBlogIcon1); this.travSampleMap.addOverlay(this.sampleBlogIcon2); },processNewJourney:function(_6e,id){ gjutils.optionCreateAndSelect($("journeyId"),id,_6e); $("journeyTravelMethod").selectedIndex=1; this.redrawJourneyForm(); },startImageUpload:function(){ gjapp.loadPanel("/static/startImageUpload.html"+(this.editMode?("?editId="+this.editId):"")); },onCustomMapChange:function(){ if($F("customMap")=="CREATE"){ gjapp.prompt("Enter a name for your new map. Letters, numbers and spaces only please.",this._customMapCreate.bind(this),function(){ $("customMap").selectedIndex=0; }.bind(this),50,""); } },_customMapCreate:function(_70){ if(!_70){ $("customMap").selectedIndex=0; return; } if(!/^[a-zA-Z0-9\s]+$/.test(_70)){ $("customMap").selectedIndex=0; alert("Your map name contains some illegal characters.\nPlease only enter letters, numbers or spaces."); return; } if(!/[a-zA-Z0-9]+/.test(_70)){ $("customMap").selectedIndex=0; alert("Your map name must contain at least one letter or number character."); return; } if(_70.length>99){ $("customMap").selectedIndex=0; alert("The longest map name allowed is 99 characters."); return; } gjapp.drawAjaxProgressMsg("Creating a new custom map..."); new Ajax.Request("/e/makeNewCustomMap",{method:"post",parameters:$H({title:_70}).toQueryString(),onComplete:function(req,_72){ gjapp.stopAjaxProgressMsg(); if(_72.ok){ gjutils.optionCreateAndSelect($("customMap"),_72.id,_72.title); }else{ if(_72.err){ alert(_72.err); }else{ alert("We encountered an error trying to create your custom map. Please try again in a few minutes."); } } }.bind(this),onException:function(r,e){ gjapp.stopAjaxProgressMsg(); alert("We encountered an error trying to create your custom map ("+e+").\nPlease try again in a few minutes."); }.bind(this)}); },deleteExp:function(){ new Ajax.Request("/view/GJViewAddExp",{method:"post",parameters:$H({id:this.editId,mode:"deleteExp"}).toQueryString(),onComplete:function(req,_76){ if(_76.ok){ gjapp.viewPort.setView(new GJViewExpList({filter:"mostRecent"}),true); return; }else{ if(_76.err){ alert(_76.err); }else{ alert("We encountered an error deleting your entry. Please try again in a few minutes."); } } $("deleteExpButton").disabled=false; return; }.bind(this)}); }}); 
var GJViewExperience=Class.create(); Object.extend(GJViewExperience.prototype,GJViewParent.prototype); Object.extend(GJViewExperience.prototype,{redraw:function(_1,_2){ if(_2){ this.loggedInState=gjapp.loggedIn; gjapp.viewPort.hideBelowMap(); this.pageContainer.loadPage("/view/GJViewExperience",this.mergeJSON(_1,{id:this.params.id,havePrevView:gjapp.viewPort.havePreviousView()?1:0})); } if(this.loggedInState!=gjapp.loggedIn){ this.loggedInState=gjapp.loggedIn; this.pageContainer.loadPage("/view/GJViewExperience",this.mergeJSON(_1,{id:this.params.id,havePrevView:gjapp.viewPort.havePreviousView()?1:0})); } },fetchIMsOnRedraw:function(){ return true; },setupMap:function(_3,_4,_5){ this.mapMoveListener=GEvent.addListener(this.gjmap.map,"moveend",function(){ gjapp.viewPort.logHistory(); }.bind(this)); this.gjmap.map.setCenter(_3,_4,_5); },getClassName:function(){ return "GJViewExperience"; },canRestore:function(){ return true; },getRestoreParams:function(){ return {id:this.params.id}; },unloadOK:function(_6){ GEvent.removeListener(this.mapMoveListener); this.gjmap.map.removeOverlay(this.expMarker); if(this.allOverlays&&this.allOverlays.each){ this.allOverlays.each(function(_7){ this.gjmap.map.removeOverlay(_7); }.bind(this)); } this.expMarker=null; return true; },finishVote:function(_8,_9){ this.redrawExpIcon(_8); },redrawExpIcon:function(_a){ this.gjmap.map.removeOverlay(this.expMarker); this.drawExpIcon(this.expIconLat,this.expIconLon,_a); },drawExpIcon:function(_b,_c,_d){ this.expIconLat=_b; this.expIconLon=_c; this.expMarker=this.makeVoteMapIcon(new GLatLng(parseFloat(_b),parseFloat(_c)),"Red",_d); this.gjmap.map.addOverlay(this.expMarker); },drawOverlays:function(_e){ if(_e){ this.allOverlays=gjutils.drawBlogEntryOverlays(this.gjmap.map,_e); } }}); 
var GJViewPort=Class.create(); GJViewPort.prototype={initialize:function(_1){ this.pageContainer=new PageContainer("panel"); this.gjmap=_1; this._initHistory(); this.previousEncodedView=false; },unload:function(){ if(this.view&&this.view.unload){ this.view.unload(); } this.view=null; this.pageContainer=null; this.gjmap=null; },openBelowMap:function(){ if($("belowMap").style.height!="100px"){ $("belowMap").style.height="100px"; $("map").style.height=(parseInt($("map").style.height)-78)+"px"; gjapp.gjmap.map.checkResize(); $("belowMap").scrollTop=0; } this.v_belowMapOpen=true; },closeBelowMap:function(){ if($("belowMap").style.height!="22px"){ $("belowMap").style.height="22px"; $("map").style.height=(parseInt($("map").style.height)+78)+"px"; gjapp.gjmap.map.checkResize(); $("belowMap").scrollTop=0; } this.v_belowMapOpen=false; },hideBelowMap:function(){ $("belowMapContainer").style.display="none"; this.handleResizeScreen(); },unhideBelowMap:function(){ $("belowMapContainer").style.display="block"; this.handleResizeScreen(); },getLoadingHTML:function(){ return "<div style=\"width: 32px; height: 32px; position: relative; left: 20px; top: 20px;\"><img src=\"/images/loading2.gif\" width=\"32\" height=\"32\" border=\"0\" /></div>"; },handleResizeScreen:function(){ $("map").style.height="10px"; $("panel").style.height="10px"; var _2=Position.cumulativeOffset($("map")); var _3=_2[1]; var _4=Position.cumulativeOffset($("belowEverythingDiv")); var _5=_4[1]; var _6=_5-(_3+10); var _7=gjutils.getWindowSize(); var _8=_7[1]; var _9=_8-(_3+_6); $("panel").style.height="200px"; var _a=Position.cumulativeOffset($("panel")); var _b=_a[1]; _4=Position.cumulativeOffset($("belowEverythingDiv")); _5=_4[1]; var _c=_5-(_b+200); var _d=_8-(_b+_c); $("map").style.height=_9+"px"; $("panel").style.height=_d+"px"; this.gjmap.map.checkResize(); },redraw:function(){ if(this.view&&this.view.redraw){ this.view.redraw(this.makeViewState()); if(this.view.fetchIMsOnRedraw()){ gjapp.fetchIMs(); } } },havePreviousView:function(){ return this.previousEncodedView?true:false; },restorePreviousView:function(){ if(this.previousEncodedView){ this.restoreEncodedView(this.previousEncodedView); this.previousEncodedView=false; } },setView:function(_e,_f){ _e.GJView||alert("This is not a GJView object"); if(this.view&&this.view.canRestore()){ this.previousEncodedView=this.makeEncodedView(); } if(this.view&&this.view.unloadOK&&(!this.view.unloadOK(_f))){ return false; }else{ if(this.view&&this.view.unload){ this.view.unload(); } this.gjmap.map.closeInfoWindow(); this.view=_e; this.view.viewPortInit(this.makeViewState(),this.pageContainer,this.gjmap); if(this.view.fetchIMsOnRedraw()){ gjapp.fetchIMs(); } return true; } },getView:function(){ return this.view; },makeViewState:function(){ var _10={v_bounds:this.gjmap.getCommaBounds(),v_zoomLevel:this.gjmap.map.getZoom(),v_mapType:this.gjmap.map.getCurrentMapType().getName(),v_belowMapOpen:this._belowMapOpen?1:0}; return _10; },_initHistory:function(){ if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){ return; } unFocus.History.addEventListener("historyChange",this._historyChange.bind(this)); this.historyLoggingEnabled=true; },logHistory:function(){ if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){ return; } if(this.historyLoggingEnabled&&this.getView().canRestore()){ var _11=this.makeEncodedView(); if(this.lastHistoryParams!=_11){ unFocus.History.addHistory(_11); this.lastHistoryParams=_11; } } },makeEncodedView:function(){ if(this.getView().canRestore()){ var _12=this.getView().getRestoreParams(); _12.__cn=this.getView().getClassName(); var _13=this.gjmap.map.getCenter(); _12.__mclt=_13.lat(); _12.__mcln=_13.lng(); _12.__mzl=this.gjmap.map.getZoom(); _12.__mt=this.gjmap.map.getCurrentMapType().getName(true); var enc=encode64(Dumper(_12)); return "--"+enc; }else{ return false; } },restoreEncodedView:function(_15){ _15=_15.replace("--",""); var dec=decode64(_15); var _17; try{ _17=eval("("+dec+")"); } catch(e){ return; } if(!_17.__mt){ return; } var _18={}; for(var key in _17){ if(!/^__/.test(key)){ _18[key]=_17[key]; } } var _1a; try{ _1a=eval("("+_17.__cn+")"); } catch(e){ return; } try{ this.setView(new _1a(_18),true); } catch(e){ return; } var _1b=GJ_MAPTYPES[_17.__mt]; this.gjmap.map.setCenter(new GLatLng(parseFloat(_17.__mclt),parseFloat(_17.__mcln)),_17.__mzl,_1b); },_historyChange:function(_1c){ if(this.view&&this.view.canRestore()&&_1c==this.makeEncodedView()){ return; } this.historyLoggingEnabled=false; if(_1c.indexOf("--")==0){ this.restoreEncodedView(_1c); }else{ if(/^\d+$/.test(_1c)){ this.setView(new GJViewExperience({id:_1c})); }else{ if(/^add=.+,.+,.+,.+$/.test(_1c)&&gjapp.loggedIn){ var str=_1c.replace(/^add=/,""); var arr=str.split(","); var _1f=G_HYBRID_MAP; if(arr[3]=="Map"){ _1f=G_NORMAL_MAP; }else{ if(arr[3]=="Satellite"){ _1f=G_SATELLITE_MAP; } } gjapp.gjmap.map.setCenter(new GLatLng(parseFloat(arr[0]),parseFloat(arr[1])),parseInt(arr[2]),_1f); gjapp.startAddExperience(); }else{ if(/^edit=\d+$/.test(_1c)){ this.setView(new GJViewAddExp({edit:_1c.replace(/^edit=/,"")})); }else{ if(_1c&&(!/=/.test(_1c))){ this.setView(new GJViewExpList({userid:_1c,filter:"mostRecent"})); }else{ this.setDefaultView(true); } } } } } this.historyLoggingEnabled=true; return; },setViewByClassName:function(_20,_21,_22){ var _23=eval("("+_20+")"); this.setView(new _23(_21),_22); },setDefaultView:function(_24){ this.gjmap.smartSetCenter(new GLatLng(0,0),1,G_HYBRID_MAP); this.setView(new GJViewExpList({filter:"mostPopular"}),_24); },setupInitialView:function(){ if(fakeAnchor){ this._historyChange(fakeAnchor); fakeAnchor=false; }else{ if(location.hash&&location.hash.substring(1)){ this._historyChange(location.hash.substring(1)); }else{ this.setDefaultView(); } } }}; 
var GlobalApp=Class.create(); GlobalApp.prototype={initialize:function(){ this.currentPanel=false; this.votesTmpl=new Template("<div id=\"votesSubEl#{rank}\" class=\"vts\">"+"<div style=\"padding-top: 2px; padding-bottom: 0px; margin-bottom: 0px; border: 0px solid #000;\">#{votes}</div>"+"<div style=\"margin-top: -4px; border: 0px solid #000; font-size: 10px; color: #333; font-family: Arial; padding: 0px;\">votes</div>"+"</div>"); for(var k in this){ if(/^initialize_.+/.test(k)){ this[k].apply(this,arguments); } } },loadPanel:function(_2,_3,_4){ if(this.currentPanel&&this.currentPanel.closePanel){ this.currentPanel.closePanel(); this.currentPanel=false; } this.currentPanel=new glassPanel({panelImage:"/images/glassPanelBigger.png",panelImageWidth:605,panelImageHeight:402,panelIcon:"/images/assets/glassPanelCloseIcon.png",panelIconWidth:42,panelIconHeight:40,panelContent:new contentLoader(_2,_3,true,(_4?_4:false))}); },prompt:function(_5,_6,_7,_8,_9){ this.__finishPrompt=function(_a){ this.closePanel(); _6(_a); }.bind(this); this.__cancelPrompt=function(){ if(_7){ _7(); } }.bind(this); this.loadSPanel("/static/prompt.html",{msg:_5,maxInputLength:_8?_8:"",defaultValue:_9?_9:""}); },loadSPanel:function(_b,_c){ if(this.currentPanel&&this.currentPanel.closePanel){ this.currentPanel.closePanel(); this.currentPanel=false; } this.currentPanel=new glassPanel({panelImage:"/images/glassPanelSmaller.png",panelImageWidth:481,panelImageHeight:220,panelIconRight:10,panelIconTop:10,panelIcon:"/images/assets/glassPanelCloseIcon.png",panelIconWidth:42,panelIconHeight:40,panelContent:new contentLoader(_b,_c,true)}); },closePanel:function(){ if(this.currentPanel&&this.currentPanel.closePanel){ this.currentPanel.closePanel(); this.currentPanel=false; } },loadBPanel:function(_d,_e){ if(this.currentPanel&&this.currentPanel.closePanel){ this.currentPanel.closePanel(); this.currentPanel=false; } this.currentPanel=new glassPanel({panelImage:"/images/glassPanelBiggest.png",panelImageWidth:605,panelImageHeight:502,panelIcon:"/images/assets/glassPanelCloseIcon.png",panelIconWidth:42,panelIconHeight:40,panelContent:new contentLoader(_d,_e,true)}); }}; 
var BlogEntryParent=Class.create(); BlogEntryParent.prototype={initialize_BlogEntryParent:function(){ $A(["finishVote","getContentScrollDiv"]).each(function(_1){ this[_1]||alert(_1+" must be implemented!"); }.bind(this)); },startVote:function(id,_3){ _3=(_3||_3==="0")?_3:""; if(GJ_ANON_VOTING){ this.registerVote(id,_3); return; } if(!this.loggedIn){ this.loadSPanel("/static/loginToVote.html"); return; } if(this.dontShowVoteConfirm){ this.registerVote(id,_3); return; }else{ new Ajax.Request("/e/registerVote",{method:"post",parameters:$H({mode:"startVote"}).toQueryString(),onComplete:function(_4,_5){ if(_5.dontShowVoteConfirm){ this.dontShowVoteConfirm=true; this.registerVote(id,_3); }else{ this.currentPanel=new glassPanel({panelImage:"/images/smallPanel.png",panelImageWidth:436,panelImageHeight:336,panelIcon:"/images/assets/glassPanelCloseIcon.png",panelIconWidth:42,panelIconHeight:40,onionSkinOpacity:0.3,onionSkinColor:"#999",panelContent:new contentLoader("/static/confirmVote.html",{id:id,rank:_3},true)}); } }.bind(this)}); } },registerVote:function(id,_7){ _7=(_7||_7==="0")?_7:""; this.closePanel(); new Ajax.Request("/e/registerVote",{method:"post",parameters:$H({id:id}).toQueryString(),onComplete:function(_8,_9){ if(_9.errMsg){ alert("Error: "+_9.errMsg); }else{ if(_9.votes){ if(GJ_EFFECTS_ON){ new Effect.Fade("voteImgEl"+_7,{duration:0.5,afterFinish:function(){ $("voteImgEl"+_7).innerHTML="<img src=\"/images/vThanks2.gif\" width=\"60\" height=\"27\" border=\"0\" alt=\"\" />"; new Effect.Appear("voteImgEl"+_7,{duration:0.5}); }.bind(this)}); new Effect.Fade("votesSubEl"+_7,{duration:0.5,afterFinish:function(){ if(_9.votes>0){ $("votesEl"+_7).innerHTML=this.votesTmpl.evaluate({rank:_7,votes:_9.votes}); }else{ $("votesEl"+_7).innerHTML=this.votesTmpl.evaluate({rank:_7}); } new Effect.Appear("votesSubEl"+_7,{duration:0.5,afterFinish:function(){ gjapp.finishVote(_9.votes,_7); }.bind(this)}); }.bind(this)}); }else{ Element.remove("votesSubEl"+_7); if(_9.votes>0){ try{ $("votesEl"+_7).innerHTML=this.votesTmpl.evaluate({rank:_7,votes:_9.votes}); } catch(e){ alert(e); } }else{ $("votesEl"+_7).innerHTML=this.votesTmpl.evaluate({rank:_7}); } } }else{ alert("We had a problem registering your vote."); } } }.bind(this)}); },emailExperience:function(_a){ this.loadPanel("/e/emailExp",{id:_a}); return; },finishEmailExp:function(_b,_c,_d){ if(_b.length<2){ alert("Please enter your full name."); return; } $("emailExpLoadingGif").style.display="block"; new Ajax.Request("/e/emailExp",{method:"post",parameters:$H({name:_b,email:_c,expId:_d}).toQueryString(),onComplete:function(_e,_f){ if(_f.errMsg){ $("emailExpLoadingGif").style.display="none"; alert(_f.errMsg); }else{ this.loadSPanel("/static/emailBlogEntryThanks.html"); } }.bind(this)}); },handleExpFlag:function(_10,id){ new Ajax.Request("/e/flag",{method:"post",parameters:$H({id:id,fl:_10}).toQueryString(),onComplete:function(req,_13){ if(typeof (_13)=="object"&&_13.done){ Element.addClassName($("parentExpDiv"),"flagged"); } }.bind(this)}); },processComment:function(){ new Ajax.Request("/e/addComment",{method:"post",evalScripts:true,parameters:Form.serialize("commentForm"),onComplete:this._completeComment.bind(this)}); },_completeComment:function(req,_15){ if(_15.err){ $("commentError").innerHTML=_15.err; }else{ if(_15.commentHTML){ try{ if($("noCommentsYet")){ Element.remove($("noCommentsYet")); } $("commentDiv").style.display="none"; $("commentClicker").style.display="inline"; $("commentError").innerHTML=""; $("commentBody").value=""; new Insertion.Top($("newComments"),_15.commentHTML); gjutils.scrollToElement(gjapp.getContentScrollDiv(),"commentsHeading"); new Effect.Appear("comment"+_15.commentId,{duration:1.5}); } catch(e){ alert(e); } }else{ alert("Could not add your comment server response not understood."); } } },displayPhoto:function(_16,_17,_18){ this.currentDisplayPhoto=new photoBox(_16,_17,_18); },closeDisplayPhoto:function(){ if(this.currentDisplayPhoto){ this.currentDisplayPhoto.closePanel(); } }}; 
var GJ_VERSION=72; var GJ_MIN_TIME_BETWEEN_ADS=30000; var GJ_OFFLINE_TIMEOUT=15000; var GJ_DEFAULT_MAP=G_HYBRID_MAP; var GJ_MARKER_ZOOM_LEVEL=13; var GJ_DEF_PERPAGE=20; var GJ_BASE_PANE=10000; var GJ_MID_PANE=30000; var GJ_ONION_PANE=50000; var GJ_TOP_PANE=100000; var GJ_IMLOOP_ENABLED=false; var GJ_ANON_VOTING=true; var GJ_EFFECTS_ON=true; var GJ_MAPTYPES={Map:G_NORMAL_MAP,Sat:G_SATELLITE_MAP,Hyb:G_HYBRID_MAP,Ter:G_PHYSICAL_MAP}; var GJUNID=1; var GJ_DEBUG=true; var GJ_GS={}; var gjappClass=Class.create(); Object.extend(gjappClass.prototype,GlobalApp.prototype); Object.extend(gjappClass.prototype,BlogEntryParent.prototype); Object.extend(gjappClass.prototype,{initialize_gjappClass:function(){ this._validFilters={"mostPopular":"Most Popular","mostRecent":"Newest","topUsers":"Top Users","topTrekkers":"Top Trekkers","mostDiscussed":"Most Discussed","usersExperiences":"Update Me!!"}; this.lastAdUpdate=false; this._anotherWindowMsgDisplayed=false; this._pingCheckInProgress=false; this._pingTracker=[]; this._pingCounter=0; this._upgradeMsgDisplayed=false; this._offlineNotified=false; this.lastBodyHeight=0; this.lastBodyWidth=0; this.topCorpMenu="<a href=\"#\" class=\"corpMenu\" onclick=\"gjapp.loadPanel('/static/about.html', {}); gjTracker('/click/aboutGeojoey'); return false;\">About</a><br /><a href=\"#\" onclick=\"gjapp.loadPanel('/static/termsbox.html'); gjTracker('/click/terms'); return false;\" class=\"corpMenu\">Terms</a><br /><a href=\"#\" onclick=\"gjapp.loadPanel('/e/feedback'); gjTracker('/click/feedback'); return false;\" class=\"corpMenu\">Feedback</a><br /><a href=\"#\" onclick=\"gjapp.loadPanel('/static/faq.html', {}); gjTracker('/click/faq'); return false;\" class=\"corpMenu\">Faq</a>"; var _1=new Template("<span class=\"lTitle\">#{fn}</span><br /><div class=\"lDiv\" style=\"margin-left: 10px;\"><img src=\"/images/flags/#{cc}.png\" border=\"0\" />&nbsp;#{cn}<br /><span class=\"lFT\">#{ft}</span></div>"); var _2=function(_3){ $("fq").value=_3.fn.unescapeHTML(); this.gjmap.modMap({mapType:GJ_DEFAULT_MAP,lat:_3.lat,lon:_3.lon,zoomLevel:GJ_MARKER_ZOOM_LEVEL}); }.bind(this); var _4=function(_5){ if(this.gjmap.map.getZoom()>GJ_MARKER_ZOOM_LEVEL){ this.gjmap.map.setZoom(GJ_MARKER_ZOOM_LEVEL); } if(!this.tmpSuggestMoveEnd){ this.tmpSuggestMoveEnd=GEvent.addListener(this.gjmap.map,"moveend",function(){ $("fq").focus(); GEvent.removeListener(this.tmpSuggestMoveEnd); this.tmpSuggestMoveEnd=false; }.bind(this)); } this.gjmap.openInfoWindow(new GLatLng(parseFloat(_5.lat),parseFloat(_5.lon)),"<img src=\"/images/flags/"+_5.cc+".png\" border=\"0\" alt=\"\" align=\"absmiddle\" />&nbsp;<b class=\"fb\">"+_5.fnb+", "+_5.cn+"</b><br /><span class=\"fbsmall\">You can <a href=\"#\" onclick=\"gjapp.gjmap.map.zoomIn(); return false;\">Zoom In</a> or <a href=\"#\" onclick=\"gjapp.gjmap.map.zoomOut(); return false;\">Zoom Out</a>. Click and drag the map to move around.</span>",{maxWidth:230}); }.bind(this); this.suggest=new Suggest({inputElem:"fq",baseURL:"/pSrch",template:_1,selectedClass:"sel",unselectedClass:"nosel",zIndex:GJ_MID_PANE,otherElems:["c"],otherValues:{bnds:function(){ return this.gjmap.getCommaBounds(); }.bind(this)},onListOver:_4,onListClick:_2,onLoseFocus:function(){ if(this.tmpSuggestMoveEnd){ GEvent.removeListener(this.tmpSuggestMoveEnd); this.tmpSuggestMoveEnd=false; } this.viewPort.redraw(); }.bind(this)}); this.mode=false; this.photoChangeInProgress=false; this.redrawPanelEnabled=true; this.IMCounter=1; this.IMQueue=new Array(); this.IMQueueBusy=false; this.IMLastFetch=0; this.lastUserActivity=(new Date()).getTime(); this.IMFastFetchRate=5000; this.IMRateSwitchTime=59; this.IMSlowFetchRate=59000; this.IMCurrentFetchRate=this.IMFastFetchRate; this.lastPageURL=""; this.lastPageParams=""; Ajax.Responders.register({onCreate:function(r){ if(!r.options.dontLogUserActivity){ this.lastUserActivity=(new Date()).getTime(); if(this._IMSwitchFast()){ clearTimeout(this.FetchIMTimeout); this.FetchIMTimeout=false; this._IMSetTimeout(); } } }.bind(this),onException:this._handleAjaxException.bind(this),onComplete:this._handleAjaxCompletion.bind(this)}); },onload:function(){ if(!GBrowserIsCompatible()){ return; } this.select_current=0; this.gjmap=new gjmapClass({mapElem:"map",panelElem:"panel",belowMapElem:"belowMap"}); this.viewPort=new GJViewPort(this.gjmap); this.handleWindowResize(); $("moreMenuElem").onclick=this.showMoreMenu.bindAsEventListener(this); window.onresize=this.handleWindowResize.bind(this); GEvent.addListener(this.gjmap.map,"moveend",function(){ this.viewPort.redraw(); this.updateGoogleAds(); }.bind(this)); Event.observe($("c"),"change",function(_7){ this.gjmap.closeInfoWindow(); this.gjmap.centerCountry($F("c")); this.select_current=$("c").selectedIndex; $("fq").focus(); var _8=GEvent.addListener(this.gjmap.map,"moveend",function(){ $("fq").focus(); }); setTimeout(function(){ GEvent.removeListener(_8); },5000); }.bind(this),false); this.lastBodyHeight=$("mainBody").offsetHeight; this.lastBodyWidth=$("mainBody").offsetWidth; this._loadUserData(this.finalLoadPhase.bind(this)); },finalLoadPhase:function(){ this.viewPort.setupInitialView(); },updateGoogleAds:function(){ if(this.lastAdUpdate&&(new Date()).getTime()-this.lastAdUpdate<GJ_MIN_TIME_BETWEEN_ADS){ return; } this.lastAdUpdate=(new Date()).getTime(); },_handleAjaxException:function(r,e){ e=e.toString(); if(GJ_DEBUG&&e.indexOf("NS_ERROR_NOT_AVAILABLE")==-1){ GLog.write("Application error in AJAX request: "+e); } },_handleAjaxCompletion:function(_b,_c,_d){ if(_d&&typeof (_d)=="object"&&_d.gjv){ if(GJ_VERSION!=_d.gjv&&(!this._upgradeMsgDisplayed)){ this._upgradeMsgDisplayed=true; alert("Geojoey has been upgraded. Click OK to load the new version.\n\nIf you keep seeing this message you may have to clear your browsers cache."); window.location="/"; }else{ } } if(_d&&typeof (_d)=="object"&&(_d.gjlg=="0"||_d.gjlg=="1")){ if(!this.verifyUserState(_d.gjlg)){ return; } } },verifyUserState:function(_e){ if(_e=="0"&&this.loggedIn&&(!this._anotherWindowMsgDisplayed)){ this._anotherWindowMsgDisplayed=true; alert("You logged out in another window. Click OK to reload Geojoey."); window.location="/"; return false; }else{ if(_e=="1"&&(!this.loggedIn)&&(!this._anotherWindowMsgDisplayed)){ this._anotherWindowMsgDisplayed=true; alert("You have logged into another window. Click OK to reload Geojoey."); window.location="/"; return false; } } return true; },unload:function(){ this.viewPort.unload(); this.gjmap.unload(); this.gjmap=null; this.suggest=null; this.viewPort=null; GUnload(); window.onresize=null; window.onload=null; window.onunload=null; },logNoShow:function(_f,_10){ if($F(_10)){ new Ajax.Request("/e/logNoShow",{method:"post",parameters:$H({msgName:_f}).toQueryString()}); } },finishShowUserList:function(){ this.gjmap.centerWorld(); this.gjmap.clearIcons(); },finishProfilePhoto:function(id,f,_13,_14){ $("photoId").value=id; $("photoLoadingImg").style.display="none"; $("photoFormDiv").style.display="none"; $("photoResultDiv").innerHTML="<div style=\"width: "+(_13+20)+"px; height: "+_14+"px; border: 0px solid #000;\"><img src=\""+f+"\" width=\""+_13+"\" height=\""+_14+"\" alt=\"0\" style=\"vertical-align: top; border: 1px solid #666;\" />&nbsp;<a style=\"vertical-align: top; font-family: Arial; font-size: 14px; font-weight: bold; padding: 0px; margin: 0px; color: #000;\" href=\"#\" onclick=\"gjapp.cancelProfilePhoto(); return false;\">X</a></div>"; $("photoResultDiv").style.display="block"; },do500:function(){ alert("internal server error."); },cancelProfilePhoto:function(){ $("photoResultDiv").style.display="none"; $("photoLoadingImg").style.display="none"; $("photoId").value=""; $("photoFormDiv").innerHTML="<br /><form action=\"/e/profile\" method=\"POST\" enctype=\"multipart/form-data\" target=\"photoup\" id=\"pform3\"><input type=\"hidden\" name=\"mode\" value=\"photo\" /><input type=\"file\" size=\"20\" name=\"userphoto\" id=\"userphoto\" onchange=\"$('pform3').submit(); $('photoFormDiv').style.display = 'none'; $('photoLoadingImg').style.display = 'block';\" /></form>"; $("photoFormDiv").style.display="block"; },finishUsrPhoto:function(f,_16,_17){ $("photoLoadingImg").style.display="none"; $("photoFormDiv").style.display="none"; $("photoResultDiv").innerHTML="<div style=\"width: "+(_16+20)+"px; height: "+_17+"px; border: 0px solid #000;\"><img src=\""+f+"\" width=\""+_16+"\" height=\""+_17+"\" alt=\"0\" style=\"vertical-align: top; border: 1px solid #666;\" />&nbsp;<a style=\"vertical-align: top; font-family: Arial; font-size: 14px; font-weight: bold; padding: 0px; margin: 0px; color: #000;\" href=\"#\" onclick=\"gjapp.cancelUsrPhoto(); return false;\">X</a></div>"; $("photoResultDiv").style.display="block"; },cancelUsrPhoto:function(_18){ $("photoResultDiv").style.display="none"; $("photoLoadingImg").style.display="block"; $("photoFormDiv").innerHTML=""; $("photoFormDiv").innerHTML="<br /><form action=\"/e/userPhoto\" method=\"POST\" enctype=\"multipart/form-data\" target=\"photoup\" id=\"pform3\"><input type=\"file\" size=\"20\" name=\"userphoto\" id=\"userphoto\" onchange=\"$('pform3').submit(); $('photoFormDiv').style.display = 'none'; $('photoLoadingImg').style.display = 'block';\" /></form>"; if(_18){ $("photoLoadingImg").style.display="none"; $("photoFormDiv").style.display="block"; }else{ new Ajax.Request("/e/userPhoto",{method:"post",evalScripts:true,parameters:$H({deleteAll:1}).toQueryString(),onComplete:function(req,_1a){ $("photoLoadingImg").style.display="none"; $("photoFormDiv").style.display="block"; }.bind(this)}); } },_startFlagExp:function(_1b,_1c){ $(_1c).innerHTML+="<div>blah</div>"; },showExperience:function(id){ this.viewPort.setView(new GJViewExperience({id:id})); },_preloadImg:function(s){ var img=document.createElement("img"); img.src=s; img.alt=""; document.body.getElementsByTagName("div")["invisible"].appendChild(img); return; },handleWindowResize:function(){ var dim=$("mainBodyDiv").getDimensions(); if((Math.abs(this.lastBodyHeight-dim.height)>1)||(Math.abs(this.lastBodyWidth-dim.width)>1)){ this.lastBodyHeight=dim.height; this.lastBodyWidth=dim.width; this.suggest.redrawList(); this.viewPort.handleResizeScreen(); }else{ } },addressSearch:function(){ if(!$F("addrTxt")){ return; } if(/^(AS|AT|AU|BE|CH|CZ|DK|FI|GB|GU|HR|HU|IN|IS|LI|LK|LU|MC|MH|MP|NL|NO|NZ|PK|PL|PR|PT|SE|SI|SK|TH|TR|VI|ZA)$/.test($F("addrCntry"))){ $("SearchLoading2").style.display="block"; new Ajax.Request("/e/goPostal",{method:"post",parameters:$H({p:$F("addrTxt"),c:$F("addrCntry")}).toQueryString(),onComplete:function(req){ var _22; try{ _22=eval("("+req.responseText+")"); } catch(e){ _22={}; } if(_22.pn){ this.gjmap.zoomTo(_22.lat,_22.lon,GJ_MARKER_ZOOM_LEVEL,GJ_DEFAULT_MAP); this.gjmap.openInfoWindow(new GLatLng(parseFloat(_22.lat),parseFloat(_22.lon)),"<b class=\"fb\">"+_22.pn+", "+_22.pc+"</b><br /><span class=\"fbsmall\">You can <a href=\"#\" onclick=\"gjapp.gjmap.map.zoomIn(); return false;\">Zoom In</a> or <a href=\"#\" onclick=\"gjapp.gjmap.map.zoomOut(); return false;\">Zoom Out</a>. Click and drag the map to move around.</span>",{maxWidth:230}); }else{ $("addrNotFound").style.color="#F00"; $("addrNotFound").innerHTML="Not&nbsp;Found"; setTimeout(function(){ $("addrNotFound").style.color=""; $("addrNotFound").innerHTML="Search"; },2000); } $("SearchLoading2").style.display="none"; }.bind(this)}); return; }else{ $("SearchLoading2").style.display="block"; var _23=new GClientGeocoder(); var _24=$F("addrCntry"); _23.getLocations($F("addrTxt")+", "+_24,function(_25){ if(!_25||_25.Status.code!=200){ $("addrNotFound").style.color="#F00"; $("addrNotFound").innerHTML="Not&nbsp;Found"; setTimeout(function(){ $("addrNotFound").style.color=""; $("addrNotFound").innerHTML="Search"; },2000); }else{ var _26=_25.Placemark[0]; var _27=$F("addrTxt"); this.gjmap.zoomTo(_26.Point.coordinates[1],_26.Point.coordinates[0],GJ_MARKER_ZOOM_LEVEL,GJ_DEFAULT_MAP); this.gjmap.openInfoWindow(new GLatLng(parseFloat(_26.Point.coordinates[1]),parseFloat(_26.Point.coordinates[0])),"<b class=\"fb\">"+_27+"</b><br /><span class=\"fbsmall\">You can <a href=\"#\" onclick=\"gjapp.gjmap.map.zoomIn(); return false;\">Zoom In</a> or <a href=\"#\" onclick=\"gjapp.gjmap.map.zoomOut(); return false;\">Zoom Out</a>. Click and drag the map to move around.</span>",{maxWidth:230}); } $("SearchLoading2").style.display="none"; }.bind(this)); } },showSearchHelp:function(evt){ var _29=Event.pointerX(evt)+10; var _2a=300; _29-=(_29+_2a>document.body.clientWidth)?(_29+_2a-document.body.clientWidth):0; var _2b=new Ajax.Updater("myDiv","/static/floatingRoundBox.html",{method:"post",evalScripts:true,parameters:$H({boxId:"searchHelp",boxWidth:"300",boxLeft:_29,boxTop:Event.pointerY(evt)+10,boxBackgroundColor:"3366CC",boxTextColor:"FFF",boxTemplate:"testText.html"}).toQueryString()}); },findSomeone:function(){ this.loadPanel("/e/findSomeone"); return; },startFindSomeone:function(q){ if(!/[a-zA-Z0-9]+/.test(q)){ return; } $("findSomeoneResults").innerHTML=this.viewPort.getLoadingHTML(); new Ajax.Updater($("findSomeoneResults"),"/e/findSomeone",{method:"post",evalScripts:true,parameters:$H({q:q}).toQueryString()}); },showGeoFriends:function(_2d,_2e){ this.onGeofriendsInsert=_2e?_2e:false; this.loadPanel("/e/geofriends",{inputElem:_2d?_2d:""}); return; },getFriendsIdx:function(){ var i=1; var idx=new Array(); while($("friendsListEl"+i)){ if($("friendsListEl"+i).checked){ idx.push(i-1); } i++; } return idx; },insertGeofriends:function(_31,_32,_33){ var _34=new Array(); for(var i=0;i<_32.length;i++){ _34.push(_33[_32[i]]); } var _36=function(){ $(_31).value+=", "+_34.join(", "); $(_31).value=$(_31).value.replace(/^[\s\,]+/,""); }; if(this.onGeofriendsInsert){ this.onGeofriendsInsert(_36); this.onGeofriendsInsert=false; }else{ _36(); } },emailExpShowGeofriends:function(_37){ var _38=$F("emailExpYourName"); var _39=$F("emailExpEmail"); var _3a=function(_3b){ this.loadPanel("/e/emailExp",{id:_37},function(){ $("emailExpYourName").value=_38; $("emailExpEmail").value=_39; _3b(); }.bind(this)); }.bind(this); this.showGeoFriends("emailExpEmail",_3a); },addFriend:function(_3c,_3d){ this.loadPanel("/e/geofriends",{add:_3c,inputElem:_3d?_3d:""}); },removeFriends:function(_3e){ if(!confirm("Are you sure you want to remove the selected friends?")){ return; } var i=1; var ids=new Array(); while($("friendsListEl"+i)){ ids.push($F("friendsListEl"+i)); i++; } this.loadPanel("/e/geofriends",{remove:ids.join(","),inputElem:_3e?_3e:""}); },inviteFriends:function(_41){ var i=1; var ids=new Array(); while($("friendsListEl"+i)){ ids.push($F("friendsListEl"+i)); i++; } this.loadPanel("/e/geofriends",{invite:ids.join(","),inputElem:_41?_41:""}); },friendsSelectAll:function(){ var i=1; while($("friendsListEl"+i)){ if($("friendSelectAll").checked){ $("friendsListEl"+i).checked=true; }else{ $("friendsListEl"+i).checked=false; } i++; } },displayVideo:function(_45){ this.currentDisplayVideo=new videoBox(_45); },closeDisplayVideo:function(){ if(this.currentDisplayVideo){ this.currentDisplayVideo.closePanel(); } },doRegister:function(){ var _46=Form.serialize($("registrationForm")); $("registerDiv").setStyle({display:"none"}); var _47=new loadingMessage("registerDiv","Processing",{fontSize:"20px",fontWeight:"bold",fontFamily:"Verdana, Arial",color:"#FFF",paddingLeft:"150px",paddingTop:"50px"}); var ajx=new Ajax.Updater(this.currentPanel.getContentElem(),"/e/register",{method:"post",evalScripts:true,onInteractive:function(){ _47.stop(); },parameters:_46}); gjTracker("/appEvent/finishRegister"); },doLogin:function(){ var _49=Form.serialize($("loginForm")); $(this.currentPanel.getContentElem()).innerHTML=""; var _4a=new loadingMessage(this.currentPanel.getContentElem(),"Processing",{fontSize:"20px",fontWeight:"bold",fontFamily:"Verdana, Arial",color:"#FFF",paddingLeft:"150px",paddingTop:"50px"}); var ajx=new Ajax.Updater(this.currentPanel.getContentElem(),"/e/login",{method:"post",evalScripts:true,onInteractive:function(){ _4a.stop(); },parameters:_49}); },_loadUserData:function(_4c){ new Ajax.Request("/e/login",{method:"post",evalScripts:false,onComplete:function(req,_4e){ if(_4e.logged_in){ this.completeLogin(_4e.userJson,_4c); }else{ this._completeLogout(_4c); } }.bind(this),parameters:"mode=firstLoad"}); },completeLogin:function(_4f,_50){ if(this.currentPanel){ this.currentPanel.closePanel(); } this._updateMainMenu(); this.loggedIn=true; this.userData=_4f; this._startIMLoop(); this.viewPort.redraw(); if(_50){ _50(); } gjTracker("/appEvent/Login/"); },logout:function(_51){ gjTracker("/appEvent/Logout/"); var ajx=new Ajax.Request("/e/logout",{method:"post",evalScripts:true,onComplete:function(req,_54){ if(_51){ window.location="/"; }else{ this._completeLogout(); } }.bind(this)}); },_completeLogout:function(_55){ this._stopIMLoop(); this._updateMainMenu(); $$(".IMWindow").each(function(_56){ Element.remove(_56); }); if(_55){ _55(); } },_startIMLoop:function(){ this.IMRunning=true; this.IMLastFetch=0; this.fetchIMs(); },_stopIMLoop:function(){ this.IMRunning=false; },fetchIMs:function(){ if(!this.IMRunning){ return; } if(this.currentIMRequest){ return; } this.FetchIMTimeout=false; this.currentIMRequest=new Ajax.Request("/fetchIMs",{method:"post",evalScripts:false,onComplete:this._completeFetchIMs.bind(this),onException:function(){ this._IMSetTimeout(); this.currentIMRequest=false; }.bind(this),dontLogUserActivity:true,parameters:$H({id:this.userData.encid,lf:this.IMLastFetch}).toQueryString()}); },turnOffIM:function(t){ new Ajax.Request("/e/turnOffIM",{method:"post",evalScripts:false,onComplete:function(){ },parameters:"type="+t}); },_completeFetchIMs:function(req,_59){ if(_59.IMs&&_59.IMs.length>0){ for(var i=0;i<_59.IMs.length;i++){ this.displayIM(_59.IMs[i]); } } this.IMLastFetch=_59.lf; var arr=_59.ftd.split(":"); this.IMFastFetchRate=arr[0]; this.IMRateSwitchTime=arr[1]; this.IMSlowFetchRate=arr[2]; this._IMSetTimeout(); this.currentIMRequest=false; },_IMSwitchSlow:function(){ if(this.IMCurrentFetchRate!=this.IMSlowFetchRate){ this.IMCurrentFetchRate=this.IMSlowFetchRate; } },_IMSwitchFast:function(){ if(this.IMCurrentFetchRate!=this.IMFastFetchRate){ this.IMCurrentFetchRate=this.IMFastFetchRate; return true; } },_IMSetTimeout:function(){ if(!GJ_IMLOOP_ENABLED){ return; } if(this.FetchIMTimeout){ clearTimeout(this.FetchIMTimeout); } if(!this.IMRunning){ return; } if(((new Date()).getTime()-this.lastUserActivity)/1000>=this.IMRateSwitchTime){ this._IMSwitchSlow(); }else{ this._IMSwitchFast(); } this.FetchIMTimeout=setTimeout(this.fetchIMs.bind(this),this.IMCurrentFetchRate); },sendIM:function(_5c,msg){ $("imStatus").innerHTML="<img src=\"/images/ajaxSmallLoad.gif\" width=\"16\" height=\"16\" border=\"0\" />"; $("imSend").value="Sending..."; new Ajax.Request("/e/sendIM",{method:"post",evalScripts:false,onComplete:this._completeSendIM.bind(this),parameters:$H({destUser:_5c,msg:msg}).toQueryString()}); },_completeSendIM:function(req,_5f){ $("imStatus").innerHTML=_5f.imResult; $("instantMsg").value=""; $("imSend").value="Send"; },displayIM:function(im){ this.IMQueue.push(im); this._serviceIMQueue(); },confirmMsgRcvd:function(_61){ new Ajax.Request("/e/confirmMsgRcvd",{method:"post",evalScripts:false,parameters:$H({msgid:_61}).toQueryString()}); },_serviceIMQueue:function(){ if(this.IMQueueBusy){ return; } this.IMQueueBusy=true; if(this.IMQueue.length==0){ this.IMQueueBusy=false; return; } var im=this.IMQueue.shift(); var dim=gjutils.getWindowSize(); var div=document.createElement("div"); div.id="IMDiv"+this.IMCounter; div.className="IMWindow"; div.style.position="absolute"; div.style.zIndex=GJ_MID_PANE-this.IMCounter; div.style.display="block"; var _65=$("IMDiv"+(this.IMCounter-1)); if(_65){ div.style.left=(parseInt(_65.style.left)-10)+"px"; }else{ div.style.left=(dim[0]-250)+"px"; } div.style.top=(dim[1]+10)+"px"; div.style.width="200px"; div.style.height="150px"; div.style.fontFamily="Verdana, Arial"; div.style.fontSize="11px"; div.style.border="3px solid #3366CC"; div.style.backgroundColor="#EFEFEF"; div.style.backgroundImage="url(/images/IMBG.jpg)"; div.innerHTML="<a href=\"#\" onclick=\"Element.remove($('"+div.id+"')); return false;\" style=\"position: absolute; right: 5px; top: 5px;\">Close</a>"; im.msg.evalScripts(); im.msg.stripScripts(); var _66=new Template(im.msg); div.innerHTML=_66.evaluate({divId:div.id}); document.body.appendChild(div); var _67=dim[1]-164; var _68=parseInt(div.style.top); var _69=div.id; this.displayIMInterval=setInterval(function(){ if(_68>_67+12){ _68-=12; div.style.top=_68+"px"; }else{ div.style.top=_67+"px"; clearInterval(this.displayIMInterval); this.IMQueueBusy=false; setTimeout(function(){ if($(_69)){ new Effect.Fade(_69,{duration:1.5}); } },10000); this._serviceIMQueue(); gjTracker("/appEvent/displayedIM/"); } }.bind(this),1); this.IMCounter++; },doProfile:function(){ var _6a=Form.serialize($("profileForm")); $(this.currentPanel.getContentElem()).innerHTML=""; var _6b=new loadingMessage(this.currentPanel.getContentElem(),"Processing",{fontSize:"20px",fontWeight:"bold",fontFamily:"Verdana, Arial",color:"#FFF",paddingLeft:"150px",paddingTop:"50px"}); var ajx=new Ajax.Updater(this.currentPanel.getContentElem(),"/e/profile",{method:"post",evalScripts:true,onInteractive:function(){ _6b.stop(); },onComplete:function(){ this.showUser(this.userData.encid,true); }.bind(this),parameters:_6a}); },doForgot:function(){ var _6d=Form.serialize($("forgotForm")); $(this.currentPanel.getContentElem()).innerHTML=""; var _6e=new loadingMessage(this.currentPanel.getContentElem(),"Processing",{fontSize:"20px",fontWeight:"bold",fontFamily:"Verdana, Arial",color:"#FFF",paddingLeft:"150px",paddingTop:"50px"}); var ajx=new Ajax.Updater(this.currentPanel.getContentElem(),"/e/forgot",{method:"post",evalScripts:true,onInteractive:function(){ _6e.stop(); },parameters:_6d}); },_updateMainMenu:function(){ var ajx=new Ajax.Updater($("mainMenu"),"/e/mainMenu",{method:"post",evalScripts:true,onComplete:function(){ if(this.viewPort.getView()&&this.viewPort.getView().setAddExpLink){ this.viewPort.getView().setAddExpLink($("addExpText")); } }.bind(this)}); },showUser:function(id,_72){ this.viewPort.setView(new GJViewExpList({userid:id,filter:"mostRecent"})); },showMyExperiences:function(_73){ if(!this.loggedIn){ gjapp.loadSPanel("/static/myExpNotLoggedIn.html"); return; } this.viewPort.setView(new GJViewExpList({userid:this.userData.encid,filter:"mostRecent"})); if(!_73){ this.gjmap.centerWorld(); } },handleListFlag:function(_74,_75){ new Ajax.Request("/e/flag",{method:"post",parameters:$H({id:this.viewPort.getView().rankIcons.getDataByRank(_75).id,fl:_74}).toQueryString(),onComplete:function(req,_77){ if(typeof (_77)=="object"&&_77.done){ Element.addClassName($("parentListDiv"+_75),"flagged"); } }.bind(this)}); },startAddExperience:function(){ if(!this.loggedIn){ this.loadSPanel("/static/login_to_add_exp.html"); return; }else{ this.viewPort.setView(new GJViewAddExp({})); return; } },registerCountryChange:function(_78){ if(_78=="US"){ $("enterCityText").innerHTML="Enter your 5 digit ZIP:"; }else{ $("enterCityText").innerHTML="Enter your city name:"; } },showLoggedInMoreMenu:function(e){ var _7a="<a href=\"#\" onclick=\"gjapp.logout(true); gjTracker('/click/logout'); return false;\" class=\"lnk\">Logout</a><br />"+"<a href=\"/"+this.userData.username+"/\" class=\"lnk\" style=\"color: #F00;\">View Your Blog</a><br />"+"<a href=\"/e/blogSettings\" class=\"lnk\">Change your Blog Settings</a><br /><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.findSomeone(); gjTracker('/click/userSearch'); return false;\">User Search</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.loadPanel('/e/messages', {}); gjTracker('/click/inbox'); return false;\">Your InBox</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.loadPanel('/e/profile', {}); gjTracker('/click/profile'); return false\">Your Info</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.showGeoFriends(); gjTracker('/click/myGeofriends'); return false;\">Your Geofriends</a><br />"+"<a class=\"lnk\" href=\"/\" onclick=\"gjTracker('/click/restartGeojoey'); return true;\">Restart Geojoey</a><br />"+this.topCorpMenu; new PopupDiv(e,{width:"150px",padding:"3px",border:"1px solid #3366CC",backgroundColor:"#FFF"},_7a,"topLeft",true); gjTracker("/click/loggedInMoreMenu"); return false; },showLoggedOutMoreMenu:function(e){ var _7c="<a class=\"lnk\" href=\"#\" onclick=\"gjapp.findSomeone(); gjTracker('/click/userSearch'); return false;\">User Search</a><br />"+"<a class=\"lnk\" href=\"/\" onclick=\"gjTracker('/click/restartGeojoey'); return true;\">Restart Geojoey</a><br /><br />"+this.topCorpMenu; new PopupDiv(e,{width:"150px",padding:"3px",border:"1px solid #3366CC",backgroundColor:"#FFF"},_7c,"topLeft",true); gjTracker("/click/loggedOutMoreMenu"); return false; },showMoreMenu:function(e){ var _7e="<b class=\"lnk\" style=\"color: #000; text-decoration: none;\">Zoom out and show me:</b><br />"+"<a href=\"#\" onclick=\"if(gjapp.viewPort.setView(new GJViewUserList({ filter: 'topUsers'})) ){ gjapp.gjmap.centerWorld(); } gjTracker('/click/globalTopUsers'); return false;\" class=\"lnk\">Top&nbsp;Users</a><br />"+"<a href=\"#\" onclick=\"if(gjapp.viewPort.setView(new GJViewUserList({filter: 'topTrekkers'})) ){ gjapp.gjmap.centerWorld(); } gjTracker('/click/globalTrekkers'); return false;\" class=\"lnk\">Trekkers</a><br />"+"<a href=\"#\" onclick=\"if(gjapp.viewPort.setView(new GJViewExpList({filter: 'mostDiscussed'})) ){ gjapp.gjmap.centerWorld(); } gjTracker('/click/globalMostDiscussed'); return false;\" class=\"lnk\">Most Discussed</a><br />"+"<a href=\"#\" onclick=\"if(gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecentlyVoted'})) ){ gjapp.gjmap.centerWorld(); } gjTracker('/click/globalRecentlyVoted'); return false;\" class=\"lnk\">Most Recent Votes</a><br />"+"<a href=\"#\" onclick=\"if(gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecentlyCommented'})) ){ gjapp.gjmap.centerWorld(); } gjTracker('/click/globalMostRecentlyCommented'); return false;\" class=\"lnk\">Most Recent Comments</a><br />"+"<a href=\"#\" onclick=\"gjapp.showMyExperiences(); gjTracker('/click/globalMyExperiences'); return false;\" class=\"lnk\">My Blog Entries</a><br />"+"<b class=\"lnk\" style=\"color: #000; text-decoration: none;\">Show in the current map area:</b><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecent'})); gjTracker('/click/localNewest'); return false;\">Newest Entries</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewExpList({filter: 'mostPopular'})); gjTracker('/click/localPopular'); return false;\">Most Popular Entries</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewUserList({filter: 'topUsers'})); gjTracker('/click/localTopUsers'); return false;\">Top Users in this area</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewUserList({filter: 'topTrekkers'})); gjTracker('/click/localTrekkers'); return false;\">Top Trekkers in this area</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewExpList({filter: 'mostDiscussed'})); gjTracker('/click/localMostDiscussed'); return false;\">Most Discussed</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecentlyVoted'})); gjTracker('/click/localRecentlyVoted'); return false;\">Most Recent Votes</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecentlyCommented'})); gjTracker('/click/localRecentlyCommented'); return false;\">Most Recent Comments</a><br />"+"<b class=\"lnk\" style=\"color: #000; text-decoration: none;\">Search Menu:</b><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"if(gjapp.viewPort.getView().openSearchExperiences){ gjapp.viewPort.getView().openSearchExperiences(); } else { gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecent'})); gjapp.viewPort.getView().openSearchExperiences(); } gjTracker('/click/mapSearchMenuSearchExps'); return false;\">Search entries in this area</a><br />"+"<a class=\"lnk\" href=\"#\" onclick=\"if(gjapp.viewPort.getView().openTagCloud){ gjapp.viewPort.getView().openTagCloud(); } else { gjapp.viewPort.setView(new GJViewExpList({filter: 'mostRecent'})); gjapp.viewPort.getView().openTagCloud(); } gjTracker('/click/mapSearchMenuBrowseTags'); return false;\">Browse the Tag Cloud in this area</a>"; new PopupDiv(e,{width:"250px",padding:"3px",border:"2px solid #3366CC",backgroundColor:"#FFF"},_7e,"topLeft",true); gjTracker("/click/globalMoreMenu"); return false; },startResize:function(evt){ if(this.mouseMoveObserver){ this.resizeMouseUp(); } evt=evt?evt:window.event; this.mouseMoveObserver=this.resizeMouseMove.bindAsEventListener(this); this.mouseUpObserver=this.resizeMouseUp.bindAsEventListener(this); Event.observe(document,"mousemove",this.mouseMoveObserver,false); Event.observe(document,"mouseup",this.mouseUpObserver,false); Event.observe(document,"click",this.mouseUpObserver,false); },resizeMouseMove:function(evt){ var dim=Element.getDimensions($("mainBodyDiv")); var _82=dim.width; $("mainTableLeft").style.width=Math.floor(Event.pointerX(evt)/_82*100)+"%"; $("mainTableRight").style.width=(100-Math.floor(Event.pointerX(evt)/_82*100))+"%"; },resizeMouseUp:function(evt){ if(!this.mouseMoveObserver){ return; } Event.stopObserving(document,"mousemove",this.mouseMoveObserver,false); Event.stopObserving(document,"mouseup",this.mouseUpObserver,false); Event.stopObserving(document,"click",this.mouseUpObserver,false); this.mouseMoveObserver=false; this.mouseUpObserver=false; },drawAjaxProgressMsg:function(msg){ new MiddlePanel("AjaxStatus",{padding:"20px",backgroundColor:"#FFF",border:"1px solid #000"},"<img src=\"/images/loading2.gif\" width=\"32\" height=\"32\" alt=\"loading\" style=\"vertical-align: middle;\" />&nbsp;&nbsp;"+msg); },stopAjaxProgressMsg:function(msg){ if(msg){ $("AjaxStatus").innerHTML=msg+"<br /><br /><a href=\"#\" onclick=\"Element.remove($('AjaxStatus')); return false;\">Close this message</a>"; }else{ Element.remove($("AjaxStatus")); } },finishVote:function(_86,_87){ this.viewPort.getView().finishVote(_86,_87); },getContentScrollDiv:function(){ return this.viewPort.pageContainer.getContainerDiv(); }}); 
