//@compiled(2006/02/09 17:46:53)
//--{behavior}----------------------------------------------------//
var Behaviors = {}
var Behavior = {
  Constructor: function() {this.all = [];},
  Instance: function() {},
  create: function(prototype) {
    var c = function() {if(this.initialize)this.initialize.apply(this,arguments)}
    c.prototype = extend(new Behavior.Instance, prototype);
    extend(c, new Behavior.Constructor);
    if(window.Events)Events.add(window, 'unload', c.terminateEvent = c.terminate.bindAsEventListener(c));
    return c.prototype.constructor = c;
  }
}

Behavior.Constructor.prototype = {
  add: function(o) {
    if(this.all.indexOf(o) == -1)this.all.push(o);
    if(this.baseID && !o.id)o.id = this.baseID.replace(/#+/g,this.all.length);
  },
  instanceOf: function(o) {return typeof o == 'object' && o.constructor == this;},
  terminate: function() {
    this.all.forEach(function(o){o.terminate()});
    this.all = [];
    if(this.terminateEvent)Events.remove(window, 'unload', this.terminateEvent);
  }
}

Behavior.Instance.prototype = {
  __fireEvent: function(type, args) {
    ['On','on'].forEach(function(on) {
      (this[on + type]||new Function).apply(this,args||[]);
    },this);
  },
  initialize: function(element, options) {
    if(this.element =$(element))
    this.element.wrapper = this;extend(this,options);
    this.__fireEvent('Binding');
    if(this.constructor.all)this.constructor.add(this);
  },
  terminate: function() {
    if(this.scripts)this.scripts.forEach(Element.remove);
    this.__fireEvent('Release');
    if(this.element)this.element.wrapper = null;this.element = null;
  }
}
//--{class}-------------------------------------------------------//
var Class = {
  create: function(prototype) {
    var constructor = function() {
      if(typeof this.initialize == 'function')
        this.initialize.apply(this,arguments);
    }
    if(prototype)constructor.prototype = prototype;
    return constructor.prototype.constructor = constructor;
  }
}
//--{macros}------------------------------------------------------//
Macro = function(find, replacement) {
  this.constructor = Macro;
  this.find = typeof find == 'object' && find.constructor == RegExp ? find : new RegExp(find,'gi');
  this.replacement = replacement || '';
}
Macro.prototype = {
  apply: function(s) {return (s||'').replace(this.find,this.replacement);},
  test:  function(s) {return (s||'').match(this.find) !== null;}
}

Macros = function(macros) {
  this.constructor = Macros;
  this.macros = [];
  for(var i = 0; i < arguments.length; i++)
    if(Macro.instanceOf(arguments[i]))this.add(arguments[i]);
}
Macros.prototype = {
  add: function(find, replacement) {
    this.macros.push(Macro.instanceOf(find) ? find : new Macro(find,replacement));
  },

  apply: function(s) {
    for(var i = 0; i < this.macros.length; i++)s = this.macros[i].apply(s);
    return s;
  },

  test: function(s) {
    for(var i = 0; i < this.macros.length; i++)if(this.macros[i].test(s))return true;
    return false;
  }
}

Macro.instanceOf  = function(o) {return typeof o=='object' && o.constructor===Macro;}
Macros.instanceOf = function(o) {return typeof o=='object' && o.constructor===Macros;}
//--{thread}------------------------------------------------------//
Thread = function(callback, frequency, options) {
  this.constructor = Thread;
  this.callback  = callback;
  this.frequency = frequency;
  extend(this,options);
}
Thread.prototype = { 
  start: function() {
    this.count = 0;
    this.interval = window.setInterval(this.onTimerEvent.bind(this),this.frequency);
    return this;
  },
  stop: function(success) {
    if(this.interval)window.clearInterval(this.interval);
    (this.onStop||new Function).call(this,success);
  },
  onTimerEvent: function() {
    if(this.callback(++this.count)==true)this.stop(true);
  }
}

Function.prototype.executeEvery = function(msecs) {
  this.thread = new Thread(this, msecs).start();
}
//--{try}---------------------------------------------------------//
var Try = {
  activeX: function(){
    var a=arguments,id;
    for(var i=0;i<a.length;i++)try{var o=new ActiveXObject(id=a[i]);delete o;break;}catch(e){id='no.activex';}
    return id;
  },
  these: function(){
    var r;for(var i=0;i<arguments.length;i++)try{r=arguments[i]();break;}catch(e){}return r;
  }
}
//--{dom/collection}----------------------------------------------//
var Collection = {
  get: function(classname, element, excludes) {
    if(!classname)return [];
    if(Var.isCollection(classname))return classname;
    return tags('*',element).filter(function(o){
      if(classname == '*' || Element.hasClass(o,classname)){
        if(excludes && Element.hasClass(o,excludes))return;
        return true;
      }
    });
  },
  from: function(args) {
    return $C(args);
  },
  hasProperty: function(c, name, value) {
    if(!Var.isArray(c=this.get(c)))return false;
    return c.every(function(o){return o[name] === value;});
  },
  setProperty: function(c, name, value) {
    if(!Var.isArray(c=this.get(c)))return -1;var n = 0;
    c.forEach(function(o){try{o[name] = value;n++;}catch(e){}});return n;
  },
  setStyle: function(c, name, value) {
    if(!Var.isArray(c=this.get(c)))return -1;var n = 0;
    c.forEach(function(o){try{o.style[name] = value;n++;}catch(e){}});return n;
  },
  shuffle: function(c) {
    if(!Var.isArray(c=this.get(c)))return -1;var n = 0;
    c.forEach(function(o){o.swapNode(c[Math.floor(Math.random()*c.length)]);n++;});return n;
  }
}
Var.isCollection = function(o) {return this.isArray(o) && o.every(function(node){return Var.isElement(node);});}
//--{dom/css}-----------------------------------------------------//
var CSS = {
  parseMacros: function(c) {
    var macros = this.macros = Macros.instanceOf(c)?c:this.macros;
    if(Macros.instanceOf(c)||!c)c = document.styleSheets;
    if(!Macros.instanceOf(macros)||c.length==0)return;
    if(window.CSSStyleSheet){
      for(var i = 0; i < c.length; i++){
        var sheet = c[i], rules;
        try{rules = sheet.cssRules;}catch(securityException){continue;}
        for(var j = 0; j < rules.length; j++){
          var rule = rules[j];
          if(macros.test(rule.cssText)){
            if(rule.constructor===CSSImportRule){
              sheet.deleteRule(j);
              sheet.insertRule(macros.apply(rule.cssText),j);
              this.parseMacros([sheet.cssRules[j].styleSheet]);
            }else{
              rule.style.cssText = macros.apply(rule.style.cssText);
            }
          }
          if(rule.constructor===CSSImportRule){
            this.parseMacros([rule.styleSheet]);
          }
        }
      }
    }else{ // IE
      this.recurseSheets(function(sheet){
        var c = sheet.imports;
        for(var i = 0; i < c.length; i++){
          var href = c[i].href;
          if(macros.test(href)){
            c[i].disabled = true;
            sheet.addImport(macros.apply(href),i+1);
          }
        }
        if(macros.test((sheet.cssText||'').replace(/@import [^;]*;/gi,''))){
          for(var i = 0; i < sheet.rules.length; i++){
            var rule = sheet.rules[i];
            if(macros.test(rule.style.cssText)){
              rule.style.cssText = macros.apply(rule.style.cssText);
            }
          }
        }
      });
    }
  },
  
  recurseRules: function(callback, sheets) {
    if(!(sheets=sheets||document.styleSheets)||sheets.length == 0||typeof callback != 'function')return;
    this.recurseSheets(function(sheet){
      var rules = sheet.rules||sheet.cssRules;
      for(var i = 0; i < rules.length; i++){
        if(window.CSSImportRule && rules[i].constructor===CSSImportRule)continue;
        callback(rules[i],i,sheet);
      }
    },sheets);
  },
  
  recurseSheets: function(callback, sheets) {
    if(!(sheets=sheets||document.styleSheets)||sheets.length == 0||typeof callback != 'function')return;
    try{
      for(var i = 0; i < sheets.length; i++){
        sheets[i].url = new URL(sheets[i].href||location.href); // need parent ref for IE?
        callback(sheets[i]);
        if(sheets[i].imports){this.recurseSheets(callback,sheets[i].imports);}
      }
    }catch(e){}
  }
}
if(window.CSSStyleSheet && CSSStyleSheet.prototype){
  CSSStyleSheet.prototype.__defineGetter__('imports',function(){
    var a=[];try{Array.from(this.cssRules).forEach(function(rule){
    if(rule.constructor===CSSImportRule)a.push(rule.styleSheet);});}catch(e){};return a;
  });
}
//--{dom/element}-------------------------------------------------//
if(!window.Element)var Element = {};
extend(Element, {
  appendChild: function(o, name, props) {if(!(o=$(o)))return;
    return o.appendChild(extend(this.getOwnerDocument(o).createElement(name),props));
  },
  appendParam: function(o, name, value) {if(!(o=$(o))||!value)return;
    if(/embed/i.test(o.nodeName))this.setAttribute(o,name,value);
    else this.appendChild(o,'param',{name:name,value:value});
  },
  appendParams: function(o, params) {var c=(params||{});
    for(var p in c){if(typeof c[p]!='function')this.appendParam(o,p,c[p]);}
  },
  getAncestors: function(o, appendSelf) {if(!(o=$(o)))return [];
    var a = (appendSelf==true?[o]:[]);if(!o.parentNode)return a;
    this.walkAncestors(o.parentNode,function(node){a.push(node)});
    return a;
  },
  getAttribute: function(o, name) {if(!(o=$(o)))return;
    return typeof o.getAttribute!='undefined' ? o.getAttribute(name)||o[name] : o[name];
  },
  getChildIndex: function(o) {if(!(o=$(o))||!o.parentNode)return -2;
    var c = o.parentNode.childNodes;
    for(var i = 0; i < c.length; i++){if(o===c[i])return i;}return -1;
  },
  getCustomStyle: function(o, stylename) {if(!(o=$(o))||!o.currentStyle)return;
    var s = Var.toString(o.currentStyle[stylename]).replace(/url[\(\('\("]|["\)'\)\)]$/g,'').replace(/^(\s+)?['"]|['"](\s+)?$/g,'');
    switch(s.toLowerCase()){case 'yes':case 'true':return true;case 'no':case 'false':return false;}
    if(s.length)return s;
  },
  getOwnerDocument: function(o) {if(!(o=$(o)))return document;
    if(o.ownerDocument)return o.ownerDocument;
    if(o.nodeName == '#document')return o;
    if(o.nodeName == '#window')return o.document;
    do{o=o.parentNode;}while(o.parentNode!=null);
    return o;
  },
  getRef: function(o, attribute) {
    if (attribute == 'mediaplayer') return MediaPlayer.all[Element.getAttribute(o, attribute)];
    try{var ref = $(this.getAttribute(o,attribute));return ref.wrapper||ref;}catch(e){}
  },
  setAttribute: function(o, name, value) {if(!(o=$(o)))return;
    return typeof o.setAttribute!='undefined' ? o.setAttribute(name,value) : o[name]=value;
  },
  setAttributes: function(o, attributes) {var c=(attributes||{});
    for(var p in c){if(!(p in c.constructor.prototype))this.setAttribute(o,p,c[p]);}
  },
  setOpacity: function(o, opacity, show) {if(!(o=$(o)))return;
    opacity = (opacity == 100 ? 99.999 : opacity);
    o.style.filter = 'alpha(opacity:'+ opacity +')';
    o.style.opacity = opacity/100;
    if(show==true)o.style.display = '';
  },
  walkAncestors: function(o, callback) {if(!(o=$(o)))return;
    while(o && o.parentNode){
      if(o.nodeType == 1 && this.__iterateNode(o,callback) == true)return o;
      o = o.parentNode;
    }
    if(this.__iterateNode(o,callback))return o;o = (o.defaultView||o.parentWindow);
    if(this.__iterateNode(o,callback))return o;
  },
  walkAttributes: function(o, callback) {
    if(!(o=$(o)))return;
    var a = o.attributes;if(!a)return;
    for(var i = 0; i < a.length; i++){
      if(Var.isString(callback) && callback == a[i].nodeName)return a[i];
      if(Var.isFunction(callback) && 
        callback(a[i].nodeValue,a[i].nodeName,a[i]) == true)return a[i];
    }
  },
  walkChildNodes: function(o, callback) {
    if(!(o=$(o)))return;
    var c = o.childNodes;
    for(var i = 0; i < c.length; i++){
      if(this.__iterateNode(c[i],callback) == true)return c[i];
    }
  },
  walkTree: function(o, callback) {
    if(!(o=$(o)))return;
    if(!this.walkTree.skip)this.walkTree.skip = []; // echo.console
    for(var c = o.firstChild; c; c = c.nextSibling){
      if(c.nodeType == 1){
        if(this.__iterateNode(c,callback) == true)return c;
        if(this.walkTree.skip.indexOf(c) == -1)this.walkTree(c,callback);
      }
    }
  },
  __iterateNode: function(o, callback) {
    if(!o||o==null)return false;
    if(Var.isString(callback))return (callback.toLowerCase() == o.nodeName.toLowerCase());
    if(Var.isElement(callback))return (callback === o);
    return callback(o);
  },
// class
  getParentByClassName: function(o, classname, boundary) {
    if(!(o=$(o))||!o.parentNode)return;o = o.parentNode;
    while(o){
      if(boundary && o === boundary)return;
      if(Element.hasClass(o,classname))return o;
      o = o.parentNode;
    }
  },
  getParentOrSelfByClassName: function(o, classname, boundary) {
    return this.hasClass(o,classname)?o:this.getParentByClassName(o,classname,boundary);
  },
  hasClass: function(o, classname) {
    if(!Var.isString(classname) || classname.indexOf(' ') > -1)
      return this.hasClassEx(o,classname);
    if(!(o=$(o))||!o.className)return false;
    return o.className.split(' ').indexOf(classname) > -1;
  },
  hasClassEx: function(o, classname) {if(!(o=$(o)))return false;
    var tokens = o.className.split(' ');
    var exists = function(token){return tokens.indexOf(token)>-1;}
    if(Var.isString(classname))classname = Var.toArray(classname,' ');
    if(Var.isArray (classname))classname = {all:classname};
    if(Var.isObject(classname)){
      if(classname.all){
        if(!Var.toArray(classname.all,' ').every(exists))return false;
      }
      if(classname.any){
        if(Var.toArray(classname.any,' ').some(exists))return true;
      }
      return true;
    }
    return false;
  },
  appendClass: function(c, classname) {var n = 0;
    Var.toArray(c).forEach(function(o){if(!(o=$(o)))return;n++;
      this.removeClass(o,classname);
      o.className += (o.className.length?' ':'')+classname;
    },this);return n;
  },
  removeClass: function(c, classname) {var n = 0;
    Var.toArray(c).forEach(function(o){if(!(o=$(o)))return;n++;
      var className = o.className.split(' ').filter(function(token){return token != classname}).join(' ');
      if (className != o.className) o.className = className;
    },this);return n;
  },
  toggleClass: function(c, classname) {
    c = Var.toArray(c);
    c.forEach(function(o){
      if(o=$(o))
        this[this.hasClass(o,classname)?'removeClass':'appendClass'](o,classname);
    },Element);
    return this.hasClass(c[0],classname);
  },
// display
  remove: function() {
    $C(arguments).forEach(function(o){if(o.parentNode)o.parentNode.removeChild(o);});
  },
  hide: function() {
    $C(arguments).forEach(function(o){o.style.display = 'none';});
  },
  show: function() {
    $C(arguments).forEach(function(o){o.style.display = '';});
  },
  toggleDisplay: function() {
    var s=(arguments.callee.useCurrentStyle?'currentStyle':'style');
    $C(arguments).forEach(function(o){
      o.style.display = (o[s].display=='none')?'':'none';
    });
  }
});
//--{dom/form}----------------------------------------------------//
var Field = {
  activate: function(o) {try{$(o).focus();$(o).select();}catch(e){}},
  clear:    function()  {for(var i=0;i<arguments.length;i++)$(arguments[i]).value='';},
  focus:    function(o) {try{$(o).focus()}catch(e){}},
  present:  function()  {for(var i=0;i<arguments.length;i++)if($(arguments[i]).value=='')return false;return true;},
  select:   function(o) {try{$(o).select()}catch(e){}}
}
var Form = {
  disable:     function(form) {Form.getElements(form).forEach(function(o){o.blur();o.disabled = true;});},
  enable:      function(form) {Form.getElements(form).forEach(function(o){o.disabled = false;});},
  focusFirst:  function(form) {Form.getElements(form).some(function(o){if(o.type!='hidden'&&!o.disabled){Field.activate(o);return true;}});},
  getElements: function(form) {var a=[];if(!(form=$(form)))return a;for(var tag in Form.Element.Serializers)a=a.concat(tags(tag,form));return a;},
  reset:       function(form) {try{if(form=$(form))form.reset()}catch(e){}},
  serialize:   function(form) {var a=[];if(!(form=$(form)))return a;var t=arguments[1];Form.getElements(form).forEach(function(o){var s=Form.Element.serialize(o,t);if(s)a.push(s);});return a.join('&');}
}
Form.Element = {
  getValue: function(o) {
    if(!(o=$(o)))return '';
    var params = Form.Element.Serializers[o.tagName.toLowerCase()](o);
    if(params)return params[1];
  },
  serialize: function(o) {
    if(!(o=$(o)))return '';
    var params = Form.Element.Serializers[o.tagName.toLowerCase()](o,arguments[1]);
    if(params)return encodeURIComponent(params[0]) +'='+ encodeURIComponent(params[1]);
  },
  Serializers: {
    input: function(o, t) {
      switch(true){
        case /button|image|reset/i.test(o.type):return;
        case /submit/i.test(o.type)&& t && t!=o:return;
        case /checkbox|radio/i.test(o.type):if(o.checked)return [o.name,o.value||'on'];break;
        default:if (o.value) return [o.name,o.value];
      }
    },
    select: function(o) {
      var i = o.selectedIndex, v = [];
      var c = o.options[Math.max(i,0)];
      if (!o.multiple) v=[c.value||c.text];
      else {
        for (i=0; (c=o.options[i]); i++) {
          if (c.selected) v[v.length] = c.value||c.text;
        }
      }
      if (v.length) return [o.name,v.join(', ')];
    },
    textarea: function(o) {
      if (o.value) return [o.name,o.value];
    }
  }
}
var $F = Form.Element.getValue;
//--{dom/form/observers}------------------------------------------//
TimedObserver = function() {}
TimedObserver.prototype = {
  initialize: function(element, frequency, callback) {
    this.element   = $(element);
    this.frequency = frequency;
    this.callback  = callback;
    this.lastValue = this.getValue();
    this.registerCallback();
  },
  registerCallback: function() {
    setTimeout(this.onTimerEvent.bind(this),this.frequency * 1000);
  },
  onTimerEvent: function() {
    var value = this.getValue();
    if(this.lastValue != value){
      this.callback(this.element, value);
      this.lastValue = value;
    }
    this.registerCallback();
  }
}
Form.Element.Observer = Class.create(extend(new TimedObserver, {
  getValue: function() {return Form.Element.getValue(this.element);}
}));
Form.Observer = Class.create(extend(new TimedObserver, {
  getValue: function() {return Form.serialize(this.element);}
}));
//--{dom/position}------------------------------------------------//
var Position = {
  getOffsets: function(o) {
    var c = {top:0, left:0, width:0, height:0}
    if(o=$(o)){c.width = o.offsetWidth;c.height = o.offsetHeight;}
    while(o){
      c.top  += o.offsetTop  || 0;
      c.left += o.offsetLeft || 0;
      o = o.offsetParent;
    }
    return c;
  },
  realOffset: function(o) {
    var c = {top:0, left:0}
    if(!(o = $(o)))return c;
    while(o && o.parentNode){
      c.top  += o.scrollTop  || 0;
      c.left += o.scrollLeft || 0;
      o = o.parentNode;
    }
    c.top -= (o.documentElement.scrollTop + (o.body ? o.body.scrollTop : 0));
    c.left -= (o.documentElement.scrollLeft + (o.body ? o.body.scrollLeft : 0));
    return c;
  },
  within: function(o, x, y) {
    if(!(o = $(o)))return false;
    var off = this.getOffsets(o);
    var real = this.realOffset(o);
    if(this.debug)this.debug.within(o, x, y, off, real);
    return (y >= off.top  - real.top  &&
            y <  off.top  - real.top  + off.height &&
            x >= off.left - real.left && 
            x <  off.left - real.left + off.width);
  }
}
//--{dom/window}--------------------------------------------------//
function popup(url, name, width, height, position, features) {
  var c=arguments.callee, x=0, y=0, p=(position||c.position);
  var W=screen.availWidth, H=screen.availHeight;
  var w=Math.min(width||c.width,W), h=Math.min(height||c.height,H);
  if(/^b/i.test(p))  y = H-h-c.offsets.bottom;
  if(/^c/i.test(p)){ y = (H-h)/2; x = (W-w)/2; }
  if( /r/i.test(p))  x = W-w-c.offsets.right;
  if(!name)name = c.uniqueID.replace(/%/,c.all.length);
  var f = c.features.replace(/%x/,x).replace(/%y/,y).replace(/%w/,w).replace(/%h/,h);
  if(!c.bound && window.Events){Events.add(window,'beforeunload',c.closeall.bind(c));c.bound = true;}
  return c.all.push( window.open(url||'about:blank',name,f+(features?features:'')) );
}
extend(popup, {
  all:[], width:800, height:550, position:'c',
  offsets: {right:23, bottom:6}, uniqueID:'popup_%',
  features: 'top=%y,left=%x,width=%w,height=%h,resizable=no,scrollbars=no',
  closeall: function() {
    for(var i=0;i<this.all.length;i++)try{this.all[i].close();this.all[i]=null;}catch(e){}
    this.all = [];
  }
});

function setWindow(width, height, position){
  var W=screen.availWidth, H=screen.availHeight, p=(position||'center');
  var w=Math.min(width||800,W), h=Math.min(height||550,H), x=0,y=0;
  if(/-right$/i.test(p))  x = W-w;
  if(/^bottom-/i.test(p)) y = H-h;
  if(/center/i.test(p)){  x = (W-w)/2; y = (H-h)/2; }
  try{resizeTo(w,h);moveTo(x,y);}catch(e){}
}
if(typeof hta=='object' && hta.commandLine)setWindow(hta.width,hta.height,hta.position);
//--{http/ajax/request}-------------------------------------------//
Ajax.Request = function() {this.set.apply(this, arguments);}
Ajax.Request.Events = Ajax.Events;
Ajax.Request.Options = {async:true, method:'POST', mimeType:'', query:''};
Ajax.Request.prototype = {constructor: Ajax.Request,
  set: function(url, options) {
    extend(this, Ajax.Request.Options, {url:url}, options);
    this.headers = extend({}, options ? options.headers : {});
  },
  get: function(query, headers) {
    this.abort();
    this.method = 'GET';
    this.headers = extend({}, headers);
    return this.send(query);
  },
  post: function(query, headers) {
    this.abort();
    this.method = 'POST';
    this.headers = extend({}, Ajax.Headers.POST, headers);
    return this.send(query);
  },
  abort: function() {
    if(this.transport)this.transport.abort();
  },
  send: function(query) {
    this.abort();
    this.requiresPrivilege = false;
    this.transport = Ajax.getTransport();
    var url = (this.url.toString()).split('?')[0];
    var qry = (this.url.toString()).split('?')[1]||query||this.query;
    if(/get/i.test(this.method))url += '?'+ qry;
    try{
      this.transport.open(this.method.toUpperCase(),url,this.async);
    }catch(e){
      if(/Permission denied/.test(e)){
        this.requiresPrivilege = true;
        netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
        this.transport.open(this.method.toUpperCase(),url,this.async);
      }else{
        (this.onError||new Function).call(this,e);
        return this;
      }
    }
    try{
      if(this.async){
        this.transport.onreadystatechange = this.onStateChange.bind(this);
        setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);
      }
      for(var p in this.headers)if(typeof this.headers[p] != 'function')
        this.transport.setRequestHeader(p,this.headers[p]);
      if(this.mimeType && this.transport.overrideMimeType)
        this.transport.overrideMimeType(this.mimeType);
      this.transport.send(/post/i.test(this.method)?qry:null);
      if(!this.async)this.respondToReadyState(4);
    }catch(e){
      (this.onError||new Function).call(this,e);
    }
    return this;
  },
  respondToReadyState: function(readyState) {
    var e = Ajax.Request.Events[readyState];
    var r = new Ajax.Response(this);
    if(e == 'Complete')delete this.transport;
    (this['on'+e]||new Function).call(this,r);
  },
  onStateChange: function() {
    var n = this.transport.readyState;
    if(n != 1)this.respondToReadyState(n);
  }
}

Ajax.Response = function(request) {if(request)this.parseFromRequest(request);}  
Ajax.Response.StatusCodes = {0:'Aborted', 12007:'Unable to resolve resource.'}
Ajax.Response.prototype = {constructor:Ajax.Response,
  isSuccess: function() {
    return (this.status >= 200 && this.status < 300);
  },
  parseFromRequest: function(request) {
    this.url = request.url;
    var http = request.transport;
    try{this.headers    = http.getAllResponseHeaders();}catch(e){}
    try{this.mimeType   = http.getResponseHeader('Content-Type');}catch(e){}
    try{this.jsonType   = http.getResponseHeader('X-JSON');}catch(e){}
    try{this.status     = http.status;       }catch(e){this.status = 0;} // https://bugzilla.mozilla.org/show_bug.cgi?id=197141
    try{this.statusText = http.statusText;   }catch(e){this.statusText = 'Unknown';}
    try{this.body       = http.responseBody; }catch(e){}
    try{this.text       = http.responseText; }catch(e){}
    try{this.xml        = http.responseXML;  }catch(e){}
    try{if(request.requiresPrivilege && http.responseXML)this.xml=(new DOMParser()).parseFromString(this.text,'text/xml');}catch(e){}
    var statusCodeValue = Ajax.Response.StatusCodes[this.status];
    if(statusCodeValue && /Unknown/.test(this.statusText))this.statusText = statusCodeValue;  
  }
}
//--{js/object/json}----------------------------------------------//
var JSON = {
  stringify: function(o) {
    var i, s = '';
    switch (typeof o) {
      case 'function':
        if (/function RegExp/.test(o.constructor)) {
          return o; // gecko reports as function
        }
        return 'function(){}';
      case 'object':
        if (o) {
          if (o.constructor == Array) {
            for (i = 0; i < o.length; i++) {
              s += (s?',':'') + JSON.stringify(o[i]);
            }
            return '['+s+']';
          }
          if (o.constructor == Date) {
            return '(new Date('+o.getTime()+'))';
          }
          if (o.constructor == RegExp) {
            return o; // msie reports as object
          }
          if ('toString' in o) {
            for (i in o) {
              if (typeof o[i] != 'undefined') {
                s += (s?',':'') + JSON.stringify(i) +':'+ JSON.stringify(o[i]);
              }
            }
            return '{'+s+'}';
          }
        }
        return 'null';
      case 'string':
        for (i = 0; i < o.length; i++) {
          var c = o.charAt(i);
          if (c >= ' ') {
            if (c == '\\' || c == '"') s += '\\'; s += c;
          } else {
            switch (c) {
              case '\b': s += '\\b'; break;
              case '\f': s += '\\f'; break;
              case '\n': s += '\\n'; break;
              case '\r': s += '\\r'; break;
              case '\t': s += '\\t'; break;
              default: c = c.charCodeAt(i);
                s += '\\u00'+ Math.floor(c / 16).toString(16) + 
                  (c % 16).toString(16);
            }
          }
        }   
        return '"'+s+'"';
      case 'number':
        return isFinite(o) ? String(o) : 'null';
      case 'boolean':
        return String(o);
      default:
        return 'null';
    }
  },
  parse: function(text) {
    var object;
    try {eval('object = ('+ text +')');} 
    catch(e) {object = null;}
    return object;
  }
};
//--{xml/xml}-----------------------------------------------------//
function XML(uri, callback) {
  if(typeof uri=='object')return uri;
  var doc, onComplete=function(){XML.setProperties(doc);setTimeout(function(){callback(doc)},10)};
  try{doc = document.implementation.createDocument('','',null);}catch(e){
  try{doc = new ActiveXObject(XML.MSXML.FREETHREADED);doc.resolveExternals = false;doc.validateOnParse = false;}catch(e){}}
  if(!doc)throw new Error('Failed to initialize XMLDocument object. [window.XML]');
  if(doc.async = typeof callback=='function'){
    if(!window.ActiveXObject)doc.onload = function() {onComplete()}
    else doc.onreadystatechange = function() {if(doc.readyState==4)onComplete()}
  }
  try{
    if(/^(\s+)?</.test(uri))doc.loadXML(uri);else doc.load(uri);
    XML.setParseError(doc, 0);
  }catch(e){
    XML.setParseError(doc, -2146697210, 'The system cannot locate the object specified.', uri);
    XML.setParseError(doc, -2146697211, 'The system cannot locate the resource specified.', uri);
    if(doc.async)onComplete();
  }
  if(!doc.async)XML.setProperties(doc);
  return doc;
}
XML.setParseError = function(xmlDoc, errorCode, reason, url) {
  try{if(xmlDoc.documentElement.nodeName == 'parseerror'){errorCode = 12007;reason = xmlDoc.documentElement.text}}catch(e){}
  try{return xmlDoc.parseError = {errorCode:(typeof errorCode == 'number'?errorCode:0), reason:(reason||'Unknown'), url:(url||location.href)}} catch(e) {}
}
XML.setProperties = function(xmlDoc) {
  if(xmlDoc && typeof xmlDoc.setProperty != 'undefined'){
    xmlDoc.setProperty('SelectionLanguage', 'XPath');if(XML.NS)
    xmlDoc.setProperty('SelectionNamespaces', XML.NS.toString());
  }
  return xmlDoc;
}
XML.tag = function(node, nsURI, localName)
{
    var c = XML.tags(node, nsURI, localName);
    return (c.length)?c[0]:null;
}
XML.tags = function(node, nsURI, localName) {   
      var forEach = function(o, block, context) {
        if (o && o.length) for (var i = 0; i < o.length; i++) {block.call(context, o[i], i, o);}
      }
      if (node.getElementsByTagNameNS) {
        return node.getElementsByTagNameNS(nsURI, localName);
      } else {
        if (!nsURI) nsURI = "*";
        try {
          var xpath = ".//*[local-name()='" + localName + "'" +
            (nsURI == "*" ? "]" : " and namespace-uri()='" + nsURI + "']");
          return node.selectNodes(xpath);
        } catch(e) {
          var c = [];
          forEach(node.getElementsByTagName("*"), function(o) {
            var a = o.nodeName.split(":");
            var n = (a.length==2)?a[1]:a[0];
            if ((nsURI == "*" || o.namespaceURI == nsURI) && localName==n) c.push(o);
          });
          return c;
        }
    }
}
XML.MSXML = (function() {
  var pattern = ['msxml2.%.6.0','msxml2.%.4.0','msxml2.%.3.0','msxml2.%','msxml.%'];
  function map(s, legacy) {var a = pattern.concat(legacy), id;for(var i = 0; i < a.length; i++)
    try{var o = new ActiveXObject(id = a[i].replace(/%/,s));o = null;break;}catch(e){id = 'no.activex'}
    return id;
  }
  return {
    CLASSID:      '88d969c0-f192-11d4-a65f-0040963251e5',
    DOMDOCUMENT:  map('domdocument','microsoft.xmldom'),
    FREETHREADED: map('freethreadeddomdocument','microsoft.freethreadedxmldom'),
    XMLHTTP:      map('xmlhttp'),
    XMLSCHEMA:    map('xmlschemacache'),
    XSLTEMPLATE:  map('xsltemplate')
  }
})();
if(typeof XMLDocument != 'undefined' && XMLDocument.prototype && XMLDocument.prototype.__defineGetter__){
  Element.prototype.__defineGetter__('xml',function(){return (new XMLSerializer).serializeToString(this);});
  XMLDocument.prototype.__defineGetter__('xml',function(){return (new XMLSerializer).serializeToString(this);});
  XMLDocument.prototype.loadXML = function(s) {
    var doc = (new DOMParser()).parseFromString(s,'text/xml');while(this.hasChildNodes())this.removeChild(this.lastChild);
    for(var i = 0; i < doc.childNodes.length; i++)this.appendChild(this.importNode(doc.childNodes[i],true));
  }
  XMLDocument.prototype.namespacesResolver = function(prefix) {
    var doc = this;
    var resolver = {
      namespaces: (doc.namespaces||{}),
      normalResolver: doc.createNSResolver(doc.documentElement),
      lookupNamespaceURI: function(prefix) {
        //if(prefix in (XML.ns||{}))return XML.ns[prefix];
        if(prefix in this.namespaces)return this.namespaces[prefix];
        return this.normalResolver.lookupNamespaceURI(prefix);
      }
    }
    return resolver;
  }
  XMLDocument.prototype.parseError = {errorCode:0, reason:'', url:''}
  XMLDocument.prototype.selectNodes = 
    Element.prototype.selectNodes = function(xpath) {
    var resolver, nodes, node, nodelist = [];
    try{resolver = (this.ownerDocument||this).namespacesResolver();
      nodes = this.evaluate(xpath,this,resolver,0,null);
      while(node = nodes.iterateNext())nodelist.push(node);
    }catch(e){}//exception if namespace not found|prefixed.
    return nodelist;
  }
  XMLDocument.prototype.selectSingleNode = 
    Element.prototype.selectSingleNode = function(xpath) {
    var nodes = this.selectNodes(xpath);
    if(nodes.length > 0)return nodes[0];
  }
  XMLDocument.prototype.setProperty = function(name, value) {
    this.setProperty.parseError = null;
    switch(name){
      case 'SelectionNamespaces':
        this.namespaces = {};
        try{
          var namespaces = value.replace(/\bxmlns:([^\s]*)\b/g,'$1').split(' ');
          for(var i = 0; i < namespaces.length; i++){
            var xmlns = namespaces[i].split('=');
            var prefix = xmlns[0], ns = xmlns[1];
            this.namespaces[prefix] = ns.slice(1,ns.length-1);
          }
          return true;
        }catch(e){
          this.setProperty.parseError = e;
          return false;
        }
      case 'SelectionLanguage':return (value=='XPath');
    }
    return false;
  }
}
//--{xml/namespaces}----------------------------------------------//
XML.NS = {
  atom: {
    '1.0': 'http://www.w3.org/2005/Atom',
    '0.3': 'http://purl.org/atom/ns#',
    toString: function() {return this['1.0']}
  },
  caml: {
    '2004': 'http://myschemas.com/CAML/2004',
    '2005': 'http://myschemas.com/caml/2005',
    toString: function() {return this['2005']}
  },
  dc:   'http://purl.org/dc/elements/1.1/',
  foaf: 'http://xmlns.com/foaf/0.1/',
  rdf:  'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
  rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
  soap: 'http://schemas.xmlsoap.org/soap/envelope/',
  xi:   'http://www.w3.org/2001/XInclude',
  xsi:  'http://www.w3.org/2001/XMLSchema-instance',
  xsd:  'http://www.w3.org/2001/XMLSchema',
  xsl: {
    '1.0': 'http://www.w3.org/1999/XSL/Transform',
    toString: function() {return this['1.0']}
  },
  xhtml: {
    '1.0': 'http://www.w3.org/1999/xhtml',
    '2.0': 'http://www.w3.org/2002/06/xhtml2',
    toString: function() {return this['1.0']}
  },
  xul:  'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul',
  toString: function() {
    var a = [];
    for(var ns in this)if(typeof this[ns] != 'function')
      a.push('xmlns:'+ ns +'="'+ this[ns] +'"');
    return a.join(' ');
  }
}
//--{xml/xpathQuery}----------------------------------------------//
if(typeof XML != 'undefined'){
  XML.lowerCase = 'abcdefghijklmnopqrstuvwxyz';
  XML.upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  XML.xpathQuery = function(element, attribute, searchstring, caseSensitive, exactMatch){
    var q = '//*[local-name() = "'+ element +'"]';
    var s = (caseSensitive == true ? searchstring : searchstring.toLowerCase());
    var a = (caseSensitive == true ? attribute : 'translate('+attribute+',"'+XML.upperCase+'","'+XML.lowerCase+'")');
    if(exactMatch == true)return q +'[starts-with('+ a +',"'+ s +'")]';
    if(s.indexOf(' ') == -1)return q + '[contains('+ a +',"'+ s +'")]';
    else{ // split into array of usable words
      var words=s.split(' '),i=0;q += '[';
      for(i=words.length-1;i>=0;i--){if(words[i].length==0)words.pop()}
      for(i=0;i<words.length;i++){q += 'contains('+a+',"'+words[i]+'")';if(i!=words.length-1)q+=' and ';}
      return q + ']';
    }
  }
}
//--{xml/xsl}-----------------------------------------------------//
function XSL(stylesheet){
  var o;
  try{o = new XSLTProcessor();o.importStylesheet(XML(stylesheet));}catch(e){
  try{o = new ActiveXObject(XML.MSXML.XSLTEMPLATE);o.stylesheet = XML(stylesheet);}catch(e){}}
  return {
    params: [],
    transform: function(input, params) {
      function add(param){
        if(param && param.constructor == XSL.Parameter){
          if(p.setParameter)p.setParameter('',param.name,param.value);
          else p.addParameter(param.name,param.value);
        }
      }
      if(!o)return XSL.NOT_SUPPORTED;
      var p = o.createProcessor ? o.createProcessor() : o;
      if(p.clearParameters)p.clearParameters();
      for(var i = 0; i < this.params.length; i++)add(this.params[i]);
      for(var i = 1; i < arguments.length; i++)add(arguments[i]);
      if(typeof p.transform != 'undefined'){
        p.input = XML(input);
        p.transform();
        return p.output.replace(/\r\n$/,''); // String
      }else{
        //var df = p.transformToFragment(XML(input),window.document);
        var doc = p.transformToDocument(XML(input));
        switch(doc.contentType){
          case 'text/html': return doc;
          case 'text/xml':  return doc.xml;
          default:          return doc.firstChild.firstChild.nodeValue;
        }
      }
    }
  }
}
XSL.NOT_SUPPORTED = '<Your browser does not support the XSLTProcessor object.>';
XSL.Parameter = function(name, value) {this.name = name;this.value = value;}