(function()
{
  var opera={};
  CSSRule.Selector=function()
  {
    this.matchType=''; // clean up
    this.text=''; // clean up
    this.lastSimpleSelector=null;
  }
  
  CSSRule.Selector.prototype.getSpecificity=function()
  {
    var ret=0, pointer=this.lastSimpleSelector, i=0;
    while(pointer)
    {
      ret+=pointer.getSpecificity();
      pointer=pointer.previous;
    }
    return ret;
  }
  
    /* 
    :visited
    :link
    :hover
    :active
    :focus
    :target
    :first-child
  pseudo elements
    ::first-line
    ::first-letter
    ::selection
    ::before
    ::after
  */
  
  CSSRule.SimpleSelectorSequence=function(previous)
  {
    this.typeSelector=null;
    this.universal=false;
    this.ns=null;
    this.classes=[];
    this.id=null;
    this.attributes=[];
    this.pseudoElement=null;
    this.pseudoClasses=[];
    this.combinator=null;
    this.previous=previous;
  }
  
  CSSRule.SimpleSelectorSequence.prototype.checkMatch=function(element)
  {
    var attr=null, _class='', classesEle=null, _classEle='', 
      childes=null, child=null, i=0, k=0;
  
    if(this.id && (this.id!=element.getAttribute('id')))
    {
      return false;
    }
    
    if(this.classes.length)
    {
      classesEle=element.getAttribute('class');
      if(!classesEle)
      {
        return false;
      }
      classesEle=classesEle.split(' ');
      outer: for(i=0; _class=this.classes[i]; i++)
      {
        for(k=0; _classEle=classesEle[k]; k++)
        {
          if(_class==_classEle)
          {
            continue outer;
          }
        }
        return false;
      }
    }
  
    if(this.typeSelector && (this.typeSelector.toLowerCase()!=element.nodeName.toLowerCase()))
    {
      return false;
    }
  
    // var ns=null;
    // if(this.ns && (ns=document.lookupNamespaceURI(this.ns)) && (ns!=element.namespaceURI))
  
    if(this.ns && (document.lookupNamespaceURI(this.ns)!=element.namespaceURI))
    {
      return false;
    }
  
    if(this.attributes.length)
    {
      for( i=0; attr=this.attributes[i]; i++)
      {
        if(!attr.checkMatch(element))
        {
          return false;
        }
      }
    }
  
    if(this.pseudoElement)
    {
      // TODO
    }
  
    if(this.pseudoClasses.length)
    {
      for(i=0; _class=this.pseudoClasses[i]; i++)
      {
        switch (_class)
        {
          case 'first-child':
          {
            childes=element.parentNode.childNodes;
            k=0;
            child=childes[k];
            while(child && (child.nodeType!=1))
            {
              child=childes[++k];
            }
            if((!child) || (child!=element))
            {
              return false;
            }
          }
          case 'link':
          case 'visited':
          {
            if(element.nodeName.toLowerCase()!='a')
            {
              return false;
            }
          }
        }
      }
    }
    return true;
  }
  
  CSSRule.SimpleSelectorSequence.prototype['s']=function(element)
  {
    var parentElement=null, array=[];
    while(parentElement=element.parentElement)
    {
      array[array.length]=(element=parentElement);
    }
    return array;
  }
  
  CSSRule.SimpleSelectorSequence.prototype['>']=function(element)
  {
    var parentElement=element.parentElement, array=[];
    if(parentElement)
    {
      array[array.length]=parentElement;
    }
    return array;
  }
  
  CSSRule.SimpleSelectorSequence.prototype['+']=function(element)
  {
    var previousSibling=element.previousSibling, array=[];
    while((element=previousSibling) && (previousSibling.nodeType!=1))
    {
      previousSibling=element.previousSibling;
    }
    if(previousSibling)
    {
      array[array.length]=previousSibling;
    }
    return array;
  }
  
  CSSRule.SimpleSelectorSequence.prototype['~']=function(element)
  {
    var parentElement=element.parentElement, childes=null, child=null, i=0, array=[];
    var passed=true;
    if(parentElement)
    {
      childes=parentElement.childNodes;
      for(; child=childes[i]; i++)
      {
        if(child==element)
        {
          passed=false;
        }
        if((child.nodeType==1) && passed)
        {
          array[array.length]=child;
        }
      }
    }
    return array;
  }
  
  CSSRule.SimpleSelectorSequence.prototype.getSpecificity=function()
  {
    var ret=0, _class='', i=0;
    if(this.id)
    {
      ret=100;
    }
    ret+=(this.classes.length*10+this.attributes.length*10);
    if(this.pseudoClasses)
    {
      for( ; _class=this.pseudoClasses[i]; i++)
      {
        switch(_class)
        {
          case 'visited':
          case 'link':
          case 'hover':
          case 'active':
          case 'focus':
          case 'target':
          case 'first-child':
          {
            ret+=10;
          }
        }
      }
    }
    if(this.typeSelector)
    {
      ret+=1;
    }
    return ret;
  }
  
  CSSRule.Attribute=function()
  {
    this.ns=this.key=this.match=this.value=null;
  }
  
  CSSRule.Attribute.prototype.checkMatch=function(element)
  {
    // this.ns todo
    var values=null, value=null, i=0, match=false;
  
    if(this.key && (!element.hasAttribute(this.key)))
    {
      return false;
    }
  
    if(this.match) // case sensitive?
    {
      value=element.getAttribute(this.key);
      switch (this.match)
      {
  
        case '^=':
        {
          if(value.indexOf(this.value)!=0)
          {
            return false;
          }
          break;
        }
  
        case '$=':
        {
          if(value.indexOf(this.value)+this.value.length!=value.length)
          {
            return false;
          }
          break;
        }
  
        case '*=':
        {
          if(value.indexOf(this.value)==-1)
          {
            return false;
          }
          break;
        }
  
        case '=': 
        {
          if(value!=this.value)
          {
            return false;
          }
          break;
        }
  
        case '~=':
        {
          values=value.split(' ');
          match=false;
          for(i=0 ; value=values[i]; i++)
          {
            if(value==this.value)
            { 
              match=true;
              break;
            }
          }
          if(!match)
          {
            return false;
          }
          break;
        }
  
        case '|=':
        {
          values=value.split('-');
          match=false;
          for(i=0 ; value=values[i]; i++)
          {
            if(value==this.value)
            { 
              match=true;
              break;
            }
          }
          if(!match)
          {
            return false;
          }
          break;
        }
  
      }
    }
    return true;
  }
  
  // no error handling
  CSSRule.selectorParser=new function()
  {
    this.parser=null;
    this.puffer='';
    this.puffer_2='';
    this.currentIdentifier=null;
    this.selectorGroups=[];
    this.selector=null;
    this.simpleSelectorSequence=null;
    this.attribute=null;
    this.stringLimiter='';
  
  
    this.resetSelector=function()
    {
      this.simpleSelectorSequence=null;
      this.selector=this.selectorGroups[this.selectorGroups.length]=new CSSRule.Selector();
    }
  
    this.resetSimpleSelectorSequence=function()
    {
      this.simpleSelectorSequence=
        this.selector.lastSimpleSelector=
        new CSSRule.SimpleSelectorSequence(this.simpleSelectorSequence);
    }
  
    this.evaluateSimpleSelector=function(simpleSelector, element)
    {
      var matches=null, match=null, i=0;
      if(simpleSelector.checkMatch(element))
      {
        if(!simpleSelector.combinator)
        {
          return true;
        }
        matches=simpleSelector[simpleSelector.combinator](element);
        for( ; match=matches[i]; i++)
        {
          if(this.evaluateSimpleSelector(simpleSelector.previous, match))
          {
            return true;
          }
        }
      }
      return false;
    }
  
    this.evaluateSelector=function(selector, element)
    {
      // selector is here a elemnent from selectorGroups
      var simpleSelectorSequence=null, k=0;
      var attrs='', pointer=null, i=0, ret=null;
      //opera.postError(this.evaluateSimpleSelector+'\n'+selector.lastSimpleSelector+'\n'+element);
      if(this.evaluateSimpleSelector(selector.lastSimpleSelector, element))
      {
        return {
          specificity: selector.getSpecificity(),
          states: [] /*
          matchType: 1,
          deepness: -1*/
        }
      }
      /*
      var currentSelection=CSSRule.SimpleSelectorSequence.prototype['s'](element);
      var pointer=null, i=0;
      for( ; pointer=currentSelection[i]; i++)
      {
        if(this.evaluateSimpleSelector(selector.lastSimpleSelector, pointer))
        {
          return {
            specificity: selector.getSpecificity(),
            matchType: 0,
            deepness: i
          }
        }
      }
      */
      return ret;
    }
  
    this.evaluateSelectorGroup=function(element)
    {
      var selector=null, i=0, ret=null, ret_2=null;
      for( ; selector=this.selectorGroups[i]; i++)
      {
        if(ret_2=this.evaluateSelector(selector, element))
        {
          if(!ret || (ret && (ret_2.specificity>ret.specificity)))
          {
            ret=ret_2;
          }
        }
      }
      return ret;
    }
  
    this.setCurrentIdentifier=function()
    {
      var s='';
      if(this.puffer)
      {
        switch(this.currentIdentifier)
        {
          case 'class':
          {
            (s=this.simpleSelectorSequence.classes)[s.length]=this.puffer;
            this.puffer='';
            this.currentIdentifier=null;
            break;
          }
          case 'pseudo-class':
          {
            switch(this.puffer)
            {
              case 'first-line':
              case 'first-letter':
              case 'selection':
              case 'before':
              case 'after':
              {
                this.simpleSelectorSequence.pseudoElement=this.puffer;
                this.puffer='';
                this.currentIdentifier=null;
                break;
              }
              default:
              {
                (s=this.simpleSelectorSequence.pseudoClasses)[s.length]=this.puffer;
                this.puffer='';
                this.currentIdentifier=null;
              }
            }
            break;
          }
          case 'id':
          {
            this.simpleSelectorSequence.id=this.puffer;
            this.puffer='';
            this.currentIdentifier=null;
            break;
          }
          case '|':
          {
            this.simpleSelectorSequence.id=this.puffer;
            this.puffer='';
            this.currentIdentifier=null;
            break;
          }
          case 'attribute-key':
          {
            this.attribute.key=this.puffer;
            this.puffer='';
            this.currentIdentifier=null;
            break;
          }
          case 'attribute-value':
          {
            this.attribute.value=this.puffer;
            this.puffer='';
            this.currentIdentifier=null;
            break;
          }
          default: // should be better
          {
            this.simpleSelectorSequence.typeSelector=this.puffer;
            this.puffer='';
            this.currentIdentifier=null;
            break;
          }
        }
      }
    }
  
    this.parseSimpleSequence=function(pos)
    {
      var s=null;
      switch(pos)
      {
        case '.':
        {
          this.setCurrentIdentifier();
          this.currentIdentifier='class';
          break;
        }
        case '#':
        {
          this.setCurrentIdentifier();
          this.currentIdentifier='id';
          break;
        }
        case '*':
        {
          this.simpleSelectorSequence.universal=true;
          this.setParser(this.parseUniversal);
          break;
        }
        case '|':
        {
          this.simpleSelectorSequence.ns=this.puffer;
          this.puffer='';
          break;
        }
        case '[':
        {
          this.setCurrentIdentifier();
          s=this.simpleSelectorSequence.attributes;
          this.attribute=s[s.length]=new CSSRule.Attribute();
          this.currentIdentifier='attribute-key';
          this.setParser(this.parseAttribute);
          break;
        }
        case ':':
        {
          this.setCurrentIdentifier();
          this.currentIdentifier='pseudo-class';
          this.setParser(this.parsePseudos);
          break;
        }
        case ',':
        {
          this.setCurrentIdentifier();
          this.resetSelector();
          this.resetSimpleSelectorSequence();
          this.setParser(this.parseCombinator);
          break;
        }
        case ' ':
        case '>':
        case '+':
        case '~':
        {
          this.setCurrentIdentifier();
          this.resetSimpleSelectorSequence();
          this.simpleSelectorSequence.combinator='s';
          this.setParser(this.parseCombinator);
          this.parser(pos);
          break;
        }
        default: // error checking
        {
          this.puffer+=pos;
        }
      }
    }
  
    this.parseCombinator=function(pos)
    {
      switch(pos)
      {
        case ' ':
        {
          break;
        }
        case '>':
        {
          this.simpleSelectorSequence.combinator='>';
          break;
        }
        case '+':
        {
          this.simpleSelectorSequence.combinator='+';
          break;
        }
        case '~':
        {
          this.simpleSelectorSequence.combinator='~';
          break;
        }
        default:
        {
          this.setParser(this.parseSimpleSequence);
          this.parser(pos);
        }
      }
    }
  
    this.parsePseudos=function(pos)
    {
      this.setParser(this.parseSimpleSequence);
      switch(pos)
      {
        case ':':
        {
          this.currentIdentifier='pseudo-element';
          break;
        }
        default:
        {
          this.parser(pos);
        }
      }
    }
  
    this.parseUniversal=function(pos)
    {
      switch(pos)
      {
        case '|':
        {
          this.simpleSelectorSequence.universal=false;
          this.simpleSelectorSequence.ns='*';
          break;
        }
        default:
        {
          this.setParser(this.parseSimpleSequence);
          this.parser(pos);
        }
      }
    }
  
    this.parseAttribute=function(pos)
    {
      switch(pos)
      {
        case '|':
        {
          this.setParser(this.parseAttributeDashMatch);
          break;
        }
        case ']':
        {
          this.setCurrentIdentifier();
          this.setParser(this.parseSimpleSequence);
          break;
        }
        case ' ':
        {
          break;
        }
        case '*':
        {
          this.setParser(this.parseAttributeUniversal);
          break;
        }
        case '=':
        {
          this.setCurrentIdentifier();
          this.puffer='';
          this.attribute.match=pos;
          this.currentIdentifier='attribute-value';
          this.setParser(this.parseAttributeValue);
          break;
        }
        case '^':
        case '$':
        case '~':
        case '^':
        {
          this.setCurrentIdentifier();
          this.puffer=pos;          
          this.setParser(this.parseAttributeMatch);
          break;
        }
        default:
        {
          this.puffer+=pos;
        }
      }
    }
  
    this.parseAttributeUniversal=function(pos)
    {
      switch (pos)
      {
        case '|':
        {
          this.attribute.ns='*';
          this.puffer='';
          this.setParser(this.parseAttribute);
          break;
        }
        case '=':
        {
          this.setCurrentIdentifier();
          this.puffer='';
          this.attribute.match='*=';
          this.currentIdentifier='attribute-value';
          this.setParser(this.parseAttributeValue);
          break;
        }
        default:
        {
          // error handling;
        }
      }
    }
  
    this.parseAttributeMatch=function(pos)
    {
      switch(pos)
      {
        case '=':
        {
          this.attribute.match=this.puffer+pos;
          this.puffer='';
          this.currentIdentifier='attribute-value';
          this.setParser(this.parseAttributeValue);
          break;
        }
        default:
        {
          // error handling
        }
      }
    }
    
    this.parseAttributeDashMatch=function(pos)
    {
      switch(pos)
      {
        case '=':
        {
          this.setCurrentIdentifier();
          this.attribute.match='|=';
          this.puffer='';
          this.currentIdentifier='attribute-value';
          this.setParser(this.parseAttributeValue);
          break;
        }
        default:
        {
          this.attribute.ns=this.puffer;
          this.puffer='';
          this.setParser(this.parseAttribute);
          this.parser(pos);
        }
      }
    }
  
    this.parseAttributeValue=function(pos)
    {
      switch(pos)
      {
        case '"':
        case '\'':
        {
          this.stringLimiter=pos;
          this.setParser(this.parseAttributeStringValue);
        }
        case ' ':
        {
          break;
        }
        case ']':
        {
          this.setCurrentIdentifier();
          this.setParser(this.parseSimpleSequence);
          break;
        }
        default:
        {
          this.puffer+=pos;
        }
      }
    }
  
    this.parseAttributeStringValue=function(pos)
    {
      switch ((pos))
      {
        case this.stringLimiter:
        {
          this.puffer_2=pos;
          this.setParser(this.parseEscape);
          break;
        }
        case '\\': // does not exist
        {
          this.setParser(this.parseEscape);
          break;
        }
        default:
        {
          this.puffer+=pos;
        }
      }
    }
  
    this.parseEscape=function(pos)
    {
      switch ((pos))
      {
        case ' ':
        {
          this.puffer_2+=pos;
          break;
        }
        case ']':
        {
          this.setCurrentIdentifier();
          this.setParser(this.parseSimpleSequence);
          break;
        }
        case this.stringLimiter:
        {
          this.puffer+=this.puffer_2;
          this.puffer_2=pos;
          break;
        }
        default:
        {
          this.puffer+=this.puffer_2+pos;
          this.puffer_2='';
          this.setParser(this.parseAttributeStringValue);
          break;
        }
      }
    }
  
    this.setParser=function(parser)
    {
      this.parser=parser;
    }
  
    this.setSelectorGroups=function(selectorGroups)
    {
      this.selectorGroups=selectorGroups;
    }
  
    this.clear=function()
    {
      this.parser=null;
      this.puffer='';
      this.puffer_2='';
      this.currentIdentifier=null;
      this.selectorGroups=[];
      this.selector=null;
      this.simpleSelectorSequence=null;
      this.attribute=null;
      this.stringLimiter='';
    }
  
    this.parseSelector=function(selectorText)
    {
      var __selector=new String(selectorText), pos='', i=0;
      this.selectorGroups=[];
      this.resetSelector();
      this.resetSimpleSelectorSequence();
      this.currentIdentifier=null;
      this.setParser(this.parseSimpleSequence);
      for( ; pos=__selector.charAt(i); i++)
      {
        this.parser(pos);
      }
      this.setCurrentIdentifier();
      return this.selectorGroups;
    }
  
    this.checkElement=function(element)
    {
      return this.evaluateSelectorGroup(element);
    }
  
    this.parse=function(element, selectorText)
    {
      this.parseSelector(selectorText);
      return this.evaluateSelectorGroup(element);
    }
  }
  

  
  opera.tools={};
  opera.tools.__revision='$Rev: 2520 $';
  opera.tools.__author='$Author: chrisk $';
  opera.tools.__date='$Date: 2007-03-06 16:13:12 +0100 (Di, 06 Mrz 2007) $';
  
  opera.tools.filters=new function()
  {
  	this.cssProperies=[
      ['background', '0px 0px'],
      ['background-attachment', 'scroll'],
      ['background-color', 'transparent'],
      ['background-image', 'none'],
      ['background-position', '0px 0px'],
      ['background-repeat', 'repeat'],
      ['border', '0px #000000'],
      ['border-bottom', '0px #000000'],
      ['border-bottom-color', '#000000'],
      ['border-bottom-style', 'none'],
      ['border-bottom-width', '0px'],
      ['border-collapse', 'separate'],
      ['border-color', '#000000'],
      ['border-left', '0px #000000'],
      ['border-left-color', '#000000'],
      ['border-left-style', 'none'],
      ['border-left-width', '0px'],
      ['border-right', '0px #000000'],
      ['border-right-color', '#000000'],
      ['border-right-style', 'none'],
      ['border-right-width', '0px'],
      ['border-spacing', '0px'],
      ['border-style', 'none'],
      ['border-top', '0px #000000'],
      ['border-top-color', '#000000'],
      ['border-top-style', 'none'],
      ['border-top-width', '0px'],
      ['border-width', '0px'],
      ['bottom', ''],
      ['caption-side', 'top'],
      ['clear', 'none'],
      ['clip', 'rect(0px, 0px, 0px, 0px)'],
      ['color', '#000000'],
      ['content', 'none'],
      ['counter-increment', 'none'],
      ['counter-reset', 'none'],
      ['css-float', ''],
      ['css-text', ''],
      ['cursor', 'default'],
      ['direction', 'ltr'],
      ['display', 'inline'],
      ['empty-cells', 'show'],
      ['font', 'normal normal 400 16px/normal "Times New Roman"'],
      ['font-family', '"Times New Roman"'],
      ['font-size', '16px'],
      ['font-size-adjust', 'none'],
      ['font-stretch', 'normal'],
      ['font-style', 'normal'],
      ['font-variant', 'normal'],
      ['font-weight', '400'],
      ['height', ''],
      ['left', ''],
      ['length', ''],
      ['letter-spacing', '0px'],
      ['line-height', 'normal'],
      ['list-style', 'disc outside none'],
      ['list-style-image', 'none'],
      ['list-style-position', 'outside'],
      ['list-style-type', 'disc'],
      ['margin', '0px'],
      ['margin-bottom', '0px'],
      ['margin-left', '0px'],
      ['margin-right', '0px'],
      ['margin-top', '0px'],
      ['marker-offset', ''],
      ['marks', 'none'],
      ['max-height', '-1px'],
      ['max-width', '-1px'],
      ['min-height', '0px'],
      ['min-width', '0px'],
      ['op-phonemes', ''],
      ['op-voice-pitch', ''],
      ['op-voice-pitch-range', ''],
      ['op-voice-rate', ''],
      ['op-voice-stress', ''],
      ['op-voice-volume', ''],
      ['opacity', '1'],
      ['orphans', '2'],
      ['outline', '3px'],
      ['outline-color', 'invert'],
      ['outline-style', 'none'],
      ['outline-width', '3px'],
      ['overflow', 'visible'],
      ['padding', '0px'],
      ['padding-bottom', '0px'],
      ['padding-left', '0px'],
      ['padding-right', '0px'],
      ['padding-top', '0px'],
      ['page', 'auto'],
      ['page-break-after', 'auto'],
      ['page-break-before', 'auto'],
      ['page-break-inside', 'auto'],
      ['pause', ''],
      ['pause-after', ''],
      ['pause-before', ''],
      ['pitch-range', ''],
      ['pixel-bottom', ''],
      ['pixel-height', ''],
      ['pixel-left', ''],
      ['pixel-right', ''],
      ['pixel-top', ''],
      ['pixel-width', ''],
      ['pos-bottom', ''],
      ['pos-height', ''],
      ['pos-left', ''],
      ['pos-right', ''],
      ['pos-top', ''],
      ['pos-width', ''],
      ['position', 'static'],
      ['quotes', 'none'],
      ['right', ''],
      ['size', 'portrait'],
      ['speak', ''],
      ['speech-rate', ''],
      ['style-float', ''],
      ['table-layout', 'auto'],
      ['text-align', 'left'],
      ['text-decoration', 'none'],
      ['text-indent', '0px'],
      ['text-shadow', ''],
      ['text-transform', 'none'],
      ['top', ''],
      ['unicode-bidi', 'normal'],
      ['vertical-align', 'baseline'],
      ['visibility', 'visible'],
      ['voice-family', ''],
      ['volume', ''],
      ['white-space', 'normal'],
      ['widows', '2'],
      ['width', ''],
      ['word-spacing', '0px'],
      ['z-index', 'auto']
  	];
  
    this.inheritedDeclarations={
      'azimuth': 1,
      'border-collapse': 1,
      'border-spacing': 1,
      'caption-side': 1,
      'color': 1,
      'cursor': 1,
      'direction': 1,
      'elevation': 1,
      'empty-cells': 1,
      'font-family': 1,
      'font-size': 1,
      'font-style': 1,
      'font-variant': 1,
      'font-weight': 1,
      'font': 1,
      'letter-spacing': 1,
      'line-height': 1,
      'list-style-image': 1,
      'list-style-position': 1,
      'list-style-type': 1,
      'list-style': 1,
      'orphans': 1,
      'page-break-inside': 1,
      'pitch-range': 1,
      'pitch': 1,
      'quotes': 1,
      'richness': 1,
      'speak-header': 1,
      'speak-numeral': 1,
      'speak-punctuation': 1,
      'speak': 1,
      'speech-rate': 1,
      'stress': 1,
      'text-align': 1,
      'text-indent': 1,
      'text-transform': 1,
      'visibility': 1,
      'voice-family': 1,
      'volume': 1,
      'white-space': 1,
      'widows': 1,
      'word-spacing': 1
    }
  
    this.windowFilter={
      open: 1,
      print: 1,
      stop: 1,
      getComputedStyle: 1,
      home: 1,
      getSelection: 1,
      setDocument: 1,
      releaseEvents: 1,
      enableExternalCapture: 1,
      disableExternalCapture: 1,
      captureEvents: 1,
      dispatchEvent: 1,
      alert: 1,
      confirm: 1,
      prompt: 1,
      setTimeout: 1,
      setInterval: 1,
      addEventStream: 1,
      removeEventStream: 1,
      clearInterval: 1,
      clearTimeout: 1,
      back: 1,
      forward: 1,
      attachEvent: 1,
      detachEvent: 1,
      addEventListener: 1,
      removeEventListener: 1,
      navigate: 1,
      DOMParser: 1,
      XMLHttpRequest: 1,
      XMLSerializer: 1,
      XSLTProcessor: 1,
      opera: 1,
      Image: 1,
      Option: 1,
      frames: 1,
      Audio: 1,
      CSSPrimitiveValue: 1,
      SVGLength: 1,
      SVGAngle: 1,
      SVGTransform: 1,
      SVGPaint: 1,
      SVGPreserveAspectRatio: 1,
      SVGPathSeg: 1,
      SVGUnitTypes: 1,
      SVGZoomAndPan: 1,
      java: 1,
      netscape: 1,
      sun: 1,
      Packages: 1,
      VXMLAudioRecording: 1,
      closed: 1,
      defaultStatus: 1,
      document: 1,
      event: 1,
      frameElement: 1,
      history: 1,
      innerHeight: 1,
      innerWidth: 1,
      length: 1,
      location: 1,
      name: 1,
      navigator: 1,
      opener: 1,
      outerHeight: 1,
      outerWidth: 1,
      pageXOffset: 1,
      pageYOffset: 1,
      parent: 1,
      screen: 1,
      screenLeft: 1,
      screenTop: 1,
      screenX: 1,
      screenY: 1,
      self: 1,
      status: 1,
      top: 1,
      window: 1
    }
  
    this.documentFilter={
      URL: 1,
      activeElement: 1,
      alinkColor: 1,
      all: 1,
      anchors: 1,
      applets: 1,
      async: 1,
      attributes: 1,
      bgColor: 1,
      body: 1,
      characterSet: 1,
      charset: 1,
      childNodes: 1,
      compatMode: 1,
      cookie: 1,
      defaultView: 1,
      designMode: 1,
      dir: 1,
      doctype: 1,
      document: 1,
      documentElement: 1,
      documentURI: 1,
      domain: 1,
      embeds: 1,
      fgColor: 1,
      firstChild: 1,
      forms: 1,
      frames: 1,
      images: 1,
      implementation: 1,
      lastChild: 1,
      lastModified: 1,
      linkColor: 1,
      links: 1,
      localName: 1,
      location: 1,
      namespaceURI: 1,
      nextSibling: 1,
      nodeName: 1,
      nodeType: 1,
      nodeValue: 1,
      ownerDocument: 1,
      parentNode: 1,
      parentWindow: 1,
      plugins: 1,
      prefix: 1,
      previousSibling: 1,
      readyState: 1,
      referrer: 1,
      scripts: 1,
      selection: 1,
      styleSheets: 1,
      text: 1,
      textContent: 1,
      title: 1,
      vlinkColor: 1,
      length: 1,
      onload: 1,
      onunload: 1,
      open: 1,
      clear: 1,
      close: 1,
      getElementsByName: 1,
      elementFromPoint: 1,
      captureEvents: 1,
      releaseEvents: 1,
      getSelection: 1,
      write: 1,
      writeln: 1,
      createDocumentFragment: 1,
      createEvent: 1,
      createRange: 1,
      createProcessingInstruction: 1,
      importNode: 1,
      adoptNode: 1,
      getElementById: 1,
      createNSResolver: 1,
      postMessage: 1,
      load: 1,
      createElement: 1,
      createElementNS: 1,
      createAttribute: 1,
      createAttributeNS: 1,
      createTextNode: 1,
      createComment: 1,
      createCDATASection: 1,
      createNodeIterator: 1,
      createTreeWalker: 1,
      getElementsByTagName: 1,
      getElementsByTagNameNS: 1,
      execCommand: 1,
      queryCommandEnabled: 1,
      queryCommandState: 1,
      queryCommandSupported: 1,
      queryCommandValue: 1,
      createExpression: 1,
      evaluate: 1,
      dispatchEvent: 1,
      insertBefore: 1,
      replaceChild: 1,
      removeChild: 1,
      appendChild: 1,
      hasChildNodes: 1,
      cloneNode: 1,
      normalize: 1,
      isSupported: 1,
      hasAttributes: 1,
      getFeature: 1,
      addEventListener: 1,
      removeEventListener: 1,
      attachEvent: 1,
      detachEvent: 1,
      lookupPrefix: 1,
      isDefaultNamespace: 1,
      lookupNamespaceURI: 1,
      selectNodes: 1,
      selectSingleNode: 1
    }
  
    this.nodeFilter={
      all: 1,
      attributes: 1,
      childNodes: 1,
      children: 1,
      className: 1,
      clientHeight: 1,
      clientLeft: 1,
      clientTop: 1,
      clientWidth: 1,
      contentEditable: 1,
      currentStyle: 1,
      dir: 1,
      document: 1,
      firstChild: 1,
      id: 1,
      innerHTML: 1,
      innerText: 1,
      isContentEditable: 1,
      lang: 1,
      lastChild: 1,
      localName: 1,
      namespaceURI: 1,
      nextSibling: 1,
      nodeName: 1,
      nodeType: 1,
      nodeValue: 1,
      offsetHeight: 1,
      offsetLeft: 1,
      offsetParent: 1,
      offsetTop: 1,
      offsetWidth: 1,
      outerHTML: 1,
      outerText: 1,
      ownerDocument: 1,
      parentElement: 1,
      parentNode: 1,
      prefix: 1,
      previousSibling: 1,
      repeatMax: 1,
      repeatMin: 1,
      repeatStart: 1,
      repetitionBlocks: 1,
      repetitionIndex: 1,
      repetitionTemplate: 1,
      repetitionType: 1,
      scrollHeight: 1,
      scrollLeft: 1,
      scrollTop: 1,
      scrollWidth: 1,
      sourceIndex: 1,
      style: 1,
      tagName: 1,
      text: 1,
      textContent: 1,
      title: 1,
      unselectable: 1,
      onclick: 1,
      onmousedown: 1,
      onmouseup: 1,
      onmouseover: 1,
      onmousemove: 1,
      onmouseout: 1,
      onkeypress: 1,
      onkeydown: 1,
      onkeyup: 1,
      onload: 1,
      onunload: 1,
      onfocus: 1,
      onblur: 1,
      ondblclick: 1,
      blur: 1,
      toString: 1,
      removeNode: 1,
      focus: 1,
      insertAdjacentElement: 1,
      insertAdjacentHTML: 1,
      insertAdjacentText: 1,
      addRepetitionBlock: 1,
      addRepetitionBlockByIndex: 1,
      moveRepetitionBlock: 1,
      removeRepetitionBlock: 1,
      removeAttributeNode: 1,
      contains: 1,
      scrollIntoView: 1,
      getAttribute: 1,
      getAttributeNS: 1,
      hasAttribute: 1,
      hasAttributeNS: 1,
      setAttribute: 1,
      setAttributeNS: 1,
      removeAttribute: 1,
      removeAttributeNS: 1,
      getAttributeNode: 1,
      getAttributeNodeNS: 1,
      setAttributeNode: 1,
      setAttributeNodeNS: 1,
      getElementsByTagName: 1,
      getElementsByTagNameNS: 1,
      dispatchEvent: 1,
      insertBefore: 1,
      replaceChild: 1,
      removeChild: 1,
      appendChild: 1,
      hasChildNodes: 1,
      cloneNode: 1,
      normalize: 1,
      isSupported: 1,
      hasAttributes: 1,
      getFeature: 1,
      addEventListener: 1,
      removeEventListener: 1,
      attachEvent: 1,
      detachEvent: 1,
      lookupPrefix: 1,
      isDefaultNamespace: 1,
      lookupNamespaceURI: 1,
      selectNodes: 1,
      selectSingleNode: 1
    }
  
    this.notAccessible=
    {
      Packages: 1,
      java: 1,
      netscape: 1,
      sun: 1
    }
  }
  

  opera.tools.templates=new function()
  {
    this.header=function(icon_src)
    {
      return ['div',
          ['img', 'src', icon_src], 
          ['h1', document.title, 'id', 'header_doc_title'],
          ['h2', location.protocol+'//'+location.host+location.pathname, 'id', 'header_location'],
        'class', 'toolHeader']
    }
  }
  

  opera.tools.styleSheet="@charset 'utf-8';/* Name: Dev Console	 Copyright 2007 Opera Software *//* Common style for all tools */body {  padding:0px;  margin:0;  font-size: 0.7em;  color:#000;}* {font-family: tahoma, sans-serif; font-size: 1em} /* optmize if time */.dom_view, .js_view  {overflow: hidden !important} /* WORKAROUND */a{color:#324c74; text-decoration:none}a:hover{text-decoration:underline}ul, li  {  padding:0;  margin:0;  list-style:none;}li{line-height:1.5em}/* SELECT WHICH FRAME TO WORK ON */.activeWindowDropDown {  margin: 2px;  text-align:right;}.activeWindowDropDown select {width: 100px}#toolTabs {  background: #fff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAXCAIAAABF%2BLJYAAAARUlEQVR4Xh3I0RGAIAwE0R1smp7oyS40EOEi5OPN3SwRgUIsbWsx59y%2Bcrq7M3wwese6YfaeXiTlJuKqteaHbLTWsOf%2BAd8pPoqcW5FrAAAAAElFTkSuQmCC')0 0 repeat-x;  overflow: hidden;}#toolTabs ul{  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF0AAAANCAIAAABEnfVjAAAEA0lEQVR4XuWUT28aZxDGt6p7rASn5lSxpxwLvTUnL5%2FAkH4AY%2FoBQta3RjIQ6KU9BIQrWWqk4JhbfSDC6SlWg2qOUVsH0rRJMGCD%2FK8G%2F41aKfSnfdRXClYuVogqdTx69cwzzzszO97F%2Buv%2FbbZtW5Z1np94cfny380mOewD2%2F7w86v%2B2dn3%2FX7rQnZwcHDjyxvLy8vgcDic%2FSqrxmOySx9dmv923u%2FzP1h9kM1mL1xnyN%2FrNsFS2ILfdV%2F1%2By8fPfrz62%2BOvl%2F%2BuFaDvMBSPrtypdlsfhGPE353%2B%2Fbq6uqTRoPy1hiM7dMxPOmoafZm5uK1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FK3lavueScqo1xL9S33pWZXv99%2BwcMXEDbsSaWbAAAAABJRU5ErkJggg%3D%3D') 5px 5px no-repeat;   height: 23px;}#toolTabs li {  float: right;  margin: 1px 1px 0 0;  text-align: center;  cursor: pointer;  padding-top: 3px;  height: 19px;  width: 33px;  color: #666;  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAsCAYAAADretGxAAABe0lEQVR4Xu2WzU7CQBSFz5QWgaWJJo0FpNDg3rcwLnkAExMTnoite3gQXkAXNkEI7FyDpj9znZuJkhi37WUxpzmrLubruTPTo4gI0vKNsVgszgFMjR%2BNB6he78bPxjPjDzWfz688z9sNh0P0ej20221Urf1%2Bj%2B12i9VqBa117HMCSZJgNBqhLEtkWYaqRxQEAeI4hlIKaZpOGeIpiiLkec5UqEG%2FHxmGIUM8MMSF7%2FsoigJ1ixMBr%2F9DxpbSXwgHwZvSJcEpsN04%2Fk3CnQ6XhIOAlTzEcrmEpFzRNZ5NJpNj0U2SAa77ETqdFqoV4XD4xGazw1u6htZki%2B7NOMZ4PADpHLo8ACBUqdaZMut10WgQXl7Xtuj2%2ByG0zkBUoB4RQArd7iVD2KLbbHqcgn1Zo5pB41h0Qdq4FL4x7SMLYceghSFIg0gYwqYgvSdOIQkCyUOASrY0BAHy49Bs%2BSMqP47TSIKs5f8dp3BjkjgEseUg7u9ukX3tICVe%2Fxvb1ABx%2BOPUiAAAAABJRU5ErkJggg%3D%3D') 0 0 no-repeat;}#toolTabs li:hover, #toolTabs li.selected {  color: black;  padding-top: 2px; height: 20px;  background-position: 0 100%}.toolHeader{  background: #e0d787 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAtCAIAAADgGZaTAAAAcUlEQVR4Xk2NzQqDMBCEhzy%2FIPTSgweh1168efYxFEVMMGkpofgCmSa7FHIY9me%2BncUVJwMgiyrSENAK1nt836N6SBVLxDAoS2Hx8U%2F1mIRlSnjZh2SEozfIs9%2B74uPc7uVGerfehHFLK7l2bv4%2F6vwfcbBUoN1TOe0AAAAASUVORK5CYII%3D') 0 0 repeat-x;  border-bottom: 1px solid #bab673;  padding: 5px;}.toolHeader img {float: left}.toolHeader h1, .toolHeader h2{  margin: 0px 0px 0px 45px;  padding: 0;}.dom_view   .toolHeader img {content:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFDklEQVR4XrWXSUs0SRCGo7Xd9x3EHzEDLrjgRRA9ODI4N0%2BijAwiHgQRPPgbREQcHLx48ORhdBQ3FHdEGMSTBy8ieHC33W2tyScx%2FKotSy9jQlH9VmbEGxH5ZlR14OHhQeLi4kpF5A9z1ZgrR753nJnrH3MNGu6NgIj8lJCQ8O%2FAwIBUV1dLXl6eMF5eXoQRFRX1v%2BKLiwuZmpqS9vZ2ub6%2B%2FpkAhgz57y0tLRIIAEUcx%2BHmxvyOwDp81n%2BJh4eHpa2t7c%2Bgwb%2FW19czaaO7ubkRRnx8vH32%2BPgo0dHRYqpks3l6ehIGz56fn%2BXu7o7s2EZh3N%2Ffq%2F2HOBwOS25urjQ0NBDAb4TkQMI4PDyMWMzzYDAop6en0tzcbAPUTNLS0mRoaIgtIxiy%2BpJccUFBgTBiY2OFCuge2SsxMdHi29tbzdySb25u2mx18LykpERmZ2epilbObf8pVk0EFWik%2FIZIsW7NrSEIXYdEnIBIwNzMusvLS%2BbJjAoQlNveFyufBoAx%2B8vdE6luz4uZC4df4BZHHLBqBIcE67H3w1lZWfD9CECBljEpKUnLRtR2K2zkz2FR%2FYOx484axPXO3g8rH8OrARZzZzEC5MrIyJDk5GSTAaULCAOcnp7OvK1CKBRSMrX3w%2F4a0DK5jyIC6%2Bvrk5qaGrLkGXsOMadAM6dKOH8vYPzRcJQc7KsBT6Scc3B2draMjY1Z0sLCQllfX2c98zhXcu5UA2LWMk9l8E9y6p8%2B8LEGWKzldUeOMY7JbGlpSRsKGCFau8bGRjk%2FP7ek2if6%2B%2FsRnJ4u%2FPlrAEMWpaS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ABEMLDzuAAMGeFSjlJyqI8QcpmSkkIL8hsaPCfs8EOH8oC83Nxc1ycDhIhYYQ%2BtCToBZvLHPV6iCOUUITv1wBlT8lvy0HdnDYRZKmbuVAN4Sb4%2FffqkcYxSipP%2Bdxy4xXPhgRpAMER4ihG0FHsoDg0K8IJWpM2ICoqVY%2BU8yB%2BOS194BFQDshzvwKWcymbo8O3X0NAA7q9ge3s7xUca8AoDxS95ARz6W2uAPgfwTso1jilAPH%2F16pWeVHZCSv7lqd4O8QfkSZ9AE0FhkaUYI1zf8zxGRAAv9TTDxzn3Af67cOlTBISEEQOhntBSWVlZrrS1tRWvOOczjegQDc700SL%2B2%2BShLxgB1QDM7AqbhNHvFCELZdDn5OSw%2B8R7%2BvSpAUH%2BIC59MmBLMxpPbiPGchi4pw1fvHihB0VzgN94%2Bj3lOIAsvQu7fJa0tbS0VL1%2F%2F54Delo5Eq7xS6Hp1dQ93uuMNFEPAf7b8I6ODv4f%2Fg32ub6%2BvgqrSktL6dUAMe2FkhDht%2BJBZUEcz%2Fmkb2xsNHRH3FQvraS%2F56UMP%2FuxwKDoQvnNEPv6L2WDOjRihNLtAAAAAElFTkSuQmCC')}/* Generic input elements */input[type=button] {margin-left: 4px; cursor: pointer}.selected {cursor: default !important}h1, h2 {  padding:0;  margin:0;  font-weight:normal;}.headerBar {  background: #f6f6f6;  border-top: 1px solid #fff;  border-bottom: 1px solid #ddd;  padding: 0 2px;}h1 {  font-size:1.3em;  margin:.5em 0;}h2 {  font-size: 1em;  line-height:1.5em;  padding:0 .5em;}/* PropertyList custom control */ul.propertyList{  display:table;  table-layout:fixed;  margin:0;  width:100%;}.propertyList li{display:table-row}.propertyList .key, .propertyList .value{  display:table-cell;  border-top: 1px solid #fff;  border-bottom: 1px solid #ddd;  overflow: hidden;  margin-bottom: 5px;  padding: 1px 2px;  background: #fff;}.propertyList .key{  text-align:right;  width: 110px;  max-width: 120px;  background: #f3f3f3;  border-right: 1px solid #ddd;}.propertyList .inputText, ul.propertyList select {  border: 1px solid #fff;  background: #fff;  width: 100%;}.propertyList select:hover, .propertyList .inputText:hover {background-color: #eee; outline: 1px solid #bbb}.propertyList select:focus, .propertyList .inputText:focus {background-color: #fff; outline: 1px solid #666}.propertyList .selectedAttribute {border: 1px solid black !important}/* DOM CONSOLE SPECIFICS */#separator {  position:absolute;  height:5px;  left:0;  right:0;  top:600px;  cursor:n-resize;}/* Tree custom control */#tree{  padding-left:10px;  overflow:auto;  position:relative;}.node {  padding: 1px 0 0px 14px;  background: transparent url('data:image/gif,GIF89a%01%00%02%00%91%00%00%00%00%00%FF%FF%FFfff%FF%FF%FF!%F9%04%01%00%00%03%00%2C%00%00%00%00%01%00%02%00%00%02%02T%0A%00%3B') 0 0 scroll repeat-y;  position:relative;  z-index: 10;}/* Stopping dotted lines when the child does not have any further sibling nodes */ .node.last {background:#fff}/* Removing dotted lines and hover effects for the first node */.node:first-child {background-image: url('')}.node:first-child > .headLine h2:hover {background-color: #fff; color: #000; cursor: default;}.toggle {  float:left;  height:11px;  margin-top: 3px;  margin-left: -5px;  margin-right: 1px;  width:11px;  background: transparent url('data:image/gif,GIF89a%0B%00!%00%A2%00%00%00%00%00%FF%FF%FF%CC%CC%CCfff%FF%FF%FF%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%04%00%2C%00%00%00%00%0B%00!%00%00%03%3D(%BA%AC%F1%10%3A8%E2%7CU%8A%98%9F%1B%60X%5DA%17%90%26jm%D1%DA%BC0%D3%AE%B3V%7Bl%FD%89%E0%99%CF%A4V%90v%8B1%08%C8%A4r%C9l%3A%9FPfi%1A%ADZ%AF%CB%04%00%3B') scroll no-repeat 0 0;}span.toggle.open {background-position:0 -11px}.headLine {  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAABCAIAAABhfAhTAAAAGklEQVR4Xo3EMQEAAAzDoKnFv4PMQh%2BuwuIDiL4dSrptHmkAAAAASUVORK5CYII%3D') scroll no-repeat 1px 8px ;  margin-left:-14px;  white-space: nowrap;  min-width: 80px;}.last > .headLine:first-child {  background:transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAZCAIAAAD8NuoTAAAAOElEQVR4Xu3QsQ0AMAgDQab1%2FhuQFahQhM6F69dVD5akd1f95WjRokWLFq1k%2Fre1lidLlixZsmQ9PQN%2FE2KyvyUAAAAASUVORK5CYII%3D') scroll no-repeat -12px -4px ;}.headLine h2 {  padding-left: 17px;  height: 17px;  margin-left: 7px;  overflow: hidden;  white-space: nowrap;  -o-text-overflow: ellipsis;  cursor: pointer;  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAD2SURBVHjaYszLdOZ78fLjpKfPP9gz4ADSkgIHJcT581hACleu3h3P8Ps0A07AaqoQHurKwAI28dcBhq9f3jH8%2F%2F%2BfgZGREU7DADfPVwaQOiYw7%2F9Phj9%2F%2FjD8%2FfuXwcktBU7DxEDyIABW%2FO%2FfP7CEq2cGw7ZNU8BsEA3i%2F%2F79GyyPotjDJ4dh8%2FoJYIUwvGldP1gcbDpMMYizfnU3g7d%2FAdgkGPYJKASLY5gMMmn18jYG%2F6BSsEIQDeIjO4MFphgkCAqFFUubwBpBNEgMFCpwxaAA5xawUpD4dwQSMGjBBuID5cERwwKKmfDwWAb8MTgLHIMAAQYAMl%2Bx7YLkibsAAAAASUVORK5CYII%3D') 2px 50% no-repeat;}.node h2:hover {background-color: #324c74; color: #fff}.toggle + h2 {margin-left: 0px} /* INDENTING ICONS PROPERLY */.text .headLine h2 {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAA1ElEQVR4XpWRQYqDQBBFf0AIrj1RjmE7u5ljzcaQ6TmG%2B%2B5zeIJMxkVXV6WqNYkILlJQ%2FA%2F%2F1UfaA4Cj7ofuCfsz6F4M%2FiSi72madsm6rlFV1Vdljf%2B3G65%2FV0D01s5FigoAM8LFnQwGa0jE6JyDQLAe%2F%2Bs15%2BJnmBmZEvpzv3TheUKJNN%2FASWHnnKGv1h9flPMKzjkjJULfn7EeKyg5520zoWtbyOZDvPclf8xlHEeJMUgIUTVKUG8ag3pVy42z5qFpmm6%2BluX5xNrnbhFoDuPe%2BoN3a0OIdc2uXCYAAAAASUVORK5CYII%3D')}.root > .headLine > h2 {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAA8ElEQVR4Xn2RsUoDQRCG%2F00uVUJMt3vYCAnRB9DGJoX4AgG9KqS2ySPcwT2CpVVSio%2BQJtaWQpT0omlEIVfkdvc2zIALxyV%2Bze7sfPwsM2Jyd9X%2BWv%2Fef3z%2BDHCA47DzrOTRRNwOz6ePT%2FMx9AsO0rhAdHM9CzgxXyDbfMM5ByGEP%2F9otjKQF4BwWxhjkCQJ3ldrL531JdI05T7BclEULL8uSfRwrbWmflU2GiUKB5attV6mgh9zjQoUsje5e1LH28p68bQn9n6DH%2BM4Lk3BOVdKrtHAm51LKKUQhiGklHQv1dQnL6DNRNEI%2F2%2FwgTe4AwnXiNowcWDZAAAAAElFTkSuQmCC')}.comment .headLine h2 {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAA%2B0lEQVR4Xo1RPUsDQRScDVcIQuJHoZDGH5EijQpKeiuvVLA7QiBcYRsrJZAEUkiaiJb5EwE7%2F0jA5qJyEb3s3W32DQcrQiADx7zHzJvdvacuzlvl%2Bdf7MPqcnWIN9neqr3uVw5Y6qV0%2BT98mV7%2FfWIutbeCs7r%2BUJPEnBhYfQBz9ZfeJLj4PFiYHUg2EN48Q9MYBwmvW6D8FohMlWOS2ybRwju4okFqYfbqkTng0Z0yGMYZcgGZtzVn638wEJhXgME9x13DJNN82B9AJyExOqMMlywMToHPfhlJg2t1DG8awdneWH757gKNiWgwcAFxvdS7Gk800jn1sssEVuNSWIsKCRpkAAAAASUVORK5CYII%3D')}/* Search result filtering */#tree .notMatch h2 {color: gray !important; background-color: white !important; cursor: default !important}#tree .notMatch span {background-position: 0 -22px;}/* DOM CONSOLE BOTTOM PART (Attributes, Properties, CSS, Styles, Metrics) */#details {  background: #fefefe;  overflow:auto;  position:relative;  }#detailsView {  padding-top: 5px;  background: #dfdfdf url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAIAAAAW4yFwAAAAF0lEQVR4XgXAgQwAAADDsPsTjqEUz6rhFLQFRw%2BVXnIAAAAASUVORK5CYII%3D') 0 0 repeat-x;}#detailHeaderTabs {  height: 20px;  overflow: hidden;  margin-bottom: -1px;  list-style: none;  padding-left: 5px;}#detailHeaderTabs li {  position: relative;  float: left;  cursor: pointer;  height: 20px;  line-height: 20px;  color: #555555;  margin: 1px 4px 0 4px;  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAoCAYAAAA%2FtpB3AAAAQ0lEQVR4XrXMuw2AQAwE0RX913U1uBLL%2F0UCBzRAMnrRQEQIkpuZ4QUAT9DdfFVVq8xcRcTK3VdmRqgqcc75rkjyv9zMj3oI%2B5Z46gAAAABJRU5ErkJggg%3D%3D');}#detailHeaderTabs li:before,#detailHeaderTabs li:after   {  position: absolute;  content: '';  top: 0;  bottom: 0;    width: 4px;}#detailHeaderTabs li:before  {  left: -4px;  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAoCAYAAADZn1szAAAAi0lEQVR4XuWQMQrEIBBFv7JsZyNYp0%2Bb8%2BRUaXMeqxxA%2BzQ2Yi84O7MwkOyeYNkHD3T4%2FgERY0RKaWY39pTLknOmWiv13kkGe2uNlAeA1TkHPkOw7NMYA8XiA3ki8V9L6GCMAUV%2BjK5qxy0hzuzGntKxWGuPaZrgvX8n9lIKKdKxhhDuWy58b%2FmvwQsmoHmB%2BYoN7gAAAABJRU5ErkJggg%3D%3D');}#detailHeaderTabs li:after  {  right: -4px;  background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAoCAYAAADZn1szAAAAj0lEQVR4XuWQMQoDIRBFvyalkMIrbJtcJ6fado80WFp6gEUEC4utFsHJCANpUqQNefBQHh8LkVLaxVVciAim987HcaDWCmZ%2BgJXWGstqs3LH1DkH4WmhGGMgXDS8uc75RE%2F80GKMAXXG2zXGCOXzGyCiXVzFRQTO8%2BScM4cQWMIdrJRSZtgsFO%2F9l3%2F6X%2BEFDXiHprwdIdAAAAAASUVORK5CYII%3D');}#detailHeaderTabs li:hover:before, #detailHeaderTabs .selected:before,#detailHeaderTabs li:hover:after,#detailHeaderTabs .selected:after {  background-position: 0% 100%}#detailHeaderTabs li:hover,#detailHeaderTabs .selected {  background-position: 100% 100%;  color: #000;  margin-top: 0px;}#detailHeaderTabs li.selected {  cursor: default}#detailsSubbar {  border: 1px solid #c6c6c6;  border-right: 0;  padding: 2px;  border-bottom: 1px solid #aaa;  background: #eee url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAIAAADHFsdbAAAALUlEQVQY023NMQoAQAwCwcX%2F%2F3mvOBIISTVioagBUs5sdCsGjdDq7r73Bpy%2FDzzqNhFj4MT5AAAAAElFTkSuQmCC') 0 0 repeat-x;}.dom_view #details textarea, .dom_view #details pre{  width:100%;  height: 100%;  border: 0;  margin: 0;  padding: 0 5px;  font-size: 1.2em;  line-height: 1.3em;  white-space: pre-wrap;}.dom_view #details pre {  color: #666;  height: 93%;  width: 93%;}/* PROPERTIES TAB (and the JS main tab) */.propertyListExpandable {background: #f6f6f6; overflow: hidden; color: #aaa;}.propertyListExpandable.selected {background: #fff; color: #000}.propertyListExpandable.selected:before {  content: 'search scope ';  color: #999;  float: right;  display: absolute;  overflow: hidden;}.propertyListExpandable li {padding-left: 8px;white-space:pre-wrap; border-bottom: 1px dotted #ccc }.propertyListExpandable li .placeholder{width: 11px; display: inline-block;}.propertyListExpandable li span {margin-left: 3px; margin-top: 3px}.propertyListExpandable .selected {background: #fff}.propertyListExpandable .toggle[handlerType='getProperties'] {cursor: pointer}.propertyListExpandable .value {padding-left: 5px;}.propertyListExpandable.selected .string {color: #c00;white-space:pre-wrap}.propertyListExpandable.selected .number {color: #427b2b}.propertyListExpandable.selected .object {color: #7548a2}.propertyListExpandable.selected .array {color: #2f57c8}.propertyListExpandable.selected .function {color: #a27406}.propertyListExpandable.selected .nativeFunction {color: #90955d}#propertyPath {  background:#ccc;  width: 105%;  margin: -2px;  padding: 2px;  margin-top: 2px;  }.parentChainWithOffsetParent {  margin: 2px;  padding: 2px;  border: 1px dashed #ccc;  background: #eee;}.offsetParent {  outline: 1px solid #fff;  border: 1px solid #aaa;  background-color: #fff;  padding: 0 3px}/* CSS TAB */h2.inheritedHeader {  font-size: 1.5em;  margin-top: 20px;  padding: 0;  text-align: center;  border-bottom: 1px solid #000;}.rule {  padding-left: 5px;  font-weight: bold;  border-bottom: 1px dotted #ccc}.rule li ul li {  padding-left: 10px;  font-weight: normal;}.rule .overwritten { color: #999}.rule .overwritten:after {color: #c00; content: ' [overwritten]'}/* METRICS TAB */.metrics ul {  margin:0;  padding:0;  list-style:none;  display:table-row;}.metrics li {  display: table-cell;  border: 1px solid transparent;  text-align:center;  vertical-align:middle;  padding: 1px;}.metrics p {  position:relative;  margin:0;  padding:0;}.metrics span {  position:absolute;  top:0;  left:0;}.metrics .element {white-space:nowrap}.metrics .element li {width: 300px}.metrics .element .elementHeight{text-align:left}.metrics .element, .metrics .padding, #tree .metrics.margin {  border-color: #324c74;  background-color: #fff;}.metrics .border {  border-color: #324c74;  background-color:#c7d4e8;}/* JS VIEW *//* Making it look the same as the DOM view top */.js_view #detailsView {  padding-top: 0;  border-top: 1px solid #fff;}.js_view #detailsSubbar {  border: 0;  padding-top: 0;  background: #f6f6f6;  border-bottom: 1px solid #aaa;}/* boxContainer  */.boxContainer {border: 1px solid #2d4469; margin: 3px 2px}.boxContainer h2 {  margin:0;  background-image: url('data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%01%00%00%00%14%08%06%00%00%00L%0EW%A1%00%00%00GIDAT%18%19%1D%CB%CB%0D%C00%08%03P%CBct%FF%FD%C274%A7%14zy2%B2%E1%BD%F7%E19%07%DC%B5%9B%2C0%C2A%1FLmPPl%10%01U%26%AD%D5%FC%C5%9C6%ADY%8F%DD%FB-%22%C0%CC%04%AB%5E%7C_%BA9Y(%CF%E9%02%00%00%00%00IEND%AEB%60%82');  background-color: #324c74;  color: #fff;  padding: 1px 3px ;}/* toolbar button sections */.css_view .methodesContainer, #xhrLoggerToolbar, .http_view .boxContainer > p {  background-color: #d6d6d6;  margin: 0;  padding: 2px;  border-top: 1px solid #f6f6f6;  border-bottom: 1px solid #aaa;}/* CSS EDITOR SPECIFIC */#refHeight {visibility:hidden; position:absolute} /* For automagic height generation */.css_view textarea {  width: 100%;  overflow:hidden;  font-family: monospace;  font-size: 1.1em;  border: 2px solid #fff;  cursor: text;  background-color: #fafafa;}.css_view textarea:hover {background-color: #fcfcfc}.css_view textarea:focus {border-color: #324c74; background-color: #fff}.css_view .hide textarea, .css_view .hide .non-editable{display:none} /* DO IN JS? *//* HTTP HEADER VIEWER SPECIFIC */.http_view .propertyList li span + span + span  {width: 25px}.propertyList.editTable {  position: aboslute;  outline: 1px outset #00;}/* XHR logger */#xhrLogger {overflow: hidden}  #xhrLoggerLog {  padding:0 2px;  line-height:16px;}#xhrLogger #logSettings {width: 100%; border-bottom: 1px solid #324c74}#xhrLogger #logSettings li {  background-color: #f6f6f6;  border-top: 1px solid #fff;  border-bottom: 1px solid #e4e4e4;}#xhrLogger #logSettings li label {cursor: pointer; padding: 2px 10px;}#xhrLogger #logSettings li label input {margin-right: 5px}#xhrLogger #logSettings li:hover {background-color: #fafafa; border-top-color: #fff; border-bottom-color: #eee}#xhrLoggerLog > li > h3 .toggle {display: none}#xhrLoggerLog .toggle {margin-left:-16px}#xhrLoggerLog h3 {margin: 0; padding: 0; font-weight: normal; border-bottom: 1px dashed #eee}#xhrLoggerLog .logId {  display: inline-block;  width: 20px;  padding-right: 3px;  text-align: right;  border-right: 1px solid #ccc;   }#xhrLoggerLog .logURL {border-left: 1px solid #fff; padding-left: 10px;}#xhrLoggerLog > div > div > ul, #xhrLoggerLog ul{margin-left:16px}#xhrLoggerLog > li > h3 {  cursor: pointer;  background-color: #eee;  border-top: 1px solid #f6f6f6;  border-bottom: 1px solid #ddd;  padding: 0px 4px}#xhrLoggerLog > li > h3:hover {  background-color: #f6f6f6;  border-top: 1px solid #fff;  border-bottom: 1px solid #e4e4e4;}#xhrLoggerLog > li > * h3[handler]:hover {  cursor: pointer;  background: #f6f6f6;}#xhrLoggerLog .methode {color:#2f57c8}#xhrLoggerLog .time {float:right;color:#c33}";
  
  
  opera.tools.console=new (function(tools)
  {
    var win_style=tools.styleSheet?tools.styleSheet:'';
    var win=null;
    var win_doc=null;
    var toolsContainer=null;
  
    var activeTool='';
  
    var accessibleWindows=null;
  
    var activeWindowIndex=0;
  
  
    var toolsTabTemplate=function()
    {
      return ['div',
        ['ul',
          ['li', 'About', 'handlerType', 'switchToAbout', 'ref', 'about'],
          ['li', 'HTTP', 'handlerType', 'switchToHTTP', 'ref', 'http'],
          ['li', 'CSS', 'handlerType', 'switchToCSS', 'ref', 'css'],
          ['li', 'JS', 'handlerType', 'switchToJS', 'ref', 'js'],
          ['li', 'DOM', 'handlerType', 'switchToDom', 'ref', 'dom']
        ],
        'id', 'toolTabs']
    }
  
    var setActiveWindowTemplate=function()
    {
      var pointer=null, i=0;
      var ret=['div', ['label', 'active window: ', ['select']], 'class', 'activeWindowDropDown'];
      var retPointer=ret[1][2];
      for( ; pointer=accessibleWindows[i]; i++)
      {
        retPointer[retPointer.length]=
          ['option', pointer.name+(pointer.containerType?' <'+pointer.containerType+'>':''), 'value', i.toString()]
      }
      ret[1][2]=retPointer.concat(['onchange', function(){setActiveWindow(this.value)}])
      return ret; 
    }
  
  
  
    var toolsContainerTemplate=function()
    {
      return ['div', 'id', 'toolsContainer']
    }
  
    /********** Prototypes **********/
  
    var ElementPrototype=function() // node name, text, pairs of attribute name and attribute values
    {
      this.___add=function()
      {
        if(arguments.length)
        {
          if(arguments[0])
          {
            var doc=this.nodeType==9?this:this.ownerDocument;
            var i=0, ele=(typeof arguments[0])=='string'?doc.createElement(arguments[i++]):this; 
            var prop='', is_array=false, arg=arguments[i];
            while((is_array=arg instanceof  Array) ||
             (((typeof arg=='string') || (typeof arg=='number')) && (((arguments.length-i)%2)|| arguments[i+1] instanceof  Array ))
            )
            {
              if(is_array) 
              {
                ele.___add.apply(ele, arg); 
              }
              else if(arg) 
              {
                ele.appendChild(doc.createTextNode(arg));
              }
              arg=arguments[++i];
            }
            for( ;arguments[i] ; i+=2)
            {
              if(/string|number/.test(typeof arguments[i+1]))
              {
                ele.setAttribute(arguments[i], arguments[i+1]);
              }
              else
              {
                ele[arguments[i]]=arguments[i+1];
              }
            }
            if(this.nodeType==1 && (this!=ele))
            {
              this.appendChild(ele);
            }
            return ele;
          }
          else
          {
            return this.appendChild(doc.createTextNode(arguments[1]));
          }
        }
        return null;
      }
  
      this.render=function(template)
      {
        return this.___add.apply(this, template);
      }
  
      this.clearAndRender=function(template)
      {
        this.innerHTML='';
        return this.___add.apply(this, template);
      }
  
      this.addClass=function(name)
      {
        if(!(new RegExp('\\b'+name+'\\b')).test(this.className))
        {
          this.className=(this.className?this.className+' ':'')+name;
        }
        return this;
      }
  
      this.removeClass=function(name)
      {
        var re=new RegExp(name+' ?| ?'+name);
        if(re.test(this.className)) 
        {
          this.className=this.className.replace(re, '');
        }
        return this;
      }
  
  
    }
  
    var pollWindow=function()
    {
      if(!accessibleWindows[activeWindowIndex].window.__registered)
      {
        updateActiveWindow();
      }
    }
  
    var switchView=function(tool, ele)
    {
      if(activeTool!=tool)
      {
        if(activeTool)
        {
          opera.tools[activeTool].clear();
        }
        win_doc.body.className=tool+'_view';
        updateSelectedTab(ele);
        tools[activeTool=tool].open(accessibleWindows[activeWindowIndex].window, win, win_doc, toolsContainer); 
        
      }
    }
  
    var updateSelectedTab=function(ele)
    {
      var lis=ele.parentNode.getElementsByTagName('li'), li=null, i=0;
      for( ; li=lis[i]; i++)
      {
        if(li==ele)
        {
          li.addClass('selected');
        }
        else
        {
          li.removeClass('selected');
        }
      }
    }
  
    var clickHandler=function(event)
    {
      var ele=event.target;
      var handler=ele.getAttribute('handlerType');
      switch (handler)
      {
        case 'switchToDom':
        {
          switchView('dom', ele);
          break;
        }
        case 'switchToCSS':
        {
          switchView('css', ele);
          break;
        }
        case 'switchToHTTP':
        {
          switchView('http', ele);
          break;
        }
        case 'switchToJS':
        {
          switchView('js', ele);
          break;
        } 
        case 'switchToAbout':
        {
          switchView('about', ele);
          break;
        } 
      }
  
    }
  
    var setActiveWindow=function(index)
    {
      accessibleWindows[index].window.__registered=true;
      tools[activeTool].setWindow(accessibleWindows[activeWindowIndex=parseInt(index)].window);
      tools[activeTool].update();
    }
  
    var updateActiveWindow=function()
    {
      // todo
    }
  
    var getAccessibleWindows=function()
    {
      accessibleWindows=[{window:window, name:'top'}]
      var containerNames=['frame', 'iframe', 'object'], containerName='', i=0;
      var containers=null, container=null, k=0, pointer=null;
      var counter=0;
      for( ; containerName=containerNames[i]; i++)
      {
        containers=document.getElementsByTagName(containerName);
        for( k=0; container=containers[k]; k++)
        {
          pointer=null;
          try
          {
            pointer=container.contentWindow.document.documentElement;
          }
          catch (event)
          {
  
          }
          if(pointer)
          {
            
            accessibleWindows[accessibleWindows.length]=
            {
              window: container.contentWindow, 
              name: container.contentWindow.name?container.contentWindow.name:counter.toString(),
              containerType: containerName 
            }
            counter++;
          }
        }
      }
      //opera.postError(accessibleWindows.length);
    }
  
    var strip$=function(string)
    {
      if(string)
      {
       return string.replace(/\$/gi, '').replace(/^[^:]*\: ?/,'');
      }
      return '';
    }
  
  
  
  	this.open=function(tool)
    {
  
  
  		win=window.open('','_blank','top='+window.innerHeight*0.05+',height='+
  			window.innerHeight*0.9+',width='+300+',resizable=yes,scrollbars=yes');
  		win_doc=win.document;
      win_doc.open();
  		win_doc.write('<!DOCTYPE html><html><head></head><body></body></html>');
  		win_doc.close();
      ElementPrototype.apply(win.Node.prototype);
  		var win_head=win_doc.getElementsByTagName('head')[0];
  		var win_body=win_doc.getElementsByTagName('body')[0];
      if(!tools.styleSheet)
      {
        win_doc.documentElement.id='developer_console';
      }
  
      win_head.___add('title', 'DOM tree for: '+location.href);
  
      win_head.___add('style', win_style);
  
      getAccessibleWindows();
      if(accessibleWindows.length>1)
      {
        win_body.render(setActiveWindowTemplate());
      }
  
      win_body.render(toolsTabTemplate());
      win_body.render(toolsContainerTemplate());
  
      win_doc.addEventListener('click', clickHandler, false);
  
      toolsContainer=win_doc.getElementById('toolsContainer');
      if(!tool)
      {
        tool='dom';
      }
      win_doc.body.className=tool+'_view';
  
      accessibleWindows[0].window.__registered=true;
      
  
      tools[activeTool=tool].open(accessibleWindows[activeWindowIndex].window, win, win_doc, toolsContainer); 
  
      var lis=win_doc.getElementById('toolTabs').getElementsByTagName('li'), li=null, i=0;
      for( ; li=lis[i]; i++)
      {
        if(li.getAttribute('ref')==tool)
        {
          updateSelectedTab(li);
          break;
        }
      }
      opera.tools.revision=strip$(opera.tools.__revision);
      opera.tools.author=strip$(opera.tools.__author);
      opera.tools.date=strip$(opera.tools.__date);
  	}
  })(opera.tools);
  

  
  
  opera.tools.dom=new (function(_tools)
  {
    /********** vars **********/
  
    var nodeKey='___sourceIndex';
  
    var transparent_png='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAHUlEQVQ4y2NgEE90pSoeNXDUwFEDRw0cNXCkGggAxJcnYB4nxVkAAAAASUVORK5CYII%3D';
  
    var icon_src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEBElEQVR4Xr1XX0hbZxQ%2F908SjDFBJU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KMAHuCwd%2FHGMy13AlOluos7PTxgFzJWYSSM4IiLgxP4p5CkioBzqQoINVg4QjEon8DVmdbERkgYnF0oDjoyMqWJzVcGmAy%2BV6f6AjGfb7I%2BZxkDT%2BTyAgCp4EE2fD7LZlMHcLOfQRFuf4hRTgYI%2FQhJytra2ecDis0iHA7XbLCwsLARxc4zKrjXZ5tLu7u2F8fHyJDgE9PT0N2JoqDMNM4B6e2y39AGS6HggEVtfW1tJUBtTV1ckej6fe6%2FX2z87O8toz%2FHFraGjoR7%2Fff3ZkZOQUTjgJ7E%2BmTO%2BGfFB1BINBK86MIV577%2Bt5O8xB5UUCdl9%2FPf8EQXcC5NdnTqAAAAAASUVORK5CYII%3D';
  	// highlight style in the document
    var highlightStyle='background:transparent url('+transparent_png+') repeat scroll 0 0';
    // highlight style in the dom tree
    var ___highlightStyle='background-color:#324c74;color:#fff;';
  
    /********** pointers **********/
  
    var win=null;
    var win_doc=null;
    var win_body=null;
    var toolsContainer=null;
  
    var detailsView=null;
    var detailsTabs=null;
    var detailsSubBar=null;
    var details=null;
  
    var list=null;
    var currentHighlight=null;
    var optionList=null;
    var lastTarget=null;
    var removeAction=false;
    var __selectedElement=null;
  
    var __storedSelectedElement=null;
  
    var __activeList=null;
    var __highlightedElement=null;
    var __detailViewNodeType=0; // 1 | 3
    var __detailViewTab='';  // 'attributes | properties | styles | metrics | rules
    var __storedDetailViewTab=''; // for JS view
  
    var __window=null;
    var __document=null;
  
    var __self=this;
  
    var delta=0;
    var min_height=80; // min height for a frame
    var catcher=null;
    var catcher_2=null;
  
    var tools=_tools;
    var filters=tools.filters;
    var cssProperies=filters.cssProperies;
    var windowFilter=filters.windowFilter;
    var documentFilter=filters.documentFilter;
    var nodeFilter=filters.nodeFilter;
  
    var notAccessible=filters.notAccessible;
  
    var templates=tools.templates;
  
    var inheritedDeclarations=filters.inheritedDeclarations;
  
    /********** filters **********/
  
    var filters=
    {
      CSSProperties:
      {
        name: 'style properties',
        id: 'CSSProperties' ,
        checked: true
      },
      whitespace:
      {
        name: 'white space nodes',
        id: 'whitespace' ,
        checked: true
      },
      windowProperties:
      {
        name: 'window properties',
        id: 'windowProperties' ,
        checked: false
      },
      documentProperties:
      {
        name: 'document properties',
        id: 'documentProperties' ,
        checked: false
      },
      nodeProperties:
      {
        name: 'node properties',
        id: 'nodeProperties' ,
        checked: false
      }
    }
  
    /********** Helpers Highlight **********/
  
    // needs to be cleand up
  
    var ___highlight=function(ele, style) 
    {
      if(/^img$/i.test(ele.nodeName)) 
      {
        if(!ele.attributes.width)
        {
          ele.___storeWidth=true;
          ele.width=ele.width;
        }
        if(!ele.attributes.height)
        {
          ele.___storeHeight=true;
          ele.width=ele.width;
        }
        ele.height=ele.height;
        ele.___storeSrc=ele.getAttribute('src');
        ele.src=colorOverlay(ele,"#303090",0.5);
      }
      else
      {
        if(!ele.___storeStyle)
        {
          ele.___storeStyle=ele.getAttribute('style');
        }
        ele.setAttribute('style',(ele.___storeStyle?ele.___storeStyle+';':'')+style);
      }
    }
  
    var ___clearStyle=function()
    {
      if(this.___storeWidth) this.removeAttribute('width');
      if(this.___storeHeight) this.removeAttribute('height');
      this.removeEventListener('load', ___clearStyle, false);
    }
  
    var ___clearHighlight=function(ele) 
    {
      if(/^img$/i.test(ele.nodeName)) 
      {
        ele.src=ele.___storeSrc;
        ele.addEventListener('load', ___clearStyle, false);
      }
      else
      {
        if(ele.___storeStyle) ele.setAttribute('style', ele.___storeStyle);
        else ele.removeAttribute('style');
        delete ele.___storeStyle
      }
    }
  
    var ___spotlight=function(ele, style, container)
    {
      var _ele=ele;
      var x=ele.offsetLeft, y=ele.offsetTop;
      while(_ele=_ele.offsetParent)
      {
        x+=_ele.offsetLeft;
        y+=_ele.offsetTop;
      }
      if(container)
      {
        container.scrollTop=y-150-container.offsetTop;
      }
      else
      {
        ele.ownerDocument.parentWindow.scrollTo(0, y-150);
      }
      ___highlight(ele, style);
      if(container)
      {
  
      }
      else
      {
        win.setTimeout(clearHighlightTimeout, 800, ele);
      }
    }
    
    var colorOverlay = function( img, color, opacity )
    {
      var canvas = __document.createElement('canvas'),
          ctx = canvas.getContext('2d');
      canvas.width = img.width;
      canvas.height = img.height
      if (opacity) ctx.globalAlpha = opacity;
      src_a = canvas.toDataURL();
      try {
        ctx.fillStyle = color;
        ctx.fillRect(0,0,canvas.width,canvas.height);    
        ctx.globalCompositeOperation = "destination-over";
        ctx.drawImage(img ,0,0);
        img.src = canvas.toDataURL();
      } 
      catch (e)
      {/*
        ctx.globalCompositeOperation = "source-over";
        ctx.clearRect(0,0,canvas.width,canvas.height);
        ctx.fillStyle = color;
        ctx.fillRect(0,0,canvas.width,canvas.height);    */
        img.src = src_a;
      }
    }
    
    var clearHighlightTimeout=function(ele)
    {
      ___clearHighlight(ele);
    }
  
    /********** templates **********/
  
    var jsConsoleTemplate=function()
    {
      return ['div', 
        ['div', 'id', 'detailsSubbar'],
        ['div', 'id', 'details'],
        'id', 'detailsView']
    }
  
    var catcherTemplate=function()
    {
      return ['input', 'style', 'position:absolute;left:-200px;top:-200px;'];
    }
  
    var catcher2Template=function()
    {
      return ['div'];
    }
      
    var domConsoleTreeViewTemplate=function()
    {
      return ['div',
        templates.header(icon_src),
        ['div', 
            ['label', 'Search: ', 
              ['input', 'handlerType', 'searchCssSelector'], 
              'title', 'Search with CSS Selector'],
            ['label', 
              ['input', 'handlerType' ,'setFilter', 'value', 'whitespace', 'type', 'checkbox'],
            'show whitespace nodes'
            ],
            ['input', 'handlerType', 'removeNode', 'value', 'remove', 'type', 'button'],
            ['input', 'handlerType', 'snapshot', 'value', 'snapshot', 'type', 'button'],
          'class', 'headerBar'],
        ['div', 'id', 'tree'],
      'id', 'treeView']
    }
  
    var separatorTemplate=function()
    {
      return ['div', 'id', 'separator'];
    }
  
    var domConsoleMainViewsTemplate=function()
    {
      return ['div', 
        ['div', 'id', 'detailsTabs'],
        ['div', 'id', 'detailsSubbar'],
        ['div', 'id', 'details'],
        'id', 'detailsView']
    }
  
    var domConsoleDetailsViewTemplate=function()
    {
      
    }
  
    var openCloseButtonTemplate=function(handler)
    {
      if(handler) 
      {
        return ['span', 'class', 'toggle close', 'handlerType', handler];
        //return ['input', 'type', 'button', 'class', 'toggle close', 'handlerType', handler];
      }
      return ['span', 'class', 'placeholder'];
    }
  
    var expandableListKeyTemplate=function(key, handler)
    {
      if(handler)
      {
        return ['span', key, 'class', 'key', 'handlerType', handler]
      }
      return ['span', key, 'class', 'key']
  
    }
    var expandableListKeyValue=function(value, className, handler)
    {
      if(handler)
      {
        return ['span', value, 'class', 'value'+(className?' '+className:''), 'handlerType', handler];
      }
      return ['span', value, 'class', 'value'+(className?' '+className:'')];
    }
  
    var expandableListKeyValueTemplate=function(key, value, handler, className)
    {
      return ['li',
        openCloseButtonTemplate(handler),
        expandableListKeyTemplate(key, handler),
        expandableListKeyValue(value, className, handler)];
  
  
    }
  
    var elementNodeNameTemplate=function(node)
    {
      switch(node.nodeType)
      {
        case 9:
        {
          return node.nodeName;
        }
        case 1:
        {
          return ''+node.nodeName+
            (node.id?' id="'+node.id+'"':'')+
            (node.className?' class="'+node.className+'"':'')+'';
        }
      }
    }
  
    var elementNodeTemplate=function(node, searchMatch)
    {
      return ['div',
        ['div',
          openCloseButtonTemplate(node.childNodes.length>0?'showTree':''),
          ['h2', 
            elementNodeNameTemplate(node),
            'handlerType', 'highlightSource'
          ],
        'class', 'headLine'+(searchMatch=='notMatch'?' '+searchMatch:'')],
      'id', node[nodeKey], 'class', node.nodeType==1?'node':'node root'];
    }
  
    var textNodeTemplate=function(node, index)
    {
      var text=node.nodeValue;
      if(text.length>9)
      {
        text=text.slice(0,9)+'...';
      }
      return ['div',
        ['div',
          ['h2', 
            node.nodeName+': '+text,
            'handlerType', 'editTextNode',
            'childIndex', index
          ],
        'class', 'headLine'],
      'class', 'node text'];
    }
  
    var commentNodeTemplate=function(node, index)
    {
      var text=node.nodeValue;
      if(text.length>9)
      {
        text=text.slice(0,9)+'...';
      }
      return ['div',
        ['div',
          ['h2', 
            node.nodeName+': '+text,
            'handlerType', 'showCommentNode',
            'childIndex', index
          ],
        'class', 'headLine'],
      'class', 'node comment'];
    }
  
    var linkTemplate=function(text, link)
    {
  
      switch(getLinkType(link))
      {
        case 'protokol':
        {
          return ['a', 
            text , 
            'href', link, 
            'target', '_blank'];
        }
        case 'host':
        {
          return ['a', 
            text , 
            'href', __window.location.protocol+'//'+__window.location.host+link, 
            'target', '_blank'];
        }
        case 'path':
        {
          return ['a', 
            text , 
            'href', __window.location.protocol+'//'+__window.location.host+__window.location.pathname.replace(/\/[^/]*$/,'/')+link, 
            'target', '_blank'];
        }
      }
    }
  
    var searchBoxTemplate=function()
    {
      return ['li', 
        ['span', 
          ['label', 'search: ', 'class', 'searchBox'], 
          'class', 'key'],
        ['span', 
          ['input', 'class', 'searchBox', 'handlerType' ,'searchBox'], 
          'class', 'value']
      ]
    }
  
    var metricsTemplate=function(styles)
    {
      
      return ['div', 
          ['ul', 
            ['li',['p','\u00a0',['span', 'margin']]],
            ['li', styles.getPropertyValue('margin-top')],
            ['li']
          ],
          ['ul', ['li', styles.getPropertyValue('margin-left')], ['li', 
            ['ul', 
              ['li',['p','\u00a0',['span', 'border']]], 
              ['li', styles.getPropertyValue('border-top-width')],
              ['li']
            ],
            ['ul', ['li', styles.getPropertyValue('border-left-width')], ['li',
              ['ul', 
                ['li',['p','\u00a0',['span', 'padding']]], 
                ['li', styles.getPropertyValue('padding-top')], 
                ['li']
              ],
              ['ul', 
                ['li', styles.getPropertyValue('padding-left')], 
                ['li', 
                  ['ul', ['li', styles.getPropertyValue('width'), 'class', 'elementWidth']],
                  ['ul', ['li', styles.getPropertyValue('height'),'class', 'elementHeight']],
                  ['ul', ['li', '\u00a0']],
                  //styles.getPropertyValue('width')+' \u25CF '+styles.getPropertyValue('height'), 
                  'class', 'element'], 
                ['li', styles.getPropertyValue('padding-right')]
              ],
              ['ul', ['li', styles.getPropertyValue('padding-bottom'), 'colspan', '3']],
              'class', 'padding'], ['li', styles.getPropertyValue('border-right-width')]],
            ['ul', ['li', styles.getPropertyValue('border-bottom-width'), 'colspan', '3']],
            'class', 'border'], ['li', styles.getPropertyValue('margin-right')]],
          ['ul', ['li', styles.getPropertyValue('margin-bottom'), 'colspan', '3']],
          'class', 'metrics border'];
    }
  
    var offsetChainTemplate=function()
    {
      var chain=[__selectedElement.nodeName], offset=pointer=__selectedElement;
      while(pointer=pointer.parentElement)
      {
        if(pointer==offset.offsetParent)
        {
          chain[chain.length-1]=' > '+chain[chain.length-1];
          chain[chain.length]=['span', pointer.nodeName, 'class', 'offsetParent'];
          chain[chain.length]='';
          offset=pointer;
        }
        else
        {
          chain[chain.length-1]=pointer.nodeName+' > '+chain[chain.length-1];
        }
      }
      chain[chain.length-1]='offsetParents: '+chain[chain.length-1];
      return ['div'].concat(chain.reverse(), ['class', 'parentChainWithOffsetParent']);
    }
  /*
     <UL CLASS="propertyList" >
              <LI>
                <SPAN CLASS="key" >border: </SPAN>
                <SPAN CLASS="value" >0px #666666</SPAN>
              </LI>
  */
    var offsetTemplate=function()
    {
      var offsets=
      [
        'offsetTop',
        'offsetLeft',
        'offsetWidth',
        'offsetHeight',
        'scrollTop',
        'scrollLeft',
        'scrollWidth',
        'scrollHeight',
        'clientTop',
        'clientLeft',
        'clientWidth',
        'clientHeight'
      ]
      var ret=['ul'], i=0, pointer='';
      for( ; pointer=offsets[i]; i++)
      {
        ret[ret.length]=
        ['li', 
          ['span', pointer+':', 'class', 'key'], 
          ['span', __selectedElement[pointer].toString(), 'class', 'value']
        ];
      }
      return ret.concat(['class', 'propertyList'])
    }
  
    var menuTemplate=function(node)
    {
      if(node.nodeType==1)
      {
        return ['ul', 
          ['li', 'attributes', 'handlerType', 'getAttributes'],
          ['li', 'computed styles', 'handlerType', 'getComputedStyle'],
          ['li', 'properties', 'handlerType', 'getPropertiesRef'],
          ['li', 'metrics', 'handlerType', 'getMetrics'],
          ['li', 'remove', 'handlerType', 'removeNode'],
          'class', 'optionList']
      }
      return ['ul', 
        ['li', 'properties', 'handlerType', 'getPropertiesRef'],
        'class', 'optionList'] 
    }
  
    var singleFilterTemplate=function(filter)
    {
    return ['li', 
        ['label', 
          ['input', 
            'type', 'checkbox', 
            'id', filter.id,
            'handlerType', 'checkFilters'
          ],
          filter.name
        ]
      ]
    }
  
  /*__detailViewTab='';  // 'attributes | properties | styles | metrics*/
  
    var detailHeaderElementNode=function()
    {
      return ['ul',
          ['li', 
            'Attributes', 
            'handlerType', 'showAttributes', 
            'class', __detailViewTab=='attributes'?'selected':''],
          ['li', 
            'Properties', 
            'handlerType', 'showProperties', 
            'class', __detailViewTab=='properties'?'selected':''],
          ['li', 
            'CSS', 
            'handlerType', 'showRules', 
            'class', __detailViewTab=='selectors'?'selected':''],
          ['li', 
            'Styles', 
            'handlerType', 'showStyles', 
            'class', __detailViewTab=='styles'?'selected':''],
          ['li', 
            'Metrics', 
            'handlerType', 'showMetrics', 
            'class', __detailViewTab=='metrics'?'selected':''],
          'id', 'detailHeaderTabs']
    }
  
    var filterTemplate=function()
    {
      return ['div',
        ['h2', 'filters:'],
        ['ul', 
          singleFilterTemplate(filters.CSSProperties),
          singleFilterTemplate(filters.whitespace),
          singleFilterTemplate(filters.windowProperties),
          singleFilterTemplate(filters.documentProperties),
          singleFilterTemplate(filters.nodeProperties)
        ],
        'class', 'filters']
    }
  
    var templateSubbarAttributes=function()
    {
      return ['div',
          ['input', 
            'type', 'button', 
            'value', 'delete', 
            'handlerType', 'deleteAttribute', 
            'disabled', 'disabled',
            'id', 'deleteAttributeSubbar'],
          ['input', 
            'type', 'button', 
            'value', 'new', 
            'handlerType', 'newAttribute'],
        'class', 'subbarAttributes']
    }
  
    var templateSubbarProperties=function()
    {
      return ['div',
          ['label', 'Search: ', ['input', 'handlerType' ,'searchBox']],
          ['label', 
            ['input', 'handlerType' ,'setFilter', 'value', __selectedElement==__window?'windowProperties':'nodeProperties', 'type', 'checkbox'],
            'only custom Properties'
          ],
          ['div', 'id', 'propertyPath'],
        'class', 'subbarProperties']
    }
  
    var templateSubbarStyles=function()
    {
      return ['div',
          ['label', 'Search: ', ['input', 'handlerType' ,'searchBoxStyle']],
          ['label', 
            ['input', 'handlerType' ,'setFilter', 'value', 'CSSProperties', 'type', 'checkbox'],
            'all properties'
          ],
        'class', 'subbarStyles']
    }
  
    var windowPropertiesTemplate=function()
    {
      return ['div',
          ['div',
            ['div',
              menuTemplate(__window),
              ['h2', 'window'],
            'class', 'headLine'],
            ['div', 'class', 'output'],
          'id', '-2'],
        'class', 'windowProperties']
  
    }
  
    /********** View Console **********/
    /********** View Tree Header **********/
    /********** View Tree Subbar **********/
    /********** View Tree Tree **********/
  
    /********** Detail View **********/
  
    var adjustDetailView=function(nodeType)
    {
      if((__detailViewNodeType!=nodeType) || !detailsTabs.firstChild)
      {
        __detailViewNodeType=nodeType;
        switch(nodeType)
        {
          case 1:
          {
            if(!__detailViewTab)
            {
              __detailViewTab='attributes';
            }
            detailsTabs.clearAndRender(detailHeaderElementNode());
  
            details.innerHTML='';
            break;
          }
          case 3:
          {
            detailsTabs.innerHTML='';
            detailsSubBar.innerHTML='';
            details.clearAndRender(['textarea', 'rows', '20']);
            break;
          }
          case 4:
          {
            detailsTabs.innerHTML='';
            detailsSubBar.innerHTML='';
            details.clearAndRender(['pre', ' ']);
            break;
          }
        }
        setSubbar();
      }
    }
  
    var setSubbar=function()
    {
      switch(__detailViewNodeType)
      {
        case 1:
        {
          setSubbarNodeElement();
          break;
        }
      }
    }
  
    var setSubbarNodeElement=function()
    {
      switch(__detailViewTab)
      {
        case 'attributes':
        {
          detailsSubBar.clearAndRender(templateSubbarAttributes());
          break;
        }
        case 'properties':
        {
          detailsSubBar.clearAndRender(templateSubbarProperties());
          break;
        }
        case 'styles':
        {
          detailsSubBar.clearAndRender(templateSubbarStyles());
          break;
        }
        case 'metrics':
        {
          detailsSubBar.innerHTML='';
          break;
        }
        case 'rules':
        {
          detailsSubBar.innerHTML='';
          break;
        }
      }
    }
  
    var updateSelectedTab=function(ele)
    {
      //opera.postError(ele)
      var lis=ele.parentNode.getElementsByTagName('li'), li=null, i=0;
      for( ; li=lis[i]; i++)
      {
        if(li==ele)
        {
          li.addClass('selected');
        }
        else
        {
          li.removeClass('selected');
        }
      }
    }
  
    var detailsShowAttributes=function()
    {
      if(__selectedElement)
      {
        details.innerHTML='';
        details.appendChild(getAttributes(__selectedElement));
        updateDeleteAttributeButton();
      }
    }
  
    var detailsShowProperties=function()
    {
      if(__selectedElement)
      {
        details.innerHTML='';
        details.appendChild(list=getPropertyList(__selectedElement, [], true));
        setSelectedList(list);
        updatePath([]);
      }
    }
  
    var detailsShowStyles=function()
    {
      if(__selectedElement)
      {
        details.innerHTML='';
        details.appendChild(__activeList=list=getComputedStyles(__selectedElement));
        //output.___activeList=list;
      }
    }
  
    var detailsShowMetrics=function()
    {
      
      if(__selectedElement)
      {
        //opera.postError('width: '+window.getComputedStyle(document.body, null).getPropertyValue('width'));
        details.clearAndRender(metricsTemplate(__window.getComputedStyle(__selectedElement, null)));
        //offsetChainTemplate();
        details.render(offsetChainTemplate());
        details.render(offsetTemplate())
      }
    }
  
    var detailsShowSelectors=function()
    {
      if(__selectedElement)
      {
        //details.clearAndRender(selectorTemplate(__selectedElement));
      }
    }
  
    /********** View Details Tabs **********/
  
    var updateDetailView=function()
    {
      if(__detailViewTab)
      {
        switch(__detailViewTab)
        {
          case 'attributes':
          {
            detailsShowAttributes();
            break;
          }
  
          case 'properties':
          {
            detailsShowProperties();
            break;
          }
  
          case 'styles':
          {
            detailsShowStyles();
            break;
          }
  
          case 'metrics':
          {
            detailsShowMetrics();
            break;
          }
  
          case 'rules':
          {
            detailsShowRules();
            break;
          }
        }
      }
    }
  
    /********** View Details Subbar **********/
  
    var updateDeleteAttributeButton=function()
    {
        var input=win_doc.getElementById('deleteAttributeSubbar');
        var selectedAttribute=false;
        if(input)
        {
          var lis=details.getElementsByTagName('li'), li=null, i=0;
          var re=/\bselectedAttribute\b/;
          for( ; li=lis[i]; i++)
          {
            if(re.test(li.className))
            {
              selectedAttribute=true;
              break;
            }
          }
          input.disabled=!selectedAttribute;
        }
    }
  
    /********** View Details Details **********/
  
    var addAttributeRow=function()
    {
      if(__selectedElement && __detailViewTab=='attributes')
      {
        var list=details.getElementsByTagName('ul')[0];
        if(list)
        {
          list.render(['li', 
              ['span', ['input'], 'class', 'key'], 
              ['span', ['input'], 'class', 'value'],
              'key', '__notSet']);
          var inputs=list.getElementsByTagName('input');
          inputs[inputs.length-2].focus();
        }
      }
    }
  
    var updateTextarea=function()
    {
      var textarea=details.getElementsByTagName('textarea')[0];
      if(textarea)
      {
        textarea.value=__selectedElement?__selectedElement.nodeValue:'';
      }
  
    }
  
    var updateComment=function()
    {
      var textarea=details.getElementsByTagName('pre')[0];
      if(textarea)
      {
        textarea.textContent=__selectedElement?__selectedElement.nodeValue:'';
      }
  
    }
  
    /********** Helpers View **********/
  
    var parseSourceIndexArray=function(arr)
    {
      var tree=win_doc.getElementById('tree');
      tree.innerHTML='';
      var container=null, event=null, i=0, span=null;
      var newTree=container=createDOMTreeEntry(__document.documentElement.parentNode, win_doc);
      for( ; i<arr.length-(removeAction?0:1); i++)
      {
        
        if(container)
        {
          span=container.getElementsByTagName('span')[0];
          if(span)
          {
            span.className=span.className.replace(/close/, 'open');
          }
          container=createTreeLayer(arr[i], container, arr[i+1]);
        }
      }
      tree.appendChild(newTree);
      win.focus();
      if(arr.length)
      {
        var ele=win_doc.getElementById(arr[i-(removeAction?1:0)]).getElementsByTagName('div')[0];
        __selectedElement=__document.getElementsByTagName('*')[arr[i-(removeAction?1:0)]];
        adjustDetailView(1);
        updateDetailView();
        
        if(__highlightedElement)
        {
          ___clearHighlight(__highlightedElement);
        }
        ___spotlight(__highlightedElement=ele.getElementsByTagName('h2')[0], ___highlightStyle, tree);
        
      }
      else
      {
        adjustDetailView();
      }
      removeAction=false;
    }
  
    var getParentElementChain=function(ele)
    {
        var arr=[ele];
        while(ele.parentNode) 
        {
          arr[arr.length]=ele=ele.parentNode;
        }
        return arr.reverse();
    }
  
    // container.render(elementNodeTemplate(node))
    // ele[nodeKey]
  
    var displayCssSelectorSearchTree=function(arr)
    {
      var tree=win_doc.getElementById('tree');
      tree.innerHTML='';
      var container=null, i=0, ele=null, currentChain=null, currentContext=null;
      var newTree=container=createDOMTreeEntry(__document.documentElement.parentNode, win_doc);
      newTree.firstChild.addClass('notMatch');
      tree.appendChild(newTree);
      for( ; ele=arr[i]; i++)
      {
        currentChain=getParentElementChain(ele);
        displayCssSelectorSearchTreeSingleBranch(tree, currentChain)
      }
      var divs=tree.getElementsByTagName('div'), reNode=/\bnode\b/, reClose=/close/, span=null;
      for(i=0 ; ele=divs[i]; i++)
      {
        if(reNode.test(ele.className))
        {
          if(!ele.nextSibling)
          {
            ele.addClass('last');
          }
          if(ele.getElementsByTagName('div')[1])
          {
            span=ele.getElementsByTagName('span')[0];
            if(span)
            {
              span.className=span.className.replace(reClose, 'open');
            }
          }
        }
      }
    }
  
    var displayCssSelectorSearchTreeSingleBranch=function(tree, chain)
    {
      var sourceIndex='', pointer=null, pointer_console=null, i=0, currentContext=null;
      var length=chain.length;
      for( ; pointer=chain[i]; i++)
      {
        pointer_console=win_doc.getElementById(pointer[nodeKey]);
        if(pointer_console)
        {
          currentContext=pointer_console;
        }
        else
        {
          currentContext=currentContext.render(elementNodeTemplate(pointer, (i==length-1?'':'notMatch')));
        }
      }
    }
  
    var createTreeLayer=function(___sourceIndex, container, nextSourceIndex)
    {
      var childs=null, child=null, i=0, length=0;
      var last=null, pointer=null;
      var ret=null;
      ___sourceIndex=parseInt(___sourceIndex)
      if(___sourceIndex==-1)
      {
        childs=__document.childNodes;
      }
      else
      {
        var ele=__document.getElementsByTagName('*')[parseInt(___sourceIndex)];
        if(ele)
        {
          childs=ele.childNodes;
        }
      }
      if(childs)
      {
        length=childs.length-1;
        for( ; child=childs[i]; i++)
        {
          if(pointer=createDOMTreeEntry(child, container, i))
          {
            last=pointer;
            if(child[nodeKey]==nextSourceIndex)
            {
              ret=pointer;
            }
          }
        }
        last.addClass('last');
      }
      return ret;
    }
  
  	var createDOMTreeEntry=function(node, container, index)
    {
      var type='', notFilter=true;
      switch (node.nodeType)
      {
        case 3:
        {
          if(filters.whitespace.checked && (/^[\u0009\u000A\u00A0\u000D\u000B\u0020]*$/.test(node.data)))
          {
            notFilter=false;
            return null;
          }
          return container.render(textNodeTemplate(node, index));
        }
  
        case 4:
        case 8:
        {
          if(filters.whitespace.checked && (/^[\u0009\u000A\u00A0\u000D\u000B\u0020]*$/.test(node.data)))
          {
            notFilter=false;
            return null;
          }
          return container.render(commentNodeTemplate(node, index));
        }
  
        
        case 1:
        case 9:
        {
          return container.render(elementNodeTemplate(node));
        }
          //break;
  
  		}
      return notFilter;
  	}
  
    /********** Event Handlers Console **********/
  
    //ele.className=ele.className.replace(/close/, 'open');
  
    var clickHandlerWindowTree=function(event)
    {
  		var li=event.target, target=null, list=null, pointer=li, path=[];
  		if(/^span$/i.test(li.nodeName))
      {
  			if(li.parentNode.getElementsByTagName('li')[0]) 
        {
          li.parentElement.firstChild.className=li.parentElement.firstChild.className.replace(/open/, 'close');
          if(/^ul$/i.test((list=li.parentNode.parentNode).nodeName))
          {
            setSelectedList(list);
            pointer=list.parentNode.childNodes[1];
            while (pointer && /^span$/i.test(pointer.nodeName))
            {
              path[path.length]=pointer.firstChild.nodeValue;
              pointer=pointer.parentNode.parentNode.parentNode.childNodes[1];
            };
            updatePath(path.reverse());
          }
          li.parentNode.removeChild(li.parentNode.getElementsByTagName('ul')[0]);
          
  			} 
        else 
        {
          pointer=li.parentElement.childNodes[1];
          li.parentElement.firstChild.className=li.parentElement.firstChild.className.replace(/close/, 'open');
          do 
          {
            path[path.length]=pointer.firstChild.nodeValue;
            pointer=pointer.parentNode.parentNode.parentNode.childNodes[1];
          } while (pointer && /^span$/i.test(pointer.nodeName));
          path.reverse();
          if(target=__selectedElement)
          {
            li.parentNode.appendChild( list=getPropertyList(target, path) );
            setSelectedList(list);
            updatePath(path);
          }
        }
  		}
  	}
  
  
  
    var clickHandlerDOMTree=function(event)
    {
      /* schabernck 
  		if(win_doc && win_doc.parentWindow.opener==null) 
      {
  			win.close();
  			return;
  		}
      */
  
      if(!__window) return; // TODO cleanup __window
  
  
  
      var ele=event.target, container=null, target=null, output=null, list=null, i=0;
      var childIndex=0;
  
      if(__window.__registered)
      {
  
        switch(ele.getAttribute('handlerType'))
        {
          case 'showTree':
          {
            container=ele.parentNode.parentNode;
            if(/close/.test(ele.className))
            {
              ele.className=ele.className.replace(/close/, 'open');
              createTreeLayer(container.id, container);
            } 
            else 
            {
              ele.className=ele.className.replace(/open/, 'close');
              var childs=container.childNodes;
              for(i=childs.length; i--; )
              {
                if(/node/i.test(childs[i].className)) 
                {
                  container.removeChild(childs[i]);
                }
              }
            } 
            break;
          }
  
          case 'editTextNode':
          {
            target=__document.getElementsByTagName('*')[parseInt(ele.parentNode.parentNode.parentNode.id)];
            childIndex=ele.getAttribute('childIndex');
            if(target && childIndex)
            {
              if(__highlightedElement)
              {
                ___clearHighlight(__highlightedElement);
              }
              __selectedElement=target.childNodes[parseInt(childIndex)];
              adjustDetailView(3);
              updateTextarea();
              ___highlight(__highlightedElement=ele, ___highlightStyle);
            }
            break;
          }
  
          case 'showCommentNode':
          {
            target=getTarget(ele.parentNode.parentNode.parentNode.id); 
            childIndex=ele.getAttribute('childIndex');
            if(target && childIndex)
            {
              if(__highlightedElement)
              {
                ___clearHighlight(__highlightedElement);
              }
              __selectedElement=target.childNodes[parseInt(childIndex)];
              
              adjustDetailView(4);
              updateComment();
              ___highlight(__highlightedElement=ele, ___highlightStyle);
            }
            break;
          }
  
          case 'highlightSource':
          {
            target=__document.getElementsByTagName('*')[parseInt(ele.parentNode.parentNode.id)];
            if(target)
            {
              if(__highlightedElement)
              {
                ___clearHighlight(__highlightedElement);
              }
              __selectedElement=target;
              adjustDetailView(1);
              updateDetailView();
              ___highlight(__highlightedElement=ele, ___highlightStyle);
              ___spotlight(target, highlightStyle);
            }
            break;
          }
  
          case 'getComputedStyle':
          {
            container=ele.parentNode.parentNode.parentNode;
            target=__document.getElementsByTagName('*')[parseInt(container.id)];
            if(target)
            {
              output=getOutput(container, 'computed style', true);
              output.appendChild(list=getComputedStyles(target));
              output.___activeList=list;
            }
            break;
          }
  
          case 'getPropertiesRef':
          {
            container=ele.parentNode.parentNode.parentNode;
            if(target=getTarget(container.id))
            {
              output=getOutput(container, 'properties',true);
              output.appendChild(list=getPropertyList(target, [], true));
              setSelectedList(list);
              output.___activeList=list;
            }
            break;
          }
  
          case 'showAttributes':
          {
            __detailViewTab='attributes';
            updateSelectedTab(ele);
            setSubbar();
            detailsShowAttributes();
            break;
          }
  
          case 'showProperties':
          {
            __detailViewTab='properties';
            updateSelectedTab(ele);
            setSubbar();
            detailsShowProperties();
            break;
          }
  
          case 'showStyles':
          {
            __detailViewTab='styles';
            updateSelectedTab(ele);
            setSubbar();
            detailsShowStyles();
            break;
          }
  
          case 'showMetrics':
          {
            __detailViewTab='metrics';
            updateSelectedTab(ele);
            setSubbar();
            detailsShowMetrics();
            break;
          }
  
          case 'showSelectors':
          {
            __detailViewTab='selectors';
            updateSelectedTab(ele);
            setSubbar();
            detailsShowSelectors();
            break;
          }
  
          case 'showRules':
          {
            __detailViewTab='rules';
            updateSelectedTab(ele);
            setSubbar();
            detailsShowRules();
          }
  
          case 'getProperties':
          {
            clickHandlerWindowTree({target:ele})
            break;
          }
  
          case 'getMetrics':
          {
            container=ele.parentNode.parentNode.parentNode;
            target=__document.getElementsByTagName('*')[parseInt(container.id)];
            if(target)
            {
              var output=getOutput(container, 'metrics');
              output.___add.apply(output, metricsTemplate(__window.getComputedStyle(target, null)));
            }
            break;
          }
  
          case 'getAttributes':
          {
            container=ele.parentNode.parentNode.parentNode;
            target=__document.getElementsByTagName('*')[parseInt(container.id)];
            if(target)
            {
              var output=getOutput(container, 'attributes');
              output.appendChild(getAttributes(target));
            }
            break;
          }
  
          case 'clearOutput':
          {
  
            output=ele.parentNode;
            delete output.___activeList;
            output.innerHTML='';
            output.removeAttribute('style');
            output.removeAttribute('class');
            break;
          }
  
          case 'removeNode':
          {
            container=ele.parentNode.parentNode.parentNode;
            target=__selectedElement;
            if(target)
            { 
              lastTarget=getPreviousSiblingElement(target) || getNextSiblingElement(target) || target.parentElement;
              target.parentNode.removeChild(target);
            }
            break;
          }
  
          case 'checkFilters':
          {
            updateFilters();
            break;
          }
  
          case 'deleteAttribute':
          {
            deleteAttribute();
            break;
          }
          case 'newAttribute':
          {
            addAttributeRow();
            break;
          }
  
  
          case 'setFilter':
          {
            setFilter(ele.checked, ele.value);
            break;
          }
  
          case 'snapshot':
          {
            opera.tools.snapshot.open(__window);
            break;
          }
  
          
        }
      }
      else
      {
        var index=i=0, all=pointer=null;
        __self.setWindow(__window);
        __window.__registered=true;
        if(__selectedElement)
        {
          all=win_doc.getElementsByTagName('*');
          for( ; (pointer=all[i]) && (pointer!=ele); i++);
          __self.update(parseInt(index=__selectedElement[nodeKey]));
          clickHandlerDOMTree({target:win_doc.getElementsByTagName('*')[i]});
        }
        else
        {
          __self.update();
        }
      }
    }
  
    var keyupHandlerDOMTree=function(event)
    {
  
  		if(win_doc.parentWindow.opener==null) 
      {
  			win.close();
  			return;
  		}
  
      var ele=event.target, list=null, lis=null, li=null, i=0, search=null;
   
  
      switch(ele.getAttribute('handlerType'))
      {
        case 'searchBox':
        {
          search=new RegExp('^'+ele.value, 'i');
          //opera.postError(search+' '+__activeList);
          if(list=__activeList)
          {
            __activeList.__searchScope=ele.value;
            lis=list.getElementsByTagName('li');
            for( ; li=lis[i]; i++)
            {
              if(search.test(li.childNodes[1].firstChild.nodeValue))
              {
                li.removeAttribute('style');
              }
              else
              {
                li.style.display='none';
              }
            }
          }
          break;
        }
        case 'searchBoxStyle':
        {
          search=new RegExp('^'+ele.value, 'i');
          //opera.postError(search+' '+__activeList);
          if(list=__activeList)
          {
            lis=list.getElementsByTagName('li');
            for( ; li=lis[i]; i++)
            {
              if(search.test(li.childNodes[0].firstChild.nodeValue))
              {
                li.removeAttribute('style');
              }
              else
              {
                li.style.display='none';
              }
            }
          }
          break;
        }
        case 'searchCssSelector':
        {
          //clearTimeout(searchWithCssSelectorTimeout);
          //searchWithCssSelectorTimeout=setTimeout(searchWithCssSelector, 300, ele.value);
          //serchWithCssSelectorValue=ele.value;
          if(event.keyCode==13)
          {
            searchWithCssSelector(ele.value);
          }
  
          
          break;
        }
      }
    }
  
    //var searchWithCssSelectorTimeout=0;
    //var serchWithCssSelectorValue='';
    var serchWithCssSelectorCollection=[];
  
    var clearOutline=function()
    {
      var pointer=null, i=0;
      for(i=0 ; pointer=serchWithCssSelectorCollection[i]; i++)
      {
        if(pointer.___style)
        {
          pointer.setAttribute('style', pointer.___style);
        }
        else
        {
          pointer.removeAttribute('style');
        }
      }
      __document.body.style.cssText+=';schabernack';
    }
  
    var searchWithCssSelector=function(selector)
    {
      var selectorText=selector;
      //clearOutline();
      var all=__document.getElementsByTagName('*'), pointer=null, i=0, ret=[];
      var match=null, style='';
      CSSRule.selectorParser.parseSelector(selectorText);
      for( ; pointer=all[i]; i++)
      {
  
        if((match=CSSRule.selectorParser.checkElement(pointer)) /*&& match.matchType*/)
        {
          ret[ret.length]=pointer;
        }
        //opera.postError(match)
      }
      displayCssSelectorSearchTree(ret);
      /*
      for(i=0 ; pointer=ret[i]; i++)
      {
        if(style=pointer.getAttribute('style'))
        {
          pointer.___style=style;
        }
        pointer.style.outline='3px solid #f00';
        pointer.style.backgroundColor='#0f0';
      }
      serchWithCssSelectorCollection=ret;
      document.body.style.cssText+=';schabernack';
      //opera.postError(selector)
      */
    }
  
    /*
          declaration.value
        declaration.importance
        declaration.notInherit
        declaration.overwritten
        */
  
  
    var tempalteMatchingRules=function(match)
    {
      var ret=
      ['ul',
        ['li', match.rule.selectorText+' {'],
        ['li', ['ul']],
        ['li', '}'],
      'class', 'rule'];
  
      var container=ret[2][1], pointer=null, declarations=match.declarations, i=0;
      var styleProp='';
      var style=match.rule.style;
      var setProps={};
  
      for( ; styleProp=style[i]; i++)
      {
        if(setProps[styleProp]  || declarations[styleProp].notInherit) 
        {
          continue;
        }
        setProps[styleProp]=1;
        container[container.length]=
        ['li',
          ['span', styleProp+': '],
          ['span', declarations[styleProp].value+
            (declarations[styleProp].importance?' !important':'')],
        'class', (declarations[styleProp].overwritten?'overwritten':'')]   
      }
      return ret;
    }
  
  
    var detailsShowRules=function()
    {
      if(__selectedElement)
      {
        var styles=__document.styleSheets;
        var sheet=null, i=0, k=0;
        var array=[];
        array[0]=[];
  
        var selectedElementParentChain=[__selectedElement], parent=__selectedElement;
  
        for(i=1; parent=parent.parentElement; i++)
        {
          selectedElementParentChain[selectedElementParentChain.length]=parent;
          array[i]=[];
        }
  
        var rules=null;
        var differentDomain=false;
  
        if(__selectedElement.nodeType==1)
        {
          for(i=0 ; sheet=styles[i]; i++)
          {
            if(!sheet.disabled)
            {
              try
              {
              	rules=sheet.cssRules;
                getMatchingRules(selectedElementParentChain, sheet, array);
              }
              catch(event)
              {
                differentDomain=true;
                break;
              }
              
            }
          }
        }
        if(differentDomain)
        {
          details.clearAndRender(['p', 'stylesheets not accessible']);
        }
        else
        {
          evaluateRules(array);
          var pointer_match=pointer_deepness=null, i=0, k=0;
  
          details.innerHTML='';
  
          for(i=0; pointer_deepness=array[i]; i++)
          {
            for(k=0; pointer_match=pointer_deepness[k]; k++)
            {
              if(pointer_match.onlyNotInheritedRules) 
              {
                continue;
              }
              details.render(tempalteMatchingRules(pointer_match));
            }
            if(i==0)
            {
              details.render(['h2', 'Inherited Rules', 'class', 'inheritedHeader']);
            }
          }
  
        }
        
      }
    }
  
    /*
      pointer.specificity
      pointer.rule
      pointer.onlyNotInheritedRules
      pointer.declarations
        declaration.value
        declaration.importance
        declaration.notInherit
        declaration.overwritten
    */
  
    var  evaluateRules=function(array)
    {
      // TODO or not? element states
      var pointer=null, i=0;
      var properties={}, propertiesPriority={};
      var setProps=null;
      var onlyNotInherited=false;
      var pointer_deepness=pointer_match=null, i=k=m=y=0;
      var style=null;
      var styleProp='';
      var entry=null;
      var entry_2=null;
      var evaluateSpecificity=function(a,b)
      {
        return b.specificity-a.specificity;      
      }
      for(i=0; pointer=array[i]; i++)
      {
        pointer.reverse();
        pointer.sort(evaluateSpecificity);
      }
      for(i=0; pointer_deepness=array[i]; i++)
      {
        for(m=0; pointer_match=pointer_deepness[m]; m++) // match with specificity, rule
        {
          pointer_match.declarations={};
          style=pointer_match.rule.style;
          setProps={};
          onlyNotInherited=true;
  
          for( k=0; styleProp=style[k]; k++) 
          {
            if(setProps[styleProp]) continue;
            setProps[styleProp]=1;
            entry=pointer_match.declarations[styleProp]=
            {
              value: style.getPropertyValue(styleProp),
              importance: style.getPropertyPriority(styleProp)
            }
            if(i && !(inheritedDeclarations[styleProp]))
            {
              entry.notInherit=true;
              continue;
            }
            onlyNotInherited=false;
            if(entry.importance)
            {
              if(propertiesPriority[styleProp])
              {
                entry.overwritten=true;
              }
              else if(properties[styleProp]) // overwrite the previous style
              {
                for(y=0; (pointer=pointer_deepness[y]) && (y<m); y++)
                {
                  if(entry_2=pointer.declarations[styleProp])
                  {
                    entry_2.overwritten=true;
                  }
                }
              }
              propertiesPriority[styleProp]=true;
            }
            else if(properties[styleProp])
            {
              entry.overwritten=true;
            }
            properties[styleProp]=true;
          }
          if(i && onlyNotInherited)
          {
            pointer_match.onlyNotInheritedRules=true;
          }
        }
      }
    }
  
    var checkRule=function(rule, targetParentChain, array)
    {
      var pointer=null, i=0, match=null;
      if(rule.selectorText!=rule.__selectorText)
      {
        rule.__cache=CSSRule.selectorParser.parseSelector(rule.selectorText);
        rule.__selectorText=rule.selectorText;
      }
      CSSRule.selectorParser.setSelectorGroups(rule.__cache);
      for(i=0; pointer=targetParentChain[i]; i++)
      {
        // match is the returned object with specificity (and states) or null
        if(match=CSSRule.selectorParser.checkElement(pointer))
        {
          (array[i][array[i].length]=match).rule=rule;
          break;
        }
      }
    }
  
    var getMatchingRules=function(targetParentChain, sheet, array)
    {
      var rule=null, i=0, k=0, rule_2=0, match=null, pos=0, pointer=null;
      for( k=0; rule=sheet.cssRules[k]; k++)
      { 
        switch (rule.type)
        {
          case 0:
          {
  
            break;
          }
          case 1: // css style rule
          {
            checkRule(rule, targetParentChain, array);
            break;
          }
          case 2: // css charset rule
          {
            break;
          }
          case 3: // css import rule
          {
  
            break;
          }
          case 4: // css media rule
          {
            //mediaRuleContainer=ruleContainer.___add('div', reMediaRule.exec(rule.cssText)[1], 'class', 'non-editable');
            /* TODO
            for(i=0; rule_2=rule.cssRules[i]; i++)
            {
              //getMatchingRule(target, rule_2, array)
              if(match=CSSRule.selectorParser.parse(target, rule_2.selectorText))
              {
                match.rule=rule_2;
                pos=match.position=array.length;
                array[pos]=match;
              }
            }
            */
            //ruleContainer.___add('div', '}', 'class', 'non-editable');
            break;
          }
          case 5: // css font-face rule
          {
            break;
          }
          case 6: // css page rule
          {
            break;
          }
        }
      }
    }
  
    var submitHandler=function(event)
    {
      var ele=event.target, span=null, key='', input=null;
  		if(win_doc.parentWindow.opener==null) 
      {
  			win.close();
  			return;
  		}
      if(event.keyCode==13 && /\bvalue\b/.test(ele.parentNode.className))
      {
        if(__selectedElement && (key=ele.parentNode.parentNode.getAttribute('key')))
        {
          if(key=='__notSet')
          {
            if((input=ele.parentNode.parentNode.getElementsByTagName('input')[0]) &&
              (key=input.value) && ele.value)
            {
              __selectedElement.setAttribute(key, ele.value);
              detailsShowAttributes();
            }
  
          }
          else
          {
            if(ele.value)
            {
              __selectedElement.setAttribute(key, ele.value);
            }
          }
        }
      }
    }
  
    var focusHandler=function(event)
    {
      var ele=event.target;
      switch(__detailViewTab)
      {
        case 'attributes':
        {
          var input=win_doc.getElementById('deleteAttributeSubbar');
          if(input)
          {
            input.disabled=false;
          }
          if(ele.type=='text')
          {
            var liEle=ele.parentNode.parentNode, lis=liEle.parentNode.getElementsByTagName('li'), li=null, i=0;
            for( ; li=lis[i]; i++)
            {
              li.removeClass('selectedAttribute');
              if(li==liEle)
              {
                li.addClass('selectedAttribute');
              }
            }
          }
        }
      }
    }
  
    var inputHandler=function(event)
    {
      var ele=event.target;
      if(/textarea/i.test(ele.nodeName) && __selectedElement &&__selectedElement.nodeType==3)
      {
        __selectedElement.nodeValue=ele.value;
      } 
      else 
      {
  
      }
    }
  
    var ___isResizing=false;
  
    var resizeHandler=function(event)
    {
      catcher.focus();
      var top=event.pageY-delta;
      var _innerHeight=win.innerHeight;
      var separator=win_doc.getElementById('separator');
      if(separator)
      {
        if((top-min_height>0) && (top<(_innerHeight-separator.offsetHeight-min_height)))
        {
          separator.style.top=top+'px';
        }
      }
    }
  
    var __resizeInterval=0;
  
    var __resizeHandler=function()
    {
      var _innerHeight=win.innerHeight;
      var separator=win_doc.getElementById('separator');
      var topFrameResize=win_doc.getElementById('tree');
      var bottomFrameResize=win_doc.getElementById('details');
      var top=parseInt(separator.style.top);
      if(separator && topFrameResize && bottomFrameResize)
      {
        if((top-min_height>0) && (top<(_innerHeight-separator.offsetHeight-min_height)))
        {
          topFrameResize.style.height=(top-topFrameResize.offsetTop)+'px';
          bottomFrameResize.style.height=(_innerHeight-bottomFrameResize.offsetTop)+'px';
        }
      }
    }
  
    var __resizeHandlerJS=function()
    {
      var bottomFrameResize=win_doc.getElementById('details');
      if(bottomFrameResize)
      {
        bottomFrameResize.style.height=(win.innerHeight-bottomFrameResize.offsetTop)+'px';
      }
    }
  
    var resizeStopHandler=function()
    {
      win_doc.removeEventListener('mousemove', resizeHandler, false);
      win_doc.removeEventListener('mouseup', resizeStopHandler, false);
      catcher_2.style.cssText='';
      clearInterval(__resizeInterval);
      __resizeHandler();
    }
  
    var onDocumentScroll=function(event)
    {
      var node=event.target;
      if(/#document|body/i.test(node.nodeName))
      {
        var separator=win_doc.getElementById('separator');
        if(separator)
        {
          win_doc.body.scrollTop=0;
          delta=0;
          //resizeHandler({pageY:parseInt(separator.style.top)});
          __resizeHandler();
        }
      }
    }
  
    var resizeInitHandler=function(event)
    {
      var separator=win_doc.getElementById('separator');
      if(event.target==separator)
      {
        delta=event.pageY-separator.offsetTop;
        win_doc.addEventListener('mousemove', resizeHandler, false);
        win_doc.addEventListener('mouseup', resizeStopHandler, false);
        catcher_2.style.cssText='position:absolute;top:0;left:0;bottom:0;right:0;z-index:100;cursor:n-resize';
        __resizeInterval=setInterval(__resizeHandler, 150);
      }
    }
  
    var docResizeHandler=function()
    {
      var separator=win_doc.getElementById('separator');
      if(separator)
      {
        //resizeHandler({pageY:parseInt(separator.style.top)});
        __resizeHandler();
      }
    }
  
    /********** Event Handlers Document **********/
  
    var clickHandlerMainDocument=function(event)
    {
      if(win_doc && win_doc.documentElement)
      {
        var ele=event.target, arr=[ele[nodeKey]], i=0, rev=[];
        if(event.preventDefault)
        {
          event.preventDefault();
          event.stopPropagation();
        }
        while(ele.parentNode) 
        {
          ele=ele.parentNode;
          arr[arr.length]=ele[nodeKey];
        }
        if(currentHighlight) 
        {
          ___clearHighlight(currentHighlight);
          currentHighlight=null;
        }	
        for( i=arr.length ; i-- ; )
        {
          rev[rev.length]=arr[i];
        }
        parseSourceIndexArray(rev);
      }
      else
      {
        __document.removeEventListener('click', clickHandlerMainDocument, true);
        __document.removeEventListener('mouseover', mouseoverHandler, false);
        win=null;
        win_doc=null;
      }
    }
  
    var mouseoverHandler= function (event) 
    {
      var ele=event.target;
      if(currentHighlight) 
      {
        ___clearHighlight(currentHighlight);
        currentHighlight=null;
      }	
      if( win_doc && event.shiftKey && !(ele==__document.documentElement || /body/i.test(ele.nodeName)) )
      {
        ___highlight(currentHighlight=ele, highlightStyle);			
      } 
    }
  
    var clickElement=function(ele)
    {
      var event=__document.createEvent('Events');
      event.initEvent('click', true, true);
      ele.dispatchEvent(event);
    }
  
    var domChange=function(event)
    {
      //opera.postError(lastTarget);
      if(event.target.nodeType!=3)
      {
        if(lastTarget)
        {
          win.setTimeout(function(){update___sourceIndex();clickHandlerMainDocument({target:lastTarget})}, 50);
        }
        else
        {
          win.setTimeout(function(){update___sourceIndex();parseSourceIndexArray([]);}, 50);
        }
      }
    }
  
    /********** Action Handler **********/
  
    var deleteAttribute=function()
    {
      if(__selectedElement && __detailViewTab=='attributes')
      {
        var lis=details.getElementsByTagName('li'), li=null, i=0;
        var re=/\bselectedAttribute\b/;
        var key='';
        for( ; li=lis[i]; i++)
        {
          if(re.test(li.className))
          {
            key=li.getAttribute('key');
            __selectedElement.removeAttribute(key);
            switch(key.toLowerCase())
            {
              case 'id':
              case 'class':
              {
                clickElement(__selectedElement);
                break;
              }
            }
            break;
          }
        }
        detailsShowAttributes();
      }
    }
  
    /********** Get Data Helpers **********/
  
    var getTarget=function(id)
    {
      var target=null;
      switch(id)
      {
        case '-2':
        {
          return __window;
          break;
        }
        case '-1':
        {
          return __window.document;
          break;
        }
        default:
        {
          return __document.getElementsByTagName('*')[parseInt(id)];
        }
      }
    }
  
    var getLinkType=function(link)
    {
      if(/^[a-z]*\:\/\//i.test(link)) return 'protokol';
      if(/^\//.test(link)) return 'host';
      return 'path';
    }
  
    var __getAttribute=function(node, attrName)
    {
      var ns=null, pos=0;
      if((pos=attrName.indexOf(':'))!=-1)
      {
        return node.getAttribute(attrName.slice(pos+1));
      }
      return node.getAttribute(attrName);
    }
  
    var getAttributes=function(node)
    {
      var attrs='', attr=null, attrsProv, i=0, list=list=win_doc.createElement('ul');
      list.className='propertyList';
      if(node.attributes && node.attributes.length > 0) 
      {
        for( ; attr=node.attributes[i]; i++) 
        {
          if(/^(href|src|data|cite)/i.test(attr.name))
          {
            list.___add
            (
              'li', 
              ['span', linkTemplate(attr.name, __getAttribute(node, attr.name)), 'class', 'key'], 
              ['span', ['input', 'value', __getAttribute(node, attr.name), 'class', 'inputText'], 'class', 'value'],
              'key', attr.name
            );
          }
          else
          {
            list.___add
            (
              'li', 
              ['span', attr.name, 'class', 'key'], 
              ['span', ['input', 'value', __getAttribute(node, attr.name), 'class', 'inputText'], 'class', 'value'],
              'key', attr.name
            );
          }
        }
      }	
      return list;
    }
  
    var updatePath=function(path)
    {
      var pathContainer=win_doc.getElementById('propertyPath');
      if(pathContainer)
      {
        pathContainer.textContent=(__selectedElement.nodeType?'selectedElement.':'window.')+path.join('.');
      }
    }
  
    var setSelectedList=function(list)
    {
      __activeList=list;
      list.addClass('selected');
      var searchfield=null;
      if(searchfield=detailsSubBar.getElementsByTagName('input')[0])
      {
        searchfield.value=__activeList.__searchScope?__activeList.__searchScope:'';
      }
      if((h3=list.previousSibling) && (/^h3$/i.test(h3.nodeName)))
      {
        h3.addClass('selected');
      }
      var uls=details.getElementsByTagName('ul'), ul=null, i=0, h3=null;
      for( ; ul=uls[i]; i++)
      {
        if(ul!=list)
        {
          ul.removeClass('selected');
          if((h3=ul.previousSibling) && (/^h3$/i.test(h3.nodeName)))
          {
            h3.removeClass('selected');
          }
        }
      }
  
    }
  
    var setFilter=function(bol, filter)
    {
      switch (filter)
      {
        case 'nodeProperties':
        {
          filters[filter].checked=bol;
          detailsShowProperties();
          break;
        }
        case 'windowProperties':
        {
          filters[filter].checked=bol;
          detailsShowProperties();
          break;
        } 
        case 'whitespace':
        {
          filters[filter].checked=!bol;
          clickHandlerMainDocument({target:__selectedElement})
          break;
        }
        case 'CSSProperties':
        {
          filters[filter].checked=!bol;
          detailsShowStyles();
          break;
        }
      }
    }
  
    var textOverflow=function(string)
    {
      var maxLength=30;
      if(string.length>maxLength)
      {
        return string.slice(0, string.indexOf(' ', maxLength))+' ...';
      }
      return string;
    }
  
    var getType=function(object, prop, mustUseTry)
    {
      // to prevent try catch
      if(notAccessible[prop])
      {
        return 'notAccessible';
      }
      var newObject=null;
      if(mustUseTry)
      {
        try
        {
          newObject=object[prop];
          if(newObject)
          {
            newObject.toString();
          }
        }
        catch (event)
        {
          return 'domainRestriction'
        }
      }
      else
      {
        newObject=object[prop];
      }
      var ret='';
      switch(ret=(typeof newObject))
      {
        case 'string':
        case 'number':
        case 'boolean':
        {
          return ret;
        }
        case 'function':
        {
          if(/native code/i.test(newObject.toString()))
          {
            return 'nativeFunction';
          }
          return 'function';
  
        }
        default:
        {
          if(newObject instanceof __window.Array)
          {
            return 'array';
          }
          if(!newObject)
          {
            return 'null';
          }
          return 'object';
        }
      }
    }
  
    var sort=function(arr)
    {
      var arr_numbers=[], arr_strings=[], length=arr.length, i=0;
      for( ; i<length; i++)
      {
        if(/^[0-9]*$/.test(arr[i]))
        {
          arr_numbers[arr_numbers.length]=arr[i];
        }
        else
        {
          arr_strings[arr_strings.length]=arr[i];
        }
  
      }
      arr_numbers.sort(function(a,b){return parseInt(a)-parseInt(b)});
      arr_strings.sort();
      return arr_numbers.concat(arr_strings);
    }
  
  	var getPropertyList=function(object, path, searchbox)
    {
      if(!object) object=__window;
      var prop='', i=0, arr=[];
      var filter=null;
      var type='';
      var ret=['ul'];
      var mustUseTry=object.contentWindow?true:false;
      var value='';
      var expandable=true;
  		for(i=0 ; object && (prop=path[i]); i++) 
      {
        object=object[prop];
      }
      
      if(/function/.test(object)) 
      {
        ret[ret.length]=expandableListKeyValueTemplate(object.toString().replace(/^\n*/,'').replace(/\n*$/,''), '');
      }
      else
      {
        filter=getFilter(object);
        for(prop in object) 
        {
          if((prop == nodeKey)  || (prop=='__registered')) continue;
          if(!filter || (filter && !(prop in filter)))
          {
            arr[arr.length]=prop;
          }
        }
        arr=sort(arr);
        // should not happen
        if(!arr.length)
        {
          arr[arr.length]='<empty>';
        }
        for(i=0; prop=arr[i]; i++) 
        {
          type=getType(object, prop, mustUseTry);
          switch(type)
          {
            case 'notAccessible':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, '[not accessible object]', '', type);
              break;
            }
            case 'domainRestriction':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, '<domain restricted>', '', type);
              break;
            }
            case 'null':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, 'null', '', type);
              break;
            }
            case 'string':
            case 'number':
            case 'boolean':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, textOverflow(object[prop].toString()), '', type);
              break;
            }
            case 'nativeFunction':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, '[native function]', '', type);
              break;
            }
            case 'function':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, '['+type+']', 'getProperties', type);
              break;
            }
            case 'array':
            {
              ret[ret.length]=expandableListKeyValueTemplate(prop, '['+type+']', 'getProperties', type);
              break;
            }
            case 'object':
            {
              if(mustUseTry)
              {
                try
                {
                  value=object[prop].toString();
                }
                catch(event)
                {
                  value='<domain restricted>';
                  expandable=false;
                }
              }
              else
              {
                value=object[prop].toString();
              }
              if(/Window/.test(value))
              {
                try
                {
                  object[prop].location.toString();
                }
                catch (event)
                {
                  value+=' <domain restricted>';
                  expandable=false;
                }
              }
              ret[ret.length]=expandableListKeyValueTemplate(prop, value, expandable?'getProperties':'', type);
              break;
            }
          }
        }
      }
  		return win_doc.render(ret.concat(['class', 'propertyListExpandable']));
  	}
  
  	var getComputedStyles=function(ele)
    {
  		var styles=__window.getComputedStyle(ele, null), prop=null, style='';
      var list=win_doc.createElement('ul'), i=0;
      list.className='propertyList';
      //list.___add.apply(list, searchBoxTemplate());
      var filterActive=filters.CSSProperties.checked;
  		for(; prop=cssProperies[i]; i++) 
      {
  			style=styles.getPropertyValue(prop[0]);
        
        if(filterActive)
        {
          if(style!=prop[1])
          {
            getEntryComputedStyle(list, prop[0], style); 
          }
        }
        else
        {
          getEntryComputedStyle(list, prop[0], style); 
        }
  		}
  		return list; 
  	}
  
    /********** clean up **********/
  
    var getPreviousSiblingElement=function(_ele)
    {
      var ele=_ele.previousSibling;
      while(ele && ele.nodeType!=1)
      {
        ele=ele.previousSibling
      }
      return ele;
    }
  
    var getNextSiblingElement=function(_ele)
    {
      var ele=_ele.nextSibling;
      while(ele && ele.nodeType!=1)
      {
        ele=ele.nextSibling
      }
      return ele;
    }
  
    var getEntryComputedStyle=function(list, key, value)
    {
      var link=null, pos=0;
      var reURL=/url *\([\u0022\u0027]([^\u0022\u0027)\u000A]*)[\u0022\u0027)\u000A]/;
      if(/background|content/i.test(key) && (link=reURL.exec(value)))
      {
        pos=value.indexOf(link[1]);
        list.___add
        (
          'li', 
          ['span', key+': ', 'class', 'key'], 
          ['span',
            value.slice(0, pos),
            linkTemplate(link[1]),
            value.slice(pos+link[1].length),
          'class', 'value']
        );
      }
      else
      {
        list.___add('li', ['span', key+': ', 'class', 'key'], ['span', value, 'class', 'value']);
      }
    }
  
    var getFilter=function(object)
    {
      if(object==__window && filters.windowProperties.checked)
      {
        return windowFilter;
      }
      if(object==__window.document && filters.documentProperties.checked)
      {
        return documentFilter;
      }
      if((object instanceof Element) && filters.nodeProperties.checked)
      {
        return nodeFilter;
      }
      return null;
    }
  
    var getOutput=function(container, title, searchbox)
    {
      container.addClass('outputActive');
      var output=container.getElementsByTagName('div')[1];
      delete output.___activeList;
      output.innerHTML='';
      output.className='show';
      output.removeAttribute('style');
      var left=output.offsetLeft, ele=output;
      while(ele=ele.offsetParent) left+=ele.offsetLeft;
      output.style.marginLeft=-(left-5)+'px';
      output.___add('span', 'class', 'closeButton', 'handlerType' ,'clearOutput');
      if(title)
      {
        output.___add('h2', title);
      }
      /*
      if(searchbox)
      {
        output.___add('label', 'search: ', ['input', 'class', 'searchBox', 'handlerType' ,'searchBox'], 'class', 'searchBox');
      }
      */
      return output;
    }
  
    var updateFilters=function()
    {
      var filter='', setting=null;
      for(filter in filters)
      {
        if(setting=win_doc.getElementById(filters[filter].id))
        {
          filters[filter].checked=setting.checked;
        }
      }
    }
    var initFilters=function()
    {
      var filter='', ele=null;
      for(filter in filters)
      {
        if(ele=win_doc.getElementById(filters[filter].id))
        {
          ele.checked=filters[filter].checked;
        }
      }
    }
  
    var update___sourceIndex=function()
    {
      var all=__document.getElementsByTagName('*'), pointer=null, i=0;
      for( ; pointer=all[i]; i++) pointer[nodeKey]=i;
      __document[nodeKey]=-1;
    }
  
  
  
    /********** Helpers **********/
  
    /********** Open **********/
  
  	var createDoc=function()
    {
  
  
  
  	}
  
    this.setWindow=function(win)
    {
      if(__window)
      {
        this.clearWindow();
      }
  
      __window=win;
      __document=win.document;
      __document.addEventListener('click', clickHandlerMainDocument, true);
      __document.addEventListener('mouseover', mouseoverHandler, false);
      __document.addEventListener('DOMNodeRemoved', domChange, false);
      __document.addEventListener('DOMNodeInserted', domChange, false);
  
    }
  
    this.update=function(index)
    {
      update___sourceIndex();
      var title=__document.title;
      if(!title || /^ *$/.test(title))
      {
        title='<title not specified>';
      }
      win_doc.getElementById('header_doc_title').textContent=title;
      win_doc.getElementById('header_location').textContent=
        __window.location.protocol+'//'+__window.location.host+__window.location.pathname;
      if(index)
      {
        __selectedElement=__document.getElementsByTagName('*')[index];
      }
      if(__selectedElement)
      {
        clickHandlerMainDocument({target:__selectedElement})
      }
      else
      {
        parseSourceIndexArray([]);
      }
    }
  
    this.clearWindow=function()
    {
      if(__window)
      {
        __document.removeEventListener('click', clickHandlerMainDocument, true);
        __document.removeEventListener('mouseover', mouseoverHandler, false);
        __document.removeEventListener('DOMNodeRemoved', domChange, false);
        __document.removeEventListener('DOMNodeInserted', domChange, false);
  
      }
      __window=null;
      __document=null;
    }
  
    this.open=function(targetWindow, _win, doc ,container)
    {
  
      if(!__window || targetWindow!=__window)
      {
        this.setWindow(targetWindow);
      }
      win=_win;
      win_doc=doc;
      win_body=doc.body;
      toolsContainer=container;
      toolsContainer.innerHTML='';
      catcher=toolsContainer.render(catcherTemplate());
      catcher_2=toolsContainer.render(catcher2Template());
   	  toolsContainer.render(domConsoleTreeViewTemplate());
      toolsContainer.render(separatorTemplate());
      toolsContainer.render(domConsoleMainViewsTemplate());
      detailsTabs=win_doc.getElementById('detailsTabs');
      detailsSubBar=win_doc.getElementById('detailsSubbar');
      details=win_doc.getElementById('details');
  
      win_doc.addEventListener('click', clickHandlerDOMTree, false);
      win_doc.addEventListener('keyup', keyupHandlerDOMTree, false);
      win_doc.addEventListener('keydown', submitHandler, false);
      win_doc.addEventListener('input', inputHandler, false);
      win_doc.addEventListener('focus', focusHandler, true);
      win_doc.addEventListener('scroll', onDocumentScroll, true);
      win_doc.addEventListener('mousedown', resizeInitHandler, false);
      win_doc.addEventListener('resize', docResizeHandler, false);
  
      resizeHandler({pageY:_win.innerHeight*.6});
      __resizeHandler();
  
      
      initFilters();
  
      this.update();
  
  
      
    }
  
    this.clear=function()
    {
      if(toolsContainer)
      {
        toolsContainer.innerHTML='';
      }
      this.clearWindow();
      if(win_doc)
      {
        //opera.postError(win_doc.nodeName);
        win_doc.removeEventListener('click', clickHandlerDOMTree, false);
        win_doc.removeEventListener('keyup', keyupHandlerDOMTree, false);
        win_doc.removeEventListener('keydown', submitHandler, false);
        win_doc.removeEventListener('input', inputHandler, false);
        win_doc.removeEventListener('focus', focusHandler, true);
        win_doc.removeEventListener('scroll', onDocumentScroll, true);
        win_doc.removeEventListener('mousedown', resizeInitHandler, false);
        win_doc.removeEventListener('resize', docResizeHandler, false);
      }
      win=null;
      win_doc=null;
      win_body=null;
      toolsContainer=null;
      detailsTabs=null;
      detailsSubBar=null;
      details=null;
      catcher=null;
      catcher_2=null;
      list=null;
      __detailViewNodeType=0;
    }
  
    this.setWindowJS=function(win)
    {
      if(__window)
      {
        this.clearWindowJS();
      }
  
      __window=win;
      __document=win.document;
      __selectedElement=win;
  
  
    }
  
    this.updateJS=function()
    {
      var title=__document.title;
      if(!title || /^ *$/.test(title))
      {
        title='<title not specified>';
      }
      win_doc.getElementById('header_doc_title').textContent=title;
      win_doc.getElementById('header_location').textContent=
        __window.location.protocol+'//'+__window.location.host+__window.location.pathname;
      detailsShowProperties();
  
    }
  
    this.clearWindowJS=function()
    {
  
      __window=null;
      __document=null;
      __selectedElement=null;
    }
  
    this.openJS=function(targetWindow, _win, doc ,container)
    {
      
      if(!__window || targetWindow!=__window)
      {
        this.setWindow(targetWindow);
      }
      win=_win;
      win_doc=doc;
      win_body=doc.body;
      toolsContainer=container;
      toolsContainer.innerHTML='';
  
      toolsContainer.render(templates.header(icon_src));
      toolsContainer.render(jsConsoleTemplate());
      detailsSubBar=win_doc.getElementById('detailsSubbar');
      details=win_doc.getElementById('details');
  
      win_doc.addEventListener('click', clickHandlerDOMTree, false);
      win_doc.addEventListener('keyup', keyupHandlerDOMTree, false);
      win_doc.addEventListener('keydown', submitHandler, false);
      win_doc.addEventListener('input', inputHandler, false);
      win_doc.addEventListener('focus', focusHandler, true);
      win_doc.addEventListener('resize', __resizeHandlerJS, false);
      
      __storedSelectedElement=__selectedElement;
      __storedDetailViewTab=__detailViewTab;
      __detailViewTab='properties';
      __detailViewNodeType=1; // not really correct, but should work
      __selectedElement=targetWindow;
      setSubbar();
      detailsShowProperties();
  
      __resizeHandlerJS();
  
    }
  
    this.clearJS=function()
    {
      __detailViewNodeType=0;
      list=null;
      __detailViewTab=__storedDetailViewTab;
      __selectedElement=__storedSelectedElement;
      __storedSelectedElement=null;
  
      if(win_doc)
      {
        win_doc.removeEventListener('click', clickHandlerDOMTree, false);
        win_doc.removeEventListener('keyup', keyupHandlerDOMTree, false);
        win_doc.removeEventListener('keydown', submitHandler, false);
        win_doc.removeEventListener('input', inputHandler, false);
        win_doc.removeEventListener('focus', focusHandler, true);
        win_doc.removeEventListener('resize', __resizeHandlerJS, false);
      }
      win=null;
      win_doc=null;
      win_body=null;
      toolsContainer=null;
      detailsTabs=null;
      detailsSubBar=null;
      details=null;
      catcher=null;
      catcher_2=null;
      list=null;
    }
  
  })(opera.tools)
  
  opera.tools.js=new function(_tools)
  {
    this.open=function(targetWindow, _win, doc ,container)
    {
      
      opera.tools.dom.openJS(targetWindow, _win, doc ,container);
    }
  
    this.clear=function(_win, doc ,container)
    {
      opera.tools.dom.clearJS(_win, doc ,container);
    }
  
    this.setWindow=function(win)
    {
      opera.tools.dom.setWindowJS(win);
    }
  
    this.update=function(_win, doc ,container)
    {
      opera.tools.dom.updateJS();
    }
  
    this.clearWindow=function()
    {
      opera.tools.dom.clearWindowJS();
    }
  
  }(opera.tools)
  

  opera.tools.css=new (function(tools)
  {
  
  
    CSSStyleSheet.prototype._insertRule=function(rule, index) /* currently a bug with the index parameter */
    {
      var rules=[], i=index;
      rules[index]=rule;
      while(rule=this.cssRules[index])
      {
        rules[rules.length]=rule.cssText;
        this.deleteRule(index);
      }
      for( ; rule=rules[i]; i++) this.insertRule(rule, i);
    }
  
    var win=null, body=null;
    var toolsContainer=null;
    var styles=null;
  
    var __window=null;
    var __document=null;
  
    var templates=tools.templates;
  
    var icon_src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADxUlEQVR4Xr1X3UsbWRS%2Fk5nJt4Hqxki6msWl%2B7DQwuahZRELwiLi20KRKEs0FAI%2BiBQWKf0HKr4sPvRhF9qmIWof%2FBfWRgkFaX2xpS8FWz%2FapPqgxkk0k6%2F%2BzuCEtGaYSdPkwC%2F35s6555z5nXPPzHDlcplxHHeNMXYL%2BB24xJoraSABLMP3JofJLw6H42ksFuvu7%2B%2FPd3R0SFgrNsk5f3R05IzH4%2BLExMTu8fFxgAK4t7i4eGd0dPRFsVh8jKj2ALkZ3sG0CPzI83xoaWnp%2BtjY2D8C1gcGBwcL%2BXz%2BCbDFmit54J0oipHh4WE%2F5n8IlPP29vYTyE6pVGKtkEKhsOtyuU4wdQnna8XT01OZtU7ybW1tSp0J6srZ2VlNzfn5%2BRhS01OvB9C8Mz09%2FZeenhIAik4zAFmWfW%2B3f7LZ7fZaVDJBEC6sZ7NZdsX33qdlU%2FVpiAHUBUfO0%2Bk0MyrIr7KPbBpmADWgGcCn5CtWKMqkaOSssdOMmXkulTnYNM4AaNMM4PnafwoD6BP6nYbnFQbC4TAHm8YZ0FA24lRzH2w2zgAMVTb8%2Fe%2BmUiuZTEaBJEkM%2FYNG5T9R%2FiF%2B%2F4sAUqmUuaurS%2F5mBigFNJpMJjWQCyPaK%2BkxHFcKkMYyTo%2B0sLDws9%2FvTyIlckM1cD6y2du%2FauadRA3UYrFwcGABK2YKiGzrMgBlrQAq492Hb4jm6hRQcZIDSoUyflydpd5AKRChIx4eHvJo9Q3VAKduCA9Y0ZhMLJcTACvodiAIBzlHIFYaKVDqgrieKyMAG0Z9BkigrBWAyoAaeU2oqcBc3ceDfgsY4mHbaAq0GUAABNUhzVVUP%2B%2BrAzXh7kW8dJhhu6FGVDVqCxUfoVqfWMBpINuNNyIY1AV0yZaqz%2BFhxak10DADtMHr9TId%2Bf4M4EhVmKAiqxJdxmiOABpjwOl0Ktd6eoy%2Fk0C%2FkhY1BXU%2FjvHfjnP9Q29v79nQ0JCNckp6RgV3XoRzHxpRCsxJNpstW9cLycHBgQ893b2xsfEAzt0AtTMLwOn4JsslIIdTQXa79vf3ZY%2FH87quVzKr1bqN9QyQw%2Fk%2BBKx02gh6dUiAPkEym807uPsU2a%2FFAAe8RKNw9fX1BZPJZJ61QNxut7C%2Bvh7FF9kJMZBGrr0jIyPdc3NzW6wFEggEulGYbZgmKYBnq6urV8choOlRNBr9gJwVmuG4s7NTCAaDl0Oh0PjKygr5%2Fp9%2BlvH%2B9mckErkxNTX128zMjIT8lJr0bWjC6XImEgnz5OTkHvn%2B%2BvP8JuBkzRUJWFM%2Fzz8DmUYjn7rPQckAAAAASUVORK5CYII%3D';
    
    var getTextaresHeight=
    {
      __default:null,
      indent:null,
      copieStyles:
      ['font-family',
        'font-size',
        'font-weight', 
        'margin-bottom',
        'margin-left',
        'margin-right',
        'margin-top',
        'padding-bottom',
        'padding-left',
        'padding-right',
        'padding-top'
      ],
      setStyles:
      ['white-space', 'pre-wrap'],
      copieStyle: function()
      {
        win.document.body.style.overflow='scroll';
        var ele=win.document.getElementById('refHeight');
        var div=win.document.getElementById('toolsContainer');
        if(div)
        {
        
        this.__default.style.cssText=this.getCssText(ele.getElementsByTagName('textarea')[0]);
        this.indent.style.cssText=this.getCssText(ele.getElementsByTagName('textarea')[1]);
        ele.style.width=(div.offsetWidth-10)+'px';
        }
        win.document.body.style.overflow='auto';
      },
      getCssText:function(ele)
      {
        var cssText='', prop='', i=0;
        var styles=win.getComputedStyle(ele, null);
        for( i=0; prop=this.copieStyles[i]; i++)
        {
          cssText+=prop+':'+styles.getPropertyValue(prop)+';';
        }
        for( i=0; i<this.setStyles.length; i++)
        {
          cssText+=this.setStyles[i++]+':'+this.setStyles[i]+';';
        }
        return cssText;
      }
    }
  
    var stylesheetCounter=0;
    var reCSS=/(^[^{]*)\{([^}]*)\}(.*)/;
    var reMediaRule=/^([^{]*\{)/;
  
    var keyupHandler=function(event)
    {
      var ele=event.target;
      if(/^textarea/i.test(ele.nodeName))
      {
        ele.setHeight();
        ele.updateRule();
      }
    }
  
    var cssTextArea=function()
    {
      this.setHeight=function()
      {
        var ref=getTextaresHeight[this.className];
        ref.textContent= this.value+'bb';
        this.style.height=ref.offsetHeight+'px';
      }
      this.updateRule=function()
      { 
        var ret=reCSS.exec(this.value);
        if(ret && ret[1]) try{this.styleRule.selectorText=ret[1]}catch(event){}; // just styleRule.cssText= ?
        if(ret && ret[2]) try{this.styleRule.style.cssText=ret[2]}catch(event){};
        if(ret && ret[3]) opera.postError(3);
      }
    }
  
    var enableSheet=function()
    {
      var sheet=this.parentNode.parentNode.parentNode._sheetRef;
      if(sheet.disabled)
      {
        sheet.disabled=false;
      }
      else
      {
        sheet.disabled=true;
      }
      this.value=sheet.disabled?'enable':'disable';
      //this.parentNode.getElementsByTagName('p')[6].textContent='disabled: '+sheet.disabled;
    }
  
    var sheetProperties=
    [
      'ownerRule',
      'parentStyleSheet',
      'title',
      'type',
      'disabled'
    ];
  
    var exportSheet=function()
    {
      var sheet=this.parentNode.parentNode.parentNode._sheetRef, i=0, text='';
      var rule=null, rules='', mediaRule=null, k=0;
      for( ; rule=sheet.cssRules[i]; i++)
      { 
        switch (rule.type)
        {
          case 1: // css style rule
          {
            rules=rule.style.cssText;
            text+=rule.selectorText +' {\n  '+rules.replace(/; */g, ';\n  ')+'\n  }\n\n';
            break;
          }
          case 2: // css charset rule
          {
            break;
          }
          case 3: // css import rule
          {
            text+=rule.cssText;
            break;
          }
          case 4: // css media rule
          {
            text+=reMediaRule.exec(rule.cssText)[1]+'\n';
            for(k=0; mediaRule=rule.cssRules[k]; k++)
            {
              rules=mediaRule.style.cssText;
              text+='  '+mediaRule.selectorText +' {\n    '+rules.replace(/; */g, ';\n    ')+'\n    }\n';
            }
            text+='  }';
            break;
          }
          case 5: // css font-face rule
          {
            break;
          }
          case 6: // css page rule
          {
            break;
          }
        }
        //rules=rule.style.cssText;
        //text+=rule.selectorText +' {\n  '+rules.replace(/; *//*g, ';\n  ')+'\n  }\n\n';
      }
      window.open('data:text/plain;charset=utf-8,'+encodeURIComponent(text));
    }
  
    var showRules=function()
    {
      var container=this.parentNode.parentNode;
      if(/show/.test(container.className))
      {
        container.className='ruleContainer hide';
        this.value='show rules';
      }
      else
      {
        container.className='ruleContainer show';
        this.value='hide rules';
      }
    }
  
    var getMedias=function(obj)
    {
      var medias='', media='', i=0;
      for( ; media=obj.media[i]; i++) 
      {
        medias+=media+' ';
      }
      return medias;
    }
  
    var templateProperty=function(key, value)
    {
      return ['li', 
          ['span', key+': ', 'class', 'key'], 
          ['span', value, 'class', 'value']
        ]; 
    }
  
    var templateLinkProperty=function(key, link)
    {
      return ['li', 
          ['span', key+': ', 'class', 'key'], 
          ['span',  
            ['a',
              link.getAttribute('href'),
              'href', link.href,
              'target', '_blank'
            ],
            'class', 'value'
          ]
        ]; 
    }
  
    var templateButton=function(label, onclick, className)
    {
      return ['input', 
      'class', className?className:'', 
      'type', 'button', 
      'value', label, 
      'onclick', onclick]
    }
  
    var templateMethods=function(sheet)
    {
      return ['div',
        templateButton('show rules', showRules, 'switcher'),
        templateButton(sheet.disabled?'enable':'disable', enableSheet),
        templateButton('export', exportSheet),
        'class', 'methodesContainer'
      ]
    }
  
    var processSheet=function(sheet)
    {
      stylesheetCounter++;
      var rule=null, mediaRule=null, k=0, i=0, rules='', textarea=null, medias='', media='';
      var ruleContainer=null, mediaRuleContainer=null;
      var methodesContainer=null;
      var container=toolsContainer.___add('div',  '_sheetRef', sheet, 'class', 'boxContainer');
      if(!sheet.title)
      {
        sheet.___title='No: '+stylesheetCounter;
      }
      container.___add('h2', 'Stylesheet '+(sheet.title?sheet.title:sheet.___title));
      var list=container.___add('ul', 'class', 'propertyList');
      if(medias=getMedias(sheet)) 
      {
        list.render(templateProperty('media', medias)); 
      }
      if(sheet.ownerNode && sheet.ownerNode.nodeName)
      {
        list.render(templateProperty('ownerNode', (sheet.ownerNode.nodeName.toLowerCase())));
        if(/^link/i.test(sheet.ownerNode.nodeName))
        {
          list.render(templateLinkProperty('url', sheet.ownerNode));
        };
      }
      for( k=0; media=sheetProperties[k]; k++) 
      {
        if(sheet[media])
        {
          switch (media)
          {
            case 'ownerRule':
            {
              list.render(templateProperty(media, sheet[media].cssText));
              break;
            }
            case 'parentStyleSheet':
            {
              list.render(templateProperty(media, sheet[media].title?sheet[media].title:sheet[media].___title));
              break;
            }
            default:
            {
              list.render(templateProperty(media, sheet[media]));
            }
          }
        }
      }
      ruleContainer=container.___add('div', 'class', 'ruleContainer hide');
      ruleContainer.render(templateMethods(sheet));
      for( k=0; rule=sheet.cssRules[k]; k++)
      { 
        switch (rule.type)
        {
          case 0: // unknown rule
          {
            ruleContainer.___add('div', rule.cssText, 'class', 'non-editable');
            break;
          }
          case 1: // css style rule
          {
            processRule(rule, ruleContainer)
            break;
          }
          case 2: // css charset rule
          {
            break;
          }
          case 3: // css import rule
          {
            ruleContainer.___add('div', rule.cssText, 'class', 'non-editable');
            processSheet(rule.styleSheet);
            break;
          }
          case 4: // css media rule
          {
            mediaRuleContainer=ruleContainer.___add('div', reMediaRule.exec(rule.cssText)[1], 'class', 'non-editable');
            for(i=0; mediaRule=rule.cssRules[i]; i++)
            {
              processRule(mediaRule, ruleContainer, 'indent')
            }
            ruleContainer.___add('div', '}', 'class', 'non-editable');
            break;
          }
          case 5: // css font-face rule
          {
            break;
          }
          case 6: // css page rule
          {
            break;
          }
        }
      }
    }
  
    var getRules=function(style)
    {
      var __cssText='', i=0, styleProp='', setProps={};
      for( ; styleProp=style[i]; i++) 
      {
        // currently there si no check for properties which are set several time
        if(setProps[styleProp]) 
        {
          continue;
        }
        setProps[styleProp]=1;
        __cssText+=(i?';\n':'')
          +styleProp
          +': '
          +style.getPropertyValue(styleProp)
          +(style.getPropertyPriority(styleProp)?' !important':'');
      }
      return __cssText;
    }
  
    var processRule=function(rule, ruleContainer, className)
    {
      var textarea=ruleContainer.___add
      (
        'textarea', 
        'styleRule', rule,
        'class', className?className:'__default'
      );
      textarea.value=rule.selectorText +' {\n  '+getRules(rule.style)+'\n  }';
      textarea.setHeight();
    }
  
    var resizeHandler=function()
    {
      getTextaresHeight.copieStyle();
    }
  
  
  
    this.setWindow=function(win)
    {
      if(__window)
      {
        this.clearWindow();
      }
  
      __window=win;
      __document=win.document;
  
  
    }
  
    this.update=function()
    {
  
      var title=__document.title;
      if(!title || /^ *$/.test(title))
      {
        title='<title not specified>';
      }
  
      toolsContainer.innerHTML='';
  
      var sheet=null, i=0;
      var ruleContainer=null;
      var _setHeightContainer=toolsContainer.___add
      (
        'div',
          ['div',
            ['textarea', 'class', '__default'],
            ['textarea', 'class', 'indent']
          ],
        'id', 'refHeight'
      );
      getTextaresHeight.__default=_setHeightContainer.firstChild.___add('p');
      getTextaresHeight.indent=_setHeightContainer.firstChild.___add('p');
      getTextaresHeight.copieStyle();    
  
      toolsContainer.render(templates.header(icon_src));
  
      styles=__document.styleSheets;
  
      //opera.postError(styles.length);
  
      win.document.getElementById('header_doc_title').textContent=title;
      win.document.getElementById('header_location').textContent=
        __window.location.protocol+'//'+__window.location.host+__window.location.pathname;
  
      for( ; sheet=styles[i]; i++)
      {
        processSheet(sheet);
      }
  
    }
  
    this.clearWindow=function()
    {
      __window=null;
      __document=null;
    }
  
    this.open=function(targetWindow, _win, doc ,container)
    {
      if(!__window || targetWindow!=__window)
      {
        this.setWindow(targetWindow);
      }
      win=_win;
      body=doc.body;
      toolsContainer=container;
     
      cssTextArea.apply(win.HTMLTextAreaElement.prototype);//.setHeight=_setHeight;
      body=win.document.getElementsByTagName('body')[0];
  
      win.document.addEventListener('keyup', keyupHandler, false);
      win.document.addEventListener('resize', resizeHandler, false);
  
      this.update();
  
    }
  
    this.clear=function()
    {
      win.document.removeEventListener('keyup', keyupHandler, false);
      win.document.removeEventListener('resize', resizeHandler, false);
    }
  
  
  })(opera.tools)
  
  

  
  opera.tools.http=new function(tools)
  {
    var templates=tools.templates;
    var win=null;
    var win_doc=null;
    var win_body=null;
    var toolsContainer=null;
    var _request=null;
    var path='';
    var time=0;
    var maxCheck=6000;
    var __window=null;
    var __document=null;
    var __logging=false;
    var __settingsVisible=false;
    var __logs=[];
    var __logIds=[];
    var __logURLs=[];
    var __logTimes=[];
    var logProperties={};
    var setURL=function(url)
    {
      var protocol=__window.location.protocol, host=__window.location.host, path=__window.location.pathname;
      var url_search='';
      var url_fargIdent='';
      var index=0;
      var _url=url;
      if((index=url.lastIndexOf('#'))!=-1)
      {
        url_fargIdent=url.slice(index);
        url=url.slice(0, index);
      }
      if((index=url.lastIndexOf('?'))!=-1)
      {
        url_search=url.slice(index);
        url=url.slice(0, index);
      }
      if(/[a-z]*\:/.test(url))
      {
        index=url.indexOf(':');
        protocol=url.slice(0, index+1);
        url=url.slice(index+1).replace(/^\/*/,'');
        if((index=url.indexOf('/'))!=-1)
        {
          host=url.slice(0,index);
          path=url.slice(index);
        }
        else
        {
          host=url;
          path='';      
        }
      }
      else if(/\.\.\//.test(url))
      {
        path=path.replace(/[^/]*$/,'')+url
      }
      else if(/\.\//.test(url))
      {
        path=path.replace(/[^/]*$/,'')+url;
      }
      else if(/\//.test(url))
      {
        path=url;
      }
      else
      {
        path=path.replace(/[^/]*$/,'')+url;
      }
      return {
        protocol: protocol,
        host: host,
        pathname: path,
        search: url_search,
        fragmentIdentifier: url_fargIdent,
        url: _url
      }
    }
  
    new function()
    {
      this.name='onreadystatechange';
      this.checked=true;
      this.log=function(id, readyState)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
         (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(), 
            'readyState', readyState
          );
        }
      },
      this.template=function(entry)
      {
        return [
          singleEntryHeaderTemplate(this.name, entry),
          ['ul', keyValueTemplate('readyState: ', entry['readyState'].toString())]
        ];
      }
      logProperties[this.name]=this;
    }
    new function()
    {
      this.name='onload';
      this.checked=true;
      this.log=function(id, status, statusText, allResponseHeaders, responseText, responseXML)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(),
            'status', status, 
            'statusText', statusText, 
            'allResponseHeaders', allResponseHeaders, 
            'responseText', responseText, 
            'responseXML', cloneDocument(responseXML)
          );
        }
      }
      //actionEntryTemplate=function(clickHandler, handlerName, text, entry, title)
      this.template=function(entry)
      {
        return [
          singleEntryHeaderTemplate(this.name, entry),
          ['ul',
            keyValueTemplate('status: ', entry.status),
            keyValueTemplate('statusText: ', entry.statusText),
            toggleEntryTemplate(showHeaders, 'toggleResponseHeaders', 'responseHeaders'),
            toggleEntryTemplate(showResponseText, 'toggleResponseText', 'responseText'),
            entry.responseXML.documentElement?
            actionEntryTemplate(showResponseXML, 'toggleResponseXML', 'responseXML', 'document in a new tab'):
            keyValueTemplate('responseXML: ', 'null'),
          'entry', entry]
        ];
      }
      logProperties[this.name]=this;
    }
    //log(id, 'open', arguments);
    new function()
    {
      this.name='open';
      this.checked=true;
      this.log=function(id, __arguments)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(),
            'arguments', __arguments
          );
        }
      },
      this.template=function(entry)
      {
        return [
          singleEntryHeaderTemplate(this.name, entry),
          templateOpenArgs(entry.arguments)
        ];
      }
      logProperties[this.name]=this;
    }
  
    new function()
    {
      this.name='send';
      this.checked=true;
      this.log=function(id, __arguments)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(),
            'data', __arguments[0]
          );
        }
      },
      this.template=function(entry)
      {
        if(!entry.data)
        {
          return [
            singleEntryHeaderTemplate(this.name, entry),
            ['ul', keyValueTemplate('data: ', entry.data==null?'null':'')]
          ];
        }
        if(typeof entry.data=='string')
        {
          return [
            singleEntryHeaderTemplate(this.name, entry),
            ['ul', toggleEntryTemplate(showSendtData, 'toggleSendtData', 'data'), 'entry', entry]
          ];
        }
        return [
          singleEntryHeaderTemplate(this.name, entry),
          ['ul', actionEntryTemplate(showSendtDoc, 'showSendtDoc', 'data', 'document in a new tab'), 'entry', entry]
        ];
      }
      logProperties[this.name]=this;
    }
  
    new function()
    {
      this.name='setRequestHeader';
      this.checked=true;
      this.log=function(id, __arguments)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(),
            'arguments', __arguments
          );
        }
      },
      this.template=function(entry)
      {
        return [
          singleEntryHeaderTemplate(this.name, entry), //header, in DOMString value
          ['ul', 
            keyValueTemplate('header: ', entry.arguments[0]),
            keyValueTemplate('value: ', entry.arguments[1])
          ]
        ];
      }
      logProperties[this.name]=this;
    }
  
    new function()
    {
      this.name='abort';
      this.checked=true;
      this.log=function(id, __arguments)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime()
          );
        }
      },
      this.template=function(entry)
      {
        return singleEntryHeaderTemplate(this.name, entry)
      }
      logProperties[this.name]=this;
    }
  
    new function()
    {
      this.name='getAllResponseHeaders';
      this.checked=true;
      this.log=function(id, ret)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(),
            'allResponseHeaders', ret
          );
        }
      }
      this.template=function(entry)
      {
        return [
          singleEntryHeaderTemplate(this.name, entry),
          ['ul',
            toggleEntryTemplate(showHeaders, 'toggleResponseHeaders', 'responseHeaders'),
          'entry', entry]
        ];
      }
      logProperties[this.name]=this;
    }
    new function()
    {
      this.name='getResponseHeader';
      this.checked=true;
      this.log=function(id, header, value)
      {
        if(this.checked)
        {
          __logs[__logs.length]=new LogEntry
          (
            'id', id, 
            'type', this.name, 
            'time', new Date().getTime(),
            'header', header,
            'value', value
          );
        }
      }
      this.template=function(entry)
      {
        return [
          singleEntryHeaderTemplate(this.name, entry),
          ['ul', 
            keyValueTemplate('header: ', entry.header),
            keyValueTemplate('value: ', entry.value)
          ]
        ];
      }
      logProperties[this.name]=this;
    }
  
    var cloneDocument=function(doc)
    {
      var cloneDoc=__window.document.implementation.createDocument('', 'root', null);
      while(cloneDoc.firstChild)
      {
        cloneDoc.removeChild(cloneDoc.firstChild);
      }
      if(doc.documentElement)
      {
        cloneDoc.appendChild(cloneDoc.importNode(doc.documentElement, true));
      }
      return cloneDoc;
    }
  
    var showHeaders=function(event)
    {
      if(event.target.getAttribute('handler')=='toggleResponseHeaders')
      {
        var toggle=this.getElementsByTagName('span')[0]
        var close=/\bclose\b/.test(toggle.className);
        if(close)
        {
          toggle.className=toggle.className.replace(/close/, 'open');
          this.parentNode.render(templateHeaders(this.parentNode.parentNode.entry.allResponseHeaders));
        }
        else
        {
          toggle.className=toggle.className.replace(/open/, 'close');
          this.parentNode.removeChild(this.parentNode.getElementsByTagName('ul')[0]);
        }
      }
    }
  
    var showResponseText=function(event)
    {
      if(event.target.getAttribute('handler')=='toggleResponseText')
      {
        var toggle=this.getElementsByTagName('span')[0]
        var close=/\bclose\b/.test(toggle.className);
        if(close)
        {
          toggle.className=toggle.className.replace(/close/, 'open');
          this.parentNode.render(templateResponseText(this.parentNode.parentNode.entry.responseText));
        }
        else
        {
          toggle.className=toggle.className.replace(/open/, 'close');
          this.parentNode.removeChild(this.parentNode.getElementsByTagName('div')[0]);
        }
      }
    }
  
    var showSendtData=function(event)
    {
      if(event.target.getAttribute('handler')=='toggleSendtData')
      {
        var toggle=this.getElementsByTagName('span')[0]
        var close=/\bclose\b/.test(toggle.className);
        if(close)
        {
          toggle.className=toggle.className.replace(/close/, 'open');
          this.parentNode.render(templateResponseText(this.parentNode.parentNode.entry.data));
        }
        else
        {
          toggle.className=toggle.className.replace(/open/, 'close');
          this.parentNode.removeChild(this.parentNode.getElementsByTagName('div')[0]);
        }
      }
      
    }
  
    var showOpenMethodArgs=function(event)
    {
      if(event.target.getAttribute('handler')=='toggleOpenMethode')
      {
        var toggle=this.getElementsByTagName('span')[0]
        var close=/\bclose\b/.test(toggle.className);
        if(close)
        {
          toggle.className=toggle.className.replace(/close/, 'open');
          this.render(templateOpenArgs(this.entry.arguments));
        }
        else
        {
          toggle.className=toggle.className.replace(/open/, 'close');
          this.removeChild(this.getElementsByTagName('ul')[0]);
        }
      }
    }
  
    var templateOpenArgs=function(args)
    {
      var argNames=['method', 'url', 'async', 'user', 'password'];
      var ret=['ul'], pointer='', i=0;
      for( ; pointer=args[i]; i++)
      {
        ret[ret.length]=keyValueTemplate(argNames[i]+': ', pointer);
      }
      return ret;
    }
  
    var showResponseXML=function(event)
    {
      if(event.target.getAttribute('handler')=='toggleResponseXML')
      {
        opera.tools.snapshot.open
        (
          {
            document:this.parentNode.parentNode.entry.responseXML, 
            location:__logURLs[this.parentNode.parentNode.entry.id]
          }
        )
      }
    }
  
    var showSendtDoc=function(event)
    {
      if(event.target.getAttribute('handler')=='showSendtDoc')
      {
        opera.tools.snapshot.open
        (
          {
            document:this.parentNode.parentNode.entry.data, 
            location:{} //TODO
          }
        );
      }
    }
  
    var templateResponseText=function(text)
    {
      return ['div', text];
    }
  
  
  
  /*
    var logProperties=
    {
      onreadystatechange: 
      {
        checked: true,
        log:function(id, readyState)
        {
          if(this.checked)
          {
            __logs[__logs.length]=new LogEntry('id', id, 'type', 'onreadystatechange', 'readyState', readyState);
          }
        },
        template: function(entry)
        {
          return ['div',
            ['span', 'onreadystatechange', 'class', 'methode'],
            ['span', 'readyState: ', 'class', 'key'],
            ['span', entry['readyState'].toString(), 'class', 'value']
          ];
        }
      },
      onload:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      setRequestHeader:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      send:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      open:    
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      abort:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      getAllResponseHeaders:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      getResponseHeader:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      },
      overrideMimeType:
      {
        checked: true,
        log:function()
        {
  
        },
        template: function()
        {
  
        }
      }
    }
  */
  
  
  
    var icon_src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEBElEQVR4Xr1XX0hbZxQ%2F908SjDFBJUJrFTpExoYt7UNLEYWO4ZwM2kERtRANiOCDD92DkI65PZQ9ONge9rAXabMg2ofCoO2rVksoSAsttX9pUZiRtFJS80cT781N%2BjvBK0ZzybUh%2FuDkfknOd77f%2FX3nnPtdIZvNkiAIJ4joEuwcrJrKixgsCLuFtZ8KGDRXVlbenJycbGhra1Nra2sTRKRReSCtr6875ubmLAMDAyvRaLSHCVydmpq60tvb%2B1DTtBtgFYIpVAZAaQvsmCRJ3unp6TN9fX1%2FyUR0vqOjI62q6r%2BwJSovVNiyxWLxd3V1ncb4WyZQXVNTEwf%2Bz2QydBhIp9MrTqczjqGTCTC0ZDKp0OFBraqq0gjQCVAqlaJCmJiY%2BGljY6MFQ4HMI4vEXhwcHPyTiiBHAElnSCCRSJx88bb%2Ba7vdXkhKkmWZ9mJzc5O%2BaloVjWLqa5pSAJUh8uKxWIzMAvvL83QC5hRADlAhIDHF9%2BFFSmsKO5qpNUpuWKneLYmIaV4ByGaowIP7%2F7ACPKZiQI3nFBgeHhYR07wCcDYqGfEzS40JlK4AtkDQJ1y98YqeLD6n9ro3pGN0dDTPXxTFnXkcE%2F1F4pL7bAUgu6QHZr87f1zcdyeQnRdk32waUBQliUtofn6%2BpqmpKY7%2FtZIV0Luk7%2FpLevz0GX1zdHknkM%2Fn4z7PJclEJavVagMZF0pY5kS02WzFcwDNxrAKdALsd62%2FmR%2Bg%2B%2B6GDRAAQq%2BXoYATi0tIXgHfzeaAcRJiQl4enD%2BylBeMCbKNjY1lsKC2tbWlIqYFJIxi5xEwVABS7ijwa99x%2BiXwhm6PXzBMboC3jBWwI6aMJBTNbIEZAnl58N%2Ftu7nmldn8QKRE2eCcEt69nBG2idjQCSUcOqSKioqSGpGwOwd%2Bu%2FwF%2Fex%2FTT98%2Fx2pqkrI%2BNwVkvN26SQFzLPgNwEkOHZRBUwRgOns99q%2BO%2BPkBbE8AiU3IrZigP9uAiJUKE0B1LawrUSu4TB%2B935JRmA%2FnQhvSckKOByOXEttbGwks2B%2FVg4KMAHuCwd%2FHGMy13AlOluos7PTxgFzJWYSSM4IiLgxP4p5CkioBzqQoINVg4QjEon8DVmdbERkgYnF0oDjoyMqWJzVcGmAy%2BV6f6AjGfb7I%2BZxkDT%2BTyAgCp4EE2fD7LZlMHcLOfQRFuf4hRTgYI%2FQhJytra2ecDis0iHA7XbLCwsLARxc4zKrjXZ5tLu7u2F8fHyJDgE9PT0N2JoqDMNM4B6e2y39AGS6HggEVtfW1tJUBtTV1ckej6fe6%2FX2z87O8toz%2FHFraGjoR7%2Fff3ZkZOQUTjgJ7E%2BmTO%2BGfFB1BINBK86MIV577%2Bt5O8xB5UUCdl9%2FPf8EQXcC5NdnTqAAAAAASUVORK5CYII%3D';
    
    var keyValueTemplate=function(key, value, keyClass, valueClass)
    {
      return ['li', 
          ['span', key, 'class', 'key'+(keyClass?' '+keyClass:'')], 
          ['span', value, 'class', 'value'+(valueClass?' '+valueClass:'')]
        ]
    }
  
    var templateHeaders=function(responseHeaders, status, time, containerClass)
    {      
      var ret=['ul'];
      if(status)
      {
        ret[ret.length]=keyValueTemplate('status:', ' '+status);
      }
      var requestHeader=responseHeaders.split('\n');
      var i=0, header='', pos=0;
      for( ; i<requestHeader.length; i++)
      {
        header=requestHeader[i];
        pos=header.indexOf(':');
        if(header && (pos>0))
        {
          ret[ret.length]=keyValueTemplate(header.slice(0, pos+1), header.slice(pos+1))
        }
      }
      if(time)
      {
        ret[ret.length]=keyValueTemplate('', ' time used: '+time+' millisec', 'empty', 'time');
      }
      if(containerClass)
      {
        ret=ret.concat(['class', containerClass]);
      }
      return ret;
    }
  
    var ___setCookie=function(name, value, time)
    {
      
      __document.cookie = name+"="+escape(value)+
        "; expires="+(new Date(new Date().getTime()+time)).toGMTString()+"; path=/";
    }
  
    var showNewCookie=function()
    {
      var container=win_doc.getElementById('newCookies');
      container
      if(container)
      {
        if(this.value=='new cookie')
        {
          this.value='hide new cookie';
          container.render(templateNewCookie(container));
        }
        else
        {
          this.value='new cookie';
          container.innerHTML='';
        }
      }
    }
  
    var templateNewCookie=function(obj)
    {
      return ['div',
        ['ul',
          ['li', 
            ['span', 'name:', 'class', 'key'], 
            ['span', 
              ['input',  
                'class', 'inputText', 
                'oninput', function(){obj.__key=this.value} 
              ], 
            'class', 'value']
          ],
          ['li', 
            ['span', 'value:', 'class', 'key'], 
            ['span', 
              ['input', 
                'class', 'inputText', 
                'oninput', function(){obj.__value=this.value} 
              ], 
            'class', 'value']
          ],
          expiresTemplate(obj),
          ['li',  
            ['span',  
              ['input', 'type', 'button', 'value', 'save', 'onclick', ___save], 
            'class', 'key', 'colspan', '2']
          ],
        'class', 'propertyList editTable'
      ], 'class', 'key editBox']
    }
  
    var templateCookis=function(request)
    {
      var ret=['ul'];
      var cookies=__document.cookie.split(/ *; */);
      var i=0, cookie='', key='', value='';
      for( ; i<cookies.length; i++)
      {
        cookie=cookies[i].split(/ *\= */);
        key=cookie[0];
        value=decodeURIComponent(cookie[1]);
        if(key)
        {
          ret[ret.length]=keyValueCookieTemplate(key, value)
        }
      }
      ret=ret.concat(['class', 'propertyList', 'id', 'cookieList']);
      return ret;
  
    }
  
    var templateXHRLogger=function()
    {
      return ['div',
        ['div', 
          ['input', 'type', 'button', 'value', 'start log', 'onclick', startStopLogging],
          ['input', 'type', 'button', 'value', 'show settings', 'onclick', showHideSettings],
          ['input', 'type', 'button', 'value', 'clear log', 'onclick', clearLog],
          'id', 'xhrLoggerToolbar'],
        ['div', 'id', 'logSettingsContainer'],
        ['ul', 'id', 'xhrLoggerLog'],
        'id', 'xhrLogger'];
    }
  
    var startStopLogging=function()
    {
      if(__logging)
      {
        stopLogging();
        this.value='start log';
        __logging=false;
      }
      else
      {
        startLogging();
        this.value='stop log';
        __logging=true;
      }
  
    }
  
    var showHideSettings=function()
    {
      if(__settingsVisible)
      {
        hideSettings();
        this.value='show settings';
        __settingsVisible=false;
      }
      else
      {
        showSettings();
        this.value='hide settings';
        __settingsVisible=true;
      }
    }
  
    var clearLog=function()
    {
      XHRWrapper.idCounter=0;
      __logs=[];
      __logIds=[];
      __logURLs=[];
      __logTimes=[];
      updateLogs();
    }
  
    var stopLogging=function()
    {
      __window.XMLHttpRequest=XHRWrapper.XHR;
    }
  
    var startLogging=function()
    {
      XHRWrapper.XHR=__window.XMLHttpRequest;
      __window.XMLHttpRequest=XHRWrapper;
    }
  
    var showSettings=function()
    {
      win_doc.getElementById('logSettingsContainer').render(logSettingsTemplate());
    }
  
    var hideSettings=function()
    {
      win_doc.getElementById('logSettingsContainer').innerHTML='';
    }
  
    var logSettingsTemplate=function()
    {
      var ret=['ul'];
      var setting='';
      for(setting in logProperties)
      {
        ret[ret.length]=['li',
          ['label',
            ['input', 'type', 'checkbox', 'value', setting, 'onchange', setSetting, 'checked', logProperties[setting].checked],
            setting]];
      }
      return ret.concat(['id', 'logSettings']);
    }
  
    var setSetting=function()
    {
      logProperties[this.value].checked=this.checked;
    }
  
    var addLogEntry=function(id)
    {
      var logContainer=win_doc.getElementById('xhrLoggerLog');
      if(logContainer)
      {
        logContainer.render(logEntryTemplate(id));
      }
    }
  
    var logEntryTemplate=function(id)
    {
      return ['li', logEntryHeaderTemplate(id)];
    }
  
    var logEntryHeaderTemplate=function(id)
    {
      return ['h3',
          ['span', 'class', 'toggle close', 'handler', 'toggle'], 
          ['span', id.toString(), 'class', 'logId', 'handler', 'toggle'], 
          ['span', __logURLs[id].pathname, 'class', 'logURL', 'handler', 'toggle'],
        'handler', 'toggle', 'onclick', showEntryLog]
    }
  
    var singleEntryHeaderTemplate=function(name, entry)
    {
      return ['h3', name, 
        ['span', (entry.time-__logTimes[entry.id])+' millisec', 'class', 'time'], 
      'class', 'methode']
    }
  
    var toggleEntryTemplate=function(clickHandler, handlerName, text)
    {
      return ['li',
        ['h3',
          ['span', 'class', 'toggle close', 'handler', handlerName], 
          text, 
        'handler', handlerName, 'onclick', clickHandler]
        ]
    }
  
    var actionEntryTemplate=function(clickHandler, handlerName, text, title)
    {
      return ['li',
        ['h3',
          ['span', 'class', 'action', 'handler', handlerName], 
          text, 
        'handler', handlerName, 'onclick', clickHandler, 'title', title]
        ]
    }
  
    var showEntryLog=function(event)
    {
      //opera.postError(event.target.nodeName+' '+event.target.getAttribute('handler'));
      if(event.target.getAttribute('handler')=='toggle')
      {
        var toggle=this.getElementsByTagName('span')[0]
        var close=/\bclose\b/.test(toggle.className);
        var id=parseInt(this.getElementsByTagName('span')[1].textContent), logs=[], log=null, i=0, div=null;
        var query='';
        var container=null;
        if(close)
        {
          toggle.className=toggle.className.replace(/close/, 'open');
          for( ; log=__logs[i]; i++)
          {
            if(log.id==id)
            {
              logs[logs.length]=log;
            }
          }
          container=this.parentNode.render(['div']);
          for(i=0; log=logs[i]; i++)
          {
            container.render(logProperties[log.type].template(log));
          }
        }
        else
        {
          this.parentNode.clearAndRender(logEntryHeaderTemplate(id));
        }
      }
    }
  
    var updateCookies=function()
    {
      var container=win_doc.getElementById('cookieList');
      if(container)
      {
        container.parentNode.replaceChild(win_doc.render(templateCookis()), container);
      }
    }
  
  
  
    var ___edit=function()
    {
      var li=this.parentNode.parentNode;
      li.innerHTML='';
      li.render(editTemplate(li))
    }
    var ___cancel=function()
    {
      
      var li=this.parentNode.parentNode.parentNode.parentNode.parentNode;
      li.parentNode.replaceChild(win_doc.render(keyValueCookieTemplate(li.__key.toString(), li.__value.toString())), li);
      
    }
    var ___delete=function()
    {
      var li=this.parentNode.parentNode.parentNode.parentNode.parentNode;
      ___setCookie(li.__key.toString(), '', -1000);
      updateCookies();
    }
    var ___save=function()
    {
      var ele=this.parentNode.parentNode.parentNode.parentNode.parentNode;
      ___setCookie(ele.__key.toString(), ele.__value.toString(), ele.__expires);
      updateCookies();
    }
    var editTemplate=function(obj)
    {
      return ['div',
        ['ul',
          ['li', 
            ['span', 'cookie:', 'class', 'key'], 
            ['span', obj.__key.toString(), 'class', 'value'],
            ['span', 
              ['input', 
                'type', 'button', 
                'class', 'cookieToggle close', 
                'onclick', ___cancel],
            'class', 'value']
          ],
          ['li', 
            ['span', 'value:', 'class', 'key'], 
            ['span', 
              ['input', 
                'value', obj.__value, 
                'class', 'inputText', 
                'oninput', function(){obj.__value=this.value} 
              ], 
            'class', 'value', 'colspan', '2']
          ],
          expiresTemplate(obj, '2'),
          ['li',  
            ['span',  
              ['input', 'type', 'button', 'value', 'delete', 'onclick', ___delete], 
              ['input', 'type', 'button', 'value', 'save', 'onclick', ___save], 
            'class', 'value', 'colspan', '3']
          ],
        'class', 'propertyList editTable'
      ], 'colspan', '3', 'class', 'key editBox']
    }
    var expiresTemplate=function(obj, colspan)
    {
      obj.__expires=31104000000;
      return ['li', 
        ['span', 'expires:', 'class', 'key'], 
        ['span', 
          ['select', 
            ['option', '1 hour', 'value', '3600000'],
            ['option', '1 day', 'value', '86400000'],
            ['option', '1 month', 'value', '2592000000'],
            ['option', '1 year', 'value', '31104000000', 'selected', 'selected'],
          'class', 'inputText', 'onchange', function(){obj.__expires=parseInt(this.value)}], 
        'class', 'value', 'colspan', colspan?colspan:1]
      ]
    }
    var keyValueCookieTemplate=function(key, value, keyClass, valueClass)
    {
      return ['li', 
          ['span', key, 'class', 'key'+(keyClass?' '+keyClass:'')], 
          ['span', value, 'class', 'value'+(valueClass?' '+valueClass:'')],
          ['span', keyClass=='empty'?'':['input', 'type', 'button', 'onclick', ___edit, 'class', 'cookieToggle open'], 'class', 'value'],
          '__key', new String(key),
          '__value', new String(value),
        ]
    }
  
  
    /* xhr logger */
  
    var LogEntry=function()
    {
      var i=0, length=arguments.length;
      for( ; i<length; i+=2)
      {
        this[arguments[i]]=arguments[i+1];
      }
    }
  
    var XHRWrapper=function()
    {
      var props=XHRWrapper.props;
      var xhr=null;
      var id=0;
      var log=function()
      {
        //opera.postError(arguments);
      }
      var update=function(wrapper)
      {
        var prop='', i=0;
        for( ; prop=props[i]; i++)
        {
          wrapper[prop]=xhr[prop];
        }
      }
      var init=function(wrapper)
      {
        xhr=new XHRWrapper.XHR();
        __logIds[__logIds.length]=id=XHRWrapper.idCounter++;
        
        xhr.onreadystatechange=function()
        {
          logProperties.onreadystatechange.log(id, this.readyState);
  
          update(wrapper);
          if(wrapper.onreadystatechange)
          {
            wrapper.onreadystatechange();
          }
        }
        xhr.onload=function(event)
        {
          addLogEntry(id);
          logProperties.onload.log(id, this.status, this.statusText, this.getAllResponseHeaders(), this.responseText, this.responseXML);
          //this.log=function(id, status, statusText, allResponseHeaders, responseText, responseXML)
          //log(id, 'onload', xhr.status, xhr.statusText, xhr.getAllResponseHeaders(), xhr.responseText, xhr.responseXML);
          
          update(wrapper);
          if(wrapper.onload)
          {
            wrapper.onload(event);
          }
        }
        XHRWrapper.initWrapper.apply(wrapper, [xhr, log, id]);
        update(wrapper);
      }
      init(this);
    }
  
    //XHRWrapper.XHR=XMLHttpRequest;
    XHRWrapper.idCounter=0;
    XHRWrapper.defaults=
    {
      readyState: 1,
      responseText: 1,
      responseXML: 1,
      status: 1,
      statusText: 1,
      onreadystatechange: 1,
      onload: 1,
      setRequestHeader: 1,
      send: 1,
      open: 1,
      abort: 1,
      getAllResponseHeaders: 1,
      getResponseHeader: 1,
      overrideMimeType: 1
    }
    XHRWrapper.props=['readyState', 'responseText', 'responseXML', 'status', 'statusText'];
    XHRWrapper.initWrapper=function(xhr, log, id)
    {
      var a='';
      this.onreadystatechange=null;
      this.readyState=0;
      this.responseText=null;
      this.responseXML=null;
      this.status=0;
      this.statusText='';
      this.setRequestHeader=function()
      {
        //log(id, 'setRequestHeader', arguments);
        logProperties.setRequestHeader.log(id, arguments);
        xhr.setRequestHeader.apply(xhr, arguments);
      }
      this.send=function()
      {
        logProperties.send.log(id, arguments);
        xhr.send.apply(xhr, arguments);
      }
      this.open=function()
      {
        __logURLs[id]=setURL(arguments[1]);
        __logTimes[id]=new Date().getTime();
        logProperties.open.log(id, arguments);
        //log(id, 'open', arguments);
        
        xhr.open.apply(xhr, arguments);
      }
      this.abort=function()
      {
        //log(id, 'abort');
        logProperties.abort.log(id);
        xhr.abort();
        addLogEntry(id);
      }
      this.getAllResponseHeaders=function()
      {
        var ret=xhr.getAllResponseHeaders();
        logProperties.getAllResponseHeaders.log(id, ret);
        //log(id, 'getAllResponseHeaders', ret);
        return ret;
      }
      this.getResponseHeader=function()
      {
        var ret=xhr.getAllResponseHeaders.apply(xhr, arguments);
        logProperties.getResponseHeader.log(id, arguments[0], ret);
        //log(id, 'getResponseHeader', arguments, ret);
        return ret;
      }
      this.overrideMimeType=function()
      {
        //log(id, 'overrideMimeType', arguments);
        xhr.overrideMimeType.apply(xhr, arguments);
      }
      for(a in xhr)
      {
        if(!XHRWrapper.defaults[a])
        {
          this[a]=function()
          {
            var ret=xhr[a].apply(xhr, arguments);
            log(id, a, arguments, ret);
            return ret;
          }
        }
      }
    }
  
    var updateLogs=function()
    {
      var id=0, i=0, container=win_doc.getElementById('xhrLoggerLog');
      if(container)
      {
        container.innerHTML='';
        for( ; i<__logIds.length; i++)
        {
          container.render(logEntryTemplate(__logIds[i].toString()));
        }
      }
    }
  
    var doHeadRequest=function()
    {
      time=new Date().getTime();
      path=__window.location.protocol+'//'+__window.location.host+__window.location.pathname;
      var request=new XMLHttpRequest();
      request.onload=function()
      {
        _request=this;
        win_doc.getElementById('httpheader').
          clearAndRender(templateHeaders(_request.getAllResponseHeaders(), _request.status.toString(), time=(new Date().getTime()-time), 'propertyList'));
      }
      request.open(this.getAttribute('methode'), path+'?time:'+(new Date().getTime()) );
      request.send(null);
    }
  
  
    /* to start log */
    //XMLHttpRequest=XHRWrapper;
  
    /* to stop log */
    //XMLHttpRequest=XHRWrapper.XHR;
  
    /* end xhr logger */
  
    this.setWindow=function(win)
    {
      if(__window)
      {
        this.clearWindow();
      }
  
      __window=win;
      __document=win.document;
  
  
    }
  
    this.update=function()
    {
  
      var title=__document.title;
       toolsContainer.innerHTML='';
      var container=null;
  
      toolsContainer.render(templates.header(icon_src));
      toolsContainer.render(['div',
        ['h2', 'HTTP headers:'],
       ['p', 
          ['input', 
            'type', 'button', 
            'methode', 'HEAD',
            'value', 'using HEAD request', 
            'onclick', doHeadRequest],
          ['input', 
            'type', 'button', 
            'methode', 'GET',
            'value', 'using GET request', 
            'onclick', doHeadRequest]
        ],
        ['div', 'id', 'httpheader'],
        'class', 'boxContainer']);
      if(_request)
      {
        win_doc.getElementById('httpheader').
          render(templateHeaders(_request.getAllResponseHeaders(), _request.status.toString(), time, 'propertyList'));
      }
      toolsContainer.render(['div',
        ['h2', 'Cookies:'],
        ['p', ['input', 'type', 'button', 'value', 'new cookie', 'onclick', showNewCookie]],
        ['div', 'id', 'newCookies'],
        templateCookis(),
        'class', 'boxContainer']);
      toolsContainer.render(['div', 
        ['h2', 'XHR Logger:'],
        templateXHRLogger(),
        'class', 'boxContainer']);
      updateLogs();
  
  
  
      if(!title || /^ *$/.test(title))
      {
        title='<title not specified>';
      }
      win_doc.getElementById('header_doc_title').textContent=title;
      win_doc.getElementById('header_location').textContent=
        __window.location.protocol+'//'+__window.location.host+__window.location.pathname;
  
    }
  
    this.clearWindow=function()
    {
  
      __window=null;
      __document=null;
  
    }
  
    this.open=function(targetWindow, _win, doc ,container)
    {
  
      if(!__window || targetWindow!=__window)
      {
        this.setWindow(targetWindow);
      }
  
      win=_win;
      win_doc=doc;
      win_body=doc.body;
      toolsContainer=container;
      this.update()
    }
  
    this.clear=function()
    {
      if(toolsContainer)
      {
        toolsContainer.innerHTML='';
      }
      win=null;
      win_doc=null;
      win_body=null;
      toolsContainer=null;
    }
  
  }(opera.tools)
  
  
  

  opera.tools.snapshot=new function()
  {
    var ___settingsLiveSource={lines:1,lineNumbers:1,tag:'#05F',attrTitle:'#E00',attrValue:'#C0C',attrDoc:'#800080',comment:'green',darkLine:'#FAFAFA',lineHead:'#999'}
  
    var tab='  ';
    var emptyTags={img:1, br:1, link:1, input:1, hr:1, meta:1};
    var xml=false;
    var counter=0;
    var showLinenumbers=___settingsLiveSource.lineNumbers;
    var showLines=___settingsLiveSource.lines;
    var icon_src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAE4ElEQVR4XrVXW0htZRCerdv7HbyRBopPggfrdNROoJEP0pNyVMhQH1IJQqweRMJEBNtKgoTK1tStsjGwLeKDkuiL%2BBCd1EBEA5XSvCCY9%2Fvd1f9NDGcvsp3mduBn9rf%2FtWZmfTP%2FzFqG8%2FNz8vDweE5En6j1vloh9Liyo9YParUo3y8NRPSGl5fXlNlsprS0NAoLCyPIzc0NaxcXF6fivb09GhoaopKSEjo6OnoTAbQq5x8XFRWRwQBIpGka1KNii8VCxcXFbUaFX2RkZGCTozs%2BPiaIp6cn67OzM6fiq6srCg0NpaysLASQjZC0i4sLgqytrT2qc8GRkZGs3d3dCQxIjnh5e3szPjk5gXo0LDXBDEhkW1tbrE9PT1l3dnbS3Nwc1dXVMf7y%2Bz9Zm3JCWavilevvhYODg3XMaOoCTR0JbXV1VZufn9dmZ2fxWzDWg%2FHi4qJg8afBt9H%2BqEgBurq6sm5ubmYGGhsbGX%2F3%2BRzZywvT66x9fHzk%2Fn%2FDOHIktSb%2BJAWIhnOytLTEOdre3iZfX1%2Bn5nxlZYWCgoI4mPDwcPjjlHAAkqONjQ0%2BJoouio6O%2Fs8a6PviD3Ik%2BQ2xU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r9O2A8KZoa%2FpPPM2DpjPg%2B7EAAb6nj8AuOSXp6OuhC3sWYUwYRghGMIz8wMEBlZWX4%2FcygziW6k3yep6sVQI8rmMkDarWoVLz8C5yd%2B2c3n8IiAAAAAElFTkSuQmCC';
    var __window=null;
    var __document=null;
  
    var openTagNameHead=function(name)
    {
      return "<span class='tag'>&lt;"+name+"";
    }
  
    var openTagNameFoot=function(xmlemptyTag)
    {
      return (xmlemptyTag?'/':'')+"&gt;</span>";
    }
  
    var closeTagName=function(name, xmlemptyTag)
    {
      if(xmlemptyTag || emptyTags[name.toLowerCase()]) return '';
      return "<span class='tag'>&lt;/"+name+"&gt;</span>";
    }
  
    var getDoctype=function()
    {
  		var doctype=__document.doctype, code='';
  		if(doctype) 
      {
        code=lineHead()+openTagNameHead('!DOCTYPE')+" <span class='attrDoc'>"+doctype.nodeName+
  			(doctype.publicId?' PUBLIC "'+doctype.publicId+'"':'')+
  			(doctype.systemId?'</span></span></span></li>'+lineHead()+'<span class=\'tag\'><span class=\'attrDoc\'>'+tab+'"'+doctype.systemId+'"':'')+"</span>"+openTagNameFoot()+'</span></li>';
      }
      return code;
    }
  
    /* this is not really good */
  
    var __getAttribute=function(node, attrName)
    {
      var ns=null, pos=0;
      if((pos=attrName.indexOf(':'))!=-1)
      {
        return node.getAttribute(attrName.slice(pos+1));
      }
      return node.getAttribute(attrName);
    }
  
    var getAttrs=function(ele)
    {
      var attrs=ele.attributes, attr=null, realAttr=null, ret='', i=0;
      for( ; attr=attrs[i]; i++)
      {
        realAttr=__getAttribute(ele, attr.name);
        if(realAttr && 
          !(ele.nodeName.toLowerCase()=='a' && attr.name=='SHAPE' && realAttr=='rect'))
        {
          realAttr=realAttr.replace(/</g,'&lt;').replace(/</g,'&lt;').replace(/\t/g, tab);
          ret+=" <span class='attrTitle'>"+attr.name+"</span>"
            +"="
            +"<span class='attrValue'>\""+realAttr+"\"</span> ";
        }
      }
      return ret;
    }
  
    var getTextNodeData=function(ele)
    {
      return text=ele.nodeValue.replace(/[\n\t\r\u00A0]+ */g,'').
        replace(/ +/g,' ').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    }
  
    var getIndent=function(deep)
    {
      var i=0, ret='';
      while(i<deep)
      {
        ret+=tab;
        i++;
      }
      return ret;
    }
  
    var lineHead=function()
    {
      var lineNumber=counter.toString();
      while(lineNumber.length<3) lineNumber='0'+lineNumber;
      return "<li class='line"+(showLines&&((counter++)&1)?" dark'":"'")+"><span>";//"<p class='line"+(showLines&&((counter++)&1)?" dark'":"'")+"><span class='lineHead'></span>";
    }
  
    this.updateNumbers=function(ele)
    {
      if(ele.checked)
      {
        ele.ownerDocument.body.className='';
      }
      else
      {
        ele.ownerDocument.body.className='hideLineNumbers';
      }
    }
  
    var getLayer=function(ele, deep, singleText)
    {
      var indent=getIndent(deep++);
      var text='';
      switch (ele.nodeType)
      {
        case 1:
        {
          var childs=ele.childNodes, child=null, i=0;
          var simple=(childs.length==0)||(childs.length==1 && childs[0].nodeType==3);
          var xmlemptyTag=xml&&childs.length==0;
          var ret=lineHead()+indent+openTagNameHead(ele.nodeName)+getAttrs(ele)+
            openTagNameFoot(xmlemptyTag);
          if(!simple) ret+='</span></li>';
          for( ; child=childs[i]; i++)
          {
            ret+=getLayer(child, deep, !simple&&child.nodeType==3);
          }
          if(simple)
          {
            // more carful
            ret+=(/textarea/i.test(ele.nodeName)?ele.value:'')+closeTagName(ele.nodeName, xmlemptyTag)+'</span></li>';
          }
          else
          {
            ret+=lineHead()+indent+closeTagName(ele.nodeName, xmlemptyTag)+'</span></li>';
          }
          return ret; 
        }
  
        case 3:
        {
          //text=encodeURIComponent(ele.nodeValue.replace(/[\n\t\r\u00a0]/g,'').replace(/ +/g,' '));
          
          if((text=getTextNodeData(ele)) && singleText) 
          {
            return lineHead()+indent+text+'</span></li>';
          }
          else
          {
            return text;
          }
        }
        case 8:
        {
          text=getTextNodeData(ele);
          return lineHead()+indent+"<span class='comment'>&lt;!--"+text+'--&gt;</span></span></li>';
          /*
          if(text && singleText) 
          {
            
          }
          else
          {
            return "<span class='comment'>&lt;!--"+text+'&gt;</span>';
          }
          */
        }
  
        case 4:
        {
          text=getTextNodeData(ele);
          return lineHead()+indent+"<span class='cdata'>&lt;![CDATA[</span>"+text+
            "<span class='cdata'>]]&gt;</span></span></li>";
        }
  
        
      }
  
      return ele.nodeType
    }
  
    var getLiveMarkup=function()
    {
      var markup=getDoctype();
      var ele=__document.documentElement;
      markup+=getLayer(ele,0);
      return markup;
    }
  
    this.open=function(win)
    {
      if(!win)
      {
        win=top;
      }
      __window=win;
      __document=win.document;
      xml=/[a-z]/.test(__document.documentElement.nodeName);
      var markup='<!DOCTYPE html PUBLIC><html><head><title></title>'
          +'<style type=\'text/css\'>'
          +'body {padding:5px;margin:0;font-family:sans-serif;font-size:.7em;background: #FFF url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAqCAIAAAD9HKYrAAAAOUlEQVQY062MsQ2AQBDDrOw%2F6xc0TxVTHHoxAEXkwnLY%2B0YN8NvEKEEz30MdR03x%2BLav97Tfbq3rAYdRNs%2F1y8dMAAAAAElFTkSuQmCC") scroll repeat-x 0 2px;color:#000;}#logo {height:40px;border:none;padding:1px;margin:0;}#logo a{ content:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHQAAAAPCAYAAAA1f%2BslAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAALmSURBVFjD7VnRjeQgDE0LtEALtJAW0kJaoAVaoAVaoAX%2B5psWaIElOnP3xmfCjFazl9ENkqUhcRLg2c%2FPu8vyGe8wTLPaLE89b8uim6VmuVklO%2Bb%2B9utFPzG2ZrFZIQvN1osfsqc1%2F8TQBGh9FNAOZCBDcPcXLzbAYhNFYZ%2FvFwVTUeBZmltau7kUoOz6DqC%2BaqEWqETD9R02YC4I6EZr62uubH49QOle6JnL%2FD1kcbwRPdLvu6xuv7fuJ3y%2B0CI34V6ke57VEU%2BAJ5pHgZ41UHgWMj3Dc8d7HGWdh%2FcmyECJVRI9U8H6fhSswwPzxEEpMfTOTBZYcEiAavLre7SPANrByOB7AFkIVE%2B%2FD58VsjoKQbE%2FGXU7EwKaHVqEw8dM1lCLESD8fgWfSoBqqN8eqN9O6BZLRlz%2BBL9maw2DAF5hPQECuQCo0lklCPDwLKCV5r6DBz4GMlUBTSu6X8jUgLbqhNaqsKmViZMKAsUzHyUoRARAMbC4skwTuh1RbmAMg89mxhYcZEfXwgBQBaCrZyi3Z1yiOYqlv4xnJGXtHWULBzbL0DTJaC7pM6NBNMUA4PV5Beqrg%2B8FAWQJ0Dz4RgFfZJ2zPUl7D%2FCs%2B723CaC9JjrItkqZ6phZltVByuhv1NARoCvbfIHnHLMzAFCgOZjXE7r9l4D2oM93DHWich1dL0CfPfvsRGh1ms031gx777dmoZkGajlTuVIdMQLlBha5Zy3PIwBIh7gN1GwRSsF3KNdPKHeUGErqQyNkYmH1UsO9DH1rYn4O3mkZoKVZbeZYJs76UM3UJIoiFBBGEClJEEUc mAhr8GwdZ3S7MCGTTkSRpAFQKzwqihSIqHBXmkC5VgDqANUKQkZqW7q%2FEYTSYZoBapvlZobRXYLoDQJV4aYs%2BXVgjUBZ%2BJcn3i5IdIhtQILWqEzoFtskLqI0BMdoX71sRPDzLNg4BatJm%2FMW4%2FHm%2BjWj96xvd3AfQD%2FjYv9x%2BI%2FHF%2FGwg80geQ5eAAAAAElFTkSuQmCC");display:block;height:18px;xxborder:1px solid blue;margin-left:46px;}#logo img {width:32px;height:32px;float:left;margin-left:5px;}#logo h1{margin:0;padding:0 2px;font-size:1.3em;font-weight:bold;margin-left:43px;}p.title, p.url{margin:0;padding:0;line-height:1.4em;font-weight:bold;margin-left:5px;}p.url{color:#666;margin-bottom:5px;}#content{white-space:pre-wrap}ol {color:#999;}.hideLineNumbers ol{margin:0;padding:0;}span{color:#000}.tag{color:#05F}.attrTitle{color:#E00}.attrValue{color:#C0C}.attrDoc{color:#800080}.comment{color:green}.line{margin:0;padding:0}.dark{background-color:#FAFAFA}h1{font-family: sans-serif;font-size: 14px;margin-top: 20px;}label{float:right;font-weight:normal;font-size:11px;}'
          +'#content{white-space:pre-wrap}'
          +'ol {color:'+___settingsLiveSource.lineHead+'}'
          +'.hideLineNumbers ol{margin:0;padding:0;}'
          +'span{color:#000}'
          +'.tag{color:'+___settingsLiveSource.tag+'}'
          +'.attrTitle{color:'+___settingsLiveSource.attrTitle+'}'
          +'.attrValue{color:'+___settingsLiveSource.attrValue+'}'
          +'.attrDoc{color:'+___settingsLiveSource.attrDoc+'}'
          +'.comment{color:'+___settingsLiveSource.comment+'}'
          +'.line{margin:0;padding:0}'
          +'.dark{background-color:'+___settingsLiveSource.darkLine+'}'
  				+'h1{font-family: sans-serif; font-size: 14px; margin-top: 20px;}'
          +'label{float:right;font-weight:normal;font-size:11px;}'
          +'</style></head><body>'
          +'<div id="logo">'
          +'<img src="'+icon_src+'">'
          +'<a href="http://dev.opera.com/tools/" ></a>'
          +'<h1>DOM Snapshot</h1>'
          +'</div>'
          +'<p class="title" >'+__document.title+'</p>'
          +'<p class="url" >[ '+__window.location.protocol+'//'+__window.location.host+__window.location.pathname+' ]</p>'
          +'<ol id=\'content\'>'+getLiveMarkup()+'</ol></body></html>';
      var win=top.open('','_blank');
      win.document.write(markup);
      win.document.close();
      /* *
      window.open('data:text/plain;charset=utf-8,'+encodeURIComponent(markup));
      /* */
    }
  }
  

  opera.tools.about=new function(tools)
  {
    var templates=tools.templates;
    var win=null;
    var win_doc=null;
    var win_body=null;
    var toolsContainer=null;
  
    var _request=null;
    var path='';
    var time=0;
    var maxCheck=6000;
    var __window=null;
    var __document=null;
  
    var icon_src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEBElEQVR4Xr1XX0hbZxQ%2F908SjDFBJUJrFTpExoYt7UNLEYWO4ZwM2kERtRANiOCDD92DkI65PZQ9ONge9rAXabMg2ofCoO2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8DVmdbERkgYnF0oDjoyMqWJzVcGmAy%2BV6f6AjGfb7I%2BZxkDT%2BTyAgCp4EE2fD7LZlMHcLOfQRFuf4hRTgYI%2FQhJytra2ecDis0iHA7XbLCwsLARxc4zKrjXZ5tLu7u2F8fHyJDgE9PT0N2JoqDMNM4B6e2y39AGS6HggEVtfW1tJUBtTV1ckej6fe6%2FX2z87O8toz%2FHFraGjoR7%2Fff3ZkZOQUTjgJ7E%2BmTO%2BGfFB1BINBK86MIV577%2Bt5O8xB5UUCdl9%2FPf8EQXcC5NdnTqAAAAAASUVORK5CYII%3D';
  	
    var templatesAbout=function()
    {
      return ['div',
        ['ul',
          ['li', 
            ['span', 'revision: ', 'class', 'key'], 
            ['span', tools.revision, 'class', 'value']],/*,
          ['li', 
            ['span', 'date: ', 'class', 'key'], 
            ['span', tools.date, 'class', 'value']],
          ['li', 
            ['span', 'author: ', 'class', 'key'], 
            ['span', tools.author, 'class', 'value']],
          ['li', 
            ['span', 'documentation: ', 'class', 'key'], 
            ['span', 
              ['a', 'dev.opera.com/tools/spec', 'target', '_blank', 'href', 'dev.opera.com/tools/spec'], 
            'class', 'value']]*/
        'class', 'propertyList']
      ]
    }
  
    this.setWindow=function(win)
    {
      if(__window)
      {
        this.clearWindow();
      }
  
      __window=win;
      __document=win.document;
  
  
    }
  
    this.update=function()
    {
  
      var title=__document.title;
      toolsContainer.innerHTML='';
      toolsContainer.render(templates.header(icon_src));
      toolsContainer.render(templatesAbout());
      if(!title || /^ *$/.test(title))
      {
        title='<title not specified>';
      }
      win_doc.getElementById('header_doc_title').textContent=title;
      win_doc.getElementById('header_location').textContent=
        __window.location.protocol+'//'+__window.location.host+__window.location.pathname;
  
    }
  
    this.clearWindow=function()
    {
  
      __window=null;
      __document=null;
  
    }
  
    this.open=function(targetWindow, _win, doc ,container)
    {
  
      if(!__window || targetWindow!=__window)
      {
        this.setWindow(targetWindow);
      }
  
      win=_win;
      win_doc=doc;
      win_body=doc.body;
      toolsContainer=container;
      this.update()
    }
  
    this.clear=function()
    {
      if(toolsContainer)
      {
        toolsContainer.innerHTML='';
      }
      win=null;
      win_doc=null;
      win_body=null;
      toolsContainer=null;
      _request=null;
    }
  
  }(opera.tools)
  
  


  opera.tools.console.open();
})()