if(!window.Element) {  Element = function() {}; } var $ = function(a, b) { if(typeof a == 'function') {  if($.__vividReady) {  a(); } else {  $.__vividOnReadyFunctions.push(a); }  } else {  if($.__vividReady) {  return new VQuery(a, b); } else {  throw('Vivid is not ready, yet.'); }  }}; function $Build(nodeName, attr) {  if(nodeName == 'text') {  var node = document.createTextNode(attr); } else {  var node = document.createElement(nodeName); for(var name in attr) {  node.setAttribute(name, attr[name]); }  }  return node; } $.__isIE/*@cc_on = true@*/; $.__isOP = window.opera; $.__isWK = navigator.userAgent.search(/webkit|KHTML/i) > -1; $.__isGecko = !$.__isWK && navigator.userAgent.search(/Gecko/i) > -1; $.__vividOnReadyFunctions = new Array; $.__vividIncludeFiles = new Array; $.__vividIncludeCallbacks = new Array; $.debugMode = false; function include(file, callback) {   if($.__includeLoading) {  $.__vividIncludeFiles.push(file); $.__vividIncludeCallbacks.push(callback); } else {  switch(file.extractFileExtension().toLowerCase()) {  case 'js': node = document.createElement('script'); node.type = 'text/javascript'; node.src = file; break; case 'css': node = document.createElement('link'); node.rel = 'stylesheet'; node.type = 'text/css'; node.href = file; break; default: throw('Cannot include file "' + file + '": unknown file type.'); } var loadChecker = function() {  if(typeof(callback) != 'undefined') callback(); $.__includeLoading = false; if($.__vividIncludeFiles.length) {  include($.__vividIncludeFiles.shift(), $.__vividIncludeCallbacks.shift()); }  }; if(node.readyState) {  node.onreadystatechange = function() {  if(node.readyState == 'interactive' || node.readyState == 'complete') {  node.onreadystatechange = null; loadChecker(); }  }; } else {  node.addEventListener('load', loadChecker, false); }  $.__includeLoading = true; if(!document.head) document.head = document.getElementsByTagName('head')[0]; document.head.appendChild(node); }} $.__readyLoader = function() {  for(var i = 0; i < $.__vividOnReadyFunctions.length; ++i) {  $.__vividOnReadyFunctions[i](); }  $.__vividOnReadyFunctions = null; }; if($.__isGecko || $.__isOP) {  document.addEventListener('DOMContentLoaded', function() {  document.removeEventListener('DOMContentLoaded', arguments.callee, false); $.__readyLoader(); }, false); } else {  if($.__isIE) {  document.onreadystatechange = function() {  switch(document.readyState) {  case 'complete': case 'interactive': document.onreadystatechange = null; $.__readyLoader(); }  }; } else {  $.__readyFallback = function() {  if(!document.body) {  window.setTimeout($.__readyFallback, 10); } else {  $.__readyFallback = null; $.__readyLoader(); }  }; $.__readyFallback(); }} $.__vividFix_createElementProto = function(node) {  if(node) {  if(node.getOpacity) return; for(var method in Element.prototype) {  try {  node[method] = Element.prototype[method]; } catch(e) {} }  }}; if($.__isIE) {  var tempCreateElement = document.createElement; var tempGetElementById = document.getElementById; var tempGetElementsByName = document.getElementsByName; var tempGetElementsByTagName = document.getElementsByTagName; document.createElement = function(name) {  var node = tempCreateElement(name); $.__vividFix_createElementProto(node); return node; }; document.getElementById = function(id) {  var node = tempGetElementById(id); $.__vividFix_createElementProto(node); return node; }; document.getElementsByName = function(name) {  var nodes = tempGetElementsByName(name); for(var i in nodes) {  $.__vividFix_createElementProto(node); }  return nodes; }; document.getElementsByTagName = function(tag) {  var nodes = tempGetElementsByTagName(tag); for(var i in nodes) {  $.__vividFix_createElementProto(nodes[i]); }  return nodes; }; Element.prototype.addEventListener = function(event, func, capture) {  var funcWrap = function(evt) {  if(capture) evt.cancelBubble = true; func(evt); }; this.attachEvent('on' + event, funcWrap); }; Element.prototype.removeEventListener = function(event, func) {  this.detachEvent('on' + event, func); }; window.getComputedStyle = function(node) {  var toReturn = new Object(); toReturn.getPropertyValue = function(prop) {  prop = prop.hyphenToCamelCase(); switch(''+prop) {  case 'width': if(node.currentStyle[prop] == 'auto') {  return node.offsetWidth; } case 'height': if(node.currentStyle[prop] == 'auto') {  return node.offsetHeight; }  }  return node.currentStyle[prop]; }; return toReturn; };} function XmlRequest() {  var req_url; var req_method; var req_isAsync; var self = this; var xhr; __construct(); this.onOpen = null; this.onRequestSent = null; this.onResponse = null; this.onResponseFailure = null; this.onIsLoading = null; this.open = function(url, method, isAsync) {  if(!url) url = window.location; if(!method) method = 'POST'; if(isAsync == null) isAsync = true; req_url = url; req_method = method; req_isAsync = isAsync; }; this.query = function(query) {  if(!req_url) self.open(); xhr.open(req_method, req_url, req_isAsync); xhr.onreadystatechange = onReadyStateChange; setHeaders(); xhr.setRequestHeader('Content-length', query ? query.length : 0); xhr.send(query); if(!req_isAsync) {  onReadyStateChange(); }  }; function onReadyStateChange() {  switch(xhr.readyState) {  case 1: if(typeof self.onOpen == 'function') {  self.onOpen(); }  break; case 2: if(typeof self.onRequestSent == 'function') {  self.onRequestSent(); }  break; case 3: if(typeof self.onIsLoading == 'function') {  try {  var curLength = xhr.responseStream ?  xhr.responseStream.length :  xhr.responseText.length; var total = xhr.getResponseHeader ?  xhr.getResponseHeader("Content-Length") :  curLength; self.onIsLoading({'totalBytes' : total, 'loadedBytes' : curLength, 'percent' : (curLength / total) * 100.0}); } catch(e) {} }  break; case 4: switch(xhr.status) {  case 200: if(typeof self.onResponse == 'function') {  self.onResponse({'xml' : xhr.responseXML, 'text' : xhr.responseText}); }  break; default: if(typeof self.onResponseFailure == 'function') {  self.onResponseFailure({'code' : xhr.status, 'message' : xhr.statusText, 'text' : xhr.responseText}); }  }  break; }  }  function setHeaders() {  if(req_method == 'POST') {  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); }  } function __construct() {  if(window.XMLHttpRequest) {  xhr = new XMLHttpRequest; } else {  if(window.ActiveXObject) {  try {  xhr = new ActiveXObject("MSXML3.XMLHTTP"); } catch(e) {  try {  xhr = new ActiveXObject("MSXML2.XMLHTTP.3.0"); } catch(e) {  try {  xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {  try {  xhr = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {  }  }  }   }  } else {  }  } if(xhr) {  if(xhr.overrideMimeType) {  xhr.overrideMimeType('text/xml'); }  }  }} function VQuery(a, b) { this.nodes = new Array; this.timerGran = 50; this.animFuncStack = new Array; switch(typeof a) { case 'string': this.query(a, b); break; case 'object': if(a instanceof VQuery) {  this.nodes.concat(a.nodes); } else {  if(a instanceof Array) {  this.nodes.concat(a); } else {  if($.__isIE) {  $.__vividFix_createElementProto(a); }  this.nodes.push(a); }  }  break; default: throw('Unknown argument'); }} VQuery.prototype.setAttributes = function(attr) {  this.each(function(node) {  if(node.setAttribute) {  for(var aName in attr) {  node.setAttribute(aName, attr[aName]); }  }  }); return this; }; VQuery.prototype.setStyle = function(style) {  this.each(function(node) {  if(node.style) {  for(var aName in style) {  node.style[aName] = style[aName]; }  }  }); return this; }; VQuery.prototype.setInnerText = function(text) {  this.each(function(node) {  node.innerText = text; }); return this; }; VQuery.prototype.setInnerHTML = function(html) {  this.each(function(node) {  node.innerHTML = html; }); return this; }; VQuery.prototype.appendHTML = function(html) {  this.each(function(node) {  node.innerHTML += html; }); return this; }; VQuery.prototype.setClass = function(name) {  return this.setAttributes({'class' : name}); }; VQuery.prototype.addClass = function(name) {  this.each(function(node) {  node.addClass(name); }); return this; }; VQuery.prototype.removeClass = function(name) {  this.each(function(node) {  node.removeClass(name); }); return this; }; VQuery.prototype.each = function(func) {  var parent = this; var handler = function() {  for(var i = 0; i < parent.nodes.length; ++i) {  var node = parent.nodes[i]; if(node) {  if(func(node) === false) break; }  }  }; this.call(handler); return this; }; VQuery.prototype.timerEach = function(func, ms) {	var parent = this; var handler = function() {  parent.each(func); }; setTimeout(handler, ms); return this; }; VQuery.prototype.append = function(obj) {  obj = new VQuery(obj); var oNodes = obj.nodes; var oLen = oNodes.length; this.each(function(node) {  for(var i=0; i<oLen; ++i) {  var child = oNodes[i]; if(child.parentNode) {  child = child.cloneNode(true); } node.appendChild(child); }  }); return this; }; VQuery.prototype.appendText = function(txt) {  this.each(function(node) {  var txtNode = document.createTextNode(txt); node.appendChild(txtNode); }); return this; }; VQuery.prototype.observe = function(event, func, capture) {  if(typeof(capture) == 'undefined') capture = false; this.each(function(node) {  if(node.addEventListener) {  node.addEventListener(event, func, capture); }  }); return this; }; VQuery.prototype.ignore = function(event, func, capture) {  if(typeof(capture) == 'undefined') capture = false; this.each(function(node) {  if(node.removeEventListener) {  node.removeEventListener(event, func, capture); }  }); return this; }; VQuery.prototype.prepend = function(obj) {  obj = new VQuery(obj); var oNodes = obj.nodes; var oLen = oNodes.length; this.each(function(node) {  for(var i=0; i<oLen; ++i) {  var newParent = oNodes[i]; if(newParent.parentNode) {  newParent = newParent.cloneNode(true); } node.parentNode.replaceChild(newParent, node); newParent.appendChild(node); }  }); return this; }; VQuery.prototype.onLoad = function(func) {  return this.observe('load', func); }; VQuery.prototype.replace = function(obj) {  obj = new VQuery(obj); var oNodes = obj.nodes; var oLen = oNodes.length; var func = function(node) {  var par = node.parentNode; var div = document.createElement('div'); par.replaceChild(div, node); for(var i=0; i<oLen; ++i) {  var child = oNodes[i]; if(child.parentNode) {  child = child.cloneNode(true); } div.appendChild(child); }  }; this.each(func); return this; }; VQuery.prototype.remove = function() {  this.each(function(node) {  var parent = node.parentNode; if(parent) {  parent.removeChild(node); }  }); return this; }; VQuery.prototype.ifEmpty = function(func) {  var parent = this; var handler = function() {  if(!parent.nodes.length) func(); }; return this.call(handler); }; VQuery.prototype.query = function(str, baseNode) {  if(document.evaluate) {  if(!baseNode) baseNode = document; var result = document.evaluate(str, baseNode, null, XPathResult.ANY_TYPE, null); this.nodes = new Array; while(element = result.iterateNext()) {  this.nodes.push(element); }  } else {  var ip = new XPathInterpreter; var result = ip.exec(str, baseNode); if(!(result instanceof Array)) result = Array(result); this.nodes = result; } if($.__isIE) {  for(var i = 0; i < this.nodes.length; ++i) {  $.__vividFix_createElementProto(nodes[i]); }  }}; VQuery.prototype.center = function() {  return this.each(function(node) {  node.center(); }); }; VQuery.prototype.call = function(func) {  var parent = this; var handler = function() {  func(); parent.animateNext(); }; this.animFuncStack.push(handler); if(this.animFuncStack.length == 1) {  this.animateNext(); }  return this; }; VQuery.prototype.wait = function(dur) {  var parent = this; var handler = function() {  setTimeout(function() {  parent.animateNext(); }, dur); }; this.animFuncStack.push(handler); if(this.animFuncStack.length == 1) {  handler(); }  return this; }; VQuery.prototype.animate = function(attribs, dur, callback) {  var parent = this; function createAStep(curVal, target, node) {  if(typeof target == 'function') {  target = target(node); }  curVal = parseFloat(curVal); target = parseFloat(target); return { step : parent.calcStep(Math.abs(target - curVal), dur), factor : (target > curVal ? 1 : -1) }; }  function calcIteration(steps, target, curVal, node) {  if(typeof target == 'function') {  target = target(node); }  target = parseFloat(target); curVal = parseFloat(curVal); if(steps.factor == 1 ? (target > curVal) : (target < curVal)) {  var newVal = curVal + steps.factor * steps.step; var reached = true; if(steps.factor == 1) {  if(newVal > target) {  newVal = target; }  } else {  if(newVal < target) {  newVal = target; }  }  if(newVal != target) {  reached = false; }  return {'newVal' : newVal, 'reached' : reached }; }  } if(!dur) dur = 0; var steps; var handler = function() {  if(handler.stop) return; var i, target, style, curVal, res; var targetsReached = true; if(!steps) {  steps = new Array; for(var i = 0; i < parent.nodes.length; ++i) {  var aSteps = new Object; var node = parent.nodes[i]; if(!node.busy) node.busy = new Object; for(var name in attribs) {  if(node.busy[name]) continue; node.busy[name] = true; target = attribs[name]; switch(name) {  case 'opacity': aSteps[name] = createAStep(node.getOpacity(), target, node); break; case '_width': case '_height': target = node[name]; aSteps[name] = createAStep(node.style[name.substr(1)], target); break; case 'width': case 'height': node.style.overflow = 'hidden'; case 'top': case 'left': curVal = window.getComputedStyle(node, null).getPropertyValue(name); aSteps[name] = createAStep(curVal, target, node); break; default: aSteps[name] = new Object; }  } steps.push(aSteps); }  }  var unit = 0; for(var name in attribs) {  for(i = 0; i < parent.nodes.length; ++i) {  target = attribs[name]; var node = parent.nodes[i]; var step = steps[i]; if(!step[name]) continue; switch(name) {  case 'opacity': curVal = node.getOpacity(); res = calcIteration(step[name], target, curVal, node); if(res) {  targetsReached = res.reached; node.setOpacity(res.newVal); }  break; case 'visibility': if(!step[name].firstVisit) {  step[name].firstVisit = true; targetsReached = false; } else {  node.style[name] = target; targetsReached = true; }  break; case '_width': res = calcIteration(step['_width'], node._width, window.getComputedStyle(node, null).getPropertyValue('width')); if(res) {  targetsReached = res.reached; node.style.width = res.newVal + 'px'; }  break; case '_height': res = calcIteration(step['_height'], node._height, window.getComputedStyle(node, null).getPropertyValue('height')); if(res) {  targetsReached = res.reached; node.style.height = res.newVal + 'px'; }  break; case 'width': case 'height': unit = 'px'; default: res = calcIteration(step[name], target, window.getComputedStyle(node, null).getPropertyValue(name), node); if(res) {  targetsReached = res.reached; node.style[name] = res.newVal + unit; }  }  if(targetsReached) {  delete node.busy[name]; }  }  }  if(!targetsReached) {  window.setTimeout(handler, parent.timerGran); } else {  if(callback) callback(); parent.animateNext(); }  }; this.animFuncStack.push(handler); if(this.animFuncStack.length == 1) {  window.setTimeout(handler, this.timerGran); }  return this; }; VQuery.prototype.hide = function(dur, callback) {  return this.animate({visibility:'hidden'}, dur, callback); }; VQuery.prototype.unhide = function(dur, callback) {  return this.animate({visibility:'visible'}, dur, callback); }; VQuery.prototype.slideIn = function(dir, dur, callback) {  var parent = this; switch(dir) {  case 'horizontal': case 'h': var handler = function() {  for(var i = 0; i < parent.nodes.length; ++i) {  var curNode = parent.nodes[i]; if(curNode._width) continue; curNode._width = window.getComputedStyle(curNode, null).getPropertyValue('width'); }  }; return this.call(handler).animate({width:1}, dur, callback).hide(); case 'vertical': case 'v': var handler = function() {  for(var i = 0; i < parent.nodes.length; ++i) {  var curNode = parent.nodes[i]; if(curNode._height) continue; curNode._height = window.getComputedStyle(curNode, null).getPropertyValue('height'); }  }; return this.call(handler).animate({height:1}, dur, callback).hide(); default: throw("Unknown argument '" + dir + "'."); }}; VQuery.prototype.slideOut = function(dir, dur, callback) {  switch(dir) {  case 'horizontal': case 'h': return this.unhide().animate({_width:true}, dur, callback).each(function(node){ node._width = null; node.style.width = 'auto'; }); case 'vertical': case 'v': return this.unhide().animate({_height:true}, dur, callback).each(function(node){ node._height = null; node.style.height = 'auto'; }); default: throw("Unknown argument '" + dir + "'."); }}; VQuery.prototype.fadeOut = function(dur, callback) {  return this.animate({opacity:0}, dur, callback); }; VQuery.prototype.fadeIn = function(dur, callback) {  return this.animate({opacity:1}, dur, callback); }; VQuery.prototype.animateNext = function() {  if(this.animFuncStack.length > 0) {  var handler = this.animFuncStack.shift(); handler(); }}; VQuery.prototype.stop = function() {  var handler; while(handler = this.animFuncStack.shift()) {  handler.stop = true; }  for(var i = 0; i < this.nodes.length; ++i) {  delete this.nodes[i].busy; }  return this; }; VQuery.prototype.calcStep = function(val, dur) {  var step = val / (dur / this.timerGran); return step.truncDecimals(3); }; function XPathInterpreter() {  this.CHILD = 0; this.DESCENDANT = 1; this.PARENT = 2; this.ANCESTOR = 3; this.FOLLOWING_SIBLING = 4; this.PRECEDING_SIBLING = 5; this.FOLLOWING = 6; this.PRECEDING = 7; this.ATTRIBUTE = 8; this.NAMESPACE = 9; this.SELF = 10; this.DESCENDANT_OR_SELF = 11; this.ANCESTOR_OR_SELF = 12; this.COLON = 13; this.DOUBLECOLON = 14; this.SLASH = 15; this.ASTERISK = 16; this.EQUAL = 17; this.UNEQUAL = 18; this.GT = 19; this.LT = 20; this.GE = 21; this.LE = 22; this.PIPE = 23; this.DOLLAR = 24; this.PERIOD = 25; this.DOUBLEPERIOD = 26; this.BRACKETOPEN = 27; this.BRACKETCLOSE = 28; this.SQBRACKETOPEN = 29; this.SQBRACKETCLOSE = 30; this.COMMENT = 31; this.TEXT = 32; this.PROC_INSTR = 33; this.NODE = 34; this.OR = 35; this.AND = 36; this.FCALL = 37; this.SIGN = 38; this.AT = 39; this.PREDICATE = 40; this.COMMA = 41; this.DOUBLESLASH = 42; this.PLUS = 43; this.MINUS = 44; this.MOD = 45; this.DIV = 46; this.MUL = 47; this.VOID = 48; this.nodesStack = null; this.curNode = false; this.tokenizer = new Tokenizer; this.operands = null; this.operators = null; this.astRoot = null; this.docRoot = document.body.parentNode.parentNode; this.initTokenizer(); }  XPathInterpreter.prototype.exec = function(query, baseNode) {	if(baseNode) {	 this.docRoot = baseNode; } $.__vividFix_createElementProto(this.docRoot); this.operands = new Array; this.operators = new Array; this.tokenizer.tokenize(query); this.ruleExpr(); if(this.tokenizer.hasNext()) this.createError("End of query expected.", this.tokenizer.getNext()); this.astRoot = this.operands.pop(); if($.debugMode) this.debug(this.astRoot, document.body); var result = this.evaluate(this.astRoot, this.docRoot); if(typeof result == 'string' && !this.astRoot.right) {	 tmp = this.docRoot.getChildElementsByTagName(result, true); result = new Array; for(var i = 0; i < tmp.length; ++i) {	 var curNode = tmp[i]; if(curNode.nodeType == 1) result.add(curNode.getChildElementsByTagName('*')); }	} if(!(result instanceof Array)) {	 result = new Array(result); } return result; }; XPathInterpreter.prototype.evaluate = function(node, domNode, forceDeep) {  switch(node.tk) {	 case this.DOUBLESLASH: forceDeep = true; case this.SLASH: if(node.left) {	 var leftResult = this.evaluate(node.left, domNode); } else {	 leftResult = false; }	 if(!leftResult) {	 if(node.right.tk != this.tokenizer.IDENTIFIER) {  return this.evaluate(node.right, domNode, forceDeep); } else {  return domNode.getChildElementsByTagName(node.right.val, forceDeep); }	 } else {	 if(typeof leftResult == 'string') {	 var deep = forceDeep || (node === this.astRoot); leftResult = domNode.getChildElementsByTagName(leftResult, deep); }	 } if(!(leftResult instanceof Array)) {	 leftResult = new Array(leftResult); }	 var set = new Array; for(var i = 0; i < leftResult.length; ++i) {	 if(node.right.tk != this.tokenizer.IDENTIFIER) {	 set.add(this.evaluate(node.right, leftResult[i], forceDeep)); } else {	 set.add(leftResult[i].getChildElementsByTagName(node.right.val, forceDeep)); }	 } return set; case this.DOUBLECOLON: var nodeTest = node.right.val.toLowerCase(); switch(node.left.tk) {	 case this.CHILD: return domNode.getChildElementsByTagName(nodeTest); case this.DESCENDANT: return domNode.getChildElementsByTagName(nodeTest, true); case this.PARENT: if((nodeTest == '*') || (domNode.parent.nodeName().toLowerCase() == nodeTest)) {	 return domNode.parent; }	 break; case this.ANCESTOR: return domNode.getAncestors(nodeTest); case this.FOLLOWING_SIBLING: return domNode.getFollowingSiblings(nodeTest); case this.PRECEDING_SIBLING: return domNode.getPrecedingSiblings(nodeTest); case this.FOLLOWING: return domNode.getFollowing(nodeTest); case this.PRECEDING: return domNode.getPreceding(nodeTest); case this.ATTRIBUTE: return domNode.getAttribute(nodeTest); case this.NAMESPACE: this.createError("Namespaces not supported.", node); break; case this.SELF: return domNode; case this.DESCENDANT_OR_SELF: set = new Array; if(nodeTest == '*' || domNode.nodeName().toLowerCase() == nodeTest) {	 set.push(domNode); }	 set.add(domNode.getChildElementsByTagName(nodeTest, true)); return set; case this.ANCESTOR_OR_SELF: set = new Array; if(nodeTest == '*' || domNode.nodeName().toLowerCase() == nodeTest) {	 set.push(domNode); }	 set.add(domNode.getAncestors(nodeTest)); return set; }	 break; case this.PERIOD: return domNode; case this.DOUBLEPERIOD: return domNode.parentNode; case this.PIPE: var set = new Array; set.add(this.evaluate(node.left, domNode)); set.add(this.evaluate(node.right, domNode)); return set; case this.PREDICATE: var deep = (node === this.astRoot || node === this.astRoot.left); if(node.left.tk == this.PREDICATE || node.left.tk == this.DOUBLECOLON) {	 var testSet = this.evaluate(node.left, domNode, forceDeep); } else {  var nodeTest = node.left.val; var testSet = domNode.getChildElementsByTagName(nodeTest, deep || forceDeep); } var result = new Array; for(var i = 0; i < testSet.length; ++i) {	 var curDomNode = testSet[i]; var rightResult = this.evaluate(node.right, curDomNode); if(typeof rightResult == 'number') {  if(i == rightResult - 1) result.push(curDomNode); } else {  if(rightResult) result.push(curDomNode); }	 } if(deep) {  var tmp = new Array; for(var i = 0; i < result.length; ++i) {  tmp.add(result[i].getChildElementsByTagName('*')); }  return tmp; } return result; case this.PLUS: return this.evaluate(node.left, domNode) + this.evaluate(node.right, domNode); case this.MINUS: return this.evaluate(node.left, domNode) - this.evaluate(node.right, domNode); case this.SIGN: return -this.evaluate(node.right, domNode); case this.MUL: return this.evaluate(node.left, domNode) * this.evaluate(node.right, domNode); case this.DIV: return this.evaluate(node.left, domNode) / this.evaluate(node.right, domNode); case this.MOD: return this.evaluate(node.left, domNode) % this.evaluate(node.right, domNode); case this.EQUAL: return this.evalRelation(node, domNode, function(a, b) { return a == b;  }); case this.UNEQUAL: return this.evalRelation(node, domNode, function(a, b) { return a != b;  }); case this.AT: return domNode.getAttribute(this.evaluate(node.right, domNode)); case this.LT: return this.evalRelation(node, domNode, function(a, b) { return a < b;  }); case this.GT: return this.evalRelation(node, domNode, function(a, b) { return a > b;  }); case this.LE: return this.evalRelation(node, domNode, function(a, b) { return a <= b;  }); case this.GE: return this.evalRelation(node, domNode, function(a, b) { return a >= b;  }); case this.AND: return this.evaluate(node.left, domNode) && this.evaluate(node.right, domNode); case this.OR: return this.evaluate(node.left, domNode) || this.evaluate(node.right, domNode); case this.FCALL: return this.processFCall(this.evaluate(node.left, domNode), this.evaluate(node.right, domNode), domNode); case this.COMMA: var leftResult = this.evaluate(node.left, domNode); if(!(leftResult instanceof Array)) leftResult = new Array(leftResult); leftResult.add(this.evaluate(node.right, domNode)); return leftResult; case this.tokenizer.IDENTIFIER: case this.tokenizer.INT: case this.tokenizer.FLOAT: case this.tokenizer.CHAR: case this.tokenizer.STRING: return node.val; }}; XPathInterpreter.prototype.evalRelation = function(node, domNode, callback) {  var resLeft = this.evaluate(node.left, domNode); var resRight = this.evaluate(node.right, domNode); if(!(resLeft instanceof Array)) {  tmp = new Array; tmp.push(resLeft); resLeft = tmp; }  if(!(resRight instanceof Array)) {  tmp = new Array; tmp.push(resRight); resRight = tmp; } for(var lIdx = 0; lIdx < resLeft.length; ++lIdx) {  for(var rIdx = 0; rIdx < resRight.length; ++rIdx) {  var a = resLeft[lIdx]; var b = resRight[rIdx]; if(a && a.innerText) a = a.innerText; if(b && b.innerText) b = b.innerText; if(!callback(a, b)) return false; }  }  return true; }; XPathInterpreter.prototype.processFCall = function(name, arg, domNode) {  switch(name) {  case 'not': return !arg[0]; case 'count': return arg[0].length; case 'ends-with': arg[0] = ""+arg[0]; arg[1] = ""+arg[1]; return arg[0].substr(arg[0].length - arg[1].length) == arg[1]; case 'id': var ids = arg.split(" "); var result = new Array; var node; for(var i = 0; i < ids.length; ++i) {  if(node = document.getElementById(ids[i])) {  result.push(node); }  }  return result; case 'contains': case 'matches': eval('var regex = /'+arg[1]+'/i;'); return (""+arg[0]).search(regex) != -1; case 'starts-with': arg[1] = ""+arg[1]; return (""+arg[0]).substr(0, arg[1].length) == arg[1]; case 'string-length': return (""+arg).length; case 'substring': if(arg[2] == null) {   return (""+arg[0]).substring(parseInt(arg[1])); } else {  return (""+arg[0]).substring(parseInt(arg[1]), parseInt(arg[2])); } case 'text': return domNode.innerText; case 'node': return domNode; default: throw('Unknown function "' + name + '".'); }}; XPathInterpreter.prototype.debug = function(node, dom) {  var ul = document.createElement('ul'); var li = document.createElement('li'); li.innerHTML = node.dbg ? node.dbg : (node.val ? node.val : node.tk); ul.appendChild(li); dom.appendChild(ul); if(node.left) {  node.left.dbg = "[LEFT] " + (node.left.val ? node.left.val : node.left.tk); this.debug(node.left, li); } if(node.right) {  node.right.dbg = "[RIGHT] " + (node.right.val ? node.right.val : node.right.tk); this.debug(node.right, li); }}; XPathInterpreter.prototype.ruleLocationPath = function() {	if(this.isAbsoluteLocationPath()) {	 this.ruleAbsoluteLocationPath(); } else {	 this.ruleRelativeLocationPath(); }}; XPathInterpreter.prototype.ruleAbsoluteLocationPath = function() {	if(this.lookKey(this.SLASH)) {	 var op = this.tokenizer.getNext(); op.isUnary = true; this.operators.push(op); if(this.isRelativeLocationPath()) {	 this.ruleRelativeLocationPath(true); this.buildTermTree(); }	} else {	 this.ruleAbbreviatedAbsoluteLocationPath(); }}; XPathInterpreter.prototype.ruleAbbreviatedAbsoluteLocationPath = function() {	var op = this.tokenizer.getCurrent(); op.isUnary = true; this.operators.push(op); this.expectKey(this.DOUBLESLASH); this.ruleRelativeLocationPath(true); this.buildTermTree(); }; XPathInterpreter.prototype.isAbsoluteLocationPath = function() {	return this.lookKey(new Array(this.SLASH, this.DOUBLESLASH)); }; XPathInterpreter.prototype.isRelativeLocationPath = function() {	return (this.lookKey(new Array(this.PERIOD, this.DOUBLEPERIOD, this.tokenizer.IDENTIFIER)) || this.isAxisSpecifier()) && !this.lookNextKey(this.BRACKETOPEN); }; XPathInterpreter.prototype.isAxisSpecifier = function() {	return this.lookKey(new Array(this.AT, this.IDENTIFIER)) || this.isAxisName(); }; XPathInterpreter.prototype.isAxisName = function() {	return this.lookKey(new Array( this.CHILD, this.DESCENDANT, this.PARENT, this.ANCESTOR, this.FOLLOWING_SIBLING, this.PRECEDING_SIBLING, this.FOLLOWING, this.PRECEDING, this.ATTRIBUTE, this.NAMESPACE, this.SELF, this.DESCENDANT_OR_SELF, this.ANCESTOR_OR_SELF)); }; XPathInterpreter.prototype.ruleRelativeLocationPath = function(immTerm) {	this.ruleStep(); if(immTerm) this.buildTermTree(); if(this.lookKey(new Array(this.SLASH, this.DOUBLESLASH))) {	 this.operators.push(this.tokenizer.getNext()); this.ruleRelativeLocationPath(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleStep = function() {	if(this.lookKey(new Array(this.PERIOD, this.DOUBLEPERIOD))) {	 this.operands.push(this.tokenizer.getNext()); } else {	 var mkTerm = this.ruleAxisSpecifier(); this.ruleNodeTest(); if(mkTerm) this.buildTermTree(); while(this.lookKey(this.SQBRACKETOPEN)) {	 this.rulePredicate(); this.buildTermTree(); }	} }; XPathInterpreter.prototype.ruleAxisSpecifier = function() {	if(this.lookKey(this.AT)) {	 var op = this.tokenizer.getNext(); op.isUnary = true; this.operators.push(op); return true; } else {	 if(this.isAxisName()) {	 this.operands.push(this.tokenizer.getNext()); this.operators.push(this.tokenizer.getCurrent()); this.expectKey(this.DOUBLECOLON); return true; }	} }; XPathInterpreter.prototype.ruleNodeTest = function() {	if(this.isNodeType()) {	 this.ruleFCall(); } else {	 if(this.lookKey(this.ASTERISK)) {	 var op = this.tokenizer.getNext(); op.tk = this.tokenizer.IDENTIFIER; op.val = '*'; this.operands.push(op); } else {	 var op = this.tokenizer.getCurrent(); if(op.tk == this.DIV) {	 op.tk = this.tokenizer.IDENTIFIER; op.val = 'div'; }	 this.operands.push(op); this.expectKey(this.tokenizer.IDENTIFIER); if(this.lookKey(this.COLON)) {	 this.operators.push(this.tokenizer.getNext()); this.operands.push(this.tokenizer.getCurrent()); this.expectKey(new Array(this.tokenizer.IDENTIFIER, this.ASTERISK)); this.buildTermTree(); }	 }	} }; XPathInterpreter.prototype.ruleFCall = function() {	this.operands.push(this.tokenizer.getNext()); this.operators.push({'tk' : this.FCALL}); this.expectKey(this.BRACKETOPEN); var hasArgs = false; while(!this.lookKey(this.BRACKETCLOSE)) {	 this.ruleExpr(); hasArgs = true; if(this.lookKey(this.COMMA)) {	 this.operators.push(this.tokenizer.getNext()); this.ruleExpr(); this.buildTermTree(); }	} if(!hasArgs) this.operands.push({'tk' : this.VOID}); this.expectKey(this.BRACKETCLOSE); this.buildTermTree(); }; XPathInterpreter.prototype.isNodeType = function() {	switch(this.tokenizer.getCurrent().val) {	 case 'comment': case 'text': case 'processing-instruction': case 'node': return true; } return false; }; XPathInterpreter.prototype.rulePredicate = function() {	this.expectKey(this.SQBRACKETOPEN); this.operators.push({'tk' : this.PREDICATE}); this.ruleExpr(); this.expectKey(this.SQBRACKETCLOSE); }; XPathInterpreter.prototype.ruleExpr = function() {	this.ruleOrExpr(); }; XPathInterpreter.prototype.ruleOrExpr = function() {	this.ruleAndExpr(); if(this.lookKey(this.OR)) {	 this.operators.push(this.tokenizer.getNext()); this.ruleOrExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleAndExpr = function() {	this.ruleEqualityExpr(); if(this.lookKey(this.AND)) {	 this.operators.push(this.tokenizer.getNext()); this.ruleAndExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleEqualityExpr = function() {	this.ruleRelationalExpr(); if(this.lookKey(new Array(this.EQUAL, this.UNEQUAL))) {	 this.operators.push(this.tokenizer.getNext()); this.ruleEqualityExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleRelationalExpr = function() {	this.ruleAdditiveExpr(); if(this.lookKey(new Array(this.LE, this.LT, this.GE, this.GT))) {	 this.operators.push(this.tokenizer.getNext()); this.ruleRelationalExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleAdditiveExpr = function() {	this.ruleMultiplicativeExpr(); if(this.lookKey(new Array(this.PLUS, this.MINUS))) {	 this.operators.push(this.tokenizer.getNext()); this.ruleAdditiveExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleMultiplicativeExpr = function() {	this.ruleUnaryExpr(); if(this.lookKey(new Array(this.ASTERISK, this.DIV, this.MOD))) {	 this.operators.push(this.tokenizer.getNext()); this.ruleMultiplicativeExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.ruleUnaryExpr = function() {	if(this.lookKey(new Array(this.MINUS))) {	 var op = this.tokenizer.getNext(); op.tk = this.SIGN; op.isUnary = true; this.operators.push(op); this.ruleUnionExpr(); this.buildTermTree(); } else {	 this.ruleUnionExpr(); }}; XPathInterpreter.prototype.ruleUnionExpr = function() {	this.rulePathExpr(); if(this.lookKey(this.PIPE)) {	 this.operators.push(this.tokenizer.getNext()); this.ruleUnionExpr(); this.buildTermTree(); }}; XPathInterpreter.prototype.isLocationPath = function() {	return this.isAbsoluteLocationPath() || this.isRelativeLocationPath(); }; XPathInterpreter.prototype.rulePathExpr = function() {	if(this.isLocationPath()) {	 this.ruleLocationPath(); } else {	 this.ruleFilterExpr(); if(this.lookKey(new Array(this.SLASH, this.DOUBLESLASH))) {	 this.operators.push(this.tokenizer.getNext()); this.ruleRelativeLocationPath(); this.buildTermTree(); }	} }; XPathInterpreter.prototype.ruleFilterExpr = function() {	this.rulePrimaryExpr(); while(this.lookKey(this.SQBRACKETOPEN)) {	 this.rulePredicate(); this.buildTermTree(); }}; XPathInterpreter.prototype.rulePrimaryExpr = function() {	switch(this.tokenizer.getCurrent().tk) {	 case this.tokenizer.IDENTIFIER: if(this.lookNextKey(this.BRACKETOPEN)) {	 this.ruleFCall(); } else {	 this.operands.push(this.tokenizer.getNext()); }	 break; case this.tokenizer.INT: case this.tokenizer.FLOAT: case this.tokenizer.CHAR: case this.tokenizer.STRING: this.operands.push(this.tokenizer.getNext()); break; case this.BRACKETOPEN: this.tokenizer.getNext(); this.ruleExpr(); this.expectKey(this.BRACKETCLOSE); break; default: this.createError('Syntax error', this.tokenizer.getCurrent()); }}; XPathInterpreter.prototype.addChildNode = function(parent, child) {	if(!parent.right) {	 parent.right = child; } else {	 if(!parent.left) {	 parent.left = child; } else {	 throw 'Internal error'; }	} }; XPathInterpreter.prototype.buildTermTree = function() {	var op = this.operators.pop(); if(op) {  var a = this.operands.pop(); this.addChildNode(op, a); if(!op.isUnary) {  var b = this.operands.pop(); this.addChildNode(op, b); }  this.operands.push(op); }}; XPathInterpreter.prototype.expectKey = function(key) {  var tk = this.tokenizer.getNext(); if(key instanceof Array) {  for(var i = 0; i < key.length; ++i) {  if(tk.tk == key[i]) return; }  this.createError("Unexpected key.", tk); } else {	 if(tk.tk != key) {	 this.createError("Unexpected key.", tk); }  }}; XPathInterpreter.prototype.lookKey = function(key) {  if(!this.tokenizer.hasNext()) return false; if(key instanceof Array) {  for(var i=0; i<key.length; ++i) {  if(this.lookKey(key[i])) return true; }  return false; } else {  return this.tokenizer.getCurrent().tk == key; }}; XPathInterpreter.prototype.lookNextKey = function(key) {   var next = this.tokenizer.peekNext(); if(next) {	 if(key instanceof Array) {	 for(var i=0; i<key.length; ++i) {	 if(key[i] == next.tk) return true; }	 return false; } else {	 return next.tk == key; }	} }; XPathInterpreter.prototype.createError = function(msg, tk) {  throw('[XPath Error] ' + msg + ' In line ' + tk.row + ', position ' + tk.pos + '. '+ 'Offending token: ' + tk.val); }; XPathInterpreter.prototype.initTokenizer = function() {  this.tokenizer.setBlockCommentSymbols(false, false); this.tokenizer.setLineCommentSymbol(false); this.tokenizer.registerKey('child', this.CHILD); this.tokenizer.registerKey('descendant', this.DESCENDANT); this.tokenizer.registerKey('parent', this.PARENT); this.tokenizer.registerKey('ancestor', this.ANCESTOR); this.tokenizer.registerKey('following-sibling', this.FOLLOWING_SIBLING); this.tokenizer.registerKey('preceding-sibling', this.PRECEDING_SIBLING); this.tokenizer.registerKey('following', this.FOLLOWING); this.tokenizer.registerKey('preceding', this.PRECEDING); this.tokenizer.registerKey('attribute', this.ATTRIBUTE); this.tokenizer.registerKey('namespace', this.NAMESPACE); this.tokenizer.registerKey('self', this.SELF); this.tokenizer.registerKey('descendant-or-this', this.DESCENDANT_OR_this); this.tokenizer.registerKey('ancestor-or-this', this.ANCESTOR_OR_this); this.tokenizer.registerKey(':', this.COLON); this.tokenizer.registerKey('::', this.DOUBLECOLON); this.tokenizer.registerKey('/', this.SLASH); this.tokenizer.registerKey('//', this.DOUBLESLASH); this.tokenizer.registerKey('*', this.ASTERISK); this.tokenizer.registerKey('=', this.EQUAL); this.tokenizer.registerKey('!=', this.UNEQUAL); this.tokenizer.registerKey('<', this.LT); this.tokenizer.registerKey('>', this.GT); this.tokenizer.registerKey('<=', this.LE); this.tokenizer.registerKey('>=', this.GE); this.tokenizer.registerKey('|', this.PIPE); this.tokenizer.registerKey('$', this.DOLLAR); this.tokenizer.registerKey('.', this.PERIOD); this.tokenizer.registerKey('..', this.DOUBLEPERIOD); this.tokenizer.registerKey('(', this.BRACKETOPEN); this.tokenizer.registerKey(')', this.BRACKETCLOSE); this.tokenizer.registerKey('[', this.SQBRACKETOPEN); this.tokenizer.registerKey(']', this.SQBRACKETCLOSE); this.tokenizer.registerKey('or', this.OR); this.tokenizer.registerKey('and', this.AND); this.tokenizer.registerKey('@', this.AT); this.tokenizer.registerKey(',', this.COMMA); this.tokenizer.registerKey('+', this.PLUS); this.tokenizer.registerKey('-', this.MINUS); this.tokenizer.registerKey('mod', this.MOD); this.tokenizer.registerKey('div', this.DIV); this.tokenizer.registerKey('ends-with', this.tokenizer.IDENTIFIER); this.tokenizer.registerKey('string-length', this.tokenizer.IDENTIFIER); this.tokenizer.registerKey('starts-with', this.tokenizer.IDENTIFIER); }; function Tokenizer() {  this.KEY = -1; this.IDENTIFIER = -2; this.STRING = -3; this.CHAR = -4; this.INT = -5; this.FLOAT = -6; this.UNKNOWN = -7; this.keys = new Object; this.whitespace = " \t"; this.newline = "\n"; this.blockComment = new Array('/*', '*/'); this.lineComment = '//'; this.delimiters = "()[]{}'\"!\%&/=?\\+*-.:,;<>|^@"; this.cLikeBaseSupport = true; this.cLikeStringSupport = true; this.tokenIndex = 0; this.tokens; this.isCaseSensitive = true; this.storeKeyAsValue = true; this.maxKeyLen = 0; }; Tokenizer.prototype.getNext = function() {  var result = this.getCurrent(); this.tokenIndex++; return result; }; Tokenizer.prototype.getCurrent = function() {  if(this.tokenIndex < this.tokens.length) {  return this.tokens[this.tokenIndex]; } else {  throw("End of tokens."); }}; Tokenizer.prototype.setCaseSensitive = function(sensitive) {  this.isCaseSensitive = sensitive; }; Tokenizer.prototype.setStoreKeyAsValue = function(store) {  this.storeKeyAsValue = store; }; Tokenizer.prototype.peekNext = function() {  if(this.tokenIndex + 1 < this.tokens.length) {  return this.tokens[this.tokenIndex + 1]; } else {  return false; }}; Tokenizer.prototype.reset = function() {  this.tokenIndex = 0; }; Tokenizer.prototype.hasNext = function() {  return !this.isEndOfTokens(); }; Tokenizer.prototype.isEndOfTokens = function() {  return this.tokenIndex >= this.tokens.length; }; Tokenizer.prototype.setDelimiters = function(delimiters) {  this.delimiters = delimiters; }; Tokenizer.prototype.getDelimiters = function() {  return this.delimiters; }; Tokenizer.prototype.registerKey = function(keyword, value) {  if(!this.isCaseSensitive) keyword = keyword.toLowerCase(); if(typeof(this.keys[keyword]) != 'undefined') throw("Duplicate key registration."); this.keys[keyword] = value; if(keyword.length > this.maxKeyLen) this.maxKeyLen = keyword.length; }; Tokenizer.prototype.unregisterKey = function(keyword) {  if(typeof(this.keys[keyword]) != 'undefined') delete this.keys[keyword]; }; Tokenizer.prototype.setBlockCommentSymbols = function(opening, closing) {  this.blockComment = new Array(opening, closing); }; Tokenizer.prototype.setLineCommentSymbol = function(symbol) {  this.lineComment = symbol; }; Tokenizer.prototype.tokenize = function(text) {  if(this.cLikeStringSupport && this.delimiters.indexOf("\"") == -1 || this.delimiters.indexOf("'") == -1) {  throw("When C-like string support is active, you must add \" and ' " + "to the delimiters list!"); } var index = 0; var pos = 0; var backupPos; var pointInUse; var noLineBreak; var tempKey; var keyFound; var line = 1; var char; this.tokens = new Array(); this.reset(); while(index < text.length) {  if(this.lineComment) {  if(text.substr(index, this.lineComment.length) == this.lineComment) { while((index < text.length) && (text[index] != "\n")) {  index++; pos++; } continue; }  } if(this.blockComment[0] && this.blockComment[1]) {  len = this.blockComment[0].length; if(text.substr(index, len) == this.blockComment[0]) {  index += len; pos += len; len = this.blockComment[1].length; while(portion = text.substr(index, len)) { if(portion == this.blockComment[1]) {  index += len; pos += len; break; } pos++; if(text[index++] == "\n") {  pos = 0; line++; }  } if(!portion) throw('Unclosed comment block.'); continue; }  } char = text.substr(index++, 1); pos++; if(this.whitespace.indexOf(char) > -1) continue; if(char == "\r") {  pos--; continue; } if(char == "\n") {  line++; pos = 0; continue; } if(char.match(/[0-9]/)) {  backupPos = pos; pointInUse = false; token = char; if(this.cLikeBaseSupport) {  if(token == "0") {  if(index < text.length) {  if(text.substr(index, 1) == "x") {  index++; while(index < text.length) {  if(text.substr(index, 1).match(/^[0-9a-fA-F]/)) {  token += text.substr(index++, 1); pos++; } else break; } token = parseInt(token, 16); } else if(text.substr(index, 1) == "b") {  index++; while(index < text.length) {  if(text.substr(1, index).match(/^[01]/)) {  token += text.substr(index++, 1); pos++; } else break; } token = parseInt(token, 2); } else {  while(index < text.length) {  if(text.substr(index, 1).match(/^[0-7]/)) {  token += text.substr(index++, 1); pos++; }  else if(text.substr(index, 1) == "8" || text.substr(index, 1) == "9") {  throw("Illegal octal number. Line "  + line + ", pos " + (pos - token.length)); } else break; } token = parseInt(token, 8); }  }  }  } while(index < text.length) {  if(text.substr(index, 1).match(/[0-9]/)) {  token += text.substr(index++, 1); pos++; } else {  if((text.substr(index, 1) == ".") && !pointInUse) {  pointInUse = true; token += text.substr(index++, 1); pos++; } else break; }  }  if(typeof token == 'string') token = parseInt(token); this.addToken(pointInUse ? this.FLOAT : this.INT, token, line, backupPos); continue; }  if(this.cLikeStringSupport) {  if(char == "\"" || char == "'") {  backupPos = pos; token = ""; noLineBreak = true; while((index < text.length) && (text.substr(index, 1) != char) && (noLineBreak = (text.substr(index, 1) != "\n"))) {  if(text.substr(index, 1) == "\\") {  if(++index < text.length) {  switch(text.substr(index, 1)) {  case "\"": token += "\""; break; case "\\": token += "\\"; break; case "n": token += "\n"; break; case "t": token += "\t"; break; case "r": token += "\r"; break; case "\n": throw("Unterminated string. Line " + line +  ", pos " + pos); default: token += "\\" + text.substr(index, 1); } index++; pos++; } else {  throw("Unterminated string. Line " + line + ", pos "  +  pos); }  } else {  token += text.substr(index++, 1); pos++; }  } index++; pos++; if(!noLineBreak) {  throw("Unterminated string. Line " + line + ", pos " + pos); } keyId = (char == "\"" ? this.STRING : this.CHAR); this.addToken(keyId, token, line, backupPos); continue; }  }  if(this.delimiters.indexOf(char) > -1) {  backupPos = pos; token = ''; tempKey = char; keyFound = false; for(i = index, j = 0; (j < this.maxKeyLen) && (i < text.length); ++i, ++j) {  tempKey += text.substr(i, 1); if(this.isKey(tempKey)) {  token = tempKey; index = i + 1; pos++; keyFound = true; }  } if(!keyFound) token = char; if(this.isKey(token)) {  keyId = this.keys[token]; } else keyId = this.UNKNOWN; this.addToken(keyId, token, line, backupPos); continue; }  token = ""; backupPos = pos; tooFar = false; while((index <= text.length) && this.delimiters.indexOf(char) == -1 && this.whitespace.indexOf(char) == -1 && (char != "\n") && (char != "\r")) {  token += char; char = text.substr(index++, 1); pos++; tooFar = true; }  if(tooFar) {  index--; pos--; } if(token.length < this.maxKeyLen) {  tempKey = token; keyFound = false; for(i = index, j = token.length - 1; (j < this.maxKeyLen) && (i < text.length); ++i, ++j) {  tempKey += text.substr(i, 1); if(this.isKey(tempKey)) {  token = tempKey; index = i + 1; pos++; keyFound = true; }  }  } if(this.isKey(token)) {  keyId = this.KEY; } else keyId = this.IDENTIFIER; this.addToken(keyId, token, line, backupPos); } }; Tokenizer.prototype.addToken = function(keyId, token, line, pos) {  var tok = {"row" : line, "pos" : pos, "val" : false}; if(keyId != this.KEY) {  tok["tk"] = keyId; tok["val"] = token; } else {  if(!this.isCaseSensitive) token = token.toLowerCase(); tok["tk"] = this.keys[token]; if(this.storeKeyAsValue) tok["val"] = token; } this.tokens.push(tok); }; Tokenizer.prototype.isKey = function(keyword) {  if(!this.isCaseSensitive) keyword = keyword.toLowerCase(); return typeof(this.keys[keyword]) != 'undefined'; }; function VCookie() {  this.get = function(name) {  eval('var regex=/' + name.regexEscape() + '\\s*=\\s*([^;]+)\\s*(;|$)/;'); var result = document.cookie.match(regex); if(result) return result[1]; }; this.set = function(name, value, expiresOn) {  if(typeof expiresOn == 'undefined') {  expiresOn = new Date; expiresOn.setTime(expiresOn.getTime() + 604800000); }  document.cookie = name + '=' + value.paramEncode() + '; expires=' + expiresOn.toGMTString(); }; this.setUnlimited = function(name, value) {  var expiresOn = new Date; expiresOn.setTime(2147483647000); this.set(name, value, expiresOn); }; this.remove = function(name) {  var expiresOn = new Date; expiresOn.setTime(0); this.set(name, '', expiresOn); };} var $Cookie = new VCookie; function VDragNDrop() {  var self = this; var started = false; var dragging = false; var dragObj; var topZ = 1000; var offsetX; var offsetY; var overPort = false; var ports = new Array; this.makeDraggable = function(node, props) {  if(typeof props == 'undefined') props = {}; node.__draggable = true; node.__forceDocking = props.forceDocking; node.__onDrag = props.onDrag; if(props.handle) {  props.handle.__draggable = true; props.handle.__isHandle = true; props.handle.__dragObj = node; }  }; this.dockTo = function(dragNode, dockNode) {  if(typeof dockNode.__onDrop == 'function') {  var result = dockNode.__onDrop(dockNode, dragNode); } else {  var result = true; }  if(result) {  var style = window.getComputedStyle(dockNode, null); dragNode.style.left = parseInt(style.getPropertyValue('left')) + 'px'; dragNode.style.top = parseInt(style.getPropertyValue('top')) + 'px'; } dragNode.__port = dockNode; }; this.registerSnapPort = function(node, props) {  if(typeof props == 'undefined') props = {}; node.__isSnapPort = true; node.__onDragOver = props.onDragOver; node.__onDragOut = props.onDragOut; node.__onDrop = props.onDrop; ports.push(node); }; this.unregisterSnapPort = function(node) {  ports.remove(node); }; this.start = function() {  if(!started) {  started = true; $(document.body).observe('mousedown', mouseDownHandler); $(document.body).observe('mouseup', mouseUpHandler); }  }; this.stop = function() {  if(started) {  started = false; dragging = false; $(document.body).ignore('mousedown', mouseDownHandler); $(document.body).ignore('mousemove', mouseMoveHandler); $(document.body).ignore('mouseup', mouseUpHandler); }  }; function mouseDownHandler(e) {  if(!e) e = window.event; var target = e.target ? e.target : e.srcElement; if(target.__draggable) {  if(target.__isHandle) {  dragObj = target.__dragObj; } else {  dragObj = target; } dragObj.style.position = 'absolute'; dragObj.style.zIndex = topZ++; offsetX = e.layerX ? e.layerX : e.offsetX ? e.offsetX : e.x; offsetY = e.layerY ? e.layerY : e.offsetY ? e.offsetY : e.y; dragging = true; $(document.body).observe('mousemove', mouseMoveHandler); }  }  function mouseMoveHandler(e) {  if(!e) e = window.event; var mouseX = e.clientX + (window.pageXOffset ? window.pageXOffset :  document.body.scrollLeft ? document.body.scrollLeft : 0); var mouseY = e.clientY + (window.pageYOffset ? window.pageYOffset :  document.body.scrollTop ? document.body.scrollTop : 0); dragObj.style.left = (mouseX - offsetX) + 'px'; dragObj.style.top = (mouseY - offsetY) + 'px'; if(typeof dragObj.__onDrag == 'function') dragObj.__onDrag(dragObj); for(var i = 0; i < ports.length; ++i) {  var port = ports[i]; var x1 = port.computeLeft(); var y1 = port.computeTop(); var x2 = port.computeWidth() + x1; var y2 = port.computeHeight() + y1; var isOver = mouseY.between(y1, y2) && mouseX.between(x1, x2); if(overPort) {  if(overPort == port && !isOver) {  if(typeof overPort.__onDragOut == 'function') {  overPort.__onDragOut(overPort, dragObj); } overPort = false; }  } else {  if(isOver) {  overPort = port; if(typeof overPort.__onDragOver == 'function') {  overPort.__onDragOver(overPort, dragObj); }  }  }  }  }  function mouseUpHandler() {  if(dragging) {  dragging = false; $(document.body).ignore('mousemove', mouseMoveHandler); if(overPort) {  self.dockTo(dragObj, overPort); } else {  if(dragObj.__forceDocking && dragObj.__port) {  self.dockTo(dragObj, dragObj.__port); }  } overPort = false; }  }} var $DD = new VDragNDrop; function Color(init, g, b, a) { this.r = 0; this.g = 0; this.b = 0; this.a = 1.0; switch(typeof(init)) {  case 'string': this.setByString(init); break; case 'object': this.r = init.r; this.g = init.g; this.b = init.b; this.a = init.a; break; case 'number': this.r = init; this.g = g; this.b = b; this.a = a; case 'undefined': break; default: throw('Illegal initialization data for Color object.'); }} Color.prototype.setByString = function(str) {  var elms; if(elms = str.match(/rgb[ ]*\([ ]*(\d+)[ ]*,[ ]*(\d+)[ ]*,[ ]*(\d+)[ ]*\)/)) {  this.r = parseInt(elms[1]); this.g = parseInt(elms[2]); this.b = parseInt(elms[3]); } else {  if(elms = str.match(/rgba[ ]*\([ ]*(\d+)[ ]*,[ ]*(\d+)[ ]*,[ ]*(\d+)[ ]*,[ ]*([\d\.]+)[ ]*\)/)) {  this.r = parseInt(elms[1]); this.g = parseInt(elms[2]); this.b = parseInt(elms[3]); this.a = parseFloat(elms[4]); } else {  if(elms = str.match(/#([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})/i)) {  this.r = parseInt(elms[1], 16); this.g = parseInt(elms[2], 16); this.b = parseInt(elms[3], 16); } else {  throw('Cannot recognize color string "' + str + '"'); }  }  }}; Color.prototype.blendTo = function(color, percent) {  var blended = new Color; var step = Math.abs(this.r - color.r) / 100; var sign = this.r > color.r ? -1 : 1; blended.r = this.r + sign * Math.round(step * percent); step = Math.abs(this.g - color.g) / 100; sign = this.g > color.g ? -1 : 1; blended.g = this.g + sign * Math.round(step * percent); step = Math.abs(this.b - color.b) / 100; sign = this.b > color.b ? -1 : 1; blended.b = this.b + sign * Math.round(step * percent); step = (this.a - color.a) / 100; sign = this.a > color.a ? -1 : 1; blended.a = this.a + sign * step * percent; return blended; }; Color.prototype.toString = function(withAlpha) {  if(withAlpha) {  return "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")"; } else {  return "rgb(" + this.r + "," + this.g + "," + this.b + ")"; }}; function JsonSerializer() {  var self = this; this.toString = function(object) {  if(object instanceof Array) return arrayToString(object); return '{'+toStringCore(object)+'}'; }; function toStringCore(object) {  var string = ''; for(var name in object) {  if(string) string += ','; string += '"'+name.escape()+'":'; switch(typeof object[name]) {  case 'number': string += object[name]; break; case 'string': string += '"'+object[name].escape()+'"'; break; case 'object': if(object[name] instanceof Array) {  string += arrayToString(object[name]); } else {  string += self.toString(object[name]); }  break; case 'boolean': string += object[name] ? 'true' : 'false'; break; case 'undefined': string += 'null'; break; }  } return string; }  function arrayToString(a) {  var result = ''; for(var i=0; i<a.length; ++i) {  if(result) result += ','; switch(typeof a[i]) {  case 'number': result += a[i]; break; case 'string': result += '"'+a[i].escape()+'"'; break; case 'object': if(a[i] instanceof Array) {  result += arrayToString(a[i]); } else {  result += self.toString(a[i]); }  break; }  }  return '['+result+']'; }} var $JSON = new JsonSerializer; Array.prototype.add = function(array) {  if((array != null) && (typeof array != 'string') && (array.length != null)) {  for(var i = 0; i < array.length; ++i) {  this.push(array[i]); }  } else {  this.push(array); }}; Array.prototype.remove = function(index) {  var obj = this.slice(index, index + 1); this.splice(index, 1); return obj[0]; }; Array.prototype.removeValue = function(value) {  var count = 0; for(var i = 0; i < this.length; ++i) {  if(this[i] == value) {  this.splice(i, 1); --i; ++count; }  }  return count; }; Array.prototype.search = function(needle) {  for(var i = Math.ceil(this.length / 2), j = this.length - 1; i--; j--) {  if(this[i] == needle) return i; if(this[j] == needle) return j; } return -1; }; Array.prototype.contains = function(needle) {  return this.search(needle) != -1; }; Array.prototype.clear = function() {  while(this.length) this.pop(); }; Array.prototype.shuffle = function() {  this.sort(function(a, b) { return Math.random() * 2 - 1; }); }; Array.prototype.filter = function(regex) {  var result = new Array; for(var i = 0; i < this.length; ++i) {  var value = "" + this[i]; if(value.match(regex)) result.push(this[i]); } return result; }; String.prototype.whitespace = " \t\n\r\0\x0B"; String.prototype.escape = function() {  var clean = this.replace(/[\n]/g, '\\n'); clean = clean.replace(/[\r]/g, '\\r'); clean = clean.replace(/[\t]/g, '\\t'); clean = clean.replace(/"/g, '\\"'); clean = clean.replace(/'/g, "\\'"); return clean; }; String.prototype.pad = function(char, len) {  var maxLen = len - this.length; var pad = ""; for(var i = 0; i < maxLen; ++i) {  pad += char; }  return pad + this; }; String.prototype.trimLeft = function(max) {  var i; if(typeof(max) == 'undefined') max = this.length; for(i = 0; i < max; ++i) {  if(this.whitespace.indexOf(this.substr(i, 1)) == -1) break; } return this.substr(i); }; String.prototype.trimRight = function(max) {  var i; if(typeof(max) == 'undefined') max = 0; for(i = this.length - 1; i >= max; --i) {  if(this.whitespace.indexOf(this.substr(i, 1)) == -1) break; } return this.substr(0, i + 1); }; String.prototype.trim = function() {  return this.trimLeft().trimRight(); }; String.prototype.beginsWith = function(str) {	return this.indexOf(str) == 0; }; String.prototype.endsWith = function(str) {	return this.indexOf(str) == this.length - str.length; }; String.prototype.times = function(count) {  var result = ""; for(var i = 0; i < count; ++i) {  result += this; } return result; }; String.prototype.hyphenToCamelCase = function() {  var str = this; if(str.indexOf('-') > -1) {  var parts = str.split('-'); str = parts[0]; for(var i = 1; i < parts.length; i++) str += parts[i].substr(0, 1).toUpperCase() + parts[i].substr(1); } return str; }; String.prototype.camelCaseToHyphen = function() {  var str = ''; for(var i = 0; i < this.length; ++i) {  var char = this.charAt(i); str += (char.charCodeAt(0) >= 97) ? char : ('-' + char.toLowerCase()); } return str; }; String.prototype.paramEncode = function() {  var str = encodeURI(this); str = str.replace(/&/g, '%26'); str = str.replace(/=/g, '%3D'); str = str.replace(/\?/g, '%3F'); return str; }; String.prototype.paramDecode = function() {  var str = decodeURI(this); str = str.replace(/%26/g, '&'); str = str.replace(/%3D/gi, '='); str = str.replace(/%3F/g, '?'); return str; }; String.prototype.extractFileName = function() {  var elms = this.split('/'); return elms.pop(); }; String.prototype.extractFileExtension = function() {  var elms = this.split('.'); return elms.pop(); }; String.prototype.extractPath = function() {  var elms = this.split('/'); elms.pop(); return elms.join('/'); }; String.prototype.compare = function(str) {  var min = Math.min(this.length, str.length); var a, b; for(var i = 0; i < min; ++i) {  a = this.charCodeAt(i); b = str.charCodeAt(i); if(a != b) break; }  return a - b;}; String.prototype.regexEscape = function() {  return this.replace(/([\(\)\[\]\.\\\^\$\-\{\}])/g, "\\$1"); }; String.prototype.stripHTML = function() {	return this.replace(/<br[^>]*>/, "\n").replace(/<[^>]+>/g,""); }; String.prototype.ellipse = function(len) {	if(this.length > len) {	 return this.substr(0, len) + "..."; } else {	 return this; }}; Number.prototype.times = function(func) {  for(var i = 0; i < this; ++i) {  func(i); }}; Number.prototype.truncDecimals = function (amount) {  var factor = Math.pow(10, amount); return Math.round(this * factor) / factor; }; Number.prototype.between = function(a, b) { return a <= this && this <= b; }; __vividWFunc = window.open; window.open = function(a, b, c) {  var win = __vividWFunc(a, b, c); win.center = function() {  var posX = screen.width / 2 - this.outerWidth / 2; var posY = screen.height / 2 - this.outerHeight / 2; this.moveTo(posX, posY); }; return win; }; window.getInnerHeight = function() {  return window.innerHeight ? window.innerHeight :  (document.documentElement.clientHeight) ?  document.documentElement.clientHeight : screen.availHeight; }; window.getInnerWidth = function() {  return window.innerWidth ? window.innerWidth :  (document.documentElement.clientWidth) ?  document.documentElement.clientWidth : screen.availWidth; }; Element.prototype.getChildElementsByTagName = function(name, deep) {  var children = this.childNodes; var resultSet = new Array; name = name.toLowerCase(); if(children) {  for(var i = 0; i < children.length; ++i) {  var curNode = children[i]; if(curNode.nodeType == 1) {  if((name == '*') || (curNode.nodeName.toLowerCase() == name)) {  resultSet.push(curNode); }  if($.__isIE) $.__vividFix_createElementProto(curNode); if(deep) {  resultSet.add(curNode.getChildElementsByTagName(name, true)); }  }  }  } return resultSet; }; Element.prototype.getFollowing = function() {  throw("Not implemented, yet"); }; Element.prototype.getPreceding = function() {  throw("Not implemented, yet"); }; Element.prototype.getFollowingSiblings = function(name) {  var node = this.nextSibling; var result = new Array; name = name.toLowerCase(); while(node) {  if(name != null) {  if(name == '*' || node.nodeName.toLowerCase() == name) {  result.push(node); }  } else {  result.push(node); } node = node.nextSibling; }  return result; }; Element.prototype.getPrecedingSiblings = function(name) {  var node = this.previousSibling; var result = new Array; name = name.toLowerCase(); while(node) {  if(name != null) {  if(name == '*' || node.nodeName.toLowerCase() == name) {  result.push(node); }  } else {  result.push(node); } node = node.previousSibling; }  return result; }; Element.prototype.getAncestors = function(name) {  var node = this.parent; var result = new Array; name = name.toLowerCase(); while(node) {  if(name != null) {  if(name == '*' || node.nodeName.toLowerCase() == name) {  result.push(node); }  } else {  result.push(node); } node = node.parent; }  return result; }; Element.prototype.getNextSiblingByTagName = function(name) {  if(name == '*') {  var sibling = this.nextSibling; while(sibling && sibling.nodeType != 1) {  sibling = sibling.nextSibling; }  return sibling; } var sibling = this; name = name.toLowerCase(); while(sibling = sibling.nextSibling) {  if(sibling.nodeName.toLowerCase() == name) {  return sibling; }  }}; Element.prototype.getPreviousSiblingByTagName = function(name) {  if(name == '*') {  var sibling = this.previousSibling; while(sibling && sibling.nodeType != 1) {  sibling = sibling.previousSibling; }  return sibling; } var sibling = this; name = name.toLowerCase(); while(sibling = sibling.previousSibling) {  if(sibling.nodeName.toLowerCase() == name) {  return sibling; }  }}; Element.prototype.appendChildNodes = function(col) {  for(var i=0; i < col.length; ++i) {  this.appendChild(col[i]); }}; Element.prototype.selectTextRange = function(start, end) {  if(this.setSelectionRange) {  this.setSelectionRange(start, end); } else if(this.createTextRange) {  var range = this.createTextRange(); range.moveStart("character", start); range.moveEnd("character", end); range.select(); } this.focus(); }; Element.prototype.addClass = function(className) {  var c = this.getAttribute('class'); if(c) c += " "; else c = ""; c += className; this.setAttribute('class', c); }; Element.prototype.removeClass = function(className) {  var str = this.getAttribute('class'); if(!str) str = ''; eval('var rx=/'+className+'/g;'); str = str.replace(rx, ''); this.setAttribute('class', str); }; Element.prototype.addPreviousSibling = function(node) {  this.parentNode.insertBefore(node, this); }; Element.prototype.addFollowingSibling = function(node) {  this.parentNode.insertBefore(node, this.nextSibling); }; Element.prototype.hide = function() {  this.style.visibility = 'hidden'; }; Element.prototype.unhide = function() {  this.style.visibility = 'visible'; }; Element.prototype.computeLeft = function() {  var style = window.getComputedStyle(this, null); var a = parseInt(this.offsetLeft); var b = parseInt(style.getPropertyValue('margin-left')); var c = parseInt(style.getPropertyValue('padding-left')); var value = (isNaN(a) ? 0 : a) +  (isNaN(b) ? 0 : b) +  (isNaN(c) ? 0 : c); if(this.offsetParent) {  value += this.offsetParent.computeLeft(); }  return value; }; Element.prototype.computeTop = function() {  var style = window.getComputedStyle(this, null); var a = parseInt(this.offsetTop); var b = parseInt(style.getPropertyValue('margin-top')); var c = parseInt(style.getPropertyValue('padding-top')); var value = (isNaN(a) ? 0 : a) +  (isNaN(b) ? 0 : b) +  (isNaN(c) ? 0 : c); if(this.offsetParent) {  value += this.offsetParent.computeTop(); }  return value; }; Element.prototype.computeHeight = function() {  var style = window.getComputedStyle(this, null); return parseInt(style.getPropertyValue('height')); }; Element.prototype.computeWidth = function() {  var style = window.getComputedStyle(this, null); return parseInt(style.getPropertyValue('width')); }; Element.prototype.center = function() {  var compStyle = window.getComputedStyle(this, null); var width = compStyle.getPropertyValue('width'); var height = compStyle.getPropertyValue('height'); function centerCalc(width, height, pWidth, pHeight) {  var hWidth = Math.round(parseInt(width) / 2); var hHeight = Math.round(parseInt(height) / 2); var hpWidth = Math.round(parseInt(pWidth) / 2); var hpHeight = Math.round(parseInt(pHeight) / 2); return {top: (hpHeight - hHeight) + 'px', left: (hpWidth - hWidth) + 'px'}; }  switch(this.style.position.toLowerCase()) {  case 'relative': var compStyle = window.getComputedStyle(this.parentNode, null); var pWidth = compStyle.getPropertyValue('width'); var pHeight = compStyle.getPropertyValue('height'); var pos = centerCalc(width, height, pWidth, pHeight); this.style.left = pos.left; this.style.top = pos.top; break; case 'absolute': case 'fixed': var pWidth = window.getInnerWidth(); var pHeight = window.getInnerHeight(); var pos = centerCalc(width, height, pWidth, pHeight); this.style.left = pos.left; this.style.top = pos.top; }}; if(window.HTMLInputElement) {  $.__focusI = HTMLInputElement.prototype.focus; HTMLInputElement.prototype.focus = function() {  $.focusedElement = this; $.__focusI.call(this); };} if(window.HTMLSelectElement) {  $.__focusS = HTMLSelectElement.prototype.focus; HTMLSelectElement.prototype.focus = function() {  $.focusedElement = this; $.__focusS.call(this); };} if(window.HTMLTextAreaElement) {  $.__focusT = HTMLTextAreaElement.prototype.focus; HTMLTextAreaElement.prototype.focus = function() {  $.focusedElement = this; $.__focusT.call(this); };} Function.prototype.inheritsFrom = function(parent) {  for(var name in parent.prototype) {  this.prototype[name] = parent.prototype[name]; }}; function WidgetBase(props) {  if(typeof(props) == 'undefined') {  props = new Object; }  if(!props.domNode) {  this.domNode = this.__defaultDOMNodeFactory(); } else {  this.domNode = props.domNode; } if(props.parentNode) props.parentNode.appendChild(this.domNode); this.props = props; if(typeof(props.cssClass) != 'undefined') {  this.domNode.setAttribute('class', props.cssClass); }} WidgetBase.prototype.getDOMNode = function() {  return this.domNode; }; WidgetBase.prototype.$ = function() {  return $(this.domNode); }; WidgetBase.prototype.refresh = function() {}; WidgetBase.prototype.__defaultDOMNodeFactory = function() {  return $Build('div'); }; $(function() {  var _vivid_test_obj = document.createElement('div'); document.body.appendChild(_vivid_test_obj); if(!_vivid_test_obj.outerHTML && HTMLElement.prototype.__defineSetter__) {  HTMLElement.prototype.__defineSetter__('outerHTML', function(html) {  var range = this.ownerDocument.createRange(); range.setStartBefore(this); var frag = range.createContextualFragment(html); this.parentNode.replaceChild(frag, this); }); HTMLElement.prototype.__defineGetter__('outerHTML', function() {  var result = ""; switch(this.nodeType) {  case 1: result = "<" + this.nodeName; for(var i = 0; i < this.attributes.length; i++ ) { if(this.attributes[i].nodeValue != null) {  result += " " + this.attributes[i].nodeName + "=\"" + this.attributes[i].nodeValue + "\""; }  }  result += ">"; if(this.childNodes.length > 0) {  result += this.innerHTML + "<\/" + this.nodeName +">"; }  break; case 3: result = this.nodeValue; break; case 4: result = "<![CDATA[" + this.nodeValue + "]]>"; break; case 5: result = "&" + this.nodeValue; break; case 8: result = "<!--" + this.nodeValue + "-->"; break; }  return result; }); HTMLElement.prototype.__defineGetter__('innerText', function() {  var tmp = this.innerHTML.replace(/<br>/gi,"\n"); return tmp.replace(/<[^>]+>/g,""); }); HTMLElement.prototype.__defineSetter__('innerText', function(txtStr) {  var parsedText = document.createTextNode(txtStr); this.innerHTML = ""; this.appendChild(parsedText); }); } _vivid_test_obj.setAttribute('style', '-moz-opacity:1.0;-khtml-opacity:1.0;' + 'opacity:1.0' ); if(_vivid_test_obj.style.opacity) {  Element.prototype.setOpacity = function(opac) {  this.style.opacity = opac; this.style.storedOpacity = opac; }; Element.prototype.getOpacity = function() {  if(!this.style.opacity) {  this.style.opacity = 1.0; }  if(!this.style.storedOpacity) {  this.style.storedOpacity = this.style.opacity; }  return this.style.storedOpacity; }; }  else if(_vivid_test_obj.style.MozOpacity) {  Element.prototype.setOpacity = function(opac) {  this.style.MozOpacity = opac; }; Element.prototype.getOpacity = function() {  if(!this.style.MozOpacity) this.style.MozOpacity = 1.0; return this.style.MozOpacity; }; }  else if(_vivid_test_obj.style.KhtmlOpacity) {  Element.prototype.setOpacity = function(opac) {  this.style.KhtmlOpacity = opac; }; Element.prototype.getOpacity = function() {  if(!this.style.KhtmlOpacity) this.style.KhtmlOpacity = 1.0; return this.style.KhtmlOpacity; }; }  else if($.__isIE) {  Element.prototype.setOpacity = function(opac) {  if(!this.style.height) {  this.style.height = this.offsetHeight; } this.style.filter = 'alpha(opacity=' + opac * 100.0 + ')'; }; Element.prototype.getOpacity = function() {  var result = this.style.filter.match(/opacity=(\w*)/); if(!result) {  return 1.0; }  return result[1] / 100.0; }; Element.prototype.getAttributeNode = function(name) {  return {'nodeName' : name, 'nodeValue' : this.getAttribute(name)}; }; Element.prototype.getAttribute = function(name) {  if(name == 'class') name = 'className'; if(name == 'style') return this.style.cssText; return this[name]; }; Element.prototype.setAttribute = function(name, value) {  if(name == 'style') {  this.style.cssText = value; return; } if(name == 'class') {  this.className = value; return; }  this[name] = value; }; $.__vividFix_createElementProto(document.body); } if(!Element.prototype.getOpacity) {  Element.prototype.getOpacity = function() {  if(!this.v_opacity) {  this.v_opacity = 1.0; }  return this.v_opacity; }; Element.prototype.setOpacity = function(opac) {  this.v_opacity = opac; }; } document.body.removeChild(_vivid_test_obj); $.__vividReady = true; });