Importing dromaeo performance tests to src/chrome/test/data.

Committing this for Anton Muhin (antonm@chromium.org).

BUG=none
TEST=none



Review URL: http://codereview.chromium.org/269054

Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 66cc1b917a01179e5f3f3869dd763be8d1dd27a2
diff --git a/JSON.php b/JSON.php
new file mode 100644
index 0000000..0cddbdd
--- /dev/null
+++ b/JSON.php
@@ -0,0 +1,806 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Converts to and from JSON format.
+ *
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in  Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ *
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met: Redistributions of source code must retain the
+ * above copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * @category
+ * @package     Services_JSON
+ * @author      Michal Migurski <mike-json@teczno.com>
+ * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
+ * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+ * @copyright   2005 Michal Migurski
+ * @version     CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
+ * @license     http://www.opensource.org/licenses/bsd-license.php
+ * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ */
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_SLICE',   1);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_STR',  2);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_ARR',  3);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_OBJ',  4);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_CMT', 5);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_LOOSE_TYPE', 16);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
+
+/**
+ * Converts to and from JSON format.
+ *
+ * Brief example of use:
+ *
+ * <code>
+ * // create a new instance of Services_JSON
+ * $json = new Services_JSON();
+ *
+ * // convert a complexe value to JSON notation, and send it to the browser
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
+ * $output = $json->encode($value);
+ *
+ * print($output);
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
+ *
+ * // accept incoming POST data, assumed to be in JSON notation
+ * $input = file_get_contents('php://input', 1000000);
+ * $value = $json->decode($input);
+ * </code>
+ */
+class Services_JSON
+{
+   /**
+    * constructs a new JSON instance
+    *
+    * @param    int     $use    object behavior flags; combine with boolean-OR
+    *
+    *                           possible values:
+    *                           - SERVICES_JSON_LOOSE_TYPE:  loose typing.
+    *                                   "{...}" syntax creates associative arrays
+    *                                   instead of objects in decode().
+    *                           - SERVICES_JSON_SUPPRESS_ERRORS:  error suppression.
+    *                                   Values which can't be encoded (e.g. resources)
+    *                                   appear as NULL instead of throwing errors.
+    *                                   By default, a deeply-nested resource will
+    *                                   bubble up with an error, so all return values
+    *                                   from encode() should be checked with isError()
+    */
+    function Services_JSON($use = 0)
+    {
+        $this->use = $use;
+    }
+
+   /**
+    * convert a string from one UTF-16 char to one UTF-8 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf16  UTF-16 character
+    * @return   string  UTF-8 character
+    * @access   private
+    */
+    function utf162utf8($utf16)
+    {
+        // oh please oh please oh please oh please oh please
+        if(function_exists('mb_convert_encoding')) {
+            return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
+        }
+
+        $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+
+        switch(true) {
+            case ((0x7F & $bytes) == $bytes):
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x7F & $bytes);
+
+            case (0x07FF & $bytes) == $bytes:
+                // return a 2-byte UTF-8 character
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0xC0 | (($bytes >> 6) & 0x1F))
+                     . chr(0x80 | ($bytes & 0x3F));
+
+            case (0xFFFF & $bytes) == $bytes:
+                // return a 3-byte UTF-8 character
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0xE0 | (($bytes >> 12) & 0x0F))
+                     . chr(0x80 | (($bytes >> 6) & 0x3F))
+                     . chr(0x80 | ($bytes & 0x3F));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }
+
+   /**
+    * convert a string from one UTF-8 char to one UTF-16 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf8   UTF-8 character
+    * @return   string  UTF-16 character
+    * @access   private
+    */
+    function utf82utf16($utf8)
+    {
+        // oh please oh please oh please oh please oh please
+        if(function_exists('mb_convert_encoding')) {
+            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+        }
+
+        switch(strlen($utf8)) {
+            case 1:
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return $utf8;
+
+            case 2:
+                // return a UTF-16 character from a 2-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x07 & (ord($utf8{0}) >> 2))
+                     . chr((0xC0 & (ord($utf8{0}) << 6))
+                         | (0x3F & ord($utf8{1})));
+
+            case 3:
+                // return a UTF-16 character from a 3-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr((0xF0 & (ord($utf8{0}) << 4))
+                         | (0x0F & (ord($utf8{1}) >> 2)))
+                     . chr((0xC0 & (ord($utf8{1}) << 6))
+                         | (0x7F & ord($utf8{2})));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }
+
+   /**
+    * encodes an arbitrary variable into JSON format
+    *
+    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
+    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
+    *                           if var is a strng, note that encode() always expects it
+    *                           to be in ASCII or UTF-8 format!
+    *
+    * @return   mixed   JSON string representation of input var or an error if a problem occurs
+    * @access   public
+    */
+    function encode($var)
+    {
+        switch (gettype($var)) {
+            case 'boolean':
+                return $var ? 'true' : 'false';
+
+            case 'NULL':
+                return 'null';
+
+            case 'integer':
+                return (int) $var;
+
+            case 'double':
+            case 'float':
+                return (float) $var;
+
+            case 'string':
+                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+                $ascii = '';
+                $strlen_var = strlen($var);
+
+               /*
+                * Iterate over every character in the string,
+                * escaping with a slash or encoding to UTF-8 where necessary
+                */
+                for ($c = 0; $c < $strlen_var; ++$c) {
+
+                    $ord_var_c = ord($var{$c});
+
+                    switch (true) {
+                        case $ord_var_c == 0x08:
+                            $ascii .= '\b';
+                            break;
+                        case $ord_var_c == 0x09:
+                            $ascii .= '\t';
+                            break;
+                        case $ord_var_c == 0x0A:
+                            $ascii .= '\n';
+                            break;
+                        case $ord_var_c == 0x0C:
+                            $ascii .= '\f';
+                            break;
+                        case $ord_var_c == 0x0D:
+                            $ascii .= '\r';
+                            break;
+
+                        case $ord_var_c == 0x22:
+                        case $ord_var_c == 0x2F:
+                        case $ord_var_c == 0x5C:
+                            // double quote, slash, slosh
+                            $ascii .= '\\'.$var{$c};
+                            break;
+
+                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+                            // characters U-00000000 - U-0000007F (same as ASCII)
+                            $ascii .= $var{$c};
+                            break;
+
+                        case (($ord_var_c & 0xE0) == 0xC0):
+                            // characters U-00000080 - U-000007FF, mask 110XXXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+                            $c += 1;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xF0) == 0xE0):
+                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}));
+                            $c += 2;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xF8) == 0xF0):
+                            // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}));
+                            $c += 3;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xFC) == 0xF8):
+                            // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}));
+                            $c += 4;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xFE) == 0xFC):
+                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}),
+                                         ord($var{$c + 5}));
+                            $c += 5;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+                    }
+                }
+
+                return '"'.$ascii.'"';
+
+            case 'array':
+               /*
+                * As per JSON spec if any array key is not an integer
+                * we must treat the the whole array as an object. We
+                * also try to catch a sparsely populated associative
+                * array with numeric keys here because some JS engines
+                * will create an array with empty indexes up to
+                * max_index which can cause memory issues and because
+                * the keys, which may be relevant, will be remapped
+                * otherwise.
+                *
+                * As per the ECMA and JSON specification an object may
+                * have any string as a property. Unfortunately due to
+                * a hole in the ECMA specification if the key is a
+                * ECMA reserved word or starts with a digit the
+                * parameter is only accessible using ECMAScript's
+                * bracket notation.
+                */
+
+                // treat as a JSON object
+                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+                    $properties = array_map(array($this, 'name_value'),
+                                            array_keys($var),
+                                            array_values($var));
+
+                    foreach($properties as $property) {
+                        if(Services_JSON::isError($property)) {
+                            return $property;
+                        }
+                    }
+
+                    return '{' . join(',', $properties) . '}';
+                }
+
+                // treat it like a regular array
+                $elements = array_map(array($this, 'encode'), $var);
+
+                foreach($elements as $element) {
+                    if(Services_JSON::isError($element)) {
+                        return $element;
+                    }
+                }
+
+                return '[' . join(',', $elements) . ']';
+
+            case 'object':
+                $vars = get_object_vars($var);
+
+                $properties = array_map(array($this, 'name_value'),
+                                        array_keys($vars),
+                                        array_values($vars));
+
+                foreach($properties as $property) {
+                    if(Services_JSON::isError($property)) {
+                        return $property;
+                    }
+                }
+
+                return '{' . join(',', $properties) . '}';
+
+            default:
+                return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+                    ? 'null'
+                    : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
+        }
+    }
+
+   /**
+    * array-walking function for use in generating JSON-formatted name-value pairs
+    *
+    * @param    string  $name   name of key to use
+    * @param    mixed   $value  reference to an array element to be encoded
+    *
+    * @return   string  JSON-formatted name-value pair, like '"name":value'
+    * @access   private
+    */
+    function name_value($name, $value)
+    {
+        $encoded_value = $this->encode($value);
+
+        if(Services_JSON::isError($encoded_value)) {
+            return $encoded_value;
+        }
+
+        return $this->encode(strval($name)) . ':' . $encoded_value;
+    }
+
+   /**
+    * reduce a string by removing leading and trailing comments and whitespace
+    *
+    * @param    $str    string      string value to strip of comments and whitespace
+    *
+    * @return   string  string value stripped of comments and whitespace
+    * @access   private
+    */
+    function reduce_string($str)
+    {
+        $str = preg_replace(array(
+
+                // eliminate single line comments in '// ...' form
+                '#^\s*//(.+)$#m',
+
+                // eliminate multi-line comments in '/* ... */' form, at start of string
+                '#^\s*/\*(.+)\*/#Us',
+
+                // eliminate multi-line comments in '/* ... */' form, at end of string
+                '#/\*(.+)\*/\s*$#Us'
+
+            ), '', $str);
+
+        // eliminate extraneous space
+        return trim($str);
+    }
+
+   /**
+    * decodes a JSON string into appropriate variable
+    *
+    * @param    string  $str    JSON-formatted string
+    *
+    * @return   mixed   number, boolean, string, array, or object
+    *                   corresponding to given JSON input string.
+    *                   See argument 1 to Services_JSON() above for object-output behavior.
+    *                   Note that decode() always returns strings
+    *                   in ASCII or UTF-8 format!
+    * @access   public
+    */
+    function decode($str)
+    {
+        $str = $this->reduce_string($str);
+
+        switch (strtolower($str)) {
+            case 'true':
+                return true;
+
+            case 'false':
+                return false;
+
+            case 'null':
+                return null;
+
+            default:
+                $m = array();
+
+                if (is_numeric($str)) {
+                    // Lookie-loo, it's a number
+
+                    // This would work on its own, but I'm trying to be
+                    // good about returning integers where appropriate:
+                    // return (float)$str;
+
+                    // Return float or int, as appropriate
+                    return ((float)$str == (integer)$str)
+                        ? (integer)$str
+                        : (float)$str;
+
+                } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
+                    // STRINGS RETURNED IN UTF-8 FORMAT
+                    $delim = substr($str, 0, 1);
+                    $chrs = substr($str, 1, -1);
+                    $utf8 = '';
+                    $strlen_chrs = strlen($chrs);
+
+                    for ($c = 0; $c < $strlen_chrs; ++$c) {
+
+                        $substr_chrs_c_2 = substr($chrs, $c, 2);
+                        $ord_chrs_c = ord($chrs{$c});
+
+                        switch (true) {
+                            case $substr_chrs_c_2 == '\b':
+                                $utf8 .= chr(0x08);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\t':
+                                $utf8 .= chr(0x09);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\n':
+                                $utf8 .= chr(0x0A);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\f':
+                                $utf8 .= chr(0x0C);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\r':
+                                $utf8 .= chr(0x0D);
+                                ++$c;
+                                break;
+
+                            case $substr_chrs_c_2 == '\\"':
+                            case $substr_chrs_c_2 == '\\\'':
+                            case $substr_chrs_c_2 == '\\\\':
+                            case $substr_chrs_c_2 == '\\/':
+                                if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
+                                   ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
+                                    $utf8 .= $chrs{++$c};
+                                }
+                                break;
+
+                            case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
+                                // single, escaped unicode character
+                                $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
+                                       . chr(hexdec(substr($chrs, ($c + 4), 2)));
+                                $utf8 .= $this->utf162utf8($utf16);
+                                $c += 5;
+                                break;
+
+                            case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
+                                $utf8 .= $chrs{$c};
+                                break;
+
+                            case ($ord_chrs_c & 0xE0) == 0xC0:
+                                // characters U-00000080 - U-000007FF, mask 110XXXXX
+                                //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 2);
+                                ++$c;
+                                break;
+
+                            case ($ord_chrs_c & 0xF0) == 0xE0:
+                                // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 3);
+                                $c += 2;
+                                break;
+
+                            case ($ord_chrs_c & 0xF8) == 0xF0:
+                                // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 4);
+                                $c += 3;
+                                break;
+
+                            case ($ord_chrs_c & 0xFC) == 0xF8:
+                                // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 5);
+                                $c += 4;
+                                break;
+
+                            case ($ord_chrs_c & 0xFE) == 0xFC:
+                                // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 6);
+                                $c += 5;
+                                break;
+
+                        }
+
+                    }
+
+                    return $utf8;
+
+                } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
+                    // array, or object notation
+
+                    if ($str{0} == '[') {
+                        $stk = array(SERVICES_JSON_IN_ARR);
+                        $arr = array();
+                    } else {
+                        if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                            $stk = array(SERVICES_JSON_IN_OBJ);
+                            $obj = array();
+                        } else {
+                            $stk = array(SERVICES_JSON_IN_OBJ);
+                            $obj = new stdClass();
+                        }
+                    }
+
+                    array_push($stk, array('what'  => SERVICES_JSON_SLICE,
+                                           'where' => 0,
+                                           'delim' => false));
+
+                    $chrs = substr($str, 1, -1);
+                    $chrs = $this->reduce_string($chrs);
+
+                    if ($chrs == '') {
+                        if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                            return $arr;
+
+                        } else {
+                            return $obj;
+
+                        }
+                    }
+
+                    //print("\nparsing {$chrs}\n");
+
+                    $strlen_chrs = strlen($chrs);
+
+                    for ($c = 0; $c <= $strlen_chrs; ++$c) {
+
+                        $top = end($stk);
+                        $substr_chrs_c_2 = substr($chrs, $c, 2);
+
+                        if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+                            // found a comma that is not inside a string, array, etc.,
+                            // OR we've reached the end of the character list
+                            $slice = substr($chrs, $top['where'], ($c - $top['where']));
+                            array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+                            //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                            if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                                // we are in an array, so just push an element onto the stack
+                                array_push($arr, $this->decode($slice));
+
+                            } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+                                // we are in an object, so figure
+                                // out the property name and set an
+                                // element in an associative array,
+                                // for now
+                                $parts = array();
+                                
+                                if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+                                    // "name":value pair
+                                    $key = $this->decode($parts[1]);
+                                    $val = $this->decode($parts[2]);
+
+                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+                                    // name:value pair, where name is unquoted
+                                    $key = $parts[1];
+                                    $val = $this->decode($parts[2]);
+
+                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                }
+
+                            }
+
+                        } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+                            // found a quote, and we are not inside a string
+                            array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+                            //print("Found start of string at {$c}\n");
+
+                        } elseif (($chrs{$c} == $top['delim']) &&
+                                 ($top['what'] == SERVICES_JSON_IN_STR) &&
+                                 ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
+                            // found a quote, we're in a string, and it's not escaped
+                            // we know that it's not escaped becase there is _not_ an
+                            // odd number of backslashes at the end of the string so far
+                            array_pop($stk);
+                            //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
+
+                        } elseif (($chrs{$c} == '[') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a left-bracket, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
+                            //print("Found start of array at {$c}\n");
+
+                        } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+                            // found a right-bracket, and we're in an array
+                            array_pop($stk);
+                            //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        } elseif (($chrs{$c} == '{') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a left-brace, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
+                            //print("Found start of object at {$c}\n");
+
+                        } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+                            // found a right-brace, and we're in an object
+                            array_pop($stk);
+                            //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        } elseif (($substr_chrs_c_2 == '/*') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a comment start, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
+                            $c++;
+                            //print("Found start of comment at {$c}\n");
+
+                        } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
+                            // found a comment end, and we're in one now
+                            array_pop($stk);
+                            $c++;
+
+                            for ($i = $top['where']; $i <= $c; ++$i)
+                                $chrs = substr_replace($chrs, ' ', $i, 1);
+
+                            //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        }
+
+                    }
+
+                    if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                        return $arr;
+
+                    } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+                        return $obj;
+
+                    }
+
+                }
+        }
+    }
+
+    /**
+     * @todo Ultimately, this should just call PEAR::isError()
+     */
+    function isError($data, $code = null)
+    {
+        if (class_exists('pear')) {
+            return PEAR::isError($data, $code);
+        } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
+                                 is_subclass_of($data, 'services_json_error'))) {
+            return true;
+        }
+
+        return false;
+    }
+}
+
+if (class_exists('PEAR_Error')) {
+
+    class Services_JSON_Error extends PEAR_Error
+    {
+        function Services_JSON_Error($message = 'unknown error', $code = null,
+                                     $mode = null, $options = null, $userinfo = null)
+        {
+            parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+        }
+    }
+
+} else {
+
+    /**
+     * @todo Ultimately, this class shall be descended from PEAR_Error
+     */
+    class Services_JSON_Error
+    {
+        function Services_JSON_Error($message = 'unknown error', $code = null,
+                                     $mode = null, $options = null, $userinfo = null)
+        {
+
+        }
+    }
+
+}
+    
+?>
diff --git a/README.chromium b/README.chromium
new file mode 100644
index 0000000..07aec2a
--- /dev/null
+++ b/README.chromium
@@ -0,0 +1,6 @@
+This directory contains Dromaeo, a JavaScript and DOM performance benchmark.
+
+Dromaeo was developed and released by John Resig (jresig at mozilla.com)/
+
+This copy was fecthed from http://github.com/jeresig/dromaeo (at commit
+0b96e6b0f98996853e1a302b9783f83fc57c5ffa) and built with make web.
diff --git a/application.css b/application.css
new file mode 100644
index 0000000..e540dd2
--- /dev/null
+++ b/application.css
@@ -0,0 +1,115 @@
+ol.results { text-align: left; display: none; font-size: 10px; list-style: none; display: none; }
+.alldone ol.results { display: block; width: 48%; float: left; }
+ol.results li { clear: both; overflow: auto; }
+ol.results b { display: block; width: 200px; float: left; text-align: right; padding-right: 15px; }
+#info { clear:both;width:420px;margin:0 auto;text-align:left; padding: 10px; }
+div.results { width:420px;margin:0 auto;margin-bottom:20px;text-align:left; padding: 10px 10px 10px 10px; }
+#info span { font-weight: bold; padding-top: 8px; }
+h1 { text-align: left; }
+h1 img { float:left;margin-right: 15px;margin-top: -10px; border: 0; }
+h1 small { font-weight:normal; }
+iframe { display: none; }
+div.resultwrap { text-align: center; }
+table.results { font-size: 12px; margin: 0 auto; }
+table.results td, table.results th.name, table.results th { text-align: right; }
+table.results .winner { color: #000; background-color: #c7331d; }
+table.results .tie { color: #000; background-color: #f9f2a1; }
+
+body  {
+	font: normal 11px "Lucida Grande", Helvetica, Arial, sans-serif;
+	background: black url(images/bg.png) repeat-x;
+	margin: 0px auto;
+	padding: 0px; 
+	color: #eee; 
+	text-align: center;
+	line-height: 180%;
+}	
+div, img, form, ul {
+	margin: 0px; 
+	padding: 0px;
+	border: 0px; 
+}
+small			{font-size: 9px;}
+div, span, td, .text_l {text-align: left;}	
+.clear 			{clear: both;}	
+.text_r 		{text-align: right;}
+.text_c 		{text-align: center;}
+a 				{font: normal  "Arial", sans-serif; color: #f9f2a1; }
+.left 			{float: left;}
+.right 			{float: right;}
+
+#wrapper 		{width: 690px; margin: 0px auto; padding: 0px; margin-top: -7px; text-align: center;}
+#content		{margin-bottom: 30px;}
+#main			{padding-bottom: 40px;}
+
+#top			{background: url(images/top.png) repeat-x; height: 250px;}
+#logo			{position: absolute; top: 0; left: 0; width: 100%; text-align: center; z-index: 100;}
+#logo img		{ margin: 0px auto; padding: 0px;}
+.dino1			{position: absolute; top: 105px; right: 300px; z-index: 15;}
+.dino2			{position: absolute; top: 110px; left: 15%;  z-index: 12;}
+.dino3			{position: absolute; top: 120px; left: 400px;  z-index: 31;}
+.dino4			{position: absolute; top: 96px; left: 200px;  z-index: 8;}
+.dino5			{position: absolute; top: 110px; right: 85px;  z-index: 14;}
+.dino6			{position: absolute; top: 105px; left: 30%;  z-index: 14;}
+.dino7			{position: absolute; top: 110px; left: 70%;  z-index: 22;}
+.dino8			{position: absolute; top: 105px; left: 37%;  z-index: 20;}
+.coment			{position: absolute; top: 0px; right: 0px;  z-index: 2; float: right;}
+
+.clouds			{position: absolute; top: 10px; right: 11%;  z-index: 12;}
+.clouds2		{position: absolute; top: 50px; right: 29%;  z-index: 13;}
+.clouds5		{position: absolute; top: 0px; right: 15%;  z-index: 16;}
+.clouds3			{position: absolute; top: 15px; left: 10%;  z-index: 15;}
+.clouds4		{position: absolute; top: 10px; left: 15%;  z-index: 14;}
+
+.water		{position: absolute; top: 110px; right: 9%;  z-index: 13;}
+
+
+/* rendered html stuff */
+
+table.results	{text-align: center; margin: 0px auto; padding: 0px; background: none;}
+table.results td, table.results th 			{padding: 2px;}
+table.results tr.onetest td, table.results tr.onetest th 			{padding: 0px;}
+table.results tr.hidden { display: none; }
+#info			{margin-bottom: 10px;}
+table.results .winner			{background: #58bd79;}
+.name			{font-weight: bold;}
+
+div.resultwrap	{margin: 10px 0 10px 0;}
+div.results		{padding: 10px; margin-bottom: 20px; background: #c7331d;}
+
+div.result-item { position: relative; width: 48%; float: left; overflow: hidden; margin-left: 1%; margin-right: 1%; height: 100px; }
+.alldone div.result-item { width: 98%; height: auto; margin-bottom: 10px; overflow: auto; }
+.alldone div.result-item p { width: 48%; float: left; }
+
+div.result-item p { padding: 0px 4px; }
+
+div.test { overflow: hidden; margin: 4px 0; }
+div.test b { display: block; width: 100%; text-align: left; margin: 0px; background: #c7331d; padding: 4px; }
+/*div.done div.test b {background: #58bd79;}*/
+div.done div.test b {background: #222;}
+div.bar { width: 100px; border: 1px inset #666; background: #c7331d; text-align: left; position: absolute; top: 7px; right: 4px; }
+div.bar div { height: 20px; background: #222; text-align: right; }
+div.done div.bar div {background: #58bd79; color: #000;}
+div.bar span { padding-left: 5px; padding-right: 5px; }
+
+#info { margin: auto; }
+
+h1 { font-size: 28px; border-bottom: 1px solid #AAA; position: relative; padding: 0px 1% 2px 1%;}
+h1 div.bar { font-size: 10px; width: 275px; top: -2px; right: 1%; }
+h1 input { position: absolute; top: 0px; right: 300px; }
+
+h2 { font-size: 20px; border-bottom: 1px solid #AAA; position: relative; padding: 0px 1% 2px 1%;}
+h2 a { color: #FFF; }
+h2 div.bar { font-size: 10px; width: 275px; top: -2px; right: 1%; }
+h2 input { position: absolute; top: 0px; right: 300px; }
+
+ul#tests { clear:both;width:420px;margin:0 auto;text-align:left; padding: 10px; list-style: none; }
+#tests b { background: #c7331d; color: #000; display: block; padding: 4px 0 4px 4px; margin-left: -20px; margin-bottom: 5px; font-size: 1.1em; -webkit-border-radius: 4px; -moz-border-radius: 4px; font-weight: normal; }
+#tests b.recommended { background: #58bd79; }
+#tests a:first-of-type { font-size: 1.2em; }
+#tests b a { font-weight: bold; color: #000; }
+#tests li { padding-left: 10px; padding-bottom: 5px; }
+
+#overview { position: relative; }
+#overview a { font-size: 10px; top: -29px; left: 8px; position: absolute; }
+#overview table a { position: static; }
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..d444389
--- /dev/null
+++ b/favicon.ico
Binary files differ
diff --git a/favicon.png b/favicon.png
new file mode 100644
index 0000000..d772102
--- /dev/null
+++ b/favicon.png
Binary files differ
diff --git a/htmlrunner.js b/htmlrunner.js
new file mode 100644
index 0000000..1365792
--- /dev/null
+++ b/htmlrunner.js
@@ -0,0 +1,4 @@
+var startTest = top.startTest || function(){};
+var test = top.test || function(name, fn){ fn(); };
+var endTest = top.endTest || function(){};
+var prep = top.prep || function(fn){ fn(); };
diff --git a/ie.css b/ie.css
new file mode 100644
index 0000000..aca3787
--- /dev/null
+++ b/ie.css
@@ -0,0 +1,30 @@
+/* -------------------------------------------------------------- 
+   
+   ie.css
+   
+   Contains every hack for Internet Explorer versions prior 
+   to IE7, so that our core files stay sweet and nimble.
+   
+-------------------------------------------------------------- */
+
+/* Make sure the layout is centered in IE5 */
+body        { text-align: center; }
+.container  { text-align: left; }
+
+
+/* This fixes the problem where IE6 adds an extra 3px margin to
+   two columns that are floated up against each other. */
+
+* html .column { overflow-x: hidden; } /* IE6 fix */
+
+.pull-1, .pull-2, .pull-3, .pull-4,
+.push-1, .push-2, .push-3, .push-4, 
+ul, ol {
+  position: relative; /* Keeps IE6 from cutting pulled/pushed images */
+}
+
+/* Fixes incorrect styling of legend in IE6 fieldsets. */
+legend { margin-bottom:1.4em; }
+
+/* Fixes incorrect placement of numbers in ol's in IE6/7 */
+ol { margin-left:2em; }
\ No newline at end of file
diff --git a/images/bg.png b/images/bg.png
new file mode 100644
index 0000000..bd659a8
--- /dev/null
+++ b/images/bg.png
Binary files differ
diff --git a/images/clouds.png b/images/clouds.png
new file mode 100644
index 0000000..c9f7dc2
--- /dev/null
+++ b/images/clouds.png
Binary files differ
diff --git a/images/clouds2.png b/images/clouds2.png
new file mode 100644
index 0000000..ac835dc
--- /dev/null
+++ b/images/clouds2.png
Binary files differ
diff --git a/images/comets.png b/images/comets.png
new file mode 100644
index 0000000..37dd962
--- /dev/null
+++ b/images/comets.png
Binary files differ
diff --git a/images/dino1.png b/images/dino1.png
new file mode 100644
index 0000000..2dda272
--- /dev/null
+++ b/images/dino1.png
Binary files differ
diff --git a/images/dino2.png b/images/dino2.png
new file mode 100644
index 0000000..ccfa15c
--- /dev/null
+++ b/images/dino2.png
Binary files differ
diff --git a/images/dino3.png b/images/dino3.png
new file mode 100644
index 0000000..a766b28
--- /dev/null
+++ b/images/dino3.png
Binary files differ
diff --git a/images/dino4.png b/images/dino4.png
new file mode 100644
index 0000000..03301d3
--- /dev/null
+++ b/images/dino4.png
Binary files differ
diff --git a/images/dino5.png b/images/dino5.png
new file mode 100644
index 0000000..5fd028d
--- /dev/null
+++ b/images/dino5.png
Binary files differ
diff --git a/images/dino6.png b/images/dino6.png
new file mode 100644
index 0000000..ded8106
--- /dev/null
+++ b/images/dino6.png
Binary files differ
diff --git a/images/dino7.png b/images/dino7.png
new file mode 100644
index 0000000..ac2021b
--- /dev/null
+++ b/images/dino7.png
Binary files differ
diff --git a/images/dino8.png b/images/dino8.png
new file mode 100644
index 0000000..a4b1fe4
--- /dev/null
+++ b/images/dino8.png
Binary files differ
diff --git a/images/left.png b/images/left.png
new file mode 100644
index 0000000..b688f2b
--- /dev/null
+++ b/images/left.png
Binary files differ
diff --git a/images/logo.png b/images/logo.png
new file mode 100644
index 0000000..199fda7
--- /dev/null
+++ b/images/logo.png
Binary files differ
diff --git a/images/logo2.png b/images/logo2.png
new file mode 100644
index 0000000..427687f
--- /dev/null
+++ b/images/logo2.png
Binary files differ
diff --git a/images/logo3.png b/images/logo3.png
new file mode 100644
index 0000000..306c485
--- /dev/null
+++ b/images/logo3.png
Binary files differ
diff --git a/images/right.png b/images/right.png
new file mode 100644
index 0000000..154cb41
--- /dev/null
+++ b/images/right.png
Binary files differ
diff --git a/images/top.png b/images/top.png
new file mode 100644
index 0000000..24039c3
--- /dev/null
+++ b/images/top.png
Binary files differ
diff --git a/images/water.png b/images/water.png
new file mode 100644
index 0000000..40a0f0d
--- /dev/null
+++ b/images/water.png
Binary files differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..1a995d0
--- /dev/null
+++ b/index.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; utf-8" />
+  <title>Dromaeo: JavaScript Performance Testing</title>
+  <link href="reset.css" rel="stylesheet" type="text/css" />
+  <!--[if lt IE 7.]>
+  <link href="ie.css" rel="stylesheet" type="text/css" />
+  <script defer type="text/javascript" src="pngfix.js"></script>
+  <![endif]-->
+  <link href="application.css" rel="stylesheet" type="text/css" />
+  <script src="jquery.js"></script>
+  <script src="json.js"></script>
+  <script src="webrunner.js"></script>
+</head>
+<body>
+        <div id="top" >
+          <div id="logo">
+            <a href="./"><img src="images/logo3.png" class="png"/></a>
+          </div>
+          <img src="images/dino1.png" class="dino1 png"/>
+          <img src="images/left.png" class="left png"/>
+          <img src="images/dino2.png" class="dino2 png"/>
+          <img src="images/dino2.png" class="dino2 png"/>
+          <img src="images/dino3.png" class="dino3 png"/>
+          <img src="images/dino4.png" class="dino4 png"/>
+          <img src="images/dino5.png" class="dino5 png"/>
+          <img src="images/dino7.png" class="dino7 png"/>
+          <img src="images/dino8.png" class="dino8 png"/>
+          <img src="images/dino6.png" class="dino6 png"/>
+          <img src="images/clouds2.png" class="clouds2 png"/>
+          <img src="images/clouds.png" class="clouds png"/>
+          <img src="images/clouds2.png" class="clouds3 png"/>
+          <img src="images/clouds.png" class="clouds4 png"/>
+          <img src="images/clouds2.png" class="clouds5 png"/>
+          <img src="images/comets.png" class="right png"/>
+        </div>
+        <div id="wrapper">
+        <div id="main">
+<div id="info"><span>Mozilla JavaScript performance test suite.</span><br/>More information about <a href="http://wiki.mozilla.org/Dromaeo">Dromaeo</a> can be found on the Mozilla wiki.</div>
+<h1 id="overview" class="test"><span>Performance Tests</span> <input type="button" id="pause" class="pause" value="Loading..."/><div class="bar"><div id="timebar" style="width:25%;"><span class="left">Est.&nbsp;Time:&nbsp;<strong id="left">0:00</strong></span></div></div><a href="./">&laquo; View All Tests</a></h1><br style="clear:both;"/>
+<ul id="tests">
+  <li><b class="recommended"><a href="?recommended">&raquo; Run Recommended Tests</a><br/>(All tests except for those testing the CSS Selector engines.)</b></li>
+  <li><b><a href="?all">&raquo; Run All Tests</a></b><br/><br/></li>
+
+  <li><b><a href="?dromaeo|sunspider|v8">&raquo; Run All JavaScript Tests</a></b></li>
+  <li><a href="?dromaeo">Dromaeo JavaScript Tests</a><br/>(Tests Strings, RegExps, Arrays, and eval.)</li>
+  <li><a href="?sunspider">SunSpider JavaScript Tests</a><br/>(From the <a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html">WebKit team</a>. Tests Math, Bitops, Looping, and Functions.)</li>
+  <li><a href="?v8">V8 JavaScript Tests</a><br/>(From the <a href="http://code.google.com/apis/v8/benchmarks.html">V8 team</a>. Tests Functions, Strings, and Objects.)<br/><br/></li>
+
+  <li><b><a href="?dom|jslib|cssquery">&raquo; Run All DOM Tests</a></b></li>
+  <li><a href="?dom">DOM Core Tests</a><br/>(Tests DOM Querying, Traversing, Manipulation, and Atributes.)</li>
+  <li><a href="?jslib">JavaScript Library Tests</a><br/>(Tests DOM functionality in jQuery and Prototype.)</li>
+  <li><a href="?cssquery">CSS Selector Tests</a><br/>(From the <a href="http://code.google.com/p/slickspeed/">MooTools team</a>. Tests jQuery, Prototype, Dojo, MooTools, YUI, and ExtJS.)</li>
+</ul>
+</div>
+</div>
+</body>
+</html>
diff --git a/jquery.js b/jquery.js
new file mode 100644
index 0000000..2e43a82
--- /dev/null
+++ b/jquery.js
@@ -0,0 +1,3408 @@
+(function(){
+/*
+ * jQuery 1.2.3 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
+ * $Rev: 4663 $
+ */
+
+// Map over jQuery in case of overwrite
+if ( window.jQuery )
+	var _jQuery = window.jQuery;
+
+var jQuery = window.jQuery = function( selector, context ) {
+	// The jQuery object is actually just the init constructor 'enhanced'
+	return new jQuery.prototype.init( selector, context );
+};
+
+// Map over the $ in case of overwrite
+if ( window.$ )
+	var _$ = window.$;
+	
+// Map the jQuery namespace to the '$' one
+window.$ = jQuery;
+
+// A simple way to check for HTML strings or ID strings
+// (both of which we optimize for)
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
+
+// Is it a simple selector
+var isSimple = /^.[^:#\[\.]*$/;
+
+jQuery.fn = jQuery.prototype = {
+	init: function( selector, context ) {
+		// Make sure that a selection was provided
+		selector = selector || document;
+
+		// Handle $(DOMElement)
+		if ( selector.nodeType ) {
+			this[0] = selector;
+			this.length = 1;
+			return this;
+
+		// Handle HTML strings
+		} else if ( typeof selector == "string" ) {
+			// Are we dealing with HTML string or an ID?
+			var match = quickExpr.exec( selector );
+
+			// Verify a match, and that no context was specified for #id
+			if ( match && (match[1] || !context) ) {
+
+				// HANDLE: $(html) -> $(array)
+				if ( match[1] )
+					selector = jQuery.clean( [ match[1] ], context );
+
+				// HANDLE: $("#id")
+				else {
+					var elem = document.getElementById( match[3] );
+
+					// Make sure an element was located
+					if ( elem )
+						// Handle the case where IE and Opera return items
+						// by name instead of ID
+						if ( elem.id != match[3] )
+							return jQuery().find( selector );
+
+						// Otherwise, we inject the element directly into the jQuery object
+						else {
+							this[0] = elem;
+							this.length = 1;
+							return this;
+						}
+
+					else
+						selector = [];
+				}
+
+			// HANDLE: $(expr, [context])
+			// (which is just equivalent to: $(content).find(expr)
+			} else
+				return new jQuery( context ).find( selector );
+
+		// HANDLE: $(function)
+		// Shortcut for document ready
+		} else if ( jQuery.isFunction( selector ) )
+			return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+
+		return this.setArray(
+			// HANDLE: $(array)
+			selector.constructor == Array && selector ||
+
+			// HANDLE: $(arraylike)
+			// Watch for when an array-like object, contains DOM nodes, is passed in as the selector
+			(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
+
+			// HANDLE: $(*)
+			[ selector ] );
+	},
+	
+	// The current version of jQuery being used
+	jquery: "1.2.3",
+
+	// The number of elements contained in the matched element set
+	size: function() {
+		return this.length;
+	},
+	
+	// The number of elements contained in the matched element set
+	length: 0,
+
+	// Get the Nth element in the matched element set OR
+	// Get the whole matched element set as a clean array
+	get: function( num ) {
+		return num == undefined ?
+
+			// Return a 'clean' array
+			jQuery.makeArray( this ) :
+
+			// Return just the object
+			this[ num ];
+	},
+	
+	// Take an array of elements and push it onto the stack
+	// (returning the new matched element set)
+	pushStack: function( elems ) {
+		// Build a new jQuery matched element set
+		var ret = jQuery( elems );
+
+		// Add the old object onto the stack (as a reference)
+		ret.prevObject = this;
+
+		// Return the newly-formed element set
+		return ret;
+	},
+	
+	// Force the current matched set of elements to become
+	// the specified array of elements (destroying the stack in the process)
+	// You should use pushStack() in order to do this, but maintain the stack
+	setArray: function( elems ) {
+		// Resetting the length to 0, then using the native Array push
+		// is a super-fast way to populate an object with array-like properties
+		this.length = 0;
+		Array.prototype.push.apply( this, elems );
+		
+		return this;
+	},
+
+	// Execute a callback for every element in the matched set.
+	// (You can seed the arguments with an array of args, but this is
+	// only used internally.)
+	each: function( callback, args ) {
+		return jQuery.each( this, callback, args );
+	},
+
+	// Determine the position of an element within 
+	// the matched set of elements
+	index: function( elem ) {
+		var ret = -1;
+
+		// Locate the position of the desired element
+		this.each(function(i){
+			if ( this == elem )
+				ret = i;
+		});
+
+		return ret;
+	},
+
+	attr: function( name, value, type ) {
+		var options = name;
+		
+		// Look for the case where we're accessing a style value
+		if ( name.constructor == String )
+			if ( value == undefined )
+				return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined;
+
+			else {
+				options = {};
+				options[ name ] = value;
+			}
+		
+		// Check to see if we're setting style values
+		return this.each(function(i){
+			// Set all the styles
+			for ( name in options )
+				jQuery.attr(
+					type ?
+						this.style :
+						this,
+					name, jQuery.prop( this, options[ name ], type, i, name )
+				);
+		});
+	},
+
+	css: function( key, value ) {
+		// ignore negative width and height values
+		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+			value = undefined;
+		return this.attr( key, value, "curCSS" );
+	},
+
+	text: function( text ) {
+		if ( typeof text != "object" && text != null )
+			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+
+		var ret = "";
+
+		jQuery.each( text || this, function(){
+			jQuery.each( this.childNodes, function(){
+				if ( this.nodeType != 8 )
+					ret += this.nodeType != 1 ?
+						this.nodeValue :
+						jQuery.fn.text( [ this ] );
+			});
+		});
+
+		return ret;
+	},
+
+	wrapAll: function( html ) {
+		if ( this[0] )
+			// The elements to wrap the target around
+			jQuery( html, this[0].ownerDocument )
+				.clone()
+				.insertBefore( this[0] )
+				.map(function(){
+					var elem = this;
+
+					while ( elem.firstChild )
+						elem = elem.firstChild;
+
+					return elem;
+				})
+				.append(this);
+
+		return this;
+	},
+
+	wrapInner: function( html ) {
+		return this.each(function(){
+			jQuery( this ).contents().wrapAll( html );
+		});
+	},
+
+	wrap: function( html ) {
+		return this.each(function(){
+			jQuery( this ).wrapAll( html );
+		});
+	},
+
+	append: function() {
+		return this.domManip(arguments, true, false, function(elem){
+			if (this.nodeType == 1)
+				this.appendChild( elem );
+		});
+	},
+
+	prepend: function() {
+		return this.domManip(arguments, true, true, function(elem){
+			if (this.nodeType == 1)
+				this.insertBefore( elem, this.firstChild );
+		});
+	},
+	
+	before: function() {
+		return this.domManip(arguments, false, false, function(elem){
+			this.parentNode.insertBefore( elem, this );
+		});
+	},
+
+	after: function() {
+		return this.domManip(arguments, false, true, function(elem){
+			this.parentNode.insertBefore( elem, this.nextSibling );
+		});
+	},
+
+	end: function() {
+		return this.prevObject || jQuery( [] );
+	},
+
+	find: function( selector ) {
+		var elems = jQuery.map(this, function(elem){
+			return jQuery.find( selector, elem );
+		});
+
+		return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
+			jQuery.unique( elems ) :
+			elems );
+	},
+
+	clone: function( events ) {
+		// Do the clone
+		var ret = this.map(function(){
+			if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
+				// IE copies events bound via attachEvent when
+				// using cloneNode. Calling detachEvent on the
+				// clone will also remove the events from the orignal
+				// In order to get around this, we use innerHTML.
+				// Unfortunately, this means some modifications to 
+				// attributes in IE that are actually only stored 
+				// as properties will not be copied (such as the
+				// the name attribute on an input).
+				var clone = this.cloneNode(true),
+					container = document.createElement("div");
+				container.appendChild(clone);
+				return jQuery.clean([container.innerHTML])[0];
+			} else
+				return this.cloneNode(true);
+		});
+
+		// Need to set the expando to null on the cloned set if it exists
+		// removeData doesn't work here, IE removes it from the original as well
+		// this is primarily for IE but the data expando shouldn't be copied over in any browser
+		var clone = ret.find("*").andSelf().each(function(){
+			if ( this[ expando ] != undefined )
+				this[ expando ] = null;
+		});
+		
+		// Copy the events from the original to the clone
+		if ( events === true )
+			this.find("*").andSelf().each(function(i){
+				if (this.nodeType == 3)
+					return;
+				var events = jQuery.data( this, "events" );
+
+				for ( var type in events )
+					for ( var handler in events[ type ] )
+						jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
+			});
+
+		// Return the cloned set
+		return ret;
+	},
+
+	filter: function( selector ) {
+		return this.pushStack(
+			jQuery.isFunction( selector ) &&
+			jQuery.grep(this, function(elem, i){
+				return selector.call( elem, i );
+			}) ||
+
+			jQuery.multiFilter( selector, this ) );
+	},
+
+	not: function( selector ) {
+		if ( selector.constructor == String )
+			// test special case where just one selector is passed in
+			if ( isSimple.test( selector ) )
+				return this.pushStack( jQuery.multiFilter( selector, this, true ) );
+			else
+				selector = jQuery.multiFilter( selector, this );
+
+		var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
+		return this.filter(function() {
+			return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
+		});
+	},
+
+	add: function( selector ) {
+		return !selector ? this : this.pushStack( jQuery.merge( 
+			this.get(),
+			selector.constructor == String ? 
+				jQuery( selector ).get() :
+				selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ?
+					selector : [selector] ) );
+	},
+
+	is: function( selector ) {
+		return selector ?
+			jQuery.multiFilter( selector, this ).length > 0 :
+			false;
+	},
+
+	hasClass: function( selector ) {
+		return this.is( "." + selector );
+	},
+	
+	val: function( value ) {
+		if ( value == undefined ) {
+
+			if ( this.length ) {
+				var elem = this[0];
+
+				// We need to handle select boxes special
+				if ( jQuery.nodeName( elem, "select" ) ) {
+					var index = elem.selectedIndex,
+						values = [],
+						options = elem.options,
+						one = elem.type == "select-one";
+					
+					// Nothing was selected
+					if ( index < 0 )
+						return null;
+
+					// Loop through all the selected options
+					for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+						var option = options[ i ];
+
+						if ( option.selected ) {
+							// Get the specifc value for the option
+							value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
+							
+							// We don't need an array for one selects
+							if ( one )
+								return value;
+							
+							// Multi-Selects return an array
+							values.push( value );
+						}
+					}
+					
+					return values;
+					
+				// Everything else, we just grab the value
+				} else
+					return (this[0].value || "").replace(/\r/g, "");
+
+			}
+
+			return undefined;
+		}
+
+		return this.each(function(){
+			if ( this.nodeType != 1 )
+				return;
+
+			if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
+				this.checked = (jQuery.inArray(this.value, value) >= 0 ||
+					jQuery.inArray(this.name, value) >= 0);
+
+			else if ( jQuery.nodeName( this, "select" ) ) {
+				var values = value.constructor == Array ?
+					value :
+					[ value ];
+
+				jQuery( "option", this ).each(function(){
+					this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
+						jQuery.inArray( this.text, values ) >= 0);
+				});
+
+				if ( !values.length )
+					this.selectedIndex = -1;
+
+			} else
+				this.value = value;
+		});
+	},
+	
+	html: function( value ) {
+		return value == undefined ?
+			(this.length ?
+				this[0].innerHTML :
+				null) :
+			this.empty().append( value );
+	},
+
+	replaceWith: function( value ) {
+		return this.after( value ).remove();
+	},
+
+	eq: function( i ) {
+		return this.slice( i, i + 1 );
+	},
+
+	slice: function() {
+		return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
+	},
+
+	map: function( callback ) {
+		return this.pushStack( jQuery.map(this, function(elem, i){
+			return callback.call( elem, i, elem );
+		}));
+	},
+
+	andSelf: function() {
+		return this.add( this.prevObject );
+	},
+
+	data: function( key, value ){
+		var parts = key.split(".");
+		parts[1] = parts[1] ? "." + parts[1] : "";
+
+		if ( value == null ) {
+			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+			
+			if ( data == undefined && this.length )
+				data = jQuery.data( this[0], key );
+
+			return data == null && parts[1] ?
+				this.data( parts[0] ) :
+				data;
+		} else
+			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+				jQuery.data( this, key, value );
+			});
+	},
+
+	removeData: function( key ){
+		return this.each(function(){
+			jQuery.removeData( this, key );
+		});
+	},
+	
+	domManip: function( args, table, reverse, callback ) {
+		var clone = this.length > 1, elems; 
+
+		return this.each(function(){
+			if ( !elems ) {
+				elems = jQuery.clean( args, this.ownerDocument );
+
+				if ( reverse )
+					elems.reverse();
+			}
+
+			var obj = this;
+
+			if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
+				obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
+
+			var scripts = jQuery( [] );
+
+			jQuery.each(elems, function(){
+				var elem = clone ?
+					jQuery( this ).clone( true )[0] :
+					this;
+
+				// execute all scripts after the elements have been injected
+				if ( jQuery.nodeName( elem, "script" ) ) {
+					scripts = scripts.add( elem );
+				} else {
+					// Remove any inner scripts for later evaluation
+					if ( elem.nodeType == 1 )
+						scripts = scripts.add( jQuery( "script", elem ).remove() );
+
+					// Inject the elements into the document
+					callback.call( obj, elem );
+				}
+			});
+
+			scripts.each( evalScript );
+		});
+	}
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.prototype.init.prototype = jQuery.prototype;
+
+function evalScript( i, elem ) {
+	if ( elem.src )
+		jQuery.ajax({
+			url: elem.src,
+			async: false,
+			dataType: "script"
+		});
+
+	else
+		jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+	if ( elem.parentNode )
+		elem.parentNode.removeChild( elem );
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+	// copy reference to target object
+	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+	// Handle a deep copy situation
+	if ( target.constructor == Boolean ) {
+		deep = target;
+		target = arguments[1] || {};
+		// skip the boolean and the target
+		i = 2;
+	}
+
+	// Handle case when target is a string or something (possible in deep copy)
+	if ( typeof target != "object" && typeof target != "function" )
+		target = {};
+
+	// extend jQuery itself if only one argument is passed
+	if ( length == 1 ) {
+		target = this;
+		i = 0;
+	}
+
+	for ( ; i < length; i++ )
+		// Only deal with non-null/undefined values
+		if ( (options = arguments[ i ]) != null )
+			// Extend the base object
+			for ( var name in options ) {
+				// Prevent never-ending loop
+				if ( target === options[ name ] )
+					continue;
+
+				// Recurse if we're merging object values
+				if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType )
+					target[ name ] = jQuery.extend( target[ name ], options[ name ] );
+
+				// Don't bring in undefined values
+				else if ( options[ name ] != undefined )
+					target[ name ] = options[ name ];
+
+			}
+
+	// Return the modified object
+	return target;
+};
+
+var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {};
+
+// exclude the following css properties to add px
+var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
+
+jQuery.extend({
+	noConflict: function( deep ) {
+		window.$ = _$;
+
+		if ( deep )
+			window.jQuery = _jQuery;
+
+		return jQuery;
+	},
+
+	// See test/unit/core.js for details concerning this function.
+	isFunction: function( fn ) {
+		return !!fn && typeof fn != "string" && !fn.nodeName && 
+			fn.constructor != Array && /function/i.test( fn + "" );
+	},
+	
+	// check if an element is in a (or is an) XML document
+	isXMLDoc: function( elem ) {
+		return elem.documentElement && !elem.body ||
+			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+	},
+
+	// Evalulates a script in a global context
+	globalEval: function( data ) {
+		data = jQuery.trim( data );
+
+		if ( data ) {
+			// Inspired by code by Andrea Giammarchi
+			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+			var head = document.getElementsByTagName("head")[0] || document.documentElement,
+				script = document.createElement("script");
+
+			script.type = "text/javascript";
+			if ( jQuery.browser.msie )
+				script.text = data;
+			else
+				script.appendChild( document.createTextNode( data ) );
+
+			head.appendChild( script );
+			head.removeChild( script );
+		}
+	},
+
+	nodeName: function( elem, name ) {
+		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+	},
+	
+	cache: {},
+	
+	data: function( elem, name, data ) {
+		elem = elem == window ?
+			windowData :
+			elem;
+
+		var id = elem[ expando ];
+
+		// Compute a unique ID for the element
+		if ( !id ) 
+			id = elem[ expando ] = ++uuid;
+
+		// Only generate the data cache if we're
+		// trying to access or manipulate it
+		if ( name && !jQuery.cache[ id ] )
+			jQuery.cache[ id ] = {};
+		
+		// Prevent overriding the named cache with undefined values
+		if ( data != undefined )
+			jQuery.cache[ id ][ name ] = data;
+		
+		// Return the named cache data, or the ID for the element	
+		return name ?
+			jQuery.cache[ id ][ name ] :
+			id;
+	},
+	
+	removeData: function( elem, name ) {
+		elem = elem == window ?
+			windowData :
+			elem;
+
+		var id = elem[ expando ];
+
+		// If we want to remove a specific section of the element's data
+		if ( name ) {
+			if ( jQuery.cache[ id ] ) {
+				// Remove the section of cache data
+				delete jQuery.cache[ id ][ name ];
+
+				// If we've removed all the data, remove the element's cache
+				name = "";
+
+				for ( name in jQuery.cache[ id ] )
+					break;
+
+				if ( !name )
+					jQuery.removeData( elem );
+			}
+
+		// Otherwise, we want to remove all of the element's data
+		} else {
+			// Clean up the element expando
+			try {
+				delete elem[ expando ];
+			} catch(e){
+				// IE has trouble directly removing the expando
+				// but it's ok with using removeAttribute
+				if ( elem.removeAttribute )
+					elem.removeAttribute( expando );
+			}
+
+			// Completely remove the data cache
+			delete jQuery.cache[ id ];
+		}
+	},
+
+	// args is for internal usage only
+	each: function( object, callback, args ) {
+		if ( args ) {
+			if ( object.length == undefined ) {
+				for ( var name in object )
+					if ( callback.apply( object[ name ], args ) === false )
+						break;
+			} else
+				for ( var i = 0, length = object.length; i < length; i++ )
+					if ( callback.apply( object[ i ], args ) === false )
+						break;
+
+		// A special, fast, case for the most common use of each
+		} else {
+			if ( object.length == undefined ) {
+				for ( var name in object )
+					if ( callback.call( object[ name ], name, object[ name ] ) === false )
+						break;
+			} else
+				for ( var i = 0, length = object.length, value = object[0]; 
+					i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+		}
+
+		return object;
+	},
+	
+	prop: function( elem, value, type, i, name ) {
+			// Handle executable functions
+			if ( jQuery.isFunction( value ) )
+				value = value.call( elem, i );
+				
+			// Handle passing in a number to a CSS property
+			return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
+				value + "px" :
+				value;
+	},
+
+	className: {
+		// internal only, use addClass("class")
+		add: function( elem, classNames ) {
+			jQuery.each((classNames || "").split(/\s+/), function(i, className){
+				if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
+					elem.className += (elem.className ? " " : "") + className;
+			});
+		},
+
+		// internal only, use removeClass("class")
+		remove: function( elem, classNames ) {
+			if (elem.nodeType == 1)
+				elem.className = classNames != undefined ?
+					jQuery.grep(elem.className.split(/\s+/), function(className){
+						return !jQuery.className.has( classNames, className );	
+					}).join(" ") :
+					"";
+		},
+
+		// internal only, use is(".class")
+		has: function( elem, className ) {
+			return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+		}
+	},
+
+	// A method for quickly swapping in/out CSS properties to get correct calculations
+	swap: function( elem, options, callback ) {
+		var old = {};
+		// Remember the old values, and insert the new ones
+		for ( var name in options ) {
+			old[ name ] = elem.style[ name ];
+			elem.style[ name ] = options[ name ];
+		}
+
+		callback.call( elem );
+
+		// Revert the old values
+		for ( var name in options )
+			elem.style[ name ] = old[ name ];
+	},
+
+	css: function( elem, name, force ) {
+		if ( name == "width" || name == "height" ) {
+			var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+		
+			function getWH() {
+				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+				var padding = 0, border = 0;
+				jQuery.each( which, function() {
+					padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+					border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+				});
+				val -= Math.round(padding + border);
+			}
+		
+			if ( jQuery(elem).is(":visible") )
+				getWH();
+			else
+				jQuery.swap( elem, props, getWH );
+			
+			return Math.max(0, val);
+		}
+		
+		return jQuery.curCSS( elem, name, force );
+	},
+
+	curCSS: function( elem, name, force ) {
+		var ret;
+
+		// A helper method for determining if an element's values are broken
+		function color( elem ) {
+			if ( !jQuery.browser.safari )
+				return false;
+
+			var ret = document.defaultView.getComputedStyle( elem, null );
+			return !ret || ret.getPropertyValue("color") == "";
+		}
+
+		// We need to handle opacity special in IE
+		if ( name == "opacity" && jQuery.browser.msie ) {
+			ret = jQuery.attr( elem.style, "opacity" );
+
+			return ret == "" ?
+				"1" :
+				ret;
+		}
+		// Opera sometimes will give the wrong display answer, this fixes it, see #2037
+		if ( jQuery.browser.opera && name == "display" ) {
+			var save = elem.style.outline;
+			elem.style.outline = "0 solid black";
+			elem.style.outline = save;
+		}
+		
+		// Make sure we're using the right name for getting the float value
+		if ( name.match( /float/i ) )
+			name = styleFloat;
+
+		if ( !force && elem.style && elem.style[ name ] )
+			ret = elem.style[ name ];
+
+		else if ( document.defaultView && document.defaultView.getComputedStyle ) {
+
+			// Only "float" is needed here
+			if ( name.match( /float/i ) )
+				name = "float";
+
+			name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+
+			var getComputedStyle = document.defaultView.getComputedStyle( elem, null );
+
+			if ( getComputedStyle && !color( elem ) )
+				ret = getComputedStyle.getPropertyValue( name );
+
+			// If the element isn't reporting its values properly in Safari
+			// then some display: none elements are involved
+			else {
+				var swap = [], stack = [];
+
+				// Locate all of the parent display: none elements
+				for ( var a = elem; a && color(a); a = a.parentNode )
+					stack.unshift(a);
+
+				// Go through and make them visible, but in reverse
+				// (It would be better if we knew the exact display type that they had)
+				for ( var i = 0; i < stack.length; i++ )
+					if ( color( stack[ i ] ) ) {
+						swap[ i ] = stack[ i ].style.display;
+						stack[ i ].style.display = "block";
+					}
+
+				// Since we flip the display style, we have to handle that
+				// one special, otherwise get the value
+				ret = name == "display" && swap[ stack.length - 1 ] != null ?
+					"none" :
+					( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || "";
+
+				// Finally, revert the display styles back
+				for ( var i = 0; i < swap.length; i++ )
+					if ( swap[ i ] != null )
+						stack[ i ].style.display = swap[ i ];
+			}
+
+			// We should always get a number back from opacity
+			if ( name == "opacity" && ret == "" )
+				ret = "1";
+
+		} else if ( elem.currentStyle ) {
+			var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+				return letter.toUpperCase();
+			});
+
+			ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+			// From the awesome hack by Dean Edwards
+			// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+			// If we're not dealing with a regular pixel number
+			// but a number that has a weird ending, we need to convert it to pixels
+			if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
+				// Remember the original values
+				var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left;
+
+				// Put in the new values to get a computed value out
+				elem.runtimeStyle.left = elem.currentStyle.left;
+				elem.style.left = ret || 0;
+				ret = elem.style.pixelLeft + "px";
+
+				// Revert the changed values
+				elem.style.left = style;
+				elem.runtimeStyle.left = runtimeStyle;
+			}
+		}
+
+		return ret;
+	},
+	
+	clean: function( elems, context ) {
+		var ret = [];
+		context = context || document;
+		// !context.createElement fails in IE with an error but returns typeof 'object'
+		if (typeof context.createElement == 'undefined') 
+			context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+
+		jQuery.each(elems, function(i, elem){
+			if ( !elem )
+				return;
+
+			if ( elem.constructor == Number )
+				elem = elem.toString();
+			
+			// Convert html string into DOM nodes
+			if ( typeof elem == "string" ) {
+				// Fix "XHTML"-style tags in all browsers
+				elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
+					return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
+						all :
+						front + "></" + tag + ">";
+				});
+
+				// Trim whitespace, otherwise indexOf won't work as expected
+				var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
+
+				var wrap =
+					// option or optgroup
+					!tags.indexOf("<opt") &&
+					[ 1, "<select multiple='multiple'>", "</select>" ] ||
+					
+					!tags.indexOf("<leg") &&
+					[ 1, "<fieldset>", "</fieldset>" ] ||
+					
+					tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+					[ 1, "<table>", "</table>" ] ||
+					
+					!tags.indexOf("<tr") &&
+					[ 2, "<table><tbody>", "</tbody></table>" ] ||
+					
+				 	// <thead> matched above
+					(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
+					[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+					
+					!tags.indexOf("<col") &&
+					[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+
+					// IE can't serialize <link> and <script> tags normally
+					jQuery.browser.msie &&
+					[ 1, "div<div>", "</div>" ] ||
+					
+					[ 0, "", "" ];
+
+				// Go to html and back, then peel off extra wrappers
+				div.innerHTML = wrap[1] + elem + wrap[2];
+				
+				// Move to the right depth
+				while ( wrap[0]-- )
+					div = div.lastChild;
+				
+				// Remove IE's autoinserted <tbody> from table fragments
+				if ( jQuery.browser.msie ) {
+					
+					// String was a <table>, *may* have spurious <tbody>
+					var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
+						div.firstChild && div.firstChild.childNodes :
+						
+						// String was a bare <thead> or <tfoot>
+						wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
+							div.childNodes :
+							[];
+				
+					for ( var j = tbody.length - 1; j >= 0 ; --j )
+						if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
+							tbody[ j ].parentNode.removeChild( tbody[ j ] );
+					
+					// IE completely kills leading whitespace when innerHTML is used	
+					if ( /^\s/.test( elem ) )	
+						div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+				
+				}
+				
+				elem = jQuery.makeArray( div.childNodes );
+			}
+
+			if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
+				return;
+
+			if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
+				ret.push( elem );
+
+			else
+				ret = jQuery.merge( ret, elem );
+
+		});
+
+		return ret;
+	},
+	
+	attr: function( elem, name, value ) {
+		// don't set attributes on text and comment nodes
+		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+			return undefined;
+
+		var fix = jQuery.isXMLDoc( elem ) ?
+			{} :
+			jQuery.props;
+
+		// Safari mis-reports the default selected property of a hidden option
+		// Accessing the parent's selectedIndex property fixes it
+		if ( name == "selected" && jQuery.browser.safari )
+			elem.parentNode.selectedIndex;
+		
+		// Certain attributes only work when accessed via the old DOM 0 way
+		if ( fix[ name ] ) {
+			if ( value != undefined )
+				elem[ fix[ name ] ] = value;
+
+			return elem[ fix[ name ] ];
+
+		} else if ( jQuery.browser.msie && name == "style" )
+			return jQuery.attr( elem.style, "cssText", value );
+
+		else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName( elem, "form" ) && (name == "action" || name == "method") )
+			return elem.getAttributeNode( name ).nodeValue;
+
+		// IE elem.getAttribute passes even for style
+		else if ( elem.tagName ) {
+
+			if ( value != undefined ) {
+				// We can't allow the type property to be changed (since it causes problems in IE)
+				if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+					throw "type property can't be changed";
+
+				// convert the value to a string (all browsers do this but IE) see #1070
+				elem.setAttribute( name, "" + value );
+			}
+
+			if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) ) 
+				return elem.getAttribute( name, 2 );
+
+			return elem.getAttribute( name );
+
+		// elem is actually elem.style ... set the style
+		} else {
+			// IE actually uses filters for opacity
+			if ( name == "opacity" && jQuery.browser.msie ) {
+				if ( value != undefined ) {
+					// IE has trouble with opacity if it does not have layout
+					// Force it by setting the zoom level
+					elem.zoom = 1; 
+	
+					// Set the alpha filter to set the opacity
+					elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
+						(parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+				}
+	
+				return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
+					(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() :
+					"";
+			}
+
+			name = name.replace(/-([a-z])/ig, function(all, letter){
+				return letter.toUpperCase();
+			});
+
+			if ( value != undefined )
+				elem[ name ] = value;
+
+			return elem[ name ];
+		}
+	},
+	
+	trim: function( text ) {
+		return (text || "").replace( /^\s+|\s+$/g, "" );
+	},
+
+	makeArray: function( array ) {
+		var ret = [];
+
+		// Need to use typeof to fight Safari childNodes crashes
+		if ( typeof array != "array" )
+			for ( var i = 0, length = array.length; i < length; i++ )
+				ret.push( array[ i ] );
+		else
+			ret = array.slice( 0 );
+
+		return ret;
+	},
+
+	inArray: function( elem, array ) {
+		for ( var i = 0, length = array.length; i < length; i++ )
+			if ( array[ i ] == elem )
+				return i;
+
+		return -1;
+	},
+
+	merge: function( first, second ) {
+		// We have to loop this way because IE & Opera overwrite the length
+		// expando of getElementsByTagName
+
+		// Also, we need to make sure that the correct elements are being returned
+		// (IE returns comment nodes in a '*' query)
+		if ( jQuery.browser.msie ) {
+			for ( var i = 0; second[ i ]; i++ )
+				if ( second[ i ].nodeType != 8 )
+					first.push( second[ i ] );
+
+		} else
+			for ( var i = 0; second[ i ]; i++ )
+				first.push( second[ i ] );
+
+		return first;
+	},
+
+	unique: function( array ) {
+		var ret = [], done = {};
+
+		try {
+
+			for ( var i = 0, length = array.length; i < length; i++ ) {
+				var id = jQuery.data( array[ i ] );
+
+				if ( !done[ id ] ) {
+					done[ id ] = true;
+					ret.push( array[ i ] );
+				}
+			}
+
+		} catch( e ) {
+			ret = array;
+		}
+
+		return ret;
+	},
+
+	grep: function( elems, callback, inv ) {
+		var ret = [];
+
+		// Go through the array, only saving the items
+		// that pass the validator function
+		for ( var i = 0, length = elems.length; i < length; i++ )
+			if ( !inv && callback( elems[ i ], i ) || inv && !callback( elems[ i ], i ) )
+				ret.push( elems[ i ] );
+
+		return ret;
+	},
+
+	map: function( elems, callback ) {
+		var ret = [];
+
+		// Go through the array, translating each of the items to their
+		// new value (or values).
+		for ( var i = 0, length = elems.length; i < length; i++ ) {
+			var value = callback( elems[ i ], i );
+
+			if ( value !== null && value != undefined ) {
+				if ( value.constructor != Array )
+					value = [ value ];
+
+				ret = ret.concat( value );
+			}
+		}
+
+		return ret;
+	}
+});
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
+	safari: /webkit/.test( userAgent ),
+	opera: /opera/.test( userAgent ),
+	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
+	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
+};
+
+var styleFloat = jQuery.browser.msie ?
+	"styleFloat" :
+	"cssFloat";
+	
+jQuery.extend({
+	// Check to see if the W3C box model is being used
+	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
+	
+	props: {
+		"for": "htmlFor",
+		"class": "className",
+		"float": styleFloat,
+		cssFloat: styleFloat,
+		styleFloat: styleFloat,
+		innerHTML: "innerHTML",
+		className: "className",
+		value: "value",
+		disabled: "disabled",
+		checked: "checked",
+		readonly: "readOnly",
+		selected: "selected",
+		maxlength: "maxLength",
+		selectedIndex: "selectedIndex",
+		defaultValue: "defaultValue",
+		tagName: "tagName",
+		nodeName: "nodeName"
+	}
+});
+
+jQuery.each({
+	parent: function(elem){return elem.parentNode;},
+	parents: function(elem){return jQuery.dir(elem,"parentNode");},
+	next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
+	prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
+	nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
+	prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
+	siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
+	children: function(elem){return jQuery.sibling(elem.firstChild);},
+	contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
+}, function(name, fn){
+	jQuery.fn[ name ] = function( selector ) {
+		var ret = jQuery.map( this, fn );
+
+		if ( selector && typeof selector == "string" )
+			ret = jQuery.multiFilter( selector, ret );
+
+		return this.pushStack( jQuery.unique( ret ) );
+	};
+});
+
+jQuery.each({
+	appendTo: "append",
+	prependTo: "prepend",
+	insertBefore: "before",
+	insertAfter: "after",
+	replaceAll: "replaceWith"
+}, function(name, original){
+	jQuery.fn[ name ] = function() {
+		var args = arguments;
+
+		return this.each(function(){
+			for ( var i = 0, length = args.length; i < length; i++ )
+				jQuery( args[ i ] )[ original ]( this );
+		});
+	};
+});
+
+jQuery.each({
+	removeAttr: function( name ) {
+		jQuery.attr( this, name, "" );
+		if (this.nodeType == 1) 
+			this.removeAttribute( name );
+	},
+
+	addClass: function( classNames ) {
+		jQuery.className.add( this, classNames );
+	},
+
+	removeClass: function( classNames ) {
+		jQuery.className.remove( this, classNames );
+	},
+
+	toggleClass: function( classNames ) {
+		jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
+	},
+
+	remove: function( selector ) {
+		if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
+			// Prevent memory leaks
+			jQuery( "*", this ).add(this).each(function(){
+				jQuery.event.remove(this);
+				jQuery.removeData(this);
+			});
+			if (this.parentNode)
+				this.parentNode.removeChild( this );
+		}
+	},
+
+	empty: function() {
+		// Remove element nodes and prevent memory leaks
+		jQuery( ">*", this ).remove();
+		
+		// Remove any remaining nodes
+		while ( this.firstChild )
+			this.removeChild( this.firstChild );
+	}
+}, function(name, fn){
+	jQuery.fn[ name ] = function(){
+		return this.each( fn, arguments );
+	};
+});
+
+jQuery.each([ "Height", "Width" ], function(i, name){
+	var type = name.toLowerCase();
+	
+	jQuery.fn[ type ] = function( size ) {
+		// Get window width or height
+		return this[0] == window ?
+			// Opera reports document.body.client[Width/Height] properly in both quirks and standards
+			jQuery.browser.opera && document.body[ "client" + name ] || 
+			
+			// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
+			jQuery.browser.safari && window[ "inner" + name ] ||
+			
+			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+			document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
+		
+			// Get document width or height
+			this[0] == document ?
+				// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+				Math.max( 
+					Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), 
+					Math.max(document.body["offset" + name], document.documentElement["offset" + name]) 
+				) :
+
+				// Get or set width or height on the element
+				size == undefined ?
+					// Get width or height on the element
+					(this.length ? jQuery.css( this[0], type ) : null) :
+
+					// Set the width or height on the element (default to pixels if value is unitless)
+					this.css( type, size.constructor == String ? size : size + "px" );
+	};
+});
+
+var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
+		"(?:[\\w*_-]|\\\\.)" :
+		"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
+	quickChild = new RegExp("^>\\s*(" + chars + "+)"),
+	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
+	quickClass = new RegExp("^([#.]?)(" + chars + "*)");
+
+jQuery.extend({
+	expr: {
+		"": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
+		"#": function(a,i,m){return a.getAttribute("id")==m[2];},
+		":": {
+			// Position Checks
+			lt: function(a,i,m){return i<m[3]-0;},
+			gt: function(a,i,m){return i>m[3]-0;},
+			nth: function(a,i,m){return m[3]-0==i;},
+			eq: function(a,i,m){return m[3]-0==i;},
+			first: function(a,i){return i==0;},
+			last: function(a,i,m,r){return i==r.length-1;},
+			even: function(a,i){return i%2==0;},
+			odd: function(a,i){return i%2;},
+
+			// Child Checks
+			"first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
+			"last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
+			"only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
+
+			// Parent Checks
+			parent: function(a){return a.firstChild;},
+			empty: function(a){return !a.firstChild;},
+
+			// Text Check
+			contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
+
+			// Visibility
+			visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
+			hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
+
+			// Form attributes
+			enabled: function(a){return !a.disabled;},
+			disabled: function(a){return a.disabled;},
+			checked: function(a){return a.checked;},
+			selected: function(a){return a.selected||jQuery.attr(a,"selected");},
+
+			// Form elements
+			text: function(a){return "text"==a.type;},
+			radio: function(a){return "radio"==a.type;},
+			checkbox: function(a){return "checkbox"==a.type;},
+			file: function(a){return "file"==a.type;},
+			password: function(a){return "password"==a.type;},
+			submit: function(a){return "submit"==a.type;},
+			image: function(a){return "image"==a.type;},
+			reset: function(a){return "reset"==a.type;},
+			button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
+			input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
+
+			// :has()
+			has: function(a,i,m){return jQuery.find(m[3],a).length;},
+
+			// :header
+			header: function(a){return /h\d/i.test(a.nodeName);},
+
+			// :animated
+			animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
+		}
+	},
+	
+	// The regular expressions that power the parsing engine
+	parse: [
+		// Match: [@value='test'], [@foo]
+		/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
+
+		// Match: :contains('foo')
+		/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
+
+		// Match: :even, :last-chlid, #id, .class
+		new RegExp("^([:.#]*)(" + chars + "+)")
+	],
+
+	multiFilter: function( expr, elems, not ) {
+		var old, cur = [];
+
+		while ( expr && expr != old ) {
+			old = expr;
+			var f = jQuery.filter( expr, elems, not );
+			expr = f.t.replace(/^\s*,\s*/, "" );
+			cur = not ? elems = f.r : jQuery.merge( cur, f.r );
+		}
+
+		return cur;
+	},
+
+	find: function( t, context ) {
+		// Quickly handle non-string expressions
+		if ( typeof t != "string" )
+			return [ t ];
+
+		// check to make sure context is a DOM element or a document
+		if ( context && context.nodeType != 1 && context.nodeType != 9)
+			return [ ];
+
+		// Set the correct context (if none is provided)
+		context = context || document;
+
+		// Initialize the search
+		var ret = [context], done = [], last, nodeName;
+
+		// Continue while a selector expression exists, and while
+		// we're no longer looping upon ourselves
+		while ( t && last != t ) {
+			var r = [];
+			last = t;
+
+			t = jQuery.trim(t);
+
+			var foundToken = false;
+
+			// An attempt at speeding up child selectors that
+			// point to a specific element tag
+			var re = quickChild;
+			var m = re.exec(t);
+
+			if ( m ) {
+				nodeName = m[1].toUpperCase();
+
+				// Perform our own iteration and filter
+				for ( var i = 0; ret[i]; i++ )
+					for ( var c = ret[i].firstChild; c; c = c.nextSibling )
+						if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
+							r.push( c );
+
+				ret = r;
+				t = t.replace( re, "" );
+				if ( t.indexOf(" ") == 0 ) continue;
+				foundToken = true;
+			} else {
+				re = /^([>+~])\s*(\w*)/i;
+
+				if ( (m = re.exec(t)) != null ) {
+					r = [];
+
+					var merge = {};
+					nodeName = m[2].toUpperCase();
+					m = m[1];
+
+					for ( var j = 0, rl = ret.length; j < rl; j++ ) {
+						var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
+						for ( ; n; n = n.nextSibling )
+							if ( n.nodeType == 1 ) {
+								var id = jQuery.data(n);
+
+								if ( m == "~" && merge[id] ) break;
+								
+								if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
+									if ( m == "~" ) merge[id] = true;
+									r.push( n );
+								}
+								
+								if ( m == "+" ) break;
+							}
+					}
+
+					ret = r;
+
+					// And remove the token
+					t = jQuery.trim( t.replace( re, "" ) );
+					foundToken = true;
+				}
+			}
+
+			// See if there's still an expression, and that we haven't already
+			// matched a token
+			if ( t && !foundToken ) {
+				// Handle multiple expressions
+				if ( !t.indexOf(",") ) {
+					// Clean the result set
+					if ( context == ret[0] ) ret.shift();
+
+					// Merge the result sets
+					done = jQuery.merge( done, ret );
+
+					// Reset the context
+					r = ret = [context];
+
+					// Touch up the selector string
+					t = " " + t.substr(1,t.length);
+
+				} else {
+					// Optimize for the case nodeName#idName
+					var re2 = quickID;
+					var m = re2.exec(t);
+					
+					// Re-organize the results, so that they're consistent
+					if ( m ) {
+						m = [ 0, m[2], m[3], m[1] ];
+
+					} else {
+						// Otherwise, do a traditional filter check for
+						// ID, class, and element selectors
+						re2 = quickClass;
+						m = re2.exec(t);
+					}
+
+					m[2] = m[2].replace(/\\/g, "");
+
+					var elem = ret[ret.length-1];
+
+					// Try to do a global search by ID, where we can
+					if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
+						// Optimization for HTML document case
+						var oid = elem.getElementById(m[2]);
+						
+						// Do a quick check for the existence of the actual ID attribute
+						// to avoid selecting by the name attribute in IE
+						// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
+						if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
+							oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
+
+						// Do a quick check for node name (where applicable) so
+						// that div#foo searches will be really fast
+						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
+					} else {
+						// We need to find all descendant elements
+						for ( var i = 0; ret[i]; i++ ) {
+							// Grab the tag name being searched for
+							var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
+
+							// Handle IE7 being really dumb about <object>s
+							if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
+								tag = "param";
+
+							r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+						}
+
+						// It's faster to filter by class and be done with it
+						if ( m[1] == "." )
+							r = jQuery.classFilter( r, m[2] );
+
+						// Same with ID filtering
+						if ( m[1] == "#" ) {
+							var tmp = [];
+
+							// Try to find the element with the ID
+							for ( var i = 0; r[i]; i++ )
+								if ( r[i].getAttribute("id") == m[2] ) {
+									tmp = [ r[i] ];
+									break;
+								}
+
+							r = tmp;
+						}
+
+						ret = r;
+					}
+
+					t = t.replace( re2, "" );
+				}
+
+			}
+
+			// If a selector string still exists
+			if ( t ) {
+				// Attempt to filter it
+				var val = jQuery.filter(t,r);
+				ret = r = val.r;
+				t = jQuery.trim(val.t);
+			}
+		}
+
+		// An error occurred with the selector;
+		// just return an empty set instead
+		if ( t )
+			ret = [];
+
+		// Remove the root context
+		if ( ret && context == ret[0] )
+			ret.shift();
+
+		// And combine the results
+		done = jQuery.merge( done, ret );
+
+		return done;
+	},
+
+	classFilter: function(r,m,not){
+		m = " " + m + " ";
+		var tmp = [];
+		for ( var i = 0; r[i]; i++ ) {
+			var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
+			if ( !not && pass || not && !pass )
+				tmp.push( r[i] );
+		}
+		return tmp;
+	},
+
+	filter: function(t,r,not) {
+		var last;
+
+		// Look for common filter expressions
+		while ( t && t != last ) {
+			last = t;
+
+			var p = jQuery.parse, m;
+
+			for ( var i = 0; p[i]; i++ ) {
+				m = p[i].exec( t );
+
+				if ( m ) {
+					// Remove what we just matched
+					t = t.substring( m[0].length );
+
+					m[2] = m[2].replace(/\\/g, "");
+					break;
+				}
+			}
+
+			if ( !m )
+				break;
+
+			// :not() is a special case that can be optimized by
+			// keeping it out of the expression list
+			if ( m[1] == ":" && m[2] == "not" )
+				// optimize if only one selector found (most common case)
+				r = isSimple.test( m[3] ) ?
+					jQuery.filter(m[3], r, true).r :
+					jQuery( r ).not( m[3] );
+
+			// We can get a big speed boost by filtering by class here
+			else if ( m[1] == "." )
+				r = jQuery.classFilter(r, m[2], not);
+
+			else if ( m[1] == "[" ) {
+				var tmp = [], type = m[3];
+				
+				for ( var i = 0, rl = r.length; i < rl; i++ ) {
+					var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
+					
+					if ( z == null || /href|src|selected/.test(m[2]) )
+						z = jQuery.attr(a,m[2]) || '';
+
+					if ( (type == "" && !!z ||
+						 type == "=" && z == m[5] ||
+						 type == "!=" && z != m[5] ||
+						 type == "^=" && z && !z.indexOf(m[5]) ||
+						 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
+						 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
+							tmp.push( a );
+				}
+				
+				r = tmp;
+
+			// We can get a speed boost by handling nth-child here
+			} else if ( m[1] == ":" && m[2] == "nth-child" ) {
+				var merge = {}, tmp = [],
+					// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+					test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+						m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
+						!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
+					// calculate the numbers (first)n+(last) including if they are negative
+					first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
+ 
+				// loop through all the elements left in the jQuery object
+				for ( var i = 0, rl = r.length; i < rl; i++ ) {
+					var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
+
+					if ( !merge[id] ) {
+						var c = 1;
+
+						for ( var n = parentNode.firstChild; n; n = n.nextSibling )
+							if ( n.nodeType == 1 )
+								n.nodeIndex = c++;
+
+						merge[id] = true;
+					}
+
+					var add = false;
+
+					if ( first == 0 ) {
+						if ( node.nodeIndex == last )
+							add = true;
+					} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
+						add = true;
+
+					if ( add ^ not )
+						tmp.push( node );
+				}
+
+				r = tmp;
+
+			// Otherwise, find the expression to execute
+			} else {
+				var fn = jQuery.expr[ m[1] ];
+				if ( typeof fn == "object" )
+					fn = fn[ m[2] ];
+
+				if ( typeof fn == "string" )
+					fn = eval("false||function(a,i){return " + fn + ";}");
+
+				// Execute it against the current filter
+				r = jQuery.grep( r, function(elem, i){
+					return fn(elem, i, m, r);
+				}, not );
+			}
+		}
+
+		// Return an array of filtered elements (r)
+		// and the modified expression string (t)
+		return { r: r, t: t };
+	},
+
+	dir: function( elem, dir ){
+		var matched = [];
+		var cur = elem[dir];
+		while ( cur && cur != document ) {
+			if ( cur.nodeType == 1 )
+				matched.push( cur );
+			cur = cur[dir];
+		}
+		return matched;
+	},
+	
+	nth: function(cur,result,dir,elem){
+		result = result || 1;
+		var num = 0;
+
+		for ( ; cur; cur = cur[dir] )
+			if ( cur.nodeType == 1 && ++num == result )
+				break;
+
+		return cur;
+	},
+	
+	sibling: function( n, elem ) {
+		var r = [];
+
+		for ( ; n; n = n.nextSibling ) {
+			if ( n.nodeType == 1 && (!elem || n != elem) )
+				r.push( n );
+		}
+
+		return r;
+	}
+});
+
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code orignated from 
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+	// Bind an event to an element
+	// Original by Dean Edwards
+	add: function(elem, types, handler, data) {
+		if ( elem.nodeType == 3 || elem.nodeType == 8 )
+			return;
+
+		// For whatever reason, IE has trouble passing the window object
+		// around, causing it to be cloned in the process
+		if ( jQuery.browser.msie && elem.setInterval != undefined )
+			elem = window;
+
+		// Make sure that the function being executed has a unique ID
+		if ( !handler.guid )
+			handler.guid = this.guid++;
+			
+		// if data is passed, bind to handler 
+		if( data != undefined ) { 
+			// Create temporary function pointer to original handler 
+			var fn = handler; 
+
+			// Create unique handler function, wrapped around original handler 
+			handler = function() { 
+				// Pass arguments and context to original handler 
+				return fn.apply(this, arguments); 
+			};
+
+			// Store data in unique handler 
+			handler.data = data;
+
+			// Set the guid of unique handler to the same of original handler, so it can be removed 
+			handler.guid = fn.guid;
+		}
+
+		// Init the element's event structure
+		var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
+			handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
+				// returned undefined or false
+				var val;
+
+				// Handle the second event of a trigger and when
+				// an event is called after a page has unloaded
+				if ( typeof jQuery == "undefined" || jQuery.event.triggered )
+					return val;
+		
+				val = jQuery.event.handle.apply(arguments.callee.elem, arguments);
+		
+				return val;
+			});
+		// Add elem as a property of the handle function
+		// This is to prevent a memory leak with non-native
+		// event in IE.
+		handle.elem = elem;
+			
+			// Handle multiple events seperated by a space
+			// jQuery(...).bind("mouseover mouseout", fn);
+			jQuery.each(types.split(/\s+/), function(index, type) {
+				// Namespaced event handlers
+				var parts = type.split(".");
+				type = parts[0];
+				handler.type = parts[1];
+
+				// Get the current list of functions bound to this event
+				var handlers = events[type];
+
+				// Init the event handler queue
+				if (!handlers) {
+					handlers = events[type] = {};
+		
+					// Check for a special event handler
+					// Only use addEventListener/attachEvent if the special
+					// events handler returns false
+					if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+						// Bind the global event handler to the element
+						if (elem.addEventListener)
+							elem.addEventListener(type, handle, false);
+						else if (elem.attachEvent)
+							elem.attachEvent("on" + type, handle);
+					}
+				}
+
+				// Add the function to the element's handler list
+				handlers[handler.guid] = handler;
+
+				// Keep track of which events have been used, for global triggering
+				jQuery.event.global[type] = true;
+			});
+		
+		// Nullify elem to prevent memory leaks in IE
+		elem = null;
+	},
+
+	guid: 1,
+	global: {},
+
+	// Detach an event or set of events from an element
+	remove: function(elem, types, handler) {
+		// don't do events on text and comment nodes
+		if ( elem.nodeType == 3 || elem.nodeType == 8 )
+			return;
+
+		var events = jQuery.data(elem, "events"), ret, index;
+
+		if ( events ) {
+			// Unbind all events for the element
+			if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
+				for ( var type in events )
+					this.remove( elem, type + (types || "") );
+			else {
+				// types is actually an event object here
+				if ( types.type ) {
+					handler = types.handler;
+					types = types.type;
+				}
+				
+				// Handle multiple events seperated by a space
+				// jQuery(...).unbind("mouseover mouseout", fn);
+				jQuery.each(types.split(/\s+/), function(index, type){
+					// Namespaced event handlers
+					var parts = type.split(".");
+					type = parts[0];
+					
+					if ( events[type] ) {
+						// remove the given handler for the given type
+						if ( handler )
+							delete events[type][handler.guid];
+			
+						// remove all handlers for the given type
+						else
+							for ( handler in events[type] )
+								// Handle the removal of namespaced events
+								if ( !parts[1] || events[type][handler].type == parts[1] )
+									delete events[type][handler];
+
+						// remove generic event handler if no more handlers exist
+						for ( ret in events[type] ) break;
+						if ( !ret ) {
+							if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
+								if (elem.removeEventListener)
+									elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
+								else if (elem.detachEvent)
+									elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
+							}
+							ret = null;
+							delete events[type];
+						}
+					}
+				});
+			}
+
+			// Remove the expando if it's no longer used
+			for ( ret in events ) break;
+			if ( !ret ) {
+				var handle = jQuery.data( elem, "handle" );
+				if ( handle ) handle.elem = null;
+				jQuery.removeData( elem, "events" );
+				jQuery.removeData( elem, "handle" );
+			}
+		}
+	},
+
+	trigger: function(type, data, elem, donative, extra) {
+		// Clone the incoming data, if any
+		data = jQuery.makeArray(data || []);
+
+		if ( type.indexOf("!") >= 0 ) {
+			type = type.slice(0, -1);
+			var exclusive = true;
+		}
+
+		// Handle a global trigger
+		if ( !elem ) {
+			// Only trigger if we've ever bound an event for it
+			if ( this.global[type] )
+				jQuery("*").add([window, document]).trigger(type, data);
+
+		// Handle triggering a single element
+		} else {
+			// don't do events on text and comment nodes
+			if ( elem.nodeType == 3 || elem.nodeType == 8 )
+				return undefined;
+
+			var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
+				// Check to see if we need to provide a fake event, or not
+				event = !data[0] || !data[0].preventDefault;
+			
+			// Pass along a fake event
+			if ( event )
+				data.unshift( this.fix({ type: type, target: elem }) );
+
+			// Enforce the right trigger type
+			data[0].type = type;
+			if ( exclusive )
+				data[0].exclusive = true;
+
+			// Trigger the event
+			if ( jQuery.isFunction( jQuery.data(elem, "handle") ) )
+				val = jQuery.data(elem, "handle").apply( elem, data );
+
+			// Handle triggering native .onfoo handlers
+			if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+				val = false;
+
+			// Extra functions don't get the custom event object
+			if ( event )
+				data.shift();
+
+			// Handle triggering of extra function
+			if ( extra && jQuery.isFunction( extra ) ) {
+				// call the extra function and tack the current return value on the end for possible inspection
+				ret = extra.apply( elem, val == null ? data : data.concat( val ) );
+				// if anything is returned, give it precedence and have it overwrite the previous value
+				if (ret !== undefined)
+					val = ret;
+			}
+
+			// Trigger the native events (except for clicks on links)
+			if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+				this.triggered = true;
+				try {
+					elem[ type ]();
+				// prevent IE from throwing an error for some hidden elements
+				} catch (e) {}
+			}
+
+			this.triggered = false;
+		}
+
+		return val;
+	},
+
+	handle: function(event) {
+		// returned undefined or false
+		var val;
+
+		// Empty object is for triggered events with no data
+		event = jQuery.event.fix( event || window.event || {} ); 
+
+		// Namespaced event handlers
+		var parts = event.type.split(".");
+		event.type = parts[0];
+
+		var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
+		args.unshift( event );
+
+		for ( var j in handlers ) {
+			var handler = handlers[j];
+			// Pass in a reference to the handler function itself
+			// So that we can later remove it
+			args[0].handler = handler;
+			args[0].data = handler.data;
+
+			// Filter the functions by class
+			if ( !parts[1] && !event.exclusive || handler.type == parts[1] ) {
+				var ret = handler.apply( this, args );
+
+				if ( val !== false )
+					val = ret;
+
+				if ( ret === false ) {
+					event.preventDefault();
+					event.stopPropagation();
+				}
+			}
+		}
+
+		// Clean up added properties in IE to prevent memory leak
+		if (jQuery.browser.msie)
+			event.target = event.preventDefault = event.stopPropagation =
+				event.handler = event.data = null;
+
+		return val;
+	},
+
+	fix: function(event) {
+		// store a copy of the original event object 
+		// and clone to set read-only properties
+		var originalEvent = event;
+		event = jQuery.extend({}, originalEvent);
+		
+		// add preventDefault and stopPropagation since 
+		// they will not work on the clone
+		event.preventDefault = function() {
+			// if preventDefault exists run it on the original event
+			if (originalEvent.preventDefault)
+				originalEvent.preventDefault();
+			// otherwise set the returnValue property of the original event to false (IE)
+			originalEvent.returnValue = false;
+		};
+		event.stopPropagation = function() {
+			// if stopPropagation exists run it on the original event
+			if (originalEvent.stopPropagation)
+				originalEvent.stopPropagation();
+			// otherwise set the cancelBubble property of the original event to true (IE)
+			originalEvent.cancelBubble = true;
+		};
+		
+		// Fix target property, if necessary
+		if ( !event.target )
+			event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+				
+		// check if target is a textnode (safari)
+		if ( event.target.nodeType == 3 )
+			event.target = originalEvent.target.parentNode;
+
+		// Add relatedTarget, if necessary
+		if ( !event.relatedTarget && event.fromElement )
+			event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+		// Calculate pageX/Y if missing and clientX/Y available
+		if ( event.pageX == null && event.clientX != null ) {
+			var doc = document.documentElement, body = document.body;
+			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
+			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+		}
+			
+		// Add which for key events
+		if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
+			event.which = event.charCode || event.keyCode;
+		
+		// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+		if ( !event.metaKey && event.ctrlKey )
+			event.metaKey = event.ctrlKey;
+
+		// Add which for click: 1 == left; 2 == middle; 3 == right
+		// Note: button is not normalized, so don't use it
+		if ( !event.which && event.button )
+			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+			
+		return event;
+	},
+	
+	special: {
+		ready: {
+			setup: function() {
+				// Make sure the ready event is setup
+				bindReady();
+				return;
+			},
+			
+			teardown: function() { return; }
+		},
+		
+		mouseenter: {
+			setup: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
+				return true;
+			},
+		
+			teardown: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
+				return true;
+			},
+			
+			handler: function(event) {
+				// If we actually just moused on to a sub-element, ignore it
+				if ( withinElement(event, this) ) return true;
+				// Execute the right handlers by setting the event type to mouseenter
+				arguments[0].type = "mouseenter";
+				return jQuery.event.handle.apply(this, arguments);
+			}
+		},
+	
+		mouseleave: {
+			setup: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
+				return true;
+			},
+		
+			teardown: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
+				return true;
+			},
+			
+			handler: function(event) {
+				// If we actually just moused on to a sub-element, ignore it
+				if ( withinElement(event, this) ) return true;
+				// Execute the right handlers by setting the event type to mouseleave
+				arguments[0].type = "mouseleave";
+				return jQuery.event.handle.apply(this, arguments);
+			}
+		}
+	}
+};
+
+jQuery.fn.extend({
+	bind: function( type, data, fn ) {
+		return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+			jQuery.event.add( this, type, fn || data, fn && data );
+		});
+	},
+	
+	one: function( type, data, fn ) {
+		return this.each(function(){
+			jQuery.event.add( this, type, function(event) {
+				jQuery(this).unbind(event);
+				return (fn || data).apply( this, arguments);
+			}, fn && data);
+		});
+	},
+
+	unbind: function( type, fn ) {
+		return this.each(function(){
+			jQuery.event.remove( this, type, fn );
+		});
+	},
+
+	trigger: function( type, data, fn ) {
+		return this.each(function(){
+			jQuery.event.trigger( type, data, this, true, fn );
+		});
+	},
+
+	triggerHandler: function( type, data, fn ) {
+		if ( this[0] )
+			return jQuery.event.trigger( type, data, this[0], false, fn );
+		return undefined;
+	},
+
+	toggle: function() {
+		// Save reference to arguments for access in closure
+		var args = arguments;
+
+		return this.click(function(event) {
+			// Figure out which function to execute
+			this.lastToggle = 0 == this.lastToggle ? 1 : 0;
+			
+			// Make sure that clicks stop
+			event.preventDefault();
+			
+			// and execute the function
+			return args[this.lastToggle].apply( this, arguments ) || false;
+		});
+	},
+
+	hover: function(fnOver, fnOut) {
+		return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
+	},
+	
+	ready: function(fn) {
+		// Attach the listeners
+		bindReady();
+
+		// If the DOM is already ready
+		if ( jQuery.isReady )
+			// Execute the function immediately
+			fn.call( document, jQuery );
+			
+		// Otherwise, remember the function for later
+		else
+			// Add the function to the wait list
+			jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
+	
+		return this;
+	}
+});
+
+jQuery.extend({
+	isReady: false,
+	readyList: [],
+	// Handle when the DOM is ready
+	ready: function() {
+		// Make sure that the DOM is not already loaded
+		if ( !jQuery.isReady ) {
+			// Remember that the DOM is ready
+			jQuery.isReady = true;
+			
+			// If there are functions bound, to execute
+			if ( jQuery.readyList ) {
+				// Execute all of them
+				jQuery.each( jQuery.readyList, function(){
+					this.apply( document );
+				});
+				
+				// Reset the list of functions
+				jQuery.readyList = null;
+			}
+		
+			// Trigger any bound ready events
+			jQuery(document).triggerHandler("ready");
+		}
+	}
+});
+
+var readyBound = false;
+
+function bindReady(){
+	if ( readyBound ) return;
+	readyBound = true;
+
+	// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
+	if ( document.addEventListener && !jQuery.browser.opera)
+		// Use the handy event callback
+		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
+	
+	// If IE is used and is not in a frame
+	// Continually check to see if the document is ready
+	if ( jQuery.browser.msie && window == top ) (function(){
+		if (jQuery.isReady) return;
+		try {
+			// If IE is used, use the trick by Diego Perini
+			// http://javascript.nwbox.com/IEContentLoaded/
+			document.documentElement.doScroll("left");
+		} catch( error ) {
+			setTimeout( arguments.callee, 0 );
+			return;
+		}
+		// and execute any waiting functions
+		jQuery.ready();
+	})();
+
+	if ( jQuery.browser.opera )
+		document.addEventListener( "DOMContentLoaded", function () {
+			if (jQuery.isReady) return;
+			for (var i = 0; i < document.styleSheets.length; i++)
+				if (document.styleSheets[i].disabled) {
+					setTimeout( arguments.callee, 0 );
+					return;
+				}
+			// and execute any waiting functions
+			jQuery.ready();
+		}, false);
+
+	if ( jQuery.browser.safari ) {
+		var numStyles;
+		(function(){
+			if (jQuery.isReady) return;
+			if ( document.readyState != "loaded" && document.readyState != "complete" ) {
+				setTimeout( arguments.callee, 0 );
+				return;
+			}
+			if ( numStyles === undefined )
+				numStyles = jQuery("style, link[rel=stylesheet]").length;
+			if ( document.styleSheets.length != numStyles ) {
+				setTimeout( arguments.callee, 0 );
+				return;
+			}
+			// and execute any waiting functions
+			jQuery.ready();
+		})();
+	}
+
+	// A fallback to window.onload, that will always work
+	jQuery.event.add( window, "load", jQuery.ready );
+}
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + 
+	"submit,keydown,keypress,keyup,error").split(","), function(i, name){
+	
+	// Handle event binding
+	jQuery.fn[name] = function(fn){
+		return fn ? this.bind(name, fn) : this.trigger(name);
+	};
+});
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event, elem) {
+	// Check if mouse(over|out) are still within the same parent element
+	var parent = event.relatedTarget;
+	// Traverse up the tree
+	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
+	// Return true if we actually just moused on to a sub-element
+	return parent == elem;
+};
+
+// Prevent memory leaks in IE
+// And prevent errors on refresh with events like mouseover in other browsers
+// Window isn't included so as not to unbind existing unload events
+jQuery(window).bind("unload", function() {
+	jQuery("*").add(document).unbind();
+});
+jQuery.fn.extend({
+	load: function( url, params, callback ) {
+		if ( jQuery.isFunction( url ) )
+			return this.bind("load", url);
+
+		var off = url.indexOf(" ");
+		if ( off >= 0 ) {
+			var selector = url.slice(off, url.length);
+			url = url.slice(0, off);
+		}
+
+		callback = callback || function(){};
+
+		// Default to a GET request
+		var type = "GET";
+
+		// If the second parameter was provided
+		if ( params )
+			// If it's a function
+			if ( jQuery.isFunction( params ) ) {
+				// We assume that it's the callback
+				callback = params;
+				params = null;
+
+			// Otherwise, build a param string
+			} else {
+				params = jQuery.param( params );
+				type = "POST";
+			}
+
+		var self = this;
+
+		// Request the remote document
+		jQuery.ajax({
+			url: url,
+			type: type,
+			dataType: "html",
+			data: params,
+			complete: function(res, status){
+				// If successful, inject the HTML into all the matched elements
+				if ( status == "success" || status == "notmodified" )
+					// See if a selector was specified
+					self.html( selector ?
+						// Create a dummy div to hold the results
+						jQuery("<div/>")
+							// inject the contents of the document in, removing the scripts
+							// to avoid any 'Permission Denied' errors in IE
+							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+							// Locate the specified elements
+							.find(selector) :
+
+						// If not, just inject the full result
+						res.responseText );
+
+				self.each( callback, [res.responseText, status, res] );
+			}
+		});
+		return this;
+	},
+
+	serialize: function() {
+		return jQuery.param(this.serializeArray());
+	},
+	serializeArray: function() {
+		return this.map(function(){
+			return jQuery.nodeName(this, "form") ?
+				jQuery.makeArray(this.elements) : this;
+		})
+		.filter(function(){
+			return this.name && !this.disabled && 
+				(this.checked || /select|textarea/i.test(this.nodeName) || 
+					/text|hidden|password/i.test(this.type));
+		})
+		.map(function(i, elem){
+			var val = jQuery(this).val();
+			return val == null ? null :
+				val.constructor == Array ?
+					jQuery.map( val, function(val, i){
+						return {name: elem.name, value: val};
+					}) :
+					{name: elem.name, value: val};
+		}).get();
+	}
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+	jQuery.fn[o] = function(f){
+		return this.bind(o, f);
+	};
+});
+
+var jsc = (new Date).getTime();
+
+jQuery.extend({
+	get: function( url, data, callback, type ) {
+		// shift arguments if data argument was ommited
+		if ( jQuery.isFunction( data ) ) {
+			callback = data;
+			data = null;
+		}
+		
+		return jQuery.ajax({
+			type: "GET",
+			url: url,
+			data: data,
+			success: callback,
+			dataType: type
+		});
+	},
+
+	getScript: function( url, callback ) {
+		return jQuery.get(url, null, callback, "script");
+	},
+
+	getJSON: function( url, data, callback ) {
+		return jQuery.get(url, data, callback, "json");
+	},
+
+	post: function( url, data, callback, type ) {
+		if ( jQuery.isFunction( data ) ) {
+			callback = data;
+			data = {};
+		}
+
+		return jQuery.ajax({
+			type: "POST",
+			url: url,
+			data: data,
+			success: callback,
+			dataType: type
+		});
+	},
+
+	ajaxSetup: function( settings ) {
+		jQuery.extend( jQuery.ajaxSettings, settings );
+	},
+
+	ajaxSettings: {
+		global: true,
+		type: "GET",
+		timeout: 0,
+		contentType: "application/x-www-form-urlencoded",
+		processData: true,
+		async: true,
+		data: null,
+		username: null,
+		password: null,
+		accepts: {
+			xml: "application/xml, text/xml",
+			html: "text/html",
+			script: "text/javascript, application/javascript",
+			json: "application/json, text/javascript",
+			text: "text/plain",
+			_default: "*/*"
+		}
+	},
+	
+	// Last-Modified header cache for next request
+	lastModified: {},
+
+	ajax: function( s ) {
+		var jsonp, jsre = /=\?(&|$)/g, status, data;
+
+		// Extend the settings, but re-extend 's' so that it can be
+		// checked again later (in the test suite, specifically)
+		s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+		// convert data if not already a string
+		if ( s.data && s.processData && typeof s.data != "string" )
+			s.data = jQuery.param(s.data);
+
+		// Handle JSONP Parameter Callbacks
+		if ( s.dataType == "jsonp" ) {
+			if ( s.type.toLowerCase() == "get" ) {
+				if ( !s.url.match(jsre) )
+					s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+			} else if ( !s.data || !s.data.match(jsre) )
+				s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+			s.dataType = "json";
+		}
+
+		// Build temporary JSONP function
+		if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+			jsonp = "jsonp" + jsc++;
+
+			// Replace the =? sequence both in the query string and the data
+			if ( s.data )
+				s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+			s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+			// We need to make sure
+			// that a JSONP style response is executed properly
+			s.dataType = "script";
+
+			// Handle JSONP-style loading
+			window[ jsonp ] = function(tmp){
+				data = tmp;
+				success();
+				complete();
+				// Garbage collect
+				window[ jsonp ] = undefined;
+				try{ delete window[ jsonp ]; } catch(e){}
+				if ( head )
+					head.removeChild( script );
+			};
+		}
+
+		if ( s.dataType == "script" && s.cache == null )
+			s.cache = false;
+
+		if ( s.cache === false && s.type.toLowerCase() == "get" ) {
+			var ts = (new Date()).getTime();
+			// try replacing _= if it is there
+			var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+			// if nothing was replaced, add timestamp to the end
+			s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+		}
+
+		// If data is available, append data to url for get requests
+		if ( s.data && s.type.toLowerCase() == "get" ) {
+			s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+			// IE likes to send both get and post data, prevent this
+			s.data = null;
+		}
+
+		// Watch for a new set of requests
+		if ( s.global && ! jQuery.active++ )
+			jQuery.event.trigger( "ajaxStart" );
+
+		// If we're requesting a remote document
+		// and trying to load JSON or Script with a GET
+		if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && s.dataType == "script" && s.type.toLowerCase() == "get" ) {
+			var head = document.getElementsByTagName("head")[0];
+			var script = document.createElement("script");
+			script.src = s.url;
+			if (s.scriptCharset)
+				script.charset = s.scriptCharset;
+
+			// Handle Script loading
+			if ( !jsonp ) {
+				var done = false;
+
+				// Attach handlers for all browsers
+				script.onload = script.onreadystatechange = function(){
+					if ( !done && (!this.readyState || 
+							this.readyState == "loaded" || this.readyState == "complete") ) {
+						done = true;
+						success();
+						complete();
+						head.removeChild( script );
+					}
+				};
+			}
+
+			head.appendChild(script);
+
+			// We handle everything using the script element injection
+			return undefined;
+		}
+
+		var requestDone = false;
+
+		// Create the request object; Microsoft failed to properly
+		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+		var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+
+		// Open the socket
+		xml.open(s.type, s.url, s.async, s.username, s.password);
+
+		// Need an extra try/catch for cross domain requests in Firefox 3
+		try {
+			// Set the correct header, if data is being sent
+			if ( s.data )
+				xml.setRequestHeader("Content-Type", s.contentType);
+
+			// Set the If-Modified-Since header, if ifModified mode.
+			if ( s.ifModified )
+				xml.setRequestHeader("If-Modified-Since",
+					jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+			// Set header so the called script knows that it's an XMLHttpRequest
+			xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+			// Set the Accepts header for the server, depending on the dataType
+			xml.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+				s.accepts[ s.dataType ] + ", */*" :
+				s.accepts._default );
+		} catch(e){}
+
+		// Allow custom headers/mimetypes
+		if ( s.beforeSend )
+			s.beforeSend(xml);
+			
+		if ( s.global )
+			jQuery.event.trigger("ajaxSend", [xml, s]);
+
+		// Wait for a response to come back
+		var onreadystatechange = function(isTimeout){
+			// The transfer is complete and the data is available, or the request timed out
+			if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
+				requestDone = true;
+				
+				// clear poll interval
+				if (ival) {
+					clearInterval(ival);
+					ival = null;
+				}
+				
+				status = isTimeout == "timeout" && "timeout" ||
+					!jQuery.httpSuccess( xml ) && "error" ||
+					s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
+					"success";
+
+				if ( status == "success" ) {
+					// Watch for, and catch, XML document parse errors
+					try {
+						// process the data (runs the xml through httpData regardless of callback)
+						data = jQuery.httpData( xml, s.dataType );
+					} catch(e) {
+						status = "parsererror";
+					}
+				}
+
+				// Make sure that the request was successful or notmodified
+				if ( status == "success" ) {
+					// Cache Last-Modified header, if ifModified mode.
+					var modRes;
+					try {
+						modRes = xml.getResponseHeader("Last-Modified");
+					} catch(e) {} // swallow exception thrown by FF if header is not available
+	
+					if ( s.ifModified && modRes )
+						jQuery.lastModified[s.url] = modRes;
+
+					// JSONP handles its own success callback
+					if ( !jsonp )
+						success();	
+				} else
+					jQuery.handleError(s, xml, status);
+
+				// Fire the complete handlers
+				complete();
+
+				// Stop memory leaks
+				if ( s.async )
+					xml = null;
+			}
+		};
+		
+		if ( s.async ) {
+			// don't attach the handler to the request, just poll it instead
+			var ival = setInterval(onreadystatechange, 13); 
+
+			// Timeout checker
+			if ( s.timeout > 0 )
+				setTimeout(function(){
+					// Check to see if the request is still happening
+					if ( xml ) {
+						// Cancel the request
+						xml.abort();
+	
+						if( !requestDone )
+							onreadystatechange( "timeout" );
+					}
+				}, s.timeout);
+		}
+			
+		// Send the data
+		try {
+			xml.send(s.data);
+		} catch(e) {
+			jQuery.handleError(s, xml, null, e);
+		}
+		
+		// firefox 1.5 doesn't fire statechange for sync requests
+		if ( !s.async )
+			onreadystatechange();
+
+		function success(){
+			// If a local callback was specified, fire it and pass it the data
+			if ( s.success )
+				s.success( data, status );
+
+			// Fire the global callback
+			if ( s.global )
+				jQuery.event.trigger( "ajaxSuccess", [xml, s] );
+		}
+
+		function complete(){
+			// Process result
+			if ( s.complete )
+				s.complete(xml, status);
+
+			// The request was completed
+			if ( s.global )
+				jQuery.event.trigger( "ajaxComplete", [xml, s] );
+
+			// Handle the global AJAX counter
+			if ( s.global && ! --jQuery.active )
+				jQuery.event.trigger( "ajaxStop" );
+		}
+		
+		// return XMLHttpRequest to allow aborting the request etc.
+		return xml;
+	},
+
+	handleError: function( s, xml, status, e ) {
+		// If a local callback was specified, fire it
+		if ( s.error ) s.error( xml, status, e );
+
+		// Fire the global callback
+		if ( s.global )
+			jQuery.event.trigger( "ajaxError", [xml, s, e] );
+	},
+
+	// Counter for holding the number of active queries
+	active: 0,
+
+	// Determines if an XMLHttpRequest was successful or not
+	httpSuccess: function( r ) {
+		try {
+			// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+			return !r.status && location.protocol == "file:" ||
+				( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 ||
+				jQuery.browser.safari && r.status == undefined;
+		} catch(e){}
+		return false;
+	},
+
+	// Determines if an XMLHttpRequest returns NotModified
+	httpNotModified: function( xml, url ) {
+		try {
+			var xmlRes = xml.getResponseHeader("Last-Modified");
+
+			// Firefox always returns 200. check Last-Modified date
+			return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
+				jQuery.browser.safari && xml.status == undefined;
+		} catch(e){}
+		return false;
+	},
+
+	httpData: function( r, type ) {
+		var ct = r.getResponseHeader("content-type");
+		var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
+		var data = xml ? r.responseXML : r.responseText;
+
+		if ( xml && data.documentElement.tagName == "parsererror" )
+			throw "parsererror";
+
+		// If the type is "script", eval it in global context
+		if ( type == "script" )
+			jQuery.globalEval( data );
+
+		// Get the JavaScript object, if JSON is used.
+		if ( type == "json" )
+			data = eval("(" + data + ")");
+
+		return data;
+	},
+
+	// Serialize an array of form elements or a set of
+	// key/values into a query string
+	param: function( a ) {
+		var s = [];
+
+		// If an array was passed in, assume that it is an array
+		// of form elements
+		if ( a.constructor == Array || a.jquery )
+			// Serialize the form elements
+			jQuery.each( a, function(){
+				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
+			});
+
+		// Otherwise, assume that it's an object of key/value pairs
+		else
+			// Serialize the key/values
+			for ( var j in a )
+				// If the value is an array then the key names need to be repeated
+				if ( a[j] && a[j].constructor == Array )
+					jQuery.each( a[j], function(){
+						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+					});
+				else
+					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
+
+		// Return the resulting serialization
+		return s.join("&").replace(/%20/g, "+");
+	}
+
+});
+jQuery.fn.extend({
+	show: function(speed,callback){
+		return speed ?
+			this.animate({
+				height: "show", width: "show", opacity: "show"
+			}, speed, callback) :
+			
+			this.filter(":hidden").each(function(){
+				this.style.display = this.oldblock || "";
+				if ( jQuery.css(this,"display") == "none" ) {
+					var elem = jQuery("<" + this.tagName + " />").appendTo("body");
+					this.style.display = elem.css("display");
+					// handle an edge condition where css is - div { display:none; } or similar
+					if (this.style.display == "none")
+						this.style.display = "block";
+					elem.remove();
+				}
+			}).end();
+	},
+	
+	hide: function(speed,callback){
+		return speed ?
+			this.animate({
+				height: "hide", width: "hide", opacity: "hide"
+			}, speed, callback) :
+			
+			this.filter(":visible").each(function(){
+				this.oldblock = this.oldblock || jQuery.css(this,"display");
+				this.style.display = "none";
+			}).end();
+	},
+
+	// Save the old toggle function
+	_toggle: jQuery.fn.toggle,
+	
+	toggle: function( fn, fn2 ){
+		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+			this._toggle( fn, fn2 ) :
+			fn ?
+				this.animate({
+					height: "toggle", width: "toggle", opacity: "toggle"
+				}, fn, fn2) :
+				this.each(function(){
+					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
+				});
+	},
+	
+	slideDown: function(speed,callback){
+		return this.animate({height: "show"}, speed, callback);
+	},
+	
+	slideUp: function(speed,callback){
+		return this.animate({height: "hide"}, speed, callback);
+	},
+
+	slideToggle: function(speed, callback){
+		return this.animate({height: "toggle"}, speed, callback);
+	},
+	
+	fadeIn: function(speed, callback){
+		return this.animate({opacity: "show"}, speed, callback);
+	},
+	
+	fadeOut: function(speed, callback){
+		return this.animate({opacity: "hide"}, speed, callback);
+	},
+	
+	fadeTo: function(speed,to,callback){
+		return this.animate({opacity: to}, speed, callback);
+	},
+	
+	animate: function( prop, speed, easing, callback ) {
+		var optall = jQuery.speed(speed, easing, callback);
+
+		return this[ optall.queue === false ? "each" : "queue" ](function(){
+			if ( this.nodeType != 1)
+				return false;
+
+			var opt = jQuery.extend({}, optall);
+			var hidden = jQuery(this).is(":hidden"), self = this;
+			
+			for ( var p in prop ) {
+				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+					return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
+
+				if ( p == "height" || p == "width" ) {
+					// Store display property
+					opt.display = jQuery.css(this, "display");
+
+					// Make sure that nothing sneaks out
+					opt.overflow = this.style.overflow;
+				}
+			}
+
+			if ( opt.overflow != null )
+				this.style.overflow = "hidden";
+
+			opt.curAnim = jQuery.extend({}, prop);
+			
+			jQuery.each( prop, function(name, val){
+				var e = new jQuery.fx( self, opt, name );
+
+				if ( /toggle|show|hide/.test(val) )
+					e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+				else {
+					var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+						start = e.cur(true) || 0;
+
+					if ( parts ) {
+						var end = parseFloat(parts[2]),
+							unit = parts[3] || "px";
+
+						// We need to compute starting value
+						if ( unit != "px" ) {
+							self.style[ name ] = (end || 1) + unit;
+							start = ((end || 1) / e.cur(true)) * start;
+							self.style[ name ] = start + unit;
+						}
+
+						// If a +=/-= token was provided, we're doing a relative animation
+						if ( parts[1] )
+							end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+						e.custom( start, end, unit );
+					} else
+						e.custom( start, val, "" );
+				}
+			});
+
+			// For JS strict compliance
+			return true;
+		});
+	},
+	
+	queue: function(type, fn){
+		if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
+			fn = type;
+			type = "fx";
+		}
+
+		if ( !type || (typeof type == "string" && !fn) )
+			return queue( this[0], type );
+
+		return this.each(function(){
+			if ( fn.constructor == Array )
+				queue(this, type, fn);
+			else {
+				queue(this, type).push( fn );
+			
+				if ( queue(this, type).length == 1 )
+					fn.apply(this);
+			}
+		});
+	},
+
+	stop: function(clearQueue, gotoEnd){
+		var timers = jQuery.timers;
+
+		if (clearQueue)
+			this.queue([]);
+
+		this.each(function(){
+			// go in reverse order so anything added to the queue during the loop is ignored
+			for ( var i = timers.length - 1; i >= 0; i-- )
+				if ( timers[i].elem == this ) {
+					if (gotoEnd)
+						// force the next step to be the last
+						timers[i](true);
+					timers.splice(i, 1);
+				}
+		});
+
+		// start the next in the queue if the last step wasn't forced
+		if (!gotoEnd)
+			this.dequeue();
+
+		return this;
+	}
+
+});
+
+var queue = function( elem, type, array ) {
+	if ( !elem )
+		return undefined;
+
+	type = type || "fx";
+
+	var q = jQuery.data( elem, type + "queue" );
+
+	if ( !q || array )
+		q = jQuery.data( elem, type + "queue", 
+			array ? jQuery.makeArray(array) : [] );
+
+	return q;
+};
+
+jQuery.fn.dequeue = function(type){
+	type = type || "fx";
+
+	return this.each(function(){
+		var q = queue(this, type);
+
+		q.shift();
+
+		if ( q.length )
+			q[0].apply( this );
+	});
+};
+
+jQuery.extend({
+	
+	speed: function(speed, easing, fn) {
+		var opt = speed && speed.constructor == Object ? speed : {
+			complete: fn || !fn && easing || 
+				jQuery.isFunction( speed ) && speed,
+			duration: speed,
+			easing: fn && easing || easing && easing.constructor != Function && easing
+		};
+
+		opt.duration = (opt.duration && opt.duration.constructor == Number ? 
+			opt.duration : 
+			{ slow: 600, fast: 200 }[opt.duration]) || 400;
+	
+		// Queueing
+		opt.old = opt.complete;
+		opt.complete = function(){
+			if ( opt.queue !== false )
+				jQuery(this).dequeue();
+			if ( jQuery.isFunction( opt.old ) )
+				opt.old.apply( this );
+		};
+	
+		return opt;
+	},
+	
+	easing: {
+		linear: function( p, n, firstNum, diff ) {
+			return firstNum + diff * p;
+		},
+		swing: function( p, n, firstNum, diff ) {
+			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+		}
+	},
+	
+	timers: [],
+	timerId: null,
+
+	fx: function( elem, options, prop ){
+		this.options = options;
+		this.elem = elem;
+		this.prop = prop;
+
+		if ( !options.orig )
+			options.orig = {};
+	}
+
+});
+
+jQuery.fx.prototype = {
+
+	// Simple function for setting a style value
+	update: function(){
+		if ( this.options.step )
+			this.options.step.apply( this.elem, [ this.now, this ] );
+
+		(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+		// Set display property to block for height/width animations
+		if ( this.prop == "height" || this.prop == "width" )
+			this.elem.style.display = "block";
+	},
+
+	// Get the current size
+	cur: function(force){
+		if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
+			return this.elem[ this.prop ];
+
+		var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+		return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+	},
+
+	// Start an animation from one number to another
+	custom: function(from, to, unit){
+		this.startTime = (new Date()).getTime();
+		this.start = from;
+		this.end = to;
+		this.unit = unit || this.unit || "px";
+		this.now = this.start;
+		this.pos = this.state = 0;
+		this.update();
+
+		var self = this;
+		function t(gotoEnd){
+			return self.step(gotoEnd);
+		}
+
+		t.elem = this.elem;
+
+		jQuery.timers.push(t);
+
+		if ( jQuery.timerId == null ) {
+			jQuery.timerId = setInterval(function(){
+				var timers = jQuery.timers;
+				
+				for ( var i = 0; i < timers.length; i++ )
+					if ( !timers[i]() )
+						timers.splice(i--, 1);
+
+				if ( !timers.length ) {
+					clearInterval( jQuery.timerId );
+					jQuery.timerId = null;
+				}
+			}, 13);
+		}
+	},
+
+	// Simple 'show' function
+	show: function(){
+		// Remember where we started, so that we can go back to it later
+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+		this.options.show = true;
+
+		// Begin the animation
+		this.custom(0, this.cur());
+
+		// Make sure that we start at a small width/height to avoid any
+		// flash of content
+		if ( this.prop == "width" || this.prop == "height" )
+			this.elem.style[this.prop] = "1px";
+		
+		// Start by showing the element
+		jQuery(this.elem).show();
+	},
+
+	// Simple 'hide' function
+	hide: function(){
+		// Remember where we started, so that we can go back to it later
+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+		this.options.hide = true;
+
+		// Begin the animation
+		this.custom(this.cur(), 0);
+	},
+
+	// Each step of an animation
+	step: function(gotoEnd){
+		var t = (new Date()).getTime();
+
+		if ( gotoEnd || t > this.options.duration + this.startTime ) {
+			this.now = this.end;
+			this.pos = this.state = 1;
+			this.update();
+
+			this.options.curAnim[ this.prop ] = true;
+
+			var done = true;
+			for ( var i in this.options.curAnim )
+				if ( this.options.curAnim[i] !== true )
+					done = false;
+
+			if ( done ) {
+				if ( this.options.display != null ) {
+					// Reset the overflow
+					this.elem.style.overflow = this.options.overflow;
+				
+					// Reset the display
+					this.elem.style.display = this.options.display;
+					if ( jQuery.css(this.elem, "display") == "none" )
+						this.elem.style.display = "block";
+				}
+
+				// Hide the element if the "hide" operation was done
+				if ( this.options.hide )
+					this.elem.style.display = "none";
+
+				// Reset the properties, if the item has been hidden or shown
+				if ( this.options.hide || this.options.show )
+					for ( var p in this.options.curAnim )
+						jQuery.attr(this.elem.style, p, this.options.orig[p]);
+			}
+
+			// If a callback was provided, execute it
+			if ( done && jQuery.isFunction( this.options.complete ) )
+				// Execute the complete function
+				this.options.complete.apply( this.elem );
+
+			return false;
+		} else {
+			var n = t - this.startTime;
+			this.state = n / this.options.duration;
+
+			// Perform the easing function, defaults to swing
+			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+			this.now = this.start + ((this.end - this.start) * this.pos);
+
+			// Perform the next step of the animation
+			this.update();
+		}
+
+		return true;
+	}
+
+};
+
+jQuery.fx.step = {
+	scrollLeft: function(fx){
+		fx.elem.scrollLeft = fx.now;
+	},
+
+	scrollTop: function(fx){
+		fx.elem.scrollTop = fx.now;
+	},
+
+	opacity: function(fx){
+		jQuery.attr(fx.elem.style, "opacity", fx.now);
+	},
+
+	_default: function(fx){
+		fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+	}
+};
+// The Offset Method
+// Originally By Brandon Aaron, part of the Dimension Plugin
+// http://jquery.com/plugins/project/dimensions
+jQuery.fn.offset = function() {
+	var left = 0, top = 0, elem = this[0], results;
+	
+	if ( elem ) with ( jQuery.browser ) {
+		var parent       = elem.parentNode, 
+		    offsetChild  = elem,
+		    offsetParent = elem.offsetParent, 
+		    doc          = elem.ownerDocument,
+		    safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
+		    fixed        = jQuery.css(elem, "position") == "fixed";
+	
+		// Use getBoundingClientRect if available
+		if ( elem.getBoundingClientRect ) {
+			var box = elem.getBoundingClientRect();
+		
+			// Add the document scroll offsets
+			add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+				box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
+		
+			// IE adds the HTML element's border, by default it is medium which is 2px
+			// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
+			// IE 7 standards mode, the border is always 2px
+			// This border/offset is typically represented by the clientLeft and clientTop properties
+			// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
+			// Therefore this method will be off by 2px in IE while in quirksmode
+			add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
+	
+		// Otherwise loop through the offsetParents and parentNodes
+		} else {
+		
+			// Initial element offsets
+			add( elem.offsetLeft, elem.offsetTop );
+			
+			// Get parent offsets
+			while ( offsetParent ) {
+				// Add offsetParent offsets
+				add( offsetParent.offsetLeft, offsetParent.offsetTop );
+			
+				// Mozilla and Safari > 2 does not include the border on offset parents
+				// However Mozilla adds the border for table or table cells
+				if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
+					border( offsetParent );
+					
+				// Add the document scroll offsets if position is fixed on any offsetParent
+				if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" )
+					fixed = true;
+			
+				// Set offsetChild to previous offsetParent unless it is the body element
+				offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
+				// Get next offsetParent
+				offsetParent = offsetParent.offsetParent;
+			}
+		
+			// Get parent scroll offsets
+			while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
+				// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
+				if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) )
+					// Subtract parent scroll offsets
+					add( -parent.scrollLeft, -parent.scrollTop );
+			
+				// Mozilla does not add the border for a parent that has overflow != visible
+				if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
+					border( parent );
+			
+				// Get next parent
+				parent = parent.parentNode;
+			}
+		
+			// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
+			// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
+			if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) || 
+				(mozilla && jQuery.css(offsetChild, "position") != "absolute") )
+					add( -doc.body.offsetLeft, -doc.body.offsetTop );
+			
+			// Add the document scroll offsets if position is fixed
+			if ( fixed )
+				add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+					Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
+		}
+
+		// Return an object with top and left properties
+		results = { top: top, left: left };
+	}
+
+	function border(elem) {
+		add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
+	}
+
+	function add(l, t) {
+		left += parseInt(l) || 0;
+		top += parseInt(t) || 0;
+	}
+
+	return results;
+};
+})();
diff --git a/json.js b/json.js
new file mode 100644
index 0000000..6fc8ed6
--- /dev/null
+++ b/json.js
@@ -0,0 +1,275 @@
+/*
+    json2.js
+    2008-02-14
+
+    Public Domain
+
+    No warranty expressed or implied. Use at your own risk.
+
+    See http://www.JSON.org/js.html
+
+    This file creates a global JSON object containing two methods:
+
+        JSON.stringify(value, whitelist)
+            value       any JavaScript value, usually an object or array.
+
+            whitelist   an optional array parameter that determines how object
+                        values are stringified.
+
+            This method produces a JSON text from a JavaScript value.
+            There are three possible ways to stringify an object, depending
+            on the optional whitelist parameter.
+
+            If an object has a toJSON method, then the toJSON() method will be
+            called. The value returned from the toJSON method will be
+            stringified.
+
+            Otherwise, if the optional whitelist parameter is an array, then
+            the elements of the array will be used to select members of the
+            object for stringification.
+
+            Otherwise, if there is no whitelist parameter, then all of the
+            members of the object will be stringified.
+
+            Values that do not have JSON representaions, such as undefined or
+            functions, will not be serialized. Such values in objects will be
+            dropped; in arrays will be replaced with null.
+            JSON.stringify(undefined) returns undefined. Dates will be
+            stringified as quoted ISO dates.
+
+            Example:
+
+            var text = JSON.stringify(['e', {pluribus: 'unum'}]);
+            // text is '["e",{"pluribus":"unum"}]'
+
+        JSON.parse(text, filter)
+            This method parses a JSON text to produce an object or
+            array. It can throw a SyntaxError exception.
+
+            The optional filter parameter is a function that can filter and
+            transform the results. It receives each of the keys and values, and
+            its return value is used instead of the original value. If it
+            returns what it received, then structure is not modified. If it
+            returns undefined then the member is deleted.
+
+            Example:
+
+            // Parse the text. If a key contains the string 'date' then
+            // convert the value to a date.
+
+            myData = JSON.parse(text, function (key, value) {
+                return key.indexOf('date') >= 0 ? new Date(value) : value;
+            });
+
+    This is a reference implementation. You are free to copy, modify, or
+    redistribute.
+
+    Use your own copy. It is extremely unwise to load third party
+    code into your pages.
+*/
+
+/*jslint evil: true */
+
+/*global JSON */
+
+/*members "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+    charCodeAt, floor, getUTCDate, getUTCFullYear, getUTCHours,
+    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, length,
+    parse, propertyIsEnumerable, prototype, push, replace, stringify, test,
+    toJSON, toString
+*/
+
+if (!this.JSON) {
+
+    JSON = function () {
+
+        function f(n) {    // Format integers to have at least two digits.
+            return n < 10 ? '0' + n : n;
+        }
+
+        Date.prototype.toJSON = function () {
+
+// Eventually, this method will be based on the date.toISOString method.
+
+            return this.getUTCFullYear()   + '-' +
+                 f(this.getUTCMonth() + 1) + '-' +
+                 f(this.getUTCDate())      + 'T' +
+                 f(this.getUTCHours())     + ':' +
+                 f(this.getUTCMinutes())   + ':' +
+                 f(this.getUTCSeconds())   + 'Z';
+        };
+
+
+        var m = {    // table of character substitutions
+            '\b': '\\b',
+            '\t': '\\t',
+            '\n': '\\n',
+            '\f': '\\f',
+            '\r': '\\r',
+            '"' : '\\"',
+            '\\': '\\\\'
+        };
+
+        function stringify(value, whitelist) {
+            var a,          // The array holding the partial texts.
+                i,          // The loop counter.
+                k,          // The member key.
+                l,          // Length.
+                r = /["\\\x00-\x1f\x7f-\x9f]/g,
+                v;          // The member value.
+
+            switch (typeof value) {
+            case 'string':
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe sequences.
+
+                return r.test(value) ?
+                    '"' + value.replace(r, function (a) {
+                        var c = m[a];
+                        if (c) {
+                            return c;
+                        }
+                        c = a.charCodeAt();
+                        return '\\u00' + Math.floor(c / 16).toString(16) +
+                                                   (c % 16).toString(16);
+                    }) + '"' :
+                    '"' + value + '"';
+
+            case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+                return isFinite(value) ? String(value) : 'null';
+
+            case 'boolean':
+            case 'null':
+                return String(value);
+
+            case 'object':
+
+// Due to a specification blunder in ECMAScript,
+// typeof null is 'object', so watch out for that case.
+
+                if (!value) {
+                    return 'null';
+                }
+
+// If the object has a toJSON method, call it, and stringify the result.
+
+                if (typeof value.toJSON === 'function') {
+                    return stringify(value.toJSON());
+                }
+                a = [];
+                if (typeof value.length === 'number' &&
+                        !(value.propertyIsEnumerable('length'))) {
+
+// The object is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+                    l = value.length;
+                    for (i = 0; i < l; i += 1) {
+                        a.push(stringify(value[i], whitelist) || 'null');
+                    }
+
+// Join all of the elements together and wrap them in brackets.
+
+                    return '[' + a.join(',') + ']';
+                }
+                if (whitelist) {
+
+// If a whitelist (array of keys) is provided, use it to select the components
+// of the object.
+
+                    l = whitelist.length;
+                    for (i = 0; i < l; i += 1) {
+                        k = whitelist[i];
+                        if (typeof k === 'string') {
+                            v = stringify(value[k], whitelist);
+                            if (v) {
+                                a.push(stringify(k) + ':' + v);
+                            }
+                        }
+                    }
+                } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+                    for (k in value) {
+                        if (typeof k === 'string') {
+                            v = stringify(value[k], whitelist);
+                            if (v) {
+                                a.push(stringify(k) + ':' + v);
+                            }
+                        }
+                    }
+                }
+
+// Join all of the member texts together and wrap them in braces.
+
+                return '{' + a.join(',') + '}';
+            }
+        }
+
+        return {
+            stringify: stringify,
+            parse: function (text, filter) {
+                var j;
+
+                function walk(k, v) {
+                    var i, n;
+                    if (v && typeof v === 'object') {
+                        for (i in v) {
+                            if (Object.prototype.hasOwnProperty.apply(v, [i])) {
+                                n = walk(i, v[i]);
+                                if (n !== undefined) {
+                                    v[i] = n;
+                                } else {
+                                    delete v[i];
+                                }
+                            }
+                        }
+                    }
+                    return filter(k, v);
+                }
+
+
+// Parsing happens in three stages. In the first stage, we run the text against
+// regular expressions that look for non-JSON patterns. We are especially
+// concerned with '()' and 'new' because they can cause invocation, and '='
+// because it can cause mutation. But just to be safe, we want to reject all
+// unexpected forms.
+
+// We split the first stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace all backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+                if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, '@').
+replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the second stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+                    j = eval('(' + text + ')');
+
+// In the optional third stage, we recursively walk the new structure, passing
+// each name/value pair to a filter function for possible transformation.
+
+                    return typeof filter === 'function' ? walk('', j) : j;
+                }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+                throw new SyntaxError('parseJSON');
+            }
+        };
+    }();
+}
diff --git a/lib/dojo.js b/lib/dojo.js
new file mode 100644
index 0000000..3110641
--- /dev/null
+++ b/lib/dojo.js
@@ -0,0 +1,8458 @@
+/*
+	Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+/*
+	This is a compiled version of Dojo, built for deployment and not for
+	development. To get an editable version, please visit:
+
+		http://dojotoolkit.org
+
+	for documentation and information on getting the source.
+*/
+
+;(function(){
+
+	/*
+	dojo, dijit, and dojox must always be the first three, and in that order.
+	djConfig.scopeMap = [
+		["dojo", "fojo"],
+		["dijit", "fijit"],
+		["dojox", "fojox"]
+	
+	]
+	*/
+
+	/**Build will replace this comment with a scoped djConfig **/
+
+	//The null below can be relaced by a build-time value used instead of djConfig.scopeMap.
+	var sMap = null;
+
+	//See if new scopes need to be defined.
+	if((sMap || (typeof djConfig != "undefined" && djConfig.scopeMap)) && (typeof window != "undefined")){
+		var scopeDef = "", scopePrefix = "", scopeSuffix = "", scopeMap = {}, scopeMapRev = {};
+		sMap = sMap || djConfig.scopeMap;
+		for(var i = 0; i < sMap.length; i++){
+			//Make local variables, then global variables that use the locals.
+			var newScope = sMap[i];
+			scopeDef += "var " + newScope[0] + " = {}; " + newScope[1] + " = " + newScope[0] + ";" + newScope[1] + "._scopeName = '" + newScope[1] + "';";
+			scopePrefix += (i == 0 ? "" : ",") + newScope[0];
+			scopeSuffix += (i == 0 ? "" : ",") + newScope[1];
+			scopeMap[newScope[0]] = newScope[1];
+			scopeMapRev[newScope[1]] = newScope[0];
+		}
+
+		eval(scopeDef + "dojo._scopeArgs = [" + scopeSuffix + "];");
+
+		dojo._scopePrefixArgs = scopePrefix;
+		dojo._scopePrefix = "(function(" + scopePrefix + "){";
+		dojo._scopeSuffix = "})(" + scopeSuffix + ")";
+		dojo._scopeMap = scopeMap;
+		dojo._scopeMapRev = scopeMapRev;
+	}
+
+/*=====
+// note:
+//		'djConfig' does not exist under 'dojo.*' so that it can be set before the
+//		'dojo' variable exists.
+// note:
+//		Setting any of these variables *after* the library has loaded does
+//		nothing at all.
+
+djConfig = {
+	// summary:
+	//		Application code can set the global 'djConfig' prior to loading
+	//		the library to override certain global settings for how dojo works.
+	//
+	// isDebug: Boolean
+	//		Defaults to `false`. If set to `true`, ensures that Dojo provides
+	//		extended debugging feedback via Firebug. If Firebug is not available
+	//		on your platform, setting `isDebug` to `true` will force Dojo to
+	//		pull in (and display) the version of Firebug Lite which is
+	//		integrated into the Dojo distribution, thereby always providing a
+	//		debugging/logging console when `isDebug` is enabled. Note that
+	//		Firebug's `console.*` methods are ALWAYS defined by Dojo. If
+	//		`isDebug` is false and you are on a platform without Firebug, these
+	//		methods will be defined as no-ops.
+	isDebug: false,
+	// debugAtAllCosts: Boolean
+	//		Defaults to `false`. If set to `true`, this triggers an alternate
+	//		mode of the package system in which dependencies are detected and
+	//		only then are resources evaluated in dependency order via
+	//		`<script>` tag inclusion. This may double-request resources and
+	//		cause problems with scripts which expect `dojo.require()` to
+	//		preform synchronously. `debugAtAllCosts` can be an invaluable
+	//		debugging aid, but when using it, ensure that all code which
+	//		depends on Dojo modules is wrapped in `dojo.addOnLoad()` handlers.
+	//		Due to the somewhat unpredictable side-effects of using
+	//		`debugAtAllCosts`, it is strongly recommended that you enable this
+	//		flag as a last resort. `debugAtAllCosts` has no effect when loading
+	//		resources across domains. For usage information, see the
+	//		[Dojo Book](http://dojotoolkit.org/book/book-dojo/part-4-meta-dojo-making-your-dojo-code-run-faster-and-better/debugging-facilities/deb)
+	debugAtAllCosts: false,
+	// locale: String
+	//		The locale to assume for loading localized resources in this page,
+	//		specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
+	//		Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
+	//		See the documentation for `dojo.i18n` and `dojo.requireLocalization`
+	//		for details on loading localized resources. If no locale is specified,
+	//		Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
+	//		or `navigator.language` properties.
+	locale: undefined,
+	// extraLocale: Array
+	//		No default value. Specifies additional locales whose
+	//		resources should also be loaded alongside the default locale when
+	//		calls to `dojo.requireLocalization()` are processed.
+	extraLocale: undefined,
+	// baseUrl: String
+	//		The directory in which `dojo.js` is located. Under normal
+	//		conditions, Dojo auto-detects the correct location from which it
+	//		was loaded. You may need to manually configure `baseUrl` in cases
+	//		where you have renamed `dojo.js` or in which `<base>` tags confuse
+	//		some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
+	//		either the value of `djConfig.baseUrl` if one is provided or the
+	//		auto-detected root if not. Other modules are located relative to
+	//		this path.
+	baseUrl: undefined,
+	// modulePaths: Object
+	//		A map of module names to paths relative to `dojo.baseUrl`. The
+	//		key/value pairs correspond directly to the arguments which
+	//		`dojo.registerModulePath` accepts. Specifiying
+	//		`djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
+	//		of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
+	//		modules may be configured via `djConfig.modulePaths`.
+	modulePaths: {},
+	// afterOnLoad: Boolean 
+	//		Indicates Dojo was added to the page after the page load. In this case
+	//		Dojo will not wait for the page DOMContentLoad/load events and fire
+	//		its dojo.addOnLoad callbacks after making sure all outstanding
+	//		dojo.required modules have loaded.
+	afterOnLoad: false,
+	// addOnLoad: Function or Array
+	//		Adds a callback via dojo.addOnLoad. Useful when Dojo is added after
+	//		the page loads and djConfig.afterOnLoad is true. Supports the same
+	//		arguments as dojo.addOnLoad. When using a function reference, use
+	//		`djConfig.addOnLoad = function(){};`. For object with function name use
+	//		`djConfig.addOnLoad = [myObject, "functionName"];` and for object with
+	//		function reference use
+	//		`djConfig.addOnLoad = [myObject, function(){}];`
+	addOnLoad: null,
+	// require: Array
+	//		An array of module names to be loaded immediately after dojo.js has been included
+	//		in a page. 
+	require: []
+}
+=====*/
+
+(function(){
+	// firebug stubs
+
+	// if((!this["console"])||(!console["firebug"])){
+
+	if(!this["console"]){
+		this.console = {
+		};
+	}
+
+	//	Be careful to leave 'log' always at the end
+	var cn = [
+		"assert", "count", "debug", "dir", "dirxml", "error", "group",
+		"groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
+		"trace", "warn", "log" 
+	];
+	var i=0, tn;
+	while((tn=cn[i++])){
+		if(!console[tn]){
+			(function(){
+				var tcn = tn+"";
+				console[tcn] = ('log' in console) ? function(){ 
+					var a = Array.apply({}, arguments);
+					a.unshift(tcn+":");
+					console["log"](a.join(" "));
+				} : function(){}
+			})();
+		}
+	}
+
+	//TODOC:  HOW TO DOC THIS?
+	// dojo is the root variable of (almost all) our public symbols -- make sure it is defined.
+	if(typeof dojo == "undefined"){
+		this.dojo = {
+			_scopeName: "dojo",
+			_scopePrefix: "",
+			_scopePrefixArgs: "",
+			_scopeSuffix: "",
+			_scopeMap: {},
+			_scopeMapRev: {}
+		};
+	}
+
+	var d = dojo;
+
+	//Need placeholders for dijit and dojox for scoping code.
+	if(typeof dijit == "undefined"){
+		this.dijit = {_scopeName: "dijit"};
+	}
+	if(typeof dojox == "undefined"){
+		this.dojox = {_scopeName: "dojox"};
+	}
+	
+	if(!d._scopeArgs){
+		d._scopeArgs = [dojo, dijit, dojox];
+	}
+
+/*=====
+dojo.global = {
+	//	summary:
+	//		Alias for the global scope
+	//		(e.g. the window object in a browser).
+	//	description:
+	//		Refer to 'dojo.global' rather than referring to window to ensure your
+	//		code runs correctly in contexts other than web browsers (e.g. Rhino on a server).
+}
+=====*/
+	d.global = this;
+
+	d.config =/*===== djConfig = =====*/{
+		isDebug: false,
+		debugAtAllCosts: false
+	};
+
+	if(typeof djConfig != "undefined"){
+		for(var opt in djConfig){
+			d.config[opt] = djConfig[opt];
+		}
+	}
+
+	var _platforms = ["Browser", "Rhino", "Spidermonkey", "Mobile"];
+	var t;
+	while((t=_platforms.shift())){
+		d["is"+t] = false;
+	}
+
+/*=====
+	// Override locale setting, if specified
+	dojo.locale = {
+		// summary: the locale as defined by Dojo (read-only)
+	};
+=====*/
+	dojo.locale = d.config.locale;
+	
+	var rev = "$Rev: 15729 $".match(/\d+/);
+
+	dojo.version = {
+		// summary: 
+		//		version number of dojo
+		//	major: Integer
+		//		Major version. If total version is "1.2.0beta1", will be 1
+		//	minor: Integer
+		//		Minor version. If total version is "1.2.0beta1", will be 2
+		//	patch: Integer
+		//		Patch version. If total version is "1.2.0beta1", will be 0
+		//	flag: String
+		//		Descriptor flag. If total version is "1.2.0beta1", will be "beta1"
+		//	revision: Number
+		//		The SVN rev from which dojo was pulled
+		major: 1, minor: 2, patch: 2, flag: "",
+		revision: rev ? +rev[0] : 999999, //FIXME: use NaN?
+		toString: function(){
+			with(d.version){
+				return major + "." + minor + "." + patch + flag + " (" + revision + ")";	// String
+			}
+		}
+	}
+
+	// Register with the OpenAjax hub
+	if(typeof OpenAjax != "undefined"){
+		OpenAjax.hub.registerLibrary(dojo._scopeName, "http://dojotoolkit.org", d.version.toString());
+	}
+
+	dojo._mixin = function(/*Object*/ obj, /*Object*/ props){
+		// summary:
+		//		Adds all properties and methods of props to obj. This addition
+		//		is "prototype extension safe", so that instances of objects
+		//		will not pass along prototype defaults.
+		var tobj = {};
+		for(var x in props){
+			// the "tobj" condition avoid copying properties in "props"
+			// inherited from Object.prototype.  For example, if obj has a custom
+			// toString() method, don't overwrite it with the toString() method
+			// that props inherited from Object.prototype
+			if(tobj[x] === undefined || tobj[x] != props[x]){
+				obj[x] = props[x];
+			}
+		}
+		// IE doesn't recognize custom toStrings in for..in
+		if(d["isIE"] && props){
+			var p = props.toString;
+			if(typeof p == "function" && p != obj.toString && p != tobj.toString &&
+				p != "\nfunction toString() {\n    [native code]\n}\n"){
+					obj.toString = props.toString;
+			}
+		}
+		return obj; // Object
+	}
+
+	dojo.mixin = function(/*Object*/obj, /*Object...*/props){
+		// summary:	
+		//		Adds all properties and methods of props to obj and returns the
+		//		(now modified) obj.
+		//	description:
+		//		`dojo.mixin` can mix multiple source objects into a
+		//		destionation object which is then returned. Unlike regular
+		//		`for...in` iteration, `dojo.mixin` is also smart about avoiding
+		//		extensions which other toolkits may unwisely add to the root
+		//		object prototype
+		//	obj:
+		//		The object to mix properties into. Also the return value.
+		//	props:
+		//		One or more objects whose values are successively copied into
+		//		obj. If more than one of these objects contain the same value,
+		//		the one specified last in the function call will "win".
+		//	example:
+		//		make a shallow copy of an object
+		//	|	var copy = dojo.mixin({}, source);
+		//	example:
+		//		many class constructors often take an object which specifies
+		//		values to be configured on the object. In this case, it is
+		//		often simplest to call `dojo.mixin` on the `this` object:
+		//	|	dojo.declare("acme.Base", null, {
+		//	|		constructor: function(properties){
+		//	|			// property configuration:
+		//	|			dojo.mixin(this, properties);
+		//	|	
+		//	|			
+		//	|			//  ...
+		//	|		},
+		//	|		quip: "I wasn't born yesterday, you know - I've seen movies.",
+		//	|		// ...
+		//	|	});
+		//	|
+		//	|	// create an instance of the class and configure it
+		//	|	var b = new acme.Base({quip: "That's what it does!" });
+		//	example:
+		//		copy in properties from multiple objects
+		//	|	var flattened = dojo.mixin(
+		//	|		{
+		//	|			name: "Frylock",
+		//	|			braces: true
+		//	|		},
+		//	|		{
+		//	|			name: "Carl Brutanananadilewski"
+		//	|		}
+		//	|	);
+		//	|	
+		//	|	// will print "Carl Brutanananadilewski"
+		//	|	
+		//	|	// will print "true"
+		//	|	
+		for(var i=1, l=arguments.length; i<l; i++){
+			d._mixin(obj, arguments[i]);
+		}
+		return obj; // Object
+	}
+
+	dojo._getProp = function(/*Array*/parts, /*Boolean*/create, /*Object*/context){
+		var obj=context || d.global;
+		for(var i=0, p; obj && (p=parts[i]); i++){
+			if(i == 0 && this._scopeMap[p]){
+				p = this._scopeMap[p];
+			}
+			obj = (p in obj ? obj[p] : (create ? obj[p]={} : undefined));
+		}
+		return obj; // mixed
+	}
+
+	dojo.setObject = function(/*String*/name, /*Object*/value, /*Object?*/context){
+		// summary: 
+		//		Set a property from a dot-separated string, such as "A.B.C"
+		//	description: 
+		//		Useful for longer api chains where you have to test each object in
+		//		the chain, or when you have an object reference in string format.
+		//		Objects are created as needed along `path`. Returns the passed
+		//		value if setting is successful or `undefined` if not.
+		//	name: 	
+		//		Path to a property, in the form "A.B.C".
+		//	context:
+		//		Optional. Object to use as root of path. Defaults to
+		//		`dojo.global`.
+		//	example:
+		//		set the value of `foo.bar.baz`, regardless of whether
+		//		intermediate objects already exist:
+		//	|	dojo.setObject("foo.bar.baz", value);
+		//	example:
+		//		without `dojo.setObject`, we often see code like this:
+		//	|	// ensure that intermediate objects are available
+		//	|	if(!obj["parent"]){ obj.parent = {}; }
+		//	|	if(!obj.parent["child"]){ obj.parent.child= {}; }
+		//	|	// now we can safely set the property
+		//	|	obj.parent.child.prop = "some value";
+		//		wheras with `dojo.setObject`, we can shorten that to:
+		//	|	dojo.setObject("parent.child.prop", "some value", obj);
+		var parts=name.split("."), p=parts.pop(), obj=d._getProp(parts, true, context);
+		return obj && p ? (obj[p]=value) : undefined; // Object
+	}
+
+	dojo.getObject = function(/*String*/name, /*Boolean*/create, /*Object*/context){
+		// summary: 
+		//		Get a property from a dot-separated string, such as "A.B.C"
+		//	description: 
+		//		Useful for longer api chains where you have to test each object in
+		//		the chain, or when you have an object reference in string format.
+		//	name: 	
+		//		Path to an property, in the form "A.B.C".
+		//	context:
+		//		Optional. Object to use as root of path. Defaults to
+		//		'dojo.global'. Null may be passed.
+		//	create: 
+		//		Optional. Defaults to `false`. If `true`, Objects will be
+		//		created at any point along the 'path' that is undefined.
+		return d._getProp(name.split("."), create, context); // Object
+	}
+
+	dojo.exists = function(/*String*/name, /*Object?*/obj){
+		//	summary: 
+		//		determine if an object supports a given method
+		//	description: 
+		//		useful for longer api chains where you have to test each object in
+		//		the chain
+		//	name: 	
+		//		Path to an object, in the form "A.B.C".
+		//	obj:
+		//		Object to use as root of path. Defaults to
+		//		'dojo.global'. Null may be passed.
+		//	example:
+		//	|	// define an object
+		//	|	var foo = {
+		//	|		bar: { }
+		//	|	};
+		//	|
+		//	|	// search the global scope
+		//	|	dojo.exists("foo.bar"); // true
+		//	|	dojo.exists("foo.bar.baz"); // false
+		//	|
+		//	|	// search from a particular scope
+		//	|	dojo.exists("bar", foo); // true
+		//	|	dojo.exists("bar.baz", foo); // false
+		return !!d.getObject(name, false, obj); // Boolean
+	}
+
+
+	dojo["eval"] = function(/*String*/ scriptFragment){
+		//	summary: 
+		//		Perform an evaluation in the global scope. Use this rather than
+		//		calling 'eval()' directly.
+		//	description: 
+		//		Placed in a separate function to minimize size of trapped
+		//		exceptions. Calling eval() directly from some other scope may
+		//		complicate tracebacks on some platforms.
+		//	returns:
+		//		The result of the evaluation. Often `undefined`
+
+
+		// note:
+		//	 - JSC eval() takes an optional second argument which can be 'unsafe'.
+		//	 - Mozilla/SpiderMonkey eval() takes an optional second argument which is the
+		//  	 scope object for new symbols.
+
+		// FIXME: investigate Joseph Smarr's technique for IE:
+		//		http://josephsmarr.com/2007/01/31/fixing-eval-to-use-global-scope-in-ie/
+		//	see also:
+		// 		http://trac.dojotoolkit.org/ticket/744
+		return d.global.eval ? d.global.eval(scriptFragment) : eval(scriptFragment); 	// Object
+	}
+
+	/*=====
+		dojo.deprecated = function(behaviour, extra, removal){
+			//	summary: 
+			//		Log a debug message to indicate that a behavior has been
+			//		deprecated.
+			//	behaviour: String
+			//		The API or behavior being deprecated. Usually in the form
+			//		of "myApp.someFunction()".
+			//	extra: String?
+			//		Text to append to the message. Often provides advice on a
+			//		new function or facility to achieve the same goal during
+			//		the deprecation period.
+			//	removal: String?
+			//		Text to indicate when in the future the behavior will be
+			//		removed. Usually a version number.
+			//	example:
+			//	|	dojo.deprecated("myApp.getTemp()", "use myApp.getLocaleTemp() instead", "1.0");
+		}
+
+		dojo.experimental = function(moduleName, extra){
+			//	summary: Marks code as experimental.
+			//	description: 
+			//	 	This can be used to mark a function, file, or module as
+			//	 	experimental.  Experimental code is not ready to be used, and the
+			//	 	APIs are subject to change without notice.  Experimental code may be
+			//	 	completed deleted without going through the normal deprecation
+			//	 	process.
+			//	moduleName: String
+			//	 	The name of a module, or the name of a module file or a specific
+			//	 	function
+			//	extra: String?
+			//	 	some additional message for the user
+			//	example:
+			//	|	dojo.experimental("dojo.data.Result");
+			//	example:
+			//	|	dojo.experimental("dojo.weather.toKelvin()", "PENDING approval from NOAA");
+		}
+	=====*/
+
+	//Real functions declared in dojo._firebug.firebug.
+	d.deprecated = d.experimental = function(){};
+
+})();
+// vim:ai:ts=4:noet
+
+/*
+ * loader.js - A bootstrap module.  Runs before the hostenv_*.js file. Contains
+ * all of the package loading methods.
+ */
+
+(function(){
+	var d = dojo;
+
+	d.mixin(d, {
+		_loadedModules: {},
+		_inFlightCount: 0,
+		_hasResource: {},
+
+		_modulePrefixes: {
+			dojo: 	{	name: "dojo", value: "." },
+			// dojox: 	{	name: "dojox", value: "../dojox" },
+			// dijit: 	{	name: "dijit", value: "../dijit" },
+			doh: 	{	name: "doh", value: "../util/doh" },
+			tests: 	{	name: "tests", value: "tests" }
+		},
+
+		_moduleHasPrefix: function(/*String*/module){
+			// summary: checks to see if module has been established
+			var mp = this._modulePrefixes;
+			return !!(mp[module] && mp[module].value); // Boolean
+		},
+
+		_getModulePrefix: function(/*String*/module){
+			// summary: gets the prefix associated with module
+			var mp = this._modulePrefixes;
+			if(this._moduleHasPrefix(module)){
+				return mp[module].value; // String
+			}
+			return module; // String
+		},
+
+		_loadedUrls: [],
+
+		//WARNING: 
+		//		This variable is referenced by packages outside of bootstrap:
+		//		FloatingPane.js and undo/browser.js
+		_postLoad: false,
+		
+		//Egad! Lots of test files push on this directly instead of using dojo.addOnLoad.
+		_loaders: [],
+		_unloaders: [],
+		_loadNotifying: false
+	});
+
+
+		dojo._loadPath = function(/*String*/relpath, /*String?*/module, /*Function?*/cb){
+		// 	summary:
+		//		Load a Javascript module given a relative path
+		//
+		//	description:
+		//		Loads and interprets the script located at relpath, which is
+		//		relative to the script root directory.  If the script is found but
+		//		its interpretation causes a runtime exception, that exception is
+		//		not caught by us, so the caller will see it.  We return a true
+		//		value if and only if the script is found.
+		//
+		// relpath: 
+		//		A relative path to a script (no leading '/', and typically ending
+		//		in '.js').
+		// module: 
+		//		A module whose existance to check for after loading a path.  Can be
+		//		used to determine success or failure of the load.
+		// cb: 
+		//		a callback function to pass the result of evaluating the script
+
+		var uri = ((relpath.charAt(0) == '/' || relpath.match(/^\w+:/)) ? "" : this.baseUrl) + relpath;
+		try{
+			return !module ? this._loadUri(uri, cb) : this._loadUriAndCheck(uri, module, cb); // Boolean
+		}catch(e){
+			console.error(e);
+			return false; // Boolean
+		}
+	}
+
+	dojo._loadUri = function(/*String*/uri, /*Function?*/cb){
+		//	summary:
+		//		Loads JavaScript from a URI
+		//	description:
+		//		Reads the contents of the URI, and evaluates the contents.  This is
+		//		used to load modules as well as resource bundles. Returns true if
+		//		it succeeded. Returns false if the URI reading failed.  Throws if
+		//		the evaluation throws.
+		//	uri: a uri which points at the script to be loaded
+		//	cb: 
+		//		a callback function to process the result of evaluating the script
+		//		as an expression, typically used by the resource bundle loader to
+		//		load JSON-style resources
+
+		if(this._loadedUrls[uri]){
+			return true; // Boolean
+		}
+		var contents = this._getText(uri, true);
+		if(!contents){ return false; } // Boolean
+		this._loadedUrls[uri] = true;
+		this._loadedUrls.push(uri);
+		if(cb){
+			contents = '('+contents+')';
+		}else{
+			//Only do the scoping if no callback. If a callback is specified,
+			//it is most likely the i18n bundle stuff.
+			contents = this._scopePrefix + contents + this._scopeSuffix;
+		}
+		if(d.isMoz){ contents += "\r\n//@ sourceURL=" + uri; } // debugging assist for Firebug
+		var value = d["eval"](contents);
+		if(cb){ cb(value); }
+		return true; // Boolean
+	}
+	
+	// FIXME: probably need to add logging to this method
+	dojo._loadUriAndCheck = function(/*String*/uri, /*String*/moduleName, /*Function?*/cb){
+		// summary: calls loadUri then findModule and returns true if both succeed
+		var ok = false;
+		try{
+			ok = this._loadUri(uri, cb);
+		}catch(e){
+			console.error("failed loading " + uri + " with error: " + e);
+		}
+		return !!(ok && this._loadedModules[moduleName]); // Boolean
+	}
+
+	dojo.loaded = function(){
+		// summary:
+		//		signal fired when initial environment and package loading is
+		//		complete. You may use dojo.addOnLoad() or dojo.connect() to
+		//		this method in order to handle initialization tasks that
+		//		require the environment to be initialized. In a browser host,
+		//		declarative widgets will be constructed when this function
+		//		finishes runing.
+		this._loadNotifying = true;
+		this._postLoad = true;
+		var mll = d._loaders;
+
+		//Clear listeners so new ones can be added
+		//For other xdomain package loads after the initial load.
+		this._loaders = [];
+
+		for(var x = 0; x < mll.length; x++){
+			mll[x]();
+		}
+
+		this._loadNotifying = false;
+		
+		//Make sure nothing else got added to the onload queue
+		//after this first run. If something did, and we are not waiting for any
+		//more inflight resources, run again.
+		if(d._postLoad && d._inFlightCount == 0 && mll.length){
+			d._callLoaded();
+		}
+	}
+
+	dojo.unloaded = function(){
+		// summary:
+		//		signal fired by impending environment destruction. You may use
+		//		dojo.addOnUnload() or dojo.connect() to this method to perform
+		//		page/application cleanup methods. See dojo.addOnUnload for more info.
+		var mll = this._unloaders;
+		while(mll.length){
+			(mll.pop())();
+		}
+	}
+
+	d._onto = function(arr, obj, fn){
+		if(!fn){
+			arr.push(obj);
+		}else if(fn){
+			var func = (typeof fn == "string") ? obj[fn] : fn;
+			arr.push(function(){ func.call(obj); });
+		}
+	}
+
+	dojo.addOnLoad = function(/*Object?*/obj, /*String|Function*/functionName){
+		// summary:
+		//		Registers a function to be triggered after the DOM has finished
+		//		loading and widgets declared in markup have been instantiated.
+		//		Images and CSS files may or may not have finished downloading when
+		//		the specified function is called.  (Note that widgets' CSS and HTML
+		//		code is guaranteed to be downloaded before said widgets are
+		//		instantiated.)
+		// example:
+		//	|	dojo.addOnLoad(functionPointer);
+		//	|	dojo.addOnLoad(object, "functionName");
+		//	|	dojo.addOnLoad(object, function(){ /* ... */});
+
+		d._onto(d._loaders, obj, functionName);
+
+		//Added for xdomain loading. dojo.addOnLoad is used to
+		//indicate callbacks after doing some dojo.require() statements.
+		//In the xdomain case, if all the requires are loaded (after initial
+		//page load), then immediately call any listeners.
+		if(d._postLoad && d._inFlightCount == 0 && !d._loadNotifying){
+			d._callLoaded();
+		}
+	}
+
+	//Support calling dojo.addOnLoad via djConfig.addOnLoad. Support all the
+	//call permutations of dojo.addOnLoad. Mainly useful when dojo is added
+	//to the page after the page has loaded.
+	var dca = d.config.addOnLoad;
+	if(dca){
+		d.addOnLoad[(dca instanceof Array ? "apply" : "call")](d, dca);
+	}
+
+	dojo.addOnUnload = function(/*Object?*/obj, /*String|Function?*/functionName){
+		// summary:
+		//		registers a function to be triggered when the page unloads. In a browser
+		//		enviroment, the functions will be triggered during the window.onbeforeunload
+		//		event. Be careful doing work during window.onbeforeunload. onbeforeunload
+		//		can be triggered if a link to download a file is clicked, or if the link is a
+		//		javascript: link. In these cases, the onbeforeunload event fires, but the
+		//		document is not actually destroyed. So be careful about doing destructive
+		//		operations in a dojo.addOnUnload callback.
+		// example:
+		//	|	dojo.addOnUnload(functionPointer)
+		//	|	dojo.addOnUnload(object, "functionName")
+		//	|	dojo.addOnUnload(object, function(){ /* ... */});
+
+		d._onto(d._unloaders, obj, functionName);
+	}
+
+	dojo._modulesLoaded = function(){
+		if(d._postLoad){ return; }
+		if(d._inFlightCount > 0){ 
+			console.warn("files still in flight!");
+			return;
+		}
+		d._callLoaded();
+	}
+
+	dojo._callLoaded = function(){
+
+		// The "object" check is for IE, and the other opera check fixes an
+		// issue in Opera where it could not find the body element in some
+		// widget test cases.  For 0.9, maybe route all browsers through the
+		// setTimeout (need protection still for non-browser environments
+		// though). This might also help the issue with FF 2.0 and freezing
+		// issues where we try to do sync xhr while background css images are
+		// being loaded (trac #2572)? Consider for 0.9.
+		if(typeof setTimeout == "object" || (dojo.config.useXDomain && d.isOpera)){
+			if(dojo.isAIR){
+				setTimeout(function(){dojo.loaded();}, 0);
+			}else{
+				setTimeout(dojo._scopeName + ".loaded();", 0);
+			}
+		}else{
+			d.loaded();
+		}
+	}
+
+	dojo._getModuleSymbols = function(/*String*/modulename){
+		// summary:
+		//		Converts a module name in dotted JS notation to an array
+		//		representing the path in the source tree
+		var syms = modulename.split(".");
+		for(var i = syms.length; i>0; i--){
+			var parentModule = syms.slice(0, i).join(".");
+			if((i==1) && !this._moduleHasPrefix(parentModule)){		
+				// Support default module directory (sibling of dojo) for top-level modules 
+				syms[0] = "../" + syms[0];
+			}else{
+				var parentModulePath = this._getModulePrefix(parentModule);
+				if(parentModulePath != parentModule){
+					syms.splice(0, i, parentModulePath);
+					break;
+				}
+			}
+		}
+		// 
+		return syms; // Array
+	}
+
+	dojo._global_omit_module_check = false;
+
+	dojo.loadInit = function(/*Function*/init){
+		//	summary:
+		//		Executes a function that needs to be executed for the loader's dojo.requireIf
+		//		resolutions to work. This is needed mostly for the xdomain loader case where
+		//		a function needs to be executed to set up the possible values for a dojo.requireIf
+		//		call.
+		//	init:
+		//		a function reference. Executed immediately.
+		//	description: This function is mainly a marker for the xdomain loader to know parts of
+		//		code that needs be executed outside the function wrappper that is placed around modules.
+		//		The init function could be executed more than once, and it should make no assumptions
+		//		on what is loaded, or what modules are available. Only the functionality in Dojo Base
+		//		is allowed to be used. Avoid using this method. For a valid use case,
+		//		see the source for dojox.gfx.
+		init();
+	}
+
+	dojo._loadModule = dojo.require = function(/*String*/moduleName, /*Boolean?*/omitModuleCheck){
+		//	summary:
+		//		loads a Javascript module from the appropriate URI
+		//	moduleName:
+		//		module name to load, using periods for separators,
+		//		 e.g. "dojo.date.locale".  Module paths are de-referenced by dojo's
+		//		internal mapping of locations to names and are disambiguated by
+		//		longest prefix. See `dojo.registerModulePath()` for details on
+		//		registering new modules.
+		//	omitModuleCheck:
+		//		if `true`, omitModuleCheck skips the step of ensuring that the
+		//		loaded file actually defines the symbol it is referenced by.
+		//		For example if it called as `dojo.require("a.b.c")` and the
+		//		file located at `a/b/c.js` does not define an object `a.b.c`,
+		//		and exception will be throws whereas no exception is raised
+		//		when called as `dojo.require("a.b.c", true)`
+		//	description:
+		//		`dojo.require("A.B")` first checks to see if symbol A.B is
+		//		defined. If it is, it is simply returned (nothing to do).
+		//	
+		//		If it is not defined, it will look for `A/B.js` in the script root
+		//		directory.
+		//	
+		//		`dojo.require` throws an excpetion if it cannot find a file
+		//		to load, or if the symbol `A.B` is not defined after loading.
+		//	
+		//		It returns the object `A.B`.
+		//	
+		//		`dojo.require()` does nothing about importing symbols into
+		//		the current namespace.  It is presumed that the caller will
+		//		take care of that. For example, to import all symbols into a
+		//		local block, you might write:
+		//	
+		//		|	with (dojo.require("A.B")) {
+		//		|		...
+		//		|	}
+		//	
+		//		And to import just the leaf symbol to a local variable:
+		//	
+		//		|	var B = dojo.require("A.B");
+		//	   	|	...
+		//	returns: the required namespace object
+		omitModuleCheck = this._global_omit_module_check || omitModuleCheck;
+
+		//Check if it is already loaded.
+		var module = this._loadedModules[moduleName];
+		if(module){
+			return module;
+		}
+
+		// convert periods to slashes
+		var relpath = this._getModuleSymbols(moduleName).join("/") + '.js';
+
+		var modArg = (!omitModuleCheck) ? moduleName : null;
+		var ok = this._loadPath(relpath, modArg);
+
+		if(!ok && !omitModuleCheck){
+			throw new Error("Could not load '" + moduleName + "'; last tried '" + relpath + "'");
+		}
+
+		// check that the symbol was defined
+		// Don't bother if we're doing xdomain (asynchronous) loading.
+		if(!omitModuleCheck && !this._isXDomain){
+			// pass in false so we can give better error
+			module = this._loadedModules[moduleName];
+			if(!module){
+				throw new Error("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'"); 
+			}
+		}
+
+		return module;
+	}
+
+	dojo.provide = function(/*String*/ resourceName){
+		//	summary:
+		//		Each javascript source file must have at least one
+		//		`dojo.provide()` call at the top of the file, corresponding to
+		//		the file name.  For example, `js/dojo/foo.js` must have
+		//		`dojo.provide("dojo.foo");` before any calls to
+		//		`dojo.require()` are made.
+		//	description:
+		//		Each javascript source file is called a resource.  When a
+		//		resource is loaded by the browser, `dojo.provide()` registers
+		//		that it has been loaded.
+		//	
+		//		For backwards compatibility reasons, in addition to registering
+		//		the resource, `dojo.provide()` also ensures that the javascript
+		//		object for the module exists.  For example,
+		//		`dojo.provide("dojox.data.FlickrStore")`, in addition to
+		//		registering that `FlickrStore.js` is a resource for the
+		//		`dojox.data` module, will ensure that the `dojox.data`
+		//		javascript object exists, so that calls like 
+		//		`dojo.data.foo = function(){ ... }` don't fail.
+		//
+		//		In the case of a build where multiple javascript source files
+		//		are combined into one bigger file (similar to a .lib or .jar
+		//		file), that file may contain multiple dojo.provide() calls, to
+		//		note that it includes multiple resources.
+
+		//Make sure we have a string.
+		resourceName = resourceName + "";
+		return (d._loadedModules[resourceName] = d.getObject(resourceName, true)); // Object
+	}
+
+	//Start of old bootstrap2:
+
+	dojo.platformRequire = function(/*Object*/modMap){
+		//	summary:
+		//		require one or more modules based on which host environment
+		//		Dojo is currently operating in
+		//	description:
+		//		This method takes a "map" of arrays which one can use to
+		//		optionally load dojo modules. The map is indexed by the
+		//		possible dojo.name_ values, with two additional values:
+		//		"default" and "common". The items in the "default" array will
+		//		be loaded if none of the other items have been choosen based on
+		//		dojo.name_, set by your host environment. The items in the
+		//		"common" array will *always* be loaded, regardless of which
+		//		list is chosen.
+		//	example:
+		//		|	dojo.platformRequire({
+		//		|		browser: [
+		//		|			"foo.sample", // simple module
+		//		|			"foo.test",
+		//		|			["foo.bar.baz", true] // skip object check in _loadModule (dojo.require)
+		//		|		],
+		//		|		default: [ "foo.sample._base" ],
+		//		|		common: [ "important.module.common" ]
+		//		|	});
+
+		var common = modMap.common || [];
+		var result = common.concat(modMap[d._name] || modMap["default"] || []);
+
+		for(var x=0; x<result.length; x++){
+			var curr = result[x];
+			if(curr.constructor == Array){
+				d._loadModule.apply(d, curr);
+			}else{
+				d._loadModule(curr);
+			}
+		}
+	}
+
+	dojo.requireIf = function(/*Boolean*/ condition, /*String*/ resourceName){
+		// summary:
+		//		If the condition is true then call dojo.require() for the specified
+		//		resource
+		if(condition === true){
+			// FIXME: why do we support chained require()'s here? does the build system?
+			var args = [];
+			for(var i = 1; i < arguments.length; i++){ 
+				args.push(arguments[i]);
+			}
+			d.require.apply(d, args);
+		}
+	}
+
+	dojo.requireAfterIf = d.requireIf;
+
+	dojo.registerModulePath = function(/*String*/module, /*String*/prefix){
+		//	summary: 
+		//		maps a module name to a path
+		//	description: 
+		//		An unregistered module is given the default path of ../[module],
+		//		relative to Dojo root. For example, module acme is mapped to
+		//		../acme.  If you want to use a different module name, use
+		//		dojo.registerModulePath. 
+		//	example:
+		//		If your dojo.js is located at this location in the web root:
+		//	|	/myapp/js/dojo/dojo/dojo.js
+		//		and your modules are located at:
+		//	|	/myapp/js/foo/bar.js
+		//	|	/myapp/js/foo/baz.js
+		//	|	/myapp/js/foo/thud/xyzzy.js
+		//		Your application can tell Dojo to locate the "foo" namespace by calling:
+		//	|	dojo.registerModulePath("foo", "../../foo");
+		//		At which point you can then use dojo.require() to load the
+		//		modules (assuming they provide() the same things which are
+		//		required). The full code might be:
+		//	|	<script type="text/javascript" 
+		//	|		src="/myapp/js/dojo/dojo/dojo.js"></script>
+		//	|	<script type="text/javascript">
+		//	|		dojo.registerModulePath("foo", "../../foo");
+		//	|		dojo.require("foo.bar");
+		//	|		dojo.require("foo.baz");
+		//	|		dojo.require("foo.thud.xyzzy");
+		//	|	</script>
+		d._modulePrefixes[module] = { name: module, value: prefix };
+	}
+
+	dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String?*/availableFlatLocales){
+		// summary:
+		//		Declares translated resources and loads them if necessary, in the
+		//		same style as dojo.require.  Contents of the resource bundle are
+		//		typically strings, but may be any name/value pair, represented in
+		//		JSON format.  See also `dojo.i18n.getLocalization`.
+		//
+		// description:
+		//		Load translated resource bundles provided underneath the "nls"
+		//		directory within a package.  Translated resources may be located in
+		//		different packages throughout the source tree.  
+		//
+		//		Each directory is named for a locale as specified by RFC 3066,
+		//		(http://www.ietf.org/rfc/rfc3066.txt), normalized in lowercase.
+		//		Note that the two bundles in the example do not define all the
+		//		same variants.  For a given locale, bundles will be loaded for
+		//		that locale and all more general locales above it, including a
+		//		fallback at the root directory.  For example, a declaration for
+		//		the "de-at" locale will first load `nls/de-at/bundleone.js`,
+		//		then `nls/de/bundleone.js` and finally `nls/bundleone.js`.  The
+		//		data will be flattened into a single Object so that lookups
+		//		will follow this cascading pattern.  An optional build step can
+		//		preload the bundles to avoid data redundancy and the multiple
+		//		network hits normally required to load these resources.
+		//
+		// moduleName: 
+		//		name of the package containing the "nls" directory in which the
+		//		bundle is found
+		//
+		// bundleName: 
+		//		bundle name, i.e. the filename without the '.js' suffix
+		//
+		// locale: 
+		//		the locale to load (optional)  By default, the browser's user
+		//		locale as defined by dojo.locale
+		//
+		// availableFlatLocales: 
+		//		A comma-separated list of the available, flattened locales for this
+		//		bundle. This argument should only be set by the build process.
+		//
+		//	example:
+		//		A particular widget may define one or more resource bundles,
+		//		structured in a program as follows, where moduleName is
+		//		mycode.mywidget and bundleNames available include bundleone and
+		//		bundletwo:
+		//	|		...
+		//	|	mycode/
+		//	|		mywidget/
+		//	|			nls/
+		//	|				bundleone.js (the fallback translation, English in this example)
+		//	|				bundletwo.js (also a fallback translation)
+		//	|				de/
+		//	|					bundleone.js
+		//	|					bundletwo.js
+		//	|				de-at/
+		//	|					bundleone.js
+		//	|				en/
+		//	|					(empty; use the fallback translation)
+		//	|				en-us/
+		//	|					bundleone.js
+		//	|				en-gb/
+		//	|					bundleone.js
+		//	|				es/
+		//	|					bundleone.js
+		//	|					bundletwo.js
+		//	|				  ...etc
+		//	|				...
+		//
+
+		d.require("dojo.i18n");
+		d.i18n._requireLocalization.apply(d.hostenv, arguments);
+	};
+
+
+	var ore = new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$");
+	var ire = new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");
+
+	dojo._Url = function(/*dojo._Url||String...*/){
+		// summary: 
+		//		Constructor to create an object representing a URL.
+		//		It is marked as private, since we might consider removing
+		//		or simplifying it.
+		// description: 
+		//		Each argument is evaluated in order relative to the next until
+		//		a canonical uri is produced. To get an absolute Uri relative to
+		//		the current document use:
+		//      	new dojo._Url(document.baseURI, url)
+
+		var n = null;
+
+		var _a = arguments;
+		var uri = [_a[0]];
+		// resolve uri components relative to each other
+		for(var i = 1; i<_a.length; i++){
+			if(!_a[i]){ continue; }
+
+			// Safari doesn't support this.constructor so we have to be explicit
+			// FIXME: Tracked (and fixed) in Webkit bug 3537.
+			//		http://bugs.webkit.org/show_bug.cgi?id=3537
+			var relobj = new d._Url(_a[i]+"");
+			var uriobj = new d._Url(uri[0]+"");
+
+			if(
+				relobj.path == "" &&
+				!relobj.scheme &&
+				!relobj.authority &&
+				!relobj.query
+			){
+				if(relobj.fragment != n){
+					uriobj.fragment = relobj.fragment;
+				}
+				relobj = uriobj;
+			}else if(!relobj.scheme){
+				relobj.scheme = uriobj.scheme;
+
+				if(!relobj.authority){
+					relobj.authority = uriobj.authority;
+
+					if(relobj.path.charAt(0) != "/"){
+						var path = uriobj.path.substring(0,
+							uriobj.path.lastIndexOf("/") + 1) + relobj.path;
+
+						var segs = path.split("/");
+						for(var j = 0; j < segs.length; j++){
+							if(segs[j] == "."){
+								// flatten "./" references
+								if(j == segs.length - 1){
+									segs[j] = "";
+								}else{
+									segs.splice(j, 1);
+									j--;
+								}
+							}else if(j > 0 && !(j == 1 && segs[0] == "") &&
+								segs[j] == ".." && segs[j-1] != ".."){
+								// flatten "../" references
+								if(j == (segs.length - 1)){
+									segs.splice(j, 1);
+									segs[j - 1] = "";
+								}else{
+									segs.splice(j - 1, 2);
+									j -= 2;
+								}
+							}
+						}
+						relobj.path = segs.join("/");
+					}
+				}
+			}
+
+			uri = [];
+			if(relobj.scheme){ 
+				uri.push(relobj.scheme, ":");
+			}
+			if(relobj.authority){
+				uri.push("//", relobj.authority);
+			}
+			uri.push(relobj.path);
+			if(relobj.query){
+				uri.push("?", relobj.query);
+			}
+			if(relobj.fragment){
+				uri.push("#", relobj.fragment);
+			}
+		}
+
+		this.uri = uri.join("");
+
+		// break the uri into its main components
+		var r = this.uri.match(ore);
+
+		this.scheme = r[2] || (r[1] ? "" : n);
+		this.authority = r[4] || (r[3] ? "" : n);
+		this.path = r[5]; // can never be undefined
+		this.query = r[7] || (r[6] ? "" : n);
+		this.fragment  = r[9] || (r[8] ? "" : n);
+
+		if(this.authority != n){
+			// server based naming authority
+			r = this.authority.match(ire);
+
+			this.user = r[3] || n;
+			this.password = r[4] || n;
+			this.host = r[6] || r[7]; // ipv6 || ipv4
+			this.port = r[9] || n;
+		}
+	}
+
+	dojo._Url.prototype.toString = function(){ return this.uri; };
+
+	dojo.moduleUrl = function(/*String*/module, /*dojo._Url||String*/url){
+		//	summary: 
+		//		Returns a `dojo._Url` object relative to a module.
+		//	example:
+		//	|	var pngPath = dojo.moduleUrl("acme","images/small.png");
+		//	|	 // list the object properties
+		//	|	// create an image and set it's source to pngPath's value:
+		//	|	var img = document.createElement("img");
+		// 	|	// NOTE: we assign the string representation of the url object
+		//	|	img.src = pngPath.toString(); 
+		//	|	// add our image to the document
+		//	|	dojo.body().appendChild(img);
+		//	example: 
+		//		you may de-reference as far as you like down the package
+		//		hierarchy.  This is sometimes handy to avoid lenghty relative
+		//		urls or for building portable sub-packages. In this example,
+		//		the `acme.widget` and `acme.util` directories may be located
+		//		under different roots (see `dojo.registerModulePath`) but the
+		//		the modules which reference them can be unaware of their
+		//		relative locations on the filesystem:
+		//	|	// somewhere in a configuration block
+		//	|	dojo.registerModulePath("acme.widget", "../../acme/widget");
+		//	|	dojo.registerModulePath("acme.util", "../../util");
+		//	|	
+		//	|	// ...
+		//	|	
+		//	|	// code in a module using acme resources
+		//	|	var tmpltPath = dojo.moduleUrl("acme.widget","templates/template.html");
+		//	|	var dataPath = dojo.moduleUrl("acme.util","resources/data.json");
+
+		var loc = d._getModuleSymbols(module).join('/');
+		if(!loc){ return null; }
+		if(loc.lastIndexOf("/") != loc.length-1){
+			loc += "/";
+		}
+		
+		//If the path is an absolute path (starts with a / or is on another
+		//domain/xdomain) then don't add the baseUrl.
+		var colonIndex = loc.indexOf(":");
+		if(loc.charAt(0) != "/" && (colonIndex == -1 || colonIndex > loc.indexOf("/"))){
+			loc = d.baseUrl + loc;
+		}
+
+		return new d._Url(loc, url); // String
+	}
+})();
+
+/*=====
+dojo.isBrowser = {
+	//	example:
+	//	|	if(dojo.isBrowser){ ... }
+};
+
+dojo.isFF = {
+	//	example:
+	//	|	if(dojo.isFF > 1){ ... }
+};
+
+dojo.isIE = {
+	// example:
+	//	|	if(dojo.isIE > 6){
+	//	|		// we are IE7
+	// 	|	}
+};
+
+dojo.isSafari = {
+	//	example:
+	//	|	if(dojo.isSafari){ ... }
+	//	example: 
+	//		Detect iPhone:
+	//	|	if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){ 
+	//	|		// we are iPhone. Note, iPod touch reports "iPod" above and fails this test.
+	//	|	}
+};
+
+dojo = {
+	// isBrowser: Boolean
+	//		True if the client is a web-browser
+	isBrowser: true,
+	//	isFF: Number | undefined
+	//		Version as a Number if client is FireFox. undefined otherwise. Corresponds to
+	//		major detected FireFox version (1.5, 2, 3, etc.)
+	isFF: 2,
+	//	isIE: Number | undefined
+	//		Version as a Number if client is MSIE(PC). undefined otherwise. Corresponds to
+	//		major detected IE version (6, 7, 8, etc.)
+	isIE: 6,
+	//	isKhtml: Number | undefined
+	//		Version as a Number if client is a KTHML-derived browser (Konqueror,
+	//		Safari, etc.). undefined otherwise. Corresponds to major detected version.
+	isKhtml: 0,
+	//	isMozilla: Number | undefined
+	//		Version as a Number if client is a Mozilla-based browser (Firefox,
+	//		SeaMonkey). undefined otherwise. Corresponds to major detected version.
+	isMozilla: 0,
+	//	isOpera: Number | undefined
+	//		Version as a Number if client is Opera. undefined otherwise. Corresponds to
+	//		major detected version.
+	isOpera: 0,
+	//	isSafari: Number | undefined
+	//		Version as a Number if client is Safari or iPhone. undefined otherwise.
+	isSafari: 0
+}
+=====*/
+
+if(typeof window != 'undefined'){
+	dojo.isBrowser = true;
+	dojo._name = "browser";
+
+
+	// attempt to figure out the path to dojo if it isn't set in the config
+	(function(){
+		var d = dojo;
+		// this is a scope protection closure. We set browser versions and grab
+		// the URL we were loaded from here.
+
+		// grab the node we were loaded from
+		if(document && document.getElementsByTagName){
+			var scripts = document.getElementsByTagName("script");
+			var rePkg = /dojo(\.xd)?\.js(\W|$)/i;
+			for(var i = 0; i < scripts.length; i++){
+				var src = scripts[i].getAttribute("src");
+				if(!src){ continue; }
+				var m = src.match(rePkg);
+				if(m){
+					// find out where we came from
+					if(!d.config.baseUrl){
+						d.config.baseUrl = src.substring(0, m.index);
+					}
+					// and find out if we need to modify our behavior
+					var cfg = scripts[i].getAttribute("djConfig");
+					if(cfg){
+						var cfgo = eval("({ "+cfg+" })");
+						for(var x in cfgo){
+							dojo.config[x] = cfgo[x];
+						}
+					}
+					break; // "first Dojo wins"
+				}
+			}
+		}
+		d.baseUrl = d.config.baseUrl;
+
+		// fill in the rendering support information in dojo.render.*
+		var n = navigator;
+		var dua = n.userAgent;
+		var dav = n.appVersion;
+		var tv = parseFloat(dav);
+
+		if(dua.indexOf("Opera") >= 0){ d.isOpera = tv; }
+		// safari detection derived from:
+		//		http://developer.apple.com/internet/safari/faq.html#anchor2
+		//		http://developer.apple.com/internet/safari/uamatrix.html
+		var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
+		if(index){
+			// try to grab the explicit Safari version first. If we don't get
+			// one, look for 419.3+ as the indication that we're on something
+			// "Safari 3-ish". Lastly, default to "Safari 2" handling.
+			d.isSafari = parseFloat(dav.split("Version/")[1]) ||
+				(parseFloat(dav.substr(index + 7)) > 419.3) ? 3 : 2;
+		}
+		if(dua.indexOf("AdobeAIR") >= 0){ d.isAIR = 1; }
+		if(dav.indexOf("Konqueror") >= 0 || d.isSafari){ d.isKhtml =  tv; }
+		if(dua.indexOf("Gecko") >= 0 && !d.isKhtml){ d.isMozilla = d.isMoz = tv; }
+		if(d.isMoz){
+			d.isFF = parseFloat(dua.split("Firefox/")[1]) || undefined;
+		}
+		if(document.all && !d.isOpera){
+			d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
+		}
+
+		//Workaround to get local file loads of dojo to work on IE 7
+		//by forcing to not use native xhr.
+		if(dojo.isIE && window.location.protocol === "file:"){
+			dojo.config.ieForceActiveXXhr=true;
+		}
+
+		var cm = document.compatMode;
+		d.isQuirks = cm == "BackCompat" || cm == "QuirksMode" || d.isIE < 6;
+
+		// TODO: is the HTML LANG attribute relevant?
+		d.locale = dojo.config.locale || (d.isIE ? n.userLanguage : n.language).toLowerCase();
+
+		// These are in order of decreasing likelihood; this will change in time.
+		d._XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
+
+		d._xhrObj = function(){
+			// summary: 
+			//		does the work of portably generating a new XMLHTTPRequest
+			//		object.
+			var http = null;
+			var last_e = null;
+			if(!dojo.isIE || !dojo.config.ieForceActiveXXhr){
+				try{ http = new XMLHttpRequest(); }catch(e){}
+			}
+			if(!http){
+				for(var i=0; i<3; ++i){
+					var progid = d._XMLHTTP_PROGIDS[i];
+					try{
+						http = new ActiveXObject(progid);
+					}catch(e){
+						last_e = e;
+					}
+
+					if(http){
+						d._XMLHTTP_PROGIDS = [progid];  // so faster next time
+						break;
+					}
+				}
+			}
+
+			if(!http){
+				throw new Error("XMLHTTP not available: "+last_e);
+			}
+
+			return http; // XMLHTTPRequest instance
+		}
+
+		d._isDocumentOk = function(http){
+			var stat = http.status || 0;
+			return (stat >= 200 && stat < 300) || 	// Boolean
+				stat == 304 || 						// allow any 2XX response code
+				stat == 1223 || 						// get it out of the cache
+				(!stat && (location.protocol=="file:" || location.protocol=="chrome:") ); // Internet Explorer mangled the status code
+		}
+
+		//See if base tag is in use.
+		//This is to fix http://trac.dojotoolkit.org/ticket/3973,
+		//but really, we need to find out how to get rid of the dojo._Url reference
+		//below and still have DOH work with the dojo.i18n test following some other
+		//test that uses the test frame to load a document (trac #2757).
+		//Opera still has problems, but perhaps a larger issue of base tag support
+		//with XHR requests (hasBase is true, but the request is still made to document
+		//path, not base path).
+		var owloc = window.location+"";
+		var base = document.getElementsByTagName("base");
+		var hasBase = (base && base.length > 0);
+
+		d._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
+			// summary: Read the contents of the specified uri and return those contents.
+			// uri:
+			//		A relative or absolute uri. If absolute, it still must be in
+			//		the same "domain" as we are.
+			// fail_ok:
+			//		Default false. If fail_ok and loading fails, return null
+			//		instead of throwing.
+			// returns: The response text. null is returned when there is a
+			//		failure and failure is okay (an exception otherwise)
+
+			// alert("_getText: " + uri);
+
+			// NOTE: must be declared before scope switches ie. this._xhrObj()
+			var http = this._xhrObj();
+
+			if(!hasBase && dojo._Url){
+				uri = (new dojo._Url(owloc, uri)).toString();
+			}
+			/*
+			
+			
+			alert(uri);
+			*/
+
+			if(d.config.cacheBust){
+				//Make sure we have a string before string methods are used on uri
+				uri += "";
+				uri += (uri.indexOf("?") == -1 ? "?" : "&") + String(d.config.cacheBust).replace(/\W+/g,"");
+			}
+
+			http.open('GET', uri, false);
+			try{
+				http.send(null);
+				// alert(http);
+				if(!d._isDocumentOk(http)){
+					var err = Error("Unable to load "+uri+" status:"+ http.status);
+					err.status = http.status;
+					err.responseText = http.responseText;
+					throw err;
+				}
+			}catch(e){
+				if(fail_ok){ return null; } // null
+				// rethrow the exception
+				throw e;
+			}
+			return http.responseText; // String
+		}
+		
+		d._windowUnloaders = [];
+		
+		d.windowUnloaded = function(){
+			// summary:
+			//		signal fired by impending window destruction. You may use
+			//		dojo.addOnWIndowUnload() or dojo.connect() to this method to perform
+			//		page/application cleanup methods. See dojo.addOnWindowUnload for more info.
+			var mll = this._windowUnloaders;
+			while(mll.length){
+				(mll.pop())();
+			}
+		}
+
+		d.addOnWindowUnload = function(/*Object?*/obj, /*String|Function?*/functionName){
+			// summary:
+			//		registers a function to be triggered when window.onunload fires.
+			//		Be careful trying to modify the DOM or access JavaScript properties
+			//		during this phase of page unloading: they may not always be available.
+			//		Consider dojo.addOnUnload() if you need to modify the DOM or do heavy
+			//		JavaScript work.
+			// example:
+			//	|	dojo.addOnWindowUnload(functionPointer)
+			//	|	dojo.addOnWindowUnload(object, "functionName")
+			//	|	dojo.addOnWindowUnload(object, function(){ /* ... */});
+	
+			d._onto(d._windowUnloaders, obj, functionName);
+		}
+	})();
+
+	dojo._initFired = false;
+	//	BEGIN DOMContentLoaded, from Dean Edwards (http://dean.edwards.name/weblog/2006/06/again/)
+	dojo._loadInit = function(e){
+		dojo._initFired = true;
+		// allow multiple calls, only first one will take effect
+		// A bug in khtml calls events callbacks for document for event which isnt supported
+		// for example a created contextmenu event calls DOMContentLoaded, workaround
+		var type = (e && e.type) ? e.type.toLowerCase() : "load";
+		if(arguments.callee.initialized || (type != "domcontentloaded" && type != "load")){ return; }
+		arguments.callee.initialized = true;
+		if("_khtmlTimer" in dojo){
+			clearInterval(dojo._khtmlTimer);
+			delete dojo._khtmlTimer;
+		}
+
+		if(dojo._inFlightCount == 0){
+			dojo._modulesLoaded();
+		}
+	}
+
+	dojo._fakeLoadInit = function(){
+		dojo._loadInit({type: "load"});
+	}
+
+	if(!dojo.config.afterOnLoad){
+		//	START DOMContentLoaded
+		// Mozilla and Opera 9 expose the event we could use
+		if(document.addEventListener){
+			// NOTE: 
+			//		due to a threading issue in Firefox 2.0, we can't enable
+			//		DOMContentLoaded on that platform. For more information, see:
+			//		http://trac.dojotoolkit.org/ticket/1704
+			if(dojo.isOpera || dojo.isFF >= 3 || (dojo.isMoz && dojo.config.enableMozDomContentLoaded === true)){
+				document.addEventListener("DOMContentLoaded", dojo._loadInit, null);
+			}
+	
+			//	mainly for Opera 8.5, won't be fired if DOMContentLoaded fired already.
+			//  also used for Mozilla because of trac #1640
+			window.addEventListener("load", dojo._loadInit, null);
+		}
+	
+		if(dojo.isAIR){
+			window.addEventListener("load", dojo._loadInit, null);
+		}else if(/(WebKit|khtml)/i.test(navigator.userAgent)){ // sniff
+			dojo._khtmlTimer = setInterval(function(){
+				if(/loaded|complete/.test(document.readyState)){
+					dojo._loadInit(); // call the onload handler
+				}
+			}, 10);
+		}
+		//	END DOMContentLoaded
+	}
+
+	(function(){
+		var _w = window;
+		var _handleNodeEvent = function(/*String*/evtName, /*Function*/fp){
+			// summary:
+			//		non-destructively adds the specified function to the node's
+			//		evtName handler.
+			// evtName: should be in the form "onclick" for "onclick" handlers.
+			// Make sure you pass in the "on" part.
+			var oldHandler = _w[evtName] || function(){};
+			_w[evtName] = function(){
+				fp.apply(_w, arguments);
+				oldHandler.apply(_w, arguments);
+			};
+		};
+
+		if(dojo.isIE){
+			// 	for Internet Explorer. readyState will not be achieved on init
+			// 	call, but dojo doesn't need it however, we'll include it
+			// 	because we don't know if there are other functions added that
+			// 	might.  Note that this has changed because the build process
+			// 	strips all comments -- including conditional ones.
+			if(!dojo.config.afterOnLoad){
+				document.write('<scr'+'ipt defer src="//:" '
+					+ 'onreadystatechange="if(this.readyState==\'complete\'){' + dojo._scopeName + '._loadInit();}">'
+					+ '</scr'+'ipt>'
+				);
+			}
+
+			try{
+				document.namespaces.add("v","urn:schemas-microsoft-com:vml");
+				document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)");
+			}catch(e){}
+		}
+
+		// FIXME: dojo.unloaded requires dojo scope, so using anon function wrapper.
+		_handleNodeEvent("onbeforeunload", function() { dojo.unloaded(); });
+		_handleNodeEvent("onunload", function() { dojo.windowUnloaded(); });
+	})();
+
+	/*
+	OpenAjax.subscribe("OpenAjax", "onload", function(){
+		if(dojo._inFlightCount == 0){
+			dojo._modulesLoaded();
+		}
+	});
+
+	OpenAjax.subscribe("OpenAjax", "onunload", function(){
+		dojo.unloaded();
+	});
+	*/
+} //if (typeof window != 'undefined')
+
+//Register any module paths set up in djConfig. Need to do this
+//in the hostenvs since hostenv_browser can read djConfig from a
+//script tag's attribute.
+(function(){
+	var mp = dojo.config["modulePaths"];
+	if(mp){
+		for(var param in mp){
+			dojo.registerModulePath(param, mp[param]);
+		}
+	}
+})();
+
+//Load debug code if necessary.
+if(dojo.config.isDebug){
+	dojo.require("dojo._firebug.firebug");
+}
+
+if(dojo.config.debugAtAllCosts){
+	dojo.config.useXDomain = true;
+	dojo.require("dojo._base._loader.loader_xd");
+	dojo.require("dojo._base._loader.loader_debug");
+	dojo.require("dojo.i18n");
+}
+
+if(!dojo._hasResource["dojo._base.lang"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.lang"] = true;
+dojo.provide("dojo._base.lang");
+
+// Crockford (ish) functions
+
+dojo.isString = function(/*anything*/ it){
+	//	summary:
+	//		Return true if it is a String
+	return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
+}
+
+dojo.isArray = function(/*anything*/ it){
+	//	summary:
+	//		Return true if it is an Array
+	return it && (it instanceof Array || typeof it == "array"); // Boolean
+}
+
+/*=====
+dojo.isFunction = function(it){
+	// summary: Return true if it is a Function
+	// it: anything
+	return; // Boolean
+}
+=====*/
+
+dojo.isFunction = (function(){
+	var _isFunction = function(/*anything*/ it){
+		return it && (typeof it == "function" || it instanceof Function); // Boolean
+	};
+
+	return dojo.isSafari ?
+		// only slow this down w/ gratuitious casting in Safari since it's what's b0rken
+		function(/*anything*/ it){
+			if(typeof it == "function" && it == "[object NodeList]"){ return false; }
+			return _isFunction(it); // Boolean
+		} : _isFunction;
+})();
+
+dojo.isObject = function(/*anything*/ it){
+	// summary: 
+	//		Returns true if it is a JavaScript object (or an Array, a Function
+	//		or null)
+	return it !== undefined &&
+		(it === null || typeof it == "object" || dojo.isArray(it) || dojo.isFunction(it)); // Boolean
+}
+
+dojo.isArrayLike = function(/*anything*/ it){
+	//	summary:
+	//		similar to dojo.isArray() but more permissive
+	//	description:
+	//		Doesn't strongly test for "arrayness".  Instead, settles for "isn't
+	//		a string or number and has a length property". Arguments objects
+	//		and DOM collections will return true when passed to
+	//		dojo.isArrayLike(), but will return false when passed to
+	//		dojo.isArray().
+	//	returns:
+	//		If it walks like a duck and quicks like a duck, return `true`
+	var d = dojo;
+	return it && it !== undefined && // Boolean
+		// keep out built-in constructors (Number, String, ...) which have length
+		// properties
+		!d.isString(it) && !d.isFunction(it) &&
+		!(it.tagName && it.tagName.toLowerCase() == 'form') &&
+		(d.isArray(it) || isFinite(it.length));
+}
+
+dojo.isAlien = function(/*anything*/ it){
+	// summary: 
+	//		Returns true if it is a built-in function or some other kind of
+	//		oddball that *should* report as a function but doesn't
+	return it && !dojo.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
+}
+
+dojo.extend = function(/*Object*/ constructor, /*Object...*/ props){
+	// summary:
+	//		Adds all properties and methods of props to constructor's
+	//		prototype, making them available to all instances created with
+	//		constructor.
+	for(var i=1, l=arguments.length; i<l; i++){
+		dojo._mixin(constructor.prototype, arguments[i]);
+	}
+	return constructor; // Object
+}
+
+dojo._hitchArgs = function(scope, method /*,...*/){
+	var pre = dojo._toArray(arguments, 2);
+	var named = dojo.isString(method);
+	return function(){
+		// arrayify arguments
+		var args = dojo._toArray(arguments);
+		// locate our method
+		var f = named ? (scope||dojo.global)[method] : method;
+		// invoke with collected args
+		return f && f.apply(scope || this, pre.concat(args)); // mixed
+ 	} // Function
+}
+
+dojo.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/){
+	//	summary: 
+	//		Returns a function that will only ever execute in the a given scope. 
+	//		This allows for easy use of object member functions
+	//		in callbacks and other places in which the "this" keyword may
+	//		otherwise not reference the expected scope. 
+	//		Any number of default positional arguments may be passed as parameters 
+	//		beyond "method".
+	//		Each of these values will be used to "placehold" (similar to curry)
+	//		for the hitched function. 
+	//	scope: 
+	//		The scope to use when method executes. If method is a string, 
+	//		scope is also the object containing method.
+	//	method:
+	//		A function to be hitched to scope, or the name of the method in
+	//		scope to be hitched.
+	//	example:
+	//	|	dojo.hitch(foo, "bar")(); 
+	//		runs foo.bar() in the scope of foo
+	//	example:
+	//	|	dojo.hitch(foo, myFunction);
+	//		returns a function that runs myFunction in the scope of foo
+	if(arguments.length > 2){
+		return dojo._hitchArgs.apply(dojo, arguments); // Function
+	}
+	if(!method){
+		method = scope;
+		scope = null;
+	}
+	if(dojo.isString(method)){
+		scope = scope || dojo.global;
+		if(!scope[method]){ throw(['dojo.hitch: scope["', method, '"] is null (scope="', scope, '")'].join('')); }
+		return function(){ return scope[method].apply(scope, arguments || []); }; // Function
+	}
+	return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function
+}
+
+/*=====
+dojo.delegate = function(obj, props){
+	//	summary:
+	//		returns a new object which "looks" to obj for properties which it
+	//		does not have a value for. Optionally takes a bag of properties to
+	//		seed the returned object with initially. 
+	//	description:
+	//		This is a small implementaton of the Boodman/Crockford delegation
+	//		pattern in JavaScript. An intermediate object constructor mediates
+	//		the prototype chain for the returned object, using it to delegate
+	//		down to obj for property lookup when object-local lookup fails.
+	//		This can be thought of similarly to ES4's "wrap", save that it does
+	//		not act on types but rather on pure objects.
+	//	obj:
+	//		The object to delegate to for properties not found directly on the
+	//		return object or in props.
+	//	props:
+	//		an object containing properties to assign to the returned object
+	//	returns:
+	//		an Object of anonymous type
+	//	example:
+	//	|	var foo = { bar: "baz" };
+	//	|	var thinger = dojo.delegate(foo, { thud: "xyzzy"});
+	//	|	thinger.bar == "baz"; // delegated to foo
+	//	|	foo.thud == undefined; // by definition
+	//	|	thinger.thud == "xyzzy"; // mixed in from props
+	//	|	foo.bar = "thonk";
+	//	|	thinger.bar == "thonk"; // still delegated to foo's bar
+}
+=====*/
+
+dojo.delegate = dojo._delegate = (function(){
+	// boodman/crockford delegation w/ cornford optimization
+	function TMP(){};
+	return function(obj, props){
+		TMP.prototype = obj;
+		var tmp = new TMP();
+		if(props){
+			dojo._mixin(tmp, props);
+		}
+		return tmp; // Object
+	}
+})();
+
+/*=====
+dojo._toArray = function(obj, offset, startWith){
+	//	summary:
+	//		Converts an array-like object (i.e. arguments, DOMCollection) to an
+	//		array. Returns a new Array with the elements of obj.
+	//	obj: Object
+	//		the object to "arrayify". We expect the object to have, at a
+	//		minimum, a length property which corresponds to integer-indexed
+	//		properties.
+	//	offset: Number?
+	//		the location in obj to start iterating from. Defaults to 0.
+	//		Optional.
+	//	startWith: Array?
+	//		An array to pack with the properties of obj. If provided,
+	//		properties in obj are appended at the end of startWith and
+	//		startWith is the returned array.
+}
+=====*/
+
+(function(){
+	var efficient = function(obj, offset, startWith){
+		return (startWith||[]).concat(Array.prototype.slice.call(obj, offset||0));
+	};
+
+	var slow = function(obj, offset, startWith){
+		var arr = startWith||[]; 
+		for(var x = offset || 0; x < obj.length; x++){ 
+			arr.push(obj[x]); 
+		} 
+		return arr;
+	};
+
+	dojo._toArray = (!dojo.isIE) ? efficient : function(obj){
+		return ((obj.item) ? slow : efficient).apply(this, arguments);
+	};
+
+})();
+
+dojo.partial = function(/*Function|String*/method /*, ...*/){
+	//	summary:
+	//		similar to hitch() except that the scope object is left to be
+	//		whatever the execution context eventually becomes.
+	//	description:
+	//		Calling dojo.partial is the functional equivalent of calling:
+	//		|	dojo.hitch(null, funcName, ...);
+	var arr = [ null ];
+	return dojo.hitch.apply(dojo, arr.concat(dojo._toArray(arguments))); // Function
+}
+
+dojo.clone = function(/*anything*/ o){
+	// summary:
+	//		Clones objects (including DOM nodes) and all children.
+	//		Warning: do not clone cyclic structures.
+	if(!o){ return o; }
+	if(dojo.isArray(o)){
+		var r = [];
+		for(var i = 0; i < o.length; ++i){
+			r.push(dojo.clone(o[i]));
+		}
+		return r; // Array
+	}
+	if(!dojo.isObject(o)){
+		return o;	/*anything*/
+	}
+	if(o.nodeType && o.cloneNode){ // isNode
+		return o.cloneNode(true); // Node
+	}
+	if(o instanceof Date){
+		return new Date(o.getTime());	// Date
+	}
+	// Generic objects
+	var r = new o.constructor(); // specific to dojo.declare()'d classes!
+	for(var i in o){
+		if(!(i in r) || r[i] != o[i]){
+			r[i] = dojo.clone(o[i]);
+		}
+	}
+	return r; // Object
+}
+
+dojo.trim = function(/*String*/ str){
+	// summary: 
+	//		trims whitespaces from both sides of the string
+	// description:
+	//		This version of trim() was selected for inclusion into the base due
+	//		to its compact size and relatively good performance (see Steven
+	//		Levithan's blog:
+	//		http://blog.stevenlevithan.com/archives/faster-trim-javascript).
+	//		The fastest but longest version of this function is located at
+	//		dojo.string.trim()
+	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');	// String
+}
+
+}
+
+if(!dojo._hasResource["dojo._base.declare"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.declare"] = true;
+dojo.provide("dojo._base.declare");
+
+
+// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
+
+dojo.declare = function(/*String*/ className, /*Function|Function[]*/ superclass, /*Object*/ props){
+	//	summary: 
+	//		Create a feature-rich constructor from compact notation
+	//	className:
+	//		The name of the constructor (loosely, a "class")
+	//		stored in the "declaredClass" property in the created prototype
+	//	superclass:
+	//		May be null, a Function, or an Array of Functions. If an array, 
+	//		the first element is used as the prototypical ancestor and
+	//		any following Functions become mixin ancestors.
+	//	props:
+	//		An object whose properties are copied to the
+	//		created prototype.
+	//		Add an instance-initialization function by making it a property 
+	//		named "constructor".
+	//	description:
+	//		Create a constructor using a compact notation for inheritance and
+	//		prototype extension. 
+	//
+	//		All superclasses (including mixins) must be Functions (not simple Objects).
+	//
+	//		Mixin ancestors provide a type of multiple inheritance. Prototypes of mixin 
+	//		ancestors are copied to the new class: changes to mixin prototypes will
+	//		not affect classes to which they have been mixed in.
+	//
+	//		"className" is cached in "declaredClass" property of the new class.
+	//
+	//	example:
+	//	|	dojo.declare("my.classes.bar", my.classes.foo, {
+	//	|		// properties to be added to the class prototype
+	//	|		someValue: 2,
+	//	|		// initialization function
+	//	|		constructor: function(){
+	//	|			this.myComplicatedObject = new ReallyComplicatedObject(); 
+	//	|		},
+	//	|		// other functions
+	//	|		someMethod: function(){ 
+	//	|			doStuff(); 
+	//	|		}
+	//	|	);
+
+	// process superclass argument
+	var dd = arguments.callee, mixins;
+	if(dojo.isArray(superclass)){
+		mixins = superclass;
+		superclass = mixins.shift();
+	}
+	// construct intermediate classes for mixins
+	if(mixins){
+		dojo.forEach(mixins, function(m){
+			if(!m){ throw(className + ": mixin #" + i + " is null"); } // It's likely a required module is not loaded
+			superclass = dd._delegate(superclass, m);
+		});
+	}
+	// create constructor
+	var ctor = dd._delegate(superclass);
+	// extend with "props"
+	props = props || {};
+	ctor.extend(props);
+	// more prototype decoration
+	dojo.extend(ctor, {declaredClass: className, _constructor: props.constructor/*, preamble: null*/});
+	// special help for IE
+	ctor.prototype.constructor = ctor;
+	// create named reference
+	return dojo.setObject(className, ctor); // Function
+};
+
+dojo.mixin(dojo.declare, {
+	_delegate: function(base, mixin){
+		var bp = (base||0).prototype, mp = (mixin||0).prototype, dd=dojo.declare;
+		// fresh constructor, fresh prototype
+		var ctor = dd._makeCtor();
+		// cache ancestry
+		dojo.mixin(ctor, {superclass: bp, mixin: mp, extend: dd._extend});
+		// chain prototypes
+		if(base){ctor.prototype = dojo._delegate(bp);}
+		// add mixin and core
+		dojo.extend(ctor, dd._core, mp||0, {_constructor: null, preamble: null});
+		// special help for IE
+		ctor.prototype.constructor = ctor;
+		// name this class for debugging
+		ctor.prototype.declaredClass = (bp||0).declaredClass + '_' + (mp||0).declaredClass;
+		return ctor;
+	},
+	_extend: function(props){
+		var i, fn;
+		for(i in props){ if(dojo.isFunction(fn=props[i]) && !0[i]){fn.nom=i;fn.ctor=this;} }
+		dojo.extend(this, props);
+	},
+	_makeCtor: function(){
+		// we have to make a function, but don't want to close over anything
+		return function(){ this._construct(arguments); };
+	},
+	_core: { 
+		_construct: function(args){
+			var c=args.callee, s=c.superclass, ct=s&&s.constructor, m=c.mixin, mct=m&&m.constructor, a=args, ii, fn;
+			// side-effect of = used on purpose here, lint may complain, don't try this at home
+			if(a[0]){ 
+				// FIXME: preambles for each mixin should be allowed
+				// FIXME: 
+				//		should we allow the preamble here NOT to modify the
+				//		default args, but instead to act on each mixin
+				//		independently of the class instance being constructed
+				//		(for impedence matching)?
+
+				// allow any first argument w/ a "preamble" property to act as a
+				// class preamble (not exclusive of the prototype preamble)
+				if(/*dojo.isFunction*/((fn = a[0].preamble))){ 
+					a = fn.apply(this, a) || a; 
+				}
+			} 
+			// prototype preamble
+			if((fn = c.prototype.preamble)){a = fn.apply(this, a) || a;}
+			// FIXME: 
+			//		need to provide an optional prototype-settable
+			//		"_explicitSuper" property which disables this
+			// initialize superclass
+			if(ct&&ct.apply){ct.apply(this, a);}
+			// initialize mixin
+			if(mct&&mct.apply){mct.apply(this, a);}
+			// initialize self
+			if((ii=c.prototype._constructor)){ii.apply(this, args);}
+			// post construction
+			if(this.constructor.prototype==c.prototype && (ct=this.postscript)){ ct.apply(this, args); }
+		},
+		_findMixin: function(mixin){
+			var c = this.constructor, p, m;
+			while(c){
+				p = c.superclass;
+				m = c.mixin;
+				if(m==mixin || (m instanceof mixin.constructor)){return p;}
+				if(m && m._findMixin && (m=m._findMixin(mixin))){return m;}
+				c = p && p.constructor;
+			}
+		},
+		_findMethod: function(name, method, ptype, has){
+			// consciously trading readability for bytes and speed in this low-level method
+			var p=ptype, c, m, f;
+			do{
+				c = p.constructor;
+				m = c.mixin;
+				// find method by name in our mixin ancestor
+				if(m && (m=this._findMethod(name, method, m, has))){return m;}
+				// if we found a named method that either exactly-is or exactly-is-not 'method'
+				if((f=p[name])&&(has==(f==method))){return p;}
+				// ascend chain
+				p = c.superclass;
+			}while(p);
+			// if we couldn't find an ancestor in our primary chain, try a mixin chain
+			return !has && (p=this._findMixin(ptype)) && this._findMethod(name, method, p, has);
+		},
+		inherited: function(name, args, newArgs){
+			// optionalize name argument
+			var a = arguments;
+			if(!dojo.isString(a[0])){newArgs=args; args=name; name=args.callee.nom;}
+			a = newArgs||args;
+			var c = args.callee, p = this.constructor.prototype, fn, mp;
+			// if not an instance override
+			if(this[name] != c || p[name] == c){
+				// start from memoized prototype, or
+				// find a prototype that has property 'name' == 'c'
+				mp = (c.ctor||0).superclass || this._findMethod(name, c, p, true);
+				if(!mp){throw(this.declaredClass + ': inherited method "' + name + '" mismatch');}
+				// find a prototype that has property 'name' != 'c'
+				p = this._findMethod(name, c, mp, false);
+			}
+			// we expect 'name' to be in prototype 'p'
+			fn = p && p[name];
+			if(!fn){throw(mp.declaredClass + ': inherited method "' + name + '" not found');}
+			// if the function exists, invoke it in our scope
+			return fn.apply(this, a);
+		}
+	}
+});
+
+}
+
+if(!dojo._hasResource["dojo._base.connect"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.connect"] = true;
+dojo.provide("dojo._base.connect");
+
+
+// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
+
+// low-level delegation machinery
+dojo._listener = {
+	// create a dispatcher function
+	getDispatcher: function(){
+		// following comments pulled out-of-line to prevent cloning them 
+		// in the returned function.
+		// - indices (i) that are really in the array of listeners (ls) will 
+		//   not be in Array.prototype. This is the 'sparse array' trick
+		//   that keeps us safe from libs that take liberties with built-in 
+		//   objects
+		// - listener is invoked with current scope (this)
+		return function(){
+			var ap=Array.prototype, c=arguments.callee, ls=c._listeners, t=c.target;
+			// return value comes from original target function
+			var r = t && t.apply(this, arguments);
+			// make local copy of listener array so it is immutable during processing
+			var lls;
+											lls = [].concat(ls);
+							
+			// invoke listeners after target function
+			for(var i in lls){
+				if(!(i in ap)){
+					lls[i].apply(this, arguments);
+				}
+			}
+			// return value comes from original target function
+			return r;
+		}
+	},
+	// add a listener to an object
+	add: function(/*Object*/ source, /*String*/ method, /*Function*/ listener){
+		// Whenever 'method' is invoked, 'listener' will have the same scope.
+		// Trying to supporting a context object for the listener led to 
+		// complexity. 
+		// Non trivial to provide 'once' functionality here
+		// because listener could be the result of a dojo.hitch call,
+		// in which case two references to the same hitch target would not
+		// be equivalent. 
+		source = source || dojo.global;
+		// The source method is either null, a dispatcher, or some other function
+		var f = source[method];
+		// Ensure a dispatcher
+		if(!f||!f._listeners){
+			var d = dojo._listener.getDispatcher();
+			// original target function is special
+			d.target = f;
+			// dispatcher holds a list of listeners
+			d._listeners = []; 
+			// redirect source to dispatcher
+			f = source[method] = d;
+		}
+		// The contract is that a handle is returned that can 
+		// identify this listener for disconnect. 
+		//
+		// The type of the handle is private. Here is it implemented as Integer. 
+		// DOM event code has this same contract but handle is Function 
+		// in non-IE browsers.
+		//
+		// We could have separate lists of before and after listeners.
+		return f._listeners.push(listener) ; /*Handle*/
+	},
+	// remove a listener from an object
+	remove: function(/*Object*/ source, /*String*/ method, /*Handle*/ handle){
+		var f = (source||dojo.global)[method];
+		// remember that handle is the index+1 (0 is not a valid handle)
+		if(f && f._listeners && handle--){
+			delete f._listeners[handle];
+		}
+	}
+};
+
+// Multiple delegation for arbitrary methods.
+
+// This unit knows nothing about DOM, 
+// but we include DOM aware 
+// documentation and dontFix
+// argument here to help the autodocs.
+// Actual DOM aware code is in event.js.
+
+dojo.connect = function(/*Object|null*/ obj, 
+						/*String*/ event, 
+						/*Object|null*/ context, 
+						/*String|Function*/ method,
+						/*Boolean*/ dontFix){
+	// summary:
+	//		Create a link that calls one function when another executes. 
+	//
+	// description:
+	//		Connects method to event, so that after event fires, method
+	//		does too. All connected functions are passed the same arguments as
+	//		the event function was initially called with. You may connect as
+	//		many methods to event as needed.
+	//
+	//		event must be a string. If obj is null, dojo.global is used.
+	//
+	//		null arguments may simply be omitted.
+	//
+	//		obj[event] can resolve to a function or undefined (null). 
+	//		If obj[event] is null, it is assigned a function.
+	//
+	//		The return value is a handle that is needed to 
+	//		remove this connection with dojo.disconnect.
+	//
+	// obj: 
+	//		The source object for the event function. 
+	//		Defaults to dojo.global if null.
+	//		If obj is a DOM node, the connection is delegated 
+	//		to the DOM event manager (unless dontFix is true).
+	//
+	// event:
+	//		String name of the event function in obj. 
+	//		I.e. identifies a property obj[event].
+	//
+	// context: 
+	//		The object that method will receive as "this".
+	//
+	//		If context is null and method is a function, then method
+	//		inherits the context of event.
+	//	
+	//		If method is a string then context must be the source 
+	//		object object for method (context[method]). If context is null,
+	//		dojo.global is used.
+	//
+	// method:
+	//		A function reference, or name of a function in context. 
+	//		The function identified by method fires after event does. 
+	//		method receives the same arguments as the event.
+	//		See context argument comments for information on method's scope.
+	//
+	// dontFix:
+	//		If obj is a DOM node, set dontFix to true to prevent delegation 
+	//		of this connection to the DOM event manager. 
+	//
+	// example:
+	//		When obj.onchange(), do ui.update():
+	//	|	dojo.connect(obj, "onchange", ui, "update");
+	//	|	dojo.connect(obj, "onchange", ui, ui.update); // same
+	//
+	// example:
+	//		Using return value for disconnect:
+	//	|	var link = dojo.connect(obj, "onchange", ui, "update");
+	//	|	...
+	//	|	dojo.disconnect(link);
+	//
+	// example:
+	//		When onglobalevent executes, watcher.handler is invoked:
+	//	|	dojo.connect(null, "onglobalevent", watcher, "handler");
+	//
+	// example:
+	//		When ob.onCustomEvent executes, customEventHandler is invoked:
+	//	|	dojo.connect(ob, "onCustomEvent", null, "customEventHandler");
+	//	|	dojo.connect(ob, "onCustomEvent", "customEventHandler"); // same
+	//
+	// example:
+	//		When ob.onCustomEvent executes, customEventHandler is invoked
+	//		with the same scope (this):
+	//	|	dojo.connect(ob, "onCustomEvent", null, customEventHandler);
+	//	|	dojo.connect(ob, "onCustomEvent", customEventHandler); // same
+	//
+	// example:
+	//		When globalEvent executes, globalHandler is invoked
+	//		with the same scope (this):
+	//	|	dojo.connect(null, "globalEvent", null, globalHandler);
+	//	|	dojo.connect("globalEvent", globalHandler); // same
+
+	// normalize arguments
+	var a=arguments, args=[], i=0;
+	// if a[0] is a String, obj was ommited
+	args.push(dojo.isString(a[0]) ? null : a[i++], a[i++]);
+	// if the arg-after-next is a String or Function, context was NOT omitted
+	var a1 = a[i+1];
+	args.push(dojo.isString(a1)||dojo.isFunction(a1) ? a[i++] : null, a[i++]);
+	// absorb any additional arguments
+	for(var l=a.length; i<l; i++){	args.push(a[i]); }
+	// do the actual work
+	return dojo._connect.apply(this, args); /*Handle*/
+}
+
+// used by non-browser hostenvs. always overriden by event.js
+dojo._connect = function(obj, event, context, method){
+	var l=dojo._listener, h=l.add(obj, event, dojo.hitch(context, method)); 
+	return [obj, event, h, l]; // Handle
+}
+
+dojo.disconnect = function(/*Handle*/ handle){
+	// summary:
+	//		Remove a link created by dojo.connect.
+	// description:
+	//		Removes the connection between event and the method referenced by handle.
+	// handle:
+	//		the return value of the dojo.connect call that created the connection.
+	if(handle && handle[0] !== undefined){
+		dojo._disconnect.apply(this, handle);
+		// let's not keep this reference
+		delete handle[0];
+	}
+}
+
+dojo._disconnect = function(obj, event, handle, listener){
+	listener.remove(obj, event, handle);
+}
+
+// topic publish/subscribe
+
+dojo._topics = {};
+
+dojo.subscribe = function(/*String*/ topic, /*Object|null*/ context, /*String|Function*/ method){
+	//	summary:
+	//		Attach a listener to a named topic. The listener function is invoked whenever the
+	//		named topic is published (see: dojo.publish).
+	//		Returns a handle which is needed to unsubscribe this listener.
+	//	context:
+	//		Scope in which method will be invoked, or null for default scope.
+	//	method:
+	//		The name of a function in context, or a function reference. This is the function that
+	//		is invoked when topic is published.
+	//	example:
+	//	|	dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
+	//	|	dojo.publish("alerts", [ "read this", "hello world" ]);																	
+
+	// support for 2 argument invocation (omitting context) depends on hitch
+	return [topic, dojo._listener.add(dojo._topics, topic, dojo.hitch(context, method))]; /*Handle*/
+}
+
+dojo.unsubscribe = function(/*Handle*/ handle){
+	//	summary:
+	//	 	Remove a topic listener. 
+	//	handle:
+	//	 	The handle returned from a call to subscribe.
+	//	example:
+	//	|	var alerter = dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
+	//	|	...
+	//	|	dojo.unsubscribe(alerter);
+	if(handle){
+		dojo._listener.remove(dojo._topics, handle[0], handle[1]);
+	}
+}
+
+dojo.publish = function(/*String*/ topic, /*Array*/ args){
+	//	summary:
+	//	 	Invoke all listener method subscribed to topic.
+	//	topic:
+	//	 	The name of the topic to publish.
+	//	args:
+	//	 	An array of arguments. The arguments will be applied 
+	//	 	to each topic subscriber (as first class parameters, via apply).
+	//	example:
+	//	|	dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
+	//	|	dojo.publish("alerts", [ "read this", "hello world" ]);	
+
+	// Note that args is an array, which is more efficient vs variable length
+	// argument list.  Ideally, var args would be implemented via Array
+	// throughout the APIs.
+	var f = dojo._topics[topic];
+	if(f){
+		f.apply(this, args||[]);
+	}
+}
+
+dojo.connectPublisher = function(	/*String*/ topic, 
+									/*Object|null*/ obj, 
+									/*String*/ event){
+	//	summary:
+	//	 	Ensure that everytime obj.event() is called, a message is published
+	//	 	on the topic. Returns a handle which can be passed to
+	//	 	dojo.disconnect() to disable subsequent automatic publication on
+	//	 	the topic.
+	//	topic:
+	//	 	The name of the topic to publish.
+	//	obj: 
+	//	 	The source object for the event function. Defaults to dojo.global
+	//	 	if null.
+	//	event:
+	//	 	The name of the event function in obj. 
+	//	 	I.e. identifies a property obj[event].
+	//	example:
+	//	|	dojo.connectPublisher("/ajax/start", dojo, "xhrGet");
+	var pf = function(){ dojo.publish(topic, arguments); }
+	return (event) ? dojo.connect(obj, event, pf) : dojo.connect(obj, pf); //Handle
+};
+
+}
+
+if(!dojo._hasResource["dojo._base.Deferred"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.Deferred"] = true;
+dojo.provide("dojo._base.Deferred");
+
+
+dojo.Deferred = function(/*Function?*/ canceller){
+	// summary:
+	//		Encapsulates a sequence of callbacks in response to a value that
+	//		may not yet be available.  This is modeled after the Deferred class
+	//		from Twisted <http://twistedmatrix.com>.
+	// description:
+	//		JavaScript has no threads, and even if it did, threads are hard.
+	//		Deferreds are a way of abstracting non-blocking events, such as the
+	//		final response to an XMLHttpRequest. Deferreds create a promise to
+	//		return a response a some point in the future and an easy way to
+	//		register your interest in receiving that response.
+	//
+	//		The most important methods for Deffered users are:
+	//
+	//			* addCallback(handler)
+	//			* addErrback(handler)
+	//			* callback(result)
+	//			* errback(result)
+	//
+	//		In general, when a function returns a Deferred, users then "fill
+	//		in" the second half of the contract by registering callbacks and
+	//		error handlers. You may register as many callback and errback
+	//		handlers as you like and they will be executed in the order
+	//		registered when a result is provided. Usually this result is
+	//		provided as the result of an asynchronous operation. The code
+	//		"managing" the Deferred (the code that made the promise to provide
+	//		an answer later) will use the callback() and errback() methods to
+	//		communicate with registered listeners about the result of the
+	//		operation. At this time, all registered result handlers are called
+	//		*with the most recent result value*.
+	//
+	//		Deferred callback handlers are treated as a chain, and each item in
+	//		the chain is required to return a value that will be fed into
+	//		successive handlers. The most minimal callback may be registered
+	//		like this:
+	//
+	//		|	var d = new dojo.Deferred();
+	//		|	d.addCallback(function(result){ return result; });
+	//
+	//		Perhaps the most common mistake when first using Deferreds is to
+	//		forget to return a value (in most cases, the value you were
+	//		passed).
+	//
+	//		The sequence of callbacks is internally represented as a list of
+	//		2-tuples containing the callback/errback pair.  For example, the
+	//		following call sequence:
+	//		
+	//		|	var d = new dojo.Deferred();
+	//		|	d.addCallback(myCallback);
+	//		|	d.addErrback(myErrback);
+	//		|	d.addBoth(myBoth);
+	//		|	d.addCallbacks(myCallback, myErrback);
+	//
+	//		is translated into a Deferred with the following internal
+	//		representation:
+	//
+	//		|	[
+	//		|		[myCallback, null],
+	//		|		[null, myErrback],
+	//		|		[myBoth, myBoth],
+	//		|		[myCallback, myErrback]
+	//		|	]
+	//
+	//		The Deferred also keeps track of its current status (fired).  Its
+	//		status may be one of three things:
+	//
+	//			* -1: no value yet (initial condition)
+	//			* 0: success
+	//			* 1: error
+	//	
+	//		A Deferred will be in the error state if one of the following three
+	//		conditions are met:
+	//
+	//			1. The result given to callback or errback is "instanceof" Error
+	//			2. The previous callback or errback raised an exception while
+	//			   executing
+	//			3. The previous callback or errback returned a value
+	//			   "instanceof" Error
+	//
+	//		Otherwise, the Deferred will be in the success state. The state of
+	//		the Deferred determines the next element in the callback sequence
+	//		to run.
+	//
+	//		When a callback or errback occurs with the example deferred chain,
+	//		something equivalent to the following will happen (imagine
+	//		that exceptions are caught and returned):
+	//
+	//		|	// d.callback(result) or d.errback(result)
+	//		|	if(!(result instanceof Error)){
+	//		|		result = myCallback(result);
+	//		|	}
+	//		|	if(result instanceof Error){
+	//		|		result = myErrback(result);
+	//		|	}
+	//		|	result = myBoth(result);
+	//		|	if(result instanceof Error){
+	//		|		result = myErrback(result);
+	//		|	}else{
+	//		|		result = myCallback(result);
+	//		|	}
+	//
+	//		The result is then stored away in case another step is added to the
+	//		callback sequence.	Since the Deferred already has a value
+	//		available, any new callbacks added will be called immediately.
+	//
+	//		There are two other "advanced" details about this implementation
+	//		that are useful:
+	//
+	//		Callbacks are allowed to return Deferred instances themselves, so
+	//		you can build complicated sequences of events with ease.
+	//
+	//		The creator of the Deferred may specify a canceller.  The canceller
+	//		is a function that will be called if Deferred.cancel is called
+	//		before the Deferred fires. You can use this to implement clean
+	//		aborting of an XMLHttpRequest, etc. Note that cancel will fire the
+	//		deferred with a CancelledError (unless your canceller returns
+	//		another kind of error), so the errbacks should be prepared to
+	//		handle that error for cancellable Deferreds.
+	// example:
+	//	|	var deferred = new dojo.Deferred();
+	//	|	setTimeout(function(){ deferred.callback({success: true}); }, 1000);
+	//	|	return deferred;
+	// example:
+	//		Deferred objects are often used when making code asynchronous. It
+	//		may be easiest to write functions in a synchronous manner and then
+	//		split code using a deferred to trigger a response to a long-lived
+	//		operation. For example, instead of register a callback function to
+	//		denote when a rendering operation completes, the function can
+	//		simply return a deferred:
+	//
+	//		|	// callback style:
+	//		|	function renderLotsOfData(data, callback){
+	//		|		var success = false
+	//		|		try{
+	//		|			for(var x in data){
+	//		|				renderDataitem(data[x]);
+	//		|			}
+	//		|			success = true;
+	//		|		}catch(e){ }
+	//		|		if(callback){
+	//		|			callback(success);
+	//		|		}
+	//		|	}
+	//
+	//		|	// using callback style
+	//		|	renderLotsOfData(someDataObj, function(success){
+	//		|		// handles success or failure
+	//		|		if(!success){
+	//		|			promptUserToRecover();
+	//		|		}
+	//		|	});
+	//		|	// NOTE: no way to add another callback here!!
+	// example:
+	//		Using a Deferred doesn't simplify the sending code any, but it
+	//		provides a standard interface for callers and senders alike,
+	//		providing both with a simple way to service multiple callbacks for
+	//		an operation and freeing both sides from worrying about details
+	//		such as "did this get called already?". With Deferreds, new
+	//		callbacks can be added at any time.
+	//
+	//		|	// Deferred style:
+	//		|	function renderLotsOfData(data){
+	//		|		var d = new dojo.Deferred();
+	//		|		try{
+	//		|			for(var x in data){
+	//		|				renderDataitem(data[x]);
+	//		|			}
+	//		|			d.callback(true);
+	//		|		}catch(e){ 
+	//		|			d.errback(new Error("rendering failed"));
+	//		|		}
+	//		|		return d;
+	//		|	}
+	//
+	//		|	// using Deferred style
+	//		|	renderLotsOfData(someDataObj).addErrback(function(){
+	//		|		promptUserToRecover();
+	//		|	});
+	//		|	// NOTE: addErrback and addCallback both return the Deferred
+	//		|	// again, so we could chain adding callbacks or save the
+	//		|	// deferred for later should we need to be notified again.
+	// example:
+	//		In this example, renderLotsOfData is syncrhonous and so both
+	//		versions are pretty artificial. Putting the data display on a
+	//		timeout helps show why Deferreds rock:
+	//
+	//		|	// Deferred style and async func
+	//		|	function renderLotsOfData(data){
+	//		|		var d = new dojo.Deferred();
+	//		|		setTimeout(function(){
+	//		|			try{
+	//		|				for(var x in data){
+	//		|					renderDataitem(data[x]);
+	//		|				}
+	//		|				d.callback(true);
+	//		|			}catch(e){ 
+	//		|				d.errback(new Error("rendering failed"));
+	//		|			}
+	//		|		}, 100);
+	//		|		return d;
+	//		|	}
+	//
+	//		|	// using Deferred style
+	//		|	renderLotsOfData(someDataObj).addErrback(function(){
+	//		|		promptUserToRecover();
+	//		|	});
+	//
+	//		Note that the caller doesn't have to change his code at all to
+	//		handle the asynchronous case.
+
+	this.chain = [];
+	this.id = this._nextId();
+	this.fired = -1;
+	this.paused = 0;
+	this.results = [null, null];
+	this.canceller = canceller;
+	this.silentlyCancelled = false;
+};
+
+dojo.extend(dojo.Deferred, {
+	/*
+	makeCalled: function(){
+		// summary:
+		//		returns a new, empty deferred, which is already in the called
+		//		state. Calling callback() or errback() on this deferred will
+		//		yeild an error and adding new handlers to it will result in
+		//		them being called immediately.
+		var deferred = new dojo.Deferred();
+		deferred.callback();
+		return deferred;
+	},
+
+	toString: function(){
+		var state;
+		if(this.fired == -1){
+			state = 'unfired';
+		}else{
+			state = this.fired ? 'success' : 'error';
+		}
+		return 'Deferred(' + this.id + ', ' + state + ')';
+	},
+	*/
+
+	_nextId: (function(){
+		var n = 1;
+		return function(){ return n++; };
+	})(),
+
+	cancel: function(){
+		// summary:	
+		//		Cancels a Deferred that has not yet received a value, or is
+		//		waiting on another Deferred as its value.
+		// description:
+		//		If a canceller is defined, the canceller is called. If the
+		//		canceller did not return an error, or there was no canceller,
+		//		then the errback chain is started.
+		var err;
+		if(this.fired == -1){
+			if(this.canceller){
+				err = this.canceller(this);
+			}else{
+				this.silentlyCancelled = true;
+			}
+			if(this.fired == -1){
+				if(!(err instanceof Error)){
+					var res = err;
+					err = new Error("Deferred Cancelled");
+					err.dojoType = "cancel";
+					err.cancelResult = res;
+				}
+				this.errback(err);
+			}
+		}else if(	(this.fired == 0) &&
+					(this.results[0] instanceof dojo.Deferred)
+		){
+			this.results[0].cancel();
+		}
+	},
+			
+
+	_resback: function(res){
+		// summary:
+		//		The private primitive that means either callback or errback
+		this.fired = ((res instanceof Error) ? 1 : 0);
+		this.results[this.fired] = res;
+		this._fire();
+	},
+
+	_check: function(){
+		if(this.fired != -1){
+			if(!this.silentlyCancelled){
+				throw new Error("already called!");
+			}
+			this.silentlyCancelled = false;
+			return;
+		}
+	},
+
+	callback: function(res){
+		//	summary:	
+		//		Begin the callback sequence with a non-error value.
+		
+		/*
+		callback or errback should only be called once on a given
+		Deferred.
+		*/
+		this._check();
+		this._resback(res);
+	},
+
+	errback: function(/*Error*/res){
+		//	summary: 
+		//		Begin the callback sequence with an error result.
+		this._check();
+		if(!(res instanceof Error)){
+			res = new Error(res);
+		}
+		this._resback(res);
+	},
+
+	addBoth: function(/*Function|Object*/cb, /*String?*/cbfn){
+		//	summary:
+		//		Add the same function as both a callback and an errback as the
+		//		next element on the callback sequence.This is useful for code
+		//		that you want to guarantee to run, e.g. a finalizer.
+		var enclosed = dojo.hitch.apply(dojo, arguments);
+		return this.addCallbacks(enclosed, enclosed); // dojo.Deferred
+	},
+
+	addCallback: function(/*Function|Object*/cb, /*String?*/cbfn /*...*/){
+		//	summary: 
+		//		Add a single callback to the end of the callback sequence.
+		return this.addCallbacks(dojo.hitch.apply(dojo, arguments)); // dojo.Deferred
+	},
+
+	addErrback: function(cb, cbfn){
+		//	summary: 
+		//		Add a single callback to the end of the callback sequence.
+		return this.addCallbacks(null, dojo.hitch.apply(dojo, arguments)); // dojo.Deferred
+	},
+
+	addCallbacks: function(cb, eb){
+		// summary: 
+		//		Add separate callback and errback to the end of the callback
+		//		sequence.
+		this.chain.push([cb, eb])
+		if(this.fired >= 0){
+			this._fire();
+		}
+		return this; // dojo.Deferred
+	},
+
+	_fire: function(){
+		// summary: 
+		//		Used internally to exhaust the callback sequence when a result
+		//		is available.
+		var chain = this.chain;
+		var fired = this.fired;
+		var res = this.results[fired];
+		var self = this;
+		var cb = null;
+		while(
+			(chain.length > 0) &&
+			(this.paused == 0)
+		){
+			// Array
+			var f = chain.shift()[fired];
+			if(!f){ continue; }
+			var func = function(){
+				var ret = f(res);
+				//If no response, then use previous response.
+				if(typeof ret != "undefined"){
+					res = ret;
+				}
+				fired = ((res instanceof Error) ? 1 : 0);
+				if(res instanceof dojo.Deferred){
+					cb = function(res){
+						self._resback(res);
+						// inlined from _pause()
+						self.paused--;
+						if(
+							(self.paused == 0) && 
+							(self.fired >= 0)
+						){
+							self._fire();
+						}
+					}
+					// inlined from _unpause
+					this.paused++;
+				}
+			};
+			if(dojo.config.isDebug){
+				func.call(this);
+			}else{
+				try{
+					func.call(this);
+				}catch(err){
+					fired = 1;
+					res = err;
+				}
+			}
+		}
+		this.fired = fired;
+		this.results[fired] = res;
+		if((cb)&&(this.paused)){
+			// this is for "tail recursion" in case the dependent
+			// deferred is already fired
+			res.addBoth(cb);
+		}
+	}
+});
+
+}
+
+if(!dojo._hasResource["dojo._base.json"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.json"] = true;
+dojo.provide("dojo._base.json");
+
+dojo.fromJson = function(/*String*/ json){
+	// summary:
+	// 		Parses a [JSON](http://json.org) string to return a JavaScript object.  Throws for invalid JSON strings.
+	// json: 
+	//		a string literal of a JSON item, for instance:
+	//			`'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
+
+	return eval("(" + json + ")"); // Object
+}
+
+dojo._escapeString = function(/*String*/str){
+	//summary:
+	//		Adds escape sequences for non-visual characters, double quote and
+	//		backslash and surrounds with double quotes to form a valid string
+	//		literal.
+	return ('"' + str.replace(/(["\\])/g, '\\$1') + '"').
+		replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").
+		replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string
+}
+
+dojo.toJsonIndentStr = "\t";
+dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr){
+	// summary:
+	//		Returns a [JSON](http://json.org) serialization of an object.
+	//
+	// description:
+	//		Returns a [JSON](http://json.org) serialization of an object.
+	//		Note that this doesn't check for infinite recursion, so don't do that!
+	//
+	// it:
+	//		an object to be serialized. Objects may define their own
+	//		serialization via a special "__json__" or "json" function
+	//		property. If a specialized serializer has been defined, it will
+	//		be used as a fallback.
+	//
+	// prettyPrint:
+	//		if true, we indent objects and arrays to make the output prettier.
+	//		The variable dojo.toJsonIndentStr is used as the indent string 
+	//		-- to use something other than the default (tab), 
+	//		change that variable before calling dojo.toJson().
+	//
+	// _indentStr:
+	//		private variable for recursive calls when pretty printing, do not use.
+
+	if(it === undefined){
+		return "undefined";
+	}
+	var objtype = typeof it;
+	if(objtype == "number" || objtype == "boolean"){
+		return it + "";
+	}
+	if(it === null){
+		return "null";
+	}
+	if(dojo.isString(it)){ 
+		return dojo._escapeString(it); 
+	}
+	// recurse
+	var recurse = arguments.callee;
+	// short-circuit for objects that support "json" serialization
+	// if they return "self" then just pass-through...
+	var newObj;
+	_indentStr = _indentStr || "";
+	var nextIndent = prettyPrint ? _indentStr + dojo.toJsonIndentStr : "";
+	var tf = it.__json__||it.json;
+	if(dojo.isFunction(tf)){
+		newObj = tf.call(it);
+		if(it !== newObj){
+			return recurse(newObj, prettyPrint, nextIndent);
+		}
+	}
+	if(it.nodeType && it.cloneNode){ // isNode
+		// we can't seriailize DOM nodes as regular objects because they have cycles
+		// DOM nodes could be serialized with something like outerHTML, but
+		// that can be provided by users in the form of .json or .__json__ function.
+		throw new Error("Can't serialize DOM nodes");
+	}
+
+	var sep = prettyPrint ? " " : "";
+	var newLine = prettyPrint ? "\n" : "";
+
+	// array
+	if(dojo.isArray(it)){
+		var res = dojo.map(it, function(obj){
+			var val = recurse(obj, prettyPrint, nextIndent);
+			if(typeof val != "string"){
+				val = "undefined";
+			}
+			return newLine + nextIndent + val;
+		});
+		return "[" + res.join("," + sep) + newLine + _indentStr + "]";
+	}
+	/*
+	// look in the registry
+	try {
+		window.o = it;
+		newObj = dojo.json.jsonRegistry.match(it);
+		return recurse(newObj, prettyPrint, nextIndent);
+	}catch(e){
+		// 
+	}
+	// it's a function with no adapter, skip it
+	*/
+	if(objtype == "function"){
+		return null; // null
+	}
+	// generic object code path
+	var output = [], key;
+	for(key in it){
+		var keyStr, val;
+		if(typeof key == "number"){
+			keyStr = '"' + key + '"';
+		}else if(typeof key == "string"){
+			keyStr = dojo._escapeString(key);
+		}else{
+			// skip non-string or number keys
+			continue;
+		}
+		val = recurse(it[key], prettyPrint, nextIndent);
+		if(typeof val != "string"){
+			// skip non-serializable values
+			continue;
+		}
+		// FIXME: use += on Moz!!
+		//	 MOW NOTE: using += is a pain because you have to account for the dangling comma...
+		output.push(newLine + nextIndent + keyStr + ":" + sep + val);
+	}
+	return "{" + output.join("," + sep) + newLine + _indentStr + "}"; // String
+}
+
+}
+
+if(!dojo._hasResource["dojo._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.array"] = true;
+
+dojo.provide("dojo._base.array");
+
+(function(){
+	var _getParts = function(arr, obj, cb){
+		return [ 
+			dojo.isString(arr) ? arr.split("") : arr, 
+			obj || dojo.global,
+			// FIXME: cache the anonymous functions we create here?
+			dojo.isString(cb) ? new Function("item", "index", "array", cb) : cb
+		];
+	};
+
+	dojo.mixin(dojo, {
+		indexOf: function(	/*Array*/		array, 
+							/*Object*/		value,
+							/*Integer?*/	fromIndex,
+							/*Boolean?*/	findLast){
+			// summary:
+			//		locates the first index of the provided value in the
+			//		passed array. If the value is not found, -1 is returned.
+			// description:
+			//		For details on this method, see:
+			// 			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf
+
+			var step = 1, end = array.length || 0, i = 0;
+			if(findLast){
+				i = end - 1;
+				step = end = -1;
+			}
+			if(fromIndex != undefined){ i = fromIndex; }
+			if((findLast && i > end) || i < end){
+				for(; i != end; i += step){
+					if(array[i] == value){ return i; }
+				}
+			}
+			return -1;	// Number
+		},
+
+		lastIndexOf: function(/*Array*/array, /*Object*/value, /*Integer?*/fromIndex){
+			// summary:
+			//		locates the last index of the provided value in the passed
+			//		array. If the value is not found, -1 is returned.
+			// description:
+			//		For details on this method, see:
+			// 			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf
+			return dojo.indexOf(array, value, fromIndex, true); // Number
+		},
+
+		forEach: function(/*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
+			//	summary:
+			//		for every item in arr, callback is invoked. Return values are ignored.
+			//	arr:
+			//		the array to iterate over. If a string, operates on individual characters.
+			//	callback:
+			//		a function is invoked with three arguments: item, index, and array
+			//	thisObject:
+			//		may be used to scope the call to callback
+			//	description:
+			//		This function corresponds to the JavaScript 1.6
+			//		Array.forEach() method. For more details, see:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:forEach
+			//	example:
+			//	|	// log out all members of the array:
+			//	|	dojo.forEach(
+			//	|		[ "thinger", "blah", "howdy", 10 ],
+			//	|		function(item){
+			//	|			
+			//	|		}
+			//	|	);
+			//	example:
+			//	|	// log out the members and their indexes
+			//	|	dojo.forEach(
+			//	|		[ "thinger", "blah", "howdy", 10 ],
+			//	|		function(item, idx, arr){
+			//	|			
+			//	|		}
+			//	|	);
+			//	example:
+			//	|	// use a scoped object member as the callback
+			//	|	
+			//	|	var obj = {
+			//	|		prefix: "logged via obj.callback:", 
+			//	|		callback: function(item){
+			//	|			
+			//	|		}
+			//	|	};
+			//	|	
+			//	|	// specifying the scope function executes the callback in that scope
+			//	|	dojo.forEach(
+			//	|		[ "thinger", "blah", "howdy", 10 ],
+			//	|		obj.callback,
+			//	|		obj
+			//	|	);
+			//	|	
+			//	|	// alternately, we can accomplish the same thing with dojo.hitch()
+			//	|	dojo.forEach(
+			//	|		[ "thinger", "blah", "howdy", 10 ],
+			//	|		dojo.hitch(obj, "callback")
+			//	|	);
+
+			// match the behavior of the built-in forEach WRT empty arrs
+			if(!arr || !arr.length){ return; }
+
+			// FIXME: there are several ways of handilng thisObject. Is
+			// dojo.global always the default context?
+			var _p = _getParts(arr, thisObject, callback); arr = _p[0];
+			for(var i=0,l=arr.length; i<l; ++i){ 
+				_p[2].call(_p[1], arr[i], i, arr);
+			}
+		},
+
+		_everyOrSome: function(/*Boolean*/every, /*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
+			var _p = _getParts(arr, thisObject, callback); arr = _p[0];
+			for(var i=0,l=arr.length; i<l; ++i){
+				var result = !!_p[2].call(_p[1], arr[i], i, arr);
+				if(every ^ result){
+					return result; // Boolean
+				}
+			}
+			return every; // Boolean
+		},
+
+		every: function(/*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
+			// summary:
+			//		Determines whether or not every item in arr satisfies the
+			//		condition implemented by callback.
+			// arr:
+			//		the array to iterate on. If a string, operates on individual characters.
+			// callback:
+			//		a function is invoked with three arguments: item, index,
+			//		and array and returns true if the condition is met.
+			// thisObject:
+			//		may be used to scope the call to callback
+			// description:
+			//		This function corresponds to the JavaScript 1.6
+			//		Array.every() method. For more details, see:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:every
+			// example:
+			//	|	// returns false
+			//	|	dojo.every([1, 2, 3, 4], function(item){ return item>1; });
+			// example:
+			//	|	// returns true 
+			//	|	dojo.every([1, 2, 3, 4], function(item){ return item>0; });
+			return this._everyOrSome(true, arr, callback, thisObject); // Boolean
+		},
+
+		some: function(/*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
+			// summary:
+			//		Determines whether or not any item in arr satisfies the
+			//		condition implemented by callback.
+			// arr:
+			//		the array to iterate over. If a string, operates on individual characters.
+			// callback:
+			//		a function is invoked with three arguments: item, index,
+			//		and array and returns true if the condition is met.
+			// thisObject:
+			//		may be used to scope the call to callback
+			// description:
+			//		This function corresponds to the JavaScript 1.6
+			//		Array.some() method. For more details, see:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:some
+			// example:
+			//	|	// is true
+			//	|	dojo.some([1, 2, 3, 4], function(item){ return item>1; });
+			// example:
+			//	|	// is false
+			//	|	dojo.some([1, 2, 3, 4], function(item){ return item<1; });
+			return this._everyOrSome(false, arr, callback, thisObject); // Boolean
+		},
+
+		map: function(/*Array|String*/arr, /*Function|String*/callback, /*Function?*/thisObject){
+			// summary:
+			//		applies callback to each element of arr and returns
+			//		an Array with the results
+			// arr:
+			//		the array to iterate on. If a string, operates on
+			//		individual characters.
+			// callback:
+			//		a function is invoked with three arguments, (item, index,
+			//		array),  and returns a value
+			// thisObject:
+			//		may be used to scope the call to callback
+			// description:
+			//		This function corresponds to the JavaScript 1.6 Array.map()
+			//		method. For more details, see:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:map
+			// example:
+			//	|	// returns [2, 3, 4, 5]
+			//	|	dojo.map([1, 2, 3, 4], function(item){ return item+1 });
+
+			var _p = _getParts(arr, thisObject, callback); arr = _p[0];
+			var outArr = (arguments[3] ? (new arguments[3]()) : []);
+			for(var i=0,l=arr.length; i<l; ++i){
+				outArr.push(_p[2].call(_p[1], arr[i], i, arr));
+			}
+			return outArr; // Array
+		},
+
+		filter: function(/*Array*/arr, /*Function|String*/callback, /*Object?*/thisObject){
+			// summary:
+			//		Returns a new Array with those items from arr that match the
+			//		condition implemented by callback.
+			// arr:
+			//		the array to iterate over.
+			// callback:
+			//		a function that is invoked with three arguments (item,
+			//		index, array). The return of this function is expected to
+			//		be a boolean which determines whether the passed-in item
+			//		will be included in the returned array.
+			// thisObject:
+			//		may be used to scope the call to callback
+			// description:
+			//		This function corresponds to the JavaScript 1.6
+			//		Array.filter() method. For more details, see:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:filter
+			// example:
+			//	|	// returns [2, 3, 4]
+			//	|	dojo.filter([1, 2, 3, 4], function(item){ return item>1; });
+
+			var _p = _getParts(arr, thisObject, callback); arr = _p[0];
+			var outArr = [];
+			for(var i=0,l=arr.length; i<l; ++i){
+				if(_p[2].call(_p[1], arr[i], i, arr)){
+					outArr.push(arr[i]);
+				}
+			}
+			return outArr; // Array
+		}
+	});
+})();
+
+}
+
+if(!dojo._hasResource["dojo._base.Color"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.Color"] = true;
+dojo.provide("dojo._base.Color");
+
+
+
+dojo.Color = function(/*Array|String|Object*/ color){
+	// summary:
+	//		takes a named string, hex string, array of rgb or rgba values,
+	//		an object with r, g, b, and a properties, or another dojo.Color object
+	if(color){ this.setColor(color); }
+};
+
+// FIXME: there's got to be a more space-efficient way to encode or discover these!!  Use hex?
+dojo.Color.named = {
+	black:      [0,0,0],
+	silver:     [192,192,192],
+	gray:       [128,128,128],
+	white:      [255,255,255],
+	maroon:		[128,0,0],
+	red:        [255,0,0],
+	purple:		[128,0,128],
+	fuchsia:	[255,0,255],
+	green:	    [0,128,0],
+	lime:	    [0,255,0],
+	olive:		[128,128,0],
+	yellow:		[255,255,0],
+	navy:       [0,0,128],
+	blue:       [0,0,255],
+	teal:		[0,128,128],
+	aqua:		[0,255,255]
+};
+
+
+dojo.extend(dojo.Color, {
+	r: 255, g: 255, b: 255, a: 1,
+	_set: function(r, g, b, a){
+		var t = this; t.r = r; t.g = g; t.b = b; t.a = a;
+	},
+	setColor: function(/*Array|String|Object*/ color){
+		// summary:
+		//		takes a named string, hex string, array of rgb or rgba values,
+		//		an object with r, g, b, and a properties, or another dojo.Color object
+		var d = dojo;
+		if(d.isString(color)){
+			d.colorFromString(color, this);
+		}else if(d.isArray(color)){
+			d.colorFromArray(color, this);
+		}else{
+			this._set(color.r, color.g, color.b, color.a);
+			if(!(color instanceof d.Color)){ this.sanitize(); }
+		}
+		return this;	// dojo.Color
+	},
+	sanitize: function(){
+		// summary:
+		//		makes sure that the object has correct attributes
+		// description: 
+		//		the default implementation does nothing, include dojo.colors to
+		//		augment it to real checks
+		return this;	// dojo.Color
+	},
+	toRgb: function(){
+		// summary: returns 3 component array of rgb values
+		var t = this;
+		return [t.r, t.g, t.b];	// Array
+	},
+	toRgba: function(){
+		// summary: returns a 4 component array of rgba values
+		var t = this;
+		return [t.r, t.g, t.b, t.a];	// Array
+	},
+	toHex: function(){
+		// summary: returns a css color string in hexadecimal representation
+		var arr = dojo.map(["r", "g", "b"], function(x){
+			var s = this[x].toString(16);
+			return s.length < 2 ? "0" + s : s;
+		}, this);
+		return "#" + arr.join("");	// String
+	},
+	toCss: function(/*Boolean?*/ includeAlpha){
+		// summary: returns a css color string in rgb(a) representation
+		var t = this, rgb = t.r + ", " + t.g + ", " + t.b;
+		return (includeAlpha ? "rgba(" + rgb + ", " + t.a : "rgb(" + rgb) + ")";	// String
+	},
+	toString: function(){
+		// summary: returns a visual representation of the color
+		return this.toCss(true); // String
+	}
+});
+
+dojo.blendColors = function(
+	/*dojo.Color*/ start, 
+	/*dojo.Color*/ end, 
+	/*Number*/ weight,
+	/*dojo.Color?*/ obj
+){
+	// summary: 
+	//		blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend,
+	//		can reuse a previously allocated dojo.Color object for the result
+	var d = dojo, t = obj || new dojo.Color();
+	d.forEach(["r", "g", "b", "a"], function(x){
+		t[x] = start[x] + (end[x] - start[x]) * weight;
+		if(x != "a"){ t[x] = Math.round(t[x]); }
+	});
+	return t.sanitize();	// dojo.Color
+};
+
+dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
+	// summary: get rgb(a) array from css-style color declarations
+	var m = color.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);
+	return m && dojo.colorFromArray(m[1].split(/\s*,\s*/), obj);	// dojo.Color
+};
+
+dojo.colorFromHex = function(/*String*/ color, /*dojo.Color?*/ obj){
+	// summary: converts a hex string with a '#' prefix to a color object.
+	//	Supports 12-bit #rgb shorthand.
+	var d = dojo, t = obj || new d.Color(),
+		bits = (color.length == 4) ? 4 : 8,
+		mask = (1 << bits) - 1;
+	color = Number("0x" + color.substr(1));
+	if(isNaN(color)){
+		return null; // dojo.Color
+	}
+	d.forEach(["b", "g", "r"], function(x){
+		var c = color & mask;
+		color >>= bits;
+		t[x] = bits == 4 ? 17 * c : c;
+	});
+	t.a = 1;
+	return t;	// dojo.Color
+};
+
+dojo.colorFromArray = function(/*Array*/ a, /*dojo.Color?*/ obj){
+	// summary: builds a color from 1, 2, 3, or 4 element array
+	var t = obj || new dojo.Color();
+	t._set(Number(a[0]), Number(a[1]), Number(a[2]), Number(a[3]));
+	if(isNaN(t.a)){ t.a = 1; }
+	return t.sanitize();	// dojo.Color
+};
+
+dojo.colorFromString = function(/*String*/ str, /*dojo.Color?*/ obj){
+	//	summary:
+	//		parses str for a color value.
+	//	description:
+	//		Acceptable input values for str may include arrays of any form
+	//		accepted by dojo.colorFromArray, hex strings such as "#aaaaaa", or
+	//		rgb or rgba strings such as "rgb(133, 200, 16)" or "rgba(10, 10,
+	//		10, 50)"
+	//	returns:
+	//		a dojo.Color object. If obj is passed, it will be the return value.
+	var a = dojo.Color.named[str];
+	return a && dojo.colorFromArray(a, obj) || dojo.colorFromRgb(str, obj) || dojo.colorFromHex(str, obj);
+};
+
+}
+
+if(!dojo._hasResource["dojo._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base"] = true;
+dojo.provide("dojo._base");
+
+
+
+
+
+
+
+
+
+}
+
+if(!dojo._hasResource["dojo._base.window"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.window"] = true;
+dojo.provide("dojo._base.window");
+
+/*=====
+dojo.doc = {
+	// summary:
+	//		Alias for the current document. 'dojo.doc' can be modified
+	//		for temporary context shifting. Also see dojo.withDoc().
+	// description:
+	//    Refer to dojo.doc rather
+	//    than referring to 'window.document' to ensure your code runs
+	//    correctly in managed contexts.
+	// example:
+	// 	|	n.appendChild(dojo.doc.createElement('div'));
+}
+=====*/
+dojo.doc = window["document"] || null;
+
+dojo.body = function(){
+	// summary:
+	//		Return the body element of the document
+	//		return the body object associated with dojo.doc
+	// example:
+	// 	|	dojo.body().appendChild(dojo.doc.createElement('div'));
+
+	// Note: document.body is not defined for a strict xhtml document
+	// Would like to memoize this, but dojo.doc can change vi dojo.withDoc().
+	return dojo.doc.body || dojo.doc.getElementsByTagName("body")[0]; // Node
+}
+
+dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocument){
+	// summary:
+	//		changes the behavior of many core Dojo functions that deal with
+	//		namespace and DOM lookup, changing them to work in a new global
+	//		context (e.g., an iframe). The varibles dojo.global and dojo.doc
+	//		are modified as a result of calling this function and the result of
+	//		`dojo.body()` likewise differs.
+	dojo.global = globalObject;
+	dojo.doc = globalDocument;
+};
+
+dojo._fireCallback = function(callback, context, cbArguments){
+	if(context && dojo.isString(callback)){
+		callback = context[callback];
+	}
+	return callback.apply(context, cbArguments || [ ]);
+}
+
+dojo.withGlobal = function(	/*Object*/globalObject, 
+							/*Function*/callback, 
+							/*Object?*/thisObject, 
+							/*Array?*/cbArguments){
+	// summary:
+	//		Call callback with globalObject as dojo.global and
+	//		globalObject.document as dojo.doc. If provided, globalObject
+	//		will be executed in the context of object thisObject
+	// description:
+	//		When callback() returns or throws an error, the dojo.global
+	//		and dojo.doc will be restored to its previous state.
+	var rval;
+	var oldGlob = dojo.global;
+	var oldDoc = dojo.doc;
+	try{
+		dojo.setContext(globalObject, globalObject.document);
+		rval = dojo._fireCallback(callback, thisObject, cbArguments);
+	}finally{
+		dojo.setContext(oldGlob, oldDoc);
+	}
+	return rval;
+}
+
+dojo.withDoc = function(	/*Object*/documentObject, 
+							/*Function*/callback, 
+							/*Object?*/thisObject, 
+							/*Array?*/cbArguments){
+	// summary:
+	//		Call callback with documentObject as dojo.doc. If provided,
+	//		callback will be executed in the context of object thisObject
+	// description:
+	//		When callback() returns or throws an error, the dojo.doc will
+	//		be restored to its previous state.
+	var rval;
+	var oldDoc = dojo.doc;
+	try{
+		dojo.doc = documentObject;
+		rval = dojo._fireCallback(callback, thisObject, cbArguments);
+	}finally{
+		dojo.doc = oldDoc;
+	}
+	return rval;
+};
+
+}
+
+if(!dojo._hasResource["dojo._base.event"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.event"] = true;
+dojo.provide("dojo._base.event");
+
+
+// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
+
+(function(){
+	// DOM event listener machinery
+	var del = (dojo._event_listener = {
+		add: function(/*DOMNode*/node, /*String*/name, /*Function*/fp){
+			if(!node){return;} 
+			name = del._normalizeEventName(name);
+			fp = del._fixCallback(name, fp);
+			var oname = name;
+			if(!dojo.isIE && (name == "mouseenter" || name == "mouseleave")){
+				var ofp = fp;
+				//oname = name;
+				name = (name == "mouseenter") ? "mouseover" : "mouseout";
+				fp = function(e){
+					// check tagName to fix a FF2 bug with invalid nodes (hidden child DIV of INPUT)
+					// which causes isDecendant to return false which causes
+					// spurious, and more importantly, incorrect mouse events to fire.
+					// TODO: remove tagName check when Firefox 2 is no longer supported
+					try{ e.relatedTarget.tagName; } catch(e2){ return; }
+					if(!dojo.isDescendant(e.relatedTarget, node)){
+						// e.type = oname; // FIXME: doesn't take? SJM: event.type is generally immutable.
+						return ofp.call(this, e); 
+					}
+				}
+			}
+			node.addEventListener(name, fp, false);
+			return fp; /*Handle*/
+		},
+		remove: function(/*DOMNode*/node, /*String*/event, /*Handle*/handle){
+			// summary:
+			//		clobbers the listener from the node
+			// node:
+			//		DOM node to attach the event to
+			// event:
+			//		the name of the handler to remove the function from
+			// handle:
+			//		the handle returned from add
+			if (node){
+				event = del._normalizeEventName(event);
+				if(!dojo.isIE && (event == "mouseenter" || event == "mouseleave")){
+					event = (event == "mouseenter") ? "mouseover" : "mouseout";
+				}
+
+				node.removeEventListener(event, handle, false);
+			}
+		},
+		_normalizeEventName: function(/*String*/name){
+			// Generally, name should be lower case, unless it is special
+			// somehow (e.g. a Mozilla DOM event).
+			// Remove 'on'.
+			return name.slice(0,2) =="on" ? name.slice(2) : name;
+		},
+		_fixCallback: function(/*String*/name, fp){
+			// By default, we only invoke _fixEvent for 'keypress'
+			// If code is added to _fixEvent for other events, we have
+			// to revisit this optimization.
+			// This also applies to _fixEvent overrides for Safari and Opera
+			// below.
+			return name != "keypress" ? fp : function(e){ return fp.call(this, del._fixEvent(e, this)); };
+		},
+		_fixEvent: function(evt, sender){
+			// _fixCallback only attaches us to keypress.
+			// Switch on evt.type anyway because we might 
+			// be called directly from dojo.fixEvent.
+			switch(evt.type){
+				case "keypress":
+					del._setKeyChar(evt);
+					break;
+			}
+			return evt;
+		},
+		_setKeyChar: function(evt){
+			evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
+			evt.charOrCode = evt.keyChar || evt.keyCode;
+		},
+		// For IE and Safari: some ctrl-key combinations (mostly w/punctuation) do not emit a char code in IE
+		// we map those virtual key codes to ascii here
+		// not valid for all (non-US) keyboards, so maybe we shouldn't bother
+		_punctMap: { 
+			106:42, 
+			111:47, 
+			186:59, 
+			187:43, 
+			188:44, 
+			189:45, 
+			190:46, 
+			191:47, 
+			192:96, 
+			219:91, 
+			220:92, 
+			221:93, 
+			222:39 
+		}
+	});
+
+	// DOM events
+	
+	dojo.fixEvent = function(/*Event*/evt, /*DOMNode*/sender){
+		// summary:
+		//		normalizes properties on the event object including event
+		//		bubbling methods, keystroke normalization, and x/y positions
+		// evt: Event
+		//		native event object
+		// sender: DOMNode
+		//		node to treat as "currentTarget"
+		return del._fixEvent(evt, sender);
+	}
+
+	dojo.stopEvent = function(/*Event*/evt){
+		// summary:
+		//		prevents propagation and clobbers the default action of the
+		//		passed event
+		// evt: Event
+		//		The event object. If omitted, window.event is used on IE.
+		evt.preventDefault();
+		evt.stopPropagation();
+		// NOTE: below, this method is overridden for IE
+	}
+
+	// the default listener to use on dontFix nodes, overriden for IE
+	var node_listener = dojo._listener;
+	
+	// Unify connect and event listeners
+	dojo._connect = function(obj, event, context, method, dontFix){
+		// FIXME: need a more strict test
+		var isNode = obj && (obj.nodeType||obj.attachEvent||obj.addEventListener);
+		// choose one of three listener options: raw (connect.js), DOM event on a Node, custom event on a Node
+		// we need the third option to provide leak prevention on broken browsers (IE)
+		var lid = !isNode ? 0 : (!dontFix ? 1 : 2), l = [dojo._listener, del, node_listener][lid];
+		// create a listener
+		var h = l.add(obj, event, dojo.hitch(context, method));
+		// formerly, the disconnect package contained "l" directly, but if client code
+		// leaks the disconnect package (by connecting it to a node), referencing "l" 
+		// compounds the problem.
+		// instead we return a listener id, which requires custom _disconnect below.
+		// return disconnect package
+		return [ obj, event, h, lid ];
+	}
+
+	dojo._disconnect = function(obj, event, handle, listener){
+		([dojo._listener, del, node_listener][listener]).remove(obj, event, handle);
+	}
+
+	// Constants
+
+	// Public: client code should test
+	// keyCode against these named constants, as the
+	// actual codes can vary by browser.
+	dojo.keys = {
+		// summary: definitions for common key values
+		BACKSPACE: 8,
+		TAB: 9,
+		CLEAR: 12,
+		ENTER: 13,
+		SHIFT: 16,
+		CTRL: 17,
+		ALT: 18,
+		PAUSE: 19,
+		CAPS_LOCK: 20,
+		ESCAPE: 27,
+		SPACE: 32,
+		PAGE_UP: 33,
+		PAGE_DOWN: 34,
+		END: 35,
+		HOME: 36,
+		LEFT_ARROW: 37,
+		UP_ARROW: 38,
+		RIGHT_ARROW: 39,
+		DOWN_ARROW: 40,
+		INSERT: 45,
+		DELETE: 46,
+		HELP: 47,
+		LEFT_WINDOW: 91,
+		RIGHT_WINDOW: 92,
+		SELECT: 93,
+		NUMPAD_0: 96,
+		NUMPAD_1: 97,
+		NUMPAD_2: 98,
+		NUMPAD_3: 99,
+		NUMPAD_4: 100,
+		NUMPAD_5: 101,
+		NUMPAD_6: 102,
+		NUMPAD_7: 103,
+		NUMPAD_8: 104,
+		NUMPAD_9: 105,
+		NUMPAD_MULTIPLY: 106,
+		NUMPAD_PLUS: 107,
+		NUMPAD_ENTER: 108,
+		NUMPAD_MINUS: 109,
+		NUMPAD_PERIOD: 110,
+		NUMPAD_DIVIDE: 111,
+		F1: 112,
+		F2: 113,
+		F3: 114,
+		F4: 115,
+		F5: 116,
+		F6: 117,
+		F7: 118,
+		F8: 119,
+		F9: 120,
+		F10: 121,
+		F11: 122,
+		F12: 123,
+		F13: 124,
+		F14: 125,
+		F15: 126,
+		NUM_LOCK: 144,
+		SCROLL_LOCK: 145
+	};
+	
+	// IE event normalization
+	if(dojo.isIE){ 
+		var _trySetKeyCode = function(e, code){
+			try{
+				// squelch errors when keyCode is read-only
+				// (e.g. if keyCode is ctrl or shift)
+				return (e.keyCode = code);
+			}catch(e){
+				return 0;
+			}
+		}
+
+		// by default, use the standard listener
+		var iel = dojo._listener;
+		var listenersName = dojo._ieListenersName = "_" + dojo._scopeName + "_listeners";
+		// dispatcher tracking property
+		if(!dojo.config._allow_leaks){
+			// custom listener that handles leak protection for DOM events
+			node_listener = iel = dojo._ie_listener = {
+				// support handler indirection: event handler functions are 
+				// referenced here. Event dispatchers hold only indices.
+				handlers: [],
+				// add a listener to an object
+				add: function(/*Object*/ source, /*String*/ method, /*Function*/ listener){
+					source = source || dojo.global;
+					var f = source[method];
+					if(!f||!f[listenersName]){
+						var d = dojo._getIeDispatcher();
+						// original target function is special
+						d.target = f && (ieh.push(f) - 1);
+						// dispatcher holds a list of indices into handlers table
+						d[listenersName] = [];
+						// redirect source to dispatcher
+						f = source[method] = d;
+					}
+					return f[listenersName].push(ieh.push(listener) - 1) ; /*Handle*/
+				},
+				// remove a listener from an object
+				remove: function(/*Object*/ source, /*String*/ method, /*Handle*/ handle){
+					var f = (source||dojo.global)[method], l = f && f[listenersName];
+					if(f && l && handle--){
+						delete ieh[l[handle]];
+						delete l[handle];
+					}
+				}
+			};
+			// alias used above
+			var ieh = iel.handlers;
+		}
+
+		dojo.mixin(del, {
+			add: function(/*DOMNode*/node, /*String*/event, /*Function*/fp){
+				if(!node){return;} // undefined
+				event = del._normalizeEventName(event);
+				if(event=="onkeypress"){
+					// we need to listen to onkeydown to synthesize
+					// keypress events that otherwise won't fire
+					// on IE
+					var kd = node.onkeydown;
+					if(!kd || !kd[listenersName] || !kd._stealthKeydownHandle){
+						var h = del.add(node, "onkeydown", del._stealthKeyDown);
+						kd = node.onkeydown;
+						kd._stealthKeydownHandle = h;
+						kd._stealthKeydownRefs = 1;
+					}else{
+						kd._stealthKeydownRefs++;
+					}
+				}
+				return iel.add(node, event, del._fixCallback(fp));
+			},
+			remove: function(/*DOMNode*/node, /*String*/event, /*Handle*/handle){
+				event = del._normalizeEventName(event);
+				iel.remove(node, event, handle); 
+				if(event=="onkeypress"){
+					var kd = node.onkeydown;
+					if(--kd._stealthKeydownRefs <= 0){
+						iel.remove(node, "onkeydown", kd._stealthKeydownHandle);
+						delete kd._stealthKeydownHandle;
+					}
+				}
+			},
+			_normalizeEventName: function(/*String*/eventName){
+				// Generally, eventName should be lower case, unless it is
+				// special somehow (e.g. a Mozilla event)
+				// ensure 'on'
+				return eventName.slice(0,2) != "on" ? "on" + eventName : eventName;
+			},
+			_nop: function(){},
+			_fixEvent: function(/*Event*/evt, /*DOMNode*/sender){
+				// summary:
+				//		normalizes properties on the event object including event
+				//		bubbling methods, keystroke normalization, and x/y positions
+				// evt: native event object
+				// sender: node to treat as "currentTarget"
+				if(!evt){
+					var w = sender && (sender.ownerDocument || sender.document || sender).parentWindow || window;
+					evt = w.event; 
+				}
+				if(!evt){return(evt);}
+				evt.target = evt.srcElement; 
+				evt.currentTarget = (sender || evt.srcElement); 
+				evt.layerX = evt.offsetX;
+				evt.layerY = evt.offsetY;
+				// FIXME: scroll position query is duped from dojo.html to
+				// avoid dependency on that entire module. Now that HTML is in
+				// Base, we should convert back to something similar there.
+				var se = evt.srcElement, doc = (se && se.ownerDocument) || document;
+				// DO NOT replace the following to use dojo.body(), in IE, document.documentElement should be used
+				// here rather than document.body
+				var docBody = ((dojo.isIE < 6) || (doc["compatMode"] == "BackCompat")) ? doc.body : doc.documentElement;
+				var offset = dojo._getIeDocumentElementOffset();
+				evt.pageX = evt.clientX + dojo._fixIeBiDiScrollLeft(docBody.scrollLeft || 0) - offset.x;
+				evt.pageY = evt.clientY + (docBody.scrollTop || 0) - offset.y;
+				if(evt.type == "mouseover"){ 
+					evt.relatedTarget = evt.fromElement;
+				}
+				if(evt.type == "mouseout"){ 
+					evt.relatedTarget = evt.toElement;
+				}
+				evt.stopPropagation = del._stopPropagation;
+				evt.preventDefault = del._preventDefault;
+				return del._fixKeys(evt);
+			},
+			_fixKeys: function(evt){
+				switch(evt.type){
+					case "keypress":
+						var c = ("charCode" in evt ? evt.charCode : evt.keyCode);
+						if (c==10){
+							// CTRL-ENTER is CTRL-ASCII(10) on IE, but CTRL-ENTER on Mozilla
+							c=0;
+							evt.keyCode = 13;
+						}else if(c==13||c==27){
+							c=0; // Mozilla considers ENTER and ESC non-printable
+						}else if(c==3){
+							c=99; // Mozilla maps CTRL-BREAK to CTRL-c
+						}
+						// Mozilla sets keyCode to 0 when there is a charCode
+						// but that stops the event on IE.
+						evt.charCode = c;
+						del._setKeyChar(evt);
+						break;
+				}
+				return evt;
+			},
+			_stealthKeyDown: function(evt){
+				// IE doesn't fire keypress for most non-printable characters.
+				// other browsers do, we simulate it here.
+				var kp = evt.currentTarget.onkeypress;
+				// only works if kp exists and is a dispatcher
+				if(!kp || !kp[listenersName]){ return; }
+				// munge key/charCode
+				var k=evt.keyCode;
+				// These are Windows Virtual Key Codes
+				// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
+				var unprintable = (k!=13)&&(k!=32)&&(k!=27)&&(k<48||k>90)&&(k<96||k>111)&&(k<186||k>192)&&(k<219||k>222);
+				// synthesize keypress for most unprintables and CTRL-keys
+				if(unprintable||evt.ctrlKey){
+					var c = unprintable ? 0 : k;
+					if(evt.ctrlKey){
+						if(k==3 || k==13){
+							return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively 
+						}else if(c>95 && c<106){ 
+							c -= 48; // map CTRL-[numpad 0-9] to ASCII
+						}else if((!evt.shiftKey)&&(c>=65&&c<=90)){ 
+							c += 32; // map CTRL-[A-Z] to lowercase
+						}else{ 
+							c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
+						}
+					}
+					// simulate a keypress event
+					var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
+					kp.call(evt.currentTarget, faux);
+					evt.cancelBubble = faux.cancelBubble;
+					evt.returnValue = faux.returnValue;
+					_trySetKeyCode(evt, faux.keyCode);
+				}
+			},
+			// Called in Event scope
+			_stopPropagation: function(){
+				this.cancelBubble = true; 
+			},
+			_preventDefault: function(){
+				// Setting keyCode to 0 is the only way to prevent certain keypresses (namely
+				// ctrl-combinations that correspond to menu accelerator keys).
+				// Otoh, it prevents upstream listeners from getting this information
+				// Try to split the difference here by clobbering keyCode only for ctrl 
+				// combinations. If you still need to access the key upstream, bubbledKeyCode is
+				// provided as a workaround.
+				this.bubbledKeyCode = this.keyCode;
+				if(this.ctrlKey){_trySetKeyCode(this, 0);}
+				this.returnValue = false;
+			}
+		});
+				
+		// override stopEvent for IE
+		dojo.stopEvent = function(evt){
+			evt = evt || window.event;
+			del._stopPropagation.call(evt);
+			del._preventDefault.call(evt);
+		}
+	}
+
+	del._synthesizeEvent = function(evt, props){
+			var faux = dojo.mixin({}, evt, props);
+			del._setKeyChar(faux);
+			// FIXME: would prefer to use dojo.hitch: dojo.hitch(evt, evt.preventDefault); 
+			// but it throws an error when preventDefault is invoked on Safari
+			// does Event.preventDefault not support "apply" on Safari?
+			faux.preventDefault = function(){ evt.preventDefault(); }; 
+			faux.stopPropagation = function(){ evt.stopPropagation(); }; 
+			return faux;
+	}
+	
+	// Opera event normalization
+	if(dojo.isOpera){
+		dojo.mixin(del, {
+			_fixEvent: function(evt, sender){
+				switch(evt.type){
+					case "keypress":
+						var c = evt.which;
+						if(c==3){
+							c=99; // Mozilla maps CTRL-BREAK to CTRL-c
+						}
+						// can't trap some keys at all, like INSERT and DELETE
+						// there is no differentiating info between DELETE and ".", or INSERT and "-"
+						c = ((c<41)&&(!evt.shiftKey) ? 0 : c);
+						if((evt.ctrlKey)&&(!evt.shiftKey)&&(c>=65)&&(c<=90)){
+							// lowercase CTRL-[A-Z] keys
+							c += 32;
+						}
+						return del._synthesizeEvent(evt, { charCode: c });
+				}
+				return evt;
+			}
+		});
+	}
+
+	// Safari event normalization
+	if(dojo.isSafari){
+		del._add = del.add;
+		del._remove = del.remove;
+
+		dojo.mixin(del, {
+			add: function(/*DOMNode*/node, /*String*/event, /*Function*/fp){
+				if(!node){return;} // undefined
+				var handle = del._add(node, event, fp);
+				if(del._normalizeEventName(event) == "keypress"){
+					// we need to listen to onkeydown to synthesize
+					// keypress events that otherwise won't fire
+					// in Safari 3.1+: https://lists.webkit.org/pipermail/webkit-dev/2007-December/002992.html
+					handle._stealthKeyDownHandle = del._add(node, "keydown", function(evt){
+						//A variation on the IE _stealthKeydown function
+						//Synthesize an onkeypress event, but only for unprintable characters.
+						var k=evt.keyCode;
+						// These are Windows Virtual Key Codes
+						// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
+						var unprintable = (k!=13)&&(k!=32)&&(k!=27)&&(k<48||k>90)&&(k<96||k>111)&&(k<186||k>192)&&(k<219||k>222);
+						// synthesize keypress for most unprintables and CTRL-keys
+						if(unprintable||evt.ctrlKey){
+							var c = unprintable ? 0 : k;
+							if(evt.ctrlKey){
+								if(k==3 || k==13){
+									return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively 
+								}else if(c>95 && c<106){ 
+									c -= 48; // map CTRL-[numpad 0-9] to ASCII
+								}else if((!evt.shiftKey)&&(c>=65&&c<=90)){ 
+									c += 32; // map CTRL-[A-Z] to lowercase
+								}else{ 
+									c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
+								}
+							}
+							// simulate a keypress event
+							var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
+							fp.call(evt.currentTarget, faux);
+						}
+					});
+				}
+				return handle; /*Handle*/
+			},
+
+			remove: function(/*DOMNode*/node, /*String*/event, /*Handle*/handle){
+				if(node){
+					if(handle._stealthKeyDownHandle){
+						del._remove(node, "keydown", handle._stealthKeyDownHandle);
+					}
+					del._remove(node, event, handle);
+				}
+			},
+			_fixEvent: function(evt, sender){
+				switch(evt.type){
+					case "keypress":
+						if(evt.faux){ return evt; }
+						var c = evt.charCode;
+						c = c>=32? c : 0;
+						return del._synthesizeEvent(evt, {charCode: c, faux: true});
+				}
+				return evt;
+			}
+		});
+	}
+})();
+
+if(dojo.isIE){
+	// keep this out of the closure
+	// closing over 'iel' or 'ieh' b0rks leak prevention
+	// ls[i] is an index into the master handler array
+	dojo._ieDispatcher = function(args, sender){
+		var ap=Array.prototype, h=dojo._ie_listener.handlers, c=args.callee, ls=c[dojo._ieListenersName], t=h[c.target];
+		// return value comes from original target function
+		var r = t && t.apply(sender, args);
+		// make local copy of listener array so it's immutable during processing
+		var lls = [].concat(ls);
+		// invoke listeners after target function
+		for(var i in lls){
+			if(!(i in ap)){
+				h[lls[i]].apply(sender, args);
+			}
+		}
+		return r;
+	}
+	dojo._getIeDispatcher = function(){
+		// ensure the returned function closes over nothing ("new Function" apparently doesn't close)
+		return new Function(dojo._scopeName + "._ieDispatcher(arguments, this)"); // function
+	}
+	// keep this out of the closure to reduce RAM allocation
+	dojo._event_listener._fixCallback = function(fp){
+		var f = dojo._event_listener._fixEvent;
+		return function(e){ return fp.call(this, f(e, this)); };
+	}
+}
+
+}
+
+if(!dojo._hasResource["dojo._base.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.html"] = true;
+
+dojo.provide("dojo._base.html");
+
+// FIXME: need to add unit tests for all the semi-public methods
+
+try{
+	document.execCommand("BackgroundImageCache", false, true);
+}catch(e){
+	// sane browsers don't have cache "issues"
+}
+
+// =============================
+// DOM Functions
+// =============================
+
+/*=====
+dojo.byId = function(id, doc){
+	//	summary:
+	//		Returns DOM node with matching `id` attribute or `null` 
+	//		if not found, similar to "$" function in another library.
+	//		If `id` is a DomNode, this function is a no-op.
+	//
+	//	id: String|DOMNode
+	//	 	A string to match an HTML id attribute or a reference to a DOM Node
+	//
+	//	doc: Document?
+	//		Document to work in. Defaults to the current value of
+	//		dojo.doc.  Can be used to retrieve
+	//		node references from other documents.
+=====*/
+if(dojo.isIE || dojo.isOpera){
+	dojo.byId = function(id, doc){
+		if(dojo.isString(id)){
+			var _d = doc || dojo.doc;
+			var te = _d.getElementById(id);
+			// attributes.id.value is better than just id in case the 
+			// user has a name=id inside a form
+			if(te && te.attributes.id.value == id){
+				return te;
+			}else{
+				var eles = _d.all[id];
+				if(!eles || !eles.length){ return eles; }
+				// if more than 1, choose first with the correct id
+				var i=0;
+				while((te=eles[i++])){
+					if(te.attributes.id.value == id){ return te; }
+				}
+			}
+		}else{
+			return id; // DomNode
+		}
+	}
+}else{
+	dojo.byId = function(id, doc){
+		return dojo.isString(id) ? (doc || dojo.doc).getElementById(id) : id; // DomNode
+	}
+}
+/*=====
+}
+=====*/
+
+(function(){
+	var d = dojo;
+
+	var _destroyContainer = null;
+	dojo.addOnWindowUnload(function(){
+		_destroyContainer=null; //prevent IE leak
+	});
+
+	dojo._destroyElement = function(/*String||DomNode*/node){
+		// summary:
+		//		removes node from its parent, clobbers it and all of its
+		//		children.
+		//	node:
+		//		the element to be destroyed, either as an ID or a reference
+
+		node = d.byId(node);
+		try{
+			if(!_destroyContainer || _destroyContainer.ownerDocument != node.ownerDocument){
+				_destroyContainer = node.ownerDocument.createElement("div");
+			}
+			_destroyContainer.appendChild(node.parentNode ? node.parentNode.removeChild(node) : node);
+			// NOTE: see http://trac.dojotoolkit.org/ticket/2931. This may be a bug and not a feature
+			_destroyContainer.innerHTML = ""; 
+		}catch(e){
+			/* squelch */
+		}
+	};
+
+	dojo.isDescendant = function(/*DomNode|String*/node, /*DomNode|String*/ancestor){
+		//	summary:
+		//		Returns true if node is a descendant of ancestor
+		//	node: id or node reference to test
+		//	ancestor: id or node reference of potential parent to test against
+		try{
+			node = d.byId(node);
+			ancestor = d.byId(ancestor);
+			while(node){
+				if(node === ancestor){
+					return true; // Boolean
+				}
+				node = node.parentNode;
+			}
+		}catch(e){ /* squelch, return false */ }
+		return false; // Boolean
+	};
+
+	dojo.setSelectable = function(/*DomNode|String*/node, /*Boolean*/selectable){
+		//	summary: enable or disable selection on a node
+		//	node:
+		//		id or reference to node
+		//	selectable:
+		node = d.byId(node);
+		if(d.isMozilla){
+			node.style.MozUserSelect = selectable ? "" : "none";
+		}else if(d.isKhtml){
+			node.style.KhtmlUserSelect = selectable ? "auto" : "none";
+		}else if(d.isIE){
+			var v = (node.unselectable = selectable ? "" : "on");
+			d.query("*", node).forEach("item.unselectable = '"+v+"'");
+		}
+		//FIXME: else?  Opera?
+	};
+
+	var _insertBefore = function(/*Node*/node, /*Node*/ref){
+		ref.parentNode.insertBefore(node, ref);
+		return true;	//	boolean
+	}
+
+	var _insertAfter = function(/*Node*/node, /*Node*/ref){
+		//	summary:
+		//		Try to insert node after ref
+		var pn = ref.parentNode;
+		if(ref == pn.lastChild){
+			pn.appendChild(node);
+		}else{
+			return _insertBefore(node, ref.nextSibling);	//	boolean
+		}
+		return true;	//	boolean
+	}
+
+	dojo.place = function(/*String|DomNode*/node, /*String|DomNode*/refNode, /*String?|Number?*/position){
+		//	summary:
+		//		Attempt to insert node into the DOM, choosing from various positioning options.
+		//		Returns true if successful, false otherwise.
+		//	node: 
+		//		id or node reference to place relative to refNode
+		//	refNode: 
+		//		id or node reference to use as basis for placement
+		//	position:
+		//		string noting the position of node relative to refNode or a
+		//		number indicating the location in the childNodes collection of refNode. 
+		//		Accepted string values are:
+		//		* before
+		//		* after
+		//		* first
+		//		* last
+		//
+		//		"first" and "last" indicate positions as children of refNode.  position defaults
+		//		to "last" if not specified
+
+		// FIXME: need to write tests for this!!!!
+		if(!node || !refNode){
+			return false;	//	boolean 
+		}
+		node = d.byId(node);
+		refNode = d.byId(refNode);
+		if(typeof position == "number"){
+			var cn = refNode.childNodes;
+			if(!cn.length || cn.length <= position){
+				refNode.appendChild(node);
+				return true;
+			}
+			return _insertBefore(node, position <= 0 ? refNode.firstChild : cn[position]);
+		}
+		switch(position){
+			case "before":
+				return _insertBefore(node, refNode);	//	boolean
+			case "after":
+				return _insertAfter(node, refNode);		//	boolean
+			case "first":
+				if(refNode.firstChild){
+					return _insertBefore(node, refNode.firstChild);	//	boolean
+				}
+				// else fallthrough...
+			default: // aka: last
+				refNode.appendChild(node);
+				return true;	//	boolean
+		}
+	}
+
+	// Box functions will assume this model.
+	// On IE/Opera, BORDER_BOX will be set if the primary document is in quirks mode.
+	// Can be set to change behavior of box setters.
+	
+	// can be either:
+	//	"border-box"
+	//	"content-box" (default)
+	dojo.boxModel = "content-box";
+	
+	// We punt per-node box mode testing completely.
+	// If anybody cares, we can provide an additional (optional) unit 
+	// that overrides existing code to include per-node box sensitivity.
+
+	// Opera documentation claims that Opera 9 uses border-box in BackCompat mode.
+	// but experiments (Opera 9.10.8679 on Windows Vista) indicate that it actually continues to use content-box.
+	// IIRC, earlier versions of Opera did in fact use border-box.
+	// Opera guys, this is really confusing. Opera being broken in quirks mode is not our fault.
+
+	if(d.isIE /*|| dojo.isOpera*/){
+		var _dcm = document.compatMode;
+		// client code may have to adjust if compatMode varies across iframes
+		d.boxModel = _dcm == "BackCompat" || _dcm == "QuirksMode" || d.isIE<6 ? "border-box" : "content-box"; // FIXME: remove IE < 6 support?
+	}
+
+	// =============================
+	// Style Functions
+	// =============================
+	
+	// getComputedStyle drives most of the style code.
+	// Wherever possible, reuse the returned object.
+	//
+	// API functions below that need to access computed styles accept an 
+	// optional computedStyle parameter.
+	// If this parameter is omitted, the functions will call getComputedStyle themselves.
+	// This way, calling code can access computedStyle once, and then pass the reference to 
+	// multiple API functions. 
+
+/*=====
+	dojo.getComputedStyle = function(node){
+		//	summary:
+		//		Returns a "computed style" object.
+		//
+		//	description:
+		//		Gets a "computed style" object which can be used to gather
+		//		information about the current state of the rendered node. 
+		//
+		//		Note that this may behave differently on different browsers.
+		//		Values may have different formats and value encodings across
+		//		browsers.
+		//
+		//		Note also that this method is expensive.  Wherever possible,
+		//		reuse the returned object.
+		//
+		//		Use the dojo.style() method for more consistent (pixelized)
+		//		return values.
+		//
+		//	node: DOMNode
+		//		A reference to a DOM node. Does NOT support taking an
+		//		ID string for speed reasons.
+		//	example:
+		//	|	dojo.getComputedStyle(dojo.byId('foo')).borderWidth;
+		return; // CSS2Properties
+	}
+=====*/
+
+	// Although we normally eschew argument validation at this
+	// level, here we test argument 'node' for (duck)type.
+	// Argument node must also implement Element.  (Note: we check
+	// against HTMLElement rather than Element for interop with prototype.js)
+	// Because 'document' is the 'parentNode' of 'body'
+	// it is frequently sent to this function even 
+	// though it is not Element.
+	var gcs;
+	if(d.isSafari){
+		gcs = function(/*DomNode*/node){
+			var s;
+			if(node instanceof HTMLElement){
+				var dv = node.ownerDocument.defaultView;
+				s = dv.getComputedStyle(node, null);
+				if(!s && node.style){ 
+					node.style.display = ""; 
+					s = dv.getComputedStyle(node, null);
+				}
+			}
+			return s || {};
+		}; 
+	}else if(d.isIE){
+		gcs = function(node){
+			// IE (as of 7) doesn't expose Element like sane browsers
+			return node.nodeType == 1 /* ELEMENT_NODE*/ ? node.currentStyle : {};
+		};
+	}else{
+		gcs = function(node){
+			return node instanceof HTMLElement ? 
+				node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
+		};
+	}
+	dojo.getComputedStyle = gcs;
+
+	if(!d.isIE){
+		dojo._toPixelValue = function(element, value){
+			// style values can be floats, client code may want
+			// to round for integer pixels.
+			return parseFloat(value) || 0; 
+		};
+	}else{
+		dojo._toPixelValue = function(element, avalue){
+			if(!avalue){ return 0; }
+			// on IE7, medium is usually 4 pixels
+			if(avalue=="medium"){ return 4; }
+			// style values can be floats, client code may
+			// want to round this value for integer pixels.
+			if(avalue.slice && (avalue.slice(-2)=='px')){ return parseFloat(avalue); }
+			with(element){
+				var sLeft = style.left;
+				var rsLeft = runtimeStyle.left;
+				runtimeStyle.left = currentStyle.left;
+				try{
+					// 'avalue' may be incompatible with style.left, which can cause IE to throw
+					// this has been observed for border widths using "thin", "medium", "thick" constants
+					// those particular constants could be trapped by a lookup
+					// but perhaps there are more
+					style.left = avalue;
+					avalue = style.pixelLeft;
+				}catch(e){
+					avalue = 0;
+				}
+				style.left = sLeft;
+				runtimeStyle.left = rsLeft;
+			}
+			return avalue;
+		}
+	}
+	var px = d._toPixelValue;
+
+	// FIXME: there opacity quirks on FF that we haven't ported over. Hrm.
+	/*=====
+	dojo._getOpacity = function(node){
+			//	summary:
+			//		Returns the current opacity of the passed node as a
+			//		floating-point value between 0 and 1.
+			//	node: DomNode
+			//		a reference to a DOM node. Does NOT support taking an
+			//		ID string for speed reasons.
+			//	returns: Number between 0 and 1
+			return; // Number
+	}
+	=====*/
+
+	var astr = "DXImageTransform.Microsoft.Alpha";
+	var af = function(n, f){ 
+		try{
+			return n.filters.item(astr);
+		}catch(e){
+			return f ? {} : null;
+		}
+	}
+
+	dojo._getOpacity = d.isIE ? function(node){
+		try{
+			return af(node).Opacity / 100; // Number
+		}catch(e){
+			return 1; // Number
+		}
+	} : function(node){
+		return gcs(node).opacity;
+	};
+
+	/*=====
+	dojo._setOpacity = function(node, opacity){
+			//	summary:
+			//		set the opacity of the passed node portably. Returns the
+			//		new opacity of the node.
+			//	node: DOMNode
+			//		a reference to a DOM node. Does NOT support taking an
+			//		ID string for performance reasons.
+			//	opacity: Number
+			//		A Number between 0 and 1. 0 specifies transparent.
+			//	returns: Number between 0 and 1
+			return; // Number
+	}
+	=====*/
+
+	dojo._setOpacity = d.isIE ? function(/*DomNode*/node, /*Number*/opacity){
+		var ov = opacity * 100;
+		node.style.zoom = 1.0;
+
+		// on IE7 Alpha(Filter opacity=100) makes text look fuzzy so disable it altogether (bug #2661),
+		//but still update the opacity value so we can get a correct reading if it is read later.
+		af(node, 1).Enabled = (opacity == 1 ? false : true);
+
+		if(!af(node)){
+			node.style.filter += " progid:"+astr+"(Opacity="+ov+")";
+		}else{
+			af(node, 1).Opacity = ov;
+		}
+
+		if(node.nodeName.toLowerCase() == "tr"){
+			d.query("> td", node).forEach(function(i){
+				d._setOpacity(i, opacity);
+			});
+		}
+		return opacity;
+	} : function(node, opacity){
+		return node.style.opacity = opacity;
+	};
+
+	var _pixelNamesCache = {
+		left: true, top: true
+	};
+	var _pixelRegExp = /margin|padding|width|height|max|min|offset/;  // |border
+	var _toStyleValue = function(node, type, value){
+		type = type.toLowerCase(); // FIXME: should we really be doing string case conversion here? Should we cache it? Need to profile!
+		if(d.isIE){
+			if(value == "auto"){
+				if(type == "height"){ return node.offsetHeight; }
+				if(type == "width"){ return node.offsetWidth; }
+			}
+			if(type == "fontweight"){
+				switch(value){
+					case 700: return "bold";
+					case 400:
+					default: return "normal";
+				}
+			}
+		}
+		if(!(type in _pixelNamesCache)){
+			_pixelNamesCache[type] = _pixelRegExp.test(type);
+		}
+		return _pixelNamesCache[type] ? px(node, value) : value;
+	}
+
+	var _floatStyle = d.isIE ? "styleFloat" : "cssFloat";
+	var _floatAliases = { "cssFloat": _floatStyle, "styleFloat": _floatStyle, "float": _floatStyle };
+	
+	// public API
+	
+	dojo.style = function(	/*DomNode|String*/ node, 
+							/*String?|Object?*/ style, 
+							/*String?*/ value){
+		//	summary:
+		//		Accesses styles on a node. If 2 arguments are
+		//		passed, acts as a getter. If 3 arguments are passed, acts
+		//		as a setter.
+		//	node:
+		//		id or reference to node to get/set style for
+		//	style:
+		//		the style property to set in DOM-accessor format
+		//		("borderWidth", not "border-width") or an object with key/value
+		//		pairs suitable for setting each property.
+		//	value:
+		//		If passed, sets value on the node for style, handling
+		//		cross-browser concerns.
+		//	example:
+		//		Passing only an ID or node returns the computed style object of
+		//		the node:
+		//	|	dojo.style("thinger");
+		//	example:
+		//		Passing a node and a style property returns the current
+		//		normalized, computed value for that property:
+		//	|	dojo.style("thinger", "opacity"); // 1 by default
+		//
+		//	example:
+		//		Passing a node, a style property, and a value changes the
+		//		current display of the node and returns the new computed value
+		//	|	dojo.style("thinger", "opacity", 0.5); // == 0.5
+		//
+		//	example:
+		//		Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:
+		//	|	dojo.style("thinger", {
+		//	|		"opacity": 0.5,
+		//	|		"border": "3px solid black",
+		//	|		"height": 300
+		//	|	});
+		//
+		// 	example:
+		//		When the CSS style property is hyphenated, the JavaScript property is camelCased.
+		//		font-size becomes fontSize, and so on.
+		//	|	dojo.style("thinger",{
+		//	|		fontSize:"14pt",
+		//	|		letterSpacing:"1.2em"
+		//	|	});
+		//
+		//	example:
+		//		dojo.NodeList implements .style() using the same syntax, omitting the "node" parameter, calling
+		//		dojo.style() on every element of the list. See: dojo.query and dojo.NodeList
+		//	|	dojo.query(".someClassName").style("visibility","hidden");
+		//	|	// or
+		//	|	dojo.query("#baz > div").style({
+		//	|		opacity:0.75,
+		//	|		fontSize:"13pt"
+		//	|	});
+
+		var n = d.byId(node), args = arguments.length, op = (style=="opacity");
+		style = _floatAliases[style] || style;
+		if(args == 3){
+			return op ? d._setOpacity(n, value) : n.style[style] = value; /*Number*/
+		}
+		if(args == 2 && op){
+			return d._getOpacity(n);
+		}
+		var s = gcs(n);
+		if(args == 2 && !d.isString(style)){
+			for(var x in style){
+				d.style(node, x, style[x]);
+			}
+			return s;
+		}
+		return (args == 1) ? s : _toStyleValue(n, style, s[style]||n.style[style]); /* CSS2Properties||String||Number */
+	}
+
+	// =============================
+	// Box Functions
+	// =============================
+
+	dojo._getPadExtents = function(/*DomNode*/n, /*Object*/computedStyle){
+		//	summary:
+		// 		Returns object with special values specifically useful for node
+		// 		fitting.
+		//
+		// 		* l/t = left/top padding (respectively)
+		// 		* w = the total of the left and right padding 
+		// 		* h = the total of the top and bottom padding
+		//
+		//		If 'node' has position, l/t forms the origin for child nodes. 
+		//		The w/h are used for calculating boxes.
+		//		Normally application code will not need to invoke this
+		//		directly, and will use the ...box... functions instead.
+		var 
+			s = computedStyle||gcs(n), 
+			l = px(n, s.paddingLeft), 
+			t = px(n, s.paddingTop);
+		return { 
+			l: l,
+			t: t,
+			w: l+px(n, s.paddingRight),
+			h: t+px(n, s.paddingBottom)
+		};
+	}
+
+	dojo._getBorderExtents = function(/*DomNode*/n, /*Object*/computedStyle){
+		//	summary:
+		//		returns an object with properties useful for noting the border
+		//		dimensions.
+		//
+		// 		* l/t = the sum of left/top border (respectively)
+		//		* w = the sum of the left and right border
+		//		* h = the sum of the top and bottom border
+		//
+		//		The w/h are used for calculating boxes.
+		//		Normally application code will not need to invoke this
+		//		directly, and will use the ...box... functions instead.
+		var 
+			ne = "none",
+			s = computedStyle||gcs(n), 
+			bl = (s.borderLeftStyle != ne ? px(n, s.borderLeftWidth) : 0),
+			bt = (s.borderTopStyle != ne ? px(n, s.borderTopWidth) : 0);
+		return { 
+			l: bl,
+			t: bt,
+			w: bl + (s.borderRightStyle!=ne ? px(n, s.borderRightWidth) : 0),
+			h: bt + (s.borderBottomStyle!=ne ? px(n, s.borderBottomWidth) : 0)
+		};
+	}
+
+	dojo._getPadBorderExtents = function(/*DomNode*/n, /*Object*/computedStyle){
+		//	summary:
+		//		returns object with properties useful for box fitting with
+		//		regards to padding.
+		//
+		//		* l/t = the sum of left/top padding and left/top border (respectively)
+		//		* w = the sum of the left and right padding and border
+		//		* h = the sum of the top and bottom padding and border
+		//
+		//		The w/h are used for calculating boxes.
+		//		Normally application code will not need to invoke this
+		//		directly, and will use the ...box... functions instead.
+		var 
+			s = computedStyle||gcs(n), 
+			p = d._getPadExtents(n, s),
+			b = d._getBorderExtents(n, s);
+		return { 
+			l: p.l + b.l,
+			t: p.t + b.t,
+			w: p.w + b.w,
+			h: p.h + b.h
+		};
+	}
+
+	dojo._getMarginExtents = function(n, computedStyle){
+		//	summary:
+		//		returns object with properties useful for box fitting with
+		//		regards to box margins (i.e., the outer-box).
+		//
+		//		* l/t = marginLeft, marginTop, respectively
+		//		* w = total width, margin inclusive
+		//		* h = total height, margin inclusive
+		//
+		//		The w/h are used for calculating boxes.
+		//		Normally application code will not need to invoke this
+		//		directly, and will use the ...box... functions instead.
+		var 
+			s = computedStyle||gcs(n), 
+			l = px(n, s.marginLeft),
+			t = px(n, s.marginTop),
+			r = px(n, s.marginRight),
+			b = px(n, s.marginBottom);
+		if(d.isSafari && (s.position != "absolute")){
+			// FIXME: Safari's version of the computed right margin
+			// is the space between our right edge and the right edge 
+			// of our offsetParent. 
+			// What we are looking for is the actual margin value as 
+			// determined by CSS.
+			// Hack solution is to assume left/right margins are the same.
+			r = l;
+		}
+		return { 
+			l: l,
+			t: t,
+			w: l+r,
+			h: t+b
+		};
+	}
+
+	// Box getters work in any box context because offsetWidth/clientWidth
+	// are invariant wrt box context
+	//
+	// They do *not* work for display: inline objects that have padding styles
+	// because the user agent ignores padding (it's bogus styling in any case)
+	//
+	// Be careful with IMGs because they are inline or block depending on 
+	// browser and browser mode.
+
+	// Although it would be easier to read, there are not separate versions of 
+	// _getMarginBox for each browser because:
+	// 1. the branching is not expensive
+	// 2. factoring the shared code wastes cycles (function call overhead)
+	// 3. duplicating the shared code wastes bytes
+	
+	dojo._getMarginBox = function(/*DomNode*/node, /*Object*/computedStyle){
+		// summary:
+		//		returns an object that encodes the width, height, left and top
+		//		positions of the node's margin box.
+		var s = computedStyle||gcs(node), me = d._getMarginExtents(node, s);
+		var l = node.offsetLeft - me.l, t = node.offsetTop - me.t, p = node.parentNode;
+		if(d.isMoz){
+			// Mozilla:
+			// If offsetParent has a computed overflow != visible, the offsetLeft is decreased
+			// by the parent's border.
+			// We don't want to compute the parent's style, so instead we examine node's
+			// computed left/top which is more stable.
+			var sl = parseFloat(s.left), st = parseFloat(s.top);
+			if(!isNaN(sl) && !isNaN(st)){
+				l = sl, t = st;
+			}else{
+				// If child's computed left/top are not parseable as a number (e.g. "auto"), we
+				// have no choice but to examine the parent's computed style.
+				if(p && p.style){
+					var pcs = gcs(p);
+					if(pcs.overflow != "visible"){
+						var be = d._getBorderExtents(p, pcs);
+						l += be.l, t += be.t;
+					}
+				}
+			}
+		}else if(d.isOpera){
+			// On Opera, offsetLeft includes the parent's border
+			if(p){
+				var be = d._getBorderExtents(p);
+				l -= be.l;
+				t -= be.t;
+			}
+		}
+		return { 
+			l: l, 
+			t: t, 
+			w: node.offsetWidth + me.w, 
+			h: node.offsetHeight + me.h 
+		};
+	}
+	
+	dojo._getContentBox = function(node, computedStyle){
+		// summary:
+		//		Returns an object that encodes the width, height, left and top
+		//		positions of the node's content box, irrespective of the
+		//		current box model.
+
+		// clientWidth/Height are important since the automatically account for scrollbars
+		// fallback to offsetWidth/Height for special cases (see #3378)
+		var s=computedStyle||gcs(node), pe=d._getPadExtents(node, s), be=d._getBorderExtents(node, s), w=node.clientWidth, h;
+		if(!w){
+			w=node.offsetWidth, h=node.offsetHeight;
+		}else{
+			h=node.clientHeight, be.w = be.h = 0; 
+		}
+		// On Opera, offsetLeft includes the parent's border
+		if(d.isOpera){ pe.l += be.l; pe.t += be.t; };
+		return { 
+			l: pe.l, 
+			t: pe.t, 
+			w: w - pe.w - be.w, 
+			h: h - pe.h - be.h
+		};
+	}
+
+	dojo._getBorderBox = function(node, computedStyle){
+		var s=computedStyle||gcs(node), pe=d._getPadExtents(node, s), cb=d._getContentBox(node, s);
+		return { 
+			l: cb.l - pe.l, 
+			t: cb.t - pe.t, 
+			w: cb.w + pe.w, 
+			h: cb.h + pe.h
+		};
+	}
+
+	// Box setters depend on box context because interpretation of width/height styles
+	// vary wrt box context.
+	//
+	// The value of dojo.boxModel is used to determine box context.
+	// dojo.boxModel can be set directly to change behavior.
+	//
+	// Beware of display: inline objects that have padding styles
+	// because the user agent ignores padding (it's a bogus setup anyway)
+	//
+	// Be careful with IMGs because they are inline or block depending on 
+	// browser and browser mode.
+	// 
+	// Elements other than DIV may have special quirks, like built-in
+	// margins or padding, or values not detectable via computedStyle.
+	// In particular, margins on TABLE do not seems to appear 
+	// at all in computedStyle on Mozilla.
+	
+	dojo._setBox = function(/*DomNode*/node, /*Number?*/l, /*Number?*/t, /*Number?*/w, /*Number?*/h, /*String?*/u){
+		//	summary:
+		//		sets width/height/left/top in the current (native) box-model
+		//		dimentions. Uses the unit passed in u.
+		//	node: DOM Node reference. Id string not supported for performance reasons.
+		//	l: optional. left offset from parent.
+		//	t: optional. top offset from parent.
+		//	w: optional. width in current box model.
+		//	h: optional. width in current box model.
+		//	u: optional. unit measure to use for other measures. Defaults to "px".
+		u = u || "px";
+		var s = node.style;
+		if(!isNaN(l)){ s.left = l+u; }
+		if(!isNaN(t)){ s.top = t+u; }
+		if(w>=0){ s.width = w+u; }
+		if(h>=0){ s.height = h+u; }
+	}
+
+	dojo._isButtonTag = function(/*DomNode*/node) {
+		// summary:
+		//		True if the node is BUTTON or INPUT.type="button".
+		return node.tagName == "BUTTON" 
+			|| node.tagName=="INPUT" && node.getAttribute("type").toUpperCase() == "BUTTON"; // boolean
+	}
+	
+	dojo._usesBorderBox = function(/*DomNode*/node){
+		//	summary: 
+		//		True if the node uses border-box layout.
+
+		// We could test the computed style of node to see if a particular box
+		// has been specified, but there are details and we choose not to bother.
+		
+		// TABLE and BUTTON (and INPUT type=button) are always border-box by default.
+		// If you have assigned a different box to either one via CSS then
+		// box functions will break.
+		
+		var n = node.tagName;
+		return d.boxModel=="border-box" || n=="TABLE" || dojo._isButtonTag(node); // boolean
+	}
+
+	dojo._setContentSize = function(/*DomNode*/node, /*Number*/widthPx, /*Number*/heightPx, /*Object*/computedStyle){
+		//	summary:
+		//		Sets the size of the node's contents, irrespective of margins,
+		//		padding, or borders.
+		if(d._usesBorderBox(node)){
+			var pb = d._getPadBorderExtents(node, computedStyle);
+			if(widthPx >= 0){ widthPx += pb.w; }
+			if(heightPx >= 0){ heightPx += pb.h; }
+		}
+		d._setBox(node, NaN, NaN, widthPx, heightPx);
+	}
+
+	dojo._setMarginBox = function(/*DomNode*/node, 	/*Number?*/leftPx, /*Number?*/topPx, 
+													/*Number?*/widthPx, /*Number?*/heightPx, 
+													/*Object*/computedStyle){
+		//	summary:
+		//		sets the size of the node's margin box and placement
+		//		(left/top), irrespective of box model. Think of it as a
+		//		passthrough to dojo._setBox that handles box-model vagaries for
+		//		you.
+
+		var s = computedStyle||gcs(node);
+		// Some elements have special padding, margin, and box-model settings. 
+		// To use box functions you may need to set padding, margin explicitly.
+		// Controlling box-model is harder, in a pinch you might set dojo.boxModel.
+		var bb=d._usesBorderBox(node),
+				pb=bb ? _nilExtents : d._getPadBorderExtents(node, s);
+		if (dojo.isSafari) {
+			// on Safari (3.1.2), button nodes with no explicit size have a default margin
+			// setting an explicit size eliminates the margin.
+			// We have to swizzle the width to get correct margin reading.
+			if (dojo._isButtonTag(node)){
+				var ns = node.style;
+				if (widthPx>=0 && !ns.width) { ns.width = "4px"; }
+				if (heightPx>=0 && !ns.height) { ns.height = "4px"; }
+			}
+		}
+		var mb=d._getMarginExtents(node, s);
+		if(widthPx>=0){ widthPx = Math.max(widthPx - pb.w - mb.w, 0); }
+		if(heightPx>=0){ heightPx = Math.max(heightPx - pb.h - mb.h, 0); }
+		d._setBox(node, leftPx, topPx, widthPx, heightPx);
+	}
+	
+	var _nilExtents = { l:0, t:0, w:0, h:0 };
+
+	// public API
+	
+	dojo.marginBox = function(/*DomNode|String*/node, /*Object?*/box){
+		//	summary:
+		//		Getter/setter for the margin-box of node.
+		//	description: 
+		//		Returns an object in the expected format of box (regardless
+		//		if box is passed). The object might look like:
+		//			`{ l: 50, t: 200, w: 300: h: 150 }`
+		//		for a node offset from its parent 50px to the left, 200px from
+		//		the top with a margin width of 300px and a margin-height of
+		//		150px.
+		//	node:
+		//		id or reference to DOM Node to get/set box for
+		//	box:
+		//		If passed, denotes that dojo.marginBox() should
+		//		update/set the margin box for node. Box is an object in the
+		//		above format. All properties are optional if passed.
+		var n=d.byId(node), s=gcs(n), b=box;
+		return !b ? d._getMarginBox(n, s) : d._setMarginBox(n, b.l, b.t, b.w, b.h, s); // Object
+	}
+
+	dojo.contentBox = function(/*DomNode|String*/node, /*Object?*/box){
+		//	summary:
+		//		Getter/setter for the content-box of node.
+		//	description:
+		//		Returns an object in the expected format of box (regardless if box is passed).
+		//		The object might look like:
+		//			`{ l: 50, t: 200, w: 300: h: 150 }`
+		//		for a node offset from its parent 50px to the left, 200px from
+		//		the top with a content width of 300px and a content-height of
+		//		150px. Note that the content box may have a much larger border
+		//		or margin box, depending on the box model currently in use and
+		//		CSS values set/inherited for node.
+		//	node:
+		//		id or reference to DOM Node to get/set box for
+		//	box:
+		//		If passed, denotes that dojo.contentBox() should
+		//		update/set the content box for node. Box is an object in the
+		//		above format. All properties are optional if passed.
+		var n=d.byId(node), s=gcs(n), b=box;
+		return !b ? d._getContentBox(n, s) : d._setContentSize(n, b.w, b.h, s); // Object
+	}
+	
+	// =============================
+	// Positioning 
+	// =============================
+	
+	var _sumAncestorProperties = function(node, prop){
+		if(!(node = (node||0).parentNode)){return 0};
+		var val, retVal = 0, _b = d.body();
+		while(node && node.style){
+			if(gcs(node).position == "fixed"){
+				return 0;
+			}
+			val = node[prop];
+			if(val){
+				retVal += val - 0;
+				// opera and khtml #body & #html has the same values, we only
+				// need one value
+				if(node == _b){ break; }
+			}
+			node = node.parentNode;
+		}
+		return retVal;	//	integer
+	}
+
+	dojo._docScroll = function(){
+		var 
+			_b = d.body(),
+			_w = d.global,
+			de = d.doc.documentElement;
+		return {
+			y: (_w.pageYOffset || de.scrollTop || _b.scrollTop || 0),
+			x: (_w.pageXOffset || d._fixIeBiDiScrollLeft(de.scrollLeft) || _b.scrollLeft || 0)
+		};
+	};
+	
+	dojo._isBodyLtr = function(){
+		//FIXME: could check html and body tags directly instead of computed style?  need to ignore case, accept empty values
+		return !("_bodyLtr" in d) ? 
+			d._bodyLtr = gcs(d.body()).direction == "ltr" :
+			d._bodyLtr; // Boolean 
+	}
+	
+	dojo._getIeDocumentElementOffset = function(){
+		// summary
+		// The following values in IE contain an offset:
+		//     event.clientX 
+		//     event.clientY 
+		//     node.getBoundingClientRect().left
+		//     node.getBoundingClientRect().top
+		// But other position related values do not contain this offset, such as
+		// node.offsetLeft, node.offsetTop, node.style.left and node.style.top.
+		// The offset is always (2, 2) in LTR direction. When the body is in RTL
+		// direction, the offset counts the width of left scroll bar's width.
+		// This function computes the actual offset.
+
+		//NOTE: assumes we're being called in an IE browser
+
+		var de = d.doc.documentElement;
+		//FIXME: use this instead?			var de = d.compatMode == "BackCompat" ? d.body : d.documentElement;
+
+		return (d.isIE >= 7) ?
+			{x: de.getBoundingClientRect().left, y: de.getBoundingClientRect().top}
+		:
+			// IE 6.0
+			{x: d._isBodyLtr() || window.parent == window ?
+				de.clientLeft : de.offsetWidth - de.clientWidth - de.clientLeft, 
+				y: de.clientTop}; // Object
+	};
+	
+	dojo._fixIeBiDiScrollLeft = function(/*Integer*/ scrollLeft){
+		// In RTL direction, scrollLeft should be a negative value, but IE 
+		// returns a positive one. All codes using documentElement.scrollLeft
+		// must call this function to fix this error, otherwise the position
+		// will offset to right when there is a horizontal scrollbar.
+		var dd = d.doc;
+		if(d.isIE && !dojo._isBodyLtr()){
+			var de = dd.compatMode == "BackCompat" ? dd.body : dd.documentElement;
+			return scrollLeft + de.clientWidth - de.scrollWidth; // Integer
+		}
+		return scrollLeft; // Integer
+	}
+
+	dojo._abs = function(/*DomNode*/node, /*Boolean?*/includeScroll){
+		//	summary:
+		//		Gets the position of the passed element relative to
+		//		the viewport (if includeScroll==false), or relative to the
+		//		document root (if includeScroll==true).
+		//
+		//		Returns an object of the form:
+		//			{ x: 100, y: 300 }
+		//		if includeScroll is passed, the x and y values will include any
+		//		document offsets that may affect the position relative to the
+		//		viewport.
+
+		// FIXME: need to decide in the brave-new-world if we're going to be
+		// margin-box or border-box.
+		var ownerDocument = node.ownerDocument;
+		var ret = {
+			x: 0,
+			y: 0
+		};
+
+		// targetBoxType == "border-box"
+		var db = d.body();
+		if(d.isIE || (d.isFF >= 3)){
+			var client = node.getBoundingClientRect();
+			var cs;
+			if(d.isFF){
+				// in FF3 you have to subract the document element margins
+				var dv = node.ownerDocument.defaultView;
+				cs=dv.getComputedStyle(db.parentNode, null);
+			}
+			var offset = (d.isIE) ? d._getIeDocumentElementOffset() : { x: px(db.parentNode,cs.marginLeft), y: px(db.parentNode,cs.marginTop)};
+			ret.x = client.left - offset.x;
+			ret.y = client.top - offset.y;
+		}else{
+			if(node["offsetParent"]){
+				var endNode;
+				// in Safari, if the node is an absolutely positioned child of
+				// the body and the body has a margin the offset of the child
+				// and the body contain the body's margins, so we need to end
+				// at the body
+				// FIXME: getting contrary results to the above in latest WebKit.
+				if(d.isSafari &&
+					//(node.style.getPropertyValue("position") == "absolute") &&
+					(gcs(node).position == "absolute") &&
+					(node.parentNode == db)){
+					endNode = db;
+				}else{
+					endNode = db.parentNode;
+				}
+				// Opera seems to be double counting for some elements
+				var cs=gcs(node);
+				var n=node;
+				if(d.isOpera&&cs.position!="absolute"){
+					n=n.offsetParent;
+				}
+				ret.x -= _sumAncestorProperties(n, "scrollLeft");
+				ret.y -= _sumAncestorProperties(n, "scrollTop");
+
+				var curnode = node;
+				do{
+					var n = curnode.offsetLeft;
+					//FIXME: ugly hack to workaround the submenu in 
+					//popupmenu2 does not shown up correctly in opera. 
+					//Someone have a better workaround?
+					if(!d.isOpera || n > 0){
+						ret.x += isNaN(n) ? 0 : n;
+					}
+					var t = curnode.offsetTop;
+					ret.y += isNaN(t) ? 0 : t;
+					var cs = gcs(curnode);
+					if(curnode != node){
+						if(d.isSafari){
+							ret.x += px(curnode, cs.borderLeftWidth);
+							ret.y += px(curnode, cs.borderTopWidth);
+						}else if(d.isFF){
+							// tried left+right with differently sized left/right borders
+							// it really is 2xleft border in FF, not left+right, even in RTL!
+							ret.x += 2*px(curnode,cs.borderLeftWidth);
+							ret.y += 2*px(curnode,cs.borderTopWidth);
+						}
+					}
+					// static children in a static div in FF2 are affected by the div's border as well
+					// but offsetParent will skip this div!
+					if(d.isFF&&cs.position=="static"){
+						var parent=curnode.parentNode;
+						while(parent!=curnode.offsetParent){
+							var pcs=gcs(parent);
+							if(pcs.position=="static"){
+								ret.x += px(curnode,pcs.borderLeftWidth);
+								ret.y += px(curnode,pcs.borderTopWidth);
+							}
+							parent=parent.parentNode;
+						}
+					}
+					curnode = curnode.offsetParent;
+				}while((curnode != endNode) && curnode);
+			}else if(node.x && node.y){
+				ret.x += isNaN(node.x) ? 0 : node.x;
+				ret.y += isNaN(node.y) ? 0 : node.y;
+			}
+		}
+		// account for document scrolling
+		// if offsetParent is used, ret value already includes scroll position
+		// so we may have to actually remove that value if !includeScroll
+		if(includeScroll){
+			var scroll = d._docScroll();
+			ret.y += scroll.y;
+			ret.x += scroll.x;
+		}
+
+		return ret; // object
+	}
+
+	// FIXME: need a setter for coords or a moveTo!!
+	dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){
+		//	summary:
+		//		Returns an object that measures margin box width/height and
+		//		absolute positioning data from dojo._abs().
+		//
+		//	description:
+		//		Returns an object that measures margin box width/height and
+		//		absolute positioning data from dojo._abs().
+		//		Return value will be in the form:
+		//			`{ l: 50, t: 200, w: 300: h: 150, x: 100, y: 300 }`
+		//		Does not act as a setter. If includeScroll is passed, the x and
+		//		y params are affected as one would expect in dojo._abs().
+		var n=d.byId(node), s=gcs(n), mb=d._getMarginBox(n, s);
+		var abs = d._abs(n, includeScroll);
+		mb.x = abs.x;
+		mb.y = abs.y;
+		return mb;
+	}
+
+	// =============================
+	// Element attribute Functions
+	// =============================
+
+	var ieLT8 = d.isIE < 8;
+
+	var _fixAttrName = function(/*String*/name){
+		switch(name.toLowerCase()){
+			case "tabindex":
+				// Internet Explorer will only set or remove tabindex
+				// if it is spelled "tabIndex"
+				// 
+				return ieLT8 ? "tabIndex" : "tabindex";
+			case "for": case "htmlfor":
+				// to pick up for attrib set in markup via getAttribute() IE<8 uses "htmlFor" and others use "for"
+				// get/setAttribute works in all as long use same value for both get/set
+				return ieLT8 ? "htmlFor" : "for";
+			case "class" :
+				return d.isIE ? "className" : "class";
+			default:
+				return name;
+		}
+	}
+
+	// non-deprecated HTML4 attributes with default values
+	// http://www.w3.org/TR/html401/index/attributes.html
+	// FF and Safari will return the default values if you
+	// access the attributes via a property but not
+	// via getAttribute()
+	var _attrProps = {
+		colspan: "colSpan",
+		enctype: "enctype",
+		frameborder: "frameborder",
+		method: "method",
+		rowspan: "rowSpan",
+		scrolling: "scrolling",
+		shape: "shape",
+		span: "span",
+		type: "type",
+		valuetype: "valueType"
+	}
+
+	dojo.hasAttr = function(/*DomNode|String*/node, /*String*/name){
+		//	summary:
+		//		Returns true if the requested attribute is specified on the
+		//		given element, and false otherwise.
+		//	node:
+		//		id or reference to the element to check
+		//	name:
+		//		the name of the attribute
+		//	returns:
+		//		true if the requested attribute is specified on the
+		//		given element, and false otherwise
+		node = d.byId(node);
+		var fixName = _fixAttrName(name);
+		fixName = fixName == "htmlFor" ? "for" : fixName; //IE<8 uses htmlFor except in this case
+		var attr = node.getAttributeNode && node.getAttributeNode(fixName);
+		return attr ? attr.specified : false; // Boolean
+	}
+
+	var _evtHdlrMap = {
+		
+	}
+
+	var _ctr = 0;
+	var _attrId = dojo._scopeName + "attrid";
+
+	dojo.attr = function(/*DomNode|String*/node, /*String|Object*/name, /*String?*/value){
+		//	summary:
+		//		Gets or sets an attribute on an HTML element.
+		//	description:
+		//		Handles normalized getting and setting of attributes on DOM
+		//		Nodes. If 2 arguments are passed, and a the second argumnt is a
+		//		string, acts as a getter.
+		//	
+		//		If a third argument is passed, or if the second argumnt is a
+		//		map of attributes, acts as a setter.
+		//
+		//		When passing functions as values, note that they will not be
+		//		directly assigned to slots on the node, but rather the default
+		//		behavior will be removed and the new behavior will be added
+		//		using `dojo.connect()`, meaning that event handler properties
+		//		will be normalized and that some caveats with regards to
+		//		non-standard behaviors for onsubmit apply. Namely that you
+		//		should cancel form submission using `dojo.stopEvent()` on the
+		//		passed event object instead of returning a boolean value from
+		//		the handler itself.
+		//	node:
+		//		id or reference to the element to get or set the attribute on
+		//	name:
+		//		the name of the attribute to get or set.
+		//	value:
+		//		The value to set for the attribute
+		//	returns:
+		//		when used as a getter, the value of the requested attribute
+		//		or null if that attribute does not have a specified or
+		//		default value;
+		//
+		//		when user as a setter, undefined
+		//
+		//	example:
+		//	|	// get the current value of the "foo" attribute on a node
+		//	|	dojo.attr(dojo.byId("nodeId"), "foo");
+		//	|	// or we can just pass the id:
+		//	|	dojo.attr("nodeId", "foo");
+		//
+		//	example:
+		//	|	// use attr() to set the tab index
+		//	|	dojo.attr("nodeId", "tabindex", 3);
+		//	|
+		//
+		//	example:
+		//	|	// set multiple values at once, including event handlers:
+		//	|	dojo.attr("formId", {
+		//	|		"foo": "bar",
+		//	|		"tabindex": -1,
+		//	|		"method": "POST",
+		//	|		"onsubmit": function(e){
+		//	|			// stop submitting the form. Note that the IE behavior
+		//	|			// of returning true or false will have no effect here
+		//	|			// since our handler is connect()ed to the built-in
+		//	|			// onsubmit behavior and so we need to use
+		//	|			// dojo.stopEvent() to ensure that the submission
+		//	|			// doesn't proceed.
+		//	|			dojo.stopEvent(e);
+		//	|
+		//	|			// submit the form with Ajax
+		//	|			dojo.xhrPost({ form: "formId" });
+		//	|		}
+		//	|	});
+
+		var args = arguments.length;
+		if(args == 2 && !d.isString(name)){
+			for(var x in name){ d.attr(node, x, name[x]); }
+			return;
+		}
+		node = d.byId(node);
+		name = _fixAttrName(name);
+		if(args == 3){
+			// FIXME:
+			//		what about when the name is "style" and value is an object?
+			//		It seems natural to pass it in to dojo.style(node,
+			//		value)...should we support this?
+			if(d.isFunction(value)){
+				// clobber if we can
+				var attrId = d.attr(node, _attrId);
+				if(!attrId){
+					attrId = _ctr++;
+					d.attr(node, _attrId, attrId);
+				}
+				if(!_evtHdlrMap[attrId]){
+					_evtHdlrMap[attrId] = {};
+				}
+				var h = _evtHdlrMap[attrId][name];
+				if(h){
+					d.disconnect(h);
+				}else{
+					try{
+						delete node[name];
+					}catch(e){}
+				}
+
+				// ensure that event objects are normalized, etc.
+				_evtHdlrMap[attrId][name] = d.connect(node, name, value);
+
+			}else if(
+				(typeof value == "boolean")|| // e.g. onsubmit, disabled
+				(name == "innerHTML")
+			){
+				node[name] = value;
+			}else if((name == "style")&&(!d.isString(value))){
+				d.style(node, value);
+			}else{
+				node.setAttribute(name, value);
+			}
+			return;
+		}else{
+			// should we access this attribute via a property or
+			// via getAttribute()?
+			var prop = _attrProps[name.toLowerCase()];
+			if(prop){
+				return node[prop];
+			}else{
+				var attrValue = node[name];
+				return (typeof attrValue == 'boolean' || typeof attrValue == 'function') ? attrValue
+					: (d.hasAttr(node, name) ? node.getAttribute(name) : null);
+			}
+		}
+	}
+
+	dojo.removeAttr = function(/*DomNode|String*/node, /*String*/name){
+		//	summary:
+		//		Removes an attribute from an HTML element.
+		//	node:
+		//		id or reference to the element to remove the attribute from
+		//	name:
+		//		the name of the attribute to remove
+		d.byId(node).removeAttribute(_fixAttrName(name));
+	}
+
+	/*
+	dojo.createElement = function(type, attrs, parent, position){
+		// TODO: need to finish this!
+	}
+	*/
+
+	// =============================
+	// (CSS) Class Functions
+	// =============================
+	var _className = "className";
+
+	dojo.hasClass = function(/*DomNode|String*/node, /*String*/classStr){
+		//	summary:
+		//		Returns whether or not the specified classes are a portion of the
+		//		class list currently applied to the node. 
+		return ((" "+ d.byId(node)[_className] +" ").indexOf(" "+ classStr +" ") >= 0);  // Boolean
+	};
+
+	dojo.addClass = function(/*DomNode|String*/node, /*String*/classStr){
+		//	summary:
+		//		Adds the specified classes to the end of the class list on the
+		//		passed node.
+		node = d.byId(node);
+		var cls = node[_className];
+		if((" "+ cls +" ").indexOf(" " + classStr + " ") < 0){
+			node[_className] = cls + (cls ? ' ' : '') + classStr;
+		}
+	};
+
+	dojo.removeClass = function(/*DomNode|String*/node, /*String*/classStr){
+		// summary: Removes the specified classes from node.
+		node = d.byId(node);
+		var t = d.trim((" " + node[_className] + " ").replace(" " + classStr + " ", " "));
+		if(node[_className] != t){ node[_className] = t; }
+	};
+
+	dojo.toggleClass = function(/*DomNode|String*/node, /*String*/classStr, /*Boolean?*/condition){
+		//	summary: 	
+		//		Adds a class to node if not present, or removes if present.
+		//		Pass a boolean condition if you want to explicitly add or remove.
+		//	condition:
+		//		If passed, true means to add the class, false means to remove.
+		if(condition === undefined){
+			condition = !d.hasClass(node, classStr);
+		}
+		d[condition ? "addClass" : "removeClass"](node, classStr);
+	};
+
+})();
+
+}
+
+if(!dojo._hasResource["dojo._base.NodeList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.NodeList"] = true;
+dojo.provide("dojo._base.NodeList");
+
+
+
+(function(){
+
+	var d = dojo;
+
+	var tnl = function(arr){
+		// decorate an array to make it look like a NodeList
+		arr.constructor = dojo.NodeList;
+		dojo._mixin(arr, dojo.NodeList.prototype);
+		return arr;
+	}
+
+	var _mapIntoDojo = function(func, alwaysThis){
+		// returns a function which, when executed in the scope of its caller,
+		// applies the passed arguments to a particular dojo.* function (named
+		// in func) and aggregates the returns. if alwaysThis is true, it
+		// always returns the scope object and not the collected returns from
+		// the Dojo method
+		return function(){
+			var _a = arguments;
+			var aa = d._toArray(_a, 0, [null]);
+			var s = this.map(function(i){
+				aa[0] = i;
+				return d[func].apply(d, aa);
+			});
+			return (alwaysThis || ( (_a.length > 1) || !d.isString(_a[0]) )) ? this : s; // String||dojo.NodeList
+		}
+	};
+
+	dojo.NodeList = function(){
+		//	summary:
+		//		dojo.NodeList is as subclass of Array which adds syntactic 
+		//		sugar for chaining, common iteration operations, animation, 
+		//		and node manipulation. NodeLists are most often returned as
+		//		the result of dojo.query() calls.
+		//	example:
+		//		create a node list from a node
+		//		|	new dojo.NodeList(dojo.byId("foo"));
+
+		return tnl(Array.apply(null, arguments));
+	}
+
+	dojo.NodeList._wrap = tnl;
+
+	dojo.extend(dojo.NodeList, {
+		// http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array#Methods
+
+		// FIXME: handle return values for #3244
+		//		http://trac.dojotoolkit.org/ticket/3244
+		
+		// FIXME:
+		//		need to wrap or implement:
+		//			join (perhaps w/ innerHTML/outerHTML overload for toString() of items?)
+		//			reduce
+		//			reduceRight
+
+		slice: function(/*===== begin, end =====*/){
+			// summary:
+			//		Returns a new NodeList, maintaining this one in place
+			// description:
+			//		This method behaves exactly like the Array.slice method
+			//		with the caveat that it returns a dojo.NodeList and not a
+			//		raw Array. For more details, see:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:slice
+			// begin: Integer
+			//		Can be a positive or negative integer, with positive
+			//		integers noting the offset to begin at, and negative
+			//		integers denoting an offset from the end (i.e., to the left
+			//		of the end)
+			// end: Integer?
+			//		Optional parameter to describe what position relative to
+			//		the NodeList's zero index to end the slice at. Like begin,
+			//		can be positive or negative.
+			var a = d._toArray(arguments);
+			return tnl(a.slice.apply(this, a));
+		},
+
+		splice: function(/*===== index, howmany, item =====*/){
+			// summary:
+			//		Returns a new NodeList, manipulating this NodeList based on
+			//		the arguments passed, potentially splicing in new elements
+			//		at an offset, optionally deleting elements
+			// description:
+			//		This method behaves exactly like the Array.splice method
+			//		with the caveat that it returns a dojo.NodeList and not a
+			//		raw Array. For more details, see:
+			//			<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:splice>
+			// index: Integer
+			//		begin can be a positive or negative integer, with positive
+			//		integers noting the offset to begin at, and negative
+			//		integers denoting an offset from the end (i.e., to the left
+			//		of the end)
+			// howmany: Integer?
+			//		Optional parameter to describe what position relative to
+			//		the NodeList's zero index to end the slice at. Like begin,
+			//		can be positive or negative.
+			// item: Object...?
+			//		Any number of optional parameters may be passed in to be
+			//		spliced into the NodeList
+			// returns:
+			//		dojo.NodeList
+			var a = d._toArray(arguments);
+			return tnl(a.splice.apply(this, a));
+		},
+
+		concat: function(/*===== item =====*/){
+			// summary:
+			//		Returns a new NodeList comprised of items in this NodeList
+			//		as well as items passed in as parameters
+			// description:
+			//		This method behaves exactly like the Array.concat method
+			//		with the caveat that it returns a dojo.NodeList and not a
+			//		raw Array. For more details, see:
+			//			<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:concat>
+			// item: Object...?
+			//		Any number of optional parameters may be passed in to be
+			//		spliced into the NodeList
+			// returns:
+			//		dojo.NodeList
+			var a = d._toArray(arguments, 0, [this]);
+			return tnl(a.concat.apply([], a));
+		},
+		
+		indexOf: function(/*Object*/ value, /*Integer?*/ fromIndex){
+			//	summary:
+			//		see dojo.indexOf(). The primary difference is that the acted-on 
+			//		array is implicitly this NodeList
+			// value:
+			//		The value to search for.
+			// fromIndex:
+			//		The loction to start searching from. Optional. Defaults to 0.
+			//	description:
+			//		For more details on the behavior of indexOf, see:
+			//			<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf>
+			//	returns:
+			//		Positive Integer or 0 for a match, -1 of not found.
+			return d.indexOf(this, value, fromIndex); // Integer
+		},
+
+		lastIndexOf: function(/*===== value, fromIndex =====*/){
+			// summary:
+			//		see dojo.lastIndexOf(). The primary difference is that the
+			//		acted-on array is implicitly this NodeList
+			//	description:
+			//		For more details on the behavior of lastIndexOf, see:
+			//			<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf>
+			// value: Object
+			//		The value to search for.
+			// fromIndex: Integer?
+			//		The loction to start searching from. Optional. Defaults to 0.
+			// returns:
+			//		Positive Integer or 0 for a match, -1 of not found.
+			return d.lastIndexOf.apply(d, d._toArray(arguments, 0, [this])); // Integer
+		},
+
+		every: function(/*Function*/callback, /*Object?*/thisObject){
+			//	summary:
+			//		see `dojo.every()` and:
+			//			<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:every>
+			//		Takes the same structure of arguments and returns as
+			//		dojo.every() with the caveat that the passed array is
+			//		implicitly this NodeList
+			return d.every(this, callback, thisObject); // Boolean
+		},
+
+		some: function(/*Function*/callback, /*Object?*/thisObject){
+			//	summary:
+			//		see dojo.some() and:
+			//			http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:some
+			//		Takes the same structure of arguments and returns as
+			//		dojo.some() with the caveat that the passed array is
+			//		implicitly this NodeList
+			return d.some(this, callback, thisObject); // Boolean
+		},
+
+		map: function(/*Function*/ func, /*Function?*/ obj){
+			//	summary:
+			//		see dojo.map(). The primary difference is that the acted-on
+			//		array is implicitly this NodeList and the return is a
+			//		dojo.NodeList (a subclass of Array)
+
+			return d.map(this, func, obj, d.NodeList); // dojo.NodeList
+		},
+
+		forEach: function(callback, thisObj){
+			//	summary:
+			//		see dojo.forEach(). The primary difference is that the acted-on 
+			//		array is implicitly this NodeList
+
+			d.forEach(this, callback, thisObj);
+			// non-standard return to allow easier chaining
+			return this; // dojo.NodeList 
+		},
+
+		// custom methods
+		
+		coords: function(){
+			//	summary:
+			// 		Returns the box objects all elements in a node list as
+			// 		an Array (*not* a NodeList)
+			
+			return d.map(this, d.coords); // Array
+		},
+
+		/*=====
+		attr: function(property, value){
+			//	summary:
+			//		gets or sets the DOM attribute for every element in the
+			//		NodeList
+			//	property: String
+			//		the attribute to get/set
+			//	value: String?
+			//		optional. The value to set the property to
+			//	returns:
+			//		if no value is passed, the result is an array of attribute values
+			//		If a value is passed, the return is this NodeList
+			return; // dojo.NodeList
+			return; // Array
+		},
+
+		style: function(property, value){
+			//	summary:
+			//		gets or sets the CSS property for every element in the NodeList
+			//	property: String
+			//		the CSS property to get/set, in JavaScript notation
+			//		("lineHieght" instead of "line-height") 
+			//	value: String?
+			//		optional. The value to set the property to
+			//	returns:
+			//		if no value is passed, the result is an array of strings.
+			//		If a value is passed, the return is this NodeList
+			return; // dojo.NodeList
+			return; // Array
+		},
+
+		addClass: function(className){
+			//	summary:
+			//		adds the specified class to every node in the list
+			//	className: String
+			//		the CSS class to add
+			return; // dojo.NodeList
+		},
+
+		removeClass: function(className){
+			//	summary:
+			//		removes the specified class from every node in the list
+			//	className: String
+			//		the CSS class to add
+			//	returns:
+			//		dojo.NodeList, this list
+			return; // dojo.NodeList
+		},
+
+		toggleClass: function(className, condition){
+			//	summary:
+			//		Adds a class to node if not present, or removes if present.
+			//		Pass a boolean condition if you want to explicitly add or remove.
+			//	condition: Boolean?
+			//		If passed, true means to add the class, false means to remove.
+			//	className: String
+			//		the CSS class to add
+			return; // dojo.NodeList
+		},
+
+		connect: function(methodName, objOrFunc, funcName){
+			//	summary:
+			//		attach event handlers to every item of the NodeList. Uses dojo.connect()
+			//		so event properties are normalized
+			//	methodName: String
+			//		the name of the method to attach to. For DOM events, this should be
+			//		the lower-case name of the event
+			//	objOrFunc: Object|Function|String
+			//		if 2 arguments are passed (methodName, objOrFunc), objOrFunc should
+			//		reference a function or be the name of the function in the global
+			//		namespace to attach. If 3 arguments are provided
+			//		(methodName, objOrFunc, funcName), objOrFunc must be the scope to 
+			//		locate the bound function in
+			//	funcName: String?
+			//		optional. A string naming the function in objOrFunc to bind to the
+			//		event. May also be a function reference.
+			//	example:
+			//		add an onclick handler to every button on the page
+			//		|	dojo.query("div:nth-child(odd)").connect("onclick", function(e){
+			//		|		
+			//		|	});
+			// example:
+			//		attach foo.bar() to every odd div's onmouseover
+			//		|	dojo.query("div:nth-child(odd)").connect("onmouseover", foo, "bar");
+		},
+		=====*/
+		attr: _mapIntoDojo("attr"),
+		style: _mapIntoDojo("style"),
+		addClass: _mapIntoDojo("addClass", true),
+		removeClass: _mapIntoDojo("removeClass", true),
+		toggleClass: _mapIntoDojo("toggleClass", true),
+		connect: _mapIntoDojo("connect", true),
+
+		// FIXME: connectPublisher()? connectRunOnce()?
+
+		place: function(/*String||Node*/ queryOrNode, /*String*/ position){
+			//	summary:
+			//		places elements of this node list relative to the first element matched
+			//		by queryOrNode. Returns the original NodeList.
+			//	queryOrNode:
+			//		may be a string representing any valid CSS3 selector or a DOM node.
+			//		In the selector case, only the first matching element will be used 
+			//		for relative positioning.
+			//	position:
+			//		can be one of:
+			//			* "last"||"end" (default)
+			//			* "first||"start"
+			//			* "before"
+			//			* "after"
+			// 		or an offset in the childNodes property
+			var item = d.query(queryOrNode)[0];
+			return this.forEach(function(i){ d.place(i, item, position); }); // dojo.NodeList
+		},
+
+		orphan: function(/*String?*/ simpleFilter){
+			//	summary:
+			//		removes elements in this list that match the simple
+			//		filter from their parents and returns them as a new
+			//		NodeList.
+			//	simpleFilter:
+			//		single-expression CSS filter
+			//	returns:
+			//		`dojo.NodeList` containing the orpahned elements 
+			return (simpleFilter ? d._filterQueryResult(this, simpleFilter) : this). // dojo.NodeList
+				forEach("if(item.parentNode){ item.parentNode.removeChild(item); }"); 
+		},
+
+		adopt: function(/*String||Array||DomNode*/ queryOrListOrNode, /*String?*/ position){
+			//	summary:
+			//		places any/all elements in queryOrListOrNode at a
+			//		position relative to the first element in this list.
+			//		Returns a dojo.NodeList of the adopted elements.
+			//	queryOrListOrNode:
+			//		a DOM node or a query string or a query result.
+			//		Represents the nodes to be adopted relative to the
+			//		first element of this NodeList.
+			//	position:
+			//		can be one of:
+			//			* "last"||"end" (default)
+			//			* "first||"start"
+			//			* "before"
+			//			* "after"
+			// 		or an offset in the childNodes property
+			var item = this[0];
+			return d.query(queryOrListOrNode).forEach(function(ai){ // dojo.NodeList
+				d.place(ai, item, position || "last"); 
+			});
+		},
+
+		// FIXME: do we need this?
+		query: function(/*String*/ queryStr){
+			//	summary:
+			//		Returns a new, flattened NodeList. Elements of the new list
+			//		satisfy the passed query but use elements of the
+			//		current NodeList as query roots.
+
+			if(!queryStr){ return this; }
+
+			// FIXME: probably slow
+			// FIXME: use map?
+			var ret = d.NodeList();
+			this.forEach(function(item){
+				// FIXME: why would we ever get undefined here?
+				ret = ret.concat(d.query(queryStr, item).filter(function(subItem){ return (subItem !== undefined); }));
+			});
+			return ret; // dojo.NodeList
+		},
+
+		filter: function(/*String*/ simpleQuery){
+			//	summary:
+			// 		"masks" the built-in javascript filter() method to support
+			//		passing a simple string filter in addition to supporting
+			//		filtering function objects.
+			//	example:
+			//		"regular" JS filter syntax as exposed in dojo.filter:
+			//		|	dojo.query("*").filter(function(item){
+			//		|		// highlight every paragraph
+			//		|		return (item.nodeName == "p");
+			//		|	}).styles("backgroundColor", "yellow");
+			// example:
+			//		the same filtering using a CSS selector
+			//		|	dojo.query("*").filter("p").styles("backgroundColor", "yellow");
+
+			var items = this;
+			var _a = arguments;
+			var r = d.NodeList();
+			var rp = function(t){ 
+				if(t !== undefined){
+					r.push(t); 
+				}
+			}
+			if(d.isString(simpleQuery)){
+				items = d._filterQueryResult(this, _a[0]);
+				if(_a.length == 1){
+					// if we only got a string query, pass back the filtered results
+					return items; // dojo.NodeList
+				}
+				// if we got a callback, run it over the filtered items
+				_a.shift();
+			}
+			// handle the (callback, [thisObject]) case
+			d.forEach(d.filter(items, _a[0], _a[1]), rp);
+			return r; // dojo.NodeList
+		},
+		
+		/*
+		// FIXME: should this be "copyTo" and include parenting info?
+		clone: function(){
+			// summary:
+			//		creates node clones of each element of this list
+			//		and returns a new list containing the clones
+		},
+		*/
+
+		addContent: function(/*String*/ content, /*String||Integer?*/ position){
+			//	summary:
+			//		add a node or some HTML as a string to every item in the list. 
+			//		Returns the original list.
+			//	description:
+			//		a copy of the HTML content is added to each item in the
+			//		list, with an optional position argument. If no position
+			//		argument is provided, the content is appended to the end of
+			//		each item.
+			//	content:
+			//		the HTML in string format to add at position to every item
+			//	position:
+			//		can be one of:
+			//			* "last"||"end" (default)
+			//			* "first||"start"
+			//			* "before"
+			//			* "after"
+			// 		or an offset in the childNodes property
+			//	example:
+			//		appends content to the end if the position is ommitted
+			//	|	dojo.query("h3 > p").addContent("hey there!");
+			//	example:
+			//		add something to the front of each element that has a "thinger" property:
+			//	|	dojo.query("[thinger]").addContent("...", "first");
+			//	example:
+			//		adds a header before each element of the list
+			//	|	dojo.query(".note").addContent("<h4>NOTE:</h4>", "before");
+			var ta = d.doc.createElement("span");
+			if(d.isString(content)){
+				ta.innerHTML = content;
+			}else{
+				ta.appendChild(content);
+			}
+			if(position === undefined){
+				position = "last";
+			}
+			var ct = (position == "first" || position == "after") ? "lastChild" : "firstChild";
+			this.forEach(function(item){
+				var tn = ta.cloneNode(true);
+				while(tn[ct]){
+					d.place(tn[ct], item, position);
+				}
+			});
+			return this; // dojo.NodeList
+		},
+
+		empty: function(){
+			//	summary:
+			//		clears all content from each node in the list
+			return this.forEach("item.innerHTML='';"); // dojo.NodeList
+
+			// FIXME: should we be checking for and/or disposing of widgets below these nodes?
+		},
+		
+		instantiate: function(/*String|Object*/ declaredClass, /*Object?*/ properties){
+			//	summary:
+			//		Create a new instance of a specified class, using the
+			//		specified properties and each node in the nodeList as a
+			//		srcNodeRef
+			//
+			var c = d.isFunction(declaredClass) ? declaredClass : d.getObject(declaredClass);
+			return this.forEach(function(i){
+				new c(properties||{},i);
+			}) // dojo.NodeList
+		},
+
+		at: function(/*===== index =====*/){
+			//	summary:
+			//		Returns a new NodeList comprised of items in this NodeList
+			//		at the given index or indices.
+			//	index: Integer...
+			//		One or more 0-based indices of items in the current NodeList.
+			//	returns:
+			//		dojo.NodeList
+			var nl = new dojo.NodeList();
+			dojo.forEach(arguments, function(i) { if(this[i]) { nl.push(this[i]); } }, this);
+			return nl; // dojo.NodeList
+		}
+
+	});
+
+	// syntactic sugar for DOM events
+	d.forEach([
+		"blur", "focus", "click", "keydown", "keypress", "keyup", "mousedown",
+		"mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover",
+		"mouseup", "submit", "load", "error"
+		], function(evt){
+			var _oe = "on"+evt;
+			d.NodeList.prototype[_oe] = function(a, b){
+				return this.connect(_oe, a, b);
+			}
+				// FIXME: should these events trigger publishes?
+				/*
+				return (a ? this.connect(_oe, a, b) : 
+							this.forEach(function(n){  
+								// FIXME:
+								//		listeners get buried by
+								//		addEventListener and can't be dug back
+								//		out to be triggered externally.
+								// see:
+								//		http://developer.mozilla.org/en/docs/DOM:element
+
+								
+
+								// FIXME: need synthetic event support!
+								var _e = { target: n, faux: true, type: evt };
+								// dojo._event_listener._synthesizeEvent({}, { target: n, faux: true, type: evt });
+								try{ n[evt](_e); }catch(e){  }
+								try{ n[_oe](_e); }catch(e){  }
+							})
+				);
+			}
+			*/
+		}
+	);
+
+})();
+
+}
+
+if(!dojo._hasResource["dojo._base.query"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.query"] = true;
+dojo.provide("dojo._base.query");
+
+
+/*
+	dojo.query() architectural overview:
+
+		dojo.query is a relatively full-featured CSS3 query library. It is
+		designed to take any valid CSS3 selector and return the nodes matching
+		the selector. To do this quickly, it processes queries in several
+		steps, applying caching where profitable.
+		
+		The steps (roughly in reverse order of the way they appear in the code):
+			1.) check to see if we already have a "query dispatcher"
+				- if so, use that with the given parameterization. Skip to step 4.
+			2.) attempt to determine which branch to dispatch the query to:
+				- JS (optimized DOM iteration)
+				- xpath (for browsers that support it and where it's fast)
+				- native (not available in any browser yet)
+			3.) tokenize and convert to executable "query dispatcher"
+				- this is where the lion's share of the complexity in the
+				  system lies. In the DOM version, the query dispatcher is
+				  assembled as a chain of "yes/no" test functions pertaining to
+				  a section of a simple query statement (".blah:nth-child(odd)"
+				  but not "div div", which is 2 simple statements). Individual
+				  statement dispatchers are cached (to prevent re-definition)
+				  as are entire dispatch chains (to make re-execution of the
+				  same query fast)
+				- in the xpath path, tokenization yields a concatenation of
+				  parameterized xpath selectors. As with the DOM version, both
+				  simple selector blocks and overall evaluators are cached to
+				  prevent re-defintion
+			4.) the resulting query dispatcher is called in the passed scope (by default the top-level document)
+				- for DOM queries, this results in a recursive, top-down
+				  evaluation of nodes based on each simple query section
+				- xpath queries can, thankfully, be executed in one shot
+			5.) matched nodes are pruned to ensure they are unique
+*/
+
+;(function(){
+	// define everything in a closure for compressability reasons. "d" is an
+	// alias to "dojo" since it's so frequently used. This seems a
+	// transformation that the build system could perform on a per-file basis.
+
+	////////////////////////////////////////////////////////////////////////
+	// Utility code
+	////////////////////////////////////////////////////////////////////////
+
+	var d = dojo;
+	var childNodesName = dojo.isIE ? "children" : "childNodes";
+	var caseSensitive = false;
+
+	var getQueryParts = function(query){
+		// summary: state machine for query tokenization
+		if(">~+".indexOf(query.charAt(query.length-1)) >= 0){
+			query += " *"
+		}
+		query += " "; // ensure that we terminate the state machine
+
+		var ts = function(s, e){
+			return d.trim(query.slice(s, e));
+		}
+
+		// the overall data graph of the full query, as represented by queryPart objects
+		var qparts = []; 
+		// state keeping vars
+		var inBrackets = -1;
+		var inParens = -1;
+		var inMatchFor = -1;
+		var inPseudo = -1;
+		var inClass = -1;
+		var inId = -1;
+		var inTag = -1;
+		var lc = ""; // the last character
+		var cc = ""; // the current character
+		var pStart;
+		// iteration vars
+		var x = 0; // index in the query
+		var ql = query.length;
+		var currentPart = null; // data structure representing the entire clause
+		var _cp = null; // the current pseudo or attr matcher
+
+		var endTag = function(){
+			if(inTag >= 0){
+				var tv = (inTag == x) ? null : ts(inTag, x); // .toLowerCase();
+				currentPart[ (">~+".indexOf(tv) < 0) ? "tag" : "oper" ] = tv;
+				inTag = -1;
+			}
+		}
+
+		var endId = function(){
+			if(inId >= 0){
+				currentPart.id = ts(inId, x).replace(/\\/g, "");
+				inId = -1;
+			}
+		}
+
+		var endClass = function(){
+			if(inClass >= 0){
+				currentPart.classes.push(ts(inClass+1, x).replace(/\\/g, ""));
+				inClass = -1;
+			}
+		}
+
+		var endAll = function(){
+			endId(); endTag(); endClass();
+		}
+
+		for(; lc=cc, cc=query.charAt(x),x<ql; x++){
+			if(lc == "\\"){ continue; }
+			if(!currentPart){
+				// NOTE: I hate all this alloc, but it's shorter than writing tons of if's
+				pStart = x;
+				currentPart = {
+					query: null,
+					pseudos: [],
+					attrs: [],
+					classes: [],
+					tag: null,
+					oper: null,
+					id: null
+				};
+				inTag = x;
+			}
+
+			if(inBrackets >= 0){
+				// look for a the close first
+				if(cc == "]"){
+					if(!_cp.attr){
+						_cp.attr = ts(inBrackets+1, x);
+					}else{
+						_cp.matchFor = ts((inMatchFor||inBrackets+1), x);
+					}
+					var cmf = _cp.matchFor;
+					if(cmf){
+						if(	(cmf.charAt(0) == '"') || (cmf.charAt(0)  == "'") ){
+							_cp.matchFor = cmf.substring(1, cmf.length-1);
+						}
+					}
+					currentPart.attrs.push(_cp);
+					_cp = null; // necessaray?
+					inBrackets = inMatchFor = -1;
+				}else if(cc == "="){
+					var addToCc = ("|~^$*".indexOf(lc) >=0 ) ? lc : "";
+					_cp.type = addToCc+cc;
+					_cp.attr = ts(inBrackets+1, x-addToCc.length);
+					inMatchFor = x+1;
+				}
+				// now look for other clause parts
+			}else if(inParens >= 0){
+				if(cc == ")"){
+					if(inPseudo >= 0){
+						_cp.value = ts(inParens+1, x);
+					}
+					inPseudo = inParens = -1;
+				}
+			}else if(cc == "#"){
+				endAll();
+				inId = x+1;
+			}else if(cc == "."){
+				endAll();
+				inClass = x;
+			}else if(cc == ":"){
+				endAll();
+				inPseudo = x;
+			}else if(cc == "["){
+				endAll();
+				inBrackets = x;
+				_cp = {
+					/*=====
+					attr: null, type: null, matchFor: null
+					=====*/
+				};
+			}else if(cc == "("){
+				if(inPseudo >= 0){
+					_cp = { 
+						name: ts(inPseudo+1, x), 
+						value: null
+					}
+					currentPart.pseudos.push(_cp);
+				}
+				inParens = x;
+			}else if(cc == " " && lc != cc){
+				// note that we expect the string to be " " terminated
+				endAll();
+				if(inPseudo >= 0){
+					currentPart.pseudos.push({ name: ts(inPseudo+1, x) });
+				}
+				currentPart.hasLoops = (	
+						currentPart.pseudos.length || 
+						currentPart.attrs.length || 
+						currentPart.classes.length	);
+				currentPart.query = ts(pStart, x);
+				currentPart.otag = currentPart.tag = (currentPart["oper"]) ? null : (currentPart.tag || "*");
+				if(currentPart.tag){ // FIXME: not valid in case-sensitive documents
+					currentPart.tag = currentPart.tag.toUpperCase();
+				}
+				qparts.push(currentPart);
+				currentPart = null;
+			}
+		}
+		return qparts;
+	};
+	
+
+	////////////////////////////////////////////////////////////////////////
+	// XPath query code
+	////////////////////////////////////////////////////////////////////////
+
+	// this array is a lookup used to generate an attribute matching function.
+	// There is a similar lookup/generator list for the DOM branch with similar
+	// calling semantics.
+	var xPathAttrs = {
+		"*=": function(attr, value){
+			return "[contains(@"+attr+", '"+ value +"')]";
+		},
+		"^=": function(attr, value){
+			return "[starts-with(@"+attr+", '"+ value +"')]";
+		},
+		"$=": function(attr, value){
+			return "[substring(@"+attr+", string-length(@"+attr+")-"+(value.length-1)+")='"+value+"']";
+		},
+		"~=": function(attr, value){
+			return "[contains(concat(' ',@"+attr+",' '), ' "+ value +" ')]";
+		},
+		"|=": function(attr, value){
+			return "[contains(concat(' ',@"+attr+",' '), ' "+ value +"-')]";
+		},
+		"=": function(attr, value){
+			return "[@"+attr+"='"+ value +"']";
+		}
+	};
+
+	// takes a list of attribute searches, the overall query, a function to
+	// generate a default matcher, and a closure-bound method for providing a
+	// matching function that generates whatever type of yes/no distinguisher
+	// the query method needs. The method is a bit tortured and hard to read
+	// because it needs to be used in both the XPath and DOM branches.
+	var handleAttrs = function(	attrList, 
+								query, 
+								getDefault, 
+								handleMatch){
+		d.forEach(query.attrs, function(attr){
+			var matcher;
+			// type, attr, matchFor
+			if(attr.type && attrList[attr.type]){
+				matcher = attrList[attr.type](attr.attr, attr.matchFor);
+			}else if(attr.attr.length){
+				matcher = getDefault(attr.attr);
+			}
+			if(matcher){ handleMatch(matcher); }
+		});
+	}
+
+	var buildPath = function(query){
+		var xpath = ".";
+		var qparts = getQueryParts(d.trim(query));
+		while(qparts.length){
+			var tqp = qparts.shift();
+			var prefix;
+			var postfix = "";
+			if(tqp.oper == ">"){
+				prefix = "/";
+				// prefix = "/child::*";
+				tqp = qparts.shift();
+			}else if(tqp.oper == "~"){
+				prefix = "/following-sibling::"; // get element following siblings
+				tqp = qparts.shift();
+			}else if(tqp.oper == "+"){
+				// FIXME: 
+				//		fails when selecting subsequent siblings by node type
+				//		because the position() checks the position in the list
+				//		of matching elements and not the localized siblings
+				prefix = "/following-sibling::";
+				postfix = "[position()=1]";
+				tqp = qparts.shift();
+			}else{
+				prefix = "//";
+				// prefix = "/descendant::*"
+			}
+
+			// get the tag name (if any)
+
+			xpath += prefix + tqp.tag + postfix;
+			
+			// check to see if it's got an id. Needs to come first in xpath.
+			if(tqp.id){
+				xpath += "[@id='"+tqp.id+"'][1]";
+			}
+
+			d.forEach(tqp.classes, function(cn){
+				var cnl = cn.length;
+				var padding = " ";
+				if(cn.charAt(cnl-1) == "*"){
+					padding = ""; cn = cn.substr(0, cnl-1);
+				}
+				xpath += 
+					"[contains(concat(' ',@class,' '), ' "+
+					cn + padding + "')]";
+			});
+
+			handleAttrs(xPathAttrs, tqp, 
+				function(condition){
+						return "[@"+condition+"]";
+				},
+				function(matcher){
+					xpath += matcher;
+				}
+			);
+
+			// FIXME: need to implement pseudo-class checks!!
+		};
+		return xpath;
+	};
+
+	var _xpathFuncCache = {};
+	var getXPathFunc = function(path){
+		if(_xpathFuncCache[path]){
+			return _xpathFuncCache[path];
+		}
+
+		var doc = d.doc;
+		// don't need to memoize. The closure scope handles it for us.
+		var xpath = buildPath(path);
+
+		var tf = function(parent){
+			// XPath query strings are memoized.
+
+			var ret = [];
+			var xpathResult;
+			var tdoc = doc;
+			if(parent){
+				tdoc = (parent.nodeType == 9) ? parent : parent.ownerDocument;
+			}
+			try{
+				xpathResult = tdoc.evaluate(xpath, parent, null, 
+												// XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
+												XPathResult.ANY_TYPE, null);
+			}catch(e){
+				
+				
+			}
+			var result = xpathResult.iterateNext();
+			while(result){
+				ret.push(result);
+				result = xpathResult.iterateNext();
+			}
+			return ret;
+		}
+		return _xpathFuncCache[path] = tf;
+	};
+
+	/*
+	d.xPathMatch = function(query){
+		// XPath based DOM query system. Handles a small subset of CSS
+		// selectors, subset is identical to the non-XPath version of this
+		// function. 
+
+		return getXPathFunc(query)();
+	}
+	*/
+
+	////////////////////////////////////////////////////////////////////////
+	// DOM query code
+	////////////////////////////////////////////////////////////////////////
+
+	var _filtersCache = {};
+	var _simpleFiltersCache = {};
+
+	// the basic building block of the yes/no chaining system. agree(f1, f2)
+	// generates a new function which returns the boolean results of both of
+	// the passed functions to a single logical-anded result.
+	var agree = function(first, second){
+		if(!first){ return second; }
+		if(!second){ return first; }
+
+		return function(){
+			return first.apply(window, arguments) && second.apply(window, arguments);
+		}
+	}
+
+	var _childElements = function(root){
+		var ret = [];
+		var te, x = 0, tret = root[childNodesName];
+		while((te = tret[x++])){
+			if(te.nodeType == 1){ ret.push(te); }
+		}
+		return ret;
+	}
+
+	var _nextSiblings = function(root, single){
+		var ret = [];
+		var te = root;
+		while(te = te.nextSibling){
+			if(te.nodeType == 1){
+				ret.push(te);
+				if(single){ break; }
+			}
+		}
+		return ret;
+	}
+
+	// FIXME:
+	//		we need to re-write the way "~" and "+" selectors are handled since
+	//		the left-hand selector simply modifies the right (which is the
+	//		actual search selector). We need to locate on search selector
+	//		instead of modifier to speed up these searches.
+
+	var _filterDown = function(element, queryParts, matchArr, idx){
+		// NOTE:
+		//		in the fast path! this function is called recursively and for
+		//		every run of a query.
+		var nidx = idx+1;
+		var isFinal = (queryParts.length == nidx);
+		var tqp = queryParts[idx];
+
+		// see if we can constrain our next level to direct children
+		if(tqp.oper){
+			// find some eligable children to search
+			var ecn = (tqp.oper == ">") ? 
+				_childElements(element) :
+				_nextSiblings(element, (tqp.oper == "+"));
+
+			if(!ecn || !ecn.length){
+				return;
+			}
+			nidx++;
+			isFinal = (queryParts.length == nidx);
+			// kinda janky, too much array alloc
+			var tf = getFilterFunc(queryParts[idx+1]);
+			// for(var x=ecn.length-1, te; x>=0, te=ecn[x]; x--){
+			for(var x=0, ecnl=ecn.length, te; x<ecnl, te=ecn[x]; x++){
+				if(tf(te)){
+					if(isFinal){
+						matchArr.push(te);
+					}else{
+						_filterDown(te, queryParts, matchArr, nidx);
+					}
+				}
+				/*
+				if(x==0){
+					break;
+				}
+				*/
+			}
+		}
+
+		// otherwise, keep going down, unless we'er at the end
+		var candidates = getElementsFunc(tqp)(element);
+		if(isFinal){
+			while(candidates.length){
+				matchArr.push(candidates.shift());
+			}
+			/*
+			candidates.unshift(0, matchArr.length-1);
+			matchArr.splice.apply(matchArr, candidates);
+			*/
+		}else{
+			// if we're not yet at the bottom, keep going!
+			while(candidates.length){
+				_filterDown(candidates.shift(), queryParts, matchArr, nidx);
+			}
+		}
+	}
+
+	var filterDown = function(elements, queryParts){
+		var ret = [];
+
+		// for every root, get the elements that match the descendant selector
+		// for(var x=elements.length-1, te; x>=0, te=elements[x]; x--){
+		var x = elements.length - 1, te;
+		while((te = elements[x--])){
+			_filterDown(te, queryParts, ret, 0);
+		}
+		return ret;
+	}
+
+	var getFilterFunc = function(q){
+		// note: query can't have spaces!
+		if(_filtersCache[q.query]){
+			return _filtersCache[q.query];
+		}
+		var ff = null;
+
+		// does it have a tagName component?
+		if(q.tag){
+			if(q.tag == "*"){
+				ff = agree(ff, 
+					function(elem){
+						return (elem.nodeType == 1);
+					}
+				);
+			}else{
+				// tag name match
+				ff = agree(ff, 
+					function(elem){
+						return (
+							(elem.nodeType == 1) &&
+							(q[ caseSensitive ? "otag" : "tag" ] == elem.tagName)
+							// (q.tag == elem.tagName.toLowerCase())
+						);
+						// return isTn;
+					}
+				);
+			}
+		}
+
+		// does the node have an ID?
+		if(q.id){
+			ff = agree(ff, 
+				function(elem){
+					return (
+						(elem.nodeType == 1) &&
+						(elem.id == q.id)
+					);
+				}
+			);
+		}
+
+		if(q.hasLoops){
+			// if we have other query param parts, make sure we add them to the
+			// filter chain
+			ff = agree(ff, getSimpleFilterFunc(q));
+		}
+
+		return _filtersCache[q.query] = ff;
+	}
+
+	var getNodeIndex = function(node){
+		// NOTE: 
+		//		we could have a more accurate caching mechanism by invalidating
+		//		caches after the query has finished, but I think that'd lead to
+		//		significantly more cache churn than the cache would provide
+		//		value for in the common case. Generally, we're more
+		//		conservative (and therefore, more accurate) than jQuery and
+		//		DomQuery WRT node node indexes, but there may be corner cases
+		//		in which we fall down.  How much we care about them is TBD.
+
+		var pn = node.parentNode;
+		var pnc = pn.childNodes;
+
+		// check to see if we can trust the cache. If not, re-key the whole
+		// thing and return our node match from that.
+
+		var nidx = -1;
+		var child = pn.firstChild;
+		if(!child){
+			return nidx;
+		}
+
+		var ci = node["__cachedIndex"];
+		var cl = pn["__cachedLength"];
+
+		// only handle cache building if we've gone out of sync
+		if(((typeof cl == "number")&&(cl != pnc.length))||(typeof ci != "number")){
+			// rip though the whole set, building cache indexes as we go
+			pn["__cachedLength"] = pnc.length;
+			var idx = 1;
+			do{
+				// we only assign indexes for nodes with nodeType == 1, as per:
+				//		http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
+				// only elements are counted in the search order, and they
+				// begin at 1 for the first child's index
+
+				if(child === node){
+					nidx = idx;
+				}
+				if(child.nodeType == 1){
+					child["__cachedIndex"] = idx;
+					idx++;
+				}
+				child = child.nextSibling;
+			}while(child);
+		}else{
+			// NOTE: 
+			//		could be incorrect in some cases (node swaps involving the
+			//		passed node, etc.), but we ignore those due to the relative
+			//		unlikelihood of that occuring
+			nidx = ci;
+		}
+		return nidx;
+	}
+
+	var firedCount = 0;
+
+	var blank = "";
+	var _getAttr = function(elem, attr){
+		if(attr == "class"){
+			return elem.className || blank;
+		}
+		if(attr == "for"){
+			return elem.htmlFor || blank;
+		}
+		if(attr == "style"){
+			return elem.style.cssText || blank;
+		}
+		return (caseSensitive ? elem.getAttribute(attr) : elem.getAttribute(attr, 2)) || blank;
+	}
+
+	var attrs = {
+		"*=": function(attr, value){
+			return function(elem){
+				// E[foo*="bar"]
+				//		an E element whose "foo" attribute value contains
+				//		the substring "bar"
+				return (_getAttr(elem, attr).indexOf(value)>=0);
+			}
+		},
+		"^=": function(attr, value){
+			// E[foo^="bar"]
+			//		an E element whose "foo" attribute value begins exactly
+			//		with the string "bar"
+			return function(elem){
+				return (_getAttr(elem, attr).indexOf(value)==0);
+			}
+		},
+		"$=": function(attr, value){
+			// E[foo$="bar"]	
+			//		an E element whose "foo" attribute value ends exactly
+			//		with the string "bar"
+			var tval = " "+value;
+			return function(elem){
+				var ea = " "+_getAttr(elem, attr);
+				return (ea.lastIndexOf(value)==(ea.length-value.length));
+			}
+		},
+		"~=": function(attr, value){
+			// E[foo~="bar"]	
+			//		an E element whose "foo" attribute value is a list of
+			//		space-separated values, one of which is exactly equal
+			//		to "bar"
+
+			// return "[contains(concat(' ',@"+attr+",' '), ' "+ value +" ')]";
+			var tval = " "+value+" ";
+			return function(elem){
+				var ea = " "+_getAttr(elem, attr)+" ";
+				return (ea.indexOf(tval)>=0);
+			}
+		},
+		"|=": function(attr, value){
+			// E[hreflang|="en"]
+			//		an E element whose "hreflang" attribute has a
+			//		hyphen-separated list of values beginning (from the
+			//		left) with "en"
+			var valueDash = " "+value+"-";
+			return function(elem){
+				var ea = " "+(elem.getAttribute(attr, 2) || "");
+				return (
+					(ea == value) ||
+					(ea.indexOf(valueDash)==0)
+				);
+			}
+		},
+		"=": function(attr, value){
+			return function(elem){
+				return (_getAttr(elem, attr) == value);
+			}
+		}
+	};
+
+	var pseudos = {
+		"checked": function(name, condition){
+			return function(elem){
+				return !!d.attr(elem, "checked");
+			}
+		},
+		"first-child": function(name, condition){
+			return function(elem){
+				if(elem.nodeType != 1){ return false; }
+				// check to see if any of the previous siblings are elements
+				var fc = elem.previousSibling;
+				while(fc && (fc.nodeType != 1)){
+					fc = fc.previousSibling;
+				}
+				return (!fc);
+			}
+		},
+		"last-child": function(name, condition){
+			return function(elem){
+				if(elem.nodeType != 1){ return false; }
+				// check to see if any of the next siblings are elements
+				var nc = elem.nextSibling;
+				while(nc && (nc.nodeType != 1)){
+					nc = nc.nextSibling;
+				}
+				return (!nc);
+			}
+		},
+		"empty": function(name, condition){
+			return function(elem){
+				// DomQuery and jQuery get this wrong, oddly enough.
+				// The CSS 3 selectors spec is pretty explicit about
+				// it, too.
+				var cn = elem.childNodes;
+				var cnl = elem.childNodes.length;
+				// if(!cnl){ return true; }
+				for(var x=cnl-1; x >= 0; x--){
+					var nt = cn[x].nodeType;
+					if((nt == 1)||(nt == 3)){ return false; }
+				}
+				return true;
+			}
+		},
+		"contains": function(name, condition){
+			return function(elem){
+				// FIXME: I dislike this version of "contains", as
+				// whimsical attribute could set it off. An inner-text
+				// based version might be more accurate, but since
+				// jQuery and DomQuery also potentially get this wrong,
+				// I'm leaving it for now.
+				if(condition.charAt(0)=='"' || condition.charAt(0)=="'"){//remove quote
+					condition=condition.substr(1,condition.length-2);
+				}
+				return (elem.innerHTML.indexOf(condition) >= 0);
+			}
+		},
+		"not": function(name, condition){
+			var ntf = getFilterFunc(getQueryParts(condition)[0]);
+			return function(elem){
+				return (!ntf(elem));
+			}
+		},
+		"nth-child": function(name, condition){
+			var pi = parseInt;
+			if(condition == "odd"){
+				condition = "2n+1";
+			}else if(condition == "even"){
+				condition = "2n";
+			}
+			if(condition.indexOf("n") != -1){
+				var tparts = condition.split("n", 2);
+				var pred = tparts[0] ? (tparts[0]=='-'?-1:pi(tparts[0])) : 1;
+				var idx = tparts[1] ? pi(tparts[1]) : 0;
+				var lb = 0, ub = -1;
+				if(pred>0){
+					if(idx<0){
+						idx = (idx % pred) && (pred + (idx % pred));
+					}else if(idx>0){
+						if(idx >= pred){
+							lb = idx - idx % pred;
+						}
+						idx = idx % pred;
+					}
+				}else if(pred<0){
+					pred *= -1;
+					if(idx>0){
+						ub = idx;
+						idx = idx % pred;
+					} //idx has to be greater than 0 when pred is negative; shall we throw an error here?
+				}
+				if(pred>0){
+					return function(elem){
+						var i=getNodeIndex(elem);
+						return (i>=lb) && (ub<0 || i<=ub) && ((i % pred) == idx);
+					}
+				}else{
+					condition=idx;
+				}
+			}
+			//if(condition.indexOf("n") == -1){
+			var ncount = pi(condition);
+			return function(elem){
+				return (getNodeIndex(elem) == ncount);
+			}
+		}
+	};
+
+	var defaultGetter = (d.isIE) ? function(cond){
+		var clc = cond.toLowerCase();
+		return function(elem){
+			return (caseSensitive ? elem.getAttribute(cond) : elem[cond]||elem[clc]);
+		}
+	} : function(cond){
+		return function(elem){
+			return (elem && elem.getAttribute && elem.hasAttribute(cond));
+		}
+	};
+
+	var getSimpleFilterFunc = function(query){
+
+		var fcHit = (_simpleFiltersCache[query.query]||_filtersCache[query.query]);
+		if(fcHit){ return fcHit; }
+
+		var ff = null;
+
+		// the only case where we'll need the tag name is if we came from an ID query
+		if(query.id){ // do we have an ID component?
+			if(query.tag != "*"){
+				ff = agree(ff, function(elem){
+					return (elem.tagName == query[ caseSensitive ? "otag" : "tag" ]);
+				});
+			}
+		}
+
+		// if there's a class in our query, generate a match function for it
+		d.forEach(query.classes, function(cname, idx, arr){
+			// get the class name
+			var isWildcard = cname.charAt(cname.length-1) == "*";
+			if(isWildcard){
+				cname = cname.substr(0, cname.length-1);
+			}
+			// I dislike the regex thing, even if memozied in a cache, but it's VERY short
+			var re = new RegExp("(?:^|\\s)" + cname + (isWildcard ? ".*" : "") + "(?:\\s|$)");
+			ff = agree(ff, function(elem){
+				return re.test(elem.className);
+			});
+			ff.count = idx;
+		});
+
+		d.forEach(query.pseudos, function(pseudo){
+			if(pseudos[pseudo.name]){
+				ff = agree(ff, pseudos[pseudo.name](pseudo.name, pseudo.value));
+			}
+		});
+
+		handleAttrs(attrs, query, defaultGetter,
+			function(tmatcher){ ff = agree(ff, tmatcher); }
+		);
+		if(!ff){
+			ff = function(){ return true; };
+		}
+		return _simpleFiltersCache[query.query] = ff;
+	}
+
+	var _getElementsFuncCache = { };
+
+	var getElementsFunc = function(query, root){
+		var fHit = _getElementsFuncCache[query.query];
+		if(fHit){ return fHit; }
+
+		// NOTE: this function is in the fast path! not memoized!!!
+
+		// the query doesn't contain any spaces, so there's only so many
+		// things it could be
+
+		if(query.id && !query.hasLoops && !query.tag){
+			// ID-only query. Easy.
+			return _getElementsFuncCache[query.query] = function(root){
+				// FIXME: if root != document, check for parenting!
+				return [ d.byId(query.id) ];
+			}
+		}
+
+		var filterFunc = getSimpleFilterFunc(query);
+
+		var retFunc;
+		if(query.tag && query.id && !query.hasLoops){
+			// we got a filtered ID search (e.g., "h4#thinger")
+			retFunc = function(root){
+				var te = d.byId(query.id, (root.ownerDocument||root)); //root itself may be a document
+				if(filterFunc(te)){
+					return [ te ];
+				}
+			}
+		}else{
+			var tret;
+
+			if(!query.hasLoops){
+				// it's just a plain-ol elements-by-tag-name query from the root
+				retFunc = function(root){
+					var ret = [];
+					var te, x=0, tret = root.getElementsByTagName(query[ caseSensitive ? "otag" : "tag"]);
+					while((te = tret[x++])){
+						ret.push(te);
+					}
+					return ret;
+				}
+			}else{
+				retFunc = function(root){
+					var ret = [];
+					var te, x = 0, tret = root.getElementsByTagName(query[ caseSensitive ? "otag" : "tag"]);
+					while((te = tret[x++])){
+						if(filterFunc(te)){
+							ret.push(te);
+						}
+					}
+					return ret;
+				}
+			}
+		}
+		return _getElementsFuncCache[query.query] = retFunc;
+	}
+
+	var _partsCache = {};
+
+	////////////////////////////////////////////////////////////////////////
+	// the query runner
+	////////////////////////////////////////////////////////////////////////
+
+	// this is the second level of spliting, from full-length queries (e.g.,
+	// "div.foo .bar") into simple query expressions (e.g., ["div.foo",
+	// ".bar"])
+	var _queryFuncCache = {
+		"*": d.isIE ? 
+			function(root){ 
+					return root.all;
+			} : 
+			function(root){
+				 return root.getElementsByTagName("*");
+			},
+		"~": _nextSiblings,
+		"+": function(root){ return _nextSiblings(root, true); },
+		">": _childElements
+	};
+
+	var getStepQueryFunc = function(query){
+		// if it's trivial, get a fast-path dispatcher
+		var qparts = getQueryParts(d.trim(query));
+		// if(query[query.length-1] == ">"){ query += " *"; }
+		if(qparts.length == 1){
+			var tt = getElementsFunc(qparts[0]);
+			tt.nozip = true; // FIXME: is this right? Shouldn't this be wrapped in a closure to mark the return?
+			return tt;
+		}
+
+		// otherwise, break it up and return a runner that iterates over the parts recursively
+		var sqf = function(root){
+			var localQueryParts = qparts.slice(0); // clone the src arr
+			var candidates;
+			if(localQueryParts[0].oper == ">"){ // FIXME: what if it's + or ~?
+				candidates = [ root ];
+				// root = document;
+			}else{
+				candidates = getElementsFunc(localQueryParts.shift())(root);
+			}
+			return filterDown(candidates, localQueryParts);
+		}
+		return sqf;
+	}
+
+	// a specialized method that implements our primoridal "query optimizer".
+	// This allows us to dispatch queries to the fastest subsystem we can get.
+	var _getQueryFunc = (
+		// NOTE: 
+		//		XPath on the Webkit is slower than it's DOM iteration for most
+		//		test cases
+		// FIXME: 
+		//		we should try to capture some runtime speed data for each query
+		//		function to determine on the fly if we should stick w/ the
+		//		potentially optimized variant or if we should try something
+		//		new.
+		(document["evaluate"] && !d.isSafari) ? 
+		function(query, root){
+			// has xpath support that's faster than DOM
+			var qparts = query.split(" ");
+			// can we handle it?
+			if(	(!caseSensitive) && // not strictly necessaray, but simplifies lots of stuff
+				(document["evaluate"]) &&
+				(query.indexOf(":") == -1) &&
+				(query.indexOf("+") == -1) // skip direct sibling matches. See line ~344
+			){
+				// dojo.debug(query);
+				// should we handle it?
+
+				// kind of a lame heuristic, but it works
+				if(	
+					// a "div div div" style query
+					((qparts.length > 2)&&(query.indexOf(">") == -1))||
+					// or something else with moderate complexity. kinda janky
+					(qparts.length > 3)||
+					(query.indexOf("[")>=0)||
+					// or if it's a ".thinger" query
+					((1 == qparts.length)&&(0 <= query.indexOf(".")))
+
+				){
+					// use get and cache a xpath runner for this selector
+					return getXPathFunc(query);
+				}
+			}
+
+			// fallthrough
+			return getStepQueryFunc(query);
+		} : getStepQueryFunc
+	);
+	// uncomment to disable XPath for testing and tuning the DOM path
+	// _getQueryFunc = getStepQueryFunc;
+
+	// FIXME: we've got problems w/ the NodeList query()/filter() functions if we go XPath for everything
+
+	// uncomment to disable DOM queries for testing and tuning XPath
+	// _getQueryFunc = getXPathFunc;
+
+	// this is the primary caching for full-query results. The query dispatcher
+	// functions are generated here and then pickled for hash lookup in the
+	// future
+	var getQueryFunc = function(query){
+		// return a cached version if one is available
+		var qcz = query.charAt(0);
+		if(d.doc["querySelectorAll"] && 
+			( (!d.isSafari) || (d.isSafari > 3.1) ) && // see #5832
+			// as per CSS 3, we can't currently start w/ combinator:
+			//		http://www.w3.org/TR/css3-selectors/#w3cselgrammar
+			(">+~".indexOf(qcz) == -1)
+		){
+			return function(root){
+				var r = root.querySelectorAll(query);
+				r.nozip = true; // skip expensive duplication checks and just wrap in a NodeList
+				return r;
+			};
+		}
+		if(_queryFuncCache[query]){ return _queryFuncCache[query]; }
+		if(0 > query.indexOf(",")){
+			// if it's not a compound query (e.g., ".foo, .bar"), cache and return a dispatcher
+			return _queryFuncCache[query] = _getQueryFunc(query);
+		}else{
+			// if it's a complex query, break it up into it's constituent parts
+			// and return a dispatcher that will merge the parts when run
+
+			// var parts = query.split(", ");
+			var parts = query.split(/\s*,\s*/);
+			var tf = function(root){
+				var pindex = 0; // avoid array alloc for every invocation
+				var ret = [];
+				var tp;
+				while((tp = parts[pindex++])){
+					ret = ret.concat(_getQueryFunc(tp, tp.indexOf(" "))(root));
+				}
+				return ret;
+			}
+			// ...cache and return
+			return _queryFuncCache[query] = tf;
+		}
+	}
+
+	// FIXME: 
+	//		Dean's Base2 uses a system whereby queries themselves note if
+	//		they'll need duplicate filtering. We need to get on that plan!!
+
+	// attempt to efficiently determine if an item in a list is a dupe,
+	// returning a list of "uniques", hopefully in doucment order
+	var _zipIdx = 0;
+	var _zip = function(arr){
+		if(arr && arr.nozip){ return d.NodeList._wrap(arr); }
+		var ret = new d.NodeList();
+		if(!arr){ return ret; }
+		if(arr[0]){
+			ret.push(arr[0]);
+		}
+		if(arr.length < 2){ return ret; }
+
+		_zipIdx++;
+		
+		// we have to fork here for IE and XML docs because we can't set
+		// expandos on their nodes (apparently). *sigh*
+		if(d.isIE && caseSensitive){
+			var szidx = _zipIdx+"";
+			arr[0].setAttribute("_zipIdx", szidx);
+			for(var x = 1, te; te = arr[x]; x++){
+				if(arr[x].getAttribute("_zipIdx") != szidx){ 
+					ret.push(te);
+				}
+				te.setAttribute("_zipIdx", szidx);
+			}
+		}else{
+			arr[0]["_zipIdx"] = _zipIdx;
+			for(var x = 1, te; te = arr[x]; x++){
+				if(arr[x]["_zipIdx"] != _zipIdx){ 
+					ret.push(te);
+				}
+				te["_zipIdx"] = _zipIdx;
+			}
+		}
+		// FIXME: should we consider stripping these properties?
+		return ret;
+	}
+
+	// the main executor
+	d.query = function(/*String*/ query, /*String|DOMNode?*/ root){
+		//	summary:
+		//		Returns nodes which match the given CSS3 selector, searching the
+		//		entire document by default but optionally taking a node to scope
+		//		the search by. Returns an instance of dojo.NodeList.
+		//	description:
+		//		dojo.query() is the swiss army knife of DOM node manipulation in
+		//		Dojo. Much like Prototype's "$$" (bling-bling) function or JQuery's
+		//		"$" function, dojo.query provides robust, high-performance
+		//		CSS-based node selector support with the option of scoping searches
+		//		to a particular sub-tree of a document.
+		//
+		//		Supported Selectors:
+		//		--------------------
+		//
+		//		dojo.query() supports a rich set of CSS3 selectors, including:
+		//
+		//			* class selectors (e.g., `.foo`)
+		//			* node type selectors like `span`
+		//			* ` ` descendant selectors
+		//			* `>` child element selectors 
+		//			* `#foo` style ID selectors
+		//			* `*` universal selector
+		//			* `~`, the immediately preceeded-by sibling selector
+		//			* `+`, the preceeded-by sibling selector
+		//			* attribute queries:
+		//			|	* `[foo]` attribute presence selector
+		//			|	* `[foo='bar']` attribute value exact match
+		//			|	* `[foo~='bar']` attribute value list item match
+		//			|	* `[foo^='bar']` attribute start match
+		//			|	* `[foo$='bar']` attribute end match
+		//			|	* `[foo*='bar']` attribute substring match
+		//			* `:first-child`, `:last-child` positional selectors
+		//			* `:empty` content emtpy selector
+		//			* `:empty` content emtpy selector
+		//			* `:checked` pseudo selector
+		//			* `:nth-child(n)`, `:nth-child(2n+1)` style positional calculations
+		//			* `:nth-child(even)`, `:nth-child(odd)` positional selectors
+		//			* `:not(...)` negation pseudo selectors
+		//
+		//		Any legal combination of these selectors will work with
+		//		`dojo.query()`, including compound selectors ("," delimited).
+		//		Very complex and useful searches can be constructed with this
+		//		palette of selectors and when combined with functions for
+		//		maniplation presented by dojo.NodeList, many types of DOM
+		//		manipulation operations become very straightforward.
+		//		
+		//		Unsupported Selectors:
+		//		----------------------
+		//
+		//		While dojo.query handles many CSS3 selectors, some fall outside of
+		//		what's resaonable for a programmatic node querying engine to
+		//		handle. Currently unsupported selectors include:
+		//		
+		//			* namespace-differentiated selectors of any form
+		//			* all `::` pseduo-element selectors
+		//			* certain pseduo-selectors which don't get a lot of day-to-day use:
+		//			|	* `:root`, `:lang()`, `:target`, `:focus`
+		//			* all visual and state selectors:
+		//			|	* `:root`, `:active`, `:hover`, `:visisted`, `:link`,
+		//				  `:enabled`, `:disabled`
+		//			* `:*-of-type` pseudo selectors
+		//		
+		//		dojo.query and XML Documents:
+		//		-----------------------------
+		//		
+		//		`dojo.query` currently only supports searching XML documents
+		//		whose tags and attributes are 100% lower-case. This is a known
+		//		limitation and will [be addressed soon](http://trac.dojotoolkit.org/ticket/3866)
+		//		Non-selector Queries:
+		//		---------------------
+		//
+		//		If something other than a String is passed for the query,
+		//		`dojo.query` will return a new `dojo.NodeList` constructed from
+		//		that parameter alone and all further processing will stop. This
+		//		means that if you have a reference to a node or NodeList, you
+		//		can quickly construct a new NodeList from the original by
+		//		calling `dojo.query(node)` or `dojo.query(list)`.
+		//
+		//	query:
+		//		The CSS3 expression to match against. For details on the syntax of
+		//		CSS3 selectors, see <http://www.w3.org/TR/css3-selectors/#selectors>
+		//	root:
+		//		A DOMNode (or node id) to scope the search from. Optional.
+		//	returns: dojo.NodeList
+		//		An instance of `dojo.NodeList`. Many methods are available on
+		//		NodeLists for searching, iterating, manipulating, and handling
+		//		events on the matched nodes in the returned list.
+		//	example:
+		//		search the entire document for elements with the class "foo":
+		//	|	dojo.query(".foo");
+		//		these elements will match:
+		//	|	<span class="foo"></span>
+		//	|	<span class="foo bar"></span>
+		//	|	<p class="thud foo"></p>
+		//	example:
+		//		search the entire document for elements with the classes "foo" *and* "bar":
+		//	|	dojo.query(".foo.bar");
+		//		these elements will match:
+		//	|	<span class="foo bar"></span>
+		//		while these will not:
+		//	|	<span class="foo"></span>
+		//	|	<p class="thud foo"></p>
+		//	example:
+		//		find `<span>` elements which are descendants of paragraphs and
+		//		which have a "highlighted" class:
+		//	|	dojo.query("p span.highlighted");
+		//		the innermost span in this fragment matches:
+		//	|	<p class="foo">
+		//	|		<span>...
+		//	|			<span class="highlighted foo bar">...</span>
+		//	|		</span>
+		//	|	</p>
+		//	example:
+		//		set an "odd" class on all odd table rows inside of the table
+		//		`#tabular_data`, using the `>` (direct child) selector to avoid
+		//		affecting any nested tables:
+		//	|	dojo.query("#tabular_data > tbody > tr:nth-child(odd)").addClass("odd");
+		//	example:
+		//		remove all elements with the class "error" from the document
+		//		and store them in a list:
+		//	|	var errors = dojo.query(".error").orphan();
+		//	example:
+		//		add an onclick handler to every submit button in the document
+		//		which causes the form to be sent via Ajax instead:
+		//	|	dojo.query("input[type='submit']").onclick(function(e){
+		//	|		dojo.stopEvent(e); // prevent sending the form
+		//	|		var btn = e.target;
+		//	|		dojo.xhrPost({
+		//	|			form: btn.form,
+		//	|			load: function(data){
+		//	|				// replace the form with the response
+		//	|				var div = dojo.doc.createElement("div");
+		//	|				dojo.place(div, btn.form, "after");
+		//	|				div.innerHTML = data;
+		//	|				dojo.style(btn.form, "display", "none");
+		//	|			}
+		//	|		});
+		//	|	});
+
+
+		// NOTE: elementsById is not currently supported
+		// NOTE: ignores xpath-ish queries for now
+
+		if(query.constructor == d.NodeList){
+			return query;
+		}
+		if(!d.isString(query)){
+			return new d.NodeList(query); // dojo.NodeList
+		}
+		if(d.isString(root)){
+			root = d.byId(root);
+		}
+
+		root = root||d.doc;
+		var od = root.ownerDocument||root.documentElement;
+		caseSensitive = (root.contentType && root.contentType=="application/xml") || (!!od) && (d.isIE ? od.xml : (root.xmlVersion||od.xmlVersion));
+		return _zip(getQueryFunc(query)(root)); // dojo.NodeList
+	}
+
+	/*
+	// exposing this was a mistake
+	d.query.attrs = attrs;
+	*/
+	// exposing this because new pseudo matches are only executed through the
+	// DOM query path (never through the xpath optimizing branch)
+	d.query.pseudos = pseudos;
+
+	// one-off function for filtering a NodeList based on a simple selector
+	d._filterQueryResult = function(nodeList, simpleFilter){
+		var tnl = new d.NodeList();
+		var ff = (simpleFilter) ? getFilterFunc(getQueryParts(simpleFilter)[0]) : function(){ return true; };
+		for(var x = 0, te; te = nodeList[x]; x++){
+			if(ff(te)){ tnl.push(te); }
+		}
+		return tnl;
+	}
+})();
+
+}
+
+if(!dojo._hasResource["dojo._base.xhr"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.xhr"] = true;
+dojo.provide("dojo._base.xhr");
+
+
+
+
+
+(function(){
+	var _d = dojo;
+	function setValue(/*Object*/obj, /*String*/name, /*String*/value){
+		//summary:
+		//		For the named property in object, set the value. If a value
+		//		already exists and it is a string, convert the value to be an
+		//		array of values.
+		var val = obj[name];
+		if(_d.isString(val)){
+			obj[name] = [val, value];
+		}else if(_d.isArray(val)){
+			val.push(value);
+		}else{
+			obj[name] = value;
+		}
+	}
+
+	dojo.formToObject = function(/*DOMNode||String*/ formNode){
+		// summary:
+		//		dojo.formToObject returns the values encoded in an HTML form as
+		//		string properties in an object which it then returns. Disabled form
+		//		elements, buttons, and other non-value form elements are skipped.
+		//		Multi-select elements are returned as an array of string values.
+		// description:
+		//		This form:
+		//
+		//		|	<form id="test_form">
+		//		|		<input type="text" name="blah" value="blah">
+		//		|		<input type="text" name="no_value" value="blah" disabled>
+		//		|		<input type="button" name="no_value2" value="blah">
+		//		|		<select type="select" multiple name="multi" size="5">
+		//		|			<option value="blah">blah</option>
+		//		|			<option value="thud" selected>thud</option>
+		//		|			<option value="thonk" selected>thonk</option>
+		//		|		</select>
+		//		|	</form>
+		//
+		//		yields this object structure as the result of a call to
+		//		formToObject():
+		//
+		//		|	{ 
+		//		|		blah: "blah",
+		//		|		multi: [
+		//		|			"thud",
+		//		|			"thonk"
+		//		|		]
+		//		|	};
+
+		var ret = {};
+		var exclude = "file|submit|image|reset|button|";
+		_d.forEach(dojo.byId(formNode).elements, function(item){
+			var _in = item.name;
+			var type = (item.type||"").toLowerCase();
+			if(_in && type && exclude.indexOf(type) == -1 && !item.disabled){
+				if(type == "radio" || type == "checkbox"){
+					if(item.checked){ setValue(ret, _in, item.value); }
+				}else if(item.multiple){
+					ret[_in] = [];
+					_d.query("option", item).forEach(function(opt){
+						if(opt.selected){
+							setValue(ret, _in, opt.value);
+						}
+					});
+				}else{ 
+					setValue(ret, _in, item.value);
+					if(type == "image"){
+						ret[_in+".x"] = ret[_in+".y"] = ret[_in].x = ret[_in].y = 0;
+					}
+				}
+			}
+		});
+		return ret; // Object
+	}
+
+	dojo.objectToQuery = function(/*Object*/ map){
+		//	summary:
+		//		takes a name/value mapping object and returns a string representing
+		//		a URL-encoded version of that object.
+		//	example:
+		//		this object:
+		//
+		//		|	{ 
+		//		|		blah: "blah",
+		//		|		multi: [
+		//		|			"thud",
+		//		|			"thonk"
+		//		|		]
+		//		|	};
+		//
+		//	yields the following query string:
+		//	
+		//	|	"blah=blah&multi=thud&multi=thonk"
+
+		// FIXME: need to implement encodeAscii!!
+		var enc = encodeURIComponent;
+		var pairs = [];
+		var backstop = {};
+		for(var name in map){
+			var value = map[name];
+			if(value != backstop[name]){
+				var assign = enc(name) + "=";
+				if(_d.isArray(value)){
+					for(var i=0; i < value.length; i++){
+						pairs.push(assign + enc(value[i]));
+					}
+				}else{
+					pairs.push(assign + enc(value));
+				}
+			}
+		}
+		return pairs.join("&"); // String
+	}
+
+	dojo.formToQuery = function(/*DOMNode||String*/ formNode){
+		// summary:
+		//		Returns a URL-encoded string representing the form passed as either a
+		//		node or string ID identifying the form to serialize
+		return _d.objectToQuery(_d.formToObject(formNode)); // String
+	}
+
+	dojo.formToJson = function(/*DOMNode||String*/ formNode, /*Boolean?*/prettyPrint){
+		// summary:
+		//		return a serialized JSON string from a form node or string
+		//		ID identifying the form to serialize
+		return _d.toJson(_d.formToObject(formNode), prettyPrint); // String
+	}
+
+	dojo.queryToObject = function(/*String*/ str){
+		// summary:
+		//		returns an object representing a de-serialized query section of a
+		//		URL. Query keys with multiple values are returned in an array.
+		// description:
+		//		This string:
+		//
+		//	|		"foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
+		//		
+		//		results in this object structure:
+		//
+		//	|		{
+		//	|			foo: [ "bar", "baz" ],
+		//	|			thinger: " spaces =blah",
+		//	|			zonk: "blarg"
+		//	|		}
+		//	
+		//		Note that spaces and other urlencoded entities are correctly
+		//		handled.
+
+		// FIXME: should we grab the URL string if we're not passed one?
+		var ret = {};
+		var qp = str.split("&");
+		var dec = decodeURIComponent;
+		_d.forEach(qp, function(item){
+			if(item.length){
+				var parts = item.split("=");
+				var name = dec(parts.shift());
+				var val = dec(parts.join("="));
+				if(_d.isString(ret[name])){
+					ret[name] = [ret[name]];
+				}
+				if(_d.isArray(ret[name])){
+					ret[name].push(val);
+				}else{
+					ret[name] = val;
+				}
+			}
+		});
+		return ret; // Object
+	}
+
+	/*
+		from refactor.txt:
+
+		all bind() replacement APIs take the following argument structure:
+
+			{
+				url: "blah.html",
+
+				// all below are optional, but must be supported in some form by
+				// every IO API
+				timeout: 1000, // milliseconds
+				handleAs: "text", // replaces the always-wrong "mimetype"
+				content: { 
+					key: "value"
+				},
+
+				// browser-specific, MAY be unsupported
+				sync: true, // defaults to false
+				form: dojo.byId("someForm") 
+			}
+	*/
+
+	// need to block async callbacks from snatching this thread as the result
+	// of an async callback might call another sync XHR, this hangs khtml forever
+	// must checked by watchInFlight()
+
+	dojo._blockAsync = false;
+
+	dojo._contentHandlers = {
+		"text": function(xhr){ return xhr.responseText; },
+		"json": function(xhr){
+			return _d.fromJson(xhr.responseText || null);
+		},
+		"json-comment-filtered": function(xhr){ 
+			// NOTE: the json-comment-filtered option was implemented to prevent
+			// "JavaScript Hijacking", but it is less secure than standard JSON. Use
+			// standard JSON instead. JSON prefixing can be used to subvert hijacking.
+			if(!dojo.config.useCommentedJson){
+				console.warn("Consider using the standard mimetype:application/json."
+					+ " json-commenting can introduce security issues. To"
+					+ " decrease the chances of hijacking, use the standard the 'json' handler and"
+					+ " prefix your json with: {}&&\n"
+					+ "Use djConfig.useCommentedJson=true to turn off this message.");
+			}
+
+			var value = xhr.responseText;
+			var cStartIdx = value.indexOf("\/*");
+			var cEndIdx = value.lastIndexOf("*\/");
+			if(cStartIdx == -1 || cEndIdx == -1){
+				throw new Error("JSON was not comment filtered");
+			}
+			return _d.fromJson(value.substring(cStartIdx+2, cEndIdx));
+		},
+		"javascript": function(xhr){ 
+			// FIXME: try Moz and IE specific eval variants?
+			return _d.eval(xhr.responseText);
+		},
+		"xml": function(xhr){ 
+			var result = xhr.responseXML;
+			if(_d.isIE && (!result || result.documentElement == null)){
+				_d.forEach(["MSXML2", "Microsoft", "MSXML", "MSXML3"], function(prefix){
+					try{
+						var dom = new ActiveXObject(prefix + ".XMLDOM");
+						dom.async = false;
+						dom.loadXML(xhr.responseText);
+						result = dom;
+					}catch(e){ /* Not available. Squelch and try next one. */ }
+				});
+			}
+			return result; // DOMDocument
+		}
+	};
+
+	dojo._contentHandlers["json-comment-optional"] = function(xhr){
+		var handlers = _d._contentHandlers;
+		if(xhr.responseText && xhr.responseText.indexOf("\/*") != -1){
+			return handlers["json-comment-filtered"](xhr);
+		}else{
+			return handlers["json"](xhr);
+		}
+	};
+
+	/*=====
+	dojo.__IoArgs = function(){
+		//	url: String
+		//		URL to server endpoint.
+		//	content: Object?
+		//		Contains properties with string values. These
+		//		properties will be serialized as name1=value2 and
+		//		passed in the request.
+		//	timeout: Integer?
+		//		Milliseconds to wait for the response. If this time
+		//		passes, the then error callbacks are called.
+		//	form: DOMNode?
+		//		DOM node for a form. Used to extract the form values
+		//		and send to the server.
+		//	preventCache: Boolean?
+		//		Default is false. If true, then a
+		//		"dojo.preventCache" parameter is sent in the request
+		//		with a value that changes with each request
+		//		(timestamp). Useful only with GET-type requests.
+		//	handleAs: String?
+		//		Acceptable values depend on the type of IO
+		//		transport (see specific IO calls for more information).
+		//	load: Function?
+		//		function(response, ioArgs){} response is of type Object, ioArgs
+		//		is of type dojo.__IoCallbackArgs.  This function will be
+		//		called on a successful HTTP response code.
+		//	error: Function?
+		//		function(response, ioArgs){} response is of type Object, ioArgs
+		//		is of type dojo.__IoCallbackArgs. This function will
+		//		be called when the request fails due to a network or server error, the url
+		//		is invalid, etc. It will also be called if the load or handle callback throws an
+		//		exception, unless djConfig.isDebug is true.  This allows deployed applications
+		//		to continue to run even when a logic error happens in the callback, while making
+		//		it easier to troubleshoot while in debug mode.
+		//	handle: Function?
+		//		function(response, ioArgs){} response is of type Object, ioArgs
+		//		is of type dojo.__IoCallbackArgs.  This function will
+		//		be called at the end of every request, whether or not an error occurs.
+		this.url = url;
+		this.content = content;
+		this.timeout = timeout;
+		this.form = form;
+		this.preventCache = preventCache;
+		this.handleAs = handleAs;
+		this.load = load;
+		this.error = error;
+		this.handle = handle;
+	}
+	=====*/
+
+	/*=====
+	dojo.__IoCallbackArgs = function(args, xhr, url, query, handleAs, id, canDelete, json){
+		//	args: Object
+		//		the original object argument to the IO call.
+		//	xhr: XMLHttpRequest
+		//		For XMLHttpRequest calls only, the
+		//		XMLHttpRequest object that was used for the
+		//		request.
+		//	url: String
+		//		The final URL used for the call. Many times it
+		//		will be different than the original args.url
+		//		value.
+		//	query: String
+		//		For non-GET requests, the
+		//		name1=value1&name2=value2 parameters sent up in
+		//		the request.
+		//	handleAs: String
+		//		The final indicator on how the response will be
+		//		handled.
+		//	id: String
+		//		For dojo.io.script calls only, the internal
+		//		script ID used for the request.
+		//	canDelete: Boolean
+		//		For dojo.io.script calls only, indicates
+		//		whether the script tag that represents the
+		//		request can be deleted after callbacks have
+		//		been called. Used internally to know when
+		//		cleanup can happen on JSONP-type requests.
+		//	json: Object
+		//		For dojo.io.script calls only: holds the JSON
+		//		response for JSONP-type requests. Used
+		//		internally to hold on to the JSON responses.
+		//		You should not need to access it directly --
+		//		the same object should be passed to the success
+		//		callbacks directly.
+		this.args = args;
+		this.xhr = xhr;
+		this.url = url;
+		this.query = query;
+		this.handleAs = handleAs;
+		this.id = id;
+		this.canDelete = canDelete;
+		this.json = json;
+	}
+	=====*/
+
+
+
+	dojo._ioSetArgs = function(/*dojo.__IoArgs*/args,
+			/*Function*/canceller,
+			/*Function*/okHandler,
+			/*Function*/errHandler){
+		//	summary: 
+		//		sets up the Deferred and ioArgs property on the Deferred so it
+		//		can be used in an io call.
+		//	args:
+		//		The args object passed into the public io call. Recognized properties on
+		//		the args object are:
+		//	canceller:
+		//		The canceller function used for the Deferred object. The function
+		//		will receive one argument, the Deferred object that is related to the
+		//		canceller.
+		//	okHandler:
+		//		The first OK callback to be registered with Deferred. It has the opportunity
+		//		to transform the OK response. It will receive one argument -- the Deferred
+		//		object returned from this function.
+		//	errHandler:
+		//		The first error callback to be registered with Deferred. It has the opportunity
+		//		to do cleanup on an error. It will receive two arguments: error (the 
+		//		Error object) and dfd, the Deferred object returned from this function.
+
+		var ioArgs = {args: args, url: args.url};
+
+		//Get values from form if requestd.
+		var formObject = null;
+		if(args.form){ 
+			var form = _d.byId(args.form);
+			//IE requires going through getAttributeNode instead of just getAttribute in some form cases, 
+			//so use it for all.  See #2844
+			var actnNode = form.getAttributeNode("action");
+			ioArgs.url = ioArgs.url || (actnNode ? actnNode.value : null); 
+			formObject = _d.formToObject(form);
+		}
+
+		// set up the query params
+		var miArgs = [{}];
+	
+		if(formObject){
+			// potentially over-ride url-provided params w/ form values
+			miArgs.push(formObject);
+		}
+		if(args.content){
+			// stuff in content over-rides what's set by form
+			miArgs.push(args.content);
+		}
+		if(args.preventCache){
+			miArgs.push({"dojo.preventCache": new Date().valueOf()});
+		}
+		ioArgs.query = _d.objectToQuery(_d.mixin.apply(null, miArgs));
+	
+		// .. and the real work of getting the deferred in order, etc.
+		ioArgs.handleAs = args.handleAs || "text";
+		var d = new _d.Deferred(canceller);
+		d.addCallbacks(okHandler, function(error){
+			return errHandler(error, d);
+		});
+
+		//Support specifying load, error and handle callback functions from the args.
+		//For those callbacks, the "this" object will be the args object.
+		//The callbacks will get the deferred result value as the
+		//first argument and the ioArgs object as the second argument.
+		var ld = args.load;
+		if(ld && _d.isFunction(ld)){
+			d.addCallback(function(value){
+				return ld.call(args, value, ioArgs);
+			});
+		}
+		var err = args.error;
+		if(err && _d.isFunction(err)){
+			d.addErrback(function(value){
+				return err.call(args, value, ioArgs);
+			});
+		}
+		var handle = args.handle;
+		if(handle && _d.isFunction(handle)){
+			d.addBoth(function(value){
+				return handle.call(args, value, ioArgs);
+			});
+		}
+		
+		d.ioArgs = ioArgs;
+	
+		// FIXME: need to wire up the xhr object's abort method to something
+		// analagous in the Deferred
+		return d;
+	}
+
+	var _deferredCancel = function(/*Deferred*/dfd){
+		//summary: canceller function for dojo._ioSetArgs call.
+		
+		dfd.canceled = true;
+		var xhr = dfd.ioArgs.xhr;
+		var _at = typeof xhr.abort;
+		if(_at == "function" || _at == "object" || _at == "unknown"){
+			xhr.abort();
+		}
+		var err = dfd.ioArgs.error;
+		if(!err){
+			err = new Error("xhr cancelled");
+			err.dojoType="cancel";
+		}
+		return err;
+	}
+	var _deferredOk = function(/*Deferred*/dfd){
+		//summary: okHandler function for dojo._ioSetArgs call.
+
+		var ret = _d._contentHandlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr);
+		return (typeof ret == "undefined") ? null : ret;
+	}
+	var _deferError = function(/*Error*/error, /*Deferred*/dfd){
+		//summary: errHandler function for dojo._ioSetArgs call.
+
+		
+		return error;
+	}
+
+	// avoid setting a timer per request. It degrades performance on IE
+	// something fierece if we don't use unified loops.
+	var _inFlightIntvl = null;
+	var _inFlight = [];
+	var _watchInFlight = function(){
+		//summary: 
+		//		internal method that checks each inflight XMLHttpRequest to see
+		//		if it has completed or if the timeout situation applies.
+		
+		var now = (new Date()).getTime();
+		// make sure sync calls stay thread safe, if this callback is called
+		// during a sync call and this results in another sync call before the
+		// first sync call ends the browser hangs
+		if(!_d._blockAsync){
+			// we need manual loop because we often modify _inFlight (and therefore 'i') while iterating
+			// note: the second clause is an assigment on purpose, lint may complain
+			for(var i = 0, tif; i < _inFlight.length && (tif = _inFlight[i]); i++){
+				var dfd = tif.dfd;
+				var func = function(){
+					if(!dfd || dfd.canceled || !tif.validCheck(dfd)){
+						_inFlight.splice(i--, 1); 
+					}else if(tif.ioCheck(dfd)){
+						_inFlight.splice(i--, 1);
+						tif.resHandle(dfd);
+					}else if(dfd.startTime){
+						//did we timeout?
+						if(dfd.startTime + (dfd.ioArgs.args.timeout || 0) < now){
+							_inFlight.splice(i--, 1);
+							var err = new Error("timeout exceeded");
+							err.dojoType = "timeout";
+							dfd.errback(err);
+							//Cancel the request so the io module can do appropriate cleanup.
+							dfd.cancel();
+						}
+					}
+				};
+				if(dojo.config.isDebug){
+					func.call(this);
+				}else{
+					try{
+						func.call(this);
+					}catch(e){
+						dfd.errback(e);
+					}
+				}
+			}
+		}
+
+		if(!_inFlight.length){
+			clearInterval(_inFlightIntvl);
+			_inFlightIntvl = null;
+			return;
+		}
+
+	}
+
+	dojo._ioCancelAll = function(){
+		//summary: Cancels all pending IO requests, regardless of IO type
+		//(xhr, script, iframe).
+		try{
+			_d.forEach(_inFlight, function(i){
+				try{
+					i.dfd.cancel();
+				}catch(e){/*squelch*/}
+			});
+		}catch(e){/*squelch*/}
+	}
+
+	//Automatically call cancel all io calls on unload
+	//in IE for trac issue #2357.
+	if(_d.isIE){
+		_d.addOnWindowUnload(_d._ioCancelAll);
+	}
+
+	_d._ioWatch = function(/*Deferred*/dfd,
+		/*Function*/validCheck,
+		/*Function*/ioCheck,
+		/*Function*/resHandle){
+		//summary: watches the io request represented by dfd to see if it completes.
+		//dfd:
+		//		The Deferred object to watch.
+		//validCheck:
+		//		Function used to check if the IO request is still valid. Gets the dfd
+		//		object as its only argument.
+		//ioCheck:
+		//		Function used to check if basic IO call worked. Gets the dfd
+		//		object as its only argument.
+		//resHandle:
+		//		Function used to process response. Gets the dfd
+		//		object as its only argument.
+		if(dfd.ioArgs.args.timeout){
+			dfd.startTime = (new Date()).getTime();
+		}
+		_inFlight.push({dfd: dfd, validCheck: validCheck, ioCheck: ioCheck, resHandle: resHandle});
+		if(!_inFlightIntvl){
+			_inFlightIntvl = setInterval(_watchInFlight, 50);
+		}
+		_watchInFlight(); // handle sync requests
+	}
+
+	var _defaultContentType = "application/x-www-form-urlencoded";
+
+	var _validCheck = function(/*Deferred*/dfd){
+		return dfd.ioArgs.xhr.readyState; //boolean
+	}
+	var _ioCheck = function(/*Deferred*/dfd){
+		return 4 == dfd.ioArgs.xhr.readyState; //boolean
+	}
+	var _resHandle = function(/*Deferred*/dfd){
+		var xhr = dfd.ioArgs.xhr;
+		if(_d._isDocumentOk(xhr)){
+			dfd.callback(dfd);
+		}else{
+			var err = new Error("Unable to load " + dfd.ioArgs.url + " status:" + xhr.status);
+			err.status = xhr.status;
+			err.responseText = xhr.responseText;
+			dfd.errback(err);
+		}
+	}
+
+	dojo._ioAddQueryToUrl = function(/*dojo.__IoCallbackArgs*/ioArgs){
+		//summary: Adds query params discovered by the io deferred construction to the URL.
+		//Only use this for operations which are fundamentally GET-type operations.
+		if(ioArgs.query.length){
+			ioArgs.url += (ioArgs.url.indexOf("?") == -1 ? "?" : "&") + ioArgs.query;
+			ioArgs.query = null;
+		}		
+	}
+
+	/*=====
+	dojo.declare("dojo.__XhrArgs", dojo.__IoArgs, {
+		constructor: function(){
+			//	summary:
+			//		In addition to the properties listed for the dojo._IoArgs type,
+			//		the following properties are allowed for dojo.xhr* methods.
+			//	handleAs: String?
+			//		Acceptable values are: text (default), json, json-comment-optional,
+			//		json-comment-filtered, javascript, xml
+			//	sync: Boolean?
+			//		false is default. Indicates whether the request should
+			//		be a synchronous (blocking) request.
+			//	headers: Object?
+			//		Additional HTTP headers to send in the request.
+			this.handleAs = handleAs;
+			this.sync = sync;
+			this.headers = headers;
+		}
+	});
+	=====*/
+
+	dojo.xhr = function(/*String*/ method, /*dojo.__XhrArgs*/ args, /*Boolean?*/ hasBody){
+		//	summary:
+		//		Sends an HTTP request with the given method.
+		//	description:
+		//		Sends an HTTP request with the given method.
+		//		See also dojo.xhrGet(), xhrPost(), xhrPut() and dojo.xhrDelete() for shortcuts
+		//		for those HTTP methods. There are also methods for "raw" PUT and POST methods
+		//		via dojo.rawXhrPut() and dojo.rawXhrPost() respectively.
+		//	method:
+		//		HTTP method to be used, such as GET, POST, PUT, DELETE.  Should be uppercase.
+		//	hasBody:
+		//		If the request has an HTTP body, then pass true for hasBody.
+
+		//Make the Deferred object for this xhr request.
+		var dfd = _d._ioSetArgs(args, _deferredCancel, _deferredOk, _deferError);
+
+		//Pass the args to _xhrObj, to allow xhr iframe proxy interceptions.
+		dfd.ioArgs.xhr = _d._xhrObj(dfd.ioArgs.args);
+
+		if(hasBody){
+			if("postData" in args){
+				dfd.ioArgs.query = args.postData;
+			}else if("putData" in args){
+				dfd.ioArgs.query = args.putData;
+			}
+		}else{
+			_d._ioAddQueryToUrl(dfd.ioArgs);
+		}
+
+		// IE 6 is a steaming pile. It won't let you call apply() on the native function (xhr.open).
+		// workaround for IE6's apply() "issues"
+		var ioArgs = dfd.ioArgs;
+		var xhr = ioArgs.xhr;
+		xhr.open(method, ioArgs.url, args.sync !== true, args.user || undefined, args.password || undefined);
+		if(args.headers){
+			for(var hdr in args.headers){
+				if(hdr.toLowerCase() === "content-type" && !args.contentType){
+					args.contentType = args.headers[hdr];
+				}else{
+					xhr.setRequestHeader(hdr, args.headers[hdr]);
+				}
+			}
+		}
+		// FIXME: is this appropriate for all content types?
+		xhr.setRequestHeader("Content-Type", args.contentType || _defaultContentType);
+		if(!args.headers || !args.headers["X-Requested-With"]){
+			xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+		}
+		// FIXME: set other headers here!
+		if(dojo.config.isDebug){
+			xhr.send(ioArgs.query);
+		}else{
+			try{
+				xhr.send(ioArgs.query);
+			}catch(e){
+				dfd.ioArgs.error = e;
+				dfd.cancel();
+			}
+		}
+		_d._ioWatch(dfd, _validCheck, _ioCheck, _resHandle);
+		xhr = null;
+		return dfd; // dojo.Deferred
+	}
+
+	dojo.xhrGet = function(/*dojo.__XhrArgs*/ args){
+		//	summary: 
+		//		Sends an HTTP GET request to the server.
+		return _d.xhr("GET", args); // dojo.Deferred
+	}
+
+	dojo.rawXhrPost = dojo.xhrPost = function(/*dojo.__XhrArgs*/ args){
+		//	summary:
+		//		Sends an HTTP POST request to the server. In addtion to the properties
+		//		listed for the dojo.__XhrArgs type, the following property is allowed:
+		//	postData:
+		//		String. Send raw data in the body of the POST request.
+		return _d.xhr("POST", args, true); // dojo.Deferred
+	}
+
+	dojo.rawXhrPut = dojo.xhrPut = function(/*dojo.__XhrArgs*/ args){
+		//	summary:
+		//		Sends an HTTP PUT request to the server. In addtion to the properties
+		//		listed for the dojo.__XhrArgs type, the following property is allowed:
+		//	putData:
+		//		String. Send raw data in the body of the PUT request.
+		return _d.xhr("PUT", args, true); // dojo.Deferred
+	}
+
+	dojo.xhrDelete = function(/*dojo.__XhrArgs*/ args){
+		//	summary:
+		//		Sends an HTTP DELETE request to the server.
+		return _d.xhr("DELETE", args); //dojo.Deferred
+	}
+
+	/*
+	dojo.wrapForm = function(formNode){
+		//summary:
+		//		A replacement for FormBind, but not implemented yet.
+
+		// FIXME: need to think harder about what extensions to this we might
+		// want. What should we allow folks to do w/ this? What events to
+		// set/send?
+		throw new Error("dojo.wrapForm not yet implemented");
+	}
+	*/
+})();
+
+}
+
+if(!dojo._hasResource["dojo._base.fx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.fx"] = true;
+dojo.provide("dojo._base.fx");
+
+
+
+
+
+
+/*
+	Animation losely package based on Dan Pupius' work, contributed under CLA: 
+		http://pupius.co.uk/js/Toolkit.Drawing.js
+*/
+(function(){ 
+
+	var d = dojo;
+	
+	dojo._Line = function(/*int*/ start, /*int*/ end){
+		//	summary:
+		//		dojo._Line is the object used to generate values from a start value
+		//		to an end value
+		//	start: int
+		//		Beginning value for range
+		//	end: int
+		//		Ending value for range
+		this.start = start;
+		this.end = end;
+		this.getValue = function(/*float*/ n){
+			//	summary: returns the point on the line
+			//	n: a floating point number greater than 0 and less than 1
+			return ((this.end - this.start) * n) + this.start; // Decimal
+		}
+	}
+	
+	d.declare("dojo._Animation", null, {
+		//	summary
+		//		A generic animation class that fires callbacks into its handlers
+		//		object at various states. Nearly all dojo animation functions
+		//		return an instance of this method, usually without calling the
+		//		.play() method beforehand. Therefore, you will likely need to
+		//		call .play() on instances of dojo._Animation when one is
+		//		returned.
+		constructor: function(/*Object*/ args){
+			d.mixin(this, args);
+			if(d.isArray(this.curve)){
+				/* curve: Array
+					pId: a */
+				this.curve = new d._Line(this.curve[0], this.curve[1]);
+			}
+		},
+		
+		// duration: Integer
+		//	The time in milliseonds the animation will take to run
+		duration: 350,
+	
+	/*=====
+		// curve: dojo._Line||Array
+		//	A two element array of start and end values, or a dojo._Line instance to be
+		//	used in the Animation. 
+		curve: null,
+	
+		// easing: Function
+		//	A Function to adjust the acceleration (or deceleration) of the progress 
+		//	across a dojo._Line
+		easing: null,
+	=====*/
+	
+		// repeat: Integer
+		//	The number of times to loop the animation
+		repeat: 0,
+	
+		// rate: Integer
+		//	the time in milliseconds to wait before advancing to next frame 
+		//	(used as a fps timer: rate/1000 = fps)
+		rate: 10 /* 100 fps */,
+	
+	/*===== 
+		// delay: Integer
+		// 	The time in milliseconds to wait before starting animation after it has been .play()'ed
+		delay: null,
+	
+		// events
+		//
+		// beforeBegin: Event
+		//	Synthetic event fired before a dojo._Animation begins playing (synchronous)
+		beforeBegin: null,
+	
+		// onBegin: Event
+		//	Synthetic event fired as a dojo._Animation begins playing (useful?)
+		onBegin: null,
+	
+		// onAnimate: Event
+		//	Synthetic event fired at each interval of a dojo._Animation
+		onAnimate: null,
+	
+		// onEnd: Event
+		//	Synthetic event fired after the final frame of a dojo._Animation
+		onEnd: null,
+	
+		// onPlay: Event
+		//	Synthetic event fired any time a dojo._Animation is play()'ed
+		onPlay: null,
+	
+		// onPause: Event
+		//	Synthetic event fired when a dojo._Animation is paused
+		onPause: null,
+	
+		// onStop: Event
+		//	Synthetic event fires when a dojo._Animation is stopped
+		onStop: null,
+	
+	=====*/
+	
+		_percent: 0,
+		_startRepeatCount: 0,
+	
+		_fire: function(/*Event*/ evt, /*Array?*/ args){
+			//	summary:
+			//		Convenience function.  Fire event "evt" and pass it the
+			//		arguments specified in "args".
+			//	evt:
+			//		The event to fire.
+			//	args:
+			//		The arguments to pass to the event.
+			if(this[evt]){
+				if(dojo.config.isDebug){
+					this[evt].apply(this, args||[]);
+				}else{
+					try{
+						this[evt].apply(this, args||[]);
+					}catch(e){
+						// squelch and log because we shouldn't allow exceptions in
+						// synthetic event handlers to cause the internal timer to run
+						// amuck, potentially pegging the CPU. I'm not a fan of this
+						// squelch, but hopefully logging will make it clear what's
+						// going on
+						console.error("exception in animation handler for:", evt);
+						console.error(e);
+					}
+				}
+			}
+			return this; // dojo._Animation
+		},
+
+		play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
+			// summary:
+			//		Start the animation.
+			// delay:
+			//		How many milliseconds to delay before starting.
+			// gotoStart:
+			//		If true, starts the animation from the beginning; otherwise,
+			//		starts it from its current position.
+			var _t = this;
+			if(gotoStart){
+				_t._stopTimer();
+				_t._active = _t._paused = false;
+				_t._percent = 0;
+			}else if(_t._active && !_t._paused){
+				return _t; // dojo._Animation
+			}
+	
+			_t._fire("beforeBegin");
+	
+			var de = delay||_t.delay;
+			var _p = dojo.hitch(_t, "_play", gotoStart);
+			if(de > 0){
+				setTimeout(_p, de);
+				return _t; // dojo._Animation
+			}
+			_p();
+			return _t;
+		},
+	
+		_play: function(gotoStart){
+			var _t = this;
+			_t._startTime = new Date().valueOf();
+			if(_t._paused){
+				_t._startTime -= _t.duration * _t._percent;
+			}
+			_t._endTime = _t._startTime + _t.duration;
+	
+			_t._active = true;
+			_t._paused = false;
+	
+			var value = _t.curve.getValue(_t._percent);
+			if(!_t._percent){
+				if(!_t._startRepeatCount){
+					_t._startRepeatCount = _t.repeat;
+				}
+				_t._fire("onBegin", [value]);
+			}
+	
+			_t._fire("onPlay", [value]);
+	
+			_t._cycle();
+			return _t; // dojo._Animation
+		},
+	
+		pause: function(){
+			// summary: Pauses a running animation.
+			this._stopTimer();
+			if(!this._active){ return this; /*dojo._Animation*/ }
+			this._paused = true;
+			this._fire("onPause", [this.curve.getValue(this._percent)]);
+			return this; // dojo._Animation
+		},
+	
+		gotoPercent: function(/*Decimal*/ percent, /*Boolean?*/ andPlay){
+			//	summary:
+			//		Sets the progress of the animation.
+			//	percent:
+			//		A percentage in decimal notation (between and including 0.0 and 1.0).
+			//	andPlay:
+			//		If true, play the animation after setting the progress.
+			this._stopTimer();
+			this._active = this._paused = true;
+			this._percent = percent;
+			if(andPlay){ this.play(); }
+			return this; // dojo._Animation
+		},
+	
+		stop: function(/*boolean?*/ gotoEnd){
+			// summary: Stops a running animation.
+			// gotoEnd: If true, the animation will end.
+			if(!this._timer){ return this; /* dojo._Animation */ }
+			this._stopTimer();
+			if(gotoEnd){
+				this._percent = 1;
+			}
+			this._fire("onStop", [this.curve.getValue(this._percent)]);
+			this._active = this._paused = false;
+			return this; // dojo._Animation
+		},
+	
+		status: function(){
+			// summary: Returns a string token representation of the status of
+			//			the animation, one of: "paused", "playing", "stopped"
+			if(this._active){
+				return this._paused ? "paused" : "playing"; // String
+			}
+			return "stopped"; // String
+		},
+	
+		_cycle: function(){
+			var _t = this;
+			if(_t._active){
+				var curr = new Date().valueOf();
+				var step = (curr - _t._startTime) / (_t._endTime - _t._startTime);
+	
+				if(step >= 1){
+					step = 1;
+				}
+				_t._percent = step;
+	
+				// Perform easing
+				if(_t.easing){
+					step = _t.easing(step);
+				}
+	
+				_t._fire("onAnimate", [_t.curve.getValue(step)]);
+	
+				if(_t._percent < 1){
+					_t._startTimer();
+				}else{
+					_t._active = false;
+	
+					if(_t.repeat > 0){
+						_t.repeat--;
+						_t.play(null, true);
+					}else if(_t.repeat == -1){
+						_t.play(null, true);
+					}else{
+						if(_t._startRepeatCount){
+							_t.repeat = _t._startRepeatCount;
+							_t._startRepeatCount = 0;
+						}
+					}
+					_t._percent = 0;
+					_t._fire("onEnd");
+					_t._stopTimer();
+				}
+			}
+			return _t; // dojo._Animation
+		}
+	});
+
+	var ctr = 0;
+	var _globalTimerList = [];
+	var runner = {
+		run: function(){ }
+	};
+	var timer = null;
+	dojo._Animation.prototype._startTimer = function(){
+		// this._timer = setTimeout(dojo.hitch(this, "_cycle"), this.rate);
+		if(!this._timer){
+			this._timer = d.connect(runner, "run", this, "_cycle");
+			ctr++;
+		}
+		if(!timer){
+			timer = setInterval(d.hitch(runner, "run"), this.rate);
+		}
+	};
+
+	dojo._Animation.prototype._stopTimer = function(){
+		if(this._timer){
+			d.disconnect(this._timer);
+			this._timer = null;
+			ctr--;
+		}
+		if(ctr <= 0){
+			clearInterval(timer);
+			timer = null;
+			ctr = 0;
+		}
+	};
+
+	var _makeFadeable = (d.isIE) ? function(node){
+		// only set the zoom if the "tickle" value would be the same as the
+		// default
+		var ns = node.style;
+		// don't set the width to auto if it didn't already cascade that way.
+		// We don't want to f anyones designs
+		if(!ns.width.length && d.style(node, "width") == "auto"){
+			ns.width = "auto";
+		}
+	} : function(){};
+
+	dojo._fade = function(/*Object*/ args){
+		//	summary: 
+		//		Returns an animation that will fade the node defined by
+		//		args.node from the start to end values passed (args.start
+		//		args.end) (end is mandatory, start is optional)
+
+		args.node = d.byId(args.node);
+		var fArgs = d.mixin({ properties: {} }, args);
+		var props = (fArgs.properties.opacity = {});
+		props.start = !("start" in fArgs) ?
+			function(){ 
+				return Number(d.style(fArgs.node, "opacity")); 
+			} : fArgs.start;
+		props.end = fArgs.end;
+
+		var anim = d.animateProperty(fArgs);
+		d.connect(anim, "beforeBegin", d.partial(_makeFadeable, fArgs.node));
+
+		return anim; // dojo._Animation
+	}
+
+	/*=====
+	dojo.__FadeArgs = function(node, duration, easing){
+		// 	node: DOMNode|String
+		//		The node referenced in the animation
+		//	duration: Integer?
+		//		Duration of the animation in milliseconds.
+		//	easing: Function?
+		//		An easing function.
+		this.node = node;
+		this.duration = duration;
+		this.easing = easing;
+	}
+	=====*/
+
+	dojo.fadeIn = function(/*dojo.__FadeArgs*/ args){
+		// summary: 
+		//		Returns an animation that will fade node defined in 'args' from
+		//		its current opacity to fully opaque.
+		return d._fade(d.mixin({ end: 1 }, args)); // dojo._Animation
+	}
+
+	dojo.fadeOut = function(/*dojo.__FadeArgs*/  args){
+		// summary: 
+		//		Returns an animation that will fade node defined in 'args'
+		//		from its current opacity to fully transparent.
+		return d._fade(d.mixin({ end: 0 }, args)); // dojo._Animation
+	}
+
+	dojo._defaultEasing = function(/*Decimal?*/ n){
+		// summary: The default easing function for dojo._Animation(s)
+		return 0.5 + ((Math.sin((n + 1.5) * Math.PI))/2);
+	}
+
+	var PropLine = function(properties){
+		// PropLine is an internal class which is used to model the values of
+		// an a group of CSS properties across an animation lifecycle. In
+		// particular, the "getValue" function handles getting interpolated
+		// values between start and end for a particular CSS value.
+		this._properties = properties;
+		for(var p in properties){
+			var prop = properties[p];
+			if(prop.start instanceof d.Color){
+				// create a reusable temp color object to keep intermediate results
+				prop.tempColor = new d.Color();
+			}
+		}
+		this.getValue = function(r){
+			var ret = {};
+			for(var p in this._properties){
+				var prop = this._properties[p];
+				var start = prop.start;
+				if(start instanceof d.Color){
+					ret[p] = d.blendColors(start, prop.end, r, prop.tempColor).toCss();
+				}else if(!d.isArray(start)){
+					ret[p] = ((prop.end - start) * r) + start + (p != "opacity" ? prop.units||"px" : "");
+				}
+			}
+			return ret;
+		}
+	}
+
+	/*=====
+	dojo.declare("dojo.__AnimArgs", [dojo.__FadeArgs], {
+		// Properties: Object?
+		//	A hash map of style properties to Objects describing the transition,
+		//	such as the properties of dojo._Line with an additional 'unit' property
+		properties: {}
+		
+		//TODOC: add event callbacks
+	});
+	=====*/
+
+	dojo.animateProperty = function(/*dojo.__AnimArgs*/ args){
+		//	summary: 
+		//		Returns an animation that will transition the properties of
+		//		node defined in 'args' depending how they are defined in
+		//		'args.properties'
+		//
+		// description:
+		//		dojo.animateProperty is the foundation of most dojo.fx
+		//		animations. It takes an object of "properties" corresponding to
+		//		style properties, and animates them in parallel over a set
+		//		duration.
+		//	
+		// 	example:
+		//		A simple animation that changes the width of the specified node.
+		//	|	dojo.animateProperty({ 
+		//	|		node: "nodeId",
+		//	|		properties: { width: 400 },
+		//	|	}).play();
+		//		Dojo figures out the start value for the width and converts the
+		//		integer specified for the width to the more expressive but
+		//		verbose form `{ width: { end: '400', units: 'px' } }` which you
+		//		can also specify directly
+		//
+		// 	example:
+		//		Animate width, height, and padding over 2 seconds... the
+		//		pedantic way:
+		//	|	dojo.animateProperty({ node: node, duration:2000,
+		//	|		properties: {
+		//	|			width: { start: '200', end: '400', unit:"px" },
+		//	|			height: { start:'200', end: '400', unit:"px" },
+		//	|			paddingTop: { start:'5', end:'50', unit:"px" } 
+		//	|		}
+		//	|	}).play();
+		//		Note 'paddingTop' is used over 'padding-top'. Multi-name CSS properties
+		//		are written using "mixed case", as the hyphen is illegal as an object key.
+		//		
+		// 	example:
+		//		Plug in a different easing function and register a callback for
+		//		when the animation ends. Easing functions accept values between
+		//		zero and one and return a value on that basis. In this case, an
+		//		exponential-in curve.
+		//	|	dojo.animateProperty({ 
+		//	|		node: "nodeId",
+		//	|		// dojo figures out the start value
+		//	|		properties: { width: { end: 400 } },
+		//	|		easing: function(n){
+		//	|			return (n==0) ? 0 : Math.pow(2, 10 * (n - 1));
+		//	|		},
+		//	|		onEnd: function(){
+		//	|			// called when the animation finishes
+		//	|		}
+		//	|	}).play(500); // delay playing half a second
+		//
+		//	example:
+		//		Like all `dojo._Animation`s, animateProperty returns a handle to the
+		//		Animation instance, which fires the events common to Dojo FX. Use `dojo.connect`
+		//		to access these events outside of the Animation definiton:
+		//	|	var anim = dojo.animateProperty({
+		//	|		node:"someId",
+		//	|		properties:{
+		//	|			width:400, height:500
+		//	|		}
+		//	|	});
+		//	|	dojo.connect(anim,"onEnd", function(){
+		//	|		
+		//	|	});
+		//	|	// play the animation now:
+		//	|	anim.play();
+		
+		args.node = d.byId(args.node);
+		if(!args.easing){ args.easing = d._defaultEasing; }
+
+		var anim = new d._Animation(args);
+		d.connect(anim, "beforeBegin", anim, function(){
+			var pm = {};
+			for(var p in this.properties){
+				// Make shallow copy of properties into pm because we overwrite
+				// some values below. In particular if start/end are functions
+				// we don't want to overwrite them or the functions won't be
+				// called if the animation is reused.
+				if(p == "width" || p == "height"){
+					this.node.display = "block";
+				}
+				var prop = this.properties[p];
+				prop = pm[p] = d.mixin({}, (d.isObject(prop) ? prop: { end: prop }));
+
+				if(d.isFunction(prop.start)){
+					prop.start = prop.start();
+				}
+				if(d.isFunction(prop.end)){
+					prop.end = prop.end();
+				}
+				var isColor = (p.toLowerCase().indexOf("color") >= 0);
+				function getStyle(node, p){
+					// dojo.style(node, "height") can return "auto" or "" on IE; this is more reliable:
+					var v = ({height: node.offsetHeight, width: node.offsetWidth})[p];
+					if(v !== undefined){ return v; }
+					v = d.style(node, p);
+					return (p=="opacity") ? Number(v) : (isColor ? v : parseFloat(v));
+				}
+				if(!("end" in prop)){
+					prop.end = getStyle(this.node, p);
+				}else if(!("start" in prop)){
+					prop.start = getStyle(this.node, p);
+				}
+
+				if(isColor){
+					prop.start = new d.Color(prop.start);
+					prop.end = new d.Color(prop.end);
+				}else{
+					prop.start = (p == "opacity") ? Number(prop.start) : parseFloat(prop.start);
+				}
+			}
+			this.curve = new PropLine(pm);
+		});
+		d.connect(anim, "onAnimate", d.hitch(d, "style", anim.node));
+		return anim; // dojo._Animation
+	}
+
+	dojo.anim = function(	/*DOMNode|String*/ 	node, 
+							/*Object*/ 			properties, 
+							/*Integer?*/		duration, 
+							/*Function?*/		easing, 
+							/*Function?*/		onEnd,
+							/*Integer?*/		delay){
+		//	summary:
+		//		A simpler interface to `dojo.animateProperty()`, also returns
+		//		an instance of `dojo._Animation` but begins the animation
+		//		immediately, unlike nearly every other Dojo animation API.
+		//	description:
+		//		`dojo.anim` is a simpler (but somewhat less powerful) version
+		//		of `dojo.animateProperty`.  It uses defaults for many basic properties
+		//		and allows for positional parameters to be used in place of the
+		//		packed "property bag" which is used for other Dojo animation
+		//		methods.
+		//
+		//		The `dojo._Animation` object returned from `dojo.anim` will be
+		//		already playing when it is returned from this function, so
+		//		calling play() on it again is (usually) a no-op.
+		//	node:
+		//		a DOM node or the id of a node to animate CSS properties on
+		//	duration:
+		//		The number of milliseconds over which the animation
+		//		should run. Defaults to the global animation default duration
+		//		(350ms).
+		//	easing:
+		//		An easing function over which to calculate acceleration
+		//		and deceleration of the animation through its duration.
+		//		A default easing algorithm is provided, but you may
+		//		plug in any you wish. A large selection of easing algorithms
+		//		are available in `dojo.fx.easing`.
+		//	onEnd:
+		//		A function to be called when the animation finishes
+		//		running.
+		//	delay:
+		//		The number of milliseconds to delay beginning the
+		//		animation by. The default is 0.
+		//	example:
+		//		Fade out a node
+		//	|	dojo.anim("id", { opacity: 0 });
+		//	example:
+		//		Fade out a node over a full second
+		//	|	dojo.anim("id", { opacity: 0 }, 1000);
+		return d.animateProperty({ 
+			node: node,
+			duration: duration||d._Animation.prototype.duration,
+			properties: properties,
+			easing: easing,
+			onEnd: onEnd 
+		}).play(delay||0);
+	}
+})();
+
+}
+
+if(!dojo._hasResource["dojo._base.browser"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo._base.browser"] = true;
+dojo.provide("dojo._base.browser");
+
+
+
+
+
+
+
+
+
+//Need this to be the last code segment in base, so do not place any
+//dojo.requireIf calls in this file. Otherwise, due to how the build system
+//puts all requireIf dependencies after the current file, the require calls
+//could be called before all of base is defined.
+if(dojo.config.require){
+	dojo.forEach(dojo.config.require, "dojo['require'](item);");
+}
+
+}
+
+	//INSERT dojo.i18n._preloadLocalizations HERE
+
+	if(dojo.config.afterOnLoad && dojo.isBrowser){
+		//Dojo is being added to the page after page load, so just trigger
+		//the init sequence after a timeout. Using a timeout so the rest of this
+		//script gets evaluated properly. This work needs to happen after the
+		//dojo.config.require work done in dojo._base.
+		window.setTimeout(dojo._fakeLoadInit, 1000);
+	}
+
+})();
+
diff --git a/lib/ext-base.js b/lib/ext-base.js
new file mode 100644
index 0000000..b68f63d
--- /dev/null
+++ b/lib/ext-base.js
@@ -0,0 +1,10 @@
+/*

+ * Ext JS Library 2.2

+ * Copyright(c) 2006-2008, Ext JS, LLC.

+ * licensing@extjs.com

+ * 

+ * http://extjs.com/license

+ */

+

+Ext={version:"2.2"};window["undefined"]=window["undefined"];Ext.apply=function(C,D,B){if(B){Ext.apply(C,B)}if(C&&D&&typeof D=="object"){for(var A in D){C[A]=D[A]}}return C};(function(){var idSeed=0;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isSafari=(/webkit|khtml/).test(ua),isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=!isOpera&&ua.indexOf("msie")>-1,isIE7=!isOpera&&ua.indexOf("msie 7")>-1,isGecko=!isSafari&&ua.indexOf("gecko")>-1,isGecko3=!isSafari&&ua.indexOf("rv:1.9")>-1,isBorderBox=isIE&&!isStrict,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isAir=(ua.indexOf("adobeair")!=-1),isLinux=(ua.indexOf("linux")!=-1),isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIE&&!isIE7){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}Ext.apply(Ext,{isStrict:isStrict,isSecure:isSecure,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p]}}}return o},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o)});return }var cache={};for(var b in o){var parts=b.split("@");if(parts[1]){var s=parts[0];if(!cache[s]){cache[s]=Ext.select(s)}cache[s].on(parts[1],o[b])}}cache=null},id:function(el,prefix){prefix=prefix||"ext-gen";el=Ext.getDom(el);var id=prefix+(++idSeed);return el?(el.id?el.id:(el.id=id)):id},extend:function(){var io=function(o){for(var m in o){this[m]=o[m]}};var oc=Object.prototype.constructor;return function(sb,sp,overrides){if(typeof sp=="object"){overrides=sp;sp=sb;sb=overrides.constructor!=oc?overrides.constructor:function(){sp.apply(this,arguments)}}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==oc){spp.constructor=sp}sb.override=function(o){Ext.override(sb,o)};sbp.override=io;Ext.override(sb,overrides);sb.extend=function(o){Ext.extend(sb,o)};return sb}}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method]}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+" == \"undefined\"){"+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]]}}},urlEncode:function(o){if(!o){return""}var buf=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=="undefined"){buf.push(k,"=&")}else{if(type!="function"&&type!="object"){buf.push(k,"=",encodeURIComponent(ov),"&")}else{if(Ext.isArray(ov)){if(ov.length){for(var i=0,len=ov.length;i<len;i++){buf.push(k,"=",encodeURIComponent(ov[i]===undefined?"":ov[i]),"&")}}else{buf.push(k,"=&")}}}}}buf.pop();return buf.join("")},urlDecode:function(string,overwrite){if(!string||!string.length){return{}}var obj={};var pairs=string.split("&");var pair,name,value;for(var i=0,len=pairs.length;i<len;i++){pair=pairs[i].split("=");name=decodeURIComponent(pair[0]);value=decodeURIComponent(pair[1]);if(overwrite!==true){if(typeof obj[name]=="undefined"){obj[name]=value}else{if(typeof obj[name]=="string"){obj[name]=[obj[name]];obj[name].push(value)}else{obj[name].push(value)}}}else{obj[name]=value}}return obj},each:function(array,fn,scope){if(typeof array.length=="undefined"||typeof array=="string"){array=[array]}for(var i=0,len=array.length;i<len;i++){if(fn.call(scope||array[i],array[i],i,array)===false){return i}}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(Ext.isArray(a)){r=r.concat(a)}else{if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0))}else{r.push(a)}}}return r},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},callback:function(cb,scope,args,delay){if(typeof cb=="function"){if(delay){cb.defer(delay,scope,args||[])}else{cb.apply(scope,args||[])}}},getDom:function(el){if(!el||!document){return null}return el.dom?el.dom:(typeof el=="string"?document.getElementById(el):el)},getDoc:function(){return Ext.get(document)},getBody:function(){return Ext.get(document.body||document.documentElement)},getCmp:function(id){return Ext.ComponentMgr.get(id)},num:function(v,defaultValue){if(typeof v!="number"){return defaultValue}return v},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;i++){var as=a[i];if(as){if(typeof as.destroy=="function"){as.destroy()}else{if(as.dom){as.removeAllListeners();as.remove()}}}}},removeNode:isIE?function(){var d;return function(n){if(n&&n.tagName!="BODY"){d=d||document.createElement("div");d.appendChild(n);d.innerHTML=""}}}():function(n){if(n&&n.parentNode&&n.tagName!="BODY"){n.parentNode.removeChild(n)}},type:function(o){if(o===undefined||o===null){return false}if(o.htmlElement){return"element"}var t=typeof o;if(t=="object"&&o.nodeName){switch(o.nodeType){case 1:return"element";case 3:return(/\S/).test(o.nodeValue)?"textnode":"whitespace"}}if(t=="object"||t=="function"){switch(o.constructor){case Array:return"array";case RegExp:return"regexp"}if(typeof o.length=="number"&&typeof o.item=="function"){return"nodelist"}}return t},isEmpty:function(v,allowBlank){return v===null||v===undefined||(!allowBlank?v==="":false)},value:function(v,defaultValue,allowBlank){return Ext.isEmpty(v,allowBlank)?defaultValue:v},isArray:function(v){return v&&typeof v.length=="number"&&typeof v.splice=="function"},isDate:function(v){return v&&typeof v.getFullYear=="function"},isOpera:isOpera,isSafari:isSafari,isSafari3:isSafari3,isSafari2:isSafari&&!isSafari3,isIE:isIE,isIE6:isIE&&!isIE7,isIE7:isIE7,isGecko:isGecko,isGecko2:isGecko&&!isGecko3,isGecko3:isGecko3,isBorderBox:isBorderBox,isLinux:isLinux,isWindows:isWindows,isMac:isMac,isAir:isAir,useShims:((isIE&&!isIE7)||(isMac&&isGecko&&!isGecko3))});Ext.ns=Ext.namespace})();Ext.ns("Ext","Ext.util","Ext.grid","Ext.dd","Ext.tree","Ext.data","Ext.form","Ext.menu","Ext.state","Ext.lib","Ext.layout","Ext.app","Ext.ux");Ext.apply(Function.prototype,{createCallback:function(){var A=arguments;var B=this;return function(){return B.apply(window,A)}},createDelegate:function(C,B,A){var D=this;return function(){var F=B||arguments;if(A===true){F=Array.prototype.slice.call(arguments,0);F=F.concat(B)}else{if(typeof A=="number"){F=Array.prototype.slice.call(arguments,0);var E=[A,0].concat(B);Array.prototype.splice.apply(F,E)}}return D.apply(C||window,F)}},defer:function(C,E,B,A){var D=this.createDelegate(E,B,A);if(C){return setTimeout(D,C)}D();return 0},createSequence:function(B,A){if(typeof B!="function"){return this}var C=this;return function(){var D=C.apply(this||window,arguments);B.apply(A||this||window,arguments);return D}},createInterceptor:function(B,A){if(typeof B!="function"){return this}var C=this;return function(){B.target=this;B.method=C;if(B.apply(A||this||window,arguments)===false){return }return C.apply(this||window,arguments)}}});Ext.applyIf(String,{escape:function(A){return A.replace(/('|\\)/g,"\\$1")},leftPad:function(D,B,C){var A=new String(D);if(!C){C=" "}while(A.length<B){A=C+A}return A.toString()},format:function(B){var A=Array.prototype.slice.call(arguments,1);return B.replace(/\{(\d+)\}/g,function(C,D){return A[D]})}});String.prototype.toggle=function(B,A){return this==B?A:B};String.prototype.trim=function(){var A=/^\s+|\s+$/g;return function(){return this.replace(A,"")}}();Ext.applyIf(Number.prototype,{constrain:function(B,A){return Math.min(Math.max(this,B),A)}});Ext.applyIf(Array.prototype,{indexOf:function(C){for(var B=0,A=this.length;B<A;B++){if(this[B]==C){return B}}return -1},remove:function(B){var A=this.indexOf(B);if(A!=-1){this.splice(A,1)}return this}});Date.prototype.getElapsed=function(A){return Math.abs((A||new Date()).getTime()-this.getTime())};
+(function(){var B;Ext.lib.Dom={getViewWidth:function(E){return E?this.getDocumentWidth():this.getViewportWidth()},getViewHeight:function(E){return E?this.getDocumentHeight():this.getViewportHeight()},getDocumentHeight:function(){var E=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(E,this.getViewportHeight())},getDocumentWidth:function(){var E=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(E,this.getViewportWidth())},getViewportHeight:function(){if(Ext.isIE){return Ext.isStrict?document.documentElement.clientHeight:document.body.clientHeight}else{return self.innerHeight}},getViewportWidth:function(){if(Ext.isIE){return Ext.isStrict?document.documentElement.clientWidth:document.body.clientWidth}else{return self.innerWidth}},isAncestor:function(F,G){F=Ext.getDom(F);G=Ext.getDom(G);if(!F||!G){return false}if(F.contains&&!Ext.isSafari){return F.contains(G)}else{if(F.compareDocumentPosition){return !!(F.compareDocumentPosition(G)&16)}else{var E=G.parentNode;while(E){if(E==F){return true}else{if(!E.tagName||E.tagName.toUpperCase()=="HTML"){return false}}E=E.parentNode}return false}}},getRegion:function(E){return Ext.lib.Region.getRegion(E)},getY:function(E){return this.getXY(E)[1]},getX:function(E){return this.getXY(E)[0]},getXY:function(G){var F,K,M,N,J=(document.body||document.documentElement);G=Ext.getDom(G);if(G==J){return[0,0]}if(G.getBoundingClientRect){M=G.getBoundingClientRect();N=C(document).getScroll();return[M.left+N.left,M.top+N.top]}var O=0,L=0;F=G;var E=C(G).getStyle("position")=="absolute";while(F){O+=F.offsetLeft;L+=F.offsetTop;if(!E&&C(F).getStyle("position")=="absolute"){E=true}if(Ext.isGecko){K=C(F);var P=parseInt(K.getStyle("borderTopWidth"),10)||0;var H=parseInt(K.getStyle("borderLeftWidth"),10)||0;O+=H;L+=P;if(F!=G&&K.getStyle("overflow")!="visible"){O+=H;L+=P}}F=F.offsetParent}if(Ext.isSafari&&E){O-=J.offsetLeft;L-=J.offsetTop}if(Ext.isGecko&&!E){var I=C(J);O+=parseInt(I.getStyle("borderLeftWidth"),10)||0;L+=parseInt(I.getStyle("borderTopWidth"),10)||0}F=G.parentNode;while(F&&F!=J){if(!Ext.isOpera||(F.tagName!="TR"&&C(F).getStyle("display")!="inline")){O-=F.scrollLeft;L-=F.scrollTop}F=F.parentNode}return[O,L]},setXY:function(E,F){E=Ext.fly(E,"_setXY");E.position();var G=E.translatePoints(F);if(F[0]!==false){E.dom.style.left=G.left+"px"}if(F[1]!==false){E.dom.style.top=G.top+"px"}},setX:function(F,E){this.setXY(F,[E,false])},setY:function(E,F){this.setXY(E,[false,F])}};Ext.lib.Event=function(){var F=false;var G=[];var K=[];var I=0;var H=[];var E=0;var J=null;return{POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,_interval:null,startInterval:function(){if(!this._interval){var L=this;var M=function(){L._tryPreloadAttach()};this._interval=setInterval(M,this.POLL_INTERVAL)}},onAvailable:function(N,L,O,M){H.push({id:N,fn:L,obj:O,override:M,checkReady:false});I=this.POLL_RETRYS;this.startInterval()},addListener:function(Q,M,P){Q=Ext.getDom(Q);if(!Q||!P){return false}if("unload"==M){K[K.length]=[Q,M,P];return true}var O=function(R){return typeof Ext!="undefined"?P(Ext.lib.Event.getEvent(R)):false};var L=[Q,M,P,O];var N=G.length;G[N]=L;this.doAdd(Q,M,O,false);return true},removeListener:function(S,O,R){var Q,N;S=Ext.getDom(S);if(!R){return this.purgeElement(S,false,O)}if("unload"==O){for(Q=0,N=K.length;Q<N;Q++){var M=K[Q];if(M&&M[0]==S&&M[1]==O&&M[2]==R){K.splice(Q,1);return true}}return false}var L=null;var P=arguments[3];if("undefined"==typeof P){P=this._getCacheIndex(S,O,R)}if(P>=0){L=G[P]}if(!S||!L){return false}this.doRemove(S,O,L[this.WFN],false);delete G[P][this.WFN];delete G[P][this.FN];G.splice(P,1);return true},getTarget:function(N,M){N=N.browserEvent||N;var L=N.target||N.srcElement;return this.resolveTextNode(L)},resolveTextNode:function(L){if(Ext.isSafari&&L&&3==L.nodeType){return L.parentNode}else{return L}},getPageX:function(M){M=M.browserEvent||M;var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(Ext.isIE){L+=this.getScroll()[1]}}return L},getPageY:function(L){L=L.browserEvent||L;var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(Ext.isIE){M+=this.getScroll()[0]}}return M},getXY:function(L){L=L.browserEvent||L;return[this.getPageX(L),this.getPageY(L)]},getRelatedTarget:function(M){M=M.browserEvent||M;var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement}else{if(M.type=="mouseover"){L=M.fromElement}}}return this.resolveTextNode(L)},getTime:function(N){N=N.browserEvent||N;if(!N.time){var M=new Date().getTime();try{N.time=M}catch(L){this.lastError=L;return M}}return N.time},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L)},stopPropagation:function(L){L=L.browserEvent||L;if(L.stopPropagation){L.stopPropagation()}else{L.cancelBubble=true}},preventDefault:function(L){L=L.browserEvent||L;if(L.preventDefault){L.preventDefault()}else{L.returnValue=false}},getEvent:function(M){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break}N=N.caller}}return L},getCharCode:function(L){L=L.browserEvent||L;return L.charCode||L.keyCode||0},_getCacheIndex:function(Q,N,P){for(var O=0,M=G.length;O<M;++O){var L=G[O];if(L&&L[this.FN]==P&&L[this.EL]==Q&&L[this.TYPE]==N){return O}}return -1},elCache:{},getEl:function(L){return document.getElementById(L)},clearCache:function(){},_load:function(M){F=true;var L=Ext.lib.Event;if(Ext.isIE){L.doRemove(window,"load",L._load)}},_tryPreloadAttach:function(){if(this.locked){return false}this.locked=true;var R=!F;if(!R){R=(I>0)}var Q=[];for(var M=0,L=H.length;M<L;++M){var P=H[M];if(P){var O=this.getEl(P.id);if(O){if(!P.checkReady||F||O.nextSibling||(document&&document.body)){var N=O;if(P.override){if(P.override===true){N=P.obj}else{N=P.override}}P.fn.call(N,P.obj);H[M]=null}}else{Q.push(P)}}}I=(Q.length===0)?0:I-1;if(R){this.startInterval()}else{clearInterval(this._interval);this._interval=null}this.locked=false;return true},purgeElement:function(P,Q,N){var R=this.getListeners(P,N);if(R){for(var O=0,L=R.length;O<L;++O){var M=R[O];this.removeListener(P,M.type,M.fn)}}if(Q&&P&&P.childNodes){for(O=0,L=P.childNodes.length;O<L;++O){this.purgeElement(P.childNodes[O],Q,N)}}},getListeners:function(M,R){var P=[],L;if(!R){L=[G,K]}else{if(R=="unload"){L=[K]}else{L=[G]}}for(var O=0;O<L.length;++O){var T=L[O];if(T&&T.length>0){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===M&&(!R||R===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.ADJ_SCOPE],index:Q})}}}}return(P.length)?P:null},_unload:function(S){var R=Ext.lib.Event,P,O,M,L,N;for(P=0,L=K.length;P<L;++P){M=K[P];if(M){var Q=window;if(M[R.ADJ_SCOPE]){if(M[R.ADJ_SCOPE]===true){Q=M[R.OBJ]}else{Q=M[R.ADJ_SCOPE]}}M[R.FN].call(Q,R.getEvent(S),M[R.OBJ]);K[P]=null;M=null;Q=null}}K=null;if(G&&G.length>0){O=G.length;while(O){N=O-1;M=G[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N)}O=O-1}M=null;R.clearCache()}R.doRemove(window,"unload",R._unload)},getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft]}else{if(M){return[M.scrollTop,M.scrollLeft]}else{return[0,0]}}},doAdd:function(){if(window.addEventListener){return function(O,M,N,L){O.addEventListener(M,N,(L))}}else{if(window.attachEvent){return function(O,M,N,L){O.attachEvent("on"+M,N)}}else{return function(){}}}}(),doRemove:function(){if(window.removeEventListener){return function(O,M,N,L){O.removeEventListener(M,N,(L))}}else{if(window.detachEvent){return function(N,L,M){N.detachEvent("on"+L,M)}}else{return function(){}}}}()}}();var D=Ext.lib.Event;D.on=D.addListener;D.un=D.removeListener;if(document&&document.body){D._load()}else{D.doAdd(window,"load",D._load)}D.doAdd(window,"unload",D._unload);D._tryPreloadAttach();Ext.lib.Ajax={request:function(K,I,E,J,F){if(F){var G=F.headers;if(G){for(var H in G){if(G.hasOwnProperty(H)){this.initHeader(H,G[H],false)}}}if(F.xmlData){if(!G||!G["Content-Type"]){this.initHeader("Content-Type","text/xml",false)}K=(K?K:(F.method?F.method:"POST"));J=F.xmlData}else{if(F.jsonData){if(!G||!G["Content-Type"]){this.initHeader("Content-Type","application/json",false)}K=(K?K:(F.method?F.method:"POST"));J=typeof F.jsonData=="object"?Ext.encode(F.jsonData):F.jsonData}}}return this.asyncRequest(K,I,E,J)},serializeForm:function(F){if(typeof F=="string"){F=(document.getElementById(F)||document.forms[F])}var G,E,H,J,K="",M=false;for(var L=0;L<F.elements.length;L++){G=F.elements[L];J=F.elements[L].disabled;E=F.elements[L].name;H=F.elements[L].value;if(!J&&E){switch(G.type){case"select-one":case"select-multiple":for(var I=0;I<G.options.length;I++){if(G.options[I].selected){if(Ext.isIE){K+=encodeURIComponent(E)+"="+encodeURIComponent(G.options[I].attributes["value"].specified?G.options[I].value:G.options[I].text)+"&"}else{K+=encodeURIComponent(E)+"="+encodeURIComponent(G.options[I].hasAttribute("value")?G.options[I].value:G.options[I].text)+"&"}}}break;case"radio":case"checkbox":if(G.checked){K+=encodeURIComponent(E)+"="+encodeURIComponent(H)+"&"}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(M==false){K+=encodeURIComponent(E)+"="+encodeURIComponent(H)+"&";M=true}break;default:K+=encodeURIComponent(E)+"="+encodeURIComponent(H)+"&";break}}}K=K.substr(0,K.length-1);return K},headers:{},hasHeaders:false,useDefaultHeader:true,defaultPostHeader:"application/x-www-form-urlencoded; charset=UTF-8",useDefaultXhrHeader:true,defaultXhrHeader:"XMLHttpRequest",hasDefaultHeaders:true,defaultHeaders:{},poll:{},timeout:{},pollInterval:50,transactionId:0,setProgId:function(E){this.activeX.unshift(E)},setDefaultPostHeader:function(E){this.useDefaultHeader=E},setDefaultXhrHeader:function(E){this.useDefaultXhrHeader=E},setPollingInterval:function(E){if(typeof E=="number"&&isFinite(E)){this.pollInterval=E}},createXhrObject:function(I){var H,E;try{E=new XMLHttpRequest();H={conn:E,tId:I}}catch(G){for(var F=0;F<this.activeX.length;++F){try{E=new ActiveXObject(this.activeX[F]);H={conn:E,tId:I};break}catch(G){}}}finally{return H}},getConnectionObject:function(){var F;var G=this.transactionId;try{F=this.createXhrObject(G);if(F){this.transactionId++}}catch(E){}finally{return F}},asyncRequest:function(I,F,H,E){var G=this.getConnectionObject();if(!G){return null}else{G.conn.open(I,F,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders["X-Requested-With"]){this.initHeader("X-Requested-With",this.defaultXhrHeader,true)}}if(E&&this.useDefaultHeader&&(!this.hasHeaders||!this.headers["Content-Type"])){this.initHeader("Content-Type",this.defaultPostHeader)}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(G)}this.handleReadyState(G,H);G.conn.send(E||null);return G}},handleReadyState:function(F,G){var E=this;if(G&&G.timeout){this.timeout[F.tId]=window.setTimeout(function(){E.abort(F,G,true)},G.timeout)}this.poll[F.tId]=window.setInterval(function(){if(F.conn&&F.conn.readyState==4){window.clearInterval(E.poll[F.tId]);delete E.poll[F.tId];if(G&&G.timeout){window.clearTimeout(E.timeout[F.tId]);delete E.timeout[F.tId]}E.handleTransactionResponse(F,G)}},this.pollInterval)},handleTransactionResponse:function(I,J,E){if(!J){this.releaseObject(I);return }var G,F;try{if(I.conn.status!==undefined&&I.conn.status!=0){G=I.conn.status}else{G=13030}}catch(H){G=13030}if(G>=200&&G<300){F=this.createResponseObject(I,J.argument);if(J.success){if(!J.scope){J.success(F)}else{J.success.apply(J.scope,[F])}}}else{switch(G){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:F=this.createExceptionObject(I.tId,J.argument,(E?E:false));if(J.failure){if(!J.scope){J.failure(F)}else{J.failure.apply(J.scope,[F])}}break;default:F=this.createResponseObject(I,J.argument);if(J.failure){if(!J.scope){J.failure(F)}else{J.failure.apply(J.scope,[F])}}}}this.releaseObject(I);F=null},createResponseObject:function(E,K){var H={};var M={};try{var G=E.conn.getAllResponseHeaders();var J=G.split("\n");for(var I=0;I<J.length;I++){var F=J[I].indexOf(":");if(F!=-1){M[J[I].substring(0,F)]=J[I].substring(F+2)}}}catch(L){}H.tId=E.tId;H.status=E.conn.status;H.statusText=E.conn.statusText;H.getResponseHeader=M;H.getAllResponseHeaders=G;H.responseText=E.conn.responseText;H.responseXML=E.conn.responseXML;if(typeof K!==undefined){H.argument=K}return H},createExceptionObject:function(L,H,E){var J=0;var K="communication failure";var G=-1;var F="transaction aborted";var I={};I.tId=L;if(E){I.status=G;I.statusText=F}else{I.status=J;I.statusText=K}if(H){I.argument=H}return I},initHeader:function(E,H,G){var F=(G)?this.defaultHeaders:this.headers;if(F[E]===undefined){F[E]=H}else{F[E]=H+","+F[E]}if(G){this.hasDefaultHeaders=true}else{this.hasHeaders=true}},setHeader:function(E){if(this.hasDefaultHeaders){for(var F in this.defaultHeaders){if(this.defaultHeaders.hasOwnProperty(F)){E.conn.setRequestHeader(F,this.defaultHeaders[F])}}}if(this.hasHeaders){for(var F in this.headers){if(this.headers.hasOwnProperty(F)){E.conn.setRequestHeader(F,this.headers[F])}}this.headers={};this.hasHeaders=false}},resetDefaultHeaders:function(){delete this.defaultHeaders;this.defaultHeaders={};this.hasDefaultHeaders=false},abort:function(F,G,E){if(this.isCallInProgress(F)){F.conn.abort();window.clearInterval(this.poll[F.tId]);delete this.poll[F.tId];if(E){delete this.timeout[F.tId]}this.handleTransactionResponse(F,G,true);return true}else{return false}},isCallInProgress:function(E){if(E.conn){return E.conn.readyState!=4&&E.conn.readyState!=0}else{return false}},releaseObject:function(E){E.conn=null;E=null},activeX:["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]};Ext.lib.Region=function(G,H,E,F){this.top=G;this[1]=G;this.right=H;this.bottom=E;this.left=F;this[0]=F};Ext.lib.Region.prototype={contains:function(E){return(E.left>=this.left&&E.right<=this.right&&E.top>=this.top&&E.bottom<=this.bottom)},getArea:function(){return((this.bottom-this.top)*(this.right-this.left))},intersect:function(I){var G=Math.max(this.top,I.top);var H=Math.min(this.right,I.right);var E=Math.min(this.bottom,I.bottom);var F=Math.max(this.left,I.left);if(E>=G&&H>=F){return new Ext.lib.Region(G,H,E,F)}else{return null}},union:function(I){var G=Math.min(this.top,I.top);var H=Math.max(this.right,I.right);var E=Math.max(this.bottom,I.bottom);var F=Math.min(this.left,I.left);return new Ext.lib.Region(G,H,E,F)},constrainTo:function(E){this.top=this.top.constrain(E.top,E.bottom);this.bottom=this.bottom.constrain(E.top,E.bottom);this.left=this.left.constrain(E.left,E.right);this.right=this.right.constrain(E.left,E.right);return this},adjust:function(G,F,E,H){this.top+=G;this.left+=F;this.right+=H;this.bottom+=E;return this}};Ext.lib.Region.getRegion=function(H){var J=Ext.lib.Dom.getXY(H);var G=J[1];var I=J[0]+H.offsetWidth;var E=J[1]+H.offsetHeight;var F=J[0];return new Ext.lib.Region(G,I,E,F)};Ext.lib.Point=function(E,F){if(Ext.isArray(E)){F=E[1];E=E[0]}this.x=this.right=this.left=this[0]=E;this.y=this.top=this.bottom=this[1]=F};Ext.lib.Point.prototype=new Ext.lib.Region();Ext.lib.Anim={scroll:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.Scroll)},motion:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.Motion)},color:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.ColorAnim)},run:function(I,F,K,L,E,H,G){G=G||Ext.lib.AnimBase;if(typeof L=="string"){L=Ext.lib.Easing[L]}var J=new G(I,F,K,L);J.animateX(function(){Ext.callback(E,H)});return J}};function C(E){if(!B){B=new Ext.Element.Flyweight()}B.dom=E;return B}if(Ext.isIE){function A(){var E=Function.prototype;delete E.createSequence;delete E.defer;delete E.createDelegate;delete E.createCallback;delete E.createInterceptor;window.detachEvent("onunload",A)}window.attachEvent("onunload",A)}Ext.lib.AnimBase=function(F,E,G,H){if(F){this.init(F,E,G,H)}};Ext.lib.AnimBase.prototype={toString:function(){var E=this.getEl();var F=E.id||E.tagName;return("Anim "+F)},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(E,G,F){return this.method(this.currentFrame,G,F-G,this.totalFrames)},setAttribute:function(E,G,F){if(this.patterns.noNegatives.test(E)){G=(G>0)?G:0}Ext.fly(this.getEl(),"_anim").setStyle(E,G+F)},getAttribute:function(E){var G=this.getEl();var I=C(G).getStyle(E);if(I!=="auto"&&!this.patterns.offsetUnit.test(I)){return parseFloat(I)}var F=this.patterns.offsetAttribute.exec(E)||[];var J=!!(F[3]);var H=!!(F[2]);if(H||(C(G).getStyle("position")=="absolute"&&J)){I=G["offset"+F[0].charAt(0).toUpperCase()+F[0].substr(1)]}else{I=0}return I},getDefaultUnit:function(E){if(this.patterns.defaultUnit.test(E)){return"px"}return""},animateX:function(G,E){var F=function(){this.onComplete.removeListener(F);if(typeof G=="function"){G.call(E||this,this)}};this.onComplete.addListener(F,this);this.animate()},setRuntimeAttribute:function(F){var K;var G;var H=this.attributes;this.runtimeAttributes[F]={};var J=function(L){return(typeof L!=="undefined")};if(!J(H[F]["to"])&&!J(H[F]["by"])){return false}K=(J(H[F]["from"]))?H[F]["from"]:this.getAttribute(F);if(J(H[F]["to"])){G=H[F]["to"]}else{if(J(H[F]["by"])){if(K.constructor==Array){G=[];for(var I=0,E=K.length;I<E;++I){G[I]=K[I]+H[F]["by"][I]}}else{G=K+H[F]["by"]}}}this.runtimeAttributes[F].start=K;this.runtimeAttributes[F].end=G;this.runtimeAttributes[F].unit=(J(H[F].unit))?H[F]["unit"]:this.getDefaultUnit(F)},init:function(G,L,K,E){var F=false;var H=null;var J=0;G=Ext.getDom(G);this.attributes=L||{};this.duration=K||1;this.method=E||Ext.lib.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=Ext.lib.AnimMgr.fps;this.getEl=function(){return G};this.isAnimated=function(){return F};this.getStartTime=function(){return H};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(Ext.lib.AnimMgr.fps*this.duration):this.duration;Ext.lib.AnimMgr.registerElement(this)};this.stop=function(O){if(O){this.currentFrame=this.totalFrames;this._onTween.fire()}Ext.lib.AnimMgr.stop(this)};var N=function(){this.onStart.fire();this.runtimeAttributes={};for(var O in this.attributes){this.setRuntimeAttribute(O)}F=true;J=0;H=new Date()};var M=function(){var Q={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};Q.toString=function(){return("duration: "+Q.duration+", currentFrame: "+Q.currentFrame)};this.onTween.fire(Q);var P=this.runtimeAttributes;for(var O in P){this.setAttribute(O,this.doMethod(O,P[O].start,P[O].end),P[O].unit)}J+=1};var I=function(){var O=(new Date()-H)/1000;var P={duration:O,frames:J,fps:J/O};P.toString=function(){return("duration: "+P.duration+", frames: "+P.frames+", fps: "+P.fps)};F=false;J=0;this.onComplete.fire(P)};this._onStart=new Ext.util.Event(this);this.onStart=new Ext.util.Event(this);this.onTween=new Ext.util.Event(this);this._onTween=new Ext.util.Event(this);this.onComplete=new Ext.util.Event(this);this._onComplete=new Ext.util.Event(this);this._onStart.addListener(N);this._onTween.addListener(M);this._onComplete.addListener(I)}};Ext.lib.AnimMgr=new function(){var G=null;var F=[];var E=0;this.fps=1000;this.delay=1;this.registerElement=function(J){F[F.length]=J;E+=1;J._onStart.fire();this.start()};this.unRegister=function(K,J){K._onComplete.fire();J=J||I(K);if(J!=-1){F.splice(J,1)}E-=1;if(E<=0){this.stop()}};this.start=function(){if(G===null){G=setInterval(this.run,this.delay)}};this.stop=function(L){if(!L){clearInterval(G);for(var K=0,J=F.length;K<J;++K){if(F[0].isAnimated()){this.unRegister(F[0],0)}}F=[];G=null;E=0}else{this.unRegister(L)}};this.run=function(){for(var L=0,J=F.length;L<J;++L){var K=F[L];if(!K||!K.isAnimated()){continue}if(K.currentFrame<K.totalFrames||K.totalFrames===null){K.currentFrame+=1;if(K.useSeconds){H(K)}K._onTween.fire()}else{Ext.lib.AnimMgr.stop(K,L)}}};var I=function(L){for(var K=0,J=F.length;K<J;++K){if(F[K]==L){return K}}return -1};var H=function(K){var N=K.totalFrames;var M=K.currentFrame;var L=(K.currentFrame*K.duration*1000/K.totalFrames);var J=(new Date()-K.getStartTime());var O=0;if(J<K.duration*1000){O=Math.round((J/L-1)*K.currentFrame)}else{O=N-(M+1)}if(O>0&&isFinite(O)){if(K.currentFrame+O>=N){O=N-(M+1)}K.currentFrame+=O}}};Ext.lib.Bezier=new function(){this.getPosition=function(I,H){var J=I.length;var G=[];for(var F=0;F<J;++F){G[F]=[I[F][0],I[F][1]]}for(var E=1;E<J;++E){for(F=0;F<J-E;++F){G[F][0]=(1-H)*G[F][0]+H*G[parseInt(F+1,10)][0];G[F][1]=(1-H)*G[F][1]+H*G[parseInt(F+1,10)][1]}}return[G[0][0],G[0][1]]}};(function(){Ext.lib.ColorAnim=function(I,H,J,K){Ext.lib.ColorAnim.superclass.constructor.call(this,I,H,J,K)};Ext.extend(Ext.lib.ColorAnim,Ext.lib.AnimBase);var F=Ext.lib;var G=F.ColorAnim.superclass;var E=F.ColorAnim.prototype;E.toString=function(){var H=this.getEl();var I=H.id||H.tagName;return("ColorAnim "+I)};E.patterns.color=/color$/i;E.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;E.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;E.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;E.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;E.parseColor=function(H){if(H.length==3){return H}var I=this.patterns.hex.exec(H);if(I&&I.length==4){return[parseInt(I[1],16),parseInt(I[2],16),parseInt(I[3],16)]}I=this.patterns.rgb.exec(H);if(I&&I.length==4){return[parseInt(I[1],10),parseInt(I[2],10),parseInt(I[3],10)]}I=this.patterns.hex3.exec(H);if(I&&I.length==4){return[parseInt(I[1]+I[1],16),parseInt(I[2]+I[2],16),parseInt(I[3]+I[3],16)]}return null};E.getAttribute=function(H){var J=this.getEl();if(this.patterns.color.test(H)){var K=C(J).getStyle(H);if(this.patterns.transparent.test(K)){var I=J.parentNode;K=C(I).getStyle(H);while(I&&this.patterns.transparent.test(K)){I=I.parentNode;K=C(I).getStyle(H);if(I.tagName.toUpperCase()=="HTML"){K="#fff"}}}}else{K=G.getAttribute.call(this,H)}return K};E.doMethod=function(I,M,J){var L;if(this.patterns.color.test(I)){L=[];for(var K=0,H=M.length;K<H;++K){L[K]=G.doMethod.call(this,I,M[K],J[K])}L="rgb("+Math.floor(L[0])+","+Math.floor(L[1])+","+Math.floor(L[2])+")"}else{L=G.doMethod.call(this,I,M,J)}return L};E.setRuntimeAttribute=function(I){G.setRuntimeAttribute.call(this,I);if(this.patterns.color.test(I)){var K=this.attributes;var M=this.parseColor(this.runtimeAttributes[I].start);var J=this.parseColor(this.runtimeAttributes[I].end);if(typeof K[I]["to"]==="undefined"&&typeof K[I]["by"]!=="undefined"){J=this.parseColor(K[I].by);for(var L=0,H=M.length;L<H;++L){J[L]=M[L]+J[L]}}this.runtimeAttributes[I].start=M;this.runtimeAttributes[I].end=J}}})();Ext.lib.Easing={easeNone:function(F,E,H,G){return H*F/G+E},easeIn:function(F,E,H,G){return H*(F/=G)*F+E},easeOut:function(F,E,H,G){return -H*(F/=G)*(F-2)+E},easeBoth:function(F,E,H,G){if((F/=G/2)<1){return H/2*F*F+E}return -H/2*((--F)*(F-2)-1)+E},easeInStrong:function(F,E,H,G){return H*(F/=G)*F*F*F+E},easeOutStrong:function(F,E,H,G){return -H*((F=F/G-1)*F*F*F-1)+E},easeBothStrong:function(F,E,H,G){if((F/=G/2)<1){return H/2*F*F*F*F+E}return -H/2*((F-=2)*F*F*F-2)+E},elasticIn:function(G,E,K,J,F,I){if(G==0){return E}if((G/=J)==1){return E+K}if(!I){I=J*0.3}if(!F||F<Math.abs(K)){F=K;var H=I/4}else{var H=I/(2*Math.PI)*Math.asin(K/F)}return -(F*Math.pow(2,10*(G-=1))*Math.sin((G*J-H)*(2*Math.PI)/I))+E},elasticOut:function(G,E,K,J,F,I){if(G==0){return E}if((G/=J)==1){return E+K}if(!I){I=J*0.3}if(!F||F<Math.abs(K)){F=K;var H=I/4}else{var H=I/(2*Math.PI)*Math.asin(K/F)}return F*Math.pow(2,-10*G)*Math.sin((G*J-H)*(2*Math.PI)/I)+K+E},elasticBoth:function(G,E,K,J,F,I){if(G==0){return E}if((G/=J/2)==2){return E+K}if(!I){I=J*(0.3*1.5)}if(!F||F<Math.abs(K)){F=K;var H=I/4}else{var H=I/(2*Math.PI)*Math.asin(K/F)}if(G<1){return -0.5*(F*Math.pow(2,10*(G-=1))*Math.sin((G*J-H)*(2*Math.PI)/I))+E}return F*Math.pow(2,-10*(G-=1))*Math.sin((G*J-H)*(2*Math.PI)/I)*0.5+K+E},backIn:function(F,E,I,H,G){if(typeof G=="undefined"){G=1.70158}return I*(F/=H)*F*((G+1)*F-G)+E},backOut:function(F,E,I,H,G){if(typeof G=="undefined"){G=1.70158}return I*((F=F/H-1)*F*((G+1)*F+G)+1)+E},backBoth:function(F,E,I,H,G){if(typeof G=="undefined"){G=1.70158}if((F/=H/2)<1){return I/2*(F*F*(((G*=(1.525))+1)*F-G))+E}return I/2*((F-=2)*F*(((G*=(1.525))+1)*F+G)+2)+E},bounceIn:function(F,E,H,G){return H-Ext.lib.Easing.bounceOut(G-F,0,H,G)+E},bounceOut:function(F,E,H,G){if((F/=G)<(1/2.75)){return H*(7.5625*F*F)+E}else{if(F<(2/2.75)){return H*(7.5625*(F-=(1.5/2.75))*F+0.75)+E}else{if(F<(2.5/2.75)){return H*(7.5625*(F-=(2.25/2.75))*F+0.9375)+E}}}return H*(7.5625*(F-=(2.625/2.75))*F+0.984375)+E},bounceBoth:function(F,E,H,G){if(F<G/2){return Ext.lib.Easing.bounceIn(F*2,0,H,G)*0.5+E}return Ext.lib.Easing.bounceOut(F*2-G,0,H,G)*0.5+H*0.5+E}};(function(){Ext.lib.Motion=function(K,J,L,M){if(K){Ext.lib.Motion.superclass.constructor.call(this,K,J,L,M)}};Ext.extend(Ext.lib.Motion,Ext.lib.ColorAnim);var H=Ext.lib;var I=H.Motion.superclass;var F=H.Motion.prototype;F.toString=function(){var J=this.getEl();var K=J.id||J.tagName;return("Motion "+K)};F.patterns.points=/^points$/i;F.setAttribute=function(J,L,K){if(this.patterns.points.test(J)){K=K||"px";I.setAttribute.call(this,"left",L[0],K);I.setAttribute.call(this,"top",L[1],K)}else{I.setAttribute.call(this,J,L,K)}};F.getAttribute=function(J){if(this.patterns.points.test(J)){var K=[I.getAttribute.call(this,"left"),I.getAttribute.call(this,"top")]}else{K=I.getAttribute.call(this,J)}return K};F.doMethod=function(J,N,K){var M=null;if(this.patterns.points.test(J)){var L=this.method(this.currentFrame,0,100,this.totalFrames)/100;M=H.Bezier.getPosition(this.runtimeAttributes[J],L)}else{M=I.doMethod.call(this,J,N,K)}return M};F.setRuntimeAttribute=function(S){if(this.patterns.points.test(S)){var K=this.getEl();var M=this.attributes;var J;var O=M["points"]["control"]||[];var L;var P,R;if(O.length>0&&!Ext.isArray(O[0])){O=[O]}else{var N=[];for(P=0,R=O.length;P<R;++P){N[P]=O[P]}O=N}Ext.fly(K,"_anim").position();if(G(M["points"]["from"])){Ext.lib.Dom.setXY(K,M["points"]["from"])}else{Ext.lib.Dom.setXY(K,Ext.lib.Dom.getXY(K))}J=this.getAttribute("points");if(G(M["points"]["to"])){L=E.call(this,M["points"]["to"],J);var Q=Ext.lib.Dom.getXY(this.getEl());for(P=0,R=O.length;P<R;++P){O[P]=E.call(this,O[P],J)}}else{if(G(M["points"]["by"])){L=[J[0]+M["points"]["by"][0],J[1]+M["points"]["by"][1]];for(P=0,R=O.length;P<R;++P){O[P]=[J[0]+O[P][0],J[1]+O[P][1]]}}}this.runtimeAttributes[S]=[J];if(O.length>0){this.runtimeAttributes[S]=this.runtimeAttributes[S].concat(O)}this.runtimeAttributes[S][this.runtimeAttributes[S].length]=L}else{I.setRuntimeAttribute.call(this,S)}};var E=function(J,L){var K=Ext.lib.Dom.getXY(this.getEl());J=[J[0]-K[0]+L[0],J[1]-K[1]+L[1]];return J};var G=function(J){return(typeof J!=="undefined")}})();(function(){Ext.lib.Scroll=function(I,H,J,K){if(I){Ext.lib.Scroll.superclass.constructor.call(this,I,H,J,K)}};Ext.extend(Ext.lib.Scroll,Ext.lib.ColorAnim);var F=Ext.lib;var G=F.Scroll.superclass;var E=F.Scroll.prototype;E.toString=function(){var H=this.getEl();var I=H.id||H.tagName;return("Scroll "+I)};E.doMethod=function(H,K,I){var J=null;if(H=="scroll"){J=[this.method(this.currentFrame,K[0],I[0]-K[0],this.totalFrames),this.method(this.currentFrame,K[1],I[1]-K[1],this.totalFrames)]}else{J=G.doMethod.call(this,H,K,I)}return J};E.getAttribute=function(H){var J=null;var I=this.getEl();if(H=="scroll"){J=[I.scrollLeft,I.scrollTop]}else{J=G.getAttribute.call(this,H)}return J};E.setAttribute=function(H,K,J){var I=this.getEl();if(H=="scroll"){I.scrollLeft=K[0];I.scrollTop=K[1]}else{G.setAttribute.call(this,H,K,J)}}})()})();
diff --git a/lib/ext-core.js b/lib/ext-core.js
new file mode 100644
index 0000000..aa36cfb
--- /dev/null
+++ b/lib/ext-core.js
@@ -0,0 +1,19 @@
+/*

+ * Ext JS Library 2.2

+ * Copyright(c) 2006-2008, Ext JS, LLC.

+ * licensing@extjs.com

+ * 

+ * http://extjs.com/license

+ */

+

+Ext.DomHelper=function(){var L=null;var F=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var B=/^table|tbody|tr|td$/i;var A=function(T){if(typeof T=="string"){return T}var O="";if(Ext.isArray(T)){for(var R=0,P=T.length;R<P;R++){O+=A(T[R])}return O}if(!T.tag){T.tag="div"}O+="<"+T.tag;for(var N in T){if(N=="tag"||N=="children"||N=="cn"||N=="html"||typeof T[N]=="function"){continue}if(N=="style"){var S=T["style"];if(typeof S=="function"){S=S.call()}if(typeof S=="string"){O+=" style=\""+S+"\""}else{if(typeof S=="object"){O+=" style=\"";for(var Q in S){if(typeof S[Q]!="function"){O+=Q+":"+S[Q]+";"}}O+="\""}}}else{if(N=="cls"){O+=" class=\""+T["cls"]+"\""}else{if(N=="htmlFor"){O+=" for=\""+T["htmlFor"]+"\""}else{O+=" "+N+"=\""+T[N]+"\""}}}}if(F.test(T.tag)){O+="/>"}else{O+=">";var U=T.children||T.cn;if(U){O+=A(U)}else{if(T.html){O+=T.html}}O+="</"+T.tag+">"}return O};var M=function(T,O){var S;if(Ext.isArray(T)){S=document.createDocumentFragment();for(var R=0,P=T.length;R<P;R++){M(T[R],S)}}else{if(typeof T=="string"){S=document.createTextNode(T)}else{S=document.createElement(T.tag||"div");var Q=!!S.setAttribute;for(var N in T){if(N=="tag"||N=="children"||N=="cn"||N=="html"||N=="style"||typeof T[N]=="function"){continue}if(N=="cls"){S.className=T["cls"]}else{if(Q){S.setAttribute(N,T[N])}else{S[N]=T[N]}}}Ext.DomHelper.applyStyles(S,T.style);var U=T.children||T.cn;if(U){M(U,S)}else{if(T.html){S.innerHTML=T.html}}}}if(O){O.appendChild(S)}return S};var I=function(S,Q,P,R){L.innerHTML=[Q,P,R].join("");var N=-1,O=L;while(++N<S){O=O.firstChild}return O};var J="<table>",E="</table>",C=J+"<tbody>",K="</tbody>"+E,H=C+"<tr>",D="</tr>"+K;var G=function(N,O,Q,P){if(!L){L=document.createElement("div")}var R;var S=null;if(N=="td"){if(O=="afterbegin"||O=="beforeend"){return }if(O=="beforebegin"){S=Q;Q=Q.parentNode}else{S=Q.nextSibling;Q=Q.parentNode}R=I(4,H,P,D)}else{if(N=="tr"){if(O=="beforebegin"){S=Q;Q=Q.parentNode;R=I(3,C,P,K)}else{if(O=="afterend"){S=Q.nextSibling;Q=Q.parentNode;R=I(3,C,P,K)}else{if(O=="afterbegin"){S=Q.firstChild}R=I(4,H,P,D)}}}else{if(N=="tbody"){if(O=="beforebegin"){S=Q;Q=Q.parentNode;R=I(2,J,P,E)}else{if(O=="afterend"){S=Q.nextSibling;Q=Q.parentNode;R=I(2,J,P,E)}else{if(O=="afterbegin"){S=Q.firstChild}R=I(3,C,P,K)}}}else{if(O=="beforebegin"||O=="afterend"){return }if(O=="afterbegin"){S=Q.firstChild}R=I(2,J,P,E)}}}Q.insertBefore(R,S);return R};return{useDom:false,markup:function(N){return A(N)},applyStyles:function(P,Q){if(Q){P=Ext.fly(P);if(typeof Q=="string"){var O=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var R;while((R=O.exec(Q))!=null){P.setStyle(R[1],R[2])}}else{if(typeof Q=="object"){for(var N in Q){P.setStyle(N,Q[N])}}else{if(typeof Q=="function"){Ext.DomHelper.applyStyles(P,Q.call())}}}}},insertHtml:function(P,R,Q){P=P.toLowerCase();if(R.insertAdjacentHTML){if(B.test(R.tagName)){var O;if(O=G(R.tagName.toLowerCase(),P,R,Q)){return O}}switch(P){case"beforebegin":R.insertAdjacentHTML("BeforeBegin",Q);return R.previousSibling;case"afterbegin":R.insertAdjacentHTML("AfterBegin",Q);return R.firstChild;case"beforeend":R.insertAdjacentHTML("BeforeEnd",Q);return R.lastChild;case"afterend":R.insertAdjacentHTML("AfterEnd",Q);return R.nextSibling}throw"Illegal insertion point -> \""+P+"\""}var N=R.ownerDocument.createRange();var S;switch(P){case"beforebegin":N.setStartBefore(R);S=N.createContextualFragment(Q);R.parentNode.insertBefore(S,R);return R.previousSibling;case"afterbegin":if(R.firstChild){N.setStartBefore(R.firstChild);S=N.createContextualFragment(Q);R.insertBefore(S,R.firstChild);return R.firstChild}else{R.innerHTML=Q;return R.firstChild}case"beforeend":if(R.lastChild){N.setStartAfter(R.lastChild);S=N.createContextualFragment(Q);R.appendChild(S);return R.lastChild}else{R.innerHTML=Q;return R.lastChild}case"afterend":N.setStartAfter(R);S=N.createContextualFragment(Q);R.parentNode.insertBefore(S,R.nextSibling);return R.nextSibling}throw"Illegal insertion point -> \""+P+"\""},insertBefore:function(N,P,O){return this.doInsert(N,P,O,"beforeBegin")},insertAfter:function(N,P,O){return this.doInsert(N,P,O,"afterEnd","nextSibling")},insertFirst:function(N,P,O){return this.doInsert(N,P,O,"afterBegin","firstChild")},doInsert:function(Q,S,R,T,P){Q=Ext.getDom(Q);var O;if(this.useDom){O=M(S,null);(P==="firstChild"?Q:Q.parentNode).insertBefore(O,P?Q[P]:Q)}else{var N=A(S);O=this.insertHtml(T,Q,N)}return R?Ext.get(O,true):O},append:function(P,R,Q){P=Ext.getDom(P);var O;if(this.useDom){O=M(R,null);P.appendChild(O)}else{var N=A(R);O=this.insertHtml("beforeEnd",P,N)}return Q?Ext.get(O,true):O},overwrite:function(N,P,O){N=Ext.getDom(N);N.innerHTML=A(P);return O?Ext.get(N.firstChild,true):N.firstChild},createTemplate:function(O){var N=A(O);return new Ext.Template(N)}}}();
+Ext.Template=function(E){var B=arguments;if(Ext.isArray(E)){E=E.join("")}else{if(B.length>1){var C=[];for(var D=0,A=B.length;D<A;D++){if(typeof B[D]=="object"){Ext.apply(this,B[D])}else{C[C.length]=B[D]}}E=C.join("")}}this.html=E;if(this.compiled){this.compile()}};Ext.Template.prototype={applyTemplate:function(B){if(this.compiled){return this.compiled(B)}var A=this.disableFormats!==true;var E=Ext.util.Format,C=this;var D=function(G,I,L,H){if(L&&A){if(L.substr(0,5)=="this."){return C.call(L.substr(5),B[I],B)}else{if(H){var K=/^\s*['"](.*)["']\s*$/;H=H.split(",");for(var J=0,F=H.length;J<F;J++){H[J]=H[J].replace(K,"$1")}H=[B[I]].concat(H)}else{H=[B[I]]}return E[L].apply(E,H)}}else{return B[I]!==undefined?B[I]:""}};return this.html.replace(this.re,D)},set:function(A,B){this.html=A;this.compiled=null;if(B){this.compile()}return this},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Ext.util.Format;var useF=this.disableFormats!==true;var sep=Ext.isGecko?"+":",";var fn=function(m,name,format,args){if(format&&useF){args=args?","+args:"";if(format.substr(0,5)!="this."){format="fm."+format+"("}else{format="this.call(\""+format.substr(5)+"\", ";args=", values"}}else{args="";format="(values['"+name+"'] == undefined ? '' : "}return"'"+sep+format+"values['"+name+"']"+args+")"+sep+"'"};var body;if(Ext.isGecko){body="this.compiled = function(values){ return '"+this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn)+"';};"}else{body=["this.compiled = function(values){ return ['"];body.push(this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn));body.push("'].join('');};");body=body.join("")}eval(body);return this},call:function(C,B,A){return this[C](B,A)},insertFirst:function(B,A,C){return this.doInsert("afterBegin",B,A,C)},insertBefore:function(B,A,C){return this.doInsert("beforeBegin",B,A,C)},insertAfter:function(B,A,C){return this.doInsert("afterEnd",B,A,C)},append:function(B,A,C){return this.doInsert("beforeEnd",B,A,C)},doInsert:function(C,E,B,A){E=Ext.getDom(E);var D=Ext.DomHelper.insertHtml(C,E,this.applyTemplate(B));return A?Ext.get(D,true):D},overwrite:function(B,A,C){B=Ext.getDom(B);B.innerHTML=this.applyTemplate(A);return C?Ext.get(B.firstChild,true):B.firstChild}};Ext.Template.prototype.apply=Ext.Template.prototype.applyTemplate;Ext.DomHelper.Template=Ext.Template;Ext.Template.from=function(B,A){B=Ext.getDom(B);return new Ext.Template(B.value||B.innerHTML,A||"")};
+Ext.DomQuery=function(){var cache={},simpleCache={},valueCache={};var nonSpace=/\S/;var trimRe=/^\s+|\s+$/g;var tplRe=/\{(\d+)\}/g;var modeRe=/^(\s?[\/>+~]\s?|\s|$)/;var tagTokenRe=/^(#)?([\w-\*]+)/;var nthRe=/(\d*)n\+?(\d*)/,nthRe2=/\D/;function child(p,index){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==index){return n}}n=n.nextSibling}return null}function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}return n}function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}return n}function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!nonSpace.test(n.nodeValue)){d.removeChild(n)}else{n.nodeIndex=++ni}n=nx}return this}function byClassName(c,a,v){if(!v){return c}var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((" "+ci.className+" ").indexOf(v)!=-1){r[++ri]=ci}}return r}function attrValue(n,attr){if(!n.tagName&&typeof n.length!="undefined"){n=n[0]}if(!n){return null}if(attr=="for"){return n.htmlFor}if(attr=="class"||attr=="className"){return n.className}return n.getAttribute(attr)||n[attr]}function getNodes(ns,mode,tagName){var result=[],ri=-1,cs;if(!ns){return result}tagName=tagName||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns]}if(!mode){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(tagName);for(var j=0,ci;ci=cs[j];j++){result[++ri]=ci}}}else{if(mode=="/"||mode==">"){var utag=tagName.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==utag||cj.nodeName==tagName||tagName=="*"){result[++ri]=cj}}}}else{if(mode=="+"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(n&&(n.nodeName==utag||n.nodeName==tagName||tagName=="*")){result[++ri]=n}}}else{if(mode=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(tagName=="*"||n.tagName.toLowerCase()!=tagName))){}if(n){result[++ri]=n}}}}}}return result}function concat(a,b){if(b.slice){return a.concat(b)}for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i]}return a}function byTag(cs,tagName){if(cs.tagName||cs==document){cs=[cs]}if(!tagName){return cs}var r=[],ri=-1;tagName=tagName.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==tagName){r[++ri]=ci}}return r}function byId(cs,attr,id){if(cs.tagName||cs==document){cs=[cs]}if(!id){return cs}var r=[],ri=-1;for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[++ri]=ci;return r}}return r}function byAttribute(cs,attr,value,op,custom){var r=[],ri=-1,st=custom=="{";var f=Ext.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Ext.DomQuery.getStyle(ci,attr)}else{if(attr=="class"||attr=="className"){a=ci.className}else{if(attr=="for"){a=ci.htmlFor}else{if(attr=="href"){a=ci.getAttribute("href",2)}else{a=ci.getAttribute(attr)}}}}if((f&&f(a,value))||(!f&&a)){r[++ri]=ci}}return r}function byPseudo(cs,name,value){return Ext.DomQuery.pseudos[name](cs,value)}var isIE=window.ActiveXObject?true:false;eval("var batch = 30803;");var key=30803;function nodupIEXml(cs){var d=++key;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c}}for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup")}return r}function nodup(cs){if(!cs){return[]}var len=cs.length,c,i,r=cs,cj,ri=-1;if(!len||typeof cs.nodeType!="undefined"||len==1){return cs}if(isIE&&typeof cs[0].selectSingleNode!="undefined"){return nodupIEXml(cs)}var d=++key;cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d}else{r=[];for(var j=0;j<i;j++){r[++ri]=cs[j]}for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[++ri]=cj}}return r}}return r}function quickDiffIEXml(c1,c2){var d=++key;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d)}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i]}}for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff")}return r}function quickDiff(c1,c2){var len1=c1.length;if(!len1){return c2}if(isIE&&c1[0].selectSingleNode){return quickDiffIEXml(c1,c2)}var d=++key;for(var i=0;i<len1;i++){c1[i]._qdiff=d}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i]}}return r}function quickId(ns,mode,root,id){if(ns==root){var d=root.ownerDocument||root;return d.getElementById(id)}ns=getNodes(ns,mode,"*");return byId(ns,null,id)}return{getStyle:function(el,name){return Ext.fly(el).getStyle(name)},compile:function(path,type){type=type||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=path,mode,lq;var tk=Ext.DomQuery.matchers;var tklen=tk.length;var mm;var lmode=q.match(modeRe);if(lmode&&lmode[1]){fn[fn.length]="mode=\""+lmode[1].replace(trimRe,"")+"\";";q=q.replace(lmode[1],"")}while(path.substr(0,1)=="/"){path=path.substr(1)}while(q&&lq!=q){lq=q;var tm=q.match(tagTokenRe);if(type=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]="n = quickId(n, mode, root, \""+tm[2]+"\");"}else{fn[fn.length]="n = getNodes(n, mode, \""+tm[2]+"\");"}q=q.replace(tm[0],"")}else{if(q.substr(0,1)!="@"){fn[fn.length]="n = getNodes(n, mode, \"*\");"}}}else{if(tm){if(tm[1]=="#"){fn[fn.length]="n = byId(n, null, \""+tm[2]+"\");"}else{fn[fn.length]="n = byTag(n, \""+tm[2]+"\");"}q=q.replace(tm[0],"")}}while(!(mm=q.match(modeRe))){var matched=false;for(var j=0;j<tklen;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(tplRe,function(x,i){return m[i]});q=q.replace(m[0],"");matched=true;break}}if(!matched){throw"Error parsing selector, parsing failed at \""+q+"\""}}if(mm[1]){fn[fn.length]="mode=\""+mm[1].replace(trimRe,"")+"\";";q=q.replace(mm[1],"")}}fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f},select:function(path,root,type){if(!root||root==document){root=document}if(typeof root=="string"){root=document.getElementById(root)}var paths=path.split(",");var results=[];for(var i=0,len=paths.length;i<len;i++){var p=paths[i].replace(trimRe,"");if(!cache[p]){cache[p]=Ext.DomQuery.compile(p);if(!cache[p]){throw p+" is not a valid selector"}}var result=cache[p](root);if(result&&result!=document){results=results.concat(result)}}if(paths.length>1){return nodup(results)}return results},selectNode:function(path,root){return Ext.DomQuery.select(path,root)[0]},selectValue:function(path,root,defaultValue){path=path.replace(trimRe,"");if(!valueCache[path]){valueCache[path]=Ext.DomQuery.compile(path,"select")}var n=valueCache[path](root);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==="")?defaultValue:v)},selectNumber:function(path,root,defaultValue){var v=Ext.DomQuery.selectValue(path,root,defaultValue||0);return parseFloat(v)},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el)}var isArray=Ext.isArray(el);var result=Ext.DomQuery.filter(isArray?el:[el],ss);return isArray?(result.length==el.length):(result.length>0)},filter:function(els,ss,nonMatches){ss=ss.replace(trimRe,"");if(!simpleCache[ss]){simpleCache[ss]=Ext.DomQuery.compile(ss,"simple")}var result=simpleCache[ss](els);return nonMatches?quickDiff(result,els):result},matchers:[{re:/^\.([\w-]+)/,select:"n = byClassName(n, null, \" {1} \");"},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:"n = byPseudo(n, \"{1}\", \"{2}\");"},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:"n = byAttribute(n, \"{2}\", \"{4}\", \"{3}\", \"{1}\");"},{re:/^#([\w-]+)/,select:"n = byId(n, null, \"{1}\");"},{re:/^@([\w-]+)/,select:"return {firstChild:{nodeValue:attrValue(n, \"{1}\")}};"}],operators:{"=":function(a,v){return a==v},"!=":function(a,v){return a!=v},"^=":function(a,v){return a&&a.substr(0,v.length)==v},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v},"*=":function(a,v){return a&&a.indexOf(v)!==-1},"%=":function(a,v){return(a%v)==0},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+"-")},"~=":function(a,v){return a&&(" "+a+" ").indexOf(" "+v+" ")!=-1}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"nth-child":function(c,a){var r=[],ri=-1;var m=nthRe.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!nthRe2.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j}}pn._batch=batch}if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n}}else{if((n.nodeIndex+l)%f==0){r[++ri]=n}}}return r},"only-child":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci}}return r},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break}}if(empty){r[++ri]=ci}}return r},"contains":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||"").indexOf(v)!=-1){r[++ri]=ci}}return r},"nodeValue":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci}}return r},"checked":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci}}return r},"not":function(c,ss){return Ext.DomQuery.filter(c,ss,true)},"any":function(c,selectors){var ss=selectors.split("|");var r=[],ri=-1,s;for(var i=0,ci;ci=c[i];i++){for(var j=0;s=ss[j];j++){if(Ext.DomQuery.is(ci,s)){r[++ri]=ci;break}}}return r},"odd":function(c){return this["nth-child"](c,"odd")},"even":function(c){return this["nth-child"](c,"even")},"nth":function(c,a){return c[a-1]||[]},"first":function(c){return c[0]||[]},"last":function(c){return c[c.length-1]||[]},"has":function(c,ss){var s=Ext.DomQuery.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci}}return r},"next":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r},"prev":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r}}}}();Ext.query=Ext.DomQuery.select;
+Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete this.listeners}};Ext.util.Observable.prototype={fireEvent:function(){if(this.eventsSuspended!==true){var A=this.events[arguments[0].toLowerCase()];if(typeof A=="object"){return A.fire.apply(A,Array.prototype.slice.call(arguments,1))}}return true},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(A,C,B,F){if(typeof A=="object"){F=A;for(var E in F){if(this.filterOptRe.test(E)){continue}if(typeof F[E]=="function"){this.addListener(E,F[E],F.scope,F)}else{this.addListener(E,F[E].fn,F[E].scope,F[E])}}return }F=(!F||typeof F=="boolean")?{}:F;A=A.toLowerCase();var D=this.events[A]||true;if(typeof D=="boolean"){D=new Ext.util.Event(this,A);this.events[A]=D}D.addListener(C,B,F)},removeListener:function(A,C,B){var D=this.events[A.toLowerCase()];if(typeof D=="object"){D.removeListener(C,B)}},purgeListeners:function(){for(var A in this.events){if(typeof this.events[A]=="object"){this.events[A].clearListeners()}}},relayEvents:function(F,D){var E=function(G){return function(){return this.fireEvent.apply(this,Ext.combine(G,Array.prototype.slice.call(arguments,0)))}};for(var C=0,A=D.length;C<A;C++){var B=D[C];if(!this.events[B]){this.events[B]=true}F.on(B,E(B),this)}},addEvents:function(D){if(!this.events){this.events={}}if(typeof D=="string"){for(var C=0,A=arguments,B;B=A[C];C++){if(!this.events[A[C]]){this.events[A[C]]=true}}}else{Ext.applyIf(this.events,D)}},hasListener:function(A){var B=this.events[A];return typeof B=="object"&&B.listeners.length>0},suspendEvents:function(){this.eventsSuspended=true},resumeEvents:function(){this.eventsSuspended=false},getMethodEvent:function(G){if(!this.methodEvents){this.methodEvents={}}var F=this.methodEvents[G];if(!F){F={};this.methodEvents[G]=F;F.originalFn=this[G];F.methodName=G;F.before=[];F.after=[];var C,B,D;var E=this;var A=function(J,I,H){if((B=J.apply(I||E,H))!==undefined){if(typeof B==="object"){if(B.returnValue!==undefined){C=B.returnValue}else{C=B}if(B.cancel===true){D=true}}else{if(B===false){D=true}else{C=B}}}};this[G]=function(){C=B=undefined;D=false;var I=Array.prototype.slice.call(arguments,0);for(var J=0,H=F.before.length;J<H;J++){A(F.before[J].fn,F.before[J].scope,I);if(D){return C}}if((B=F.originalFn.apply(E,I))!==undefined){C=B}for(var J=0,H=F.after.length;J<H;J++){A(F.after[J].fn,F.after[J].scope,I);if(D){return C}}return C}}return F},beforeMethod:function(D,B,A){var C=this.getMethodEvent(D);C.before.push({fn:B,scope:A})},afterMethod:function(D,B,A){var C=this.getMethodEvent(D);C.after.push({fn:B,scope:A})},removeMethodListener:function(F,D,C){var E=this.getMethodEvent(F);for(var B=0,A=E.before.length;B<A;B++){if(E.before[B].fn==D&&E.before[B].scope==C){E.before.splice(B,1);return }}for(var B=0,A=E.after.length;B<A;B++){if(E.after[B].fn==D&&E.after[B].scope==C){E.after.splice(B,1);return }}}};Ext.util.Observable.prototype.on=Ext.util.Observable.prototype.addListener;Ext.util.Observable.prototype.un=Ext.util.Observable.prototype.removeListener;Ext.util.Observable.capture=function(C,B,A){C.fireEvent=C.fireEvent.createInterceptor(B,A)};Ext.util.Observable.releaseCapture=function(A){A.fireEvent=Ext.util.Observable.prototype.fireEvent};(function(){var B=function(F,G,E){var D=new Ext.util.DelayedTask();return function(){D.delay(G.buffer,F,E,Array.prototype.slice.call(arguments,0))}};var C=function(F,G,E,D){return function(){G.removeListener(E,D);return F.apply(D,arguments)}};var A=function(E,F,D){return function(){var G=Array.prototype.slice.call(arguments,0);setTimeout(function(){E.apply(D,G)},F.delay||10)}};Ext.util.Event=function(E,D){this.name=D;this.obj=E;this.listeners=[]};Ext.util.Event.prototype={addListener:function(G,F,E){F=F||this.obj;if(!this.isListening(G,F)){var D=this.createListener(G,F,E);if(!this.firing){this.listeners.push(D)}else{this.listeners=this.listeners.slice(0);this.listeners.push(D)}}},createListener:function(G,F,H){H=H||{};F=F||this.obj;var D={fn:G,scope:F,options:H};var E=G;if(H.delay){E=A(E,H,F)}if(H.single){E=C(E,this,G,F)}if(H.buffer){E=B(E,H,F)}D.fireFn=E;return D},findListener:function(I,H){H=H||this.obj;var F=this.listeners;for(var G=0,D=F.length;G<D;G++){var E=F[G];if(E.fn==I&&E.scope==H){return G}}return -1},isListening:function(E,D){return this.findListener(E,D)!=-1},removeListener:function(F,E){var D;if((D=this.findListener(F,E))!=-1){if(!this.firing){this.listeners.splice(D,1)}else{this.listeners=this.listeners.slice(0);this.listeners.splice(D,1)}return true}return false},clearListeners:function(){this.listeners=[]},fire:function(){var F=this.listeners,I,D=F.length;if(D>0){this.firing=true;var G=Array.prototype.slice.call(arguments,0);for(var H=0;H<D;H++){var E=F[H];if(E.fireFn.apply(E.scope||this.obj||window,arguments)===false){this.firing=false;return false}}this.firing=false}return true}}})();
+Ext.EventManager=function(){var X,Q,M=false;var N,W,H,S;var P=Ext.lib.Event;var R=Ext.lib.Dom;var A="Ex"+"t";var J={};var O=function(b,E,a,Z,Y){var d=Ext.id(b);if(!J[d]){J[d]={}}var c=J[d];if(!c[E]){c[E]=[]}var D=c[E];D.push({id:d,ename:E,fn:a,wrap:Z,scope:Y});P.on(b,E,Z);if(E=="mousewheel"&&b.addEventListener){b.addEventListener("DOMMouseScroll",Z,false);P.on(window,"unload",function(){b.removeEventListener("DOMMouseScroll",Z,false)})}if(E=="mousedown"&&b==document){Ext.EventManager.stoppedMouseDownEvent.addListener(Z)}};var I=function(Y,a,e,g){Y=Ext.getDom(Y);var D=Ext.id(Y),f=J[D],E;if(f){var c=f[a],Z;if(c){for(var b=0,d=c.length;b<d;b++){Z=c[b];if(Z.fn==e&&(!g||Z.scope==g)){E=Z.wrap;P.un(Y,a,E);c.splice(b,1);break}}}}if(a=="mousewheel"&&Y.addEventListener&&E){Y.removeEventListener("DOMMouseScroll",E,false)}if(a=="mousedown"&&Y==document&&E){Ext.EventManager.stoppedMouseDownEvent.removeListener(E)}};var F=function(a){a=Ext.getDom(a);var c=Ext.id(a),b=J[c],E;if(b){for(var Z in b){if(b.hasOwnProperty(Z)){E=b[Z];for(var Y=0,D=E.length;Y<D;Y++){P.un(a,Z,E[Y].wrap);E[Y]=null}}b[Z]=null}delete J[c]}};var C=function(){if(!M){M=Ext.isReady=true;if(Ext.isGecko||Ext.isOpera){document.removeEventListener("DOMContentLoaded",C,false)}}if(Q){clearInterval(Q);Q=null}if(X){X.fire();X.clearListeners()}};var B=function(){X=new Ext.util.Event();if(Ext.isReady){return }P.on(window,"load",C);if(Ext.isGecko||Ext.isOpera){document.addEventListener("DOMContentLoaded",C,false)}else{if(Ext.isIE){Q=setInterval(function(){try{Ext.isReady||(document.documentElement.doScroll("left"))}catch(D){return }C()},5);document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;C()}}}else{if(Ext.isSafari){Q=setInterval(function(){var D=document.readyState;if(D=="complete"){C()}},10)}}}};var V=function(E,Y){var D=new Ext.util.DelayedTask(E);return function(Z){Z=new Ext.EventObjectImpl(Z);D.delay(Y.buffer,E,null,[Z])}};var T=function(a,Z,D,Y,E){return function(b){Ext.EventManager.removeListener(Z,D,Y,E);a(b)}};var G=function(D,E){return function(Y){Y=new Ext.EventObjectImpl(Y);setTimeout(function(){D(Y)},E.delay||10)}};var L=function(Y,E,D,c,b){var d=(!D||typeof D=="boolean")?{}:D;c=c||d.fn;b=b||d.scope;var a=Ext.getDom(Y);if(!a){throw"Error listening for \""+E+"\". Element \""+Y+"\" doesn't exist."}var Z=function(g){if(!window[A]){return }g=Ext.EventObject.setEvent(g);var f;if(d.delegate){f=g.getTarget(d.delegate,a);if(!f){return }}else{f=g.target}if(d.stopEvent===true){g.stopEvent()}if(d.preventDefault===true){g.preventDefault()}if(d.stopPropagation===true){g.stopPropagation()}if(d.normalized===false){g=g.browserEvent}c.call(b||a,g,f,d)};if(d.delay){Z=G(Z,d)}if(d.single){Z=T(Z,a,E,c,b)}if(d.buffer){Z=V(Z,d)}O(a,E,c,Z,b);return Z};var K=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var U={addListener:function(Y,D,a,Z,E){if(typeof D=="object"){var c=D;for(var b in c){if(K.test(b)){continue}if(typeof c[b]=="function"){L(Y,b,c,c[b],c.scope)}else{L(Y,b,c[b])}}return }return L(Y,D,E,a,Z)},removeListener:function(E,D,Z,Y){return I(E,D,Z,Y)},removeAll:function(D){return F(D)},onDocumentReady:function(Y,E,D){if(!X){B()}if(M||Ext.isReady){D||(D={});Y.defer(D.delay||0,E)}else{X.addListener(Y,E,D)}},onWindowResize:function(Y,E,D){if(!N){N=new Ext.util.Event();W=new Ext.util.DelayedTask(function(){N.fire(R.getViewWidth(),R.getViewHeight())});P.on(window,"resize",this.fireWindowResize,this)}N.addListener(Y,E,D)},fireWindowResize:function(){if(N){if((Ext.isIE||Ext.isAir)&&W){W.delay(50)}else{N.fire(R.getViewWidth(),R.getViewHeight())}}},onTextResize:function(Z,Y,D){if(!H){H=new Ext.util.Event();var E=new Ext.Element(document.createElement("div"));E.dom.className="x-text-resize";E.dom.innerHTML="X";E.appendTo(document.body);S=E.dom.offsetHeight;setInterval(function(){if(E.dom.offsetHeight!=S){H.fire(S,S=E.dom.offsetHeight)}},this.textResizeInterval)}H.addListener(Z,Y,D)},removeResizeListener:function(E,D){if(N){N.removeListener(E,D)}},fireResize:function(){if(N){N.fire(R.getViewWidth(),R.getViewHeight())}},ieDeferSrc:false,textResizeInterval:50};U.on=U.addListener;U.un=U.removeListener;U.stoppedMouseDownEvent=new Ext.util.Event();return U}();Ext.onReady=Ext.EventManager.onDocumentReady;(function(){var A=function(){var C=document.body||document.getElementsByTagName("body")[0];if(!C){return false}var B=[" ",Ext.isIE?"ext-ie "+(Ext.isIE6?"ext-ie6":"ext-ie7"):Ext.isGecko?"ext-gecko "+(Ext.isGecko2?"ext-gecko2":"ext-gecko3"):Ext.isOpera?"ext-opera":Ext.isSafari?"ext-safari":""];if(Ext.isMac){B.push("ext-mac")}if(Ext.isLinux){B.push("ext-linux")}if(Ext.isBorderBox){B.push("ext-border-box")}if(Ext.isStrict){var D=C.parentNode;if(D){D.className+=" ext-strict"}}C.className+=B.join(" ");return true};if(!A()){Ext.onReady(A)}})();Ext.EventObject=function(){var B=Ext.lib.Event;var A={3:13,63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var C=Ext.isIE?{1:0,4:1,2:2}:(Ext.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Ext.EventObjectImpl=function(D){if(D){this.setEvent(D.browserEvent||D)}};Ext.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,RETURN:13,SHIFT:16,CTRL:17,CONTROL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGEUP:33,PAGE_DOWN:34,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,setEvent:function(D){if(D==this||(D&&D.browserEvent)){return D}this.browserEvent=D;if(D){this.button=D.button?C[D.button]:(D.which?D.which-1:-1);if(D.type=="click"&&this.button==-1){this.button=0}this.type=D.type;this.shiftKey=D.shiftKey;this.ctrlKey=D.ctrlKey||D.metaKey;this.altKey=D.altKey;this.keyCode=D.keyCode;this.charCode=D.charCode;this.target=B.getTarget(D);this.xy=B.getXY(D)}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0]}return this},stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this)}B.stopEvent(this.browserEvent)}},preventDefault:function(){if(this.browserEvent){B.preventDefault(this.browserEvent)}},isNavKeyPress:function(){var D=this.keyCode;D=Ext.isSafari?(A[D]||D):D;return(D>=33&&D<=40)||D==this.RETURN||D==this.TAB||D==this.ESC},isSpecialKey:function(){var D=this.keyCode;return(this.type=="keypress"&&this.ctrlKey)||D==9||D==13||D==40||D==27||(D==16)||(D==17)||(D>=18&&D<=20)||(D>=33&&D<=35)||(D>=36&&D<=39)||(D>=44&&D<=45)},stopPropagation:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this)}B.stopPropagation(this.browserEvent)}},getCharCode:function(){return this.charCode||this.keyCode},getKey:function(){var D=this.keyCode||this.charCode;return Ext.isSafari?(A[D]||D):D},getPageX:function(){return this.xy[0]},getPageY:function(){return this.xy[1]},getTime:function(){if(this.browserEvent){return B.getTime(this.browserEvent)}return null},getXY:function(){return this.xy},getTarget:function(E,F,D){return E?Ext.fly(this.target).findParent(E,F,D):(D?Ext.get(this.target):this.target)},getRelatedTarget:function(){if(this.browserEvent){return B.getRelatedTarget(this.browserEvent)}return null},getWheelDelta:function(){var D=this.browserEvent;var E=0;if(D.wheelDelta){E=D.wheelDelta/120}else{if(D.detail){E=-D.detail/3}}return E},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)?true:false},within:function(E,F){var D=this[F?"getRelatedTarget":"getTarget"]();return D&&Ext.fly(E).contains(D)},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1])}};return new Ext.EventObjectImpl()}();
+(function(){var D=Ext.lib.Dom;var E=Ext.lib.Event;var A=Ext.lib.Anim;var propCache={};var camelRe=/(-[a-z])/gi;var camelFn=function(m,a){return a.charAt(1).toUpperCase()};var view=document.defaultView;Ext.Element=function(element,forceNew){var dom=typeof element=="string"?document.getElementById(element):element;if(!dom){return null}var id=dom.id;if(forceNew!==true&&id&&Ext.Element.cache[id]){return Ext.Element.cache[id]}this.dom=dom;this.id=id||Ext.id(dom)};var El=Ext.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(visMode){this.visibilityMode=visMode;return this},enableDisplayMode:function(display){this.setVisibilityMode(El.DISPLAY);if(typeof display!="undefined"){this.originalDisplay=display}return this},findParent:function(simpleSelector,maxDepth,returnEl){var p=this.dom,b=document.body,depth=0,dq=Ext.DomQuery,stopEl;maxDepth=maxDepth||50;if(typeof maxDepth!="number"){stopEl=Ext.getDom(maxDepth);maxDepth=10}while(p&&p.nodeType==1&&depth<maxDepth&&p!=b&&p!=stopEl){if(dq.is(p,simpleSelector)){return returnEl?Ext.get(p):p}depth++;p=p.parentNode}return null},findParentNode:function(simpleSelector,maxDepth,returnEl){var p=Ext.fly(this.dom.parentNode,"_internal");return p?p.findParent(simpleSelector,maxDepth,returnEl):null},up:function(simpleSelector,maxDepth){return this.findParentNode(simpleSelector,maxDepth,true)},is:function(simpleSelector){return Ext.DomQuery.is(this.dom,simpleSelector)},animate:function(args,duration,onComplete,easing,animType){this.anim(args,{duration:duration,callback:onComplete,easing:easing},animType);return this},anim:function(args,opt,animType,defaultDur,defaultEase,cb){animType=animType||"run";opt=opt||{};var anim=Ext.lib.Anim[animType](this.dom,args,(opt.duration||defaultDur)||0.35,(opt.easing||defaultEase)||"easeOut",function(){Ext.callback(cb,this);Ext.callback(opt.callback,opt.scope||this,[this,opt])},this);opt.anim=anim;return anim},preanim:function(a,i){return !a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]})},clean:function(forceReclean){if(this.isCleaned&&forceReclean!==true){return this}var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n)}else{n.nodeIndex=++ni}n=nx}this.isCleaned=true;return this},scrollIntoView:function(container,hscroll){var c=Ext.getDom(container)||Ext.getBody().dom;var el=this.dom;var o=this.getOffsetsTo(c),l=o[0]+c.scrollLeft,t=o[1]+c.scrollTop,b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(el.offsetHeight>ch||t<ct){c.scrollTop=t}else{if(b>cb){c.scrollTop=b-ch}}c.scrollTop=c.scrollTop;if(hscroll!==false){if(el.offsetWidth>c.clientWidth||l<cl){c.scrollLeft=l}else{if(r>cr){c.scrollLeft=r-c.clientWidth}}c.scrollLeft=c.scrollLeft}return this},scrollChildIntoView:function(child,hscroll){Ext.fly(child,"_scrollChildIntoView").scrollIntoView(this,hscroll)},autoHeight:function(animate,duration,onComplete,easing){var oldHeight=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var height=parseInt(this.dom.scrollHeight,10);if(!animate){this.setHeight(height);this.unclip();if(typeof onComplete=="function"){onComplete()}}else{this.setHeight(oldHeight);this.setHeight(height,animate,duration,function(){this.unclip();if(typeof onComplete=="function"){onComplete()}}.createDelegate(this),easing)}}.createDelegate(this),0);return this},contains:function(el){if(!el){return false}return D.isAncestor(this.dom,el.dom?el.dom:el)},isVisible:function(deep){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(deep!==true||!vis){return vis}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Ext.fly(p,"_isVisible").isVisible()){return false}p=p.parentNode}return true},select:function(selector,unique){return El.select(selector,unique,this.dom)},query:function(selector){return Ext.DomQuery.select(selector,this.dom)},child:function(selector,returnDom){var n=Ext.DomQuery.selectNode(selector,this.dom);return returnDom?n:Ext.get(n)},down:function(selector,returnDom){var n=Ext.DomQuery.selectNode(" > "+selector,this.dom);return returnDom?n:Ext.get(n)},initDD:function(group,config,overrides){var dd=new Ext.dd.DD(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},initDDProxy:function(group,config,overrides){var dd=new Ext.dd.DDProxy(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},initDDTarget:function(group,config,overrides){var dd=new Ext.dd.DDTarget(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},setVisible:function(visible,animate){if(!animate||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(visible)}else{this.fixDisplay();this.dom.style.visibility=visible?"visible":"hidden"}}else{var dom=this.dom;var visMode=this.visibilityMode;if(visible){this.setOpacity(0.01);this.setVisible(true)}this.anim({opacity:{to:(visible?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!visible){if(visMode==El.DISPLAY){dom.style.display="none"}else{dom.style.visibility="hidden"}Ext.get(dom).setOpacity(1)}})}return this},isDisplayed:function(){return this.getStyle("display")!="none"},toggle:function(animate){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this},setDisplayed:function(value){if(typeof value=="boolean"){value=value?this.originalDisplay:"none"}this.setStyle("display",value);return this},focus:function(){try{this.dom.focus()}catch(e){}return this},blur:function(){try{this.dom.blur()}catch(e){}return this},addClass:function(className){if(Ext.isArray(className)){for(var i=0,len=className.length;i<len;i++){this.addClass(className[i])}}else{if(className&&!this.hasClass(className)){this.dom.className=this.dom.className+" "+className}}return this},radioClass:function(className){var siblings=this.dom.parentNode.childNodes;for(var i=0;i<siblings.length;i++){var s=siblings[i];if(s.nodeType==1){Ext.get(s).removeClass(className)}}this.addClass(className);return this},removeClass:function(className){if(!className||!this.dom.className){return this}if(Ext.isArray(className)){for(var i=0,len=className.length;i<len;i++){this.removeClass(className[i])}}else{if(this.hasClass(className)){var re=this.classReCache[className];if(!re){re=new RegExp("(?:^|\\s+)"+className+"(?:\\s+|$)","g");this.classReCache[className]=re}this.dom.className=this.dom.className.replace(re," ")}}return this},classReCache:{},toggleClass:function(className){if(this.hasClass(className)){this.removeClass(className)}else{this.addClass(className)}return this},hasClass:function(className){return className&&(" "+this.dom.className+" ").indexOf(" "+className+" ")!=-1},replaceClass:function(oldClassName,newClassName){this.removeClass(oldClassName);this.addClass(newClassName);return this},getStyles:function(){var a=arguments,len=a.length,r={};for(var i=0;i<len;i++){r[a[i]]=this.getStyle(a[i])}return r},getStyle:function(){return view&&view.getComputedStyle?function(prop){var el=this.dom,v,cs,camel;if(prop=="float"){prop="cssFloat"}if(v=el.style[prop]){return v}if(cs=view.getComputedStyle(el,"")){if(!(camel=propCache[prop])){camel=propCache[prop]=prop.replace(camelRe,camelFn)}return cs[camel]}return null}:function(prop){var el=this.dom,v,cs,camel;if(prop=="opacity"){if(typeof el.style.filter=="string"){var m=el.style.filter.match(/alpha\(opacity=(.*)\)/i);if(m){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0}}}return 1}else{if(prop=="float"){prop="styleFloat"}}if(!(camel=propCache[prop])){camel=propCache[prop]=prop.replace(camelRe,camelFn)}if(v=el.style[camel]){return v}if(cs=el.currentStyle){return cs[camel]}return null}}(),setStyle:function(prop,value){if(typeof prop=="string"){var camel;if(!(camel=propCache[prop])){camel=propCache[prop]=prop.replace(camelRe,camelFn)}if(camel=="opacity"){this.setOpacity(value)}else{this.dom.style[camel]=value}}else{for(var style in prop){if(typeof prop[style]!="function"){this.setStyle(style,prop[style])}}}return this},applyStyles:function(style){Ext.DomHelper.applyStyles(this.dom,style);return this},getX:function(){return D.getX(this.dom)},getY:function(){return D.getY(this.dom)},getXY:function(){return D.getXY(this.dom)},getOffsetsTo:function(el){var o=this.getXY();var e=Ext.fly(el,"_internal").getXY();return[o[0]-e[0],o[1]-e[1]]},setX:function(x,animate){if(!animate||!A){D.setX(this.dom,x)}else{this.setXY([x,this.getY()],this.preanim(arguments,1))}return this},setY:function(y,animate){if(!animate||!A){D.setY(this.dom,y)}else{this.setXY([this.getX(),y],this.preanim(arguments,1))}return this},setLeft:function(left){this.setStyle("left",this.addUnits(left));return this},setTop:function(top){this.setStyle("top",this.addUnits(top));return this},setRight:function(right){this.setStyle("right",this.addUnits(right));return this},setBottom:function(bottom){this.setStyle("bottom",this.addUnits(bottom));return this},setXY:function(pos,animate){if(!animate||!A){D.setXY(this.dom,pos)}else{this.anim({points:{to:pos}},this.preanim(arguments,1),"motion")}return this},setLocation:function(x,y,animate){this.setXY([x,y],this.preanim(arguments,2));return this},moveTo:function(x,y,animate){this.setXY([x,y],this.preanim(arguments,2));return this},getRegion:function(){return D.getRegion(this.dom)},getHeight:function(contentHeight){var h=this.dom.offsetHeight||0;h=contentHeight!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");return h<0?0:h},getWidth:function(contentWidth){var w=this.dom.offsetWidth||0;w=contentWidth!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr");return w<0?0:w},getComputedHeight:function(){var h=Math.max(this.dom.offsetHeight,this.dom.clientHeight);if(!h){h=parseInt(this.getStyle("height"),10)||0;if(!this.isBorderBox()){h+=this.getFrameWidth("tb")}}return h},getComputedWidth:function(){var w=Math.max(this.dom.offsetWidth,this.dom.clientWidth);if(!w){w=parseInt(this.getStyle("width"),10)||0;if(!this.isBorderBox()){w+=this.getFrameWidth("lr")}}return w},getSize:function(contentSize){return{width:this.getWidth(contentSize),height:this.getHeight(contentSize)}},getStyleSize:function(){var w,h,d=this.dom,s=d.style;if(s.width&&s.width!="auto"){w=parseInt(s.width,10);if(Ext.isBorderBox){w-=this.getFrameWidth("lr")}}if(s.height&&s.height!="auto"){h=parseInt(s.height,10);if(Ext.isBorderBox){h-=this.getFrameWidth("tb")}}return{width:w||this.getWidth(true),height:h||this.getHeight(true)}},getViewSize:function(){var d=this.dom,doc=document,aw=0,ah=0;if(d==doc||d==doc.body){return{width:D.getViewWidth(),height:D.getViewHeight()}}else{return{width:d.clientWidth,height:d.clientHeight}}},getValue:function(asNumber){return asNumber?parseInt(this.dom.value,10):this.dom.value},adjustWidth:function(width){if(typeof width=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){width-=(this.getBorderWidth("lr")+this.getPadding("lr"))}if(width<0){width=0}}return width},adjustHeight:function(height){if(typeof height=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){height-=(this.getBorderWidth("tb")+this.getPadding("tb"))}if(height<0){height=0}}return height},setWidth:function(width,animate){width=this.adjustWidth(width);if(!animate||!A){this.dom.style.width=this.addUnits(width)}else{this.anim({width:{to:width}},this.preanim(arguments,1))}return this},setHeight:function(height,animate){height=this.adjustHeight(height);if(!animate||!A){this.dom.style.height=this.addUnits(height)}else{this.anim({height:{to:height}},this.preanim(arguments,1))}return this},setSize:function(width,height,animate){if(typeof width=="object"){height=width.height;width=width.width}width=this.adjustWidth(width);height=this.adjustHeight(height);if(!animate||!A){this.dom.style.width=this.addUnits(width);this.dom.style.height=this.addUnits(height)}else{this.anim({width:{to:width},height:{to:height}},this.preanim(arguments,2))}return this},setBounds:function(x,y,width,height,animate){if(!animate||!A){this.setSize(width,height);this.setLocation(x,y)}else{width=this.adjustWidth(width);height=this.adjustHeight(height);this.anim({points:{to:[x,y]},width:{to:width},height:{to:height}},this.preanim(arguments,4),"motion")}return this},setRegion:function(region,animate){this.setBounds(region.left,region.top,region.right-region.left,region.bottom-region.top,this.preanim(arguments,1));return this},addListener:function(eventName,fn,scope,options){Ext.EventManager.on(this.dom,eventName,fn,scope||this,options)},removeListener:function(eventName,fn,scope){Ext.EventManager.removeListener(this.dom,eventName,fn,scope||this);return this},removeAllListeners:function(){Ext.EventManager.removeAll(this.dom);return this},relayEvent:function(eventName,observable){this.on(eventName,function(e){observable.fireEvent(eventName,e)})},setOpacity:function(opacity,animate){if(!animate||!A){var s=this.dom.style;if(Ext.isIE){s.zoom=1;s.filter=(s.filter||"").replace(/alpha\([^\)]*\)/gi,"")+(opacity==1?"":" alpha(opacity="+opacity*100+")")}else{s.opacity=opacity}}else{this.anim({opacity:{to:opacity}},this.preanim(arguments,1),null,0.35,"easeIn")}return this},getLeft:function(local){if(!local){return this.getX()}else{return parseInt(this.getStyle("left"),10)||0}},getRight:function(local){if(!local){return this.getX()+this.getWidth()}else{return(this.getLeft(true)+this.getWidth())||0}},getTop:function(local){if(!local){return this.getY()}else{return parseInt(this.getStyle("top"),10)||0}},getBottom:function(local){if(!local){return this.getY()+this.getHeight()}else{return(this.getTop(true)+this.getHeight())||0}},position:function(pos,zIndex,x,y){if(!pos){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}}else{this.setStyle("position",pos)}if(zIndex){this.setStyle("z-index",zIndex)}if(x!==undefined&&y!==undefined){this.setXY([x,y])}else{if(x!==undefined){this.setX(x)}else{if(y!==undefined){this.setY(y)}}}},clearPositioning:function(value){value=value||"";this.setStyle({"left":value,"right":value,"top":value,"bottom":value,"z-index":"","position":"static"});return this},getPositioning:function(){var l=this.getStyle("left");var t=this.getStyle("top");return{"position":this.getStyle("position"),"left":l,"right":l?"":this.getStyle("right"),"top":t,"bottom":t?"":this.getStyle("bottom"),"z-index":this.getStyle("z-index")}},getBorderWidth:function(side){return this.addStyles(side,El.borders)},getPadding:function(side){return this.addStyles(side,El.paddings)},setPositioning:function(pc){this.applyStyles(pc);if(pc.right=="auto"){this.dom.style.right=""}if(pc.bottom=="auto"){this.dom.style.bottom=""}return this},fixDisplay:function(){if(this.getStyle("display")=="none"){this.setStyle("visibility","hidden");this.setStyle("display",this.originalDisplay);if(this.getStyle("display")=="none"){this.setStyle("display","block")}}},setOverflow:function(v){if(v=="auto"&&Ext.isMac&&Ext.isGecko2){this.dom.style.overflow="hidden";(function(){this.dom.style.overflow="auto"}).defer(1,this)}else{this.dom.style.overflow=v}},setLeftTop:function(left,top){this.dom.style.left=this.addUnits(left);this.dom.style.top=this.addUnits(top);return this},move:function(direction,distance,animate){var xy=this.getXY();direction=direction.toLowerCase();switch(direction){case"l":case"left":this.moveTo(xy[0]-distance,xy[1],this.preanim(arguments,2));break;case"r":case"right":this.moveTo(xy[0]+distance,xy[1],this.preanim(arguments,2));break;case"t":case"top":case"up":this.moveTo(xy[0],xy[1]-distance,this.preanim(arguments,2));break;case"b":case"bottom":case"down":this.moveTo(xy[0],xy[1]+distance,this.preanim(arguments,2));break}return this},clip:function(){if(!this.isClipped){this.isClipped=true;this.originalClip={"o":this.getStyle("overflow"),"x":this.getStyle("overflow-x"),"y":this.getStyle("overflow-y")};this.setStyle("overflow","hidden");this.setStyle("overflow-x","hidden");this.setStyle("overflow-y","hidden")}return this},unclip:function(){if(this.isClipped){this.isClipped=false;var o=this.originalClip;if(o.o){this.setStyle("overflow",o.o)}if(o.x){this.setStyle("overflow-x",o.x)}if(o.y){this.setStyle("overflow-y",o.y)}}return this},getAnchorXY:function(anchor,local,s){var w,h,vp=false;if(!s){var d=this.dom;if(d==document.body||d==document){vp=true;w=D.getViewWidth();h=D.getViewHeight()}else{w=this.getWidth();h=this.getHeight()}}else{w=s.width;h=s.height}var x=0,y=0,r=Math.round;switch((anchor||"tl").toLowerCase()){case"c":x=r(w*0.5);y=r(h*0.5);break;case"t":x=r(w*0.5);y=0;break;case"l":x=0;y=r(h*0.5);break;case"r":x=w;y=r(h*0.5);break;case"b":x=r(w*0.5);y=h;break;case"tl":x=0;y=0;break;case"bl":x=0;y=h;break;case"br":x=w;y=h;break;case"tr":x=w;y=0;break}if(local===true){return[x,y]}if(vp){var sc=this.getScroll();return[x+sc.left,y+sc.top]}var o=this.getXY();return[x+o[0],y+o[1]]},getAlignToXY:function(el,p,o){el=Ext.get(el);if(!el||!el.dom){throw"Element.alignToXY with an element that doesn't exist"}var d=this.dom;var c=false;var p1="",p2="";o=o||[0,0];if(!p){p="tl-bl"}else{if(p=="?"){p="tl-bl?"}else{if(p.indexOf("-")==-1){p="tl-"+p}}}p=p.toLowerCase();var m=p.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!m){throw"Element.alignTo with an invalid alignment "+p}p1=m[1];p2=m[2];c=!!m[3];var a1=this.getAnchorXY(p1,true);var a2=el.getAnchorXY(p2,false);var x=a2[0]-a1[0]+o[0];var y=a2[1]-a1[1]+o[1];if(c){var w=this.getWidth(),h=this.getHeight(),r=el.getRegion();var dw=D.getViewWidth()-5,dh=D.getViewHeight()-5;var p1y=p1.charAt(0),p1x=p1.charAt(p1.length-1);var p2y=p2.charAt(0),p2x=p2.charAt(p2.length-1);var swapY=((p1y=="t"&&p2y=="b")||(p1y=="b"&&p2y=="t"));var swapX=((p1x=="r"&&p2x=="l")||(p1x=="l"&&p2x=="r"));var doc=document;var scrollX=(doc.documentElement.scrollLeft||doc.body.scrollLeft||0)+5;var scrollY=(doc.documentElement.scrollTop||doc.body.scrollTop||0)+5;if((x+w)>dw+scrollX){x=swapX?r.left-w:dw+scrollX-w}if(x<scrollX){x=swapX?r.right:scrollX}if((y+h)>dh+scrollY){y=swapY?r.top-h:dh+scrollY-h}if(y<scrollY){y=swapY?r.bottom:scrollY}}return[x,y]},getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,local,offsets,proposedXY){el=Ext.get(el);offsets=offsets?Ext.applyIf(offsets,os):os;var vw,vh,vx=0,vy=0;if(el.dom==document.body||el.dom==document){vw=Ext.lib.Dom.getViewWidth();vh=Ext.lib.Dom.getViewHeight()}else{vw=el.dom.clientWidth;vh=el.dom.clientHeight;if(!local){var vxy=el.getXY();vx=vxy[0];vy=vxy[1]}}var s=el.getScroll();vx+=offsets.left+s.left;vy+=offsets.top+s.top;vw-=offsets.right;vh-=offsets.bottom;var vr=vx+vw;var vb=vy+vh;var xy=proposedXY||(!local?this.getXY():[this.getLeft(true),this.getTop(true)]);var x=xy[0],y=xy[1];var w=this.dom.offsetWidth,h=this.dom.offsetHeight;var moved=false;if((x+w)>vr){x=vr-w;moved=true}if((y+h)>vb){y=vb-h;moved=true}if(x<vx){x=vx;moved=true}if(y<vy){y=vy;moved=true}return moved?[x,y]:false}}(),adjustForConstraints:function(xy,parent,offsets){return this.getConstrainToXY(parent||document,false,offsets,xy)||xy},alignTo:function(element,position,offsets,animate){var xy=this.getAlignToXY(element,position,offsets);this.setXY(xy,this.preanim(arguments,3));return this},anchorTo:function(el,alignment,offsets,animate,monitorScroll,callback){var action=function(){this.alignTo(el,alignment,offsets,animate);Ext.callback(callback,this)};Ext.EventManager.onWindowResize(action,this);var tm=typeof monitorScroll;if(tm!="undefined"){Ext.EventManager.on(window,"scroll",action,this,{buffer:tm=="number"?monitorScroll:50})}action.call(this);return this},clearOpacity:function(){if(window.ActiveXObject){if(typeof this.dom.style.filter=="string"&&(/alpha/i).test(this.dom.style.filter)){this.dom.style.filter=""}}else{this.dom.style.opacity="";this.dom.style["-moz-opacity"]="";this.dom.style["-khtml-opacity"]=""}return this},hide:function(animate){this.setVisible(false,this.preanim(arguments,0));return this},show:function(animate){this.setVisible(true,this.preanim(arguments,0));return this},addUnits:function(size){return Ext.Element.addUnits(size,this.defaultUnit)},update:function(html,loadScripts,callback){if(typeof html=="undefined"){html=""}if(loadScripts!==true){this.dom.innerHTML=html;if(typeof callback=="function"){callback()}return this}var id=Ext.id();var dom=this.dom;html+="<span id=\""+id+"\"></span>";E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var srcRe=/\ssrc=([\'\"])(.*?)\1/i;var typeRe=/\stype=([\'\"])(.*?)\1/i;var match;while(match=re.exec(html)){var attrs=match[1];var srcMatch=attrs?attrs.match(srcRe):false;if(srcMatch&&srcMatch[2]){var s=document.createElement("script");s.src=srcMatch[2];var typeMatch=attrs.match(typeRe);if(typeMatch&&typeMatch[2]){s.type=typeMatch[2]}hd.appendChild(s)}else{if(match[2]&&match[2].length>0){if(window.execScript){window.execScript(match[2])}else{window.eval(match[2])}}}}var el=document.getElementById(id);if(el){Ext.removeNode(el)}if(typeof callback=="function"){callback()}});dom.innerHTML=html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this},load:function(){var um=this.getUpdater();um.update.apply(um,arguments);return this},getUpdater:function(){if(!this.updateManager){this.updateManager=new Ext.Updater(this)}return this.updateManager},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this},getCenterXY:function(){return this.getAlignToXY(document,"c-c")},center:function(centerIn){this.alignTo(centerIn||document,"c-c");return this},isBorderBox:function(){return noBoxAdjust[this.dom.tagName.toLowerCase()]||Ext.isBorderBox},getBox:function(contentBox,local){var xy;if(!local){xy=this.getXY()}else{var left=parseInt(this.getStyle("left"),10)||0;var top=parseInt(this.getStyle("top"),10)||0;xy=[left,top]}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!contentBox){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h}}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)}}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx},getFrameWidth:function(sides,onlyContentBox){return onlyContentBox&&Ext.isBorderBox?0:(this.getPadding(sides)+this.getBorderWidth(sides))},setBox:function(box,adjust,animate){var w=box.width,h=box.height;if((adjust&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"))}this.setBounds(box.x,box.y,w,h,this.preanim(arguments,2));return this},repaint:function(){var dom=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.get(dom).removeClass("x-repaint")},1);return this},getMargins:function(side){if(!side){return{top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0}}else{return this.addStyles(side,El.margins)}},addStyles:function(sides,styles){var val=0,v,w;for(var i=0,len=sides.length;i<len;i++){v=this.getStyle(styles[sides.charAt(i)]);if(v){w=parseInt(v,10);if(w){val+=(w>=0?w:-1*w)}}}return val},createProxy:function(config,renderTo,matchBox){config=typeof config=="object"?config:{tag:"div",cls:config};var proxy;if(renderTo){proxy=Ext.DomHelper.append(renderTo,config,true)}else{proxy=Ext.DomHelper.insertBefore(this.dom,config,true)}if(matchBox){proxy.setBox(this.getBox())}return proxy},mask:function(msg,msgCls){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}if(this._maskMsg){this._maskMsg.remove()}if(this._mask){this._mask.remove()}this._mask=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask"},true);this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof msg=="string"){this._maskMsg=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask-msg",cn:{tag:"div"}},true);var mm=this._maskMsg;mm.dom.className=msgCls?"ext-el-mask-msg "+msgCls:"ext-el-mask-msg";mm.dom.firstChild.innerHTML=msg;mm.setDisplayed(true);mm.center(this)}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this.getStyle("height")=="auto"){this._mask.setSize(this.dom.clientWidth,this.getHeight())}return this._mask},unmask:function(){if(this._mask){if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg}this._mask.remove();delete this._mask}this.removeClass("x-masked")},isMasked:function(){return this._mask&&this._mask.isVisible()},createShim:function(){var el=document.createElement("iframe");el.frameBorder="0";el.className="ext-shim";if(Ext.isIE&&Ext.isSecure){el.src=Ext.SSL_SECURE_URL}var shim=Ext.get(this.dom.parentNode.insertBefore(el,this.dom));shim.autoBoxAdjust=false;return shim},remove:function(){Ext.removeNode(this.dom);delete El.cache[this.dom.id]},hover:function(overFn,outFn,scope){var preOverFn=function(e){if(!e.within(this,true)){overFn.apply(scope||this,arguments)}};var preOutFn=function(e){if(!e.within(this,true)){outFn.apply(scope||this,arguments)}};this.on("mouseover",preOverFn,this.dom);this.on("mouseout",preOutFn,this.dom);return this},addClassOnOver:function(className){this.hover(function(){Ext.fly(this,"_internal").addClass(className)},function(){Ext.fly(this,"_internal").removeClass(className)});return this},addClassOnFocus:function(className){this.on("focus",function(){Ext.fly(this,"_internal").addClass(className)},this.dom);this.on("blur",function(){Ext.fly(this,"_internal").removeClass(className)},this.dom);return this},addClassOnClick:function(className){var dom=this.dom;this.on("mousedown",function(){Ext.fly(dom,"_internal").addClass(className);var d=Ext.getDoc();var fn=function(){Ext.fly(dom,"_internal").removeClass(className);d.removeListener("mouseup",fn)};d.on("mouseup",fn)});return this},swallowEvent:function(eventName,preventDefault){var fn=function(e){e.stopPropagation();if(preventDefault){e.preventDefault()}};if(Ext.isArray(eventName)){for(var i=0,len=eventName.length;i<len;i++){this.on(eventName[i],fn)}return this}this.on(eventName,fn);return this},parent:function(selector,returnDom){return this.matchNode("parentNode","parentNode",selector,returnDom)},next:function(selector,returnDom){return this.matchNode("nextSibling","nextSibling",selector,returnDom)},prev:function(selector,returnDom){return this.matchNode("previousSibling","previousSibling",selector,returnDom)},first:function(selector,returnDom){return this.matchNode("nextSibling","firstChild",selector,returnDom)},last:function(selector,returnDom){return this.matchNode("previousSibling","lastChild",selector,returnDom)},matchNode:function(dir,start,selector,returnDom){var n=this.dom[start];while(n){if(n.nodeType==1&&(!selector||Ext.DomQuery.is(n,selector))){return !returnDom?Ext.get(n):n}n=n[dir]}return null},appendChild:function(el){el=Ext.get(el);el.appendTo(this);return this},createChild:function(config,insertBefore,returnDom){config=config||{tag:"div"};if(insertBefore){return Ext.DomHelper.insertBefore(insertBefore,config,returnDom!==true)}return Ext.DomHelper[!this.dom.firstChild?"overwrite":"append"](this.dom,config,returnDom!==true)},appendTo:function(el){el=Ext.getDom(el);el.appendChild(this.dom);return this},insertBefore:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el);return this},insertAfter:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el.nextSibling);return this},insertFirst:function(el,returnDom){el=el||{};if(typeof el=="object"&&!el.nodeType&&!el.dom){return this.createChild(el,this.dom.firstChild,returnDom)}else{el=Ext.getDom(el);this.dom.insertBefore(el,this.dom.firstChild);return !returnDom?Ext.get(el):el}},insertSibling:function(el,where,returnDom){var rt;if(Ext.isArray(el)){for(var i=0,len=el.length;i<len;i++){rt=this.insertSibling(el[i],where,returnDom)}return rt}where=where?where.toLowerCase():"before";el=el||{};var refNode=where=="before"?this.dom:this.dom.nextSibling;if(typeof el=="object"&&!el.nodeType&&!el.dom){if(where=="after"&&!this.dom.nextSibling){rt=Ext.DomHelper.append(this.dom.parentNode,el,!returnDom)}else{rt=Ext.DomHelper[where=="after"?"insertAfter":"insertBefore"](this.dom,el,!returnDom)}}else{rt=this.dom.parentNode.insertBefore(Ext.getDom(el),refNode);if(!returnDom){rt=Ext.get(rt)}}return rt},wrap:function(config,returnDom){if(!config){config={tag:"div"}}var newEl=Ext.DomHelper.insertBefore(this.dom,config,!returnDom);newEl.dom?newEl.dom.appendChild(this.dom):newEl.appendChild(this.dom);return newEl},replace:function(el){el=Ext.get(el);this.insertBefore(el);el.remove();return this},replaceWith:function(el){if(typeof el=="object"&&!el.nodeType&&!el.dom){el=this.insertSibling(el,"before")}else{el=Ext.getDom(el);this.dom.parentNode.insertBefore(el,this.dom)}El.uncache(this.id);this.dom.parentNode.removeChild(this.dom);this.dom=el;this.id=Ext.id(el);El.cache[this.id]=this;return this},insertHtml:function(where,html,returnEl){var el=Ext.DomHelper.insertHtml(where,this.dom,html);return returnEl?Ext.get(el):el},set:function(o,useSet){var el=this.dom;useSet=typeof useSet=="undefined"?(el.setAttribute?true:false):useSet;for(var attr in o){if(attr=="style"||typeof o[attr]=="function"){continue}if(attr=="cls"){el.className=o["cls"]}else{if(o.hasOwnProperty(attr)){if(useSet){el.setAttribute(attr,o[attr])}else{el[attr]=o[attr]}}}}if(o.style){Ext.DomHelper.applyStyles(el,o.style)}return this},addKeyListener:function(key,fn,scope){var config;if(typeof key!="object"||Ext.isArray(key)){config={key:key,fn:fn,scope:scope}}else{config={key:key.key,shift:key.shift,ctrl:key.ctrl,alt:key.alt,fn:fn,scope:scope}}return new Ext.KeyMap(this,config)},addKeyMap:function(config){return new Ext.KeyMap(this,config)},isScrollable:function(){var dom=this.dom;return dom.scrollHeight>dom.clientHeight||dom.scrollWidth>dom.clientWidth},scrollTo:function(side,value,animate){var prop=side.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!animate||!A){this.dom[prop]=value}else{var to=prop=="scrollLeft"?[value,this.dom.scrollTop]:[this.dom.scrollLeft,value];this.anim({scroll:{"to":to}},this.preanim(arguments,2),"scroll")}return this},scroll:function(direction,distance,animate){if(!this.isScrollable()){return }var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;direction=direction.toLowerCase();var scrolled=false;var a=this.preanim(arguments,2);switch(direction){case"l":case"left":if(w-l>cw){var v=Math.min(l+distance,w-cw);this.scrollTo("left",v,a);scrolled=true}break;case"r":case"right":if(l>0){var v=Math.max(l-distance,0);this.scrollTo("left",v,a);scrolled=true}break;case"t":case"top":case"up":if(t>0){var v=Math.max(t-distance,0);this.scrollTo("top",v,a);scrolled=true}break;case"b":case"bottom":case"down":if(h-t>ch){var v=Math.min(t+distance,h-ch);this.scrollTo("top",v,a);scrolled=true}break}return scrolled},translatePoints:function(x,y){if(typeof x=="object"||Ext.isArray(x)){y=x[1];x=x[0]}var p=this.getStyle("position");var o=this.getXY();var l=parseInt(this.getStyle("left"),10);var t=parseInt(this.getStyle("top"),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop}return{left:(x-o[0]+l),top:(y-o[1]+t)}},getScroll:function(){var d=this.dom,doc=document;if(d==doc||d==doc.body){var l,t;if(Ext.isIE&&Ext.isStrict){l=doc.documentElement.scrollLeft||(doc.body.scrollLeft||0);t=doc.documentElement.scrollTop||(doc.body.scrollTop||0)}else{l=window.pageXOffset||(doc.body.scrollLeft||0);t=window.pageYOffset||(doc.body.scrollTop||0)}return{left:l,top:t}}else{return{left:d.scrollLeft,top:d.scrollTop}}},getColor:function(attr,defaultValue,prefix){var v=this.getStyle(attr);if(!v||v=="transparent"||v=="inherit"){return defaultValue}var color=typeof prefix=="undefined"?"#":prefix;if(v.substr(0,4)=="rgb("){var rvs=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(rvs[i]);var s=h.toString(16);if(h<16){s="0"+s}color+=s}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);color+=c+c}}else{if(v.length==7){color+=v.substr(1)}}}}return(color.length>5?color.toLowerCase():defaultValue)},boxWrap:function(cls){cls=cls||"x-box";var el=Ext.get(this.insertHtml("beforeBegin",String.format("<div class=\"{0}\">"+El.boxMarkup+"</div>",cls)));el.child("."+cls+"-mc").dom.appendChild(this.dom);return el},getAttributeNS:Ext.isIE?function(ns,name){var d=this.dom;var type=typeof d[ns+":"+name];if(type!="undefined"&&type!="unknown"){return d[ns+":"+name]}return d[name]}:function(ns,name){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name]},getTextWidth:function(text,min,max){return(Ext.util.TextMetrics.measure(this.dom,Ext.value(text,this.dom.innerHTML,true)).width).constrain(min||0,max||1000000)}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.getUpdateManager=ep.getUpdater;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,defaultUnit){if(v===""||v=="auto"){return v}if(v===undefined){return""}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(defaultUnit||"px")}return v};El.boxMarkup="<div class=\"{0}-tl\"><div class=\"{0}-tr\"><div class=\"{0}-tc\"></div></div></div><div class=\"{0}-ml\"><div class=\"{0}-mr\"><div class=\"{0}-mc\"></div></div></div><div class=\"{0}-bl\"><div class=\"{0}-br\"><div class=\"{0}-bc\"></div></div></div>";El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var docEl;El.get=function(el){var ex,elm,id;if(!el){return null}if(typeof el=="string"){if(!(elm=document.getElementById(el))){return null}if(ex=El.cache[el]){ex.dom=elm}else{ex=El.cache[el]=new El(elm)}return ex}else{if(el.tagName){if(!(id=el.id)){id=Ext.id(el)}if(ex=El.cache[id]){ex.dom=el}else{ex=El.cache[id]=new El(el)}return ex}else{if(el instanceof El){if(el!=docEl){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el}return el}else{if(el.isComposite){return el}else{if(Ext.isArray(el)){return El.select(el)}else{if(el==document){if(!docEl){var f=function(){};f.prototype=El.prototype;docEl=new f();docEl.dom=document}return docEl}}}}}}return null};El.uncache=function(el){for(var i=0,a=arguments,len=a.length;i<len;i++){if(a[i]){delete El.cache[a[i].id||a[i]]}}};El.garbageCollect=function(){if(!Ext.enableGarbageCollector){clearInterval(El.collectorThread);return }for(var eid in El.cache){var el=El.cache[eid],d=el.dom;if(!d||!d.parentNode||(!d.offsetParent&&!document.getElementById(eid))){delete El.cache[eid];if(d&&Ext.enableListenerCollection){Ext.EventManager.removeAll(d)}}}};El.collectorThreadId=setInterval(El.garbageCollect,30000);var flyFn=function(){};flyFn.prototype=El.prototype;var _cls=new flyFn();El.Flyweight=function(dom){this.dom=dom};El.Flyweight.prototype=_cls;El.Flyweight.prototype.isFlyweight=true;El._flyweights={};El.fly=function(el,named){named=named||"_global";el=Ext.getDom(el);if(!el){return null}if(!El._flyweights[named]){El._flyweights[named]=new El.Flyweight()}El._flyweights[named].dom=el;return El._flyweights[named]};Ext.get=El.get;Ext.fly=El.fly;var noBoxAdjust=Ext.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Ext.isIE||Ext.isGecko){noBoxAdjust["button"]=1}Ext.EventManager.on(window,"unload",function(){delete El.cache;delete El._flyweights})})();
+Ext.enableFx=true;Ext.Fx={slideIn:function(A,C){var B=this.getFxEl();C=C||{};B.queueFx(C,function(){A=A||"t";this.fixDisplay();var D=this.getFxRestore();var I=this.getBox();this.setSize(I);var F=this.fxWrap(D.pos,C,"hidden");var K=this.dom.style;K.visibility="visible";K.position="absolute";var E=function(){B.fxUnwrap(F,D.pos,C);K.width=D.width;K.height=D.height;B.afterFx(C)};var J,L={to:[I.x,I.y]},H={to:I.width},G={to:I.height};switch(A.toLowerCase()){case"t":F.setSize(I.width,0);K.left=K.bottom="0";J={height:G};break;case"l":F.setSize(0,I.height);K.right=K.top="0";J={width:H};break;case"r":F.setSize(0,I.height);F.setX(I.right);K.left=K.top="0";J={width:H,points:L};break;case"b":F.setSize(I.width,0);F.setY(I.bottom);K.left=K.top="0";J={height:G,points:L};break;case"tl":F.setSize(0,0);K.right=K.bottom="0";J={width:H,height:G};break;case"bl":F.setSize(0,0);F.setY(I.y+I.height);K.right=K.top="0";J={width:H,height:G,points:L};break;case"br":F.setSize(0,0);F.setXY([I.right,I.bottom]);K.left=K.top="0";J={width:H,height:G,points:L};break;case"tr":F.setSize(0,0);F.setX(I.x+I.width);K.left=K.bottom="0";J={width:H,height:G,points:L};break}this.dom.style.visibility="visible";F.show();arguments.callee.anim=F.fxanim(J,C,"motion",0.5,"easeOut",E)});return this},slideOut:function(A,C){var B=this.getFxEl();C=C||{};B.queueFx(C,function(){A=A||"t";var I=this.getFxRestore();var D=this.getBox();this.setSize(D);var G=this.fxWrap(I.pos,C,"visible");var F=this.dom.style;F.visibility="visible";F.position="absolute";G.setSize(D);var J=function(){if(C.useDisplay){B.setDisplayed(false)}else{B.hide()}B.fxUnwrap(G,I.pos,C);F.width=I.width;F.height=I.height;B.afterFx(C)};var E,H={to:0};switch(A.toLowerCase()){case"t":F.left=F.bottom="0";E={height:H};break;case"l":F.right=F.top="0";E={width:H};break;case"r":F.left=F.top="0";E={width:H,points:{to:[D.right,D.y]}};break;case"b":F.left=F.top="0";E={height:H,points:{to:[D.x,D.bottom]}};break;case"tl":F.right=F.bottom="0";E={width:H,height:H};break;case"bl":F.right=F.top="0";E={width:H,height:H,points:{to:[D.x,D.bottom]}};break;case"br":F.left=F.top="0";E={width:H,height:H,points:{to:[D.x+D.width,D.bottom]}};break;case"tr":F.left=F.bottom="0";E={width:H,height:H,points:{to:[D.right,D.y]}};break}arguments.callee.anim=G.fxanim(E,C,"motion",0.5,"easeOut",J)});return this},puff:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){this.clearOpacity();this.show();var F=this.getFxRestore();var D=this.dom.style;var G=function(){if(B.useDisplay){A.setDisplayed(false)}else{A.hide()}A.clearOpacity();A.setPositioning(F.pos);D.width=F.width;D.height=F.height;D.fontSize="";A.afterFx(B)};var E=this.getWidth();var C=this.getHeight();arguments.callee.anim=this.fxanim({width:{to:this.adjustWidth(E*2)},height:{to:this.adjustHeight(C*2)},points:{by:[-(E*0.5),-(C*0.5)]},opacity:{to:0},fontSize:{to:200,unit:"%"}},B,"motion",0.5,"easeOut",G)});return this},switchOff:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){this.clearOpacity();this.clip();var D=this.getFxRestore();var C=this.dom.style;var E=function(){if(B.useDisplay){A.setDisplayed(false)}else{A.hide()}A.clearOpacity();A.setPositioning(D.pos);C.width=D.width;C.height=D.height;A.afterFx(B)};this.fxanim({opacity:{to:0.3}},null,null,0.1,null,function(){this.clearOpacity();(function(){this.fxanim({height:{to:1},points:{by:[0,this.getHeight()*0.5]}},B,"motion",0.3,"easeIn",E)}).defer(100,this)})});return this},highlight:function(A,C){var B=this.getFxEl();C=C||{};B.queueFx(C,function(){A=A||"ffff9c";var D=C.attr||"backgroundColor";this.clearOpacity();this.show();var G=this.getColor(D);var H=this.dom.style[D];var F=(C.endColor||G)||"ffffff";var I=function(){B.dom.style[D]=H;B.afterFx(C)};var E={};E[D]={from:A,to:F};arguments.callee.anim=this.fxanim(E,C,"color",1,"easeIn",I)});return this},frame:function(A,C,D){var B=this.getFxEl();D=D||{};B.queueFx(D,function(){A=A||"#C3DAF9";if(A.length==6){A="#"+A}C=C||1;var G=D.duration||1;this.show();var E=this.getBox();var F=function(){var H=Ext.getBody().createChild({style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+A}});var I=Ext.isBorderBox?2:1;H.animate({top:{from:E.y,to:E.y-20},left:{from:E.x,to:E.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:E.height,to:(E.height+(20*I))},width:{from:E.width,to:(E.width+(20*I))}},G,function(){H.remove();if(--C>0){F()}else{B.afterFx(D)}})};F.call(this)});return this},pause:function(C){var A=this.getFxEl();var B={};A.queueFx(B,function(){setTimeout(function(){A.afterFx(B)},C*1000)});return this},fadeIn:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility="visible";var C=B.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:C}},B,null,0.5,"easeOut",function(){if(C==1){this.clearOpacity()}A.afterFx(B)})});return this},fadeOut:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){arguments.callee.anim=this.fxanim({opacity:{to:B.endOpacity||0}},B,null,0.5,"easeOut",function(){if(this.visibilityMode==Ext.Element.DISPLAY||B.useDisplay){this.dom.style.display="none"}else{this.dom.style.visibility="hidden"}this.clearOpacity();A.afterFx(B)})});return this},scale:function(A,B,C){this.shift(Ext.apply({},C,{width:A,height:B}));return this},shift:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){var E={},D=B.width,F=B.height,C=B.x,H=B.y,G=B.opacity;if(D!==undefined){E.width={to:this.adjustWidth(D)}}if(F!==undefined){E.height={to:this.adjustHeight(F)}}if(B.left!==undefined){E.left={to:B.left}}if(B.top!==undefined){E.top={to:B.top}}if(B.right!==undefined){E.right={to:B.right}}if(B.bottom!==undefined){E.bottom={to:B.bottom}}if(C!==undefined||H!==undefined){E.points={to:[C!==undefined?C:this.getX(),H!==undefined?H:this.getY()]}}if(G!==undefined){E.opacity={to:G}}if(B.xy!==undefined){E.points={to:B.xy}}arguments.callee.anim=this.fxanim(E,B,"motion",0.35,"easeOut",function(){A.afterFx(B)})});return this},ghost:function(A,C){var B=this.getFxEl();C=C||{};B.queueFx(C,function(){A=A||"b";var H=this.getFxRestore();var E=this.getWidth(),G=this.getHeight();var F=this.dom.style;var J=function(){if(C.useDisplay){B.setDisplayed(false)}else{B.hide()}B.clearOpacity();B.setPositioning(H.pos);F.width=H.width;F.height=H.height;B.afterFx(C)};var D={opacity:{to:0},points:{}},I=D.points;switch(A.toLowerCase()){case"t":I.by=[0,-G];break;case"l":I.by=[-E,0];break;case"r":I.by=[E,0];break;case"b":I.by=[0,G];break;case"tl":I.by=[-E,-G];break;case"bl":I.by=[-E,G];break;case"br":I.by=[E,G];break;case"tr":I.by=[E,-G];break}arguments.callee.anim=this.fxanim(D,C,"motion",0.5,"easeOut",J)});return this},syncFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this},sequenceFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:false,stopFx:false});return this},nextFx:function(){var A=this.fxQueue[0];if(A){A.call(this)}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0]},stopFx:function(){if(this.hasActiveFx()){var A=this.fxQueue[0];if(A&&A.anim&&A.anim.isAnimated()){this.fxQueue=[A];A.anim.stop(true)}}return this},beforeFx:function(A){if(this.hasActiveFx()&&!A.concurrent){if(A.stopFx){this.stopFx();return true}return false}return true},hasFxBlock:function(){var A=this.fxQueue;return A&&A[0]&&A[0].block},queueFx:function(C,A){if(!this.fxQueue){this.fxQueue=[]}if(!this.hasFxBlock()){Ext.applyIf(C,this.fxDefaults);if(!C.concurrent){var B=this.beforeFx(C);A.block=C.block;this.fxQueue.push(A);if(B){this.nextFx()}}else{A.call(this)}}return this},fxWrap:function(F,D,C){var B;if(!D.wrap||!(B=Ext.get(D.wrap))){var A;if(D.fixPosition){A=this.getXY()}var E=document.createElement("div");E.style.visibility=C;B=Ext.get(this.dom.parentNode.insertBefore(E,this.dom));B.setPositioning(F);if(B.getStyle("position")=="static"){B.position("relative")}this.clearPositioning("auto");B.clip();B.dom.appendChild(this.dom);if(A){B.setXY(A)}}return B},fxUnwrap:function(A,C,B){this.clearPositioning();this.setPositioning(C);if(!B.wrap){A.dom.parentNode.insertBefore(this.dom,A.dom);A.remove()}},getFxRestore:function(){var A=this.dom.style;return{pos:this.getPositioning(),width:A.width,height:A.height}},afterFx:function(A){if(A.afterStyle){this.applyStyles(A.afterStyle)}if(A.afterCls){this.addClass(A.afterCls)}if(A.remove===true){this.remove()}Ext.callback(A.callback,A.scope,[this]);if(!A.concurrent){this.fxQueue.shift();this.nextFx()}},getFxEl:function(){return Ext.get(this.dom)},fxanim:function(D,E,B,F,C,A){B=B||"run";E=E||{};var G=Ext.lib.Anim[B](this.dom,D,(E.duration||F)||0.35,(E.easing||C)||"easeOut",function(){Ext.callback(A,this)},this);E.anim=G;return G}};Ext.Fx.resize=Ext.Fx.scale;Ext.apply(Ext.Element.prototype,Ext.Fx);
+Ext.CompositeElement=function(A){this.elements=[];this.addElements(A)};Ext.CompositeElement.prototype={isComposite:true,addElements:function(E){if(!E){return this}if(typeof E=="string"){E=Ext.Element.selectorFunction(E)}var D=this.elements;var B=D.length-1;for(var C=0,A=E.length;C<A;C++){D[++B]=Ext.get(E[C])}return this},fill:function(A){this.elements=[];this.add(A);return this},filter:function(A){var B=[];this.each(function(C){if(C.is(A)){B[B.length]=C.dom}});this.fill(B);return this},invoke:function(E,B){var D=this.elements;for(var C=0,A=D.length;C<A;C++){Ext.Element.prototype[E].apply(D[C],B)}return this},add:function(A){if(typeof A=="string"){this.addElements(Ext.Element.selectorFunction(A))}else{if(A.length!==undefined){this.addElements(A)}else{this.addElements([A])}}return this},each:function(E,D){var C=this.elements;for(var B=0,A=C.length;B<A;B++){if(E.call(D||C[B],C[B],this,B)===false){break}}return this},item:function(A){return this.elements[A]||null},first:function(){return this.item(0)},last:function(){return this.item(this.elements.length-1)},getCount:function(){return this.elements.length},contains:function(A){return this.indexOf(A)!==-1},indexOf:function(A){return this.elements.indexOf(Ext.get(A))},removeElement:function(D,F){if(Ext.isArray(D)){for(var C=0,A=D.length;C<A;C++){this.removeElement(D[C])}return this}var B=typeof D=="number"?D:this.indexOf(D);if(B!==-1&&this.elements[B]){if(F){var E=this.elements[B];if(E.dom){E.remove()}else{Ext.removeNode(E)}}this.elements.splice(B,1)}return this},replaceElement:function(D,C,A){var B=typeof D=="number"?D:this.indexOf(D);if(B!==-1){if(A){this.elements[B].replaceWith(C)}else{this.elements.splice(B,1,Ext.get(C))}}return this},clear:function(){this.elements=[]}};(function(){Ext.CompositeElement.createCall=function(B,C){if(!B[C]){B[C]=function(){return this.invoke(C,arguments)}}};for(var A in Ext.Element.prototype){if(typeof Ext.Element.prototype[A]=="function"){Ext.CompositeElement.createCall(Ext.CompositeElement.prototype,A)}}})();Ext.CompositeElementLite=function(A){Ext.CompositeElementLite.superclass.constructor.call(this,A);this.el=new Ext.Element.Flyweight()};Ext.extend(Ext.CompositeElementLite,Ext.CompositeElement,{addElements:function(E){if(E){if(Ext.isArray(E)){this.elements=this.elements.concat(E)}else{var D=this.elements;var B=D.length-1;for(var C=0,A=E.length;C<A;C++){D[++B]=E[C]}}}return this},invoke:function(F,B){var D=this.elements;var E=this.el;for(var C=0,A=D.length;C<A;C++){E.dom=D[C];Ext.Element.prototype[F].apply(E,B)}return this},item:function(A){if(!this.elements[A]){return null}this.el.dom=this.elements[A];return this.el},addListener:function(B,G,F,E){var D=this.elements;for(var C=0,A=D.length;C<A;C++){Ext.EventManager.on(D[C],B,G,F||D[C],E)}return this},each:function(F,E){var C=this.elements;var D=this.el;for(var B=0,A=C.length;B<A;B++){D.dom=C[B];if(F.call(E||D,D,this,B)===false){break}}return this},indexOf:function(A){return this.elements.indexOf(Ext.getDom(A))},replaceElement:function(D,C,A){var B=typeof D=="number"?D:this.indexOf(D);if(B!==-1){C=Ext.getDom(C);if(A){var E=this.elements[B];E.parentNode.insertBefore(C,E);Ext.removeNode(E)}this.elements.splice(B,1,C)}return this}});Ext.CompositeElementLite.prototype.on=Ext.CompositeElementLite.prototype.addListener;if(Ext.DomQuery){Ext.Element.selectorFunction=Ext.DomQuery.select}Ext.Element.select=function(A,D,B){var C;if(typeof A=="string"){C=Ext.Element.selectorFunction(A,B)}else{if(A.length!==undefined){C=A}else{throw"Invalid selector"}}if(D===true){return new Ext.CompositeElement(C)}else{return new Ext.CompositeElementLite(C)}};Ext.select=Ext.Element.select;
+Ext.data.Connection=function(A){Ext.apply(this,A);this.addEvents("beforerequest","requestcomplete","requestexception");Ext.data.Connection.superclass.constructor.call(this)};Ext.extend(Ext.data.Connection,Ext.util.Observable,{timeout:30000,autoAbort:false,disableCaching:true,disableCachingParam:"_dc",request:function(E){if(this.fireEvent("beforerequest",this,E)!==false){var C=E.params;if(typeof C=="function"){C=C.call(E.scope||window,E)}if(typeof C=="object"){C=Ext.urlEncode(C)}if(this.extraParams){var G=Ext.urlEncode(this.extraParams);C=C?(C+"&"+G):G}var B=E.url||this.url;if(typeof B=="function"){B=B.call(E.scope||window,E)}if(E.form){var D=Ext.getDom(E.form);B=B||D.action;var J=D.getAttribute("enctype");if(E.isUpload||(J&&J.toLowerCase()=="multipart/form-data")){return this.doFormUpload(E,C,B)}var I=Ext.lib.Ajax.serializeForm(D);C=C?(C+"&"+I):I}var K=E.headers;if(this.defaultHeaders){K=Ext.apply(K||{},this.defaultHeaders);if(!E.headers){E.headers=K}}var F={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:E},timeout:E.timeout||this.timeout};var A=E.method||this.method||((C||E.xmlData||E.jsonData)?"POST":"GET");if(A=="GET"&&(this.disableCaching&&E.disableCaching!==false)||E.disableCaching===true){var H=E.disableCachingParam||this.disableCachingParam;B+=(B.indexOf("?")!=-1?"&":"?")+H+"="+(new Date().getTime())}if(typeof E.autoAbort=="boolean"){if(E.autoAbort){this.abort()}}else{if(this.autoAbort!==false){this.abort()}}if((A=="GET"||E.xmlData||E.jsonData)&&C){B+=(B.indexOf("?")!=-1?"&":"?")+C;C=""}this.transId=Ext.lib.Ajax.request(A,B,F,C,E);return this.transId}else{Ext.callback(E.callback,E.scope,[E,null,null]);return null}},isLoading:function(A){if(A){return Ext.lib.Ajax.isCallInProgress(A)}else{return this.transId?true:false}},abort:function(A){if(A||this.isLoading()){Ext.lib.Ajax.abort(A||this.transId)}},handleResponse:function(A){this.transId=false;var B=A.argument.options;A.argument=B?B.argument:null;this.fireEvent("requestcomplete",this,A,B);Ext.callback(B.success,B.scope,[A,B]);Ext.callback(B.callback,B.scope,[B,true,A])},handleFailure:function(A,C){this.transId=false;var B=A.argument.options;A.argument=B?B.argument:null;this.fireEvent("requestexception",this,A,B,C);Ext.callback(B.failure,B.scope,[A,B]);Ext.callback(B.callback,B.scope,[B,false,A])},doFormUpload:function(E,A,B){var C=Ext.id();var F=document.createElement("iframe");F.id=C;F.name=C;F.className="x-hidden";if(Ext.isIE){F.src=Ext.SSL_SECURE_URL}document.body.appendChild(F);if(Ext.isIE){document.frames[C].name=C}var D=Ext.getDom(E.form);D.target=C;D.method="POST";D.enctype=D.encoding="multipart/form-data";if(B){D.action=B}var L,J;if(A){L=[];A=Ext.urlDecode(A,false);for(var H in A){if(A.hasOwnProperty(H)){J=document.createElement("input");J.type="hidden";J.name=H;J.value=A[H];D.appendChild(J);L.push(J)}}}function G(){var M={responseText:"",responseXML:null};M.argument=E?E.argument:null;try{var O;if(Ext.isIE){O=F.contentWindow.document}else{O=(F.contentDocument||window.frames[C].document)}if(O&&O.body){M.responseText=O.body.innerHTML}if(O&&O.XMLDocument){M.responseXML=O.XMLDocument}else{M.responseXML=O}}catch(N){}Ext.EventManager.removeListener(F,"load",G,this);this.fireEvent("requestcomplete",this,M,E);Ext.callback(E.success,E.scope,[M,E]);Ext.callback(E.callback,E.scope,[E,true,M]);setTimeout(function(){Ext.removeNode(F)},100)}Ext.EventManager.on(F,"load",G,this);D.submit();if(L){for(var I=0,K=L.length;I<K;I++){Ext.removeNode(L[I])}}}});Ext.Ajax=new Ext.data.Connection({autoAbort:false,serializeForm:function(A){return Ext.lib.Ajax.serializeForm(A)}});
+Ext.Updater=Ext.extend(Ext.util.Observable,{constructor:function(B,A){B=Ext.get(B);if(!A&&B.updateManager){return B.updateManager}this.el=B;this.defaultUrl=null;this.addEvents("beforeupdate","update","failure");var C=Ext.Updater.defaults;this.sslBlankUrl=C.sslBlankUrl;this.disableCaching=C.disableCaching;this.indicatorText=C.indicatorText;this.showLoadIndicator=C.showLoadIndicator;this.timeout=C.timeout;this.loadScripts=C.loadScripts;this.transaction=null;this.refreshDelegate=this.refresh.createDelegate(this);this.updateDelegate=this.update.createDelegate(this);this.formUpdateDelegate=this.formUpdate.createDelegate(this);if(!this.renderer){this.renderer=this.getDefaultRenderer()}Ext.Updater.superclass.constructor.call(this)},getDefaultRenderer:function(){return new Ext.Updater.BasicRenderer()},getEl:function(){return this.el},update:function(B,F,G,D){if(this.fireEvent("beforeupdate",this.el,B,F)!==false){var A,C;if(typeof B=="object"){A=B;B=A.url;F=F||A.params;G=G||A.callback;D=D||A.discardUrl;C=A.scope;if(typeof A.nocache!="undefined"){this.disableCaching=A.nocache}if(typeof A.text!="undefined"){this.indicatorText="<div class=\"loading-indicator\">"+A.text+"</div>"}if(typeof A.scripts!="undefined"){this.loadScripts=A.scripts}if(typeof A.timeout!="undefined"){this.timeout=A.timeout}}this.showLoading();if(!D){this.defaultUrl=B}if(typeof B=="function"){B=B.call(this)}var E=Ext.apply({},{url:B,params:(typeof F=="function"&&C)?F.createDelegate(C):F,success:this.processSuccess,failure:this.processFailure,scope:this,callback:undefined,timeout:(this.timeout*1000),disableCaching:this.disableCaching,argument:{"options":A,"url":B,"form":null,"callback":G,"scope":C||window,"params":F}},A);this.transaction=Ext.Ajax.request(E)}},formUpdate:function(C,A,B,D){if(this.fireEvent("beforeupdate",this.el,C,A)!==false){if(typeof A=="function"){A=A.call(this)}C=Ext.getDom(C);this.transaction=Ext.Ajax.request({form:C,url:A,success:this.processSuccess,failure:this.processFailure,scope:this,timeout:(this.timeout*1000),argument:{"url":A,"form":C,"callback":D,"reset":B}});this.showLoading.defer(1,this)}},refresh:function(A){if(this.defaultUrl==null){return }this.update(this.defaultUrl,null,A,true)},startAutoRefresh:function(B,C,D,E,A){if(A){this.update(C||this.defaultUrl,D,E,true)}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId)}this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[C||this.defaultUrl,D,E,true]),B*1000)},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText)}},processSuccess:function(A){this.transaction=null;if(A.argument.form&&A.argument.reset){try{A.argument.form.reset()}catch(B){}}if(this.loadScripts){this.renderer.render(this.el,A,this,this.updateComplete.createDelegate(this,[A]))}else{this.renderer.render(this.el,A,this);this.updateComplete(A)}},updateComplete:function(A){this.fireEvent("update",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback.call(A.argument.scope,this.el,true,A,A.argument.options)}},processFailure:function(A){this.transaction=null;this.fireEvent("failure",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback.call(A.argument.scope,this.el,false,A,A.argument.options)}},setRenderer:function(A){this.renderer=A},getRenderer:function(){return this.renderer},setDefaultUrl:function(A){this.defaultUrl=A},abort:function(){if(this.transaction){Ext.Ajax.abort(this.transaction)}},isUpdating:function(){if(this.transaction){return Ext.Ajax.isLoading(this.transaction)}return false}});Ext.Updater.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Ext.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:"<div class=\"loading-indicator\">Loading...</div>"};Ext.Updater.updateElement=function(D,C,E,B){var A=Ext.get(D).getUpdater();Ext.apply(A,B);A.update(C,E,B?B.callback:null)};Ext.Updater.BasicRenderer=function(){};Ext.Updater.BasicRenderer.prototype={render:function(C,A,B,D){C.update(A.responseText,B.loadScripts,D)}};Ext.UpdateManager=Ext.Updater;
+Ext.util.DelayedTask=function(E,D,A){var G=null,F,B;var C=function(){var H=new Date().getTime();if(H-B>=F){clearInterval(G);G=null;E.apply(D,A||[])}};this.delay=function(I,K,J,H){if(G&&I!=F){this.cancel()}F=I;B=new Date().getTime();E=K||E;D=J||D;A=H||A;if(!G){G=setInterval(C,F)}};this.cancel=function(){if(G){clearInterval(G);G=null}}};
diff --git a/lib/jquery.js b/lib/jquery.js
new file mode 100644
index 0000000..88e661e
--- /dev/null
+++ b/lib/jquery.js
@@ -0,0 +1,3549 @@
+(function(){
+/*
+ * jQuery 1.2.6 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
+ * $Rev: 5685 $
+ */
+
+// Map over jQuery in case of overwrite
+var _jQuery = window.jQuery,
+// Map over the $ in case of overwrite
+	_$ = window.$;
+
+var jQuery = window.jQuery = window.$ = function( selector, context ) {
+	// The jQuery object is actually just the init constructor 'enhanced'
+	return new jQuery.fn.init( selector, context );
+};
+
+// A simple way to check for HTML strings or ID strings
+// (both of which we optimize for)
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
+
+// Is it a simple selector
+	isSimple = /^.[^:#\[\.]*$/,
+
+// Will speed up references to undefined, and allows munging its name.
+	undefined;
+
+jQuery.fn = jQuery.prototype = {
+	init: function( selector, context ) {
+		// Make sure that a selection was provided
+		selector = selector || document;
+
+		// Handle $(DOMElement)
+		if ( selector.nodeType ) {
+			this[0] = selector;
+			this.length = 1;
+			return this;
+		}
+		// Handle HTML strings
+		if ( typeof selector == "string" ) {
+			// Are we dealing with HTML string or an ID?
+			var match = quickExpr.exec( selector );
+
+			// Verify a match, and that no context was specified for #id
+			if ( match && (match[1] || !context) ) {
+
+				// HANDLE: $(html) -> $(array)
+				if ( match[1] )
+					selector = jQuery.clean( [ match[1] ], context );
+
+				// HANDLE: $("#id")
+				else {
+					var elem = document.getElementById( match[3] );
+
+					// Make sure an element was located
+					if ( elem ){
+						// Handle the case where IE and Opera return items
+						// by name instead of ID
+						if ( elem.id != match[3] )
+							return jQuery().find( selector );
+
+						// Otherwise, we inject the element directly into the jQuery object
+						return jQuery( elem );
+					}
+					selector = [];
+				}
+
+			// HANDLE: $(expr, [context])
+			// (which is just equivalent to: $(content).find(expr)
+			} else
+				return jQuery( context ).find( selector );
+
+		// HANDLE: $(function)
+		// Shortcut for document ready
+		} else if ( jQuery.isFunction( selector ) )
+			return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+
+		return this.setArray(jQuery.makeArray(selector));
+	},
+
+	// The current version of jQuery being used
+	jquery: "1.2.6",
+
+	// The number of elements contained in the matched element set
+	size: function() {
+		return this.length;
+	},
+
+	// The number of elements contained in the matched element set
+	length: 0,
+
+	// Get the Nth element in the matched element set OR
+	// Get the whole matched element set as a clean array
+	get: function( num ) {
+		return num == undefined ?
+
+			// Return a 'clean' array
+			jQuery.makeArray( this ) :
+
+			// Return just the object
+			this[ num ];
+	},
+
+	// Take an array of elements and push it onto the stack
+	// (returning the new matched element set)
+	pushStack: function( elems ) {
+		// Build a new jQuery matched element set
+		var ret = jQuery( elems );
+
+		// Add the old object onto the stack (as a reference)
+		ret.prevObject = this;
+
+		// Return the newly-formed element set
+		return ret;
+	},
+
+	// Force the current matched set of elements to become
+	// the specified array of elements (destroying the stack in the process)
+	// You should use pushStack() in order to do this, but maintain the stack
+	setArray: function( elems ) {
+		// Resetting the length to 0, then using the native Array push
+		// is a super-fast way to populate an object with array-like properties
+		this.length = 0;
+		Array.prototype.push.apply( this, elems );
+
+		return this;
+	},
+
+	// Execute a callback for every element in the matched set.
+	// (You can seed the arguments with an array of args, but this is
+	// only used internally.)
+	each: function( callback, args ) {
+		return jQuery.each( this, callback, args );
+	},
+
+	// Determine the position of an element within
+	// the matched set of elements
+	index: function( elem ) {
+		var ret = -1;
+
+		// Locate the position of the desired element
+		return jQuery.inArray(
+			// If it receives a jQuery object, the first element is used
+			elem && elem.jquery ? elem[0] : elem
+		, this );
+	},
+
+	attr: function( name, value, type ) {
+		var options = name;
+
+		// Look for the case where we're accessing a style value
+		if ( name.constructor == String )
+			if ( value === undefined )
+				return this[0] && jQuery[ type || "attr" ]( this[0], name );
+
+			else {
+				options = {};
+				options[ name ] = value;
+			}
+
+		// Check to see if we're setting style values
+		return this.each(function(i){
+			// Set all the styles
+			for ( name in options )
+				jQuery.attr(
+					type ?
+						this.style :
+						this,
+					name, jQuery.prop( this, options[ name ], type, i, name )
+				);
+		});
+	},
+
+	css: function( key, value ) {
+		// ignore negative width and height values
+		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+			value = undefined;
+		return this.attr( key, value, "curCSS" );
+	},
+
+	text: function( text ) {
+		if ( typeof text != "object" && text != null )
+			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+
+		var ret = "";
+
+		jQuery.each( text || this, function(){
+			jQuery.each( this.childNodes, function(){
+				if ( this.nodeType != 8 )
+					ret += this.nodeType != 1 ?
+						this.nodeValue :
+						jQuery.fn.text( [ this ] );
+			});
+		});
+
+		return ret;
+	},
+
+	wrapAll: function( html ) {
+		if ( this[0] )
+			// The elements to wrap the target around
+			jQuery( html, this[0].ownerDocument )
+				.clone()
+				.insertBefore( this[0] )
+				.map(function(){
+					var elem = this;
+
+					while ( elem.firstChild )
+						elem = elem.firstChild;
+
+					return elem;
+				})
+				.append(this);
+
+		return this;
+	},
+
+	wrapInner: function( html ) {
+		return this.each(function(){
+			jQuery( this ).contents().wrapAll( html );
+		});
+	},
+
+	wrap: function( html ) {
+		return this.each(function(){
+			jQuery( this ).wrapAll( html );
+		});
+	},
+
+	append: function() {
+		return this.domManip(arguments, true, false, function(elem){
+			if (this.nodeType == 1)
+				this.appendChild( elem );
+		});
+	},
+
+	prepend: function() {
+		return this.domManip(arguments, true, true, function(elem){
+			if (this.nodeType == 1)
+				this.insertBefore( elem, this.firstChild );
+		});
+	},
+
+	before: function() {
+		return this.domManip(arguments, false, false, function(elem){
+			this.parentNode.insertBefore( elem, this );
+		});
+	},
+
+	after: function() {
+		return this.domManip(arguments, false, true, function(elem){
+			this.parentNode.insertBefore( elem, this.nextSibling );
+		});
+	},
+
+	end: function() {
+		return this.prevObject || jQuery( [] );
+	},
+
+	find: function( selector ) {
+		var elems = jQuery.map(this, function(elem){
+			return jQuery.find( selector, elem );
+		});
+
+		return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
+			jQuery.unique( elems ) :
+			elems );
+	},
+
+	clone: function( events ) {
+		// Do the clone
+		var ret = this.map(function(){
+			if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
+				// IE copies events bound via attachEvent when
+				// using cloneNode. Calling detachEvent on the
+				// clone will also remove the events from the orignal
+				// In order to get around this, we use innerHTML.
+				// Unfortunately, this means some modifications to
+				// attributes in IE that are actually only stored
+				// as properties will not be copied (such as the
+				// the name attribute on an input).
+				var clone = this.cloneNode(true),
+					container = document.createElement("div");
+				container.appendChild(clone);
+				return jQuery.clean([container.innerHTML])[0];
+			} else
+				return this.cloneNode(true);
+		});
+
+		// Need to set the expando to null on the cloned set if it exists
+		// removeData doesn't work here, IE removes it from the original as well
+		// this is primarily for IE but the data expando shouldn't be copied over in any browser
+		var clone = ret.find("*").andSelf().each(function(){
+			if ( this[ expando ] != undefined )
+				this[ expando ] = null;
+		});
+
+		// Copy the events from the original to the clone
+		if ( events === true )
+			this.find("*").andSelf().each(function(i){
+				if (this.nodeType == 3)
+					return;
+				var events = jQuery.data( this, "events" );
+
+				for ( var type in events )
+					for ( var handler in events[ type ] )
+						jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
+			});
+
+		// Return the cloned set
+		return ret;
+	},
+
+	filter: function( selector ) {
+		return this.pushStack(
+			jQuery.isFunction( selector ) &&
+			jQuery.grep(this, function(elem, i){
+				return selector.call( elem, i );
+			}) ||
+
+			jQuery.multiFilter( selector, this ) );
+	},
+
+	not: function( selector ) {
+		if ( selector.constructor == String )
+			// test special case where just one selector is passed in
+			if ( isSimple.test( selector ) )
+				return this.pushStack( jQuery.multiFilter( selector, this, true ) );
+			else
+				selector = jQuery.multiFilter( selector, this );
+
+		var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
+		return this.filter(function() {
+			return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
+		});
+	},
+
+	add: function( selector ) {
+		return this.pushStack( jQuery.unique( jQuery.merge(
+			this.get(),
+			typeof selector == 'string' ?
+				jQuery( selector ) :
+				jQuery.makeArray( selector )
+		)));
+	},
+
+	is: function( selector ) {
+		return !!selector && jQuery.multiFilter( selector, this ).length > 0;
+	},
+
+	hasClass: function( selector ) {
+		return this.is( "." + selector );
+	},
+
+	val: function( value ) {
+		if ( value == undefined ) {
+
+			if ( this.length ) {
+				var elem = this[0];
+
+				// We need to handle select boxes special
+				if ( jQuery.nodeName( elem, "select" ) ) {
+					var index = elem.selectedIndex,
+						values = [],
+						options = elem.options,
+						one = elem.type == "select-one";
+
+					// Nothing was selected
+					if ( index < 0 )
+						return null;
+
+					// Loop through all the selected options
+					for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+						var option = options[ i ];
+
+						if ( option.selected ) {
+							// Get the specifc value for the option
+							value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
+
+							// We don't need an array for one selects
+							if ( one )
+								return value;
+
+							// Multi-Selects return an array
+							values.push( value );
+						}
+					}
+
+					return values;
+
+				// Everything else, we just grab the value
+				} else
+					return (this[0].value || "").replace(/\r/g, "");
+
+			}
+
+			return undefined;
+		}
+
+		if( value.constructor == Number )
+			value += '';
+
+		return this.each(function(){
+			if ( this.nodeType != 1 )
+				return;
+
+			if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
+				this.checked = (jQuery.inArray(this.value, value) >= 0 ||
+					jQuery.inArray(this.name, value) >= 0);
+
+			else if ( jQuery.nodeName( this, "select" ) ) {
+				var values = jQuery.makeArray(value);
+
+				jQuery( "option", this ).each(function(){
+					this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
+						jQuery.inArray( this.text, values ) >= 0);
+				});
+
+				if ( !values.length )
+					this.selectedIndex = -1;
+
+			} else
+				this.value = value;
+		});
+	},
+
+	html: function( value ) {
+		return value == undefined ?
+			(this[0] ?
+				this[0].innerHTML :
+				null) :
+			this.empty().append( value );
+	},
+
+	replaceWith: function( value ) {
+		return this.after( value ).remove();
+	},
+
+	eq: function( i ) {
+		return this.slice( i, i + 1 );
+	},
+
+	slice: function() {
+		return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
+	},
+
+	map: function( callback ) {
+		return this.pushStack( jQuery.map(this, function(elem, i){
+			return callback.call( elem, i, elem );
+		}));
+	},
+
+	andSelf: function() {
+		return this.add( this.prevObject );
+	},
+
+	data: function( key, value ){
+		var parts = key.split(".");
+		parts[1] = parts[1] ? "." + parts[1] : "";
+
+		if ( value === undefined ) {
+			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+			if ( data === undefined && this.length )
+				data = jQuery.data( this[0], key );
+
+			return data === undefined && parts[1] ?
+				this.data( parts[0] ) :
+				data;
+		} else
+			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+				jQuery.data( this, key, value );
+			});
+	},
+
+	removeData: function( key ){
+		return this.each(function(){
+			jQuery.removeData( this, key );
+		});
+	},
+
+	domManip: function( args, table, reverse, callback ) {
+		var clone = this.length > 1, elems;
+
+		return this.each(function(){
+			if ( !elems ) {
+				elems = jQuery.clean( args, this.ownerDocument );
+
+				if ( reverse )
+					elems.reverse();
+			}
+
+			var obj = this;
+
+			if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
+				obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
+
+			var scripts = jQuery( [] );
+
+			jQuery.each(elems, function(){
+				var elem = clone ?
+					jQuery( this ).clone( true )[0] :
+					this;
+
+				// execute all scripts after the elements have been injected
+				if ( jQuery.nodeName( elem, "script" ) )
+					scripts = scripts.add( elem );
+				else {
+					// Remove any inner scripts for later evaluation
+					if ( elem.nodeType == 1 )
+						scripts = scripts.add( jQuery( "script", elem ).remove() );
+
+					// Inject the elements into the document
+					callback.call( obj, elem );
+				}
+			});
+
+			scripts.each( evalScript );
+		});
+	}
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+function evalScript( i, elem ) {
+	if ( elem.src )
+		jQuery.ajax({
+			url: elem.src,
+			async: false,
+			dataType: "script"
+		});
+
+	else
+		jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+	if ( elem.parentNode )
+		elem.parentNode.removeChild( elem );
+}
+
+function now(){
+	return +new Date;
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+	// copy reference to target object
+	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+	// Handle a deep copy situation
+	if ( target.constructor == Boolean ) {
+		deep = target;
+		target = arguments[1] || {};
+		// skip the boolean and the target
+		i = 2;
+	}
+
+	// Handle case when target is a string or something (possible in deep copy)
+	if ( typeof target != "object" && typeof target != "function" )
+		target = {};
+
+	// extend jQuery itself if only one argument is passed
+	if ( length == i ) {
+		target = this;
+		--i;
+	}
+
+	for ( ; i < length; i++ )
+		// Only deal with non-null/undefined values
+		if ( (options = arguments[ i ]) != null )
+			// Extend the base object
+			for ( var name in options ) {
+				var src = target[ name ], copy = options[ name ];
+
+				// Prevent never-ending loop
+				if ( target === copy )
+					continue;
+
+				// Recurse if we're merging object values
+				if ( deep && copy && typeof copy == "object" && !copy.nodeType )
+					target[ name ] = jQuery.extend( deep, 
+						// Never move original objects, clone them
+						src || ( copy.length != null ? [ ] : { } )
+					, copy );
+
+				// Don't bring in undefined values
+				else if ( copy !== undefined )
+					target[ name ] = copy;
+
+			}
+
+	// Return the modified object
+	return target;
+};
+
+var expando = "jQuery" + now(), uuid = 0, windowData = {},
+	// exclude the following css properties to add px
+	exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+	// cache defaultView
+	defaultView = document.defaultView || {};
+
+jQuery.extend({
+	noConflict: function( deep ) {
+		window.$ = _$;
+
+		if ( deep )
+			window.jQuery = _jQuery;
+
+		return jQuery;
+	},
+
+	// See test/unit/core.js for details concerning this function.
+	isFunction: function( fn ) {
+		return !!fn && typeof fn != "string" && !fn.nodeName &&
+			fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
+	},
+
+	// check if an element is in a (or is an) XML document
+	isXMLDoc: function( elem ) {
+		return elem.documentElement && !elem.body ||
+			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+	},
+
+	// Evalulates a script in a global context
+	globalEval: function( data ) {
+		data = jQuery.trim( data );
+
+		if ( data ) {
+			// Inspired by code by Andrea Giammarchi
+			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+			var head = document.getElementsByTagName("head")[0] || document.documentElement,
+				script = document.createElement("script");
+
+			script.type = "text/javascript";
+			if ( jQuery.browser.msie )
+				script.text = data;
+			else
+				script.appendChild( document.createTextNode( data ) );
+
+			// Use insertBefore instead of appendChild  to circumvent an IE6 bug.
+			// This arises when a base node is used (#2709).
+			head.insertBefore( script, head.firstChild );
+			head.removeChild( script );
+		}
+	},
+
+	nodeName: function( elem, name ) {
+		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+	},
+
+	cache: {},
+
+	data: function( elem, name, data ) {
+		elem = elem == window ?
+			windowData :
+			elem;
+
+		var id = elem[ expando ];
+
+		// Compute a unique ID for the element
+		if ( !id )
+			id = elem[ expando ] = ++uuid;
+
+		// Only generate the data cache if we're
+		// trying to access or manipulate it
+		if ( name && !jQuery.cache[ id ] )
+			jQuery.cache[ id ] = {};
+
+		// Prevent overriding the named cache with undefined values
+		if ( data !== undefined )
+			jQuery.cache[ id ][ name ] = data;
+
+		// Return the named cache data, or the ID for the element
+		return name ?
+			jQuery.cache[ id ][ name ] :
+			id;
+	},
+
+	removeData: function( elem, name ) {
+		elem = elem == window ?
+			windowData :
+			elem;
+
+		var id = elem[ expando ];
+
+		// If we want to remove a specific section of the element's data
+		if ( name ) {
+			if ( jQuery.cache[ id ] ) {
+				// Remove the section of cache data
+				delete jQuery.cache[ id ][ name ];
+
+				// If we've removed all the data, remove the element's cache
+				name = "";
+
+				for ( name in jQuery.cache[ id ] )
+					break;
+
+				if ( !name )
+					jQuery.removeData( elem );
+			}
+
+		// Otherwise, we want to remove all of the element's data
+		} else {
+			// Clean up the element expando
+			try {
+				delete elem[ expando ];
+			} catch(e){
+				// IE has trouble directly removing the expando
+				// but it's ok with using removeAttribute
+				if ( elem.removeAttribute )
+					elem.removeAttribute( expando );
+			}
+
+			// Completely remove the data cache
+			delete jQuery.cache[ id ];
+		}
+	},
+
+	// args is for internal usage only
+	each: function( object, callback, args ) {
+		var name, i = 0, length = object.length;
+
+		if ( args ) {
+			if ( length == undefined ) {
+				for ( name in object )
+					if ( callback.apply( object[ name ], args ) === false )
+						break;
+			} else
+				for ( ; i < length; )
+					if ( callback.apply( object[ i++ ], args ) === false )
+						break;
+
+		// A special, fast, case for the most common use of each
+		} else {
+			if ( length == undefined ) {
+				for ( name in object )
+					if ( callback.call( object[ name ], name, object[ name ] ) === false )
+						break;
+			} else
+				for ( var value = object[0];
+					i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+		}
+
+		return object;
+	},
+
+	prop: function( elem, value, type, i, name ) {
+		// Handle executable functions
+		if ( jQuery.isFunction( value ) )
+			value = value.call( elem, i );
+
+		// Handle passing in a number to a CSS property
+		return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
+			value + "px" :
+			value;
+	},
+
+	className: {
+		// internal only, use addClass("class")
+		add: function( elem, classNames ) {
+			jQuery.each((classNames || "").split(/\s+/), function(i, className){
+				if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
+					elem.className += (elem.className ? " " : "") + className;
+			});
+		},
+
+		// internal only, use removeClass("class")
+		remove: function( elem, classNames ) {
+			if (elem.nodeType == 1)
+				elem.className = classNames != undefined ?
+					jQuery.grep(elem.className.split(/\s+/), function(className){
+						return !jQuery.className.has( classNames, className );
+					}).join(" ") :
+					"";
+		},
+
+		// internal only, use hasClass("class")
+		has: function( elem, className ) {
+			return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+		}
+	},
+
+	// A method for quickly swapping in/out CSS properties to get correct calculations
+	swap: function( elem, options, callback ) {
+		var old = {};
+		// Remember the old values, and insert the new ones
+		for ( var name in options ) {
+			old[ name ] = elem.style[ name ];
+			elem.style[ name ] = options[ name ];
+		}
+
+		callback.call( elem );
+
+		// Revert the old values
+		for ( var name in options )
+			elem.style[ name ] = old[ name ];
+	},
+
+	css: function( elem, name, force ) {
+		if ( name == "width" || name == "height" ) {
+			var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+
+			function getWH() {
+				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+				var padding = 0, border = 0;
+				jQuery.each( which, function() {
+					padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+					border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+				});
+				val -= Math.round(padding + border);
+			}
+
+			if ( jQuery(elem).is(":visible") )
+				getWH();
+			else
+				jQuery.swap( elem, props, getWH );
+
+			return Math.max(0, val);
+		}
+
+		return jQuery.curCSS( elem, name, force );
+	},
+
+	curCSS: function( elem, name, force ) {
+		var ret, style = elem.style;
+
+		// A helper method for determining if an element's values are broken
+		function color( elem ) {
+			if ( !jQuery.browser.safari )
+				return false;
+
+			// defaultView is cached
+			var ret = defaultView.getComputedStyle( elem, null );
+			return !ret || ret.getPropertyValue("color") == "";
+		}
+
+		// We need to handle opacity special in IE
+		if ( name == "opacity" && jQuery.browser.msie ) {
+			ret = jQuery.attr( style, "opacity" );
+
+			return ret == "" ?
+				"1" :
+				ret;
+		}
+		// Opera sometimes will give the wrong display answer, this fixes it, see #2037
+		if ( jQuery.browser.opera && name == "display" ) {
+			var save = style.outline;
+			style.outline = "0 solid black";
+			style.outline = save;
+		}
+
+		// Make sure we're using the right name for getting the float value
+		if ( name.match( /float/i ) )
+			name = styleFloat;
+
+		if ( !force && style && style[ name ] )
+			ret = style[ name ];
+
+		else if ( defaultView.getComputedStyle ) {
+
+			// Only "float" is needed here
+			if ( name.match( /float/i ) )
+				name = "float";
+
+			name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+
+			var computedStyle = defaultView.getComputedStyle( elem, null );
+
+			if ( computedStyle && !color( elem ) )
+				ret = computedStyle.getPropertyValue( name );
+
+			// If the element isn't reporting its values properly in Safari
+			// then some display: none elements are involved
+			else {
+				var swap = [], stack = [], a = elem, i = 0;
+
+				// Locate all of the parent display: none elements
+				for ( ; a && color(a); a = a.parentNode )
+					stack.unshift(a);
+
+				// Go through and make them visible, but in reverse
+				// (It would be better if we knew the exact display type that they had)
+				for ( ; i < stack.length; i++ )
+					if ( color( stack[ i ] ) ) {
+						swap[ i ] = stack[ i ].style.display;
+						stack[ i ].style.display = "block";
+					}
+
+				// Since we flip the display style, we have to handle that
+				// one special, otherwise get the value
+				ret = name == "display" && swap[ stack.length - 1 ] != null ?
+					"none" :
+					( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
+
+				// Finally, revert the display styles back
+				for ( i = 0; i < swap.length; i++ )
+					if ( swap[ i ] != null )
+						stack[ i ].style.display = swap[ i ];
+			}
+
+			// We should always get a number back from opacity
+			if ( name == "opacity" && ret == "" )
+				ret = "1";
+
+		} else if ( elem.currentStyle ) {
+			var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+				return letter.toUpperCase();
+			});
+
+			ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+			// From the awesome hack by Dean Edwards
+			// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+			// If we're not dealing with a regular pixel number
+			// but a number that has a weird ending, we need to convert it to pixels
+			if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
+				// Remember the original values
+				var left = style.left, rsLeft = elem.runtimeStyle.left;
+
+				// Put in the new values to get a computed value out
+				elem.runtimeStyle.left = elem.currentStyle.left;
+				style.left = ret || 0;
+				ret = style.pixelLeft + "px";
+
+				// Revert the changed values
+				style.left = left;
+				elem.runtimeStyle.left = rsLeft;
+			}
+		}
+
+		return ret;
+	},
+
+	clean: function( elems, context ) {
+		var ret = [];
+		context = context || document;
+		// !context.createElement fails in IE with an error but returns typeof 'object'
+		if (typeof context.createElement == 'undefined')
+			context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+
+		jQuery.each(elems, function(i, elem){
+			if ( !elem )
+				return;
+
+			if ( elem.constructor == Number )
+				elem += '';
+
+			// Convert html string into DOM nodes
+			if ( typeof elem == "string" ) {
+				// Fix "XHTML"-style tags in all browsers
+				elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
+					return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
+						all :
+						front + "></" + tag + ">";
+				});
+
+				// Trim whitespace, otherwise indexOf won't work as expected
+				var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
+
+				var wrap =
+					// option or optgroup
+					!tags.indexOf("<opt") &&
+					[ 1, "<select multiple='multiple'>", "</select>" ] ||
+
+					!tags.indexOf("<leg") &&
+					[ 1, "<fieldset>", "</fieldset>" ] ||
+
+					tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+					[ 1, "<table>", "</table>" ] ||
+
+					!tags.indexOf("<tr") &&
+					[ 2, "<table><tbody>", "</tbody></table>" ] ||
+
+				 	// <thead> matched above
+					(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
+					[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+
+					!tags.indexOf("<col") &&
+					[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+
+					// IE can't serialize <link> and <script> tags normally
+					jQuery.browser.msie &&
+					[ 1, "div<div>", "</div>" ] ||
+
+					[ 0, "", "" ];
+
+				// Go to html and back, then peel off extra wrappers
+				div.innerHTML = wrap[1] + elem + wrap[2];
+
+				// Move to the right depth
+				while ( wrap[0]-- )
+					div = div.lastChild;
+
+				// Remove IE's autoinserted <tbody> from table fragments
+				if ( jQuery.browser.msie ) {
+
+					// String was a <table>, *may* have spurious <tbody>
+					var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
+						div.firstChild && div.firstChild.childNodes :
+
+						// String was a bare <thead> or <tfoot>
+						wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
+							div.childNodes :
+							[];
+
+					for ( var j = tbody.length - 1; j >= 0 ; --j )
+						if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
+							tbody[ j ].parentNode.removeChild( tbody[ j ] );
+
+					// IE completely kills leading whitespace when innerHTML is used
+					if ( /^\s/.test( elem ) )
+						div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+
+				}
+
+				elem = jQuery.makeArray( div.childNodes );
+			}
+
+			if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
+				return;
+
+			if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
+				ret.push( elem );
+
+			else
+				ret = jQuery.merge( ret, elem );
+
+		});
+
+		return ret;
+	},
+
+	attr: function( elem, name, value ) {
+		// don't set attributes on text and comment nodes
+		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+			return undefined;
+
+		var notxml = !jQuery.isXMLDoc( elem ),
+			// Whether we are setting (or getting)
+			set = value !== undefined,
+			msie = jQuery.browser.msie;
+
+		// Try to normalize/fix the name
+		name = notxml && jQuery.props[ name ] || name;
+
+		// Only do all the following if this is a node (faster for style)
+		// IE elem.getAttribute passes even for style
+		if ( elem.tagName ) {
+
+			// These attributes require special treatment
+			var special = /href|src|style/.test( name );
+
+			// Safari mis-reports the default selected property of a hidden option
+			// Accessing the parent's selectedIndex property fixes it
+			if ( name == "selected" && jQuery.browser.safari )
+				elem.parentNode.selectedIndex;
+
+			// If applicable, access the attribute via the DOM 0 way
+			if ( name in elem && notxml && !special ) {
+				if ( set ){
+					// We can't allow the type property to be changed (since it causes problems in IE)
+					if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+						throw "type property can't be changed";
+
+					elem[ name ] = value;
+				}
+
+				// browsers index elements by id/name on forms, give priority to attributes.
+				if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
+					return elem.getAttributeNode( name ).nodeValue;
+
+				return elem[ name ];
+			}
+
+			if ( msie && notxml &&  name == "style" )
+				return jQuery.attr( elem.style, "cssText", value );
+
+			if ( set )
+				// convert the value to a string (all browsers do this but IE) see #1070
+				elem.setAttribute( name, "" + value );
+
+			var attr = msie && notxml && special
+					// Some attributes require a special call on IE
+					? elem.getAttribute( name, 2 )
+					: elem.getAttribute( name );
+
+			// Non-existent attributes return null, we normalize to undefined
+			return attr === null ? undefined : attr;
+		}
+
+		// elem is actually elem.style ... set the style
+
+		// IE uses filters for opacity
+		if ( msie && name == "opacity" ) {
+			if ( set ) {
+				// IE has trouble with opacity if it does not have layout
+				// Force it by setting the zoom level
+				elem.zoom = 1;
+
+				// Set the alpha filter to set the opacity
+				elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
+					(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+			}
+
+			return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
+				(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
+				"";
+		}
+
+		name = name.replace(/-([a-z])/ig, function(all, letter){
+			return letter.toUpperCase();
+		});
+
+		if ( set )
+			elem[ name ] = value;
+
+		return elem[ name ];
+	},
+
+	trim: function( text ) {
+		return (text || "").replace( /^\s+|\s+$/g, "" );
+	},
+
+	makeArray: function( array ) {
+		var ret = [];
+
+		if( array != null ){
+			var i = array.length;
+			//the window, strings and functions also have 'length'
+			if( i == null || array.split || array.setInterval || array.call )
+				ret[0] = array;
+			else
+				while( i )
+					ret[--i] = array[i];
+		}
+
+		return ret;
+	},
+
+	inArray: function( elem, array ) {
+		for ( var i = 0, length = array.length; i < length; i++ )
+		// Use === because on IE, window == document
+			if ( array[ i ] === elem )
+				return i;
+
+		return -1;
+	},
+
+	merge: function( first, second ) {
+		// We have to loop this way because IE & Opera overwrite the length
+		// expando of getElementsByTagName
+		var i = 0, elem, pos = first.length;
+		// Also, we need to make sure that the correct elements are being returned
+		// (IE returns comment nodes in a '*' query)
+		if ( jQuery.browser.msie ) {
+			while ( elem = second[ i++ ] )
+				if ( elem.nodeType != 8 )
+					first[ pos++ ] = elem;
+
+		} else
+			while ( elem = second[ i++ ] )
+				first[ pos++ ] = elem;
+
+		return first;
+	},
+
+	unique: function( array ) {
+		var ret = [], done = {};
+
+		try {
+
+			for ( var i = 0, length = array.length; i < length; i++ ) {
+				var id = jQuery.data( array[ i ] );
+
+				if ( !done[ id ] ) {
+					done[ id ] = true;
+					ret.push( array[ i ] );
+				}
+			}
+
+		} catch( e ) {
+			ret = array;
+		}
+
+		return ret;
+	},
+
+	grep: function( elems, callback, inv ) {
+		var ret = [];
+
+		// Go through the array, only saving the items
+		// that pass the validator function
+		for ( var i = 0, length = elems.length; i < length; i++ )
+			if ( !inv != !callback( elems[ i ], i ) )
+				ret.push( elems[ i ] );
+
+		return ret;
+	},
+
+	map: function( elems, callback ) {
+		var ret = [];
+
+		// Go through the array, translating each of the items to their
+		// new value (or values).
+		for ( var i = 0, length = elems.length; i < length; i++ ) {
+			var value = callback( elems[ i ], i );
+
+			if ( value != null )
+				ret[ ret.length ] = value;
+		}
+
+		return ret.concat.apply( [], ret );
+	}
+});
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
+	safari: /webkit/.test( userAgent ),
+	opera: /opera/.test( userAgent ),
+	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
+	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
+};
+
+var styleFloat = jQuery.browser.msie ?
+	"styleFloat" :
+	"cssFloat";
+
+jQuery.extend({
+	// Check to see if the W3C box model is being used
+	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
+
+	props: {
+		"for": "htmlFor",
+		"class": "className",
+		"float": styleFloat,
+		cssFloat: styleFloat,
+		styleFloat: styleFloat,
+		readonly: "readOnly",
+		maxlength: "maxLength",
+		cellspacing: "cellSpacing"
+	}
+});
+
+jQuery.each({
+	parent: function(elem){return elem.parentNode;},
+	parents: function(elem){return jQuery.dir(elem,"parentNode");},
+	next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
+	prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
+	nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
+	prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
+	siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
+	children: function(elem){return jQuery.sibling(elem.firstChild);},
+	contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
+}, function(name, fn){
+	jQuery.fn[ name ] = function( selector ) {
+		var ret = jQuery.map( this, fn );
+
+		if ( selector && typeof selector == "string" )
+			ret = jQuery.multiFilter( selector, ret );
+
+		return this.pushStack( jQuery.unique( ret ) );
+	};
+});
+
+jQuery.each({
+	appendTo: "append",
+	prependTo: "prepend",
+	insertBefore: "before",
+	insertAfter: "after",
+	replaceAll: "replaceWith"
+}, function(name, original){
+	jQuery.fn[ name ] = function() {
+		var args = arguments;
+
+		return this.each(function(){
+			for ( var i = 0, length = args.length; i < length; i++ )
+				jQuery( args[ i ] )[ original ]( this );
+		});
+	};
+});
+
+jQuery.each({
+	removeAttr: function( name ) {
+		jQuery.attr( this, name, "" );
+		if (this.nodeType == 1)
+			this.removeAttribute( name );
+	},
+
+	addClass: function( classNames ) {
+		jQuery.className.add( this, classNames );
+	},
+
+	removeClass: function( classNames ) {
+		jQuery.className.remove( this, classNames );
+	},
+
+	toggleClass: function( classNames ) {
+		jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
+	},
+
+	remove: function( selector ) {
+		if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
+			// Prevent memory leaks
+			jQuery( "*", this ).add(this).each(function(){
+				jQuery.event.remove(this);
+				jQuery.removeData(this);
+			});
+			if (this.parentNode)
+				this.parentNode.removeChild( this );
+		}
+	},
+
+	empty: function() {
+		// Remove element nodes and prevent memory leaks
+		jQuery( ">*", this ).remove();
+
+		// Remove any remaining nodes
+		while ( this.firstChild )
+			this.removeChild( this.firstChild );
+	}
+}, function(name, fn){
+	jQuery.fn[ name ] = function(){
+		return this.each( fn, arguments );
+	};
+});
+
+jQuery.each([ "Height", "Width" ], function(i, name){
+	var type = name.toLowerCase();
+
+	jQuery.fn[ type ] = function( size ) {
+		// Get window width or height
+		return this[0] == window ?
+			// Opera reports document.body.client[Width/Height] properly in both quirks and standards
+			jQuery.browser.opera && document.body[ "client" + name ] ||
+
+			// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
+			jQuery.browser.safari && window[ "inner" + name ] ||
+
+			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+			document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
+
+			// Get document width or height
+			this[0] == document ?
+				// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+				Math.max(
+					Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
+					Math.max(document.body["offset" + name], document.documentElement["offset" + name])
+				) :
+
+				// Get or set width or height on the element
+				size == undefined ?
+					// Get width or height on the element
+					(this.length ? jQuery.css( this[0], type ) : null) :
+
+					// Set the width or height on the element (default to pixels if value is unitless)
+					this.css( type, size.constructor == String ? size : size + "px" );
+	};
+});
+
+// Helper function used by the dimensions and offset modules
+function num(elem, prop) {
+	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
+		"(?:[\\w*_-]|\\\\.)" :
+		"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
+	quickChild = new RegExp("^>\\s*(" + chars + "+)"),
+	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
+	quickClass = new RegExp("^([#.]?)(" + chars + "*)");
+
+jQuery.extend({
+	expr: {
+		"": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
+		"#": function(a,i,m){return a.getAttribute("id")==m[2];},
+		":": {
+			// Position Checks
+			lt: function(a,i,m){return i<m[3]-0;},
+			gt: function(a,i,m){return i>m[3]-0;},
+			nth: function(a,i,m){return m[3]-0==i;},
+			eq: function(a,i,m){return m[3]-0==i;},
+			first: function(a,i){return i==0;},
+			last: function(a,i,m,r){return i==r.length-1;},
+			even: function(a,i){return i%2==0;},
+			odd: function(a,i){return i%2;},
+
+			// Child Checks
+			"first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
+			"last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
+			"only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
+
+			// Parent Checks
+			parent: function(a){return a.firstChild;},
+			empty: function(a){return !a.firstChild;},
+
+			// Text Check
+			contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
+
+			// Visibility
+			visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
+			hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
+
+			// Form attributes
+			enabled: function(a){return !a.disabled;},
+			disabled: function(a){return a.disabled;},
+			checked: function(a){return a.checked;},
+			selected: function(a){return a.selected||jQuery.attr(a,"selected");},
+
+			// Form elements
+			text: function(a){return "text"==a.type;},
+			radio: function(a){return "radio"==a.type;},
+			checkbox: function(a){return "checkbox"==a.type;},
+			file: function(a){return "file"==a.type;},
+			password: function(a){return "password"==a.type;},
+			submit: function(a){return "submit"==a.type;},
+			image: function(a){return "image"==a.type;},
+			reset: function(a){return "reset"==a.type;},
+			button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
+			input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
+
+			// :has()
+			has: function(a,i,m){return jQuery.find(m[3],a).length;},
+
+			// :header
+			header: function(a){return /h\d/i.test(a.nodeName);},
+
+			// :animated
+			animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
+		}
+	},
+
+	// The regular expressions that power the parsing engine
+	parse: [
+		// Match: [@value='test'], [@foo]
+		/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
+
+		// Match: :contains('foo')
+		/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
+
+		// Match: :even, :last-child, #id, .class
+		new RegExp("^([:.#]*)(" + chars + "+)")
+	],
+
+	multiFilter: function( expr, elems, not ) {
+		var old, cur = [];
+
+		while ( expr && expr != old ) {
+			old = expr;
+			var f = jQuery.filter( expr, elems, not );
+			expr = f.t.replace(/^\s*,\s*/, "" );
+			cur = not ? elems = f.r : jQuery.merge( cur, f.r );
+		}
+
+		return cur;
+	},
+
+	find: function( t, context ) {
+		// Quickly handle non-string expressions
+		if ( typeof t != "string" )
+			return [ t ];
+
+		// check to make sure context is a DOM element or a document
+		if ( context && context.nodeType != 1 && context.nodeType != 9)
+			return [ ];
+
+		// Set the correct context (if none is provided)
+		context = context || document;
+
+		// Initialize the search
+		var ret = [context], done = [], last, nodeName;
+
+		// Continue while a selector expression exists, and while
+		// we're no longer looping upon ourselves
+		while ( t && last != t ) {
+			var r = [];
+			last = t;
+
+			t = jQuery.trim(t);
+
+			var foundToken = false,
+
+			// An attempt at speeding up child selectors that
+			// point to a specific element tag
+				re = quickChild,
+
+				m = re.exec(t);
+
+			if ( m ) {
+				nodeName = m[1].toUpperCase();
+
+				// Perform our own iteration and filter
+				for ( var i = 0; ret[i]; i++ )
+					for ( var c = ret[i].firstChild; c; c = c.nextSibling )
+						if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
+							r.push( c );
+
+				ret = r;
+				t = t.replace( re, "" );
+				if ( t.indexOf(" ") == 0 ) continue;
+				foundToken = true;
+			} else {
+				re = /^([>+~])\s*(\w*)/i;
+
+				if ( (m = re.exec(t)) != null ) {
+					r = [];
+
+					var merge = {};
+					nodeName = m[2].toUpperCase();
+					m = m[1];
+
+					for ( var j = 0, rl = ret.length; j < rl; j++ ) {
+						var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
+						for ( ; n; n = n.nextSibling )
+							if ( n.nodeType == 1 ) {
+								var id = jQuery.data(n);
+
+								if ( m == "~" && merge[id] ) break;
+
+								if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
+									if ( m == "~" ) merge[id] = true;
+									r.push( n );
+								}
+
+								if ( m == "+" ) break;
+							}
+					}
+
+					ret = r;
+
+					// And remove the token
+					t = jQuery.trim( t.replace( re, "" ) );
+					foundToken = true;
+				}
+			}
+
+			// See if there's still an expression, and that we haven't already
+			// matched a token
+			if ( t && !foundToken ) {
+				// Handle multiple expressions
+				if ( !t.indexOf(",") ) {
+					// Clean the result set
+					if ( context == ret[0] ) ret.shift();
+
+					// Merge the result sets
+					done = jQuery.merge( done, ret );
+
+					// Reset the context
+					r = ret = [context];
+
+					// Touch up the selector string
+					t = " " + t.substr(1,t.length);
+
+				} else {
+					// Optimize for the case nodeName#idName
+					var re2 = quickID;
+					var m = re2.exec(t);
+
+					// Re-organize the results, so that they're consistent
+					if ( m ) {
+						m = [ 0, m[2], m[3], m[1] ];
+
+					} else {
+						// Otherwise, do a traditional filter check for
+						// ID, class, and element selectors
+						re2 = quickClass;
+						m = re2.exec(t);
+					}
+
+					m[2] = m[2].replace(/\\/g, "");
+
+					var elem = ret[ret.length-1];
+
+					// Try to do a global search by ID, where we can
+					if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
+						// Optimization for HTML document case
+						var oid = elem.getElementById(m[2]);
+
+						// Do a quick check for the existence of the actual ID attribute
+						// to avoid selecting by the name attribute in IE
+						// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
+						if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
+							oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
+
+						// Do a quick check for node name (where applicable) so
+						// that div#foo searches will be really fast
+						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
+					} else {
+						// We need to find all descendant elements
+						for ( var i = 0; ret[i]; i++ ) {
+							// Grab the tag name being searched for
+							var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
+
+							// Handle IE7 being really dumb about <object>s
+							if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
+								tag = "param";
+
+							r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+						}
+
+						// It's faster to filter by class and be done with it
+						if ( m[1] == "." )
+							r = jQuery.classFilter( r, m[2] );
+
+						// Same with ID filtering
+						if ( m[1] == "#" ) {
+							var tmp = [];
+
+							// Try to find the element with the ID
+							for ( var i = 0; r[i]; i++ )
+								if ( r[i].getAttribute("id") == m[2] ) {
+									tmp = [ r[i] ];
+									break;
+								}
+
+							r = tmp;
+						}
+
+						ret = r;
+					}
+
+					t = t.replace( re2, "" );
+				}
+
+			}
+
+			// If a selector string still exists
+			if ( t ) {
+				// Attempt to filter it
+				var val = jQuery.filter(t,r);
+				ret = r = val.r;
+				t = jQuery.trim(val.t);
+			}
+		}
+
+		// An error occurred with the selector;
+		// just return an empty set instead
+		if ( t )
+			ret = [];
+
+		// Remove the root context
+		if ( ret && context == ret[0] )
+			ret.shift();
+
+		// And combine the results
+		done = jQuery.merge( done, ret );
+
+		return done;
+	},
+
+	classFilter: function(r,m,not){
+		m = " " + m + " ";
+		var tmp = [];
+		for ( var i = 0; r[i]; i++ ) {
+			var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
+			if ( !not && pass || not && !pass )
+				tmp.push( r[i] );
+		}
+		return tmp;
+	},
+
+	filter: function(t,r,not) {
+		var last;
+
+		// Look for common filter expressions
+		while ( t && t != last ) {
+			last = t;
+
+			var p = jQuery.parse, m;
+
+			for ( var i = 0; p[i]; i++ ) {
+				m = p[i].exec( t );
+
+				if ( m ) {
+					// Remove what we just matched
+					t = t.substring( m[0].length );
+
+					m[2] = m[2].replace(/\\/g, "");
+					break;
+				}
+			}
+
+			if ( !m )
+				break;
+
+			// :not() is a special case that can be optimized by
+			// keeping it out of the expression list
+			if ( m[1] == ":" && m[2] == "not" )
+				// optimize if only one selector found (most common case)
+				r = isSimple.test( m[3] ) ?
+					jQuery.filter(m[3], r, true).r :
+					jQuery( r ).not( m[3] );
+
+			// We can get a big speed boost by filtering by class here
+			else if ( m[1] == "." )
+				r = jQuery.classFilter(r, m[2], not);
+
+			else if ( m[1] == "[" ) {
+				var tmp = [], type = m[3];
+
+				for ( var i = 0, rl = r.length; i < rl; i++ ) {
+					var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
+
+					if ( z == null || /href|src|selected/.test(m[2]) )
+						z = jQuery.attr(a,m[2]) || '';
+
+					if ( (type == "" && !!z ||
+						 type == "=" && z == m[5] ||
+						 type == "!=" && z != m[5] ||
+						 type == "^=" && z && !z.indexOf(m[5]) ||
+						 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
+						 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
+							tmp.push( a );
+				}
+
+				r = tmp;
+
+			// We can get a speed boost by handling nth-child here
+			} else if ( m[1] == ":" && m[2] == "nth-child" ) {
+				var merge = {}, tmp = [],
+					// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+					test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+						m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
+						!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
+					// calculate the numbers (first)n+(last) including if they are negative
+					first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
+
+				// loop through all the elements left in the jQuery object
+				for ( var i = 0, rl = r.length; i < rl; i++ ) {
+					var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
+
+					if ( !merge[id] ) {
+						var c = 1;
+
+						for ( var n = parentNode.firstChild; n; n = n.nextSibling )
+							if ( n.nodeType == 1 )
+								n.nodeIndex = c++;
+
+						merge[id] = true;
+					}
+
+					var add = false;
+
+					if ( first == 0 ) {
+						if ( node.nodeIndex == last )
+							add = true;
+					} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
+						add = true;
+
+					if ( add ^ not )
+						tmp.push( node );
+				}
+
+				r = tmp;
+
+			// Otherwise, find the expression to execute
+			} else {
+				var fn = jQuery.expr[ m[1] ];
+				if ( typeof fn == "object" )
+					fn = fn[ m[2] ];
+
+				if ( typeof fn == "string" )
+					fn = eval("false||function(a,i){return " + fn + ";}");
+
+				// Execute it against the current filter
+				r = jQuery.grep( r, function(elem, i){
+					return fn(elem, i, m, r);
+				}, not );
+			}
+		}
+
+		// Return an array of filtered elements (r)
+		// and the modified expression string (t)
+		return { r: r, t: t };
+	},
+
+	dir: function( elem, dir ){
+		var matched = [],
+			cur = elem[dir];
+		while ( cur && cur != document ) {
+			if ( cur.nodeType == 1 )
+				matched.push( cur );
+			cur = cur[dir];
+		}
+		return matched;
+	},
+
+	nth: function(cur,result,dir,elem){
+		result = result || 1;
+		var num = 0;
+
+		for ( ; cur; cur = cur[dir] )
+			if ( cur.nodeType == 1 && ++num == result )
+				break;
+
+		return cur;
+	},
+
+	sibling: function( n, elem ) {
+		var r = [];
+
+		for ( ; n; n = n.nextSibling ) {
+			if ( n.nodeType == 1 && n != elem )
+				r.push( n );
+		}
+
+		return r;
+	}
+});
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code orignated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+	// Bind an event to an element
+	// Original by Dean Edwards
+	add: function(elem, types, handler, data) {
+		if ( elem.nodeType == 3 || elem.nodeType == 8 )
+			return;
+
+		// For whatever reason, IE has trouble passing the window object
+		// around, causing it to be cloned in the process
+		if ( jQuery.browser.msie && elem.setInterval )
+			elem = window;
+
+		// Make sure that the function being executed has a unique ID
+		if ( !handler.guid )
+			handler.guid = this.guid++;
+
+		// if data is passed, bind to handler
+		if( data != undefined ) {
+			// Create temporary function pointer to original handler
+			var fn = handler;
+
+			// Create unique handler function, wrapped around original handler
+			handler = this.proxy( fn, function() {
+				// Pass arguments and context to original handler
+				return fn.apply(this, arguments);
+			});
+
+			// Store data in unique handler
+			handler.data = data;
+		}
+
+		// Init the element's event structure
+		var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
+			handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
+				// Handle the second event of a trigger and when
+				// an event is called after a page has unloaded
+				if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
+					return jQuery.event.handle.apply(arguments.callee.elem, arguments);
+			});
+		// Add elem as a property of the handle function
+		// This is to prevent a memory leak with non-native
+		// event in IE.
+		handle.elem = elem;
+
+		// Handle multiple events separated by a space
+		// jQuery(...).bind("mouseover mouseout", fn);
+		jQuery.each(types.split(/\s+/), function(index, type) {
+			// Namespaced event handlers
+			var parts = type.split(".");
+			type = parts[0];
+			handler.type = parts[1];
+
+			// Get the current list of functions bound to this event
+			var handlers = events[type];
+
+			// Init the event handler queue
+			if (!handlers) {
+				handlers = events[type] = {};
+
+				// Check for a special event handler
+				// Only use addEventListener/attachEvent if the special
+				// events handler returns false
+				if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+					// Bind the global event handler to the element
+					if (elem.addEventListener)
+						elem.addEventListener(type, handle, false);
+					else if (elem.attachEvent)
+						elem.attachEvent("on" + type, handle);
+				}
+			}
+
+			// Add the function to the element's handler list
+			handlers[handler.guid] = handler;
+
+			// Keep track of which events have been used, for global triggering
+			jQuery.event.global[type] = true;
+		});
+
+		// Nullify elem to prevent memory leaks in IE
+		elem = null;
+	},
+
+	guid: 1,
+	global: {},
+
+	// Detach an event or set of events from an element
+	remove: function(elem, types, handler) {
+		// don't do events on text and comment nodes
+		if ( elem.nodeType == 3 || elem.nodeType == 8 )
+			return;
+
+		var events = jQuery.data(elem, "events"), ret, index;
+
+		if ( events ) {
+			// Unbind all events for the element
+			if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
+				for ( var type in events )
+					this.remove( elem, type + (types || "") );
+			else {
+				// types is actually an event object here
+				if ( types.type ) {
+					handler = types.handler;
+					types = types.type;
+				}
+
+				// Handle multiple events seperated by a space
+				// jQuery(...).unbind("mouseover mouseout", fn);
+				jQuery.each(types.split(/\s+/), function(index, type){
+					// Namespaced event handlers
+					var parts = type.split(".");
+					type = parts[0];
+
+					if ( events[type] ) {
+						// remove the given handler for the given type
+						if ( handler )
+							delete events[type][handler.guid];
+
+						// remove all handlers for the given type
+						else
+							for ( handler in events[type] )
+								// Handle the removal of namespaced events
+								if ( !parts[1] || events[type][handler].type == parts[1] )
+									delete events[type][handler];
+
+						// remove generic event handler if no more handlers exist
+						for ( ret in events[type] ) break;
+						if ( !ret ) {
+							if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
+								if (elem.removeEventListener)
+									elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
+								else if (elem.detachEvent)
+									elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
+							}
+							ret = null;
+							delete events[type];
+						}
+					}
+				});
+			}
+
+			// Remove the expando if it's no longer used
+			for ( ret in events ) break;
+			if ( !ret ) {
+				var handle = jQuery.data( elem, "handle" );
+				if ( handle ) handle.elem = null;
+				jQuery.removeData( elem, "events" );
+				jQuery.removeData( elem, "handle" );
+			}
+		}
+	},
+
+	trigger: function(type, data, elem, donative, extra) {
+		// Clone the incoming data, if any
+		data = jQuery.makeArray(data);
+
+		if ( type.indexOf("!") >= 0 ) {
+			type = type.slice(0, -1);
+			var exclusive = true;
+		}
+
+		// Handle a global trigger
+		if ( !elem ) {
+			// Only trigger if we've ever bound an event for it
+			if ( this.global[type] )
+				jQuery("*").add([window, document]).trigger(type, data);
+
+		// Handle triggering a single element
+		} else {
+			// don't do events on text and comment nodes
+			if ( elem.nodeType == 3 || elem.nodeType == 8 )
+				return undefined;
+
+			var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
+				// Check to see if we need to provide a fake event, or not
+				event = !data[0] || !data[0].preventDefault;
+
+			// Pass along a fake event
+			if ( event ) {
+				data.unshift({
+					type: type,
+					target: elem,
+					preventDefault: function(){},
+					stopPropagation: function(){},
+					timeStamp: now()
+				});
+				data[0][expando] = true; // no need to fix fake event
+			}
+
+			// Enforce the right trigger type
+			data[0].type = type;
+			if ( exclusive )
+				data[0].exclusive = true;
+
+			// Trigger the event, it is assumed that "handle" is a function
+			var handle = jQuery.data(elem, "handle");
+			if ( handle )
+				val = handle.apply( elem, data );
+
+			// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
+			if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+				val = false;
+
+			// Extra functions don't get the custom event object
+			if ( event )
+				data.shift();
+
+			// Handle triggering of extra function
+			if ( extra && jQuery.isFunction( extra ) ) {
+				// call the extra function and tack the current return value on the end for possible inspection
+				ret = extra.apply( elem, val == null ? data : data.concat( val ) );
+				// if anything is returned, give it precedence and have it overwrite the previous value
+				if (ret !== undefined)
+					val = ret;
+			}
+
+			// Trigger the native events (except for clicks on links)
+			if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+				this.triggered = true;
+				try {
+					elem[ type ]();
+				// prevent IE from throwing an error for some hidden elements
+				} catch (e) {}
+			}
+
+			this.triggered = false;
+		}
+
+		return val;
+	},
+
+	handle: function(event) {
+		// returned undefined or false
+		var val, ret, namespace, all, handlers;
+
+		event = arguments[0] = jQuery.event.fix( event || window.event );
+
+		// Namespaced event handlers
+		namespace = event.type.split(".");
+		event.type = namespace[0];
+		namespace = namespace[1];
+		// Cache this now, all = true means, any handler
+		all = !namespace && !event.exclusive;
+
+		handlers = ( jQuery.data(this, "events") || {} )[event.type];
+
+		for ( var j in handlers ) {
+			var handler = handlers[j];
+
+			// Filter the functions by class
+			if ( all || handler.type == namespace ) {
+				// Pass in a reference to the handler function itself
+				// So that we can later remove it
+				event.handler = handler;
+				event.data = handler.data;
+
+				ret = handler.apply( this, arguments );
+
+				if ( val !== false )
+					val = ret;
+
+				if ( ret === false ) {
+					event.preventDefault();
+					event.stopPropagation();
+				}
+			}
+		}
+
+		return val;
+	},
+
+	fix: function(event) {
+		if ( event[expando] == true )
+			return event;
+
+		// store a copy of the original event object
+		// and "clone" to set read-only properties
+		var originalEvent = event;
+		event = { originalEvent: originalEvent };
+		var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
+		for ( var i=props.length; i; i-- )
+			event[ props[i] ] = originalEvent[ props[i] ];
+
+		// Mark it as fixed
+		event[expando] = true;
+
+		// add preventDefault and stopPropagation since
+		// they will not work on the clone
+		event.preventDefault = function() {
+			// if preventDefault exists run it on the original event
+			if (originalEvent.preventDefault)
+				originalEvent.preventDefault();
+			// otherwise set the returnValue property of the original event to false (IE)
+			originalEvent.returnValue = false;
+		};
+		event.stopPropagation = function() {
+			// if stopPropagation exists run it on the original event
+			if (originalEvent.stopPropagation)
+				originalEvent.stopPropagation();
+			// otherwise set the cancelBubble property of the original event to true (IE)
+			originalEvent.cancelBubble = true;
+		};
+
+		// Fix timeStamp
+		event.timeStamp = event.timeStamp || now();
+
+		// Fix target property, if necessary
+		if ( !event.target )
+			event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+
+		// check if target is a textnode (safari)
+		if ( event.target.nodeType == 3 )
+			event.target = event.target.parentNode;
+
+		// Add relatedTarget, if necessary
+		if ( !event.relatedTarget && event.fromElement )
+			event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+		// Calculate pageX/Y if missing and clientX/Y available
+		if ( event.pageX == null && event.clientX != null ) {
+			var doc = document.documentElement, body = document.body;
+			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
+			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+		}
+
+		// Add which for key events
+		if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
+			event.which = event.charCode || event.keyCode;
+
+		// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+		if ( !event.metaKey && event.ctrlKey )
+			event.metaKey = event.ctrlKey;
+
+		// Add which for click: 1 == left; 2 == middle; 3 == right
+		// Note: button is not normalized, so don't use it
+		if ( !event.which && event.button )
+			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+
+		return event;
+	},
+
+	proxy: function( fn, proxy ){
+		// Set the guid of unique handler to the same of original handler, so it can be removed
+		proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
+		// So proxy can be declared as an argument
+		return proxy;
+	},
+
+	special: {
+		ready: {
+			setup: function() {
+				// Make sure the ready event is setup
+				bindReady();
+				return;
+			},
+
+			teardown: function() { return; }
+		},
+
+		mouseenter: {
+			setup: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
+				return true;
+			},
+
+			teardown: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
+				return true;
+			},
+
+			handler: function(event) {
+				// If we actually just moused on to a sub-element, ignore it
+				if ( withinElement(event, this) ) return true;
+				// Execute the right handlers by setting the event type to mouseenter
+				event.type = "mouseenter";
+				return jQuery.event.handle.apply(this, arguments);
+			}
+		},
+
+		mouseleave: {
+			setup: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
+				return true;
+			},
+
+			teardown: function() {
+				if ( jQuery.browser.msie ) return false;
+				jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
+				return true;
+			},
+
+			handler: function(event) {
+				// If we actually just moused on to a sub-element, ignore it
+				if ( withinElement(event, this) ) return true;
+				// Execute the right handlers by setting the event type to mouseleave
+				event.type = "mouseleave";
+				return jQuery.event.handle.apply(this, arguments);
+			}
+		}
+	}
+};
+
+jQuery.fn.extend({
+	bind: function( type, data, fn ) {
+		return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+			jQuery.event.add( this, type, fn || data, fn && data );
+		});
+	},
+
+	one: function( type, data, fn ) {
+		var one = jQuery.event.proxy( fn || data, function(event) {
+			jQuery(this).unbind(event, one);
+			return (fn || data).apply( this, arguments );
+		});
+		return this.each(function(){
+			jQuery.event.add( this, type, one, fn && data);
+		});
+	},
+
+	unbind: function( type, fn ) {
+		return this.each(function(){
+			jQuery.event.remove( this, type, fn );
+		});
+	},
+
+	trigger: function( type, data, fn ) {
+		return this.each(function(){
+			jQuery.event.trigger( type, data, this, true, fn );
+		});
+	},
+
+	triggerHandler: function( type, data, fn ) {
+		return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
+	},
+
+	toggle: function( fn ) {
+		// Save reference to arguments for access in closure
+		var args = arguments, i = 1;
+
+		// link all the functions, so any of them can unbind this click handler
+		while( i < args.length )
+			jQuery.event.proxy( fn, args[i++] );
+
+		return this.click( jQuery.event.proxy( fn, function(event) {
+			// Figure out which function to execute
+			this.lastToggle = ( this.lastToggle || 0 ) % i;
+
+			// Make sure that clicks stop
+			event.preventDefault();
+
+			// and execute the function
+			return args[ this.lastToggle++ ].apply( this, arguments ) || false;
+		}));
+	},
+
+	hover: function(fnOver, fnOut) {
+		return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
+	},
+
+	ready: function(fn) {
+		// Attach the listeners
+		bindReady();
+
+		// If the DOM is already ready
+		if ( jQuery.isReady )
+			// Execute the function immediately
+			fn.call( document, jQuery );
+
+		// Otherwise, remember the function for later
+		else
+			// Add the function to the wait list
+			jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
+
+		return this;
+	}
+});
+
+jQuery.extend({
+	isReady: false,
+	readyList: [],
+	// Handle when the DOM is ready
+	ready: function() {
+		// Make sure that the DOM is not already loaded
+		if ( !jQuery.isReady ) {
+			// Remember that the DOM is ready
+			jQuery.isReady = true;
+
+			// If there are functions bound, to execute
+			if ( jQuery.readyList ) {
+				// Execute all of them
+				jQuery.each( jQuery.readyList, function(){
+					this.call( document );
+				});
+
+				// Reset the list of functions
+				jQuery.readyList = null;
+			}
+
+			// Trigger any bound ready events
+			jQuery(document).triggerHandler("ready");
+		}
+	}
+});
+
+var readyBound = false;
+
+function bindReady(){
+	if ( readyBound ) return;
+	readyBound = true;
+
+	// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
+	if ( document.addEventListener && !jQuery.browser.opera)
+		// Use the handy event callback
+		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
+
+	// If IE is used and is not in a frame
+	// Continually check to see if the document is ready
+	if ( jQuery.browser.msie && window == top ) (function(){
+		if (jQuery.isReady) return;
+		try {
+			// If IE is used, use the trick by Diego Perini
+			// http://javascript.nwbox.com/IEContentLoaded/
+			document.documentElement.doScroll("left");
+		} catch( error ) {
+			setTimeout( arguments.callee, 0 );
+			return;
+		}
+		// and execute any waiting functions
+		jQuery.ready();
+	})();
+
+	if ( jQuery.browser.opera )
+		document.addEventListener( "DOMContentLoaded", function () {
+			if (jQuery.isReady) return;
+			for (var i = 0; i < document.styleSheets.length; i++)
+				if (document.styleSheets[i].disabled) {
+					setTimeout( arguments.callee, 0 );
+					return;
+				}
+			// and execute any waiting functions
+			jQuery.ready();
+		}, false);
+
+	if ( jQuery.browser.safari ) {
+		var numStyles;
+		(function(){
+			if (jQuery.isReady) return;
+			if ( document.readyState != "loaded" && document.readyState != "complete" ) {
+				setTimeout( arguments.callee, 0 );
+				return;
+			}
+			if ( numStyles === undefined )
+				numStyles = jQuery("style, link[rel=stylesheet]").length;
+			if ( document.styleSheets.length != numStyles ) {
+				setTimeout( arguments.callee, 0 );
+				return;
+			}
+			// and execute any waiting functions
+			jQuery.ready();
+		})();
+	}
+
+	// A fallback to window.onload, that will always work
+	jQuery.event.add( window, "load", jQuery.ready );
+}
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
+	"submit,keydown,keypress,keyup,error").split(","), function(i, name){
+
+	// Handle event binding
+	jQuery.fn[name] = function(fn){
+		return fn ? this.bind(name, fn) : this.trigger(name);
+	};
+});
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event, elem) {
+	// Check if mouse(over|out) are still within the same parent element
+	var parent = event.relatedTarget;
+	// Traverse up the tree
+	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
+	// Return true if we actually just moused on to a sub-element
+	return parent == elem;
+};
+
+// Prevent memory leaks in IE
+// And prevent errors on refresh with events like mouseover in other browsers
+// Window isn't included so as not to unbind existing unload events
+jQuery(window).bind("unload", function() {
+	jQuery("*").add(document).unbind();
+});
+jQuery.fn.extend({
+	// Keep a copy of the old load
+	_load: jQuery.fn.load,
+
+	load: function( url, params, callback ) {
+		if ( typeof url != 'string' )
+			return this._load( url );
+
+		var off = url.indexOf(" ");
+		if ( off >= 0 ) {
+			var selector = url.slice(off, url.length);
+			url = url.slice(0, off);
+		}
+
+		callback = callback || function(){};
+
+		// Default to a GET request
+		var type = "GET";
+
+		// If the second parameter was provided
+		if ( params )
+			// If it's a function
+			if ( jQuery.isFunction( params ) ) {
+				// We assume that it's the callback
+				callback = params;
+				params = null;
+
+			// Otherwise, build a param string
+			} else {
+				params = jQuery.param( params );
+				type = "POST";
+			}
+
+		var self = this;
+
+		// Request the remote document
+		jQuery.ajax({
+			url: url,
+			type: type,
+			dataType: "html",
+			data: params,
+			complete: function(res, status){
+				// If successful, inject the HTML into all the matched elements
+				if ( status == "success" || status == "notmodified" )
+					// See if a selector was specified
+					self.html( selector ?
+						// Create a dummy div to hold the results
+						jQuery("<div/>")
+							// inject the contents of the document in, removing the scripts
+							// to avoid any 'Permission Denied' errors in IE
+							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+							// Locate the specified elements
+							.find(selector) :
+
+						// If not, just inject the full result
+						res.responseText );
+
+				self.each( callback, [res.responseText, status, res] );
+			}
+		});
+		return this;
+	},
+
+	serialize: function() {
+		return jQuery.param(this.serializeArray());
+	},
+	serializeArray: function() {
+		return this.map(function(){
+			return jQuery.nodeName(this, "form") ?
+				jQuery.makeArray(this.elements) : this;
+		})
+		.filter(function(){
+			return this.name && !this.disabled &&
+				(this.checked || /select|textarea/i.test(this.nodeName) ||
+					/text|hidden|password/i.test(this.type));
+		})
+		.map(function(i, elem){
+			var val = jQuery(this).val();
+			return val == null ? null :
+				val.constructor == Array ?
+					jQuery.map( val, function(val, i){
+						return {name: elem.name, value: val};
+					}) :
+					{name: elem.name, value: val};
+		}).get();
+	}
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+	jQuery.fn[o] = function(f){
+		return this.bind(o, f);
+	};
+});
+
+var jsc = now();
+
+jQuery.extend({
+	get: function( url, data, callback, type ) {
+		// shift arguments if data argument was ommited
+		if ( jQuery.isFunction( data ) ) {
+			callback = data;
+			data = null;
+		}
+
+		return jQuery.ajax({
+			type: "GET",
+			url: url,
+			data: data,
+			success: callback,
+			dataType: type
+		});
+	},
+
+	getScript: function( url, callback ) {
+		return jQuery.get(url, null, callback, "script");
+	},
+
+	getJSON: function( url, data, callback ) {
+		return jQuery.get(url, data, callback, "json");
+	},
+
+	post: function( url, data, callback, type ) {
+		if ( jQuery.isFunction( data ) ) {
+			callback = data;
+			data = {};
+		}
+
+		return jQuery.ajax({
+			type: "POST",
+			url: url,
+			data: data,
+			success: callback,
+			dataType: type
+		});
+	},
+
+	ajaxSetup: function( settings ) {
+		jQuery.extend( jQuery.ajaxSettings, settings );
+	},
+
+	ajaxSettings: {
+		url: location.href,
+		global: true,
+		type: "GET",
+		timeout: 0,
+		contentType: "application/x-www-form-urlencoded",
+		processData: true,
+		async: true,
+		data: null,
+		username: null,
+		password: null,
+		accepts: {
+			xml: "application/xml, text/xml",
+			html: "text/html",
+			script: "text/javascript, application/javascript",
+			json: "application/json, text/javascript",
+			text: "text/plain",
+			_default: "*/*"
+		}
+	},
+
+	// Last-Modified header cache for next request
+	lastModified: {},
+
+	ajax: function( s ) {
+		// Extend the settings, but re-extend 's' so that it can be
+		// checked again later (in the test suite, specifically)
+		s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+		var jsonp, jsre = /=\?(&|$)/g, status, data,
+			type = s.type.toUpperCase();
+
+		// convert data if not already a string
+		if ( s.data && s.processData && typeof s.data != "string" )
+			s.data = jQuery.param(s.data);
+
+		// Handle JSONP Parameter Callbacks
+		if ( s.dataType == "jsonp" ) {
+			if ( type == "GET" ) {
+				if ( !s.url.match(jsre) )
+					s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+			} else if ( !s.data || !s.data.match(jsre) )
+				s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+			s.dataType = "json";
+		}
+
+		// Build temporary JSONP function
+		if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+			jsonp = "jsonp" + jsc++;
+
+			// Replace the =? sequence both in the query string and the data
+			if ( s.data )
+				s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+			s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+			// We need to make sure
+			// that a JSONP style response is executed properly
+			s.dataType = "script";
+
+			// Handle JSONP-style loading
+			window[ jsonp ] = function(tmp){
+				data = tmp;
+				success();
+				complete();
+				// Garbage collect
+				window[ jsonp ] = undefined;
+				try{ delete window[ jsonp ]; } catch(e){}
+				if ( head )
+					head.removeChild( script );
+			};
+		}
+
+		if ( s.dataType == "script" && s.cache == null )
+			s.cache = false;
+
+		if ( s.cache === false && type == "GET" ) {
+			var ts = now();
+			// try replacing _= if it is there
+			var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+			// if nothing was replaced, add timestamp to the end
+			s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+		}
+
+		// If data is available, append data to url for get requests
+		if ( s.data && type == "GET" ) {
+			s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+			// IE likes to send both get and post data, prevent this
+			s.data = null;
+		}
+
+		// Watch for a new set of requests
+		if ( s.global && ! jQuery.active++ )
+			jQuery.event.trigger( "ajaxStart" );
+
+		// Matches an absolute URL, and saves the domain
+		var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
+
+		// If we're requesting a remote document
+		// and trying to load JSON or Script with a GET
+		if ( s.dataType == "script" && type == "GET"
+				&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
+			var head = document.getElementsByTagName("head")[0];
+			var script = document.createElement("script");
+			script.src = s.url;
+			if (s.scriptCharset)
+				script.charset = s.scriptCharset;
+
+			// Handle Script loading
+			if ( !jsonp ) {
+				var done = false;
+
+				// Attach handlers for all browsers
+				script.onload = script.onreadystatechange = function(){
+					if ( !done && (!this.readyState ||
+							this.readyState == "loaded" || this.readyState == "complete") ) {
+						done = true;
+						success();
+						complete();
+						head.removeChild( script );
+					}
+				};
+			}
+
+			head.appendChild(script);
+
+			// We handle everything using the script element injection
+			return undefined;
+		}
+
+		var requestDone = false;
+
+		// Create the request object; Microsoft failed to properly
+		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+		var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+
+		// Open the socket
+		// Passing null username, generates a login popup on Opera (#2865)
+		if( s.username )
+			xhr.open(type, s.url, s.async, s.username, s.password);
+		else
+			xhr.open(type, s.url, s.async);
+
+		// Need an extra try/catch for cross domain requests in Firefox 3
+		try {
+			// Set the correct header, if data is being sent
+			if ( s.data )
+				xhr.setRequestHeader("Content-Type", s.contentType);
+
+			// Set the If-Modified-Since header, if ifModified mode.
+			if ( s.ifModified )
+				xhr.setRequestHeader("If-Modified-Since",
+					jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+			// Set header so the called script knows that it's an XMLHttpRequest
+			xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+			// Set the Accepts header for the server, depending on the dataType
+			xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+				s.accepts[ s.dataType ] + ", */*" :
+				s.accepts._default );
+		} catch(e){}
+
+		// Allow custom headers/mimetypes
+		if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
+			// cleanup active request counter
+			s.global && jQuery.active--;
+			// close opended socket
+			xhr.abort();
+			return false;
+		}
+
+		if ( s.global )
+			jQuery.event.trigger("ajaxSend", [xhr, s]);
+
+		// Wait for a response to come back
+		var onreadystatechange = function(isTimeout){
+			// The transfer is complete and the data is available, or the request timed out
+			if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+				requestDone = true;
+
+				// clear poll interval
+				if (ival) {
+					clearInterval(ival);
+					ival = null;
+				}
+
+				status = isTimeout == "timeout" && "timeout" ||
+					!jQuery.httpSuccess( xhr ) && "error" ||
+					s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
+					"success";
+
+				if ( status == "success" ) {
+					// Watch for, and catch, XML document parse errors
+					try {
+						// process the data (runs the xml through httpData regardless of callback)
+						data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
+					} catch(e) {
+						status = "parsererror";
+					}
+				}
+
+				// Make sure that the request was successful or notmodified
+				if ( status == "success" ) {
+					// Cache Last-Modified header, if ifModified mode.
+					var modRes;
+					try {
+						modRes = xhr.getResponseHeader("Last-Modified");
+					} catch(e) {} // swallow exception thrown by FF if header is not available
+
+					if ( s.ifModified && modRes )
+						jQuery.lastModified[s.url] = modRes;
+
+					// JSONP handles its own success callback
+					if ( !jsonp )
+						success();
+				} else
+					jQuery.handleError(s, xhr, status);
+
+				// Fire the complete handlers
+				complete();
+
+				// Stop memory leaks
+				if ( s.async )
+					xhr = null;
+			}
+		};
+
+		if ( s.async ) {
+			// don't attach the handler to the request, just poll it instead
+			var ival = setInterval(onreadystatechange, 13);
+
+			// Timeout checker
+			if ( s.timeout > 0 )
+				setTimeout(function(){
+					// Check to see if the request is still happening
+					if ( xhr ) {
+						// Cancel the request
+						xhr.abort();
+
+						if( !requestDone )
+							onreadystatechange( "timeout" );
+					}
+				}, s.timeout);
+		}
+
+		// Send the data
+		try {
+			xhr.send(s.data);
+		} catch(e) {
+			jQuery.handleError(s, xhr, null, e);
+		}
+
+		// firefox 1.5 doesn't fire statechange for sync requests
+		if ( !s.async )
+			onreadystatechange();
+
+		function success(){
+			// If a local callback was specified, fire it and pass it the data
+			if ( s.success )
+				s.success( data, status );
+
+			// Fire the global callback
+			if ( s.global )
+				jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
+		}
+
+		function complete(){
+			// Process result
+			if ( s.complete )
+				s.complete(xhr, status);
+
+			// The request was completed
+			if ( s.global )
+				jQuery.event.trigger( "ajaxComplete", [xhr, s] );
+
+			// Handle the global AJAX counter
+			if ( s.global && ! --jQuery.active )
+				jQuery.event.trigger( "ajaxStop" );
+		}
+
+		// return XMLHttpRequest to allow aborting the request etc.
+		return xhr;
+	},
+
+	handleError: function( s, xhr, status, e ) {
+		// If a local callback was specified, fire it
+		if ( s.error ) s.error( xhr, status, e );
+
+		// Fire the global callback
+		if ( s.global )
+			jQuery.event.trigger( "ajaxError", [xhr, s, e] );
+	},
+
+	// Counter for holding the number of active queries
+	active: 0,
+
+	// Determines if an XMLHttpRequest was successful or not
+	httpSuccess: function( xhr ) {
+		try {
+			// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+			return !xhr.status && location.protocol == "file:" ||
+				( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
+				jQuery.browser.safari && xhr.status == undefined;
+		} catch(e){}
+		return false;
+	},
+
+	// Determines if an XMLHttpRequest returns NotModified
+	httpNotModified: function( xhr, url ) {
+		try {
+			var xhrRes = xhr.getResponseHeader("Last-Modified");
+
+			// Firefox always returns 200. check Last-Modified date
+			return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
+				jQuery.browser.safari && xhr.status == undefined;
+		} catch(e){}
+		return false;
+	},
+
+	httpData: function( xhr, type, filter ) {
+		var ct = xhr.getResponseHeader("content-type"),
+			xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+			data = xml ? xhr.responseXML : xhr.responseText;
+
+		if ( xml && data.documentElement.tagName == "parsererror" )
+			throw "parsererror";
+			
+		// Allow a pre-filtering function to sanitize the response
+		if( filter )
+			data = filter( data, type );
+
+		// If the type is "script", eval it in global context
+		if ( type == "script" )
+			jQuery.globalEval( data );
+
+		// Get the JavaScript object, if JSON is used.
+		if ( type == "json" )
+			data = eval("(" + data + ")");
+
+		return data;
+	},
+
+	// Serialize an array of form elements or a set of
+	// key/values into a query string
+	param: function( a ) {
+		var s = [];
+
+		// If an array was passed in, assume that it is an array
+		// of form elements
+		if ( a.constructor == Array || a.jquery )
+			// Serialize the form elements
+			jQuery.each( a, function(){
+				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
+			});
+
+		// Otherwise, assume that it's an object of key/value pairs
+		else
+			// Serialize the key/values
+			for ( var j in a )
+				// If the value is an array then the key names need to be repeated
+				if ( a[j] && a[j].constructor == Array )
+					jQuery.each( a[j], function(){
+						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+					});
+				else
+					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
+
+		// Return the resulting serialization
+		return s.join("&").replace(/%20/g, "+");
+	}
+
+});
+jQuery.fn.extend({
+	show: function(speed,callback){
+		return speed ?
+			this.animate({
+				height: "show", width: "show", opacity: "show"
+			}, speed, callback) :
+
+			this.filter(":hidden").each(function(){
+				this.style.display = this.oldblock || "";
+				if ( jQuery.css(this,"display") == "none" ) {
+					var elem = jQuery("<" + this.tagName + " />").appendTo("body");
+					this.style.display = elem.css("display");
+					// handle an edge condition where css is - div { display:none; } or similar
+					if (this.style.display == "none")
+						this.style.display = "block";
+					elem.remove();
+				}
+			}).end();
+	},
+
+	hide: function(speed,callback){
+		return speed ?
+			this.animate({
+				height: "hide", width: "hide", opacity: "hide"
+			}, speed, callback) :
+
+			this.filter(":visible").each(function(){
+				this.oldblock = this.oldblock || jQuery.css(this,"display");
+				this.style.display = "none";
+			}).end();
+	},
+
+	// Save the old toggle function
+	_toggle: jQuery.fn.toggle,
+
+	toggle: function( fn, fn2 ){
+		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+			this._toggle.apply( this, arguments ) :
+			fn ?
+				this.animate({
+					height: "toggle", width: "toggle", opacity: "toggle"
+				}, fn, fn2) :
+				this.each(function(){
+					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
+				});
+	},
+
+	slideDown: function(speed,callback){
+		return this.animate({height: "show"}, speed, callback);
+	},
+
+	slideUp: function(speed,callback){
+		return this.animate({height: "hide"}, speed, callback);
+	},
+
+	slideToggle: function(speed, callback){
+		return this.animate({height: "toggle"}, speed, callback);
+	},
+
+	fadeIn: function(speed, callback){
+		return this.animate({opacity: "show"}, speed, callback);
+	},
+
+	fadeOut: function(speed, callback){
+		return this.animate({opacity: "hide"}, speed, callback);
+	},
+
+	fadeTo: function(speed,to,callback){
+		return this.animate({opacity: to}, speed, callback);
+	},
+
+	animate: function( prop, speed, easing, callback ) {
+		var optall = jQuery.speed(speed, easing, callback);
+
+		return this[ optall.queue === false ? "each" : "queue" ](function(){
+			if ( this.nodeType != 1)
+				return false;
+
+			var opt = jQuery.extend({}, optall), p,
+				hidden = jQuery(this).is(":hidden"), self = this;
+
+			for ( p in prop ) {
+				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+					return opt.complete.call(this);
+
+				if ( p == "height" || p == "width" ) {
+					// Store display property
+					opt.display = jQuery.css(this, "display");
+
+					// Make sure that nothing sneaks out
+					opt.overflow = this.style.overflow;
+				}
+			}
+
+			if ( opt.overflow != null )
+				this.style.overflow = "hidden";
+
+			opt.curAnim = jQuery.extend({}, prop);
+
+			jQuery.each( prop, function(name, val){
+				var e = new jQuery.fx( self, opt, name );
+
+				if ( /toggle|show|hide/.test(val) )
+					e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+				else {
+					var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+						start = e.cur(true) || 0;
+
+					if ( parts ) {
+						var end = parseFloat(parts[2]),
+							unit = parts[3] || "px";
+
+						// We need to compute starting value
+						if ( unit != "px" ) {
+							self.style[ name ] = (end || 1) + unit;
+							start = ((end || 1) / e.cur(true)) * start;
+							self.style[ name ] = start + unit;
+						}
+
+						// If a +=/-= token was provided, we're doing a relative animation
+						if ( parts[1] )
+							end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+						e.custom( start, end, unit );
+					} else
+						e.custom( start, val, "" );
+				}
+			});
+
+			// For JS strict compliance
+			return true;
+		});
+	},
+
+	queue: function(type, fn){
+		if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
+			fn = type;
+			type = "fx";
+		}
+
+		if ( !type || (typeof type == "string" && !fn) )
+			return queue( this[0], type );
+
+		return this.each(function(){
+			if ( fn.constructor == Array )
+				queue(this, type, fn);
+			else {
+				queue(this, type).push( fn );
+
+				if ( queue(this, type).length == 1 )
+					fn.call(this);
+			}
+		});
+	},
+
+	stop: function(clearQueue, gotoEnd){
+		var timers = jQuery.timers;
+
+		if (clearQueue)
+			this.queue([]);
+
+		this.each(function(){
+			// go in reverse order so anything added to the queue during the loop is ignored
+			for ( var i = timers.length - 1; i >= 0; i-- )
+				if ( timers[i].elem == this ) {
+					if (gotoEnd)
+						// force the next step to be the last
+						timers[i](true);
+					timers.splice(i, 1);
+				}
+		});
+
+		// start the next in the queue if the last step wasn't forced
+		if (!gotoEnd)
+			this.dequeue();
+
+		return this;
+	}
+
+});
+
+var queue = function( elem, type, array ) {
+	if ( elem ){
+
+		type = type || "fx";
+
+		var q = jQuery.data( elem, type + "queue" );
+
+		if ( !q || array )
+			q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+
+	}
+	return q;
+};
+
+jQuery.fn.dequeue = function(type){
+	type = type || "fx";
+
+	return this.each(function(){
+		var q = queue(this, type);
+
+		q.shift();
+
+		if ( q.length )
+			q[0].call( this );
+	});
+};
+
+jQuery.extend({
+
+	speed: function(speed, easing, fn) {
+		var opt = speed && speed.constructor == Object ? speed : {
+			complete: fn || !fn && easing ||
+				jQuery.isFunction( speed ) && speed,
+			duration: speed,
+			easing: fn && easing || easing && easing.constructor != Function && easing
+		};
+
+		opt.duration = (opt.duration && opt.duration.constructor == Number ?
+			opt.duration :
+			jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
+
+		// Queueing
+		opt.old = opt.complete;
+		opt.complete = function(){
+			if ( opt.queue !== false )
+				jQuery(this).dequeue();
+			if ( jQuery.isFunction( opt.old ) )
+				opt.old.call( this );
+		};
+
+		return opt;
+	},
+
+	easing: {
+		linear: function( p, n, firstNum, diff ) {
+			return firstNum + diff * p;
+		},
+		swing: function( p, n, firstNum, diff ) {
+			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+		}
+	},
+
+	timers: [],
+	timerId: null,
+
+	fx: function( elem, options, prop ){
+		this.options = options;
+		this.elem = elem;
+		this.prop = prop;
+
+		if ( !options.orig )
+			options.orig = {};
+	}
+
+});
+
+jQuery.fx.prototype = {
+
+	// Simple function for setting a style value
+	update: function(){
+		if ( this.options.step )
+			this.options.step.call( this.elem, this.now, this );
+
+		(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+		// Set display property to block for height/width animations
+		if ( this.prop == "height" || this.prop == "width" )
+			this.elem.style.display = "block";
+	},
+
+	// Get the current size
+	cur: function(force){
+		if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
+			return this.elem[ this.prop ];
+
+		var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+		return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+	},
+
+	// Start an animation from one number to another
+	custom: function(from, to, unit){
+		this.startTime = now();
+		this.start = from;
+		this.end = to;
+		this.unit = unit || this.unit || "px";
+		this.now = this.start;
+		this.pos = this.state = 0;
+		this.update();
+
+		var self = this;
+		function t(gotoEnd){
+			return self.step(gotoEnd);
+		}
+
+		t.elem = this.elem;
+
+		jQuery.timers.push(t);
+
+		if ( jQuery.timerId == null ) {
+			jQuery.timerId = setInterval(function(){
+				var timers = jQuery.timers;
+
+				for ( var i = 0; i < timers.length; i++ )
+					if ( !timers[i]() )
+						timers.splice(i--, 1);
+
+				if ( !timers.length ) {
+					clearInterval( jQuery.timerId );
+					jQuery.timerId = null;
+				}
+			}, 13);
+		}
+	},
+
+	// Simple 'show' function
+	show: function(){
+		// Remember where we started, so that we can go back to it later
+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+		this.options.show = true;
+
+		// Begin the animation
+		this.custom(0, this.cur());
+
+		// Make sure that we start at a small width/height to avoid any
+		// flash of content
+		if ( this.prop == "width" || this.prop == "height" )
+			this.elem.style[this.prop] = "1px";
+
+		// Start by showing the element
+		jQuery(this.elem).show();
+	},
+
+	// Simple 'hide' function
+	hide: function(){
+		// Remember where we started, so that we can go back to it later
+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+		this.options.hide = true;
+
+		// Begin the animation
+		this.custom(this.cur(), 0);
+	},
+
+	// Each step of an animation
+	step: function(gotoEnd){
+		var t = now();
+
+		if ( gotoEnd || t > this.options.duration + this.startTime ) {
+			this.now = this.end;
+			this.pos = this.state = 1;
+			this.update();
+
+			this.options.curAnim[ this.prop ] = true;
+
+			var done = true;
+			for ( var i in this.options.curAnim )
+				if ( this.options.curAnim[i] !== true )
+					done = false;
+
+			if ( done ) {
+				if ( this.options.display != null ) {
+					// Reset the overflow
+					this.elem.style.overflow = this.options.overflow;
+
+					// Reset the display
+					this.elem.style.display = this.options.display;
+					if ( jQuery.css(this.elem, "display") == "none" )
+						this.elem.style.display = "block";
+				}
+
+				// Hide the element if the "hide" operation was done
+				if ( this.options.hide )
+					this.elem.style.display = "none";
+
+				// Reset the properties, if the item has been hidden or shown
+				if ( this.options.hide || this.options.show )
+					for ( var p in this.options.curAnim )
+						jQuery.attr(this.elem.style, p, this.options.orig[p]);
+			}
+
+			if ( done )
+				// Execute the complete function
+				this.options.complete.call( this.elem );
+
+			return false;
+		} else {
+			var n = t - this.startTime;
+			this.state = n / this.options.duration;
+
+			// Perform the easing function, defaults to swing
+			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+			this.now = this.start + ((this.end - this.start) * this.pos);
+
+			// Perform the next step of the animation
+			this.update();
+		}
+
+		return true;
+	}
+
+};
+
+jQuery.extend( jQuery.fx, {
+	speeds:{
+		slow: 600,
+ 		fast: 200,
+ 		// Default speed
+ 		def: 400
+	},
+	step: {
+		scrollLeft: function(fx){
+			fx.elem.scrollLeft = fx.now;
+		},
+
+		scrollTop: function(fx){
+			fx.elem.scrollTop = fx.now;
+		},
+
+		opacity: function(fx){
+			jQuery.attr(fx.elem.style, "opacity", fx.now);
+		},
+
+		_default: function(fx){
+			fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+		}
+	}
+});
+// The Offset Method
+// Originally By Brandon Aaron, part of the Dimension Plugin
+// http://jquery.com/plugins/project/dimensions
+jQuery.fn.offset = function() {
+	var left = 0, top = 0, elem = this[0], results;
+
+	if ( elem ) with ( jQuery.browser ) {
+		var parent       = elem.parentNode,
+		    offsetChild  = elem,
+		    offsetParent = elem.offsetParent,
+		    doc          = elem.ownerDocument,
+		    safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
+		    css          = jQuery.curCSS,
+		    fixed        = css(elem, "position") == "fixed";
+
+		// Use getBoundingClientRect if available
+		if ( elem.getBoundingClientRect ) {
+			var box = elem.getBoundingClientRect();
+
+			// Add the document scroll offsets
+			add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+				box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
+
+			// IE adds the HTML element's border, by default it is medium which is 2px
+			// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
+			// IE 7 standards mode, the border is always 2px
+			// This border/offset is typically represented by the clientLeft and clientTop properties
+			// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
+			// Therefore this method will be off by 2px in IE while in quirksmode
+			add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
+
+		// Otherwise loop through the offsetParents and parentNodes
+		} else {
+
+			// Initial element offsets
+			add( elem.offsetLeft, elem.offsetTop );
+
+			// Get parent offsets
+			while ( offsetParent ) {
+				// Add offsetParent offsets
+				add( offsetParent.offsetLeft, offsetParent.offsetTop );
+
+				// Mozilla and Safari > 2 does not include the border on offset parents
+				// However Mozilla adds the border for table or table cells
+				if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
+					border( offsetParent );
+
+				// Add the document scroll offsets if position is fixed on any offsetParent
+				if ( !fixed && css(offsetParent, "position") == "fixed" )
+					fixed = true;
+
+				// Set offsetChild to previous offsetParent unless it is the body element
+				offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
+				// Get next offsetParent
+				offsetParent = offsetParent.offsetParent;
+			}
+
+			// Get parent scroll offsets
+			while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
+				// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
+				if ( !/^inline|table.*$/i.test(css(parent, "display")) )
+					// Subtract parent scroll offsets
+					add( -parent.scrollLeft, -parent.scrollTop );
+
+				// Mozilla does not add the border for a parent that has overflow != visible
+				if ( mozilla && css(parent, "overflow") != "visible" )
+					border( parent );
+
+				// Get next parent
+				parent = parent.parentNode;
+			}
+
+			// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
+			// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
+			if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
+				(mozilla && css(offsetChild, "position") != "absolute") )
+					add( -doc.body.offsetLeft, -doc.body.offsetTop );
+
+			// Add the document scroll offsets if position is fixed
+			if ( fixed )
+				add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+					Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
+		}
+
+		// Return an object with top and left properties
+		results = { top: top, left: left };
+	}
+
+	function border(elem) {
+		add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
+	}
+
+	function add(l, t) {
+		left += parseInt(l, 10) || 0;
+		top += parseInt(t, 10) || 0;
+	}
+
+	return results;
+};
+
+
+jQuery.fn.extend({
+	position: function() {
+		var left = 0, top = 0, results;
+
+		if ( this[0] ) {
+			// Get *real* offsetParent
+			var offsetParent = this.offsetParent(),
+
+			// Get correct offsets
+			offset       = this.offset(),
+			parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+			// Subtract element margins
+			// note: when an element has margin: auto the offsetLeft and marginLeft 
+			// are the same in Safari causing offset.left to incorrectly be 0
+			offset.top  -= num( this, 'marginTop' );
+			offset.left -= num( this, 'marginLeft' );
+
+			// Add offsetParent borders
+			parentOffset.top  += num( offsetParent, 'borderTopWidth' );
+			parentOffset.left += num( offsetParent, 'borderLeftWidth' );
+
+			// Subtract the two offsets
+			results = {
+				top:  offset.top  - parentOffset.top,
+				left: offset.left - parentOffset.left
+			};
+		}
+
+		return results;
+	},
+
+	offsetParent: function() {
+		var offsetParent = this[0].offsetParent;
+		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
+			offsetParent = offsetParent.offsetParent;
+		return jQuery(offsetParent);
+	}
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ['Left', 'Top'], function(i, name) {
+	var method = 'scroll' + name;
+	
+	jQuery.fn[ method ] = function(val) {
+		if (!this[0]) return;
+
+		return val != undefined ?
+
+			// Set the scroll offset
+			this.each(function() {
+				this == window || this == document ?
+					window.scrollTo(
+						!i ? val : jQuery(window).scrollLeft(),
+						 i ? val : jQuery(window).scrollTop()
+					) :
+					this[ method ] = val;
+			}) :
+
+			// Return the scroll offset
+			this[0] == window || this[0] == document ?
+				self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
+					jQuery.boxModel && document.documentElement[ method ] ||
+					document.body[ method ] :
+				this[0][ method ];
+	};
+});
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function(i, name){
+
+	var tl = i ? "Left"  : "Top",  // top or left
+		br = i ? "Right" : "Bottom"; // bottom or right
+
+	// innerHeight and innerWidth
+	jQuery.fn["inner" + name] = function(){
+		return this[ name.toLowerCase() ]() +
+			num(this, "padding" + tl) +
+			num(this, "padding" + br);
+	};
+
+	// outerHeight and outerWidth
+	jQuery.fn["outer" + name] = function(margin) {
+		return this["inner" + name]() +
+			num(this, "border" + tl + "Width") +
+			num(this, "border" + br + "Width") +
+			(margin ?
+				num(this, "margin" + tl) + num(this, "margin" + br) : 0);
+	};
+
+});})();
diff --git a/lib/mootools.js b/lib/mootools.js
new file mode 100644
index 0000000..7e1e482
--- /dev/null
+++ b/lib/mootools.js
@@ -0,0 +1,3946 @@
+/*
+Script: Core.js
+	MooTools - My Object Oriented JavaScript Tools.
+
+License:
+	MIT-style license.
+
+Copyright:
+	Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/).
+
+Code & Documentation:
+	[The MooTools production team](http://mootools.net/developers/).
+
+Inspiration:
+	- Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
+	- Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
+*/
+
+var MooTools = {
+	'version': '1.2.1',
+	'build': '0d4845aab3d9a4fdee2f0d4a6dd59210e4b697cf'
+};
+
+var Native = function(options){
+	options = options || {};
+	var name = options.name;
+	var legacy = options.legacy;
+	var protect = options.protect;
+	var methods = options.implement;
+	var generics = options.generics;
+	var initialize = options.initialize;
+	var afterImplement = options.afterImplement || function(){};
+	var object = initialize || legacy;
+	generics = generics !== false;
+
+	object.constructor = Native;
+	object.$family = {name: 'native'};
+	if (legacy && initialize) object.prototype = legacy.prototype;
+	object.prototype.constructor = object;
+
+	if (name){
+		var family = name.toLowerCase();
+		object.prototype.$family = {name: family};
+		Native.typize(object, family);
+	}
+
+	var add = function(obj, name, method, force){
+		if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method;
+		if (generics) Native.genericize(obj, name, protect);
+		afterImplement.call(obj, name, method);
+		return obj;
+	};
+
+	object.alias = function(a1, a2, a3){
+		if (typeof a1 == 'string'){
+			if ((a1 = this.prototype[a1])) return add(this, a2, a1, a3);
+		}
+		for (var a in a1) this.alias(a, a1[a], a2);
+		return this;
+	};
+
+	object.implement = function(a1, a2, a3){
+		if (typeof a1 == 'string') return add(this, a1, a2, a3);
+		for (var p in a1) add(this, p, a1[p], a2);
+		return this;
+	};
+
+	if (methods) object.implement(methods);
+
+	return object;
+};
+
+Native.genericize = function(object, property, check){
+	if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){
+		var args = Array.prototype.slice.call(arguments);
+		return object.prototype[property].apply(args.shift(), args);
+	};
+};
+
+Native.implement = function(objects, properties){
+	for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties);
+};
+
+Native.typize = function(object, family){
+	if (!object.type) object.type = function(item){
+		return ($type(item) === family);
+	};
+};
+
+(function(){
+	var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String};
+	for (var n in natives) new Native({name: n, initialize: natives[n], protect: true});
+
+	var types = {'boolean': Boolean, 'native': Native, 'object': Object};
+	for (var t in types) Native.typize(types[t], t);
+
+	var generics = {
+		'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"],
+		'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"]
+	};
+	for (var g in generics){
+		for (var i = generics[g].length; i--;) Native.genericize(window[g], generics[g][i], true);
+	};
+})();
+
+var Hash = new Native({
+
+	name: 'Hash',
+
+	initialize: function(object){
+		if ($type(object) == 'hash') object = $unlink(object.getClean());
+		for (var key in object) this[key] = object[key];
+		return this;
+	}
+
+});
+
+Hash.implement({
+
+	forEach: function(fn, bind){
+		for (var key in this){
+			if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this);
+		}
+	},
+
+	getClean: function(){
+		var clean = {};
+		for (var key in this){
+			if (this.hasOwnProperty(key)) clean[key] = this[key];
+		}
+		return clean;
+	},
+
+	getLength: function(){
+		var length = 0;
+		for (var key in this){
+			if (this.hasOwnProperty(key)) length++;
+		}
+		return length;
+	}
+
+});
+
+Hash.alias('forEach', 'each');
+
+Array.implement({
+
+	forEach: function(fn, bind){
+		for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this);
+	}
+
+});
+
+Array.alias('forEach', 'each');
+
+function $A(iterable){
+	if (iterable.item){
+		var array = [];
+		for (var i = 0, l = iterable.length; i < l; i++) array[i] = iterable[i];
+		return array;
+	}
+	return Array.prototype.slice.call(iterable);
+};
+
+function $arguments(i){
+	return function(){
+		return arguments[i];
+	};
+};
+
+function $chk(obj){
+	return !!(obj || obj === 0);
+};
+
+function $clear(timer){
+	clearTimeout(timer);
+	clearInterval(timer);
+	return null;
+};
+
+function $defined(obj){
+	return (obj != undefined);
+};
+
+function $each(iterable, fn, bind){
+	var type = $type(iterable);
+	((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind);
+};
+
+function $empty(){};
+
+function $extend(original, extended){
+	for (var key in (extended || {})) original[key] = extended[key];
+	return original;
+};
+
+function $H(object){
+	return new Hash(object);
+};
+
+function $lambda(value){
+	return (typeof value == 'function') ? value : function(){
+		return value;
+	};
+};
+
+function $merge(){
+	var mix = {};
+	for (var i = 0, l = arguments.length; i < l; i++){
+		var object = arguments[i];
+		if ($type(object) != 'object') continue;
+		for (var key in object){
+			var op = object[key], mp = mix[key];
+			mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $merge(mp, op) : $unlink(op);
+		}
+	}
+	return mix;
+};
+
+function $pick(){
+	for (var i = 0, l = arguments.length; i < l; i++){
+		if (arguments[i] != undefined) return arguments[i];
+	}
+	return null;
+};
+
+function $random(min, max){
+	return Math.floor(Math.random() * (max - min + 1) + min);
+};
+
+function $splat(obj){
+	var type = $type(obj);
+	return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
+};
+
+var $time = Date.now || function(){
+	return +new Date;
+};
+
+function $try(){
+	for (var i = 0, l = arguments.length; i < l; i++){
+		try {
+			return arguments[i]();
+		} catch(e){}
+	}
+	return null;
+};
+
+function $type(obj){
+	if (obj == undefined) return false;
+	if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
+	if (obj.nodeName){
+		switch (obj.nodeType){
+			case 1: return 'element';
+			case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
+		}
+	} else if (typeof obj.length == 'number'){
+		if (obj.callee) return 'arguments';
+		else if (obj.item) return 'collection';
+	}
+	return typeof obj;
+};
+
+function $unlink(object){
+	var unlinked;
+	switch ($type(object)){
+		case 'object':
+			unlinked = {};
+			for (var p in object) unlinked[p] = $unlink(object[p]);
+		break;
+		case 'hash':
+			unlinked = new Hash(object);
+		break;
+		case 'array':
+			unlinked = [];
+			for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]);
+		break;
+		default: return object;
+	}
+	return unlinked;
+};
+
+
+/*
+Script: Browser.js
+	The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash.
+
+License:
+	MIT-style license.
+*/
+
+var Browser = $merge({
+
+	Engine: {name: 'unknown', version: 0},
+
+	Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()},
+
+	Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)},
+
+	Plugins: {},
+
+	Engines: {
+
+		presto: function(){
+			return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925));
+		},
+
+		trident: function(){
+			return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? 5 : 4);
+		},
+
+		webkit: function(){
+			return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419);
+		},
+
+		gecko: function(){
+			return (document.getBoxObjectFor == undefined) ? false : ((document.getElementsByClassName) ? 19 : 18);
+		}
+
+	}
+
+}, Browser || {});
+
+Browser.Platform[Browser.Platform.name] = true;
+
+Browser.detect = function(){
+
+	for (var engine in this.Engines){
+		var version = this.Engines[engine]();
+		if (version){
+			this.Engine = {name: engine, version: version};
+			this.Engine[engine] = this.Engine[engine + version] = true;
+			break;
+		}
+	}
+
+	return {name: engine, version: version};
+
+};
+
+Browser.detect();
+
+Browser.Request = function(){
+	return $try(function(){
+		return new XMLHttpRequest();
+	}, function(){
+		return new ActiveXObject('MSXML2.XMLHTTP');
+	});
+};
+
+Browser.Features.xhr = !!(Browser.Request());
+
+Browser.Plugins.Flash = (function(){
+	var version = ($try(function(){
+		return navigator.plugins['Shockwave Flash'].description;
+	}, function(){
+		return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
+	}) || '0 r0').match(/\d+/g);
+	return {version: parseInt(version[0] || 0 + '.' + version[1] || 0), build: parseInt(version[2] || 0)};
+})();
+
+function $exec(text){
+	if (!text) return text;
+	if (window.execScript){
+		window.execScript(text);
+	} else {
+		var script = document.createElement('script');
+		script.setAttribute('type', 'text/javascript');
+		script[(Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerText' : 'text'] = text;
+		document.head.appendChild(script);
+		document.head.removeChild(script);
+	}
+	return text;
+};
+
+Native.UID = 1;
+
+var $uid = (Browser.Engine.trident) ? function(item){
+	return (item.uid || (item.uid = [Native.UID++]))[0];
+} : function(item){
+	return item.uid || (item.uid = Native.UID++);
+};
+
+var Window = new Native({
+
+	name: 'Window',
+
+	legacy: (Browser.Engine.trident) ? null: window.Window,
+
+	initialize: function(win){
+		$uid(win);
+		if (!win.Element){
+			win.Element = $empty;
+			if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2
+			win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {};
+		}
+		win.document.window = win;
+		return $extend(win, Window.Prototype);
+	},
+
+	afterImplement: function(property, value){
+		window[property] = Window.Prototype[property] = value;
+	}
+
+});
+
+Window.Prototype = {$family: {name: 'window'}};
+
+new Window(window);
+
+var Document = new Native({
+
+	name: 'Document',
+
+	legacy: (Browser.Engine.trident) ? null: window.Document,
+
+	initialize: function(doc){
+		$uid(doc);
+		doc.head = doc.getElementsByTagName('head')[0];
+		doc.html = doc.getElementsByTagName('html')[0];
+		if (Browser.Engine.trident && Browser.Engine.version <= 4) $try(function(){
+			doc.execCommand("BackgroundImageCache", false, true);
+		});
+		if (Browser.Engine.trident) doc.window.attachEvent('onunload', function() {
+			doc.window.detachEvent('onunload', arguments.callee);
+			doc.head = doc.html = doc.window = null;
+		});
+		return $extend(doc, Document.Prototype);
+	},
+
+	afterImplement: function(property, value){
+		document[property] = Document.Prototype[property] = value;
+	}
+
+});
+
+Document.Prototype = {$family: {name: 'document'}};
+
+new Document(document);
+
+
+/*
+Script: Array.js
+	Contains Array Prototypes like each, contains, and erase.
+
+License:
+	MIT-style license.
+*/
+
+Array.implement({
+
+	every: function(fn, bind){
+		for (var i = 0, l = this.length; i < l; i++){
+			if (!fn.call(bind, this[i], i, this)) return false;
+		}
+		return true;
+	},
+
+	filter: function(fn, bind){
+		var results = [];
+		for (var i = 0, l = this.length; i < l; i++){
+			if (fn.call(bind, this[i], i, this)) results.push(this[i]);
+		}
+		return results;
+	},
+
+	clean: function() {
+		return this.filter($defined);
+	},
+
+	indexOf: function(item, from){
+		var len = this.length;
+		for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
+			if (this[i] === item) return i;
+		}
+		return -1;
+	},
+
+	map: function(fn, bind){
+		var results = [];
+		for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this);
+		return results;
+	},
+
+	some: function(fn, bind){
+		for (var i = 0, l = this.length; i < l; i++){
+			if (fn.call(bind, this[i], i, this)) return true;
+		}
+		return false;
+	},
+
+	associate: function(keys){
+		var obj = {}, length = Math.min(this.length, keys.length);
+		for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
+		return obj;
+	},
+
+	link: function(object){
+		var result = {};
+		for (var i = 0, l = this.length; i < l; i++){
+			for (var key in object){
+				if (object[key](this[i])){
+					result[key] = this[i];
+					delete object[key];
+					break;
+				}
+			}
+		}
+		return result;
+	},
+
+	contains: function(item, from){
+		return this.indexOf(item, from) != -1;
+	},
+
+	extend: function(array){
+		for (var i = 0, j = array.length; i < j; i++) this.push(array[i]);
+		return this;
+	},
+
+	getLast: function(){
+		return (this.length) ? this[this.length - 1] : null;
+	},
+
+	getRandom: function(){
+		return (this.length) ? this[$random(0, this.length - 1)] : null;
+	},
+
+	include: function(item){
+		if (!this.contains(item)) this.push(item);
+		return this;
+	},
+
+	combine: function(array){
+		for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
+		return this;
+	},
+
+	erase: function(item){
+		for (var i = this.length; i--; i){
+			if (this[i] === item) this.splice(i, 1);
+		}
+		return this;
+	},
+
+	empty: function(){
+		this.length = 0;
+		return this;
+	},
+
+	flatten: function(){
+		var array = [];
+		for (var i = 0, l = this.length; i < l; i++){
+			var type = $type(this[i]);
+			if (!type) continue;
+			array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]);
+		}
+		return array;
+	},
+
+	hexToRgb: function(array){
+		if (this.length != 3) return null;
+		var rgb = this.map(function(value){
+			if (value.length == 1) value += value;
+			return value.toInt(16);
+		});
+		return (array) ? rgb : 'rgb(' + rgb + ')';
+	},
+
+	rgbToHex: function(array){
+		if (this.length < 3) return null;
+		if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
+		var hex = [];
+		for (var i = 0; i < 3; i++){
+			var bit = (this[i] - 0).toString(16);
+			hex.push((bit.length == 1) ? '0' + bit : bit);
+		}
+		return (array) ? hex : '#' + hex.join('');
+	}
+
+});
+
+
+/*
+Script: Function.js
+	Contains Function Prototypes like create, bind, pass, and delay.
+
+License:
+	MIT-style license.
+*/
+
+Function.implement({
+
+	extend: function(properties){
+		for (var property in properties) this[property] = properties[property];
+		return this;
+	},
+
+	create: function(options){
+		var self = this;
+		options = options || {};
+		return function(event){
+			var args = options.arguments;
+			args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0);
+			if (options.event) args = [event || window.event].extend(args);
+			var returns = function(){
+				return self.apply(options.bind || null, args);
+			};
+			if (options.delay) return setTimeout(returns, options.delay);
+			if (options.periodical) return setInterval(returns, options.periodical);
+			if (options.attempt) return $try(returns);
+			return returns();
+		};
+	},
+
+	run: function(args, bind){
+		return this.apply(bind, $splat(args));
+	},
+
+	pass: function(args, bind){
+		return this.create({bind: bind, arguments: args});
+	},
+
+	bind: function(bind, args){
+		return this.create({bind: bind, arguments: args});
+	},
+
+	bindWithEvent: function(bind, args){
+		return this.create({bind: bind, arguments: args, event: true});
+	},
+
+	attempt: function(args, bind){
+		return this.create({bind: bind, arguments: args, attempt: true})();
+	},
+
+	delay: function(delay, bind, args){
+		return this.create({bind: bind, arguments: args, delay: delay})();
+	},
+
+	periodical: function(periodical, bind, args){
+		return this.create({bind: bind, arguments: args, periodical: periodical})();
+	}
+
+});
+
+
+/*
+Script: Number.js
+	Contains Number Prototypes like limit, round, times, and ceil.
+
+License:
+	MIT-style license.
+*/
+
+Number.implement({
+
+	limit: function(min, max){
+		return Math.min(max, Math.max(min, this));
+	},
+
+	round: function(precision){
+		precision = Math.pow(10, precision || 0);
+		return Math.round(this * precision) / precision;
+	},
+
+	times: function(fn, bind){
+		for (var i = 0; i < this; i++) fn.call(bind, i, this);
+	},
+
+	toFloat: function(){
+		return parseFloat(this);
+	},
+
+	toInt: function(base){
+		return parseInt(this, base || 10);
+	}
+
+});
+
+Number.alias('times', 'each');
+
+(function(math){
+	var methods = {};
+	math.each(function(name){
+		if (!Number[name]) methods[name] = function(){
+			return Math[name].apply(null, [this].concat($A(arguments)));
+		};
+	});
+	Number.implement(methods);
+})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
+
+
+/*
+Script: String.js
+	Contains String Prototypes like camelCase, capitalize, test, and toInt.
+
+License:
+	MIT-style license.
+*/
+
+String.implement({
+
+	test: function(regex, params){
+		return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this);
+	},
+
+	contains: function(string, separator){
+		return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
+	},
+
+	trim: function(){
+		return this.replace(/^\s+|\s+$/g, '');
+	},
+
+	clean: function(){
+		return this.replace(/\s+/g, ' ').trim();
+	},
+
+	camelCase: function(){
+		return this.replace(/-\D/g, function(match){
+			return match.charAt(1).toUpperCase();
+		});
+	},
+
+	hyphenate: function(){
+		return this.replace(/[A-Z]/g, function(match){
+			return ('-' + match.charAt(0).toLowerCase());
+		});
+	},
+
+	capitalize: function(){
+		return this.replace(/\b[a-z]/g, function(match){
+			return match.toUpperCase();
+		});
+	},
+
+	escapeRegExp: function(){
+		return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
+	},
+
+	toInt: function(base){
+		return parseInt(this, base || 10);
+	},
+
+	toFloat: function(){
+		return parseFloat(this);
+	},
+
+	hexToRgb: function(array){
+		var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
+		return (hex) ? hex.slice(1).hexToRgb(array) : null;
+	},
+
+	rgbToHex: function(array){
+		var rgb = this.match(/\d{1,3}/g);
+		return (rgb) ? rgb.rgbToHex(array) : null;
+	},
+
+	stripScripts: function(option){
+		var scripts = '';
+		var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
+			scripts += arguments[1] + '\n';
+			return '';
+		});
+		if (option === true) $exec(scripts);
+		else if ($type(option) == 'function') option(scripts, text);
+		return text;
+	},
+
+	substitute: function(object, regexp){
+		return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
+			if (match.charAt(0) == '\\') return match.slice(1);
+			return (object[name] != undefined) ? object[name] : '';
+		});
+	}
+
+});
+
+
+/*
+Script: Hash.js
+	Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
+
+License:
+	MIT-style license.
+*/
+
+Hash.implement({
+
+	has: Object.prototype.hasOwnProperty,
+
+	keyOf: function(value){
+		for (var key in this){
+			if (this.hasOwnProperty(key) && this[key] === value) return key;
+		}
+		return null;
+	},
+
+	hasValue: function(value){
+		return (Hash.keyOf(this, value) !== null);
+	},
+
+	extend: function(properties){
+		Hash.each(properties, function(value, key){
+			Hash.set(this, key, value);
+		}, this);
+		return this;
+	},
+
+	combine: function(properties){
+		Hash.each(properties, function(value, key){
+			Hash.include(this, key, value);
+		}, this);
+		return this;
+	},
+
+	erase: function(key){
+		if (this.hasOwnProperty(key)) delete this[key];
+		return this;
+	},
+
+	get: function(key){
+		return (this.hasOwnProperty(key)) ? this[key] : null;
+	},
+
+	set: function(key, value){
+		if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
+		return this;
+	},
+
+	empty: function(){
+		Hash.each(this, function(value, key){
+			delete this[key];
+		}, this);
+		return this;
+	},
+
+	include: function(key, value){
+		var k = this[key];
+		if (k == undefined) this[key] = value;
+		return this;
+	},
+
+	map: function(fn, bind){
+		var results = new Hash;
+		Hash.each(this, function(value, key){
+			results.set(key, fn.call(bind, value, key, this));
+		}, this);
+		return results;
+	},
+
+	filter: function(fn, bind){
+		var results = new Hash;
+		Hash.each(this, function(value, key){
+			if (fn.call(bind, value, key, this)) results.set(key, value);
+		}, this);
+		return results;
+	},
+
+	every: function(fn, bind){
+		for (var key in this){
+			if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false;
+		}
+		return true;
+	},
+
+	some: function(fn, bind){
+		for (var key in this){
+			if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true;
+		}
+		return false;
+	},
+
+	getKeys: function(){
+		var keys = [];
+		Hash.each(this, function(value, key){
+			keys.push(key);
+		});
+		return keys;
+	},
+
+	getValues: function(){
+		var values = [];
+		Hash.each(this, function(value){
+			values.push(value);
+		});
+		return values;
+	},
+
+	toQueryString: function(base){
+		var queryString = [];
+		Hash.each(this, function(value, key){
+			if (base) key = base + '[' + key + ']';
+			var result;
+			switch ($type(value)){
+				case 'object': result = Hash.toQueryString(value, key); break;
+				case 'array':
+					var qs = {};
+					value.each(function(val, i){
+						qs[i] = val;
+					});
+					result = Hash.toQueryString(qs, key);
+				break;
+				default: result = key + '=' + encodeURIComponent(value);
+			}
+			if (value != undefined) queryString.push(result);
+		});
+
+		return queryString.join('&');
+	}
+
+});
+
+Hash.alias({keyOf: 'indexOf', hasValue: 'contains'});
+
+
+/*
+Script: Event.js
+	Contains the Event Native, to make the event object completely crossbrowser.
+
+License:
+	MIT-style license.
+*/
+
+var Event = new Native({
+
+	name: 'Event',
+
+	initialize: function(event, win){
+		win = win || window;
+		var doc = win.document;
+		event = event || win.event;
+		if (event.$extended) return event;
+		this.$extended = true;
+		var type = event.type;
+		var target = event.target || event.srcElement;
+		while (target && target.nodeType == 3) target = target.parentNode;
+
+		if (type.test(/key/)){
+			var code = event.which || event.keyCode;
+			var key = Event.Keys.keyOf(code);
+			if (type == 'keydown'){
+				var fKey = code - 111;
+				if (fKey > 0 && fKey < 13) key = 'f' + fKey;
+			}
+			key = key || String.fromCharCode(code).toLowerCase();
+		} else if (type.match(/(click|mouse|menu)/i)){
+			doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
+			var page = {
+				x: event.pageX || event.clientX + doc.scrollLeft,
+				y: event.pageY || event.clientY + doc.scrollTop
+			};
+			var client = {
+				x: (event.pageX) ? event.pageX - win.pageXOffset : event.clientX,
+				y: (event.pageY) ? event.pageY - win.pageYOffset : event.clientY
+			};
+			if (type.match(/DOMMouseScroll|mousewheel/)){
+				var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3;
+			}
+			var rightClick = (event.which == 3) || (event.button == 2);
+			var related = null;
+			if (type.match(/over|out/)){
+				switch (type){
+					case 'mouseover': related = event.relatedTarget || event.fromElement; break;
+					case 'mouseout': related = event.relatedTarget || event.toElement;
+				}
+				if (!(function(){
+					while (related && related.nodeType == 3) related = related.parentNode;
+					return true;
+				}).create({attempt: Browser.Engine.gecko})()) related = false;
+			}
+		}
+
+		return $extend(this, {
+			event: event,
+			type: type,
+
+			page: page,
+			client: client,
+			rightClick: rightClick,
+
+			wheel: wheel,
+
+			relatedTarget: related,
+			target: target,
+
+			code: code,
+			key: key,
+
+			shift: event.shiftKey,
+			control: event.ctrlKey,
+			alt: event.altKey,
+			meta: event.metaKey
+		});
+	}
+
+});
+
+Event.Keys = new Hash({
+	'enter': 13,
+	'up': 38,
+	'down': 40,
+	'left': 37,
+	'right': 39,
+	'esc': 27,
+	'space': 32,
+	'backspace': 8,
+	'tab': 9,
+	'delete': 46
+});
+
+Event.implement({
+
+	stop: function(){
+		return this.stopPropagation().preventDefault();
+	},
+
+	stopPropagation: function(){
+		if (this.event.stopPropagation) this.event.stopPropagation();
+		else this.event.cancelBubble = true;
+		return this;
+	},
+
+	preventDefault: function(){
+		if (this.event.preventDefault) this.event.preventDefault();
+		else this.event.returnValue = false;
+		return this;
+	}
+
+});
+
+
+/*
+Script: Class.js
+	Contains the Class Function for easily creating, extending, and implementing reusable Classes.
+
+License:
+	MIT-style license.
+*/
+
+var Class = new Native({
+
+	name: 'Class',
+
+	initialize: function(properties){
+		properties = properties || {};
+		var klass = function(){
+			for (var key in this){
+				if ($type(this[key]) != 'function') this[key] = $unlink(this[key]);
+			}
+			this.constructor = klass;
+			if (Class.prototyping) return this;
+			var instance = (this.initialize) ? this.initialize.apply(this, arguments) : this;
+			if (this.options && this.options.initialize) this.options.initialize.call(this);
+			return instance;
+		};
+
+		for (var mutator in Class.Mutators){
+			if (!properties[mutator]) continue;
+			properties = Class.Mutators[mutator](properties, properties[mutator]);
+			delete properties[mutator];
+		}
+
+		$extend(klass, this);
+		klass.constructor = Class;
+		klass.prototype = properties;
+		return klass;
+	}
+
+});
+
+Class.Mutators = {
+
+	Extends: function(self, klass){
+		Class.prototyping = klass.prototype;
+		var subclass = new klass;
+		delete subclass.parent;
+		subclass = Class.inherit(subclass, self);
+		delete Class.prototyping;
+		return subclass;
+	},
+
+	Implements: function(self, klasses){
+		$splat(klasses).each(function(klass){
+			Class.prototying = klass;
+			$extend(self, ($type(klass) == 'class') ? new klass : klass);
+			delete Class.prototyping;
+		});
+		return self;
+	}
+
+};
+
+Class.extend({
+
+	inherit: function(object, properties){
+		var caller = arguments.callee.caller;
+		for (var key in properties){
+			var override = properties[key];
+			var previous = object[key];
+			var type = $type(override);
+			if (previous && type == 'function'){
+				if (override != previous){
+					if (caller){
+						override.__parent = previous;
+						object[key] = override;
+					} else {
+						Class.override(object, key, override);
+					}
+				}
+			} else if(type == 'object'){
+				object[key] = $merge(previous, override);
+			} else {
+				object[key] = override;
+			}
+		}
+
+		if (caller) object.parent = function(){
+			return arguments.callee.caller.__parent.apply(this, arguments);
+		};
+
+		return object;
+	},
+
+	override: function(object, name, method){
+		var parent = Class.prototyping;
+		if (parent && object[name] != parent[name]) parent = null;
+		var override = function(){
+			var previous = this.parent;
+			this.parent = parent ? parent[name] : object[name];
+			var value = method.apply(this, arguments);
+			this.parent = previous;
+			return value;
+		};
+		object[name] = override;
+	}
+
+});
+
+Class.implement({
+
+	implement: function(){
+		var proto = this.prototype;
+		$each(arguments, function(properties){
+			Class.inherit(proto, properties);
+		});
+		return this;
+	}
+
+});
+
+
+/*
+Script: Class.Extras.js
+	Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
+
+License:
+	MIT-style license.
+*/
+
+var Chain = new Class({
+
+	$chain: [],
+
+	chain: function(){
+		this.$chain.extend(Array.flatten(arguments));
+		return this;
+	},
+
+	callChain: function(){
+		return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
+	},
+
+	clearChain: function(){
+		this.$chain.empty();
+		return this;
+	}
+
+});
+
+var Events = new Class({
+
+	$events: {},
+
+	addEvent: function(type, fn, internal){
+		type = Events.removeOn(type);
+		if (fn != $empty){
+			this.$events[type] = this.$events[type] || [];
+			this.$events[type].include(fn);
+			if (internal) fn.internal = true;
+		}
+		return this;
+	},
+
+	addEvents: function(events){
+		for (var type in events) this.addEvent(type, events[type]);
+		return this;
+	},
+
+	fireEvent: function(type, args, delay){
+		type = Events.removeOn(type);
+		if (!this.$events || !this.$events[type]) return this;
+		this.$events[type].each(function(fn){
+			fn.create({'bind': this, 'delay': delay, 'arguments': args})();
+		}, this);
+		return this;
+	},
+
+	removeEvent: function(type, fn){
+		type = Events.removeOn(type);
+		if (!this.$events[type]) return this;
+		if (!fn.internal) this.$events[type].erase(fn);
+		return this;
+	},
+
+	removeEvents: function(events){
+		if ($type(events) == 'object'){
+			for (var type in events) this.removeEvent(type, events[type]);
+			return this;
+		}
+		if (events) events = Events.removeOn(events);
+		for (var type in this.$events){
+			if (events && events != type) continue;
+			var fns = this.$events[type];
+			for (var i = fns.length; i--; i) this.removeEvent(type, fns[i]);
+		}
+		return this;
+	}
+
+});
+
+Events.removeOn = function(string){
+	return string.replace(/^on([A-Z])/, function(full, first) {
+		return first.toLowerCase();
+	});
+};
+
+var Options = new Class({
+
+	setOptions: function(){
+		this.options = $merge.run([this.options].extend(arguments));
+		if (!this.addEvent) return this;
+		for (var option in this.options){
+			if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
+			this.addEvent(option, this.options[option]);
+			delete this.options[option];
+		}
+		return this;
+	}
+
+});
+
+
+/*
+Script: Element.js
+	One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser,
+	time-saver methods to let you easily work with HTML Elements.
+
+License:
+	MIT-style license.
+*/
+
+var Element = new Native({
+
+	name: 'Element',
+
+	legacy: window.Element,
+
+	initialize: function(tag, props){
+		var konstructor = Element.Constructors.get(tag);
+		if (konstructor) return konstructor(props);
+		if (typeof tag == 'string') return document.newElement(tag, props);
+		return $(tag).set(props);
+	},
+
+	afterImplement: function(key, value){
+		Element.Prototype[key] = value;
+		if (Array[key]) return;
+		Elements.implement(key, function(){
+			var items = [], elements = true;
+			for (var i = 0, j = this.length; i < j; i++){
+				var returns = this[i][key].apply(this[i], arguments);
+				items.push(returns);
+				if (elements) elements = ($type(returns) == 'element');
+			}
+			return (elements) ? new Elements(items) : items;
+		});
+	}
+
+});
+
+Element.Prototype = {$family: {name: 'element'}};
+
+Element.Constructors = new Hash;
+
+var IFrame = new Native({
+
+	name: 'IFrame',
+
+	generics: false,
+
+	initialize: function(){
+		var params = Array.link(arguments, {properties: Object.type, iframe: $defined});
+		var props = params.properties || {};
+		var iframe = $(params.iframe) || false;
+		var onload = props.onload || $empty;
+		delete props.onload;
+		props.id = props.name = $pick(props.id, props.name, iframe.id, iframe.name, 'IFrame_' + $time());
+		iframe = new Element(iframe || 'iframe', props);
+		var onFrameLoad = function(){
+			var host = $try(function(){
+				return iframe.contentWindow.location.host;
+			});
+			if (host && host == window.location.host){
+				var win = new Window(iframe.contentWindow);
+				new Document(iframe.contentWindow.document);
+				$extend(win.Element.prototype, Element.Prototype);
+			}
+			onload.call(iframe.contentWindow, iframe.contentWindow.document);
+		};
+		(window.frames[props.id]) ? onFrameLoad() : iframe.addListener('load', onFrameLoad);
+		return iframe;
+	}
+
+});
+
+var Elements = new Native({
+
+	initialize: function(elements, options){
+		options = $extend({ddup: true, cash: true}, options);
+		elements = elements || [];
+		if (options.ddup || options.cash){
+			var uniques = {}, returned = [];
+			for (var i = 0, l = elements.length; i < l; i++){
+				var el = $.element(elements[i], !options.cash);
+				if (options.ddup){
+					if (uniques[el.uid]) continue;
+					uniques[el.uid] = true;
+				}
+				returned.push(el);
+			}
+			elements = returned;
+		}
+		return (options.cash) ? $extend(elements, this) : elements;
+	}
+
+});
+
+Elements.implement({
+
+	filter: function(filter, bind){
+		if (!filter) return this;
+		return new Elements(Array.filter(this, (typeof filter == 'string') ? function(item){
+			return item.match(filter);
+		} : filter, bind));
+	}
+
+});
+
+Document.implement({
+
+	newElement: function(tag, props){
+		if (Browser.Engine.trident && props){
+			['name', 'type', 'checked'].each(function(attribute){
+				if (!props[attribute]) return;
+				tag += ' ' + attribute + '="' + props[attribute] + '"';
+				if (attribute != 'checked') delete props[attribute];
+			});
+			tag = '<' + tag + '>';
+		}
+		return $.element(this.createElement(tag)).set(props);
+	},
+
+	newTextNode: function(text){
+		return this.createTextNode(text);
+	},
+
+	getDocument: function(){
+		return this;
+	},
+
+	getWindow: function(){
+		return this.window;
+	}
+
+});
+
+Window.implement({
+
+	$: function(el, nocash){
+		if (el && el.$family && el.uid) return el;
+		var type = $type(el);
+		return ($[type]) ? $[type](el, nocash, this.document) : null;
+	},
+
+	$$: function(selector){
+		if (arguments.length == 1 && typeof selector == 'string') return this.document.getElements(selector);
+		var elements = [];
+		var args = Array.flatten(arguments);
+		for (var i = 0, l = args.length; i < l; i++){
+			var item = args[i];
+			switch ($type(item)){
+				case 'element': elements.push(item); break;
+				case 'string': elements.extend(this.document.getElements(item, true));
+			}
+		}
+		return new Elements(elements);
+	},
+
+	getDocument: function(){
+		return this.document;
+	},
+
+	getWindow: function(){
+		return this;
+	}
+
+});
+
+$.string = function(id, nocash, doc){
+	id = doc.getElementById(id);
+	return (id) ? $.element(id, nocash) : null;
+};
+
+$.element = function(el, nocash){
+	$uid(el);
+	if (!nocash && !el.$family && !(/^object|embed$/i).test(el.tagName)){
+		var proto = Element.Prototype;
+		for (var p in proto) el[p] = proto[p];
+	};
+	return el;
+};
+
+$.object = function(obj, nocash, doc){
+	if (obj.toElement) return $.element(obj.toElement(doc), nocash);
+	return null;
+};
+
+$.textnode = $.whitespace = $.window = $.document = $arguments(0);
+
+Native.implement([Element, Document], {
+
+	getElement: function(selector, nocash){
+		return $(this.getElements(selector, true)[0] || null, nocash);
+	},
+
+	getElements: function(tags, nocash){
+		tags = tags.split(',');
+		var elements = [];
+		var ddup = (tags.length > 1);
+		tags.each(function(tag){
+			var partial = this.getElementsByTagName(tag.trim());
+			(ddup) ? elements.extend(partial) : elements = partial;
+		}, this);
+		return new Elements(elements, {ddup: ddup, cash: !nocash});
+	}
+
+});
+
+(function(){
+
+var collected = {}, storage = {};
+var props = {input: 'checked', option: 'selected', textarea: (Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerHTML' : 'value'};
+
+var get = function(uid){
+	return (storage[uid] || (storage[uid] = {}));
+};
+
+var clean = function(item, retain){
+	if (!item) return;
+	var uid = item.uid;
+	if (Browser.Engine.trident){
+		if (item.clearAttributes){
+			var clone = retain && item.cloneNode(false);
+			item.clearAttributes();
+			if (clone) item.mergeAttributes(clone);
+		} else if (item.removeEvents){
+			item.removeEvents();
+		}
+		if ((/object/i).test(item.tagName)){
+			for (var p in item){
+				if (typeof item[p] == 'function') item[p] = $empty;
+			}
+			Element.dispose(item);
+		}
+	}	
+	if (!uid) return;
+	collected[uid] = storage[uid] = null;
+};
+
+var purge = function(){
+	Hash.each(collected, clean);
+	if (Browser.Engine.trident) $A(document.getElementsByTagName('object')).each(clean);
+	if (window.CollectGarbage) CollectGarbage();
+	collected = storage = null;
+};
+
+var walk = function(element, walk, start, match, all, nocash){
+	var el = element[start || walk];
+	var elements = [];
+	while (el){
+		if (el.nodeType == 1 && (!match || Element.match(el, match))){
+			if (!all) return $(el, nocash);
+			elements.push(el);
+		}
+		el = el[walk];
+	}
+	return (all) ? new Elements(elements, {ddup: false, cash: !nocash}) : null;
+};
+
+var attributes = {
+	'html': 'innerHTML',
+	'class': 'className',
+	'for': 'htmlFor',
+	'text': (Browser.Engine.trident || (Browser.Engine.webkit && Browser.Engine.version < 420)) ? 'innerText' : 'textContent'
+};
+var bools = ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer'];
+var camels = ['value', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 'rowSpan', 'tabIndex', 'useMap'];
+
+Hash.extend(attributes, bools.associate(bools));
+Hash.extend(attributes, camels.associate(camels.map(String.toLowerCase)));
+
+var inserters = {
+
+	before: function(context, element){
+		if (element.parentNode) element.parentNode.insertBefore(context, element);
+	},
+
+	after: function(context, element){
+		if (!element.parentNode) return;
+		var next = element.nextSibling;
+		(next) ? element.parentNode.insertBefore(context, next) : element.parentNode.appendChild(context);
+	},
+
+	bottom: function(context, element){
+		element.appendChild(context);
+	},
+
+	top: function(context, element){
+		var first = element.firstChild;
+		(first) ? element.insertBefore(context, first) : element.appendChild(context);
+	}
+
+};
+
+inserters.inside = inserters.bottom;
+
+Hash.each(inserters, function(inserter, where){
+
+	where = where.capitalize();
+
+	Element.implement('inject' + where, function(el){
+		inserter(this, $(el, true));
+		return this;
+	});
+
+	Element.implement('grab' + where, function(el){
+		inserter($(el, true), this);
+		return this;
+	});
+
+});
+
+Element.implement({
+
+	set: function(prop, value){
+		switch ($type(prop)){
+			case 'object':
+				for (var p in prop) this.set(p, prop[p]);
+				break;
+			case 'string':
+				var property = Element.Properties.get(prop);
+				(property && property.set) ? property.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(prop, value);
+		}
+		return this;
+	},
+
+	get: function(prop){
+		var property = Element.Properties.get(prop);
+		return (property && property.get) ? property.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(prop);
+	},
+
+	erase: function(prop){
+		var property = Element.Properties.get(prop);
+		(property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
+		return this;
+	},
+
+	setProperty: function(attribute, value){
+		var key = attributes[attribute];
+		if (value == undefined) return this.removeProperty(attribute);
+		if (key && bools[attribute]) value = !!value;
+		(key) ? this[key] = value : this.setAttribute(attribute, '' + value);
+		return this;
+	},
+
+	setProperties: function(attributes){
+		for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
+		return this;
+	},
+
+	getProperty: function(attribute){
+		var key = attributes[attribute];
+		var value = (key) ? this[key] : this.getAttribute(attribute, 2);
+		return (bools[attribute]) ? !!value : (key) ? value : value || null;
+	},
+
+	getProperties: function(){
+		var args = $A(arguments);
+		return args.map(this.getProperty, this).associate(args);
+	},
+
+	removeProperty: function(attribute){
+		var key = attributes[attribute];
+		(key) ? this[key] = (key && bools[attribute]) ? false : '' : this.removeAttribute(attribute);
+		return this;
+	},
+
+	removeProperties: function(){
+		Array.each(arguments, this.removeProperty, this);
+		return this;
+	},
+
+	hasClass: function(className){
+		return this.className.contains(className, ' ');
+	},
+
+	addClass: function(className){
+		if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean();
+		return this;
+	},
+
+	removeClass: function(className){
+		this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
+		return this;
+	},
+
+	toggleClass: function(className){
+		return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);
+	},
+
+	adopt: function(){
+		Array.flatten(arguments).each(function(element){
+			element = $(element, true);
+			if (element) this.appendChild(element);
+		}, this);
+		return this;
+	},
+
+	appendText: function(text, where){
+		return this.grab(this.getDocument().newTextNode(text), where);
+	},
+
+	grab: function(el, where){
+		inserters[where || 'bottom']($(el, true), this);
+		return this;
+	},
+
+	inject: function(el, where){
+		inserters[where || 'bottom'](this, $(el, true));
+		return this;
+	},
+
+	replaces: function(el){
+		el = $(el, true);
+		el.parentNode.replaceChild(this, el);
+		return this;
+	},
+
+	wraps: function(el, where){
+		el = $(el, true);
+		return this.replaces(el).grab(el, where);
+	},
+
+	getPrevious: function(match, nocash){
+		return walk(this, 'previousSibling', null, match, false, nocash);
+	},
+
+	getAllPrevious: function(match, nocash){
+		return walk(this, 'previousSibling', null, match, true, nocash);
+	},
+
+	getNext: function(match, nocash){
+		return walk(this, 'nextSibling', null, match, false, nocash);
+	},
+
+	getAllNext: function(match, nocash){
+		return walk(this, 'nextSibling', null, match, true, nocash);
+	},
+
+	getFirst: function(match, nocash){
+		return walk(this, 'nextSibling', 'firstChild', match, false, nocash);
+	},
+
+	getLast: function(match, nocash){
+		return walk(this, 'previousSibling', 'lastChild', match, false, nocash);
+	},
+
+	getParent: function(match, nocash){
+		return walk(this, 'parentNode', null, match, false, nocash);
+	},
+
+	getParents: function(match, nocash){
+		return walk(this, 'parentNode', null, match, true, nocash);
+	},
+
+	getChildren: function(match, nocash){
+		return walk(this, 'nextSibling', 'firstChild', match, true, nocash);
+	},
+
+	getWindow: function(){
+		return this.ownerDocument.window;
+	},
+
+	getDocument: function(){
+		return this.ownerDocument;
+	},
+
+	getElementById: function(id, nocash){
+		var el = this.ownerDocument.getElementById(id);
+		if (!el) return null;
+		for (var parent = el.parentNode; parent != this; parent = parent.parentNode){
+			if (!parent) return null;
+		}
+		return $.element(el, nocash);
+	},
+
+	getSelected: function(){
+		return new Elements($A(this.options).filter(function(option){
+			return option.selected;
+		}));
+	},
+
+	getComputedStyle: function(property){
+		if (this.currentStyle) return this.currentStyle[property.camelCase()];
+		var computed = this.getDocument().defaultView.getComputedStyle(this, null);
+		return (computed) ? computed.getPropertyValue([property.hyphenate()]) : null;
+	},
+
+	toQueryString: function(){
+		var queryString = [];
+		this.getElements('input, select, textarea', true).each(function(el){
+			if (!el.name || el.disabled) return;
+			var value = (el.tagName.toLowerCase() == 'select') ? Element.getSelected(el).map(function(opt){
+				return opt.value;
+			}) : ((el.type == 'radio' || el.type == 'checkbox') && !el.checked) ? null : el.value;
+			$splat(value).each(function(val){
+				if (typeof val != 'undefined') queryString.push(el.name + '=' + encodeURIComponent(val));
+			});
+		});
+		return queryString.join('&');
+	},
+
+	clone: function(contents, keepid){
+		contents = contents !== false;
+		var clone = this.cloneNode(contents);
+		var clean = function(node, element){
+			if (!keepid) node.removeAttribute('id');
+			if (Browser.Engine.trident){
+				node.clearAttributes();
+				node.mergeAttributes(element);
+				node.removeAttribute('uid');
+				if (node.options){
+					var no = node.options, eo = element.options;
+					for (var j = no.length; j--;) no[j].selected = eo[j].selected;
+				}
+			}
+			var prop = props[element.tagName.toLowerCase()];
+			if (prop && element[prop]) node[prop] = element[prop];
+		};
+
+		if (contents){
+			var ce = clone.getElementsByTagName('*'), te = this.getElementsByTagName('*');
+			for (var i = ce.length; i--;) clean(ce[i], te[i]);
+		}
+
+		clean(clone, this);
+		return $(clone);
+	},
+
+	destroy: function(){
+		Element.empty(this);
+		Element.dispose(this);
+		clean(this, true);
+		return null;
+	},
+
+	empty: function(){
+		$A(this.childNodes).each(function(node){
+			Element.destroy(node);
+		});
+		return this;
+	},
+
+	dispose: function(){
+		return (this.parentNode) ? this.parentNode.removeChild(this) : this;
+	},
+
+	hasChild: function(el){
+		el = $(el, true);
+		if (!el) return false;
+		if (Browser.Engine.webkit && Browser.Engine.version < 420) return $A(this.getElementsByTagName(el.tagName)).contains(el);
+		return (this.contains) ? (this != el && this.contains(el)) : !!(this.compareDocumentPosition(el) & 16);
+	},
+
+	match: function(tag){
+		return (!tag || (tag == this) || (Element.get(this, 'tag') == tag));
+	}
+
+});
+
+Native.implement([Element, Window, Document], {
+
+	addListener: function(type, fn){
+		if (type == 'unload'){
+			var old = fn, self = this;
+			fn = function(){
+				self.removeListener('unload', fn);
+				old();
+			};
+		} else {
+			collected[this.uid] = this;
+		}
+		if (this.addEventListener) this.addEventListener(type, fn, false);
+		else this.attachEvent('on' + type, fn);
+		return this;
+	},
+
+	removeListener: function(type, fn){
+		if (this.removeEventListener) this.removeEventListener(type, fn, false);
+		else this.detachEvent('on' + type, fn);
+		return this;
+	},
+
+	retrieve: function(property, dflt){
+		var storage = get(this.uid), prop = storage[property];
+		if (dflt != undefined && prop == undefined) prop = storage[property] = dflt;
+		return $pick(prop);
+	},
+
+	store: function(property, value){
+		var storage = get(this.uid);
+		storage[property] = value;
+		return this;
+	},
+
+	eliminate: function(property){
+		var storage = get(this.uid);
+		delete storage[property];
+		return this;
+	}
+
+});
+
+window.addListener('unload', purge);
+
+})();
+
+Element.Properties = new Hash;
+
+Element.Properties.style = {
+
+	set: function(style){
+		this.style.cssText = style;
+	},
+
+	get: function(){
+		return this.style.cssText;
+	},
+
+	erase: function(){
+		this.style.cssText = '';
+	}
+
+};
+
+Element.Properties.tag = {
+
+	get: function(){
+		return this.tagName.toLowerCase();
+	}
+
+};
+
+Element.Properties.html = (function(){
+	var wrapper = document.createElement('div');
+
+	var translations = {
+		table: [1, '<table>', '</table>'],
+		select: [1, '<select>', '</select>'],
+		tbody: [2, '<table><tbody>', '</tbody></table>'],
+		tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
+	};
+	translations.thead = translations.tfoot = translations.tbody;
+
+	var html = {
+		set: function(){
+			var html = Array.flatten(arguments).join('');
+			var wrap = Browser.Engine.trident && translations[this.get('tag')];
+			if (wrap){
+				var first = wrapper;
+				first.innerHTML = wrap[1] + html + wrap[2];
+				for (var i = wrap[0]; i--;) first = first.firstChild;
+				this.empty().adopt(first.childNodes);
+			} else {
+				this.innerHTML = html;
+			}
+		}
+	};
+
+	html.erase = html.set;
+
+	return html;
+})();
+
+if (Browser.Engine.webkit && Browser.Engine.version < 420) Element.Properties.text = {
+	get: function(){
+		if (this.innerText) return this.innerText;
+		var temp = this.ownerDocument.newElement('div', {html: this.innerHTML}).inject(this.ownerDocument.body);
+		var text = temp.innerText;
+		temp.destroy();
+		return text;
+	}
+};
+
+
+/*
+Script: Element.Event.js
+	Contains Element methods for dealing with events, and custom Events.
+
+License:
+	MIT-style license.
+*/
+
+Element.Properties.events = {set: function(events){
+	this.addEvents(events);
+}};
+
+Native.implement([Element, Window, Document], {
+
+	addEvent: function(type, fn){
+		var events = this.retrieve('events', {});
+		events[type] = events[type] || {'keys': [], 'values': []};
+		if (events[type].keys.contains(fn)) return this;
+		events[type].keys.push(fn);
+		var realType = type, custom = Element.Events.get(type), condition = fn, self = this;
+		if (custom){
+			if (custom.onAdd) custom.onAdd.call(this, fn);
+			if (custom.condition){
+				condition = function(event){
+					if (custom.condition.call(this, event)) return fn.call(this, event);
+					return true;
+				};
+			}
+			realType = custom.base || realType;
+		}
+		var defn = function(){
+			return fn.call(self);
+		};
+		var nativeEvent = Element.NativeEvents[realType];
+		if (nativeEvent){
+			if (nativeEvent == 2){
+				defn = function(event){
+					event = new Event(event, self.getWindow());
+					if (condition.call(self, event) === false) event.stop();
+				};
+			}
+			this.addListener(realType, defn);
+		}
+		events[type].values.push(defn);
+		return this;
+	},
+
+	removeEvent: function(type, fn){
+		var events = this.retrieve('events');
+		if (!events || !events[type]) return this;
+		var pos = events[type].keys.indexOf(fn);
+		if (pos == -1) return this;
+		events[type].keys.splice(pos, 1);
+		var value = events[type].values.splice(pos, 1)[0];
+		var custom = Element.Events.get(type);
+		if (custom){
+			if (custom.onRemove) custom.onRemove.call(this, fn);
+			type = custom.base || type;
+		}
+		return (Element.NativeEvents[type]) ? this.removeListener(type, value) : this;
+	},
+
+	addEvents: function(events){
+		for (var event in events) this.addEvent(event, events[event]);
+		return this;
+	},
+
+	removeEvents: function(events){
+		if ($type(events) == 'object'){
+			for (var type in events) this.removeEvent(type, events[type]);
+			return this;
+		}
+		var attached = this.retrieve('events');
+		if (!attached) return this;
+		if (!events){
+			for (var type in attached) this.removeEvents(type);
+			this.eliminate('events');
+		} else if (attached[events]){
+			while (attached[events].keys[0]) this.removeEvent(events, attached[events].keys[0]);
+			attached[events] = null;
+		}
+		return this;
+	},
+
+	fireEvent: function(type, args, delay){
+		var events = this.retrieve('events');
+		if (!events || !events[type]) return this;
+		events[type].keys.each(function(fn){
+			fn.create({'bind': this, 'delay': delay, 'arguments': args})();
+		}, this);
+		return this;
+	},
+
+	cloneEvents: function(from, type){
+		from = $(from);
+		var fevents = from.retrieve('events');
+		if (!fevents) return this;
+		if (!type){
+			for (var evType in fevents) this.cloneEvents(from, evType);
+		} else if (fevents[type]){
+			fevents[type].keys.each(function(fn){
+				this.addEvent(type, fn);
+			}, this);
+		}
+		return this;
+	}
+
+});
+
+Element.NativeEvents = {
+	click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
+	mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
+	mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
+	keydown: 2, keypress: 2, keyup: 2, //keyboard
+	focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, //form elements
+	load: 1, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
+	error: 1, abort: 1, scroll: 1 //misc
+};
+
+(function(){
+
+var $check = function(event){
+	var related = event.relatedTarget;
+	if (related == undefined) return true;
+	if (related === false) return false;
+	return ($type(this) != 'document' && related != this && related.prefix != 'xul' && !this.hasChild(related));
+};
+
+Element.Events = new Hash({
+
+	mouseenter: {
+		base: 'mouseover',
+		condition: $check
+	},
+
+	mouseleave: {
+		base: 'mouseout',
+		condition: $check
+	},
+
+	mousewheel: {
+		base: (Browser.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel'
+	}
+
+});
+
+})();
+
+
+/*
+Script: Element.Style.js
+	Contains methods for interacting with the styles of Elements in a fashionable way.
+
+License:
+	MIT-style license.
+*/
+
+Element.Properties.styles = {set: function(styles){
+	this.setStyles(styles);
+}};
+
+Element.Properties.opacity = {
+
+	set: function(opacity, novisibility){
+		if (!novisibility){
+			if (opacity == 0){
+				if (this.style.visibility != 'hidden') this.style.visibility = 'hidden';
+			} else {
+				if (this.style.visibility != 'visible') this.style.visibility = 'visible';
+			}
+		}
+		if (!this.currentStyle || !this.currentStyle.hasLayout) this.style.zoom = 1;
+		if (Browser.Engine.trident) this.style.filter = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')';
+		this.style.opacity = opacity;
+		this.store('opacity', opacity);
+	},
+
+	get: function(){
+		return this.retrieve('opacity', 1);
+	}
+
+};
+
+Element.implement({
+
+	setOpacity: function(value){
+		return this.set('opacity', value, true);
+	},
+
+	getOpacity: function(){
+		return this.get('opacity');
+	},
+
+	setStyle: function(property, value){
+		switch (property){
+			case 'opacity': return this.set('opacity', parseFloat(value));
+			case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat';
+		}
+		property = property.camelCase();
+		if ($type(value) != 'string'){
+			var map = (Element.Styles.get(property) || '@').split(' ');
+			value = $splat(value).map(function(val, i){
+				if (!map[i]) return '';
+				return ($type(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
+			}).join(' ');
+		} else if (value == String(Number(value))){
+			value = Math.round(value);
+		}
+		this.style[property] = value;
+		return this;
+	},
+
+	getStyle: function(property){
+		switch (property){
+			case 'opacity': return this.get('opacity');
+			case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat';
+		}
+		property = property.camelCase();
+		var result = this.style[property];
+		if (!$chk(result)){
+			result = [];
+			for (var style in Element.ShortStyles){
+				if (property != style) continue;
+				for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s));
+				return result.join(' ');
+			}
+			result = this.getComputedStyle(property);
+		}
+		if (result){
+			result = String(result);
+			var color = result.match(/rgba?\([\d\s,]+\)/);
+			if (color) result = result.replace(color[0], color[0].rgbToHex());
+		}
+		if (Browser.Engine.presto || (Browser.Engine.trident && !$chk(parseInt(result)))){
+			if (property.test(/^(height|width)$/)){
+				var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
+				values.each(function(value){
+					size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
+				}, this);
+				return this['offset' + property.capitalize()] - size + 'px';
+			}
+			if ((Browser.Engine.presto) && String(result).test('px')) return result;
+			if (property.test(/(border(.+)Width|margin|padding)/)) return '0px';
+		}
+		return result;
+	},
+
+	setStyles: function(styles){
+		for (var style in styles) this.setStyle(style, styles[style]);
+		return this;
+	},
+
+	getStyles: function(){
+		var result = {};
+		Array.each(arguments, function(key){
+			result[key] = this.getStyle(key);
+		}, this);
+		return result;
+	}
+
+});
+
+Element.Styles = new Hash({
+	left: '@px', top: '@px', bottom: '@px', right: '@px',
+	width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
+	backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
+	fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
+	margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
+	borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
+	zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@'
+});
+
+Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
+
+['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
+	var Short = Element.ShortStyles;
+	var All = Element.Styles;
+	['margin', 'padding'].each(function(style){
+		var sd = style + direction;
+		Short[style][sd] = All[sd] = '@px';
+	});
+	var bd = 'border' + direction;
+	Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
+	var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
+	Short[bd] = {};
+	Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
+	Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
+	Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
+});
+
+
+/*
+Script: Element.Dimensions.js
+	Contains methods to work with size, scroll, or positioning of Elements and the window object.
+
+License:
+	MIT-style license.
+
+Credits:
+	- Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
+	- Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
+*/
+
+(function(){
+
+Element.implement({
+
+	scrollTo: function(x, y){
+		if (isBody(this)){
+			this.getWindow().scrollTo(x, y);
+		} else {
+			this.scrollLeft = x;
+			this.scrollTop = y;
+		}
+		return this;
+	},
+
+	getSize: function(){
+		if (isBody(this)) return this.getWindow().getSize();
+		return {x: this.offsetWidth, y: this.offsetHeight};
+	},
+
+	getScrollSize: function(){
+		if (isBody(this)) return this.getWindow().getScrollSize();
+		return {x: this.scrollWidth, y: this.scrollHeight};
+	},
+
+	getScroll: function(){
+		if (isBody(this)) return this.getWindow().getScroll();
+		return {x: this.scrollLeft, y: this.scrollTop};
+	},
+
+	getScrolls: function(){
+		var element = this, position = {x: 0, y: 0};
+		while (element && !isBody(element)){
+			position.x += element.scrollLeft;
+			position.y += element.scrollTop;
+			element = element.parentNode;
+		}
+		return position;
+	},
+
+	getOffsetParent: function(){
+		var element = this;
+		if (isBody(element)) return null;
+		if (!Browser.Engine.trident) return element.offsetParent;
+		while ((element = element.parentNode) && !isBody(element)){
+			if (styleString(element, 'position') != 'static') return element;
+		}
+		return null;
+	},
+
+	getOffsets: function(){
+		if (Browser.Engine.trident){
+			var bound = this.getBoundingClientRect(), html = this.getDocument().documentElement;
+			return {
+				x: bound.left + html.scrollLeft - html.clientLeft,
+				y: bound.top + html.scrollTop - html.clientTop
+			};
+		}
+
+		var element = this, position = {x: 0, y: 0};
+		if (isBody(this)) return position;
+
+		while (element && !isBody(element)){
+			position.x += element.offsetLeft;
+			position.y += element.offsetTop;
+
+			if (Browser.Engine.gecko){
+				if (!borderBox(element)){
+					position.x += leftBorder(element);
+					position.y += topBorder(element);
+				}
+				var parent = element.parentNode;
+				if (parent && styleString(parent, 'overflow') != 'visible'){
+					position.x += leftBorder(parent);
+					position.y += topBorder(parent);
+				}
+			} else if (element != this && Browser.Engine.webkit){
+				position.x += leftBorder(element);
+				position.y += topBorder(element);
+			}
+
+			element = element.offsetParent;
+		}
+		if (Browser.Engine.gecko && !borderBox(this)){
+			position.x -= leftBorder(this);
+			position.y -= topBorder(this);
+		}
+		return position;
+	},
+
+	getPosition: function(relative){
+		if (isBody(this)) return {x: 0, y: 0};
+		var offset = this.getOffsets(), scroll = this.getScrolls();
+		var position = {x: offset.x - scroll.x, y: offset.y - scroll.y};
+		var relativePosition = (relative && (relative = $(relative))) ? relative.getPosition() : {x: 0, y: 0};
+		return {x: position.x - relativePosition.x, y: position.y - relativePosition.y};
+	},
+
+	getCoordinates: function(element){
+		if (isBody(this)) return this.getWindow().getCoordinates();
+		var position = this.getPosition(element), size = this.getSize();
+		var obj = {left: position.x, top: position.y, width: size.x, height: size.y};
+		obj.right = obj.left + obj.width;
+		obj.bottom = obj.top + obj.height;
+		return obj;
+	},
+
+	computePosition: function(obj){
+		return {left: obj.x - styleNumber(this, 'margin-left'), top: obj.y - styleNumber(this, 'margin-top')};
+	},
+
+	position: function(obj){
+		return this.setStyles(this.computePosition(obj));
+	}
+
+});
+
+Native.implement([Document, Window], {
+
+	getSize: function(){
+		var win = this.getWindow();
+		if (Browser.Engine.presto || Browser.Engine.webkit) return {x: win.innerWidth, y: win.innerHeight};
+		var doc = getCompatElement(this);
+		return {x: doc.clientWidth, y: doc.clientHeight};
+	},
+
+	getScroll: function(){
+		var win = this.getWindow();
+		var doc = getCompatElement(this);
+		return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
+	},
+
+	getScrollSize: function(){
+		var doc = getCompatElement(this);
+		var min = this.getSize();
+		return {x: Math.max(doc.scrollWidth, min.x), y: Math.max(doc.scrollHeight, min.y)};
+	},
+
+	getPosition: function(){
+		return {x: 0, y: 0};
+	},
+
+	getCoordinates: function(){
+		var size = this.getSize();
+		return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
+	}
+
+});
+
+// private methods
+
+var styleString = Element.getComputedStyle;
+
+function styleNumber(element, style){
+	return styleString(element, style).toInt() || 0;
+};
+
+function borderBox(element){
+	return styleString(element, '-moz-box-sizing') == 'border-box';
+};
+
+function topBorder(element){
+	return styleNumber(element, 'border-top-width');
+};
+
+function leftBorder(element){
+	return styleNumber(element, 'border-left-width');
+};
+
+function isBody(element){
+	return (/^(?:body|html)$/i).test(element.tagName);
+};
+
+function getCompatElement(element){
+	var doc = element.getDocument();
+	return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
+};
+
+})();
+
+//aliases
+
+Native.implement([Window, Document, Element], {
+
+	getHeight: function(){
+		return this.getSize().y;
+	},
+
+	getWidth: function(){
+		return this.getSize().x;
+	},
+
+	getScrollTop: function(){
+		return this.getScroll().y;
+	},
+
+	getScrollLeft: function(){
+		return this.getScroll().x;
+	},
+
+	getScrollHeight: function(){
+		return this.getScrollSize().y;
+	},
+
+	getScrollWidth: function(){
+		return this.getScrollSize().x;
+	},
+
+	getTop: function(){
+		return this.getPosition().y;
+	},
+
+	getLeft: function(){
+		return this.getPosition().x;
+	}
+
+});
+
+
+/*
+Script: Selectors.js
+	Adds advanced CSS Querying capabilities for targeting elements. Also includes pseudoselectors support.
+
+License:
+	MIT-style license.
+*/
+
+Native.implement([Document, Element], {
+
+	getElements: function(expression, nocash){
+		expression = expression.split(',');
+		var items, local = {};
+		for (var i = 0, l = expression.length; i < l; i++){
+			var selector = expression[i], elements = Selectors.Utils.search(this, selector, local);
+			if (i != 0 && elements.item) elements = $A(elements);
+			items = (i == 0) ? elements : (items.item) ? $A(items).concat(elements) : items.concat(elements);
+		}
+		return new Elements(items, {ddup: (expression.length > 1), cash: !nocash});
+	}
+
+});
+
+Element.implement({
+
+	match: function(selector){
+		if (!selector || (selector == this)) return true;
+		var tagid = Selectors.Utils.parseTagAndID(selector);
+		var tag = tagid[0], id = tagid[1];
+		if (!Selectors.Filters.byID(this, id) || !Selectors.Filters.byTag(this, tag)) return false;
+		var parsed = Selectors.Utils.parseSelector(selector);
+		return (parsed) ? Selectors.Utils.filter(this, parsed, {}) : true;
+	}
+
+});
+
+var Selectors = {Cache: {nth: {}, parsed: {}}};
+
+Selectors.RegExps = {
+	id: (/#([\w-]+)/),
+	tag: (/^(\w+|\*)/),
+	quick: (/^(\w+|\*)$/),
+	splitter: (/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),
+	combined: (/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)
+};
+
+Selectors.Utils = {
+
+	chk: function(item, uniques){
+		if (!uniques) return true;
+		var uid = $uid(item);
+		if (!uniques[uid]) return uniques[uid] = true;
+		return false;
+	},
+
+	parseNthArgument: function(argument){
+		if (Selectors.Cache.nth[argument]) return Selectors.Cache.nth[argument];
+		var parsed = argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);
+		if (!parsed) return false;
+		var inta = parseInt(parsed[1]);
+		var a = (inta || inta === 0) ? inta : 1;
+		var special = parsed[2] || false;
+		var b = parseInt(parsed[3]) || 0;
+		if (a != 0){
+			b--;
+			while (b < 1) b += a;
+			while (b >= a) b -= a;
+		} else {
+			a = b;
+			special = 'index';
+		}
+		switch (special){
+			case 'n': parsed = {a: a, b: b, special: 'n'}; break;
+			case 'odd': parsed = {a: 2, b: 0, special: 'n'}; break;
+			case 'even': parsed = {a: 2, b: 1, special: 'n'}; break;
+			case 'first': parsed = {a: 0, special: 'index'}; break;
+			case 'last': parsed = {special: 'last-child'}; break;
+			case 'only': parsed = {special: 'only-child'}; break;
+			default: parsed = {a: (a - 1), special: 'index'};
+		}
+
+		return Selectors.Cache.nth[argument] = parsed;
+	},
+
+	parseSelector: function(selector){
+		if (Selectors.Cache.parsed[selector]) return Selectors.Cache.parsed[selector];
+		var m, parsed = {classes: [], pseudos: [], attributes: []};
+		while ((m = Selectors.RegExps.combined.exec(selector))){
+			var cn = m[1], an = m[2], ao = m[3], av = m[5], pn = m[6], pa = m[7];
+			if (cn){
+				parsed.classes.push(cn);
+			} else if (pn){
+				var parser = Selectors.Pseudo.get(pn);
+				if (parser) parsed.pseudos.push({parser: parser, argument: pa});
+				else parsed.attributes.push({name: pn, operator: '=', value: pa});
+			} else if (an){
+				parsed.attributes.push({name: an, operator: ao, value: av});
+			}
+		}
+		if (!parsed.classes.length) delete parsed.classes;
+		if (!parsed.attributes.length) delete parsed.attributes;
+		if (!parsed.pseudos.length) delete parsed.pseudos;
+		if (!parsed.classes && !parsed.attributes && !parsed.pseudos) parsed = null;
+		return Selectors.Cache.parsed[selector] = parsed;
+	},
+
+	parseTagAndID: function(selector){
+		var tag = selector.match(Selectors.RegExps.tag);
+		var id = selector.match(Selectors.RegExps.id);
+		return [(tag) ? tag[1] : '*', (id) ? id[1] : false];
+	},
+
+	filter: function(item, parsed, local){
+		var i;
+		if (parsed.classes){
+			for (i = parsed.classes.length; i--; i){
+				var cn = parsed.classes[i];
+				if (!Selectors.Filters.byClass(item, cn)) return false;
+			}
+		}
+		if (parsed.attributes){
+			for (i = parsed.attributes.length; i--; i){
+				var att = parsed.attributes[i];
+				if (!Selectors.Filters.byAttribute(item, att.name, att.operator, att.value)) return false;
+			}
+		}
+		if (parsed.pseudos){
+			for (i = parsed.pseudos.length; i--; i){
+				var psd = parsed.pseudos[i];
+				if (!Selectors.Filters.byPseudo(item, psd.parser, psd.argument, local)) return false;
+			}
+		}
+		return true;
+	},
+
+	getByTagAndID: function(ctx, tag, id){
+		if (id){
+			var item = (ctx.getElementById) ? ctx.getElementById(id, true) : Element.getElementById(ctx, id, true);
+			return (item && Selectors.Filters.byTag(item, tag)) ? [item] : [];
+		} else {
+			return ctx.getElementsByTagName(tag);
+		}
+	},
+
+	search: function(self, expression, local){
+		var splitters = [];
+
+		var selectors = expression.trim().replace(Selectors.RegExps.splitter, function(m0, m1, m2){
+			splitters.push(m1);
+			return ':)' + m2;
+		}).split(':)');
+
+		var items, filtered, item;
+
+		for (var i = 0, l = selectors.length; i < l; i++){
+
+			var selector = selectors[i];
+
+			if (i == 0 && Selectors.RegExps.quick.test(selector)){
+				items = self.getElementsByTagName(selector);
+				continue;
+			}
+
+			var splitter = splitters[i - 1];
+
+			var tagid = Selectors.Utils.parseTagAndID(selector);
+			var tag = tagid[0], id = tagid[1];
+
+			if (i == 0){
+				items = Selectors.Utils.getByTagAndID(self, tag, id);
+			} else {
+				var uniques = {}, found = [];
+				for (var j = 0, k = items.length; j < k; j++) found = Selectors.Getters[splitter](found, items[j], tag, id, uniques);
+				items = found;
+			}
+
+			var parsed = Selectors.Utils.parseSelector(selector);
+
+			if (parsed){
+				filtered = [];
+				for (var m = 0, n = items.length; m < n; m++){
+					item = items[m];
+					if (Selectors.Utils.filter(item, parsed, local)) filtered.push(item);
+				}
+				items = filtered;
+			}
+
+		}
+
+		return items;
+
+	}
+
+};
+
+Selectors.Getters = {
+
+	' ': function(found, self, tag, id, uniques){
+		var items = Selectors.Utils.getByTagAndID(self, tag, id);
+		for (var i = 0, l = items.length; i < l; i++){
+			var item = items[i];
+			if (Selectors.Utils.chk(item, uniques)) found.push(item);
+		}
+		return found;
+	},
+
+	'>': function(found, self, tag, id, uniques){
+		var children = Selectors.Utils.getByTagAndID(self, tag, id);
+		for (var i = 0, l = children.length; i < l; i++){
+			var child = children[i];
+			if (child.parentNode == self && Selectors.Utils.chk(child, uniques)) found.push(child);
+		}
+		return found;
+	},
+
+	'+': function(found, self, tag, id, uniques){
+		while ((self = self.nextSibling)){
+			if (self.nodeType == 1){
+				if (Selectors.Utils.chk(self, uniques) && Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self);
+				break;
+			}
+		}
+		return found;
+	},
+
+	'~': function(found, self, tag, id, uniques){
+		while ((self = self.nextSibling)){
+			if (self.nodeType == 1){
+				if (!Selectors.Utils.chk(self, uniques)) break;
+				if (Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self);
+			}
+		}
+		return found;
+	}
+
+};
+
+Selectors.Filters = {
+
+	byTag: function(self, tag){
+		return (tag == '*' || (self.tagName && self.tagName.toLowerCase() == tag));
+	},
+
+	byID: function(self, id){
+		return (!id || (self.id && self.id == id));
+	},
+
+	byClass: function(self, klass){
+		return (self.className && self.className.contains(klass, ' '));
+	},
+
+	byPseudo: function(self, parser, argument, local){
+		return parser.call(self, argument, local);
+	},
+
+	byAttribute: function(self, name, operator, value){
+		var result = Element.prototype.getProperty.call(self, name);
+		if (!result) return (operator == '!=');
+		if (!operator || value == undefined) return true;
+		switch (operator){
+			case '=': return (result == value);
+			case '*=': return (result.contains(value));
+			case '^=': return (result.substr(0, value.length) == value);
+			case '$=': return (result.substr(result.length - value.length) == value);
+			case '!=': return (result != value);
+			case '~=': return result.contains(value, ' ');
+			case '|=': return result.contains(value, '-');
+		}
+		return false;
+	}
+
+};
+
+Selectors.Pseudo = new Hash({
+
+	// w3c pseudo selectors
+
+	checked: function(){
+		return this.checked;
+	},
+
+	empty: function(){
+		return !(this.innerText || this.textContent || '').length;
+	},
+
+	not: function(selector){
+		return !Element.match(this, selector);
+	},
+
+	contains: function(text){
+		return (this.innerText || this.textContent || '').contains(text);
+	},
+
+	'first-child': function(){
+		return Selectors.Pseudo.index.call(this, 0);
+	},
+
+	'last-child': function(){
+		var element = this;
+		while ((element = element.nextSibling)){
+			if (element.nodeType == 1) return false;
+		}
+		return true;
+	},
+
+	'only-child': function(){
+		var prev = this;
+		while ((prev = prev.previousSibling)){
+			if (prev.nodeType == 1) return false;
+		}
+		var next = this;
+		while ((next = next.nextSibling)){
+			if (next.nodeType == 1) return false;
+		}
+		return true;
+	},
+
+	'nth-child': function(argument, local){
+		argument = (argument == undefined) ? 'n' : argument;
+		var parsed = Selectors.Utils.parseNthArgument(argument);
+		if (parsed.special != 'n') return Selectors.Pseudo[parsed.special].call(this, parsed.a, local);
+		var count = 0;
+		local.positions = local.positions || {};
+		var uid = $uid(this);
+		if (!local.positions[uid]){
+			var self = this;
+			while ((self = self.previousSibling)){
+				if (self.nodeType != 1) continue;
+				count ++;
+				var position = local.positions[$uid(self)];
+				if (position != undefined){
+					count = position + count;
+					break;
+				}
+			}
+			local.positions[uid] = count;
+		}
+		return (local.positions[uid] % parsed.a == parsed.b);
+	},
+
+	// custom pseudo selectors
+
+	index: function(index){
+		var element = this, count = 0;
+		while ((element = element.previousSibling)){
+			if (element.nodeType == 1 && ++count > index) return false;
+		}
+		return (count == index);
+	},
+
+	even: function(argument, local){
+		return Selectors.Pseudo['nth-child'].call(this, '2n+1', local);
+	},
+
+	odd: function(argument, local){
+		return Selectors.Pseudo['nth-child'].call(this, '2n', local);
+	}
+
+});
+
+
+/*
+Script: Domready.js
+	Contains the domready custom event.
+
+License:
+	MIT-style license.
+*/
+
+Element.Events.domready = {
+
+	onAdd: function(fn){
+		if (Browser.loaded) fn.call(this);
+	}
+
+};
+
+(function(){
+
+	var domready = function(){
+		if (Browser.loaded) return;
+		Browser.loaded = true;
+		window.fireEvent('domready');
+		document.fireEvent('domready');
+	};
+
+	if (Browser.Engine.trident){
+		var temp = document.createElement('div');
+		(function(){
+			($try(function(){
+				temp.doScroll('left');
+				return $(temp).inject(document.body).set('html', 'temp').dispose();
+			})) ? domready() : arguments.callee.delay(50);
+		})();
+	} else if (Browser.Engine.webkit && Browser.Engine.version < 525){
+		(function(){
+			(['loaded', 'complete'].contains(document.readyState)) ? domready() : arguments.callee.delay(50);
+		})();
+	} else {
+		window.addEvent('load', domready);
+		document.addEvent('DOMContentLoaded', domready);
+	}
+
+})();
+
+
+/*
+Script: JSON.js
+	JSON encoder and decoder.
+
+License:
+	MIT-style license.
+
+See Also:
+	<http://www.json.org/>
+*/
+
+var JSON = new Hash({
+
+	$specialChars: {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'},
+
+	$replaceChars: function(chr){
+		return JSON.$specialChars[chr] || '\\u00' + Math.floor(chr.charCodeAt() / 16).toString(16) + (chr.charCodeAt() % 16).toString(16);
+	},
+
+	encode: function(obj){
+		switch ($type(obj)){
+			case 'string':
+				return '"' + obj.replace(/[\x00-\x1f\\"]/g, JSON.$replaceChars) + '"';
+			case 'array':
+				return '[' + String(obj.map(JSON.encode).filter($defined)) + ']';
+			case 'object': case 'hash':
+				var string = [];
+				Hash.each(obj, function(value, key){
+					var json = JSON.encode(value);
+					if (json) string.push(JSON.encode(key) + ':' + json);
+				});
+				return '{' + string + '}';
+			case 'number': case 'boolean': return String(obj);
+			case false: return 'null';
+		}
+		return null;
+	},
+
+	decode: function(string, secure){
+		if ($type(string) != 'string' || !string.length) return null;
+		if (secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null;
+		return eval('(' + string + ')');
+	}
+
+});
+
+Native.implement([Hash, Array, String, Number], {
+
+	toJSON: function(){
+		return JSON.encode(this);
+	}
+
+});
+
+
+/*
+Script: Cookie.js
+	Class for creating, loading, and saving browser Cookies.
+
+License:
+	MIT-style license.
+
+Credits:
+	Based on the functions by Peter-Paul Koch (http://quirksmode.org).
+*/
+
+var Cookie = new Class({
+
+	Implements: Options,
+
+	options: {
+		path: false,
+		domain: false,
+		duration: false,
+		secure: false,
+		document: document
+	},
+
+	initialize: function(key, options){
+		this.key = key;
+		this.setOptions(options);
+	},
+
+	write: function(value){
+		value = encodeURIComponent(value);
+		if (this.options.domain) value += '; domain=' + this.options.domain;
+		if (this.options.path) value += '; path=' + this.options.path;
+		if (this.options.duration){
+			var date = new Date();
+			date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
+			value += '; expires=' + date.toGMTString();
+		}
+		if (this.options.secure) value += '; secure';
+		this.options.document.cookie = this.key + '=' + value;
+		return this;
+	},
+
+	read: function(){
+		var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
+		return (value) ? decodeURIComponent(value[1]) : null;
+	},
+
+	dispose: function(){
+		new Cookie(this.key, $merge(this.options, {duration: -1})).write('');
+		return this;
+	}
+
+});
+
+Cookie.write = function(key, value, options){
+	return new Cookie(key, options).write(value);
+};
+
+Cookie.read = function(key){
+	return new Cookie(key).read();
+};
+
+Cookie.dispose = function(key, options){
+	return new Cookie(key, options).dispose();
+};
+
+
+/*
+Script: Swiff.js
+	Wrapper for embedding SWF movies. Supports (and fixes) External Interface Communication.
+
+License:
+	MIT-style license.
+
+Credits:
+	Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
+*/
+
+var Swiff = new Class({
+
+	Implements: [Options],
+
+	options: {
+		id: null,
+		height: 1,
+		width: 1,
+		container: null,
+		properties: {},
+		params: {
+			quality: 'high',
+			allowScriptAccess: 'always',
+			wMode: 'transparent',
+			swLiveConnect: true
+		},
+		callBacks: {},
+		vars: {}
+	},
+
+	toElement: function(){
+		return this.object;
+	},
+
+	initialize: function(path, options){
+		this.instance = 'Swiff_' + $time();
+
+		this.setOptions(options);
+		options = this.options;
+		var id = this.id = options.id || this.instance;
+		var container = $(options.container);
+
+		Swiff.CallBacks[this.instance] = {};
+
+		var params = options.params, vars = options.vars, callBacks = options.callBacks;
+		var properties = $extend({height: options.height, width: options.width}, options.properties);
+
+		var self = this;
+
+		for (var callBack in callBacks){
+			Swiff.CallBacks[this.instance][callBack] = (function(option){
+				return function(){
+					return option.apply(self.object, arguments);
+				};
+			})(callBacks[callBack]);
+			vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
+		}
+
+		params.flashVars = Hash.toQueryString(vars);
+		if (Browser.Engine.trident){
+			properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
+			params.movie = path;
+		} else {
+			properties.type = 'application/x-shockwave-flash';
+			properties.data = path;
+		}
+		var build = '<object id="' + id + '"';
+		for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
+		build += '>';
+		for (var param in params){
+			if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
+		}
+		build += '</object>';
+		this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
+	},
+
+	replaces: function(element){
+		element = $(element, true);
+		element.parentNode.replaceChild(this.toElement(), element);
+		return this;
+	},
+
+	inject: function(element){
+		$(element, true).appendChild(this.toElement());
+		return this;
+	},
+
+	remote: function(){
+		return Swiff.remote.apply(Swiff, [this.toElement()].extend(arguments));
+	}
+
+});
+
+Swiff.CallBacks = {};
+
+Swiff.remote = function(obj, fn){
+	var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
+	return eval(rs);
+};
+
+
+/*
+Script: Fx.js
+	Contains the basic animation logic to be extended by all other Fx Classes.
+
+License:
+	MIT-style license.
+*/
+
+var Fx = new Class({
+
+	Implements: [Chain, Events, Options],
+
+	options: {
+		/*
+		onStart: $empty,
+		onCancel: $empty,
+		onComplete: $empty,
+		*/
+		fps: 50,
+		unit: false,
+		duration: 500,
+		link: 'ignore'
+	},
+
+	initialize: function(options){
+		this.subject = this.subject || this;
+		this.setOptions(options);
+		this.options.duration = Fx.Durations[this.options.duration] || this.options.duration.toInt();
+		var wait = this.options.wait;
+		if (wait === false) this.options.link = 'cancel';
+	},
+
+	getTransition: function(){
+		return function(p){
+			return -(Math.cos(Math.PI * p) - 1) / 2;
+		};
+	},
+
+	step: function(){
+		var time = $time();
+		if (time < this.time + this.options.duration){
+			var delta = this.transition((time - this.time) / this.options.duration);
+			this.set(this.compute(this.from, this.to, delta));
+		} else {
+			this.set(this.compute(this.from, this.to, 1));
+			this.complete();
+		}
+	},
+
+	set: function(now){
+		return now;
+	},
+
+	compute: function(from, to, delta){
+		return Fx.compute(from, to, delta);
+	},
+
+	check: function(caller){
+		if (!this.timer) return true;
+		switch (this.options.link){
+			case 'cancel': this.cancel(); return true;
+			case 'chain': this.chain(caller.bind(this, Array.slice(arguments, 1))); return false;
+		}
+		return false;
+	},
+
+	start: function(from, to){
+		if (!this.check(arguments.callee, from, to)) return this;
+		this.from = from;
+		this.to = to;
+		this.time = 0;
+		this.transition = this.getTransition();
+		this.startTimer();
+		this.onStart();
+		return this;
+	},
+
+	complete: function(){
+		if (this.stopTimer()) this.onComplete();
+		return this;
+	},
+
+	cancel: function(){
+		if (this.stopTimer()) this.onCancel();
+		return this;
+	},
+
+	onStart: function(){
+		this.fireEvent('start', this.subject);
+	},
+
+	onComplete: function(){
+		this.fireEvent('complete', this.subject);
+		if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
+	},
+
+	onCancel: function(){
+		this.fireEvent('cancel', this.subject).clearChain();
+	},
+
+	pause: function(){
+		this.stopTimer();
+		return this;
+	},
+
+	resume: function(){
+		this.startTimer();
+		return this;
+	},
+
+	stopTimer: function(){
+		if (!this.timer) return false;
+		this.time = $time() - this.time;
+		this.timer = $clear(this.timer);
+		return true;
+	},
+
+	startTimer: function(){
+		if (this.timer) return false;
+		this.time = $time() - this.time;
+		this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this);
+		return true;
+	}
+
+});
+
+Fx.compute = function(from, to, delta){
+	return (to - from) * delta + from;
+};
+
+Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
+
+
+/*
+Script: Fx.CSS.js
+	Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
+
+License:
+	MIT-style license.
+*/
+
+Fx.CSS = new Class({
+
+	Extends: Fx,
+
+	//prepares the base from/to object
+
+	prepare: function(element, property, values){
+		values = $splat(values);
+		var values1 = values[1];
+		if (!$chk(values1)){
+			values[1] = values[0];
+			values[0] = element.getStyle(property);
+		}
+		var parsed = values.map(this.parse);
+		return {from: parsed[0], to: parsed[1]};
+	},
+
+	//parses a value into an array
+
+	parse: function(value){
+		value = $lambda(value)();
+		value = (typeof value == 'string') ? value.split(' ') : $splat(value);
+		return value.map(function(val){
+			val = String(val);
+			var found = false;
+			Fx.CSS.Parsers.each(function(parser, key){
+				if (found) return;
+				var parsed = parser.parse(val);
+				if ($chk(parsed)) found = {value: parsed, parser: parser};
+			});
+			found = found || {value: val, parser: Fx.CSS.Parsers.String};
+			return found;
+		});
+	},
+
+	//computes by a from and to prepared objects, using their parsers.
+
+	compute: function(from, to, delta){
+		var computed = [];
+		(Math.min(from.length, to.length)).times(function(i){
+			computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
+		});
+		computed.$family = {name: 'fx:css:value'};
+		return computed;
+	},
+
+	//serves the value as settable
+
+	serve: function(value, unit){
+		if ($type(value) != 'fx:css:value') value = this.parse(value);
+		var returned = [];
+		value.each(function(bit){
+			returned = returned.concat(bit.parser.serve(bit.value, unit));
+		});
+		return returned;
+	},
+
+	//renders the change to an element
+
+	render: function(element, property, value, unit){
+		element.setStyle(property, this.serve(value, unit));
+	},
+
+	//searches inside the page css to find the values for a selector
+
+	search: function(selector){
+		if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
+		var to = {};
+		Array.each(document.styleSheets, function(sheet, j){
+			var href = sheet.href;
+			if (href && href.contains('://') && !href.contains(document.domain)) return;
+			var rules = sheet.rules || sheet.cssRules;
+			Array.each(rules, function(rule, i){
+				if (!rule.style) return;
+				var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
+					return m.toLowerCase();
+				}) : null;
+				if (!selectorText || !selectorText.test('^' + selector + '$')) return;
+				Element.Styles.each(function(value, style){
+					if (!rule.style[style] || Element.ShortStyles[style]) return;
+					value = String(rule.style[style]);
+					to[style] = (value.test(/^rgb/)) ? value.rgbToHex() : value;
+				});
+			});
+		});
+		return Fx.CSS.Cache[selector] = to;
+	}
+
+});
+
+Fx.CSS.Cache = {};
+
+Fx.CSS.Parsers = new Hash({
+
+	Color: {
+		parse: function(value){
+			if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
+			return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
+		},
+		compute: function(from, to, delta){
+			return from.map(function(value, i){
+				return Math.round(Fx.compute(from[i], to[i], delta));
+			});
+		},
+		serve: function(value){
+			return value.map(Number);
+		}
+	},
+
+	Number: {
+		parse: parseFloat,
+		compute: Fx.compute,
+		serve: function(value, unit){
+			return (unit) ? value + unit : value;
+		}
+	},
+
+	String: {
+		parse: $lambda(false),
+		compute: $arguments(1),
+		serve: $arguments(0)
+	}
+
+});
+
+
+/*
+Script: Fx.Tween.js
+	Formerly Fx.Style, effect to transition any CSS property for an element.
+
+License:
+	MIT-style license.
+*/
+
+Fx.Tween = new Class({
+
+	Extends: Fx.CSS,
+
+	initialize: function(element, options){
+		this.element = this.subject = $(element);
+		this.parent(options);
+	},
+
+	set: function(property, now){
+		if (arguments.length == 1){
+			now = property;
+			property = this.property || this.options.property;
+		}
+		this.render(this.element, property, now, this.options.unit);
+		return this;
+	},
+
+	start: function(property, from, to){
+		if (!this.check(arguments.callee, property, from, to)) return this;
+		var args = Array.flatten(arguments);
+		this.property = this.options.property || args.shift();
+		var parsed = this.prepare(this.element, this.property, args);
+		return this.parent(parsed.from, parsed.to);
+	}
+
+});
+
+Element.Properties.tween = {
+
+	set: function(options){
+		var tween = this.retrieve('tween');
+		if (tween) tween.cancel();
+		return this.eliminate('tween').store('tween:options', $extend({link: 'cancel'}, options));
+	},
+
+	get: function(options){
+		if (options || !this.retrieve('tween')){
+			if (options || !this.retrieve('tween:options')) this.set('tween', options);
+			this.store('tween', new Fx.Tween(this, this.retrieve('tween:options')));
+		}
+		return this.retrieve('tween');
+	}
+
+};
+
+Element.implement({
+
+	tween: function(property, from, to){
+		this.get('tween').start(arguments);
+		return this;
+	},
+
+	fade: function(how){
+		var fade = this.get('tween'), o = 'opacity', toggle;
+		how = $pick(how, 'toggle');
+		switch (how){
+			case 'in': fade.start(o, 1); break;
+			case 'out': fade.start(o, 0); break;
+			case 'show': fade.set(o, 1); break;
+			case 'hide': fade.set(o, 0); break;
+			case 'toggle':
+				var flag = this.retrieve('fade:flag', this.get('opacity') == 1);
+				fade.start(o, (flag) ? 0 : 1);
+				this.store('fade:flag', !flag);
+				toggle = true;
+			break;
+			default: fade.start(o, arguments);
+		}
+		if (!toggle) this.eliminate('fade:flag');
+		return this;
+	},
+
+	highlight: function(start, end){
+		if (!end){
+			end = this.retrieve('highlight:original', this.getStyle('background-color'));
+			end = (end == 'transparent') ? '#fff' : end;
+		}
+		var tween = this.get('tween');
+		tween.start('background-color', start || '#ffff88', end).chain(function(){
+			this.setStyle('background-color', this.retrieve('highlight:original'));
+			tween.callChain();
+		}.bind(this));
+		return this;
+	}
+
+});
+
+
+/*
+Script: Fx.Morph.js
+	Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules.
+
+License:
+	MIT-style license.
+*/
+
+Fx.Morph = new Class({
+
+	Extends: Fx.CSS,
+
+	initialize: function(element, options){
+		this.element = this.subject = $(element);
+		this.parent(options);
+	},
+
+	set: function(now){
+		if (typeof now == 'string') now = this.search(now);
+		for (var p in now) this.render(this.element, p, now[p], this.options.unit);
+		return this;
+	},
+
+	compute: function(from, to, delta){
+		var now = {};
+		for (var p in from) now[p] = this.parent(from[p], to[p], delta);
+		return now;
+	},
+
+	start: function(properties){
+		if (!this.check(arguments.callee, properties)) return this;
+		if (typeof properties == 'string') properties = this.search(properties);
+		var from = {}, to = {};
+		for (var p in properties){
+			var parsed = this.prepare(this.element, p, properties[p]);
+			from[p] = parsed.from;
+			to[p] = parsed.to;
+		}
+		return this.parent(from, to);
+	}
+
+});
+
+Element.Properties.morph = {
+
+	set: function(options){
+		var morph = this.retrieve('morph');
+		if (morph) morph.cancel();
+		return this.eliminate('morph').store('morph:options', $extend({link: 'cancel'}, options));
+	},
+
+	get: function(options){
+		if (options || !this.retrieve('morph')){
+			if (options || !this.retrieve('morph:options')) this.set('morph', options);
+			this.store('morph', new Fx.Morph(this, this.retrieve('morph:options')));
+		}
+		return this.retrieve('morph');
+	}
+
+};
+
+Element.implement({
+
+	morph: function(props){
+		this.get('morph').start(props);
+		return this;
+	}
+
+});
+
+
+/*
+Script: Fx.Transitions.js
+	Contains a set of advanced transitions to be used with any of the Fx Classes.
+
+License:
+	MIT-style license.
+
+Credits:
+	Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
+*/
+
+Fx.implement({
+
+	getTransition: function(){
+		var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
+		if (typeof trans == 'string'){
+			var data = trans.split(':');
+			trans = Fx.Transitions;
+			trans = trans[data[0]] || trans[data[0].capitalize()];
+			if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
+		}
+		return trans;
+	}
+
+});
+
+Fx.Transition = function(transition, params){
+	params = $splat(params);
+	return $extend(transition, {
+		easeIn: function(pos){
+			return transition(pos, params);
+		},
+		easeOut: function(pos){
+			return 1 - transition(1 - pos, params);
+		},
+		easeInOut: function(pos){
+			return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2;
+		}
+	});
+};
+
+Fx.Transitions = new Hash({
+
+	linear: $arguments(0)
+
+});
+
+Fx.Transitions.extend = function(transitions){
+	for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
+};
+
+Fx.Transitions.extend({
+
+	Pow: function(p, x){
+		return Math.pow(p, x[0] || 6);
+	},
+
+	Expo: function(p){
+		return Math.pow(2, 8 * (p - 1));
+	},
+
+	Circ: function(p){
+		return 1 - Math.sin(Math.acos(p));
+	},
+
+	Sine: function(p){
+		return 1 - Math.sin((1 - p) * Math.PI / 2);
+	},
+
+	Back: function(p, x){
+		x = x[0] || 1.618;
+		return Math.pow(p, 2) * ((x + 1) * p - x);
+	},
+
+	Bounce: function(p){
+		var value;
+		for (var a = 0, b = 1; 1; a += b, b /= 2){
+			if (p >= (7 - 4 * a) / 11){
+				value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
+				break;
+			}
+		}
+		return value;
+	},
+
+	Elastic: function(p, x){
+		return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3);
+	}
+
+});
+
+['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
+	Fx.Transitions[transition] = new Fx.Transition(function(p){
+		return Math.pow(p, [i + 2]);
+	});
+});
+
+
+/*
+Script: Request.js
+	Powerful all purpose Request Class. Uses XMLHTTPRequest.
+
+License:
+	MIT-style license.
+*/
+
+var Request = new Class({
+
+	Implements: [Chain, Events, Options],
+
+	options: {/*
+		onRequest: $empty,
+		onComplete: $empty,
+		onCancel: $empty,
+		onSuccess: $empty,
+		onFailure: $empty,
+		onException: $empty,*/
+		url: '',
+		data: '',
+		headers: {
+			'X-Requested-With': 'XMLHttpRequest',
+			'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+		},
+		async: true,
+		format: false,
+		method: 'post',
+		link: 'ignore',
+		isSuccess: null,
+		emulation: true,
+		urlEncoded: true,
+		encoding: 'utf-8',
+		evalScripts: false,
+		evalResponse: false
+	},
+
+	initialize: function(options){
+		this.xhr = new Browser.Request();
+		this.setOptions(options);
+		this.options.isSuccess = this.options.isSuccess || this.isSuccess;
+		this.headers = new Hash(this.options.headers);
+	},
+
+	onStateChange: function(){
+		if (this.xhr.readyState != 4 || !this.running) return;
+		this.running = false;
+		this.status = 0;
+		$try(function(){
+			this.status = this.xhr.status;
+		}.bind(this));
+		if (this.options.isSuccess.call(this, this.status)){
+			this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML};
+			this.success(this.response.text, this.response.xml);
+		} else {
+			this.response = {text: null, xml: null};
+			this.failure();
+		}
+		this.xhr.onreadystatechange = $empty;
+	},
+
+	isSuccess: function(){
+		return ((this.status >= 200) && (this.status < 300));
+	},
+
+	processScripts: function(text){
+		if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return $exec(text);
+		return text.stripScripts(this.options.evalScripts);
+	},
+
+	success: function(text, xml){
+		this.onSuccess(this.processScripts(text), xml);
+	},
+
+	onSuccess: function(){
+		this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
+	},
+
+	failure: function(){
+		this.onFailure();
+	},
+
+	onFailure: function(){
+		this.fireEvent('complete').fireEvent('failure', this.xhr);
+	},
+
+	setHeader: function(name, value){
+		this.headers.set(name, value);
+		return this;
+	},
+
+	getHeader: function(name){
+		return $try(function(){
+			return this.xhr.getResponseHeader(name);
+		}.bind(this));
+	},
+
+	check: function(caller){
+		if (!this.running) return true;
+		switch (this.options.link){
+			case 'cancel': this.cancel(); return true;
+			case 'chain': this.chain(caller.bind(this, Array.slice(arguments, 1))); return false;
+		}
+		return false;
+	},
+
+	send: function(options){
+		if (!this.check(arguments.callee, options)) return this;
+		this.running = true;
+
+		var type = $type(options);
+		if (type == 'string' || type == 'element') options = {data: options};
+
+		var old = this.options;
+		options = $extend({data: old.data, url: old.url, method: old.method}, options);
+		var data = options.data, url = options.url, method = options.method;
+
+		switch ($type(data)){
+			case 'element': data = $(data).toQueryString(); break;
+			case 'object': case 'hash': data = Hash.toQueryString(data);
+		}
+
+		if (this.options.format){
+			var format = 'format=' + this.options.format;
+			data = (data) ? format + '&' + data : format;
+		}
+
+		if (this.options.emulation && ['put', 'delete'].contains(method)){
+			var _method = '_method=' + method;
+			data = (data) ? _method + '&' + data : _method;
+			method = 'post';
+		}
+
+		if (this.options.urlEncoded && method == 'post'){
+			var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
+			this.headers.set('Content-type', 'application/x-www-form-urlencoded' + encoding);
+		}
+
+		if (data && method == 'get'){
+			url = url + (url.contains('?') ? '&' : '?') + data;
+			data = null;
+		}
+
+		this.xhr.open(method.toUpperCase(), url, this.options.async);
+
+		this.xhr.onreadystatechange = this.onStateChange.bind(this);
+
+		this.headers.each(function(value, key){
+			try {
+				this.xhr.setRequestHeader(key, value);
+			} catch (e){
+				this.fireEvent('exception', [key, value]);
+			}
+		}, this);
+
+		this.fireEvent('request');
+		this.xhr.send(data);
+		if (!this.options.async) this.onStateChange();
+		return this;
+	},
+
+	cancel: function(){
+		if (!this.running) return this;
+		this.running = false;
+		this.xhr.abort();
+		this.xhr.onreadystatechange = $empty;
+		this.xhr = new Browser.Request();
+		this.fireEvent('cancel');
+		return this;
+	}
+
+});
+
+(function(){
+
+var methods = {};
+['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){
+	methods[method] = function(){
+		var params = Array.link(arguments, {url: String.type, data: $defined});
+		return this.send($extend(params, {method: method.toLowerCase()}));
+	};
+});
+
+Request.implement(methods);
+
+})();
+
+Element.Properties.send = {
+
+	set: function(options){
+		var send = this.retrieve('send');
+		if (send) send.cancel();
+		return this.eliminate('send').store('send:options', $extend({
+			data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
+		}, options));
+	},
+
+	get: function(options){
+		if (options || !this.retrieve('send')){
+			if (options || !this.retrieve('send:options')) this.set('send', options);
+			this.store('send', new Request(this.retrieve('send:options')));
+		}
+		return this.retrieve('send');
+	}
+
+};
+
+Element.implement({
+
+	send: function(url){
+		var sender = this.get('send');
+		sender.send({data: this, url: url || sender.options.url});
+		return this;
+	}
+
+});
+
+
+/*
+Script: Request.HTML.js
+	Extends the basic Request Class with additional methods for interacting with HTML responses.
+
+License:
+	MIT-style license.
+*/
+
+Request.HTML = new Class({
+
+	Extends: Request,
+
+	options: {
+		update: false,
+		evalScripts: true,
+		filter: false
+	},
+
+	processHTML: function(text){
+		var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
+		text = (match) ? match[1] : text;
+
+		var container = new Element('div');
+
+		return $try(function(){
+			var root = '<root>' + text + '</root>', doc;
+			if (Browser.Engine.trident){
+				doc = new ActiveXObject('Microsoft.XMLDOM');
+				doc.async = false;
+				doc.loadXML(root);
+			} else {
+				doc = new DOMParser().parseFromString(root, 'text/xml');
+			}
+			root = doc.getElementsByTagName('root')[0];
+			for (var i = 0, k = root.childNodes.length; i < k; i++){
+				var child = Element.clone(root.childNodes[i], true, true);
+				if (child) container.grab(child);
+			}
+			return container;
+		}) || container.set('html', text);
+	},
+
+	success: function(text){
+		var options = this.options, response = this.response;
+
+		response.html = text.stripScripts(function(script){
+			response.javascript = script;
+		});
+
+		var temp = this.processHTML(response.html);
+
+		response.tree = temp.childNodes;
+		response.elements = temp.getElements('*');
+
+		if (options.filter) response.tree = response.elements.filter(options.filter);
+		if (options.update) $(options.update).empty().set('html', response.html);
+		if (options.evalScripts) $exec(response.javascript);
+
+		this.onSuccess(response.tree, response.elements, response.html, response.javascript);
+	}
+
+});
+
+Element.Properties.load = {
+
+	set: function(options){
+		var load = this.retrieve('load');
+		if (load) load.cancel();
+		return this.eliminate('load').store('load:options', $extend({data: this, link: 'cancel', update: this, method: 'get'}, options));
+	},
+
+	get: function(options){
+		if (options || ! this.retrieve('load')){
+			if (options || !this.retrieve('load:options')) this.set('load', options);
+			this.store('load', new Request.HTML(this.retrieve('load:options')));
+		}
+		return this.retrieve('load');
+	}
+
+};
+
+Element.implement({
+
+	load: function(){
+		this.get('load').send(Array.link(arguments, {data: Object.type, url: String.type}));
+		return this;
+	}
+
+});
+
+
+/*
+Script: Request.JSON.js
+	Extends the basic Request Class with additional methods for sending and receiving JSON data.
+
+License:
+	MIT-style license.
+*/
+
+Request.JSON = new Class({
+
+	Extends: Request,
+
+	options: {
+		secure: true
+	},
+
+	initialize: function(options){
+		this.parent(options);
+		this.headers.extend({'Accept': 'application/json', 'X-Request': 'JSON'});
+	},
+
+	success: function(text){
+		this.response.json = JSON.decode(text, this.options.secure);
+		this.onSuccess(this.response.json, text);
+	}
+
+});
diff --git a/lib/prototype.js b/lib/prototype.js
new file mode 100644
index 0000000..dfe8ab4
--- /dev/null
+++ b/lib/prototype.js
@@ -0,0 +1,4320 @@
+/*  Prototype JavaScript framework, version 1.6.0.3
+ *  (c) 2005-2008 Sam Stephenson
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *  For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+  Version: '1.6.0.3',
+
+  Browser: {
+    IE:     !!(window.attachEvent &&
+      navigator.userAgent.indexOf('Opera') === -1),
+    Opera:  navigator.userAgent.indexOf('Opera') > -1,
+    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 &&
+      navigator.userAgent.indexOf('KHTML') === -1,
+    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
+  },
+
+  BrowserFeatures: {
+    XPath: !!document.evaluate,
+    SelectorsAPI: !!document.querySelector,
+    ElementExtensions: !!window.HTMLElement,
+    SpecificElementExtensions:
+      document.createElement('div')['__proto__'] &&
+      document.createElement('div')['__proto__'] !==
+        document.createElement('form')['__proto__']
+  },
+
+  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
+
+  emptyFunction: function() { },
+  K: function(x) { return x }
+};
+
+if (Prototype.Browser.MobileSafari)
+  Prototype.BrowserFeatures.SpecificElementExtensions = false;
+
+
+/* Based on Alex Arnell's inheritance implementation. */
+var Class = {
+  create: function() {
+    var parent = null, properties = $A(arguments);
+    if (Object.isFunction(properties[0]))
+      parent = properties.shift();
+
+    function klass() {
+      this.initialize.apply(this, arguments);
+    }
+
+    Object.extend(klass, Class.Methods);
+    klass.superclass = parent;
+    klass.subclasses = [];
+
+    if (parent) {
+      var subclass = function() { };
+      subclass.prototype = parent.prototype;
+      klass.prototype = new subclass;
+      parent.subclasses.push(klass);
+    }
+
+    for (var i = 0; i < properties.length; i++)
+      klass.addMethods(properties[i]);
+
+    if (!klass.prototype.initialize)
+      klass.prototype.initialize = Prototype.emptyFunction;
+
+    klass.prototype.constructor = klass;
+
+    return klass;
+  }
+};
+
+Class.Methods = {
+  addMethods: function(source) {
+    var ancestor   = this.superclass && this.superclass.prototype;
+    var properties = Object.keys(source);
+
+    if (!Object.keys({ toString: true }).length)
+      properties.push("toString", "valueOf");
+
+    for (var i = 0, length = properties.length; i < length; i++) {
+      var property = properties[i], value = source[property];
+      if (ancestor && Object.isFunction(value) &&
+          value.argumentNames().first() == "$super") {
+        var method = value;
+        value = (function(m) {
+          return function() { return ancestor[m].apply(this, arguments) };
+        })(property).wrap(method);
+
+        value.valueOf = method.valueOf.bind(method);
+        value.toString = method.toString.bind(method);
+      }
+      this.prototype[property] = value;
+    }
+
+    return this;
+  }
+};
+
+var Abstract = { };
+
+Object.extend = function(destination, source) {
+  for (var property in source)
+    destination[property] = source[property];
+  return destination;
+};
+
+Object.extend(Object, {
+  inspect: function(object) {
+    try {
+      if (Object.isUndefined(object)) return 'undefined';
+      if (object === null) return 'null';
+      return object.inspect ? object.inspect() : String(object);
+    } catch (e) {
+      if (e instanceof RangeError) return '...';
+      throw e;
+    }
+  },
+
+  toJSON: function(object) {
+    var type = typeof object;
+    switch (type) {
+      case 'undefined':
+      case 'function':
+      case 'unknown': return;
+      case 'boolean': return object.toString();
+    }
+
+    if (object === null) return 'null';
+    if (object.toJSON) return object.toJSON();
+    if (Object.isElement(object)) return;
+
+    var results = [];
+    for (var property in object) {
+      var value = Object.toJSON(object[property]);
+      if (!Object.isUndefined(value))
+        results.push(property.toJSON() + ': ' + value);
+    }
+
+    return '{' + results.join(', ') + '}';
+  },
+
+  toQueryString: function(object) {
+    return $H(object).toQueryString();
+  },
+
+  toHTML: function(object) {
+    return object && object.toHTML ? object.toHTML() : String.interpret(object);
+  },
+
+  keys: function(object) {
+    var keys = [];
+    for (var property in object)
+      keys.push(property);
+    return keys;
+  },
+
+  values: function(object) {
+    var values = [];
+    for (var property in object)
+      values.push(object[property]);
+    return values;
+  },
+
+  clone: function(object) {
+    return Object.extend({ }, object);
+  },
+
+  isElement: function(object) {
+    return !!(object && object.nodeType == 1);
+  },
+
+  isArray: function(object) {
+    return object != null && typeof object == "object" &&
+      'splice' in object && 'join' in object;
+  },
+
+  isHash: function(object) {
+    return object instanceof Hash;
+  },
+
+  isFunction: function(object) {
+    return typeof object == "function";
+  },
+
+  isString: function(object) {
+    return typeof object == "string";
+  },
+
+  isNumber: function(object) {
+    return typeof object == "number";
+  },
+
+  isUndefined: function(object) {
+    return typeof object == "undefined";
+  }
+});
+
+Object.extend(Function.prototype, {
+  argumentNames: function() {
+    var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
+      .replace(/\s+/g, '').split(',');
+    return names.length == 1 && !names[0] ? [] : names;
+  },
+
+  bind: function() {
+    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
+    var __method = this, args = $A(arguments), object = args.shift();
+    return function() {
+      return __method.apply(object, args.concat($A(arguments)));
+    }
+  },
+
+  bindAsEventListener: function() {
+    var __method = this, args = $A(arguments), object = args.shift();
+    return function(event) {
+      return __method.apply(object, [event || window.event].concat(args));
+    }
+  },
+
+  curry: function() {
+    if (!arguments.length) return this;
+    var __method = this, args = $A(arguments);
+    return function() {
+      return __method.apply(this, args.concat($A(arguments)));
+    }
+  },
+
+  delay: function() {
+    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
+    return window.setTimeout(function() {
+      return __method.apply(__method, args);
+    }, timeout);
+  },
+
+  defer: function() {
+    var args = [0.01].concat($A(arguments));
+    return this.delay.apply(this, args);
+  },
+
+  wrap: function(wrapper) {
+    var __method = this;
+    return function() {
+      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
+    }
+  },
+
+  methodize: function() {
+    if (this._methodized) return this._methodized;
+    var __method = this;
+    return this._methodized = function() {
+      return __method.apply(null, [this].concat($A(arguments)));
+    };
+  }
+});
+
+Date.prototype.toJSON = function() {
+  return '"' + this.getUTCFullYear() + '-' +
+    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
+    this.getUTCDate().toPaddedString(2) + 'T' +
+    this.getUTCHours().toPaddedString(2) + ':' +
+    this.getUTCMinutes().toPaddedString(2) + ':' +
+    this.getUTCSeconds().toPaddedString(2) + 'Z"';
+};
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) { }
+    }
+
+    return returnValue;
+  }
+};
+
+RegExp.prototype.match = RegExp.prototype.test;
+
+RegExp.escape = function(str) {
+  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+};
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create({
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  execute: function() {
+    this.callback(this);
+  },
+
+  stop: function() {
+    if (!this.timer) return;
+    clearInterval(this.timer);
+    this.timer = null;
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try {
+        this.currentlyExecuting = true;
+        this.execute();
+      } finally {
+        this.currentlyExecuting = false;
+      }
+    }
+  }
+});
+Object.extend(String, {
+  interpret: function(value) {
+    return value == null ? '' : String(value);
+  },
+  specialChar: {
+    '\b': '\\b',
+    '\t': '\\t',
+    '\n': '\\n',
+    '\f': '\\f',
+    '\r': '\\r',
+    '\\': '\\\\'
+  }
+});
+
+Object.extend(String.prototype, {
+  gsub: function(pattern, replacement) {
+    var result = '', source = this, match;
+    replacement = arguments.callee.prepareReplacement(replacement);
+
+    while (source.length > 0) {
+      if (match = source.match(pattern)) {
+        result += source.slice(0, match.index);
+        result += String.interpret(replacement(match));
+        source  = source.slice(match.index + match[0].length);
+      } else {
+        result += source, source = '';
+      }
+    }
+    return result;
+  },
+
+  sub: function(pattern, replacement, count) {
+    replacement = this.gsub.prepareReplacement(replacement);
+    count = Object.isUndefined(count) ? 1 : count;
+
+    return this.gsub(pattern, function(match) {
+      if (--count < 0) return match[0];
+      return replacement(match);
+    });
+  },
+
+  scan: function(pattern, iterator) {
+    this.gsub(pattern, iterator);
+    return String(this);
+  },
+
+  truncate: function(length, truncation) {
+    length = length || 30;
+    truncation = Object.isUndefined(truncation) ? '...' : truncation;
+    return this.length > length ?
+      this.slice(0, length - truncation.length) + truncation : String(this);
+  },
+
+  strip: function() {
+    return this.replace(/^\s+/, '').replace(/\s+$/, '');
+  },
+
+  stripTags: function() {
+    return this.replace(/<\/?[^>]+>/gi, '');
+  },
+
+  stripScripts: function() {
+    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+  },
+
+  extractScripts: function() {
+    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+    return (this.match(matchAll) || []).map(function(scriptTag) {
+      return (scriptTag.match(matchOne) || ['', ''])[1];
+    });
+  },
+
+  evalScripts: function() {
+    return this.extractScripts().map(function(script) { return eval(script) });
+  },
+
+  escapeHTML: function() {
+    var self = arguments.callee;
+    self.text.data = this;
+    return self.div.innerHTML;
+  },
+
+  unescapeHTML: function() {
+    var div = new Element('div');
+    div.innerHTML = this.stripTags();
+    return div.childNodes[0] ? (div.childNodes.length > 1 ?
+      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
+      div.childNodes[0].nodeValue) : '';
+  },
+
+  toQueryParams: function(separator) {
+    var match = this.strip().match(/([^?#]*)(#.*)?$/);
+    if (!match) return { };
+
+    return match[1].split(separator || '&').inject({ }, function(hash, pair) {
+      if ((pair = pair.split('='))[0]) {
+        var key = decodeURIComponent(pair.shift());
+        var value = pair.length > 1 ? pair.join('=') : pair[0];
+        if (value != undefined) value = decodeURIComponent(value);
+
+        if (key in hash) {
+          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
+          hash[key].push(value);
+        }
+        else hash[key] = value;
+      }
+      return hash;
+    });
+  },
+
+  toArray: function() {
+    return this.split('');
+  },
+
+  succ: function() {
+    return this.slice(0, this.length - 1) +
+      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+  },
+
+  times: function(count) {
+    return count < 1 ? '' : new Array(count + 1).join(this);
+  },
+
+  camelize: function() {
+    var parts = this.split('-'), len = parts.length;
+    if (len == 1) return parts[0];
+
+    var camelized = this.charAt(0) == '-'
+      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+      : parts[0];
+
+    for (var i = 1; i < len; i++)
+      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+    return camelized;
+  },
+
+  capitalize: function() {
+    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+  },
+
+  underscore: function() {
+    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+  },
+
+  dasherize: function() {
+    return this.gsub(/_/,'-');
+  },
+
+  inspect: function(useDoubleQuotes) {
+    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
+      var character = String.specialChar[match[0]];
+      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+    });
+    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+  },
+
+  toJSON: function() {
+    return this.inspect(true);
+  },
+
+  unfilterJSON: function(filter) {
+    return this.sub(filter || Prototype.JSONFilter, '#{1}');
+  },
+
+  isJSON: function() {
+    var str = this;
+    if (str.blank()) return false;
+    str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+  },
+
+  evalJSON: function(sanitize) {
+    var json = this.unfilterJSON();
+    try {
+      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
+    } catch (e) { }
+    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+  },
+
+  include: function(pattern) {
+    return this.indexOf(pattern) > -1;
+  },
+
+  startsWith: function(pattern) {
+    return this.indexOf(pattern) === 0;
+  },
+
+  endsWith: function(pattern) {
+    var d = this.length - pattern.length;
+    return d >= 0 && this.lastIndexOf(pattern) === d;
+  },
+
+  empty: function() {
+    return this == '';
+  },
+
+  blank: function() {
+    return /^\s*$/.test(this);
+  },
+
+  interpolate: function(object, pattern) {
+    return new Template(this, pattern).evaluate(object);
+  }
+});
+
+if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
+  escapeHTML: function() {
+    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+  },
+  unescapeHTML: function() {
+    return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
+  }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+  if (Object.isFunction(replacement)) return replacement;
+  var template = new Template(replacement);
+  return function(match) { return template.evaluate(match) };
+};
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+Object.extend(String.prototype.escapeHTML, {
+  div:  document.createElement('div'),
+  text: document.createTextNode('')
+});
+
+String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
+
+var Template = Class.create({
+  initialize: function(template, pattern) {
+    this.template = template.toString();
+    this.pattern = pattern || Template.Pattern;
+  },
+
+  evaluate: function(object) {
+    if (Object.isFunction(object.toTemplateReplacements))
+      object = object.toTemplateReplacements();
+
+    return this.template.gsub(this.pattern, function(match) {
+      if (object == null) return '';
+
+      var before = match[1] || '';
+      if (before == '\\') return match[2];
+
+      var ctx = object, expr = match[3];
+      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+      match = pattern.exec(expr);
+      if (match == null) return before;
+
+      while (match != null) {
+        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
+        ctx = ctx[comp];
+        if (null == ctx || '' == match[3]) break;
+        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
+        match = pattern.exec(expr);
+      }
+
+      return before + String.interpret(ctx);
+    });
+  }
+});
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+
+var $break = { };
+
+var Enumerable = {
+  each: function(iterator, context) {
+    var index = 0;
+    try {
+      this._each(function(value) {
+        iterator.call(context, value, index++);
+      });
+    } catch (e) {
+      if (e != $break) throw e;
+    }
+    return this;
+  },
+
+  eachSlice: function(number, iterator, context) {
+    var index = -number, slices = [], array = this.toArray();
+    if (number < 1) return array;
+    while ((index += number) < array.length)
+      slices.push(array.slice(index, index+number));
+    return slices.collect(iterator, context);
+  },
+
+  all: function(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result = true;
+    this.each(function(value, index) {
+      result = result && !!iterator.call(context, value, index);
+      if (!result) throw $break;
+    });
+    return result;
+  },
+
+  any: function(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result = false;
+    this.each(function(value, index) {
+      if (result = !!iterator.call(context, value, index))
+        throw $break;
+    });
+    return result;
+  },
+
+  collect: function(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var results = [];
+    this.each(function(value, index) {
+      results.push(iterator.call(context, value, index));
+    });
+    return results;
+  },
+
+  detect: function(iterator, context) {
+    var result;
+    this.each(function(value, index) {
+      if (iterator.call(context, value, index)) {
+        result = value;
+        throw $break;
+      }
+    });
+    return result;
+  },
+
+  findAll: function(iterator, context) {
+    var results = [];
+    this.each(function(value, index) {
+      if (iterator.call(context, value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  grep: function(filter, iterator, context) {
+    iterator = iterator || Prototype.K;
+    var results = [];
+
+    if (Object.isString(filter))
+      filter = new RegExp(filter);
+
+    this.each(function(value, index) {
+      if (filter.match(value))
+        results.push(iterator.call(context, value, index));
+    });
+    return results;
+  },
+
+  include: function(object) {
+    if (Object.isFunction(this.indexOf))
+      if (this.indexOf(object) != -1) return true;
+
+    var found = false;
+    this.each(function(value) {
+      if (value == object) {
+        found = true;
+        throw $break;
+      }
+    });
+    return found;
+  },
+
+  inGroupsOf: function(number, fillWith) {
+    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
+    return this.eachSlice(number, function(slice) {
+      while(slice.length < number) slice.push(fillWith);
+      return slice;
+    });
+  },
+
+  inject: function(memo, iterator, context) {
+    this.each(function(value, index) {
+      memo = iterator.call(context, memo, value, index);
+    });
+    return memo;
+  },
+
+  invoke: function(method) {
+    var args = $A(arguments).slice(1);
+    return this.map(function(value) {
+      return value[method].apply(value, args);
+    });
+  },
+
+  max: function(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator.call(context, value, index);
+      if (result == null || value >= result)
+        result = value;
+    });
+    return result;
+  },
+
+  min: function(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator.call(context, value, index);
+      if (result == null || value < result)
+        result = value;
+    });
+    return result;
+  },
+
+  partition: function(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var trues = [], falses = [];
+    this.each(function(value, index) {
+      (iterator.call(context, value, index) ?
+        trues : falses).push(value);
+    });
+    return [trues, falses];
+  },
+
+  pluck: function(property) {
+    var results = [];
+    this.each(function(value) {
+      results.push(value[property]);
+    });
+    return results;
+  },
+
+  reject: function(iterator, context) {
+    var results = [];
+    this.each(function(value, index) {
+      if (!iterator.call(context, value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  sortBy: function(iterator, context) {
+    return this.map(function(value, index) {
+      return {
+        value: value,
+        criteria: iterator.call(context, value, index)
+      };
+    }).sort(function(left, right) {
+      var a = left.criteria, b = right.criteria;
+      return a < b ? -1 : a > b ? 1 : 0;
+    }).pluck('value');
+  },
+
+  toArray: function() {
+    return this.map();
+  },
+
+  zip: function() {
+    var iterator = Prototype.K, args = $A(arguments);
+    if (Object.isFunction(args.last()))
+      iterator = args.pop();
+
+    var collections = [this].concat(args).map($A);
+    return this.map(function(value, index) {
+      return iterator(collections.pluck(index));
+    });
+  },
+
+  size: function() {
+    return this.toArray().length;
+  },
+
+  inspect: function() {
+    return '#<Enumerable:' + this.toArray().inspect() + '>';
+  }
+};
+
+Object.extend(Enumerable, {
+  map:     Enumerable.collect,
+  find:    Enumerable.detect,
+  select:  Enumerable.findAll,
+  filter:  Enumerable.findAll,
+  member:  Enumerable.include,
+  entries: Enumerable.toArray,
+  every:   Enumerable.all,
+  some:    Enumerable.any
+});
+function $A(iterable) {
+  if (!iterable) return [];
+  if (iterable.toArray) return iterable.toArray();
+  var length = iterable.length || 0, results = new Array(length);
+  while (length--) results[length] = iterable[length];
+  return results;
+}
+
+if (Prototype.Browser.WebKit) {
+  $A = function(iterable) {
+    if (!iterable) return [];
+    // In Safari, only use the `toArray` method if it's not a NodeList.
+    // A NodeList is a function, has an function `item` property, and a numeric
+    // `length` property. Adapted from Google Doctype.
+    if (!(typeof iterable === 'function' && typeof iterable.length ===
+        'number' && typeof iterable.item === 'function') && iterable.toArray)
+      return iterable.toArray();
+    var length = iterable.length || 0, results = new Array(length);
+    while (length--) results[length] = iterable[length];
+    return results;
+  };
+}
+
+Array.from = $A;
+
+Object.extend(Array.prototype, Enumerable);
+
+if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+  _each: function(iterator) {
+    for (var i = 0, length = this.length; i < length; i++)
+      iterator(this[i]);
+  },
+
+  clear: function() {
+    this.length = 0;
+    return this;
+  },
+
+  first: function() {
+    return this[0];
+  },
+
+  last: function() {
+    return this[this.length - 1];
+  },
+
+  compact: function() {
+    return this.select(function(value) {
+      return value != null;
+    });
+  },
+
+  flatten: function() {
+    return this.inject([], function(array, value) {
+      return array.concat(Object.isArray(value) ?
+        value.flatten() : [value]);
+    });
+  },
+
+  without: function() {
+    var values = $A(arguments);
+    return this.select(function(value) {
+      return !values.include(value);
+    });
+  },
+
+  reverse: function(inline) {
+    return (inline !== false ? this : this.toArray())._reverse();
+  },
+
+  reduce: function() {
+    return this.length > 1 ? this : this[0];
+  },
+
+  uniq: function(sorted) {
+    return this.inject([], function(array, value, index) {
+      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
+        array.push(value);
+      return array;
+    });
+  },
+
+  intersect: function(array) {
+    return this.uniq().findAll(function(item) {
+      return array.detect(function(value) { return item === value });
+    });
+  },
+
+  clone: function() {
+    return [].concat(this);
+  },
+
+  size: function() {
+    return this.length;
+  },
+
+  inspect: function() {
+    return '[' + this.map(Object.inspect).join(', ') + ']';
+  },
+
+  toJSON: function() {
+    var results = [];
+    this.each(function(object) {
+      var value = Object.toJSON(object);
+      if (!Object.isUndefined(value)) results.push(value);
+    });
+    return '[' + results.join(', ') + ']';
+  }
+});
+
+// use native browser JS 1.6 implementation if available
+if (Object.isFunction(Array.prototype.forEach))
+  Array.prototype._each = Array.prototype.forEach;
+
+if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
+  i || (i = 0);
+  var length = this.length;
+  if (i < 0) i = length + i;
+  for (; i < length; i++)
+    if (this[i] === item) return i;
+  return -1;
+};
+
+if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
+  i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
+  var n = this.slice(0, i).reverse().indexOf(item);
+  return (n < 0) ? n : i - n - 1;
+};
+
+Array.prototype.toArray = Array.prototype.clone;
+
+function $w(string) {
+  if (!Object.isString(string)) return [];
+  string = string.strip();
+  return string ? string.split(/\s+/) : [];
+}
+
+if (Prototype.Browser.Opera){
+  Array.prototype.concat = function() {
+    var array = [];
+    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      if (Object.isArray(arguments[i])) {
+        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
+          array.push(arguments[i][j]);
+      } else {
+        array.push(arguments[i]);
+      }
+    }
+    return array;
+  };
+}
+Object.extend(Number.prototype, {
+  toColorPart: function() {
+    return this.toPaddedString(2, 16);
+  },
+
+  succ: function() {
+    return this + 1;
+  },
+
+  times: function(iterator, context) {
+    $R(0, this, true).each(iterator, context);
+    return this;
+  },
+
+  toPaddedString: function(length, radix) {
+    var string = this.toString(radix || 10);
+    return '0'.times(length - string.length) + string;
+  },
+
+  toJSON: function() {
+    return isFinite(this) ? this.toString() : 'null';
+  }
+});
+
+$w('abs round ceil floor').each(function(method){
+  Number.prototype[method] = Math[method].methodize();
+});
+function $H(object) {
+  return new Hash(object);
+};
+
+var Hash = Class.create(Enumerable, (function() {
+
+  function toQueryPair(key, value) {
+    if (Object.isUndefined(value)) return key;
+    return key + '=' + encodeURIComponent(String.interpret(value));
+  }
+
+  return {
+    initialize: function(object) {
+      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+    },
+
+    _each: function(iterator) {
+      for (var key in this._object) {
+        var value = this._object[key], pair = [key, value];
+        pair.key = key;
+        pair.value = value;
+        iterator(pair);
+      }
+    },
+
+    set: function(key, value) {
+      return this._object[key] = value;
+    },
+
+    get: function(key) {
+      // simulating poorly supported hasOwnProperty
+      if (this._object[key] !== Object.prototype[key])
+        return this._object[key];
+    },
+
+    unset: function(key) {
+      var value = this._object[key];
+      delete this._object[key];
+      return value;
+    },
+
+    toObject: function() {
+      return Object.clone(this._object);
+    },
+
+    keys: function() {
+      return this.pluck('key');
+    },
+
+    values: function() {
+      return this.pluck('value');
+    },
+
+    index: function(value) {
+      var match = this.detect(function(pair) {
+        return pair.value === value;
+      });
+      return match && match.key;
+    },
+
+    merge: function(object) {
+      return this.clone().update(object);
+    },
+
+    update: function(object) {
+      return new Hash(object).inject(this, function(result, pair) {
+        result.set(pair.key, pair.value);
+        return result;
+      });
+    },
+
+    toQueryString: function() {
+      return this.inject([], function(results, pair) {
+        var key = encodeURIComponent(pair.key), values = pair.value;
+
+        if (values && typeof values == 'object') {
+          if (Object.isArray(values))
+            return results.concat(values.map(toQueryPair.curry(key)));
+        } else results.push(toQueryPair(key, values));
+        return results;
+      }).join('&');
+    },
+
+    inspect: function() {
+      return '#<Hash:{' + this.map(function(pair) {
+        return pair.map(Object.inspect).join(': ');
+      }).join(', ') + '}>';
+    },
+
+    toJSON: function() {
+      return Object.toJSON(this.toObject());
+    },
+
+    clone: function() {
+      return new Hash(this);
+    }
+  }
+})());
+
+Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
+Hash.from = $H;
+var ObjectRange = Class.create(Enumerable, {
+  initialize: function(start, end, exclusive) {
+    this.start = start;
+    this.end = end;
+    this.exclusive = exclusive;
+  },
+
+  _each: function(iterator) {
+    var value = this.start;
+    while (this.include(value)) {
+      iterator(value);
+      value = value.succ();
+    }
+  },
+
+  include: function(value) {
+    if (value < this.start)
+      return false;
+    if (this.exclusive)
+      return value < this.end;
+    return value <= this.end;
+  }
+});
+
+var $R = function(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+};
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new XMLHttpRequest()},
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+    ) || false;
+  },
+
+  activeRequestCount: 0
+};
+
+Ajax.Responders = {
+  responders: [],
+
+  _each: function(iterator) {
+    this.responders._each(iterator);
+  },
+
+  register: function(responder) {
+    if (!this.include(responder))
+      this.responders.push(responder);
+  },
+
+  unregister: function(responder) {
+    this.responders = this.responders.without(responder);
+  },
+
+  dispatch: function(callback, request, transport, json) {
+    this.each(function(responder) {
+      if (Object.isFunction(responder[callback])) {
+        try {
+          responder[callback].apply(responder, [request, transport, json]);
+        } catch (e) { }
+      }
+    });
+  }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+  onCreate:   function() { Ajax.activeRequestCount++ },
+  onComplete: function() { Ajax.activeRequestCount-- }
+});
+
+Ajax.Base = Class.create({
+  initialize: function(options) {
+    this.options = {
+      method:       'post',
+      asynchronous: true,
+      contentType:  'application/x-www-form-urlencoded',
+      encoding:     'UTF-8',
+      parameters:   '',
+      evalJSON:     true,
+      evalJS:       true
+    };
+    Object.extend(this.options, options || { });
+
+    this.options.method = this.options.method.toLowerCase();
+
+    if (Object.isString(this.options.parameters))
+      this.options.parameters = this.options.parameters.toQueryParams();
+    else if (Object.isHash(this.options.parameters))
+      this.options.parameters = this.options.parameters.toObject();
+  }
+});
+
+Ajax.Request = Class.create(Ajax.Base, {
+  _complete: false,
+
+  initialize: function($super, url, options) {
+    $super(options);
+    this.transport = Ajax.getTransport();
+    this.request(url);
+  },
+
+  request: function(url) {
+    this.url = url;
+    this.method = this.options.method;
+    var params = Object.clone(this.options.parameters);
+
+    if (!['get', 'post'].include(this.method)) {
+      // simulate other verbs over post
+      params['_method'] = this.method;
+      this.method = 'post';
+    }
+
+    this.parameters = params;
+
+    if (params = Object.toQueryString(params)) {
+      // when GET, append parameters to URL
+      if (this.method == 'get')
+        this.url += (this.url.include('?') ? '&' : '?') + params;
+      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
+        params += '&_=';
+    }
+
+    try {
+      var response = new Ajax.Response(this);
+      if (this.options.onCreate) this.options.onCreate(response);
+      Ajax.Responders.dispatch('onCreate', this, response);
+
+      this.transport.open(this.method.toUpperCase(), this.url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
+
+      this.transport.onreadystatechange = this.onStateChange.bind(this);
+      this.setRequestHeaders();
+
+      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
+      this.transport.send(this.body);
+
+      /* Force Firefox to handle ready state 4 for synchronous requests */
+      if (!this.options.asynchronous && this.transport.overrideMimeType)
+        this.onStateChange();
+
+    }
+    catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState > 1 && !((readyState == 4) && this._complete))
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  setRequestHeaders: function() {
+    var headers = {
+      'X-Requested-With': 'XMLHttpRequest',
+      'X-Prototype-Version': Prototype.Version,
+      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+    };
+
+    if (this.method == 'post') {
+      headers['Content-type'] = this.options.contentType +
+        (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+      /* Force "Connection: close" for older Mozilla browsers to work
+       * around a bug where XMLHttpRequest sends an incorrect
+       * Content-length header. See Mozilla Bugzilla #246651.
+       */
+      if (this.transport.overrideMimeType &&
+          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+            headers['Connection'] = 'close';
+    }
+
+    // user-defined headers
+    if (typeof this.options.requestHeaders == 'object') {
+      var extras = this.options.requestHeaders;
+
+      if (Object.isFunction(extras.push))
+        for (var i = 0, length = extras.length; i < length; i += 2)
+          headers[extras[i]] = extras[i+1];
+      else
+        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+    }
+
+    for (var name in headers)
+      this.transport.setRequestHeader(name, headers[name]);
+  },
+
+  success: function() {
+    var status = this.getStatus();
+    return !status || (status >= 200 && status < 300);
+  },
+
+  getStatus: function() {
+    try {
+      return this.transport.status || 0;
+    } catch (e) { return 0 }
+  },
+
+  respondToReadyState: function(readyState) {
+    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
+
+    if (state == 'Complete') {
+      try {
+        this._complete = true;
+        (this.options['on' + response.status]
+         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+         || Prototype.emptyFunction)(response, response.headerJSON);
+      } catch (e) {
+        this.dispatchException(e);
+      }
+
+      var contentType = response.getHeader('Content-type');
+      if (this.options.evalJS == 'force'
+          || (this.options.evalJS && this.isSameOrigin() && contentType
+          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
+        this.evalResponse();
+    }
+
+    try {
+      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
+      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+
+    if (state == 'Complete') {
+      // avoid memory leak in MSIE: clean up
+      this.transport.onreadystatechange = Prototype.emptyFunction;
+    }
+  },
+
+  isSameOrigin: function() {
+    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+      protocol: location.protocol,
+      domain: document.domain,
+      port: location.port ? ':' + location.port : ''
+    }));
+  },
+
+  getHeader: function(name) {
+    try {
+      return this.transport.getResponseHeader(name) || null;
+    } catch (e) { return null }
+  },
+
+  evalResponse: function() {
+    try {
+      return eval((this.transport.responseText || '').unfilterJSON());
+    } catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  dispatchException: function(exception) {
+    (this.options.onException || Prototype.emptyFunction)(this, exception);
+    Ajax.Responders.dispatch('onException', this, exception);
+  }
+});
+
+Ajax.Request.Events =
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Response = Class.create({
+  initialize: function(request){
+    this.request = request;
+    var transport  = this.transport  = request.transport,
+        readyState = this.readyState = transport.readyState;
+
+    if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
+      this.status       = this.getStatus();
+      this.statusText   = this.getStatusText();
+      this.responseText = String.interpret(transport.responseText);
+      this.headerJSON   = this._getHeaderJSON();
+    }
+
+    if(readyState == 4) {
+      var xml = transport.responseXML;
+      this.responseXML  = Object.isUndefined(xml) ? null : xml;
+      this.responseJSON = this._getResponseJSON();
+    }
+  },
+
+  status:      0,
+  statusText: '',
+
+  getStatus: Ajax.Request.prototype.getStatus,
+
+  getStatusText: function() {
+    try {
+      return this.transport.statusText || '';
+    } catch (e) { return '' }
+  },
+
+  getHeader: Ajax.Request.prototype.getHeader,
+
+  getAllHeaders: function() {
+    try {
+      return this.getAllResponseHeaders();
+    } catch (e) { return null }
+  },
+
+  getResponseHeader: function(name) {
+    return this.transport.getResponseHeader(name);
+  },
+
+  getAllResponseHeaders: function() {
+    return this.transport.getAllResponseHeaders();
+  },
+
+  _getHeaderJSON: function() {
+    var json = this.getHeader('X-JSON');
+    if (!json) return null;
+    json = decodeURIComponent(escape(json));
+    try {
+      return json.evalJSON(this.request.options.sanitizeJSON ||
+        !this.request.isSameOrigin());
+    } catch (e) {
+      this.request.dispatchException(e);
+    }
+  },
+
+  _getResponseJSON: function() {
+    var options = this.request.options;
+    if (!options.evalJSON || (options.evalJSON != 'force' &&
+      !(this.getHeader('Content-type') || '').include('application/json')) ||
+        this.responseText.blank())
+          return null;
+    try {
+      return this.responseText.evalJSON(options.sanitizeJSON ||
+        !this.request.isSameOrigin());
+    } catch (e) {
+      this.request.dispatchException(e);
+    }
+  }
+});
+
+Ajax.Updater = Class.create(Ajax.Request, {
+  initialize: function($super, container, url, options) {
+    this.container = {
+      success: (container.success || container),
+      failure: (container.failure || (container.success ? null : container))
+    };
+
+    options = Object.clone(options);
+    var onComplete = options.onComplete;
+    options.onComplete = (function(response, json) {
+      this.updateContent(response.responseText);
+      if (Object.isFunction(onComplete)) onComplete(response, json);
+    }).bind(this);
+
+    $super(url, options);
+  },
+
+  updateContent: function(responseText) {
+    var receiver = this.container[this.success() ? 'success' : 'failure'],
+        options = this.options;
+
+    if (!options.evalScripts) responseText = responseText.stripScripts();
+
+    if (receiver = $(receiver)) {
+      if (options.insertion) {
+        if (Object.isString(options.insertion)) {
+          var insertion = { }; insertion[options.insertion] = responseText;
+          receiver.insert(insertion);
+        }
+        else options.insertion(receiver, responseText);
+      }
+      else receiver.update(responseText);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
+  initialize: function($super, container, url, options) {
+    $super(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = (this.options.decay || 1);
+
+    this.updater = { };
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.options.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(response) {
+    if (this.options.decay) {
+      this.decay = (response.responseText == this.lastText ?
+        this.decay * this.options.decay : 1);
+
+      this.lastText = response.responseText;
+    }
+    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+function $(element) {
+  if (arguments.length > 1) {
+    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+      elements.push($(arguments[i]));
+    return elements;
+  }
+  if (Object.isString(element))
+    element = document.getElementById(element);
+  return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+  document._getElementsByXPath = function(expression, parentElement) {
+    var results = [];
+    var query = document.evaluate(expression, $(parentElement) || document,
+      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+    for (var i = 0, length = query.snapshotLength; i < length; i++)
+      results.push(Element.extend(query.snapshotItem(i)));
+    return results;
+  };
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Node) var Node = { };
+
+if (!Node.ELEMENT_NODE) {
+  // DOM level 2 ECMAScript Language Binding
+  Object.extend(Node, {
+    ELEMENT_NODE: 1,
+    ATTRIBUTE_NODE: 2,
+    TEXT_NODE: 3,
+    CDATA_SECTION_NODE: 4,
+    ENTITY_REFERENCE_NODE: 5,
+    ENTITY_NODE: 6,
+    PROCESSING_INSTRUCTION_NODE: 7,
+    COMMENT_NODE: 8,
+    DOCUMENT_NODE: 9,
+    DOCUMENT_TYPE_NODE: 10,
+    DOCUMENT_FRAGMENT_NODE: 11,
+    NOTATION_NODE: 12
+  });
+}
+
+(function() {
+  var element = this.Element;
+  this.Element = function(tagName, attributes) {
+    attributes = attributes || { };
+    tagName = tagName.toLowerCase();
+    var cache = Element.cache;
+    if (Prototype.Browser.IE && attributes.name) {
+      tagName = '<' + tagName + ' name="' + attributes.name + '">';
+      delete attributes.name;
+      return Element.writeAttribute(document.createElement(tagName), attributes);
+    }
+    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
+    return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
+  };
+  Object.extend(this.Element, element || { });
+  if (element) this.Element.prototype = element.prototype;
+}).call(window);
+
+Element.cache = { };
+
+Element.Methods = {
+  visible: function(element) {
+    return $(element).style.display != 'none';
+  },
+
+  toggle: function(element) {
+    element = $(element);
+    Element[Element.visible(element) ? 'hide' : 'show'](element);
+    return element;
+  },
+
+  hide: function(element) {
+    element = $(element);
+    element.style.display = 'none';
+    return element;
+  },
+
+  show: function(element) {
+    element = $(element);
+    element.style.display = '';
+    return element;
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+    return element;
+  },
+
+  update: function(element, content) {
+    element = $(element);
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) return element.update().insert(content);
+    content = Object.toHTML(content);
+    element.innerHTML = content.stripScripts();
+    content.evalScripts.bind(content).defer();
+    return element;
+  },
+
+  replace: function(element, content) {
+    element = $(element);
+    if (content && content.toElement) content = content.toElement();
+    else if (!Object.isElement(content)) {
+      content = Object.toHTML(content);
+      var range = element.ownerDocument.createRange();
+      range.selectNode(element);
+      content.evalScripts.bind(content).defer();
+      content = range.createContextualFragment(content.stripScripts());
+    }
+    element.parentNode.replaceChild(content, element);
+    return element;
+  },
+
+  insert: function(element, insertions) {
+    element = $(element);
+
+    if (Object.isString(insertions) || Object.isNumber(insertions) ||
+        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
+          insertions = {bottom:insertions};
+
+    var content, insert, tagName, childNodes;
+
+    for (var position in insertions) {
+      content  = insertions[position];
+      position = position.toLowerCase();
+      insert = Element._insertionTranslations[position];
+
+      if (content && content.toElement) content = content.toElement();
+      if (Object.isElement(content)) {
+        insert(element, content);
+        continue;
+      }
+
+      content = Object.toHTML(content);
+
+      tagName = ((position == 'before' || position == 'after')
+        ? element.parentNode : element).tagName.toUpperCase();
+
+      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+      if (position == 'top' || position == 'after') childNodes.reverse();
+      childNodes.each(insert.curry(element));
+
+      content.evalScripts.bind(content).defer();
+    }
+
+    return element;
+  },
+
+  wrap: function(element, wrapper, attributes) {
+    element = $(element);
+    if (Object.isElement(wrapper))
+      $(wrapper).writeAttribute(attributes || { });
+    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
+    else wrapper = new Element('div', wrapper);
+    if (element.parentNode)
+      element.parentNode.replaceChild(wrapper, element);
+    wrapper.appendChild(element);
+    return wrapper;
+  },
+
+  inspect: function(element) {
+    element = $(element);
+    var result = '<' + element.tagName.toLowerCase();
+    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+      var property = pair.first(), attribute = pair.last();
+      var value = (element[property] || '').toString();
+      if (value) result += ' ' + attribute + '=' + value.inspect(true);
+    });
+    return result + '>';
+  },
+
+  recursivelyCollect: function(element, property) {
+    element = $(element);
+    var elements = [];
+    while (element = element[property])
+      if (element.nodeType == 1)
+        elements.push(Element.extend(element));
+    return elements;
+  },
+
+  ancestors: function(element) {
+    return $(element).recursivelyCollect('parentNode');
+  },
+
+  descendants: function(element) {
+    return $(element).select("*");
+  },
+
+  firstDescendant: function(element) {
+    element = $(element).firstChild;
+    while (element && element.nodeType != 1) element = element.nextSibling;
+    return $(element);
+  },
+
+  immediateDescendants: function(element) {
+    if (!(element = $(element).firstChild)) return [];
+    while (element && element.nodeType != 1) element = element.nextSibling;
+    if (element) return [element].concat($(element).nextSiblings());
+    return [];
+  },
+
+  previousSiblings: function(element) {
+    return $(element).recursivelyCollect('previousSibling');
+  },
+
+  nextSiblings: function(element) {
+    return $(element).recursivelyCollect('nextSibling');
+  },
+
+  siblings: function(element) {
+    element = $(element);
+    return element.previousSiblings().reverse().concat(element.nextSiblings());
+  },
+
+  match: function(element, selector) {
+    if (Object.isString(selector))
+      selector = new Selector(selector);
+    return selector.match($(element));
+  },
+
+  up: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(element.parentNode);
+    var ancestors = element.ancestors();
+    return Object.isNumber(expression) ? ancestors[expression] :
+      Selector.findElement(ancestors, expression, index);
+  },
+
+  down: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return element.firstDescendant();
+    return Object.isNumber(expression) ? element.descendants()[expression] :
+      Element.select(element, expression)[index || 0];
+  },
+
+  previous: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
+    var previousSiblings = element.previousSiblings();
+    return Object.isNumber(expression) ? previousSiblings[expression] :
+      Selector.findElement(previousSiblings, expression, index);
+  },
+
+  next: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
+    var nextSiblings = element.nextSiblings();
+    return Object.isNumber(expression) ? nextSiblings[expression] :
+      Selector.findElement(nextSiblings, expression, index);
+  },
+
+  select: function() {
+    var args = $A(arguments), element = $(args.shift());
+    return Selector.findChildElements(element, args);
+  },
+
+  adjacent: function() {
+    var args = $A(arguments), element = $(args.shift());
+    return Selector.findChildElements(element.parentNode, args).without(element);
+  },
+
+  identify: function(element) {
+    element = $(element);
+    var id = element.readAttribute('id'), self = arguments.callee;
+    if (id) return id;
+    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
+    element.writeAttribute('id', id);
+    return id;
+  },
+
+  readAttribute: function(element, name) {
+    element = $(element);
+    if (Prototype.Browser.IE) {
+      var t = Element._attributeTranslations.read;
+      if (t.values[name]) return t.values[name](element, name);
+      if (t.names[name]) name = t.names[name];
+      if (name.include(':')) {
+        return (!element.attributes || !element.attributes[name]) ? null :
+         element.attributes[name].value;
+      }
+    }
+    return element.getAttribute(name);
+  },
+
+  writeAttribute: function(element, name, value) {
+    element = $(element);
+    var attributes = { }, t = Element._attributeTranslations.write;
+
+    if (typeof name == 'object') attributes = name;
+    else attributes[name] = Object.isUndefined(value) ? true : value;
+
+    for (var attr in attributes) {
+      name = t.names[attr] || attr;
+      value = attributes[attr];
+      if (t.values[attr]) name = t.values[attr](element, value);
+      if (value === false || value === null)
+        element.removeAttribute(name);
+      else if (value === true)
+        element.setAttribute(name, name);
+      else element.setAttribute(name, value);
+    }
+    return element;
+  },
+
+  getHeight: function(element) {
+    return $(element).getDimensions().height;
+  },
+
+  getWidth: function(element) {
+    return $(element).getDimensions().width;
+  },
+
+  classNames: function(element) {
+    return new Element.ClassNames(element);
+  },
+
+  hasClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    var elementClassName = element.className;
+    return (elementClassName.length > 0 && (elementClassName == className ||
+      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
+  },
+
+  addClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    if (!element.hasClassName(className))
+      element.className += (element.className ? ' ' : '') + className;
+    return element;
+  },
+
+  removeClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    element.className = element.className.replace(
+      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
+    return element;
+  },
+
+  toggleClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    return element[element.hasClassName(className) ?
+      'removeClassName' : 'addClassName'](className);
+  },
+
+  // removes whitespace-only text node children
+  cleanWhitespace: function(element) {
+    element = $(element);
+    var node = element.firstChild;
+    while (node) {
+      var nextNode = node.nextSibling;
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+        element.removeChild(node);
+      node = nextNode;
+    }
+    return element;
+  },
+
+  empty: function(element) {
+    return $(element).innerHTML.blank();
+  },
+
+  descendantOf: function(element, ancestor) {
+    element = $(element), ancestor = $(ancestor);
+
+    if (element.compareDocumentPosition)
+      return (element.compareDocumentPosition(ancestor) & 8) === 8;
+
+    if (ancestor.contains)
+      return ancestor.contains(element) && ancestor !== element;
+
+    while (element = element.parentNode)
+      if (element == ancestor) return true;
+
+    return false;
+  },
+
+  scrollTo: function(element) {
+    element = $(element);
+    var pos = element.cumulativeOffset();
+    window.scrollTo(pos[0], pos[1]);
+    return element;
+  },
+
+  getStyle: function(element, style) {
+    element = $(element);
+    style = style == 'float' ? 'cssFloat' : style.camelize();
+    var value = element.style[style];
+    if (!value || value == 'auto') {
+      var css = document.defaultView.getComputedStyle(element, null);
+      value = css ? css[style] : null;
+    }
+    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+    return value == 'auto' ? null : value;
+  },
+
+  getOpacity: function(element) {
+    return $(element).getStyle('opacity');
+  },
+
+  setStyle: function(element, styles) {
+    element = $(element);
+    var elementStyle = element.style, match;
+    if (Object.isString(styles)) {
+      element.style.cssText += ';' + styles;
+      return styles.include('opacity') ?
+        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
+    }
+    for (var property in styles)
+      if (property == 'opacity') element.setOpacity(styles[property]);
+      else
+        elementStyle[(property == 'float' || property == 'cssFloat') ?
+          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
+            property] = styles[property];
+
+    return element;
+  },
+
+  setOpacity: function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1 || value === '') ? '' :
+      (value < 0.00001) ? 0 : value;
+    return element;
+  },
+
+  getDimensions: function(element) {
+    element = $(element);
+    var display = element.getStyle('display');
+    if (display != 'none' && display != null) // Safari bug
+      return {width: element.offsetWidth, height: element.offsetHeight};
+
+    // All *Width and *Height properties give 0 on elements with display none,
+    // so enable the element temporarily
+    var els = element.style;
+    var originalVisibility = els.visibility;
+    var originalPosition = els.position;
+    var originalDisplay = els.display;
+    els.visibility = 'hidden';
+    els.position = 'absolute';
+    els.display = 'block';
+    var originalWidth = element.clientWidth;
+    var originalHeight = element.clientHeight;
+    els.display = originalDisplay;
+    els.position = originalPosition;
+    els.visibility = originalVisibility;
+    return {width: originalWidth, height: originalHeight};
+  },
+
+  makePositioned: function(element) {
+    element = $(element);
+    var pos = Element.getStyle(element, 'position');
+    if (pos == 'static' || !pos) {
+      element._madePositioned = true;
+      element.style.position = 'relative';
+      // Opera returns the offset relative to the positioning context, when an
+      // element is position relative but top and left have not been defined
+      if (Prototype.Browser.Opera) {
+        element.style.top = 0;
+        element.style.left = 0;
+      }
+    }
+    return element;
+  },
+
+  undoPositioned: function(element) {
+    element = $(element);
+    if (element._madePositioned) {
+      element._madePositioned = undefined;
+      element.style.position =
+        element.style.top =
+        element.style.left =
+        element.style.bottom =
+        element.style.right = '';
+    }
+    return element;
+  },
+
+  makeClipping: function(element) {
+    element = $(element);
+    if (element._overflow) return element;
+    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
+    if (element._overflow !== 'hidden')
+      element.style.overflow = 'hidden';
+    return element;
+  },
+
+  undoClipping: function(element) {
+    element = $(element);
+    if (!element._overflow) return element;
+    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+    element._overflow = null;
+    return element;
+  },
+
+  cumulativeOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+    } while (element);
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  positionedOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+      if (element) {
+        if (element.tagName.toUpperCase() == 'BODY') break;
+        var p = Element.getStyle(element, 'position');
+        if (p !== 'static') break;
+      }
+    } while (element);
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  absolutize: function(element) {
+    element = $(element);
+    if (element.getStyle('position') == 'absolute') return element;
+    // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+    var offsets = element.positionedOffset();
+    var top     = offsets[1];
+    var left    = offsets[0];
+    var width   = element.clientWidth;
+    var height  = element.clientHeight;
+
+    element._originalLeft   = left - parseFloat(element.style.left  || 0);
+    element._originalTop    = top  - parseFloat(element.style.top || 0);
+    element._originalWidth  = element.style.width;
+    element._originalHeight = element.style.height;
+
+    element.style.position = 'absolute';
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.width  = width + 'px';
+    element.style.height = height + 'px';
+    return element;
+  },
+
+  relativize: function(element) {
+    element = $(element);
+    if (element.getStyle('position') == 'relative') return element;
+    // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+    element.style.position = 'relative';
+    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
+    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.height = element._originalHeight;
+    element.style.width  = element._originalWidth;
+    return element;
+  },
+
+  cumulativeScrollOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0;
+      element = element.parentNode;
+    } while (element);
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  getOffsetParent: function(element) {
+    if (element.offsetParent) return $(element.offsetParent);
+    if (element == document.body) return $(element);
+
+    while ((element = element.parentNode) && element != document.body)
+      if (Element.getStyle(element, 'position') != 'static')
+        return $(element);
+
+    return $(document.body);
+  },
+
+  viewportOffset: function(forElement) {
+    var valueT = 0, valueL = 0;
+
+    var element = forElement;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+
+      // Safari fix
+      if (element.offsetParent == document.body &&
+        Element.getStyle(element, 'position') == 'absolute') break;
+
+    } while (element = element.offsetParent);
+
+    element = forElement;
+    do {
+      if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
+        valueT -= element.scrollTop  || 0;
+        valueL -= element.scrollLeft || 0;
+      }
+    } while (element = element.parentNode);
+
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  clonePosition: function(element, source) {
+    var options = Object.extend({
+      setLeft:    true,
+      setTop:     true,
+      setWidth:   true,
+      setHeight:  true,
+      offsetTop:  0,
+      offsetLeft: 0
+    }, arguments[2] || { });
+
+    // find page position of source
+    source = $(source);
+    var p = source.viewportOffset();
+
+    // find coordinate system to use
+    element = $(element);
+    var delta = [0, 0];
+    var parent = null;
+    // delta [0,0] will do fine with position: fixed elements,
+    // position:absolute needs offsetParent deltas
+    if (Element.getStyle(element, 'position') == 'absolute') {
+      parent = element.getOffsetParent();
+      delta = parent.viewportOffset();
+    }
+
+    // correct by body offsets (fixes Safari)
+    if (parent == document.body) {
+      delta[0] -= document.body.offsetLeft;
+      delta[1] -= document.body.offsetTop;
+    }
+
+    // set position
+    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
+    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
+    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
+    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
+    return element;
+  }
+};
+
+Element.Methods.identify.counter = 1;
+
+Object.extend(Element.Methods, {
+  getElementsBySelector: Element.Methods.select,
+  childElements: Element.Methods.immediateDescendants
+});
+
+Element._attributeTranslations = {
+  write: {
+    names: {
+      className: 'class',
+      htmlFor:   'for'
+    },
+    values: { }
+  }
+};
+
+if (Prototype.Browser.Opera) {
+  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+    function(proceed, element, style) {
+      switch (style) {
+        case 'left': case 'top': case 'right': case 'bottom':
+          if (proceed(element, 'position') === 'static') return null;
+        case 'height': case 'width':
+          // returns '0px' for hidden elements; we want it to return null
+          if (!Element.visible(element)) return null;
+
+          // returns the border-box dimensions rather than the content-box
+          // dimensions, so we subtract padding and borders from the value
+          var dim = parseInt(proceed(element, style), 10);
+
+          if (dim !== element['offset' + style.capitalize()])
+            return dim + 'px';
+
+          var properties;
+          if (style === 'height') {
+            properties = ['border-top-width', 'padding-top',
+             'padding-bottom', 'border-bottom-width'];
+          }
+          else {
+            properties = ['border-left-width', 'padding-left',
+             'padding-right', 'border-right-width'];
+          }
+          return properties.inject(dim, function(memo, property) {
+            var val = proceed(element, property);
+            return val === null ? memo : memo - parseInt(val, 10);
+          }) + 'px';
+        default: return proceed(element, style);
+      }
+    }
+  );
+
+  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+    function(proceed, element, attribute) {
+      if (attribute === 'title') return element.title;
+      return proceed(element, attribute);
+    }
+  );
+}
+
+else if (Prototype.Browser.IE) {
+  // IE doesn't report offsets correctly for static elements, so we change them
+  // to "relative" to get the values, then change them back.
+  Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
+    function(proceed, element) {
+      element = $(element);
+      // IE throws an error if element is not in document
+      try { element.offsetParent }
+      catch(e) { return $(document.body) }
+      var position = element.getStyle('position');
+      if (position !== 'static') return proceed(element);
+      element.setStyle({ position: 'relative' });
+      var value = proceed(element);
+      element.setStyle({ position: position });
+      return value;
+    }
+  );
+
+  $w('positionedOffset viewportOffset').each(function(method) {
+    Element.Methods[method] = Element.Methods[method].wrap(
+      function(proceed, element) {
+        element = $(element);
+        try { element.offsetParent }
+        catch(e) { return Element._returnOffset(0,0) }
+        var position = element.getStyle('position');
+        if (position !== 'static') return proceed(element);
+        // Trigger hasLayout on the offset parent so that IE6 reports
+        // accurate offsetTop and offsetLeft values for position: fixed.
+        var offsetParent = element.getOffsetParent();
+        if (offsetParent && offsetParent.getStyle('position') === 'fixed')
+          offsetParent.setStyle({ zoom: 1 });
+        element.setStyle({ position: 'relative' });
+        var value = proceed(element);
+        element.setStyle({ position: position });
+        return value;
+      }
+    );
+  });
+
+  Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
+    function(proceed, element) {
+      try { element.offsetParent }
+      catch(e) { return Element._returnOffset(0,0) }
+      return proceed(element);
+    }
+  );
+
+  Element.Methods.getStyle = function(element, style) {
+    element = $(element);
+    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
+    var value = element.style[style];
+    if (!value && element.currentStyle) value = element.currentStyle[style];
+
+    if (style == 'opacity') {
+      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+        if (value[1]) return parseFloat(value[1]) / 100;
+      return 1.0;
+    }
+
+    if (value == 'auto') {
+      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
+        return element['offset' + style.capitalize()] + 'px';
+      return null;
+    }
+    return value;
+  };
+
+  Element.Methods.setOpacity = function(element, value) {
+    function stripAlpha(filter){
+      return filter.replace(/alpha\([^\)]*\)/gi,'');
+    }
+    element = $(element);
+    var currentStyle = element.currentStyle;
+    if ((currentStyle && !currentStyle.hasLayout) ||
+      (!currentStyle && element.style.zoom == 'normal'))
+        element.style.zoom = 1;
+
+    var filter = element.getStyle('filter'), style = element.style;
+    if (value == 1 || value === '') {
+      (filter = stripAlpha(filter)) ?
+        style.filter = filter : style.removeAttribute('filter');
+      return element;
+    } else if (value < 0.00001) value = 0;
+    style.filter = stripAlpha(filter) +
+      'alpha(opacity=' + (value * 100) + ')';
+    return element;
+  };
+
+  Element._attributeTranslations = {
+    read: {
+      names: {
+        'class': 'className',
+        'for':   'htmlFor'
+      },
+      values: {
+        _getAttr: function(element, attribute) {
+          return element.getAttribute(attribute, 2);
+        },
+        _getAttrNode: function(element, attribute) {
+          var node = element.getAttributeNode(attribute);
+          return node ? node.value : "";
+        },
+        _getEv: function(element, attribute) {
+          attribute = element.getAttribute(attribute);
+          return attribute ? attribute.toString().slice(23, -2) : null;
+        },
+        _flag: function(element, attribute) {
+          return $(element).hasAttribute(attribute) ? attribute : null;
+        },
+        style: function(element) {
+          return element.style.cssText.toLowerCase();
+        },
+        title: function(element) {
+          return element.title;
+        }
+      }
+    }
+  };
+
+  Element._attributeTranslations.write = {
+    names: Object.extend({
+      cellpadding: 'cellPadding',
+      cellspacing: 'cellSpacing'
+    }, Element._attributeTranslations.read.names),
+    values: {
+      checked: function(element, value) {
+        element.checked = !!value;
+      },
+
+      style: function(element, value) {
+        element.style.cssText = value ? value : '';
+      }
+    }
+  };
+
+  Element._attributeTranslations.has = {};
+
+  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
+      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
+    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
+    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
+  });
+
+  (function(v) {
+    Object.extend(v, {
+      href:        v._getAttr,
+      src:         v._getAttr,
+      type:        v._getAttr,
+      action:      v._getAttrNode,
+      disabled:    v._flag,
+      checked:     v._flag,
+      readonly:    v._flag,
+      multiple:    v._flag,
+      onload:      v._getEv,
+      onunload:    v._getEv,
+      onclick:     v._getEv,
+      ondblclick:  v._getEv,
+      onmousedown: v._getEv,
+      onmouseup:   v._getEv,
+      onmouseover: v._getEv,
+      onmousemove: v._getEv,
+      onmouseout:  v._getEv,
+      onfocus:     v._getEv,
+      onblur:      v._getEv,
+      onkeypress:  v._getEv,
+      onkeydown:   v._getEv,
+      onkeyup:     v._getEv,
+      onsubmit:    v._getEv,
+      onreset:     v._getEv,
+      onselect:    v._getEv,
+      onchange:    v._getEv
+    });
+  })(Element._attributeTranslations.read.values);
+}
+
+else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
+  Element.Methods.setOpacity = function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1) ? 0.999999 :
+      (value === '') ? '' : (value < 0.00001) ? 0 : value;
+    return element;
+  };
+}
+
+else if (Prototype.Browser.WebKit) {
+  Element.Methods.setOpacity = function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1 || value === '') ? '' :
+      (value < 0.00001) ? 0 : value;
+
+    if (value == 1)
+      if(element.tagName.toUpperCase() == 'IMG' && element.width) {
+        element.width++; element.width--;
+      } else try {
+        var n = document.createTextNode(' ');
+        element.appendChild(n);
+        element.removeChild(n);
+      } catch (e) { }
+
+    return element;
+  };
+
+  // Safari returns margins on body which is incorrect if the child is absolutely
+  // positioned.  For performance reasons, redefine Element#cumulativeOffset for
+  // KHTML/WebKit only.
+  Element.Methods.cumulativeOffset = function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      if (element.offsetParent == document.body)
+        if (Element.getStyle(element, 'position') == 'absolute') break;
+
+      element = element.offsetParent;
+    } while (element);
+
+    return Element._returnOffset(valueL, valueT);
+  };
+}
+
+if (Prototype.Browser.IE || Prototype.Browser.Opera) {
+  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
+  Element.Methods.update = function(element, content) {
+    element = $(element);
+
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) return element.update().insert(content);
+
+    content = Object.toHTML(content);
+    var tagName = element.tagName.toUpperCase();
+
+    if (tagName in Element._insertionTranslations.tags) {
+      $A(element.childNodes).each(function(node) { element.removeChild(node) });
+      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+        .each(function(node) { element.appendChild(node) });
+    }
+    else element.innerHTML = content.stripScripts();
+
+    content.evalScripts.bind(content).defer();
+    return element;
+  };
+}
+
+if ('outerHTML' in document.createElement('div')) {
+  Element.Methods.replace = function(element, content) {
+    element = $(element);
+
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) {
+      element.parentNode.replaceChild(content, element);
+      return element;
+    }
+
+    content = Object.toHTML(content);
+    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
+
+    if (Element._insertionTranslations.tags[tagName]) {
+      var nextSibling = element.next();
+      var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+      parent.removeChild(element);
+      if (nextSibling)
+        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
+      else
+        fragments.each(function(node) { parent.appendChild(node) });
+    }
+    else element.outerHTML = content.stripScripts();
+
+    content.evalScripts.bind(content).defer();
+    return element;
+  };
+}
+
+Element._returnOffset = function(l, t) {
+  var result = [l, t];
+  result.left = l;
+  result.top = t;
+  return result;
+};
+
+Element._getContentFromAnonymousElement = function(tagName, html) {
+  var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
+  if (t) {
+    div.innerHTML = t[0] + html + t[1];
+    t[2].times(function() { div = div.firstChild });
+  } else div.innerHTML = html;
+  return $A(div.childNodes);
+};
+
+Element._insertionTranslations = {
+  before: function(element, node) {
+    element.parentNode.insertBefore(node, element);
+  },
+  top: function(element, node) {
+    element.insertBefore(node, element.firstChild);
+  },
+  bottom: function(element, node) {
+    element.appendChild(node);
+  },
+  after: function(element, node) {
+    element.parentNode.insertBefore(node, element.nextSibling);
+  },
+  tags: {
+    TABLE:  ['<table>',                '</table>',                   1],
+    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
+    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
+    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
+    SELECT: ['<select>',               '</select>',                  1]
+  }
+};
+
+(function() {
+  Object.extend(this.tags, {
+    THEAD: this.tags.TBODY,
+    TFOOT: this.tags.TBODY,
+    TH:    this.tags.TD
+  });
+}).call(Element._insertionTranslations);
+
+Element.Methods.Simulated = {
+  hasAttribute: function(element, attribute) {
+    attribute = Element._attributeTranslations.has[attribute] || attribute;
+    var node = $(element).getAttributeNode(attribute);
+    return !!(node && node.specified);
+  }
+};
+
+Element.Methods.ByTag = { };
+
+Object.extend(Element, Element.Methods);
+
+if (!Prototype.BrowserFeatures.ElementExtensions &&
+    document.createElement('div')['__proto__']) {
+  window.HTMLElement = { };
+  window.HTMLElement.prototype = document.createElement('div')['__proto__'];
+  Prototype.BrowserFeatures.ElementExtensions = true;
+}
+
+Element.extend = (function() {
+  if (Prototype.BrowserFeatures.SpecificElementExtensions)
+    return Prototype.K;
+
+  var Methods = { }, ByTag = Element.Methods.ByTag;
+
+  var extend = Object.extend(function(element) {
+    if (!element || element._extendedByPrototype ||
+        element.nodeType != 1 || element == window) return element;
+
+    var methods = Object.clone(Methods),
+      tagName = element.tagName.toUpperCase(), property, value;
+
+    // extend methods for specific tags
+    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
+
+    for (property in methods) {
+      value = methods[property];
+      if (Object.isFunction(value) && !(property in element))
+        element[property] = value.methodize();
+    }
+
+    element._extendedByPrototype = Prototype.emptyFunction;
+    return element;
+
+  }, {
+    refresh: function() {
+      // extend methods for all tags (Safari doesn't need this)
+      if (!Prototype.BrowserFeatures.ElementExtensions) {
+        Object.extend(Methods, Element.Methods);
+        Object.extend(Methods, Element.Methods.Simulated);
+      }
+    }
+  });
+
+  extend.refresh();
+  return extend;
+})();
+
+Element.hasAttribute = function(element, attribute) {
+  if (element.hasAttribute) return element.hasAttribute(attribute);
+  return Element.Methods.Simulated.hasAttribute(element, attribute);
+};
+
+Element.addMethods = function(methods) {
+  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+
+  if (!methods) {
+    Object.extend(Form, Form.Methods);
+    Object.extend(Form.Element, Form.Element.Methods);
+    Object.extend(Element.Methods.ByTag, {
+      "FORM":     Object.clone(Form.Methods),
+      "INPUT":    Object.clone(Form.Element.Methods),
+      "SELECT":   Object.clone(Form.Element.Methods),
+      "TEXTAREA": Object.clone(Form.Element.Methods)
+    });
+  }
+
+  if (arguments.length == 2) {
+    var tagName = methods;
+    methods = arguments[1];
+  }
+
+  if (!tagName) Object.extend(Element.Methods, methods || { });
+  else {
+    if (Object.isArray(tagName)) tagName.each(extend);
+    else extend(tagName);
+  }
+
+  function extend(tagName) {
+    tagName = tagName.toUpperCase();
+    if (!Element.Methods.ByTag[tagName])
+      Element.Methods.ByTag[tagName] = { };
+    Object.extend(Element.Methods.ByTag[tagName], methods);
+  }
+
+  function copy(methods, destination, onlyIfAbsent) {
+    onlyIfAbsent = onlyIfAbsent || false;
+    for (var property in methods) {
+      var value = methods[property];
+      if (!Object.isFunction(value)) continue;
+      if (!onlyIfAbsent || !(property in destination))
+        destination[property] = value.methodize();
+    }
+  }
+
+  function findDOMClass(tagName) {
+    var klass;
+    var trans = {
+      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
+      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
+      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
+      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
+      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
+      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
+      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
+      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
+      "FrameSet", "IFRAME": "IFrame"
+    };
+    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
+    if (window[klass]) return window[klass];
+    klass = 'HTML' + tagName + 'Element';
+    if (window[klass]) return window[klass];
+    klass = 'HTML' + tagName.capitalize() + 'Element';
+    if (window[klass]) return window[klass];
+
+    window[klass] = { };
+    window[klass].prototype = document.createElement(tagName)['__proto__'];
+    return window[klass];
+  }
+
+  if (F.ElementExtensions) {
+    copy(Element.Methods, HTMLElement.prototype);
+    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+  }
+
+  if (F.SpecificElementExtensions) {
+    for (var tag in Element.Methods.ByTag) {
+      var klass = findDOMClass(tag);
+      if (Object.isUndefined(klass)) continue;
+      copy(T[tag], klass.prototype);
+    }
+  }
+
+  Object.extend(Element, Element.Methods);
+  delete Element.ByTag;
+
+  if (Element.extend.refresh) Element.extend.refresh();
+  Element.cache = { };
+};
+
+document.viewport = {
+  getDimensions: function() {
+    var dimensions = { }, B = Prototype.Browser;
+    $w('width height').each(function(d) {
+      var D = d.capitalize();
+      if (B.WebKit && !document.evaluate) {
+        // Safari <3.0 needs self.innerWidth/Height
+        dimensions[d] = self['inner' + D];
+      } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) {
+        // Opera <9.5 needs document.body.clientWidth/Height
+        dimensions[d] = document.body['client' + D]
+      } else {
+        dimensions[d] = document.documentElement['client' + D];
+      }
+    });
+    return dimensions;
+  },
+
+  getWidth: function() {
+    return this.getDimensions().width;
+  },
+
+  getHeight: function() {
+    return this.getDimensions().height;
+  },
+
+  getScrollOffsets: function() {
+    return Element._returnOffset(
+      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
+  }
+};
+/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
+ * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
+ * license.  Please see http://www.yui-ext.com/ for more information. */
+
+var Selector = Class.create({
+  initialize: function(expression) {
+    this.expression = expression.strip();
+
+    if (this.shouldUseSelectorsAPI()) {
+      this.mode = 'selectorsAPI';
+    } else if (this.shouldUseXPath()) {
+      this.mode = 'xpath';
+      this.compileXPathMatcher();
+    } else {
+      this.mode = "normal";
+      this.compileMatcher();
+    }
+
+  },
+
+  shouldUseXPath: function() {
+    if (!Prototype.BrowserFeatures.XPath) return false;
+
+    var e = this.expression;
+
+    // Safari 3 chokes on :*-of-type and :empty
+    if (Prototype.Browser.WebKit &&
+     (e.include("-of-type") || e.include(":empty")))
+      return false;
+
+    // XPath can't do namespaced attributes, nor can it read
+    // the "checked" property from DOM nodes
+    if ((/(\[[\w-]*?:|:checked)/).test(e))
+      return false;
+
+    return true;
+  },
+
+  shouldUseSelectorsAPI: function() {
+    if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
+
+    if (!Selector._div) Selector._div = new Element('div');
+
+    // Make sure the browser treats the selector as valid. Test on an
+    // isolated element to minimize cost of this check.
+    try {
+      Selector._div.querySelector(this.expression);
+    } catch(e) {
+      return false;
+    }
+
+    return true;
+  },
+
+  compileMatcher: function() {
+    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
+        c = Selector.criteria, le, p, m;
+
+    if (Selector._cache[e]) {
+      this.matcher = Selector._cache[e];
+      return;
+    }
+
+    this.matcher = ["this.matcher = function(root) {",
+                    "var r = root, h = Selector.handlers, c = false, n;"];
+
+    while (e && le != e && (/\S/).test(e)) {
+      le = e;
+      for (var i in ps) {
+        p = ps[i];
+        if (m = e.match(p)) {
+          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
+            new Template(c[i]).evaluate(m));
+          e = e.replace(m[0], '');
+          break;
+        }
+      }
+    }
+
+    this.matcher.push("return h.unique(n);\n}");
+    eval(this.matcher.join('\n'));
+    Selector._cache[this.expression] = this.matcher;
+  },
+
+  compileXPathMatcher: function() {
+    var e = this.expression, ps = Selector.patterns,
+        x = Selector.xpath, le, m;
+
+    if (Selector._cache[e]) {
+      this.xpath = Selector._cache[e]; return;
+    }
+
+    this.matcher = ['.//*'];
+    while (e && le != e && (/\S/).test(e)) {
+      le = e;
+      for (var i in ps) {
+        if (m = e.match(ps[i])) {
+          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
+            new Template(x[i]).evaluate(m));
+          e = e.replace(m[0], '');
+          break;
+        }
+      }
+    }
+
+    this.xpath = this.matcher.join('');
+    Selector._cache[this.expression] = this.xpath;
+  },
+
+  findElements: function(root) {
+    root = root || document;
+    var e = this.expression, results;
+
+    switch (this.mode) {
+      case 'selectorsAPI':
+        // querySelectorAll queries document-wide, then filters to descendants
+        // of the context element. That's not what we want.
+        // Add an explicit context to the selector if necessary.
+        if (root !== document) {
+          var oldId = root.id, id = $(root).identify();
+          e = "#" + id + " " + e;
+        }
+
+        results = $A(root.querySelectorAll(e)).map(Element.extend);
+        root.id = oldId;
+
+        return results;
+      case 'xpath':
+        return document._getElementsByXPath(this.xpath, root);
+      default:
+       return this.matcher(root);
+    }
+  },
+
+  match: function(element) {
+    this.tokens = [];
+
+    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
+    var le, p, m;
+
+    while (e && le !== e && (/\S/).test(e)) {
+      le = e;
+      for (var i in ps) {
+        p = ps[i];
+        if (m = e.match(p)) {
+          // use the Selector.assertions methods unless the selector
+          // is too complex.
+          if (as[i]) {
+            this.tokens.push([i, Object.clone(m)]);
+            e = e.replace(m[0], '');
+          } else {
+            // reluctantly do a document-wide search
+            // and look for a match in the array
+            return this.findElements(document).include(element);
+          }
+        }
+      }
+    }
+
+    var match = true, name, matches;
+    for (var i = 0, token; token = this.tokens[i]; i++) {
+      name = token[0], matches = token[1];
+      if (!Selector.assertions[name](element, matches)) {
+        match = false; break;
+      }
+    }
+
+    return match;
+  },
+
+  toString: function() {
+    return this.expression;
+  },
+
+  inspect: function() {
+    return "#<Selector:" + this.expression.inspect() + ">";
+  }
+});
+
+Object.extend(Selector, {
+  _cache: { },
+
+  xpath: {
+    descendant:   "//*",
+    child:        "/*",
+    adjacent:     "/following-sibling::*[1]",
+    laterSibling: '/following-sibling::*',
+    tagName:      function(m) {
+      if (m[1] == '*') return '';
+      return "[local-name()='" + m[1].toLowerCase() +
+             "' or local-name()='" + m[1].toUpperCase() + "']";
+    },
+    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
+    id:           "[@id='#{1}']",
+    attrPresence: function(m) {
+      m[1] = m[1].toLowerCase();
+      return new Template("[@#{1}]").evaluate(m);
+    },
+    attr: function(m) {
+      m[1] = m[1].toLowerCase();
+      m[3] = m[5] || m[6];
+      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
+    },
+    pseudo: function(m) {
+      var h = Selector.xpath.pseudos[m[1]];
+      if (!h) return '';
+      if (Object.isFunction(h)) return h(m);
+      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
+    },
+    operators: {
+      '=':  "[@#{1}='#{3}']",
+      '!=': "[@#{1}!='#{3}']",
+      '^=': "[starts-with(@#{1}, '#{3}')]",
+      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
+      '*=': "[contains(@#{1}, '#{3}')]",
+      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
+      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
+    },
+    pseudos: {
+      'first-child': '[not(preceding-sibling::*)]',
+      'last-child':  '[not(following-sibling::*)]',
+      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
+      'empty':       "[count(*) = 0 and (count(text()) = 0)]",
+      'checked':     "[@checked]",
+      'disabled':    "[(@disabled) and (@type!='hidden')]",
+      'enabled':     "[not(@disabled) and (@type!='hidden')]",
+      'not': function(m) {
+        var e = m[6], p = Selector.patterns,
+            x = Selector.xpath, le, v;
+
+        var exclusion = [];
+        while (e && le != e && (/\S/).test(e)) {
+          le = e;
+          for (var i in p) {
+            if (m = e.match(p[i])) {
+              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
+              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
+              e = e.replace(m[0], '');
+              break;
+            }
+          }
+        }
+        return "[not(" + exclusion.join(" and ") + ")]";
+      },
+      'nth-child':      function(m) {
+        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
+      },
+      'nth-last-child': function(m) {
+        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
+      },
+      'nth-of-type':    function(m) {
+        return Selector.xpath.pseudos.nth("position() ", m);
+      },
+      'nth-last-of-type': function(m) {
+        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
+      },
+      'first-of-type':  function(m) {
+        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
+      },
+      'last-of-type':   function(m) {
+        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
+      },
+      'only-of-type':   function(m) {
+        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
+      },
+      nth: function(fragment, m) {
+        var mm, formula = m[6], predicate;
+        if (formula == 'even') formula = '2n+0';
+        if (formula == 'odd')  formula = '2n+1';
+        if (mm = formula.match(/^(\d+)$/)) // digit only
+          return '[' + fragment + "= " + mm[1] + ']';
+        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+          if (mm[1] == "-") mm[1] = -1;
+          var a = mm[1] ? Number(mm[1]) : 1;
+          var b = mm[2] ? Number(mm[2]) : 0;
+          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
+          "((#{fragment} - #{b}) div #{a} >= 0)]";
+          return new Template(predicate).evaluate({
+            fragment: fragment, a: a, b: b });
+        }
+      }
+    }
+  },
+
+  criteria: {
+    tagName:      'n = h.tagName(n, r, "#{1}", c);      c = false;',
+    className:    'n = h.className(n, r, "#{1}", c);    c = false;',
+    id:           'n = h.id(n, r, "#{1}", c);           c = false;',
+    attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
+    attr: function(m) {
+      m[3] = (m[5] || m[6]);
+      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
+    },
+    pseudo: function(m) {
+      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
+      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
+    },
+    descendant:   'c = "descendant";',
+    child:        'c = "child";',
+    adjacent:     'c = "adjacent";',
+    laterSibling: 'c = "laterSibling";'
+  },
+
+  patterns: {
+    // combinators must be listed first
+    // (and descendant needs to be last combinator)
+    laterSibling: /^\s*~\s*/,
+    child:        /^\s*>\s*/,
+    adjacent:     /^\s*\+\s*/,
+    descendant:   /^\s/,
+
+    // selectors follow
+    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
+    id:           /^#([\w\-\*]+)(\b|$)/,
+    className:    /^\.([\w\-\*]+)(\b|$)/,
+    pseudo:
+/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
+    attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
+    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
+  },
+
+  // for Selector.match and Element#match
+  assertions: {
+    tagName: function(element, matches) {
+      return matches[1].toUpperCase() == element.tagName.toUpperCase();
+    },
+
+    className: function(element, matches) {
+      return Element.hasClassName(element, matches[1]);
+    },
+
+    id: function(element, matches) {
+      return element.id === matches[1];
+    },
+
+    attrPresence: function(element, matches) {
+      return Element.hasAttribute(element, matches[1]);
+    },
+
+    attr: function(element, matches) {
+      var nodeValue = Element.readAttribute(element, matches[1]);
+      return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
+    }
+  },
+
+  handlers: {
+    // UTILITY FUNCTIONS
+    // joins two collections
+    concat: function(a, b) {
+      for (var i = 0, node; node = b[i]; i++)
+        a.push(node);
+      return a;
+    },
+
+    // marks an array of nodes for counting
+    mark: function(nodes) {
+      var _true = Prototype.emptyFunction;
+      for (var i = 0, node; node = nodes[i]; i++)
+        node._countedByPrototype = _true;
+      return nodes;
+    },
+
+    unmark: function(nodes) {
+      for (var i = 0, node; node = nodes[i]; i++)
+        node._countedByPrototype = undefined;
+      return nodes;
+    },
+
+    // mark each child node with its position (for nth calls)
+    // "ofType" flag indicates whether we're indexing for nth-of-type
+    // rather than nth-child
+    index: function(parentNode, reverse, ofType) {
+      parentNode._countedByPrototype = Prototype.emptyFunction;
+      if (reverse) {
+        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
+          var node = nodes[i];
+          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+        }
+      } else {
+        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
+          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+      }
+    },
+
+    // filters out duplicates and extends all nodes
+    unique: function(nodes) {
+      if (nodes.length == 0) return nodes;
+      var results = [], n;
+      for (var i = 0, l = nodes.length; i < l; i++)
+        if (!(n = nodes[i])._countedByPrototype) {
+          n._countedByPrototype = Prototype.emptyFunction;
+          results.push(Element.extend(n));
+        }
+      return Selector.handlers.unmark(results);
+    },
+
+    // COMBINATOR FUNCTIONS
+    descendant: function(nodes) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        h.concat(results, node.getElementsByTagName('*'));
+      return results;
+    },
+
+    child: function(nodes) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        for (var j = 0, child; child = node.childNodes[j]; j++)
+          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
+      }
+      return results;
+    },
+
+    adjacent: function(nodes) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        var next = this.nextElementSibling(node);
+        if (next) results.push(next);
+      }
+      return results;
+    },
+
+    laterSibling: function(nodes) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        h.concat(results, Element.nextSiblings(node));
+      return results;
+    },
+
+    nextElementSibling: function(node) {
+      while (node = node.nextSibling)
+        if (node.nodeType == 1) return node;
+      return null;
+    },
+
+    previousElementSibling: function(node) {
+      while (node = node.previousSibling)
+        if (node.nodeType == 1) return node;
+      return null;
+    },
+
+    // TOKEN FUNCTIONS
+    tagName: function(nodes, root, tagName, combinator) {
+      var uTagName = tagName.toUpperCase();
+      var results = [], h = Selector.handlers;
+      if (nodes) {
+        if (combinator) {
+          // fastlane for ordinary descendant combinators
+          if (combinator == "descendant") {
+            for (var i = 0, node; node = nodes[i]; i++)
+              h.concat(results, node.getElementsByTagName(tagName));
+            return results;
+          } else nodes = this[combinator](nodes);
+          if (tagName == "*") return nodes;
+        }
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.tagName.toUpperCase() === uTagName) results.push(node);
+        return results;
+      } else return root.getElementsByTagName(tagName);
+    },
+
+    id: function(nodes, root, id, combinator) {
+      var targetNode = $(id), h = Selector.handlers;
+      if (!targetNode) return [];
+      if (!nodes && root == document) return [targetNode];
+      if (nodes) {
+        if (combinator) {
+          if (combinator == 'child') {
+            for (var i = 0, node; node = nodes[i]; i++)
+              if (targetNode.parentNode == node) return [targetNode];
+          } else if (combinator == 'descendant') {
+            for (var i = 0, node; node = nodes[i]; i++)
+              if (Element.descendantOf(targetNode, node)) return [targetNode];
+          } else if (combinator == 'adjacent') {
+            for (var i = 0, node; node = nodes[i]; i++)
+              if (Selector.handlers.previousElementSibling(targetNode) == node)
+                return [targetNode];
+          } else nodes = h[combinator](nodes);
+        }
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node == targetNode) return [targetNode];
+        return [];
+      }
+      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
+    },
+
+    className: function(nodes, root, className, combinator) {
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      return Selector.handlers.byClassName(nodes, root, className);
+    },
+
+    byClassName: function(nodes, root, className) {
+      if (!nodes) nodes = Selector.handlers.descendant([root]);
+      var needle = ' ' + className + ' ';
+      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
+        nodeClassName = node.className;
+        if (nodeClassName.length == 0) continue;
+        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
+          results.push(node);
+      }
+      return results;
+    },
+
+    attrPresence: function(nodes, root, attr, combinator) {
+      if (!nodes) nodes = root.getElementsByTagName("*");
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      var results = [];
+      for (var i = 0, node; node = nodes[i]; i++)
+        if (Element.hasAttribute(node, attr)) results.push(node);
+      return results;
+    },
+
+    attr: function(nodes, root, attr, value, operator, combinator) {
+      if (!nodes) nodes = root.getElementsByTagName("*");
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      var handler = Selector.operators[operator], results = [];
+      for (var i = 0, node; node = nodes[i]; i++) {
+        var nodeValue = Element.readAttribute(node, attr);
+        if (nodeValue === null) continue;
+        if (handler(nodeValue, value)) results.push(node);
+      }
+      return results;
+    },
+
+    pseudo: function(nodes, name, value, root, combinator) {
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      if (!nodes) nodes = root.getElementsByTagName("*");
+      return Selector.pseudos[name](nodes, value, root);
+    }
+  },
+
+  pseudos: {
+    'first-child': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        if (Selector.handlers.previousElementSibling(node)) continue;
+          results.push(node);
+      }
+      return results;
+    },
+    'last-child': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        if (Selector.handlers.nextElementSibling(node)) continue;
+          results.push(node);
+      }
+      return results;
+    },
+    'only-child': function(nodes, value, root) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
+          results.push(node);
+      return results;
+    },
+    'nth-child':        function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root);
+    },
+    'nth-last-child':   function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root, true);
+    },
+    'nth-of-type':      function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root, false, true);
+    },
+    'nth-last-of-type': function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root, true, true);
+    },
+    'first-of-type':    function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, "1", root, false, true);
+    },
+    'last-of-type':     function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, "1", root, true, true);
+    },
+    'only-of-type':     function(nodes, formula, root) {
+      var p = Selector.pseudos;
+      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
+    },
+
+    // handles the an+b logic
+    getIndices: function(a, b, total) {
+      if (a == 0) return b > 0 ? [b] : [];
+      return $R(1, total).inject([], function(memo, i) {
+        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
+        return memo;
+      });
+    },
+
+    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
+    nth: function(nodes, formula, root, reverse, ofType) {
+      if (nodes.length == 0) return [];
+      if (formula == 'even') formula = '2n+0';
+      if (formula == 'odd')  formula = '2n+1';
+      var h = Selector.handlers, results = [], indexed = [], m;
+      h.mark(nodes);
+      for (var i = 0, node; node = nodes[i]; i++) {
+        if (!node.parentNode._countedByPrototype) {
+          h.index(node.parentNode, reverse, ofType);
+          indexed.push(node.parentNode);
+        }
+      }
+      if (formula.match(/^\d+$/)) { // just a number
+        formula = Number(formula);
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.nodeIndex == formula) results.push(node);
+      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+        if (m[1] == "-") m[1] = -1;
+        var a = m[1] ? Number(m[1]) : 1;
+        var b = m[2] ? Number(m[2]) : 0;
+        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
+        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
+          for (var j = 0; j < l; j++)
+            if (node.nodeIndex == indices[j]) results.push(node);
+        }
+      }
+      h.unmark(nodes);
+      h.unmark(indexed);
+      return results;
+    },
+
+    'empty': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        // IE treats comments as element nodes
+        if (node.tagName == '!' || node.firstChild) continue;
+        results.push(node);
+      }
+      return results;
+    },
+
+    'not': function(nodes, selector, root) {
+      var h = Selector.handlers, selectorType, m;
+      var exclusions = new Selector(selector).findElements(root);
+      h.mark(exclusions);
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (!node._countedByPrototype) results.push(node);
+      h.unmark(exclusions);
+      return results;
+    },
+
+    'enabled': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (!node.disabled && (!node.type || node.type !== 'hidden'))
+          results.push(node);
+      return results;
+    },
+
+    'disabled': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (node.disabled) results.push(node);
+      return results;
+    },
+
+    'checked': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (node.checked) results.push(node);
+      return results;
+    }
+  },
+
+  operators: {
+    '=':  function(nv, v) { return nv == v; },
+    '!=': function(nv, v) { return nv != v; },
+    '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
+    '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
+    '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
+    '$=': function(nv, v) { return nv.endsWith(v); },
+    '*=': function(nv, v) { return nv.include(v); },
+    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
+    '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
+     '-').include('-' + (v || "").toUpperCase() + '-'); }
+  },
+
+  split: function(expression) {
+    var expressions = [];
+    expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+      expressions.push(m[1].strip());
+    });
+    return expressions;
+  },
+
+  matchElements: function(elements, expression) {
+    var matches = $$(expression), h = Selector.handlers;
+    h.mark(matches);
+    for (var i = 0, results = [], element; element = elements[i]; i++)
+      if (element._countedByPrototype) results.push(element);
+    h.unmark(matches);
+    return results;
+  },
+
+  findElement: function(elements, expression, index) {
+    if (Object.isNumber(expression)) {
+      index = expression; expression = false;
+    }
+    return Selector.matchElements(elements, expression || '*')[index || 0];
+  },
+
+  findChildElements: function(element, expressions) {
+    expressions = Selector.split(expressions.join(','));
+    var results = [], h = Selector.handlers;
+    for (var i = 0, l = expressions.length, selector; i < l; i++) {
+      selector = new Selector(expressions[i].strip());
+      h.concat(results, selector.findElements(element));
+    }
+    return (l > 1) ? h.unique(results) : results;
+  }
+});
+
+if (Prototype.Browser.IE) {
+  Object.extend(Selector.handlers, {
+    // IE returns comment nodes on getElementsByTagName("*").
+    // Filter them out.
+    concat: function(a, b) {
+      for (var i = 0, node; node = b[i]; i++)
+        if (node.tagName !== "!") a.push(node);
+      return a;
+    },
+
+    // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
+    unmark: function(nodes) {
+      for (var i = 0, node; node = nodes[i]; i++)
+        node.removeAttribute('_countedByPrototype');
+      return nodes;
+    }
+  });
+}
+
+function $$() {
+  return Selector.findChildElements(document, $A(arguments));
+}
+var Form = {
+  reset: function(form) {
+    $(form).reset();
+    return form;
+  },
+
+  serializeElements: function(elements, options) {
+    if (typeof options != 'object') options = { hash: !!options };
+    else if (Object.isUndefined(options.hash)) options.hash = true;
+    var key, value, submitted = false, submit = options.submit;
+
+    var data = elements.inject({ }, function(result, element) {
+      if (!element.disabled && element.name) {
+        key = element.name; value = $(element).getValue();
+        if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
+            submit !== false && (!submit || key == submit) && (submitted = true)))) {
+          if (key in result) {
+            // a key is already present; construct an array of values
+            if (!Object.isArray(result[key])) result[key] = [result[key]];
+            result[key].push(value);
+          }
+          else result[key] = value;
+        }
+      }
+      return result;
+    });
+
+    return options.hash ? data : Object.toQueryString(data);
+  }
+};
+
+Form.Methods = {
+  serialize: function(form, options) {
+    return Form.serializeElements(Form.getElements(form), options);
+  },
+
+  getElements: function(form) {
+    return $A($(form).getElementsByTagName('*')).inject([],
+      function(elements, child) {
+        if (Form.Element.Serializers[child.tagName.toLowerCase()])
+          elements.push(Element.extend(child));
+        return elements;
+      }
+    );
+  },
+
+  getInputs: function(form, typeName, name) {
+    form = $(form);
+    var inputs = form.getElementsByTagName('input');
+
+    if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) || (name && input.name != name))
+        continue;
+      matchingInputs.push(Element.extend(input));
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    form = $(form);
+    Form.getElements(form).invoke('disable');
+    return form;
+  },
+
+  enable: function(form) {
+    form = $(form);
+    Form.getElements(form).invoke('enable');
+    return form;
+  },
+
+  findFirstElement: function(form) {
+    var elements = $(form).getElements().findAll(function(element) {
+      return 'hidden' != element.type && !element.disabled;
+    });
+    var firstByIndex = elements.findAll(function(element) {
+      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
+    }).sortBy(function(element) { return element.tabIndex }).first();
+
+    return firstByIndex ? firstByIndex : elements.find(function(element) {
+      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+    });
+  },
+
+  focusFirstElement: function(form) {
+    form = $(form);
+    form.findFirstElement().activate();
+    return form;
+  },
+
+  request: function(form, options) {
+    form = $(form), options = Object.clone(options || { });
+
+    var params = options.parameters, action = form.readAttribute('action') || '';
+    if (action.blank()) action = window.location.href;
+    options.parameters = form.serialize(true);
+
+    if (params) {
+      if (Object.isString(params)) params = params.toQueryParams();
+      Object.extend(options.parameters, params);
+    }
+
+    if (form.hasAttribute('method') && !options.method)
+      options.method = form.method;
+
+    return new Ajax.Request(action, options);
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element = {
+  focus: function(element) {
+    $(element).focus();
+    return element;
+  },
+
+  select: function(element) {
+    $(element).select();
+    return element;
+  }
+};
+
+Form.Element.Methods = {
+  serialize: function(element) {
+    element = $(element);
+    if (!element.disabled && element.name) {
+      var value = element.getValue();
+      if (value != undefined) {
+        var pair = { };
+        pair[element.name] = value;
+        return Object.toQueryString(pair);
+      }
+    }
+    return '';
+  },
+
+  getValue: function(element) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    return Form.Element.Serializers[method](element);
+  },
+
+  setValue: function(element, value) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    Form.Element.Serializers[method](element, value);
+    return element;
+  },
+
+  clear: function(element) {
+    $(element).value = '';
+    return element;
+  },
+
+  present: function(element) {
+    return $(element).value != '';
+  },
+
+  activate: function(element) {
+    element = $(element);
+    try {
+      element.focus();
+      if (element.select && (element.tagName.toLowerCase() != 'input' ||
+          !['button', 'reset', 'submit'].include(element.type)))
+        element.select();
+    } catch (e) { }
+    return element;
+  },
+
+  disable: function(element) {
+    element = $(element);
+    element.disabled = true;
+    return element;
+  },
+
+  enable: function(element) {
+    element = $(element);
+    element.disabled = false;
+    return element;
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Field = Form.Element;
+var $F = Form.Element.Methods.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = {
+  input: function(element, value) {
+    switch (element.type.toLowerCase()) {
+      case 'checkbox':
+      case 'radio':
+        return Form.Element.Serializers.inputSelector(element, value);
+      default:
+        return Form.Element.Serializers.textarea(element, value);
+    }
+  },
+
+  inputSelector: function(element, value) {
+    if (Object.isUndefined(value)) return element.checked ? element.value : null;
+    else element.checked = !!value;
+  },
+
+  textarea: function(element, value) {
+    if (Object.isUndefined(value)) return element.value;
+    else element.value = value;
+  },
+
+  select: function(element, value) {
+    if (Object.isUndefined(value))
+      return this[element.type == 'select-one' ?
+        'selectOne' : 'selectMany'](element);
+    else {
+      var opt, currentValue, single = !Object.isArray(value);
+      for (var i = 0, length = element.length; i < length; i++) {
+        opt = element.options[i];
+        currentValue = this.optionValue(opt);
+        if (single) {
+          if (currentValue == value) {
+            opt.selected = true;
+            return;
+          }
+        }
+        else opt.selected = value.include(currentValue);
+      }
+    }
+  },
+
+  selectOne: function(element) {
+    var index = element.selectedIndex;
+    return index >= 0 ? this.optionValue(element.options[index]) : null;
+  },
+
+  selectMany: function(element) {
+    var values, length = element.length;
+    if (!length) return null;
+
+    for (var i = 0, values = []; i < length; i++) {
+      var opt = element.options[i];
+      if (opt.selected) values.push(this.optionValue(opt));
+    }
+    return values;
+  },
+
+  optionValue: function(opt) {
+    // extend element because hasAttribute may not be native
+    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
+  initialize: function($super, element, frequency, callback) {
+    $super(callback, frequency);
+    this.element   = $(element);
+    this.lastValue = this.getValue();
+  },
+
+  execute: function() {
+    var value = this.getValue();
+    if (Object.isString(this.lastValue) && Object.isString(value) ?
+        this.lastValue != value : String(this.lastValue) != String(value)) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+});
+
+Form.Element.Observer = Class.create(Abstract.TimedObserver, {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create(Abstract.TimedObserver, {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = Class.create({
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+
+  registerFormCallbacks: function() {
+    Form.getElements(this.element).each(this.registerCallback, this);
+  },
+
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':
+        case 'radio':
+          Event.observe(element, 'click', this.onElementEvent.bind(this));
+          break;
+        default:
+          Event.observe(element, 'change', this.onElementEvent.bind(this));
+          break;
+      }
+    }
+  }
+});
+
+Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create(Abstract.EventObserver, {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+if (!window.Event) var Event = { };
+
+Object.extend(Event, {
+  KEY_BACKSPACE: 8,
+  KEY_TAB:       9,
+  KEY_RETURN:   13,
+  KEY_ESC:      27,
+  KEY_LEFT:     37,
+  KEY_UP:       38,
+  KEY_RIGHT:    39,
+  KEY_DOWN:     40,
+  KEY_DELETE:   46,
+  KEY_HOME:     36,
+  KEY_END:      35,
+  KEY_PAGEUP:   33,
+  KEY_PAGEDOWN: 34,
+  KEY_INSERT:   45,
+
+  cache: { },
+
+  relatedTarget: function(event) {
+    var element;
+    switch(event.type) {
+      case 'mouseover': element = event.fromElement; break;
+      case 'mouseout':  element = event.toElement;   break;
+      default: return null;
+    }
+    return Element.extend(element);
+  }
+});
+
+Event.Methods = (function() {
+  var isButton;
+
+  if (Prototype.Browser.IE) {
+    var buttonMap = { 0: 1, 1: 4, 2: 2 };
+    isButton = function(event, code) {
+      return event.button == buttonMap[code];
+    };
+
+  } else if (Prototype.Browser.WebKit) {
+    isButton = function(event, code) {
+      switch (code) {
+        case 0: return event.which == 1 && !event.metaKey;
+        case 1: return event.which == 1 && event.metaKey;
+        default: return false;
+      }
+    };
+
+  } else {
+    isButton = function(event, code) {
+      return event.which ? (event.which === code + 1) : (event.button === code);
+    };
+  }
+
+  return {
+    isLeftClick:   function(event) { return isButton(event, 0) },
+    isMiddleClick: function(event) { return isButton(event, 1) },
+    isRightClick:  function(event) { return isButton(event, 2) },
+
+    element: function(event) {
+      event = Event.extend(event);
+
+      var node          = event.target,
+          type          = event.type,
+          currentTarget = event.currentTarget;
+
+      if (currentTarget && currentTarget.tagName) {
+        // Firefox screws up the "click" event when moving between radio buttons
+        // via arrow keys. It also screws up the "load" and "error" events on images,
+        // reporting the document as the target instead of the original image.
+        if (type === 'load' || type === 'error' ||
+          (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
+            && currentTarget.type === 'radio'))
+              node = currentTarget;
+      }
+      if (node.nodeType == Node.TEXT_NODE) node = node.parentNode;
+      return Element.extend(node);
+    },
+
+    findElement: function(event, expression) {
+      var element = Event.element(event);
+      if (!expression) return element;
+      var elements = [element].concat(element.ancestors());
+      return Selector.findElement(elements, expression, 0);
+    },
+
+    pointer: function(event) {
+      var docElement = document.documentElement,
+      body = document.body || { scrollLeft: 0, scrollTop: 0 };
+      return {
+        x: event.pageX || (event.clientX +
+          (docElement.scrollLeft || body.scrollLeft) -
+          (docElement.clientLeft || 0)),
+        y: event.pageY || (event.clientY +
+          (docElement.scrollTop || body.scrollTop) -
+          (docElement.clientTop || 0))
+      };
+    },
+
+    pointerX: function(event) { return Event.pointer(event).x },
+    pointerY: function(event) { return Event.pointer(event).y },
+
+    stop: function(event) {
+      Event.extend(event);
+      event.preventDefault();
+      event.stopPropagation();
+      event.stopped = true;
+    }
+  };
+})();
+
+Event.extend = (function() {
+  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
+    m[name] = Event.Methods[name].methodize();
+    return m;
+  });
+
+  if (Prototype.Browser.IE) {
+    Object.extend(methods, {
+      stopPropagation: function() { this.cancelBubble = true },
+      preventDefault:  function() { this.returnValue = false },
+      inspect: function() { return "[object Event]" }
+    });
+
+    return function(event) {
+      if (!event) return false;
+      if (event._extendedByPrototype) return event;
+
+      event._extendedByPrototype = Prototype.emptyFunction;
+      var pointer = Event.pointer(event);
+      Object.extend(event, {
+        target: event.srcElement,
+        relatedTarget: Event.relatedTarget(event),
+        pageX:  pointer.x,
+        pageY:  pointer.y
+      });
+      return Object.extend(event, methods);
+    };
+
+  } else {
+    Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
+    Object.extend(Event.prototype, methods);
+    return Prototype.K;
+  }
+})();
+
+Object.extend(Event, (function() {
+  var cache = Event.cache;
+
+  function getEventID(element) {
+    if (element._prototypeEventID) return element._prototypeEventID[0];
+    arguments.callee.id = arguments.callee.id || 1;
+    return element._prototypeEventID = [++arguments.callee.id];
+  }
+
+  function getDOMEventName(eventName) {
+    if (eventName && eventName.include(':')) return "dataavailable";
+    return eventName;
+  }
+
+  function getCacheForID(id) {
+    return cache[id] = cache[id] || { };
+  }
+
+  function getWrappersForEventName(id, eventName) {
+    var c = getCacheForID(id);
+    return c[eventName] = c[eventName] || [];
+  }
+
+  function createWrapper(element, eventName, handler) {
+    var id = getEventID(element);
+    var c = getWrappersForEventName(id, eventName);
+    if (c.pluck("handler").include(handler)) return false;
+
+    var wrapper = function(event) {
+      if (!Event || !Event.extend ||
+        (event.eventName && event.eventName != eventName))
+          return false;
+
+      Event.extend(event);
+      handler.call(element, event);
+    };
+
+    wrapper.handler = handler;
+    c.push(wrapper);
+    return wrapper;
+  }
+
+  function findWrapper(id, eventName, handler) {
+    var c = getWrappersForEventName(id, eventName);
+    return c.find(function(wrapper) { return wrapper.handler == handler });
+  }
+
+  function destroyWrapper(id, eventName, handler) {
+    var c = getCacheForID(id);
+    if (!c[eventName]) return false;
+    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
+  }
+
+  function destroyCache() {
+    for (var id in cache)
+      for (var eventName in cache[id])
+        cache[id][eventName] = null;
+  }
+
+
+  // Internet Explorer needs to remove event handlers on page unload
+  // in order to avoid memory leaks.
+  if (window.attachEvent) {
+    window.attachEvent("onunload", destroyCache);
+  }
+
+  // Safari has a dummy event handler on page unload so that it won't
+  // use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
+  // object when page is returned to via the back button using its bfcache.
+  if (Prototype.Browser.WebKit) {
+    window.addEventListener('unload', Prototype.emptyFunction, false);
+  }
+
+  return {
+    observe: function(element, eventName, handler) {
+      element = $(element);
+      var name = getDOMEventName(eventName);
+
+      var wrapper = createWrapper(element, eventName, handler);
+      if (!wrapper) return element;
+
+      if (element.addEventListener) {
+        element.addEventListener(name, wrapper, false);
+      } else {
+        element.attachEvent("on" + name, wrapper);
+      }
+
+      return element;
+    },
+
+    stopObserving: function(element, eventName, handler) {
+      element = $(element);
+      var id = getEventID(element), name = getDOMEventName(eventName);
+
+      if (!handler && eventName) {
+        getWrappersForEventName(id, eventName).each(function(wrapper) {
+          element.stopObserving(eventName, wrapper.handler);
+        });
+        return element;
+
+      } else if (!eventName) {
+        Object.keys(getCacheForID(id)).each(function(eventName) {
+          element.stopObserving(eventName);
+        });
+        return element;
+      }
+
+      var wrapper = findWrapper(id, eventName, handler);
+      if (!wrapper) return element;
+
+      if (element.removeEventListener) {
+        element.removeEventListener(name, wrapper, false);
+      } else {
+        element.detachEvent("on" + name, wrapper);
+      }
+
+      destroyWrapper(id, eventName, handler);
+
+      return element;
+    },
+
+    fire: function(element, eventName, memo) {
+      element = $(element);
+      if (element == document && document.createEvent && !element.dispatchEvent)
+        element = document.documentElement;
+
+      var event;
+      if (document.createEvent) {
+        event = document.createEvent("HTMLEvents");
+        event.initEvent("dataavailable", true, true);
+      } else {
+        event = document.createEventObject();
+        event.eventType = "ondataavailable";
+      }
+
+      event.eventName = eventName;
+      event.memo = memo || { };
+
+      if (document.createEvent) {
+        element.dispatchEvent(event);
+      } else {
+        element.fireEvent(event.eventType, event);
+      }
+
+      return Event.extend(event);
+    }
+  };
+})());
+
+Object.extend(Event, Event.Methods);
+
+Element.addMethods({
+  fire:          Event.fire,
+  observe:       Event.observe,
+  stopObserving: Event.stopObserving
+});
+
+Object.extend(document, {
+  fire:          Element.Methods.fire.methodize(),
+  observe:       Element.Methods.observe.methodize(),
+  stopObserving: Element.Methods.stopObserving.methodize(),
+  loaded:        false
+});
+
+(function() {
+  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
+     Matthias Miller, Dean Edwards and John Resig. */
+
+  var timer;
+
+  function fireContentLoadedEvent() {
+    if (document.loaded) return;
+    if (timer) window.clearInterval(timer);
+    document.fire("dom:loaded");
+    document.loaded = true;
+  }
+
+  if (document.addEventListener) {
+    if (Prototype.Browser.WebKit) {
+      timer = window.setInterval(function() {
+        if (/loaded|complete/.test(document.readyState))
+          fireContentLoadedEvent();
+      }, 0);
+
+      Event.observe(window, "load", fireContentLoadedEvent);
+
+    } else {
+      document.addEventListener("DOMContentLoaded",
+        fireContentLoadedEvent, false);
+    }
+
+  } else {
+    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
+    $("__onDOMContentLoaded").onreadystatechange = function() {
+      if (this.readyState == "complete") {
+        this.onreadystatechange = null;
+        fireContentLoadedEvent();
+      }
+    };
+  }
+})();
+/*------------------------------- DEPRECATED -------------------------------*/
+
+Hash.toQueryString = Object.toQueryString;
+
+var Toggle = { display: Element.toggle };
+
+Element.Methods.childOf = Element.Methods.descendantOf;
+
+var Insertion = {
+  Before: function(element, content) {
+    return Element.insert(element, {before:content});
+  },
+
+  Top: function(element, content) {
+    return Element.insert(element, {top:content});
+  },
+
+  Bottom: function(element, content) {
+    return Element.insert(element, {bottom:content});
+  },
+
+  After: function(element, content) {
+    return Element.insert(element, {after:content});
+  }
+};
+
+var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+
+// This should be moved to script.aculo.us; notice the deprecated methods
+// further below, that map to the newer Element methods.
+var Position = {
+  // set to true if needed, warning: firefox performance problems
+  // NOT neeeded for page scrolling, only if draggable contained in
+  // scrollable elements
+  includeScrollOffsets: false,
+
+  // must be called before calling withinIncludingScrolloffset, every time the
+  // page is scrolled
+  prepare: function() {
+    this.deltaX =  window.pageXOffset
+                || document.documentElement.scrollLeft
+                || document.body.scrollLeft
+                || 0;
+    this.deltaY =  window.pageYOffset
+                || document.documentElement.scrollTop
+                || document.body.scrollTop
+                || 0;
+  },
+
+  // caches x/y coordinate pair to use with overlap
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = Element.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] &&
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = Element.cumulativeScrollOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = Element.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] &&
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  // within must be called directly before
+  overlap: function(mode, element) {
+    if (!mode) return 0;
+    if (mode == 'vertical')
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+        element.offsetWidth;
+  },
+
+  // Deprecation layer -- use newer Element methods now (1.5.2).
+
+  cumulativeOffset: Element.Methods.cumulativeOffset,
+
+  positionedOffset: Element.Methods.positionedOffset,
+
+  absolutize: function(element) {
+    Position.prepare();
+    return Element.absolutize(element);
+  },
+
+  relativize: function(element) {
+    Position.prepare();
+    return Element.relativize(element);
+  },
+
+  realOffset: Element.Methods.cumulativeScrollOffset,
+
+  offsetParent: Element.Methods.getOffsetParent,
+
+  page: Element.Methods.viewportOffset,
+
+  clone: function(source, target, options) {
+    options = options || { };
+    return Element.clonePosition(target, source, options);
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
+  function iter(name) {
+    return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
+  }
+
+  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
+  function(element, className) {
+    className = className.toString().strip();
+    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
+    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
+  } : function(element, className) {
+    className = className.toString().strip();
+    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
+    if (!classNames && !className) return elements;
+
+    var nodes = $(element).getElementsByTagName('*');
+    className = ' ' + className + ' ';
+
+    for (var i = 0, child, cn; child = nodes[i]; i++) {
+      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
+          (classNames && classNames.all(function(name) {
+            return !name.toString().blank() && cn.include(' ' + name + ' ');
+          }))))
+        elements.push(Element.extend(child));
+    }
+    return elements;
+  };
+
+  return function(className, parentElement) {
+    return $(parentElement || document.body).getElementsByClassName(className);
+  };
+}(Element.Methods);
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+  initialize: function(element) {
+    this.element = $(element);
+  },
+
+  _each: function(iterator) {
+    this.element.className.split(/\s+/).select(function(name) {
+      return name.length > 0;
+    })._each(iterator);
+  },
+
+  set: function(className) {
+    this.element.className = className;
+  },
+
+  add: function(classNameToAdd) {
+    if (this.include(classNameToAdd)) return;
+    this.set($A(this).concat(classNameToAdd).join(' '));
+  },
+
+  remove: function(classNameToRemove) {
+    if (!this.include(classNameToRemove)) return;
+    this.set($A(this).without(classNameToRemove).join(' '));
+  },
+
+  toString: function() {
+    return $A(this).join(' ');
+  }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+
+/*--------------------------------------------------------------------------*/
+
+Element.addMethods();
\ No newline at end of file
diff --git a/lib/yahoo.js b/lib/yahoo.js
new file mode 100644
index 0000000..92ba865
--- /dev/null
+++ b/lib/yahoo.js
@@ -0,0 +1,986 @@
+/*
+Copyright (c) 2008, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.6.0
+*/
+/**
+ * The YAHOO object is the single global object used by YUI Library.  It
+ * contains utility function for setting up namespaces, inheritance, and
+ * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
+ * created automatically for and used by the library.
+ * @module yahoo
+ * @title  YAHOO Global
+ */
+
+/**
+ * YAHOO_config is not included as part of the library.  Instead it is an 
+ * object that can be defined by the implementer immediately before 
+ * including the YUI library.  The properties included in this object
+ * will be used to configure global properties needed as soon as the 
+ * library begins to load.
+ * @class YAHOO_config
+ * @static
+ */
+
+/**
+ * A reference to a function that will be executed every time a YAHOO module
+ * is loaded.  As parameter, this function will receive the version
+ * information for the module. See <a href="YAHOO.env.html#getVersion">
+ * YAHOO.env.getVersion</a> for the description of the version data structure.
+ * @property listener
+ * @type Function
+ * @static
+ * @default undefined
+ */
+
+/**
+ * Set to true if the library will be dynamically loaded after window.onload.
+ * Defaults to false 
+ * @property injecting
+ * @type boolean
+ * @static
+ * @default undefined
+ */
+
+/**
+ * Instructs the yuiloader component to dynamically load yui components and
+ * their dependencies.  See the yuiloader documentation for more information
+ * about dynamic loading
+ * @property load
+ * @static
+ * @default undefined
+ * @see yuiloader
+ */
+
+/**
+ * Forces the use of the supplied locale where applicable in the library
+ * @property locale
+ * @type string
+ * @static
+ * @default undefined
+ */
+
+if (typeof YAHOO == "undefined" || !YAHOO) {
+    /**
+     * The YAHOO global namespace object.  If YAHOO is already defined, the
+     * existing YAHOO object will not be overwritten so that defined
+     * namespaces are preserved.
+     * @class YAHOO
+     * @static
+     */
+    var YAHOO = {};
+}
+
+/**
+ * Returns the namespace specified and creates it if it doesn't exist
+ * <pre>
+ * YAHOO.namespace("property.package");
+ * YAHOO.namespace("YAHOO.property.package");
+ * </pre>
+ * Either of the above would create YAHOO.property, then
+ * YAHOO.property.package
+ *
+ * Be careful when naming packages. Reserved words may work in some browsers
+ * and not others. For instance, the following will fail in Safari:
+ * <pre>
+ * YAHOO.namespace("really.long.nested.namespace");
+ * </pre>
+ * This fails because "long" is a future reserved word in ECMAScript
+ *
+ * @method namespace
+ * @static
+ * @param  {String*} arguments 1-n namespaces to create 
+ * @return {Object}  A reference to the last namespace object created
+ */
+YAHOO.namespace = function() {
+    var a=arguments, o=null, i, j, d;
+    for (i=0; i<a.length; i=i+1) {
+        d=a[i].split(".");
+        o=YAHOO;
+
+        // YAHOO is implied, so it is ignored if it is included
+        for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
+            o[d[j]]=o[d[j]] || {};
+            o=o[d[j]];
+        }
+    }
+
+    return o;
+};
+
+/**
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is
+ * available.
+ *
+ * @method log
+ * @static
+ * @param  {String}  msg  The message to log.
+ * @param  {String}  cat  The log category for the message.  Default
+ *                        categories are "info", "warn", "error", time".
+ *                        Custom categories can be used as well. (opt)
+ * @param  {String}  src  The source of the the message (opt)
+ * @return {Boolean}      True if the log operation was successful.
+ */
+YAHOO.log = function(msg, cat, src) {
+    var l=YAHOO.widget.Logger;
+    if(l && l.log) {
+        return l.log(msg, cat, src);
+    } else {
+        return false;
+    }
+};
+
+/**
+ * Registers a module with the YAHOO object
+ * @method register
+ * @static
+ * @param {String}   name    the name of the module (event, slider, etc)
+ * @param {Function} mainClass a reference to class in the module.  This
+ *                             class will be tagged with the version info
+ *                             so that it will be possible to identify the
+ *                             version that is in use when multiple versions
+ *                             have loaded
+ * @param {Object}   data      metadata object for the module.  Currently it
+ *                             is expected to contain a "version" property
+ *                             and a "build" property at minimum.
+ */
+YAHOO.register = function(name, mainClass, data) {
+    var mods = YAHOO.env.modules;
+    if (!mods[name]) {
+        mods[name] = { versions:[], builds:[] };
+    }
+    var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;
+    m.name = name;
+    m.version = v;
+    m.build = b;
+    m.versions.push(v);
+    m.builds.push(b);
+    m.mainClass = mainClass;
+    // fire the module load listeners
+    for (var i=0;i<ls.length;i=i+1) {
+        ls[i](m);
+    }
+    // label the main class
+    if (mainClass) {
+        mainClass.VERSION = v;
+        mainClass.BUILD = b;
+    } else {
+        YAHOO.log("mainClass is undefined for module " + name, "warn");
+    }
+};
+
+/**
+ * YAHOO.env is used to keep track of what is known about the YUI library and
+ * the browsing environment
+ * @class YAHOO.env
+ * @static
+ */
+YAHOO.env = YAHOO.env || {
+
+    /**
+     * Keeps the version info for all YUI modules that have reported themselves
+     * @property modules
+     * @type Object[]
+     */
+    modules: [],
+    
+    /**
+     * List of functions that should be executed every time a YUI module
+     * reports itself.
+     * @property listeners
+     * @type Function[]
+     */
+    listeners: []
+};
+
+/**
+ * Returns the version data for the specified module:
+ *      <dl>
+ *      <dt>name:</dt>      <dd>The name of the module</dd>
+ *      <dt>version:</dt>   <dd>The version in use</dd>
+ *      <dt>build:</dt>     <dd>The build number in use</dd>
+ *      <dt>versions:</dt>  <dd>All versions that were registered</dd>
+ *      <dt>builds:</dt>    <dd>All builds that were registered.</dd>
+ *      <dt>mainClass:</dt> <dd>An object that was was stamped with the
+ *                 current version and build. If 
+ *                 mainClass.VERSION != version or mainClass.BUILD != build,
+ *                 multiple versions of pieces of the library have been
+ *                 loaded, potentially causing issues.</dd>
+ *       </dl>
+ *
+ * @method getVersion
+ * @static
+ * @param {String}  name the name of the module (event, slider, etc)
+ * @return {Object} The version info
+ */
+YAHOO.env.getVersion = function(name) {
+    return YAHOO.env.modules[name] || null;
+};
+
+/**
+ * Do not fork for a browser if it can be avoided.  Use feature detection when
+ * you can.  Use the user agent as a last resort.  YAHOO.env.ua stores a version
+ * number for the browser engine, 0 otherwise.  This value may or may not map
+ * to the version number of the browser using the engine.  The value is 
+ * presented as a float so that it can easily be used for boolean evaluation 
+ * as well as for looking for a particular range of versions.  Because of this, 
+ * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9 
+ * reports 1.8).
+ * @class YAHOO.env.ua
+ * @static
+ */
+YAHOO.env.ua = function() {
+    var o={
+
+        /**
+         * Internet Explorer version number or 0.  Example: 6
+         * @property ie
+         * @type float
+         */
+        ie:0,
+
+        /**
+         * Opera version number or 0.  Example: 9.2
+         * @property opera
+         * @type float
+         */
+        opera:0,
+
+        /**
+         * Gecko engine revision number.  Will evaluate to 1 if Gecko 
+         * is detected but the revision could not be found. Other browsers
+         * will be 0.  Example: 1.8
+         * <pre>
+         * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
+         * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
+         * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
+         * Firefox 3 alpha: 1.9a4   <-- Reports 1.9
+         * </pre>
+         * @property gecko
+         * @type float
+         */
+        gecko:0,
+
+        /**
+         * AppleWebKit version.  KHTML browsers that are not WebKit browsers 
+         * will evaluate to 1, other browsers 0.  Example: 418.9.1
+         * <pre>
+         * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 
+         *                                   latest available for Mac OSX 10.3.
+         * Safari 2.0.2:         416     <-- hasOwnProperty introduced
+         * Safari 2.0.4:         418     <-- preventDefault fixed
+         * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
+         *                                   different versions of webkit
+         * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
+         *                                   updated, but not updated
+         *                                   to the latest patch.
+         * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native SVG
+         *                                   and many major issues fixed).  
+         * 3.x yahoo.com, flickr:422     <-- Safari 3.x hacks the user agent
+         *                                   string when hitting yahoo.com and 
+         *                                   flickr.com.
+         * Safari 3.0.4 (523.12):523.12  <-- First Tiger release - automatic update
+         *                                   from 2.x via the 10.4.11 OS patch
+         * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
+         *                                   yahoo.com user agent hack removed.
+         *                                   
+         * </pre>
+         * http://developer.apple.com/internet/safari/uamatrix.html
+         * @property webkit
+         * @type float
+         */
+        webkit: 0,
+
+        /**
+         * The mobile property will be set to a string containing any relevant
+         * user agent information when a modern mobile browser is detected.
+         * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
+         * devices with the WebKit-based browser, and Opera Mini.  
+         * @property mobile 
+         * @type string
+         */
+        mobile: null,
+
+        /**
+         * Adobe AIR version number or 0.  Only populated if webkit is detected.
+         * Example: 1.0
+         * @property air
+         * @type float
+         */
+        air: 0
+
+    };
+
+    var ua=navigator.userAgent, m;
+
+    // Modern KHTML browsers should qualify as Safari X-Grade
+    if ((/KHTML/).test(ua)) {
+        o.webkit=1;
+    }
+    // Modern WebKit browsers are at least X-Grade
+    m=ua.match(/AppleWebKit\/([^\s]*)/);
+    if (m&&m[1]) {
+        o.webkit=parseFloat(m[1]);
+
+        // Mobile browser check
+        if (/ Mobile\//.test(ua)) {
+            o.mobile = "Apple"; // iPhone or iPod Touch
+        } else {
+            m=ua.match(/NokiaN[^\/]*/);
+            if (m) {
+                o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
+            }
+        }
+
+        m=ua.match(/AdobeAIR\/([^\s]*)/);
+        if (m) {
+            o.air = m[0]; // Adobe AIR 1.0 or better
+        }
+
+    }
+
+    if (!o.webkit) { // not webkit
+        // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
+        m=ua.match(/Opera[\s\/]([^\s]*)/);
+        if (m&&m[1]) {
+            o.opera=parseFloat(m[1]);
+            m=ua.match(/Opera Mini[^;]*/);
+            if (m) {
+                o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
+            }
+        } else { // not opera or webkit
+            m=ua.match(/MSIE\s([^;]*)/);
+            if (m&&m[1]) {
+                o.ie=parseFloat(m[1]);
+            } else { // not opera, webkit, or ie
+                m=ua.match(/Gecko\/([^\s]*)/);
+                if (m) {
+                    o.gecko=1; // Gecko detected, look for revision
+                    m=ua.match(/rv:([^\s\)]*)/);
+                    if (m&&m[1]) {
+                        o.gecko=parseFloat(m[1]);
+                    }
+                }
+            }
+        }
+    }
+    
+    return o;
+}();
+
+/*
+ * Initializes the global by creating the default namespaces and applying
+ * any new configuration information that is detected.  This is the setup
+ * for env.
+ * @method init
+ * @static
+ * @private
+ */
+(function() {
+    YAHOO.namespace("util", "widget", "example");
+    if ("undefined" !== typeof YAHOO_config) {
+        var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;
+        if (l) {
+            // if YAHOO is loaded multiple times we need to check to see if
+            // this is a new config object.  If it is, add the new component
+            // load listener to the stack
+            for (i=0;i<ls.length;i=i+1) {
+                if (ls[i]==l) {
+                    unique=false;
+                    break;
+                }
+            }
+            if (unique) {
+                ls.push(l);
+            }
+        }
+    }
+})();
+/**
+ * Provides the language utilites and extensions used by the library
+ * @class YAHOO.lang
+ */
+YAHOO.lang = YAHOO.lang || {};
+
+(function() {
+
+var L = YAHOO.lang,
+
+    // ADD = ["toString", "valueOf", "hasOwnProperty"],
+    ADD = ["toString", "valueOf"],
+
+    OB = {
+
+    /**
+     * Determines whether or not the provided object is an array.
+     * Testing typeof/instanceof/constructor of arrays across frame 
+     * boundaries isn't possible in Safari unless you have a reference
+     * to the other frame to test against its Array prototype.  To
+     * handle this case, we test well-known array properties instead.
+     * properties.
+     * @method isArray
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isArray: function(o) { 
+        if (o) {
+           return L.isNumber(o.length) && L.isFunction(o.splice);
+        }
+        return false;
+    },
+
+    /**
+     * Determines whether or not the provided object is a boolean
+     * @method isBoolean
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isBoolean: function(o) {
+        return typeof o === 'boolean';
+    },
+    
+    /**
+     * Determines whether or not the provided object is a function
+     * @method isFunction
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isFunction: function(o) {
+        return typeof o === 'function';
+    },
+        
+    /**
+     * Determines whether or not the provided object is null
+     * @method isNull
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isNull: function(o) {
+        return o === null;
+    },
+        
+    /**
+     * Determines whether or not the provided object is a legal number
+     * @method isNumber
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isNumber: function(o) {
+        return typeof o === 'number' && isFinite(o);
+    },
+      
+    /**
+     * Determines whether or not the provided object is of type object
+     * or function
+     * @method isObject
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */  
+    isObject: function(o) {
+return (o && (typeof o === 'object' || L.isFunction(o))) || false;
+    },
+        
+    /**
+     * Determines whether or not the provided object is a string
+     * @method isString
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isString: function(o) {
+        return typeof o === 'string';
+    },
+        
+    /**
+     * Determines whether or not the provided object is undefined
+     * @method isUndefined
+     * @param {any} o The object being testing
+     * @return {boolean} the result
+     */
+    isUndefined: function(o) {
+        return typeof o === 'undefined';
+    },
+    
+ 
+    /**
+     * IE will not enumerate native functions in a derived object even if the
+     * function was overridden.  This is a workaround for specific functions 
+     * we care about on the Object prototype. 
+     * @property _IEEnumFix
+     * @param {Function} r  the object to receive the augmentation
+     * @param {Function} s  the object that supplies the properties to augment
+     * @static
+     * @private
+     */
+    _IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
+            for (var i=0;i<ADD.length;i=i+1) {
+                var fname=ADD[i],f=s[fname];
+                if (L.isFunction(f) && f!=Object.prototype[fname]) {
+                    r[fname]=f;
+                }
+            }
+    } : function(){},
+       
+    /**
+     * Utility to set up the prototype, constructor and superclass properties to
+     * support an inheritance strategy that can chain constructors and methods.
+     * Static members will not be inherited.
+     *
+     * @method extend
+     * @static
+     * @param {Function} subc   the object to modify
+     * @param {Function} superc the object to inherit
+     * @param {Object} overrides  additional properties/methods to add to the
+     *                              subclass prototype.  These will override the
+     *                              matching items obtained from the superclass 
+     *                              if present.
+     */
+    extend: function(subc, superc, overrides) {
+        if (!superc||!subc) {
+            throw new Error("extend failed, please check that " +
+                            "all dependencies are included.");
+        }
+        var F = function() {};
+        F.prototype=superc.prototype;
+        subc.prototype=new F();
+        subc.prototype.constructor=subc;
+        subc.superclass=superc.prototype;
+        if (superc.prototype.constructor == Object.prototype.constructor) {
+            superc.prototype.constructor=superc;
+        }
+    
+        if (overrides) {
+            for (var i in overrides) {
+                if (L.hasOwnProperty(overrides, i)) {
+                    subc.prototype[i]=overrides[i];
+                }
+            }
+
+            L._IEEnumFix(subc.prototype, overrides);
+        }
+    },
+   
+    /**
+     * Applies all properties in the supplier to the receiver if the
+     * receiver does not have these properties yet.  Optionally, one or 
+     * more methods/properties can be specified (as additional 
+     * parameters).  This option will overwrite the property if receiver 
+     * has it already.  If true is passed as the third parameter, all 
+     * properties will be applied and _will_ overwrite properties in 
+     * the receiver.
+     *
+     * @method augmentObject
+     * @static
+     * @since 2.3.0
+     * @param {Function} r  the object to receive the augmentation
+     * @param {Function} s  the object that supplies the properties to augment
+     * @param {String*|boolean}  arguments zero or more properties methods 
+     *        to augment the receiver with.  If none specified, everything
+     *        in the supplier will be used unless it would
+     *        overwrite an existing property in the receiver. If true
+     *        is specified as the third parameter, all properties will
+     *        be applied and will overwrite an existing property in
+     *        the receiver
+     */
+    augmentObject: function(r, s) {
+        if (!s||!r) {
+            throw new Error("Absorb failed, verify dependencies.");
+        }
+        var a=arguments, i, p, override=a[2];
+        if (override && override!==true) { // only absorb the specified properties
+            for (i=2; i<a.length; i=i+1) {
+                r[a[i]] = s[a[i]];
+            }
+        } else { // take everything, overwriting only if the third parameter is true
+            for (p in s) { 
+                if (override || !(p in r)) {
+                    r[p] = s[p];
+                }
+            }
+            
+            L._IEEnumFix(r, s);
+        }
+    },
+ 
+    /**
+     * Same as YAHOO.lang.augmentObject, except it only applies prototype properties
+     * @see YAHOO.lang.augmentObject
+     * @method augmentProto
+     * @static
+     * @param {Function} r  the object to receive the augmentation
+     * @param {Function} s  the object that supplies the properties to augment
+     * @param {String*|boolean}  arguments zero or more properties methods 
+     *        to augment the receiver with.  If none specified, everything 
+     *        in the supplier will be used unless it would overwrite an existing 
+     *        property in the receiver.  if true is specified as the third 
+     *        parameter, all properties will be applied and will overwrite an 
+     *        existing property in the receiver
+     */
+    augmentProto: function(r, s) {
+        if (!s||!r) {
+            throw new Error("Augment failed, verify dependencies.");
+        }
+        //var a=[].concat(arguments);
+        var a=[r.prototype,s.prototype];
+        for (var i=2;i<arguments.length;i=i+1) {
+            a.push(arguments[i]);
+        }
+        L.augmentObject.apply(this, a);
+    },
+
+      
+    /**
+     * Returns a simple string representation of the object or array.
+     * Other types of objects will be returned unprocessed.  Arrays
+     * are expected to be indexed.  Use object notation for
+     * associative arrays.
+     * @method dump
+     * @since 2.3.0
+     * @param o {Object} The object to dump
+     * @param d {int} How deep to recurse child objects, default 3
+     * @return {String} the dump result
+     */
+    dump: function(o, d) {
+        var i,len,s=[],OBJ="{...}",FUN="f(){...}",
+            COMMA=', ', ARROW=' => ';
+
+        // Cast non-objects to string
+        // Skip dates because the std toString is what we want
+        // Skip HTMLElement-like objects because trying to dump 
+        // an element will cause an unhandled exception in FF 2.x
+        if (!L.isObject(o)) {
+            return o + "";
+        } else if (o instanceof Date || ("nodeType" in o && "tagName" in o)) {
+            return o;
+        } else if  (L.isFunction(o)) {
+            return FUN;
+        }
+
+        // dig into child objects the depth specifed. Default 3
+        d = (L.isNumber(d)) ? d : 3;
+
+        // arrays [1, 2, 3]
+        if (L.isArray(o)) {
+            s.push("[");
+            for (i=0,len=o.length;i<len;i=i+1) {
+                if (L.isObject(o[i])) {
+                    s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
+                } else {
+                    s.push(o[i]);
+                }
+                s.push(COMMA);
+            }
+            if (s.length > 1) {
+                s.pop();
+            }
+            s.push("]");
+        // objects {k1 => v1, k2 => v2}
+        } else {
+            s.push("{");
+            for (i in o) {
+                if (L.hasOwnProperty(o, i)) {
+                    s.push(i + ARROW);
+                    if (L.isObject(o[i])) {
+                        s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
+                    } else {
+                        s.push(o[i]);
+                    }
+                    s.push(COMMA);
+                }
+            }
+            if (s.length > 1) {
+                s.pop();
+            }
+            s.push("}");
+        }
+
+        return s.join("");
+    },
+
+    /**
+     * Does variable substitution on a string. It scans through the string 
+     * looking for expressions enclosed in { } braces. If an expression 
+     * is found, it is used a key on the object.  If there is a space in
+     * the key, the first word is used for the key and the rest is provided
+     * to an optional function to be used to programatically determine the
+     * value (the extra information might be used for this decision). If 
+     * the value for the key in the object, or what is returned from the
+     * function has a string value, number value, or object value, it is 
+     * substituted for the bracket expression and it repeats.  If this
+     * value is an object, it uses the Object's toString() if this has
+     * been overridden, otherwise it does a shallow dump of the key/value
+     * pairs.
+     * @method substitute
+     * @since 2.3.0
+     * @param s {String} The string that will be modified.
+     * @param o {Object} An object containing the replacement values
+     * @param f {Function} An optional function that can be used to
+     *                     process each match.  It receives the key,
+     *                     value, and any extra metadata included with
+     *                     the key inside of the braces.
+     * @return {String} the substituted string
+     */
+    substitute: function (s, o, f) {
+        var i, j, k, key, v, meta, saved=[], token, 
+            DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}';
+
+
+        for (;;) {
+            i = s.lastIndexOf(LBRACE);
+            if (i < 0) {
+                break;
+            }
+            j = s.indexOf(RBRACE, i);
+            if (i + 1 >= j) {
+                break;
+            }
+
+            //Extract key and meta info 
+            token = s.substring(i + 1, j);
+            key = token;
+            meta = null;
+            k = key.indexOf(SPACE);
+            if (k > -1) {
+                meta = key.substring(k + 1);
+                key = key.substring(0, k);
+            }
+
+            // lookup the value
+            v = o[key];
+
+            // if a substitution function was provided, execute it
+            if (f) {
+                v = f(key, v, meta);
+            }
+
+            if (L.isObject(v)) {
+                if (L.isArray(v)) {
+                    v = L.dump(v, parseInt(meta, 10));
+                } else {
+                    meta = meta || "";
+
+                    // look for the keyword 'dump', if found force obj dump
+                    var dump = meta.indexOf(DUMP);
+                    if (dump > -1) {
+                        meta = meta.substring(4);
+                    }
+
+                    // use the toString if it is not the Object toString 
+                    // and the 'dump' meta info was not found
+                    if (v.toString===Object.prototype.toString||dump>-1) {
+                        v = L.dump(v, parseInt(meta, 10));
+                    } else {
+                        v = v.toString();
+                    }
+                }
+            } else if (!L.isString(v) && !L.isNumber(v)) {
+                // This {block} has no replace string. Save it for later.
+                v = "~-" + saved.length + "-~";
+                saved[saved.length] = token;
+
+                // break;
+            }
+
+            s = s.substring(0, i) + v + s.substring(j + 1);
+
+
+        }
+
+        // restore saved {block}s
+        for (i=saved.length-1; i>=0; i=i-1) {
+            s = s.replace(new RegExp("~-" + i + "-~"), "{"  + saved[i] + "}", "g");
+        }
+
+        return s;
+    },
+
+
+    /**
+     * Returns a string without any leading or trailing whitespace.  If 
+     * the input is not a string, the input will be returned untouched.
+     * @method trim
+     * @since 2.3.0
+     * @param s {string} the string to trim
+     * @return {string} the trimmed string
+     */
+    trim: function(s){
+        try {
+            return s.replace(/^\s+|\s+$/g, "");
+        } catch(e) {
+            return s;
+        }
+    },
+
+    /**
+     * Returns a new object containing all of the properties of
+     * all the supplied objects.  The properties from later objects
+     * will overwrite those in earlier objects.
+     * @method merge
+     * @since 2.3.0
+     * @param arguments {Object*} the objects to merge
+     * @return the new merged object
+     */
+    merge: function() {
+        var o={}, a=arguments;
+        for (var i=0, l=a.length; i<l; i=i+1) {
+            L.augmentObject(o, a[i], true);
+        }
+        return o;
+    },
+
+    /**
+     * Executes the supplied function in the context of the supplied 
+     * object 'when' milliseconds later.  Executes the function a 
+     * single time unless periodic is set to true.
+     * @method later
+     * @since 2.4.0
+     * @param when {int} the number of milliseconds to wait until the fn 
+     * is executed
+     * @param o the context object
+     * @param fn {Function|String} the function to execute or the name of 
+     * the method in the 'o' object to execute
+     * @param data [Array] data that is provided to the function.  This accepts
+     * either a single item or an array.  If an array is provided, the
+     * function is executed with one parameter for each array item.  If
+     * you need to pass a single array parameter, it needs to be wrapped in
+     * an array [myarray]
+     * @param periodic {boolean} if true, executes continuously at supplied 
+     * interval until canceled
+     * @return a timer object. Call the cancel() method on this object to 
+     * stop the timer.
+     */
+    later: function(when, o, fn, data, periodic) {
+        when = when || 0; 
+        o = o || {};
+        var m=fn, d=data, f, r;
+
+        if (L.isString(fn)) {
+            m = o[fn];
+        }
+
+        if (!m) {
+            throw new TypeError("method undefined");
+        }
+
+        if (!L.isArray(d)) {
+            d = [data];
+        }
+
+        f = function() {
+            m.apply(o, d);
+        };
+
+        r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
+
+        return {
+            interval: periodic,
+            cancel: function() {
+                if (this.interval) {
+                    clearInterval(r);
+                } else {
+                    clearTimeout(r);
+                }
+            }
+        };
+    },
+    
+    /**
+     * A convenience method for detecting a legitimate non-null value.
+     * Returns false for null/undefined/NaN, true for other values, 
+     * including 0/false/''
+     * @method isValue
+     * @since 2.3.0
+     * @param o {any} the item to test
+     * @return {boolean} true if it is not null/undefined/NaN || false
+     */
+    isValue: function(o) {
+        // return (o || o === false || o === 0 || o === ''); // Infinity fails
+return (L.isObject(o) || L.isString(o) || L.isNumber(o) || L.isBoolean(o));
+    }
+
+};
+
+/**
+ * Determines whether or not the property was added
+ * to the object instance.  Returns false if the property is not present
+ * in the object, or was inherited from the prototype.
+ * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
+ * There is a discrepancy between YAHOO.lang.hasOwnProperty and
+ * Object.prototype.hasOwnProperty when the property is a primitive added to
+ * both the instance AND prototype with the same value:
+ * <pre>
+ * var A = function() {};
+ * A.prototype.foo = 'foo';
+ * var a = new A();
+ * a.foo = 'foo';
+ * alert(a.hasOwnProperty('foo')); // true
+ * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
+ * </pre>
+ * @method hasOwnProperty
+ * @param {any} o The object being testing
+ * @param prop {string} the name of the property to test
+ * @return {boolean} the result
+ */
+L.hasOwnProperty = (Object.prototype.hasOwnProperty) ?
+    function(o, prop) {
+        return o && o.hasOwnProperty(prop);
+    } : function(o, prop) {
+        return !L.isUndefined(o[prop]) && 
+                o.constructor.prototype[prop] !== o[prop];
+    };
+
+// new lang wins
+OB.augmentObject(L, OB, true);
+
+/*
+ * An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
+ * @class YAHOO.util.Lang
+ */
+YAHOO.util.Lang = L;
+ 
+/**
+ * Same as YAHOO.lang.augmentObject, except it only applies prototype 
+ * properties.  This is an alias for augmentProto.
+ * @see YAHOO.lang.augmentObject
+ * @method augment
+ * @static
+ * @param {Function} r  the object to receive the augmentation
+ * @param {Function} s  the object that supplies the properties to augment
+ * @param {String*|boolean}  arguments zero or more properties methods to 
+ *        augment the receiver with.  If none specified, everything
+ *        in the supplier will be used unless it would
+ *        overwrite an existing property in the receiver.  if true
+ *        is specified as the third parameter, all properties will
+ *        be applied and will overwrite an existing property in
+ *        the receiver
+ */
+L.augment = L.augmentProto;
+
+/**
+ * An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
+ * @for YAHOO
+ * @method augment
+ * @static
+ * @param {Function} r  the object to receive the augmentation
+ * @param {Function} s  the object that supplies the properties to augment
+ * @param {String*}  arguments zero or more properties methods to 
+ *        augment the receiver with.  If none specified, everything
+ *        in the supplier will be used unless it would
+ *        overwrite an existing property in the receiver
+ */
+YAHOO.augment = L.augmentProto;
+       
+/**
+ * An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
+ * @method extend
+ * @static
+ * @param {Function} subc   the object to modify
+ * @param {Function} superc the object to inherit
+ * @param {Object} overrides  additional properties/methods to add to the
+ *        subclass prototype.  These will override the
+ *        matching items obtained from the superclass if present.
+ */
+YAHOO.extend = L.extend;
+
+})();
+YAHOO.register("yahoo", YAHOO, {version: "2.6.0", build: "1321"});
diff --git a/lib/yui-dom.js b/lib/yui-dom.js
new file mode 100644
index 0000000..f0bdc38
--- /dev/null
+++ b/lib/yui-dom.js
@@ -0,0 +1,1241 @@
+/*
+Copyright (c) 2008, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.6.0
+*/
+/**
+ * The dom module provides helper methods for manipulating Dom elements.
+ * @module dom
+ *
+ */
+
+(function() {
+    var Y = YAHOO.util,     // internal shorthand
+        lang = YAHOO.lang,
+        getStyle,           // for load time browser branching
+        setStyle,           // ditto
+        propertyCache = {}, // for faster hyphen converts
+        reClassNameCache = {},          // cache regexes for className
+        document = window.document;     // cache for faster lookups
+    
+    YAHOO.env._id_counter = YAHOO.env._id_counter || 0;     // for use with generateId (global to save state if Dom is overwritten)
+
+    // brower detection
+    var isOpera = YAHOO.env.ua.opera,
+        isSafari = YAHOO.env.ua.webkit, 
+        isGecko = YAHOO.env.ua.gecko,
+        isIE = YAHOO.env.ua.ie; 
+    
+    // regex cache
+    var patterns = {
+        HYPHEN: /(-[a-z])/i, // to normalize get/setStyle
+        ROOT_TAG: /^body|html$/i, // body for quirks mode, html for standards,
+        OP_SCROLL:/^(?:inline|table-row)$/i
+    };
+
+    var toCamel = function(property) {
+        if ( !patterns.HYPHEN.test(property) ) {
+            return property; // no hyphens
+        }
+        
+        if (propertyCache[property]) { // already converted
+            return propertyCache[property];
+        }
+       
+        var converted = property;
+ 
+        while( patterns.HYPHEN.exec(converted) ) {
+            converted = converted.replace(RegExp.$1,
+                    RegExp.$1.substr(1).toUpperCase());
+        }
+        
+        propertyCache[property] = converted;
+        return converted;
+        //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
+    };
+    
+    var getClassRegEx = function(className) {
+        var re = reClassNameCache[className];
+        if (!re) {
+            re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+            reClassNameCache[className] = re;
+        }
+        return re;
+    };
+
+    // branching at load instead of runtime
+    if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
+        getStyle = function(el, property) {
+            var value = null;
+            
+            if (property == 'float') { // fix reserved word
+                property = 'cssFloat';
+            }
+
+            var computed = el.ownerDocument.defaultView.getComputedStyle(el, '');
+            if (computed) { // test computed before touching for safari
+                value = computed[toCamel(property)];
+            }
+            
+            return el.style[property] || value;
+        };
+    } else if (document.documentElement.currentStyle && isIE) { // IE method
+        getStyle = function(el, property) {                         
+            switch( toCamel(property) ) {
+                case 'opacity' :// IE opacity uses filter
+                    var val = 100;
+                    try { // will error if no DXImageTransform
+                        val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
+
+                    } catch(e) {
+                        try { // make sure its in the document
+                            val = el.filters('alpha').opacity;
+                        } catch(e) {
+                        }
+                    }
+                    return val / 100;
+                case 'float': // fix reserved word
+                    property = 'styleFloat'; // fall through
+                default: 
+                    // test currentStyle before touching
+                    var value = el.currentStyle ? el.currentStyle[property] : null;
+                    return ( el.style[property] || value );
+            }
+        };
+    } else { // default to inline only
+        getStyle = function(el, property) { return el.style[property]; };
+    }
+    
+    if (isIE) {
+        setStyle = function(el, property, val) {
+            switch (property) {
+                case 'opacity':
+                    if ( lang.isString(el.style.filter) ) { // in case not appended
+                        el.style.filter = 'alpha(opacity=' + val * 100 + ')';
+                        
+                        if (!el.currentStyle || !el.currentStyle.hasLayout) {
+                            el.style.zoom = 1; // when no layout or cant tell
+                        }
+                    }
+                    break;
+                case 'float':
+                    property = 'styleFloat';
+                default:
+                el.style[property] = val;
+            }
+        };
+    } else {
+        setStyle = function(el, property, val) {
+            if (property == 'float') {
+                property = 'cssFloat';
+            }
+            el.style[property] = val;
+        };
+    }
+
+    var testElement = function(node, method) {
+        return node && node.nodeType == 1 && ( !method || method(node) );
+    };
+
+    /**
+     * Provides helper methods for DOM elements.
+     * @namespace YAHOO.util
+     * @class Dom
+     */
+    YAHOO.util.Dom = {
+        /**
+         * Returns an HTMLElement reference.
+         * @method get
+         * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+         * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
+         */
+        get: function(el) {
+            if (el) {
+                if (el.nodeType || el.item) { // Node, or NodeList
+                    return el;
+                }
+
+                if (typeof el === 'string') { // id
+                    return document.getElementById(el);
+                }
+                
+                if ('length' in el) { // array-like 
+                    var c = [];
+                    for (var i = 0, len = el.length; i < len; ++i) {
+                        c[c.length] = Y.Dom.get(el[i]);
+                    }
+                    
+                    return c;
+                }
+
+                return el; // some other object, just pass it back
+            }
+
+            return null;
+        },
+    
+        /**
+         * Normalizes currentStyle and ComputedStyle.
+         * @method getStyle
+         * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+         * @param {String} property The style property whose value is returned.
+         * @return {String | Array} The current value of the style property for the element(s).
+         */
+        getStyle: function(el, property) {
+            property = toCamel(property);
+            
+            var f = function(element) {
+                return getStyle(element, property);
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+    
+        /**
+         * Wrapper for setting style properties of HTMLElements.  Normalizes "opacity" across modern browsers.
+         * @method setStyle
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+         * @param {String} property The style property to be set.
+         * @param {String} val The value to apply to the given property.
+         */
+        setStyle: function(el, property, val) {
+            property = toCamel(property);
+            
+            var f = function(element) {
+                setStyle(element, property, val);
+                
+            };
+            
+            Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Gets the current position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method getXY
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+         * @return {Array} The XY position of the element(s)
+         */
+        getXY: function(el) {
+            var f = function(el) {
+                // has to be part of document to have pageXY
+                if ( (el.parentNode === null || el.offsetParent === null ||
+                        this.getStyle(el, 'display') == 'none') && el != el.ownerDocument.body) {
+                    return false;
+                }
+                
+                return getXY(el);
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Gets the current X position of an element based on page coordinates.  The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method getX
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+         * @return {Number | Array} The X position of the element(s)
+         */
+        getX: function(el) {
+            var f = function(el) {
+                return Y.Dom.getXY(el)[0];
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Gets the current Y position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method getY
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+         * @return {Number | Array} The Y position of the element(s)
+         */
+        getY: function(el) {
+            var f = function(el) {
+                return Y.Dom.getXY(el)[1];
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Set the position of an html element in page coordinates, regardless of how the element is positioned.
+         * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method setXY
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+         * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
+         * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
+         */
+        setXY: function(el, pos, noRetry) {
+            var f = function(el) {
+                var style_pos = this.getStyle(el, 'position');
+                if (style_pos == 'static') { // default to relative
+                    this.setStyle(el, 'position', 'relative');
+                    style_pos = 'relative';
+                }
+
+                var pageXY = this.getXY(el);
+                if (pageXY === false) { // has to be part of doc to have pageXY
+                    return false; 
+                }
+                
+                var delta = [ // assuming pixels; if not we will have to retry
+                    parseInt( this.getStyle(el, 'left'), 10 ),
+                    parseInt( this.getStyle(el, 'top'), 10 )
+                ];
+            
+                if ( isNaN(delta[0]) ) {// in case of 'auto'
+                    delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
+                } 
+                if ( isNaN(delta[1]) ) { // in case of 'auto'
+                    delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
+                } 
+        
+                if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
+                if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
+              
+                if (!noRetry) {
+                    var newXY = this.getXY(el);
+
+                    // if retry is true, try one more time if we miss 
+                   if ( (pos[0] !== null && newXY[0] != pos[0]) || 
+                        (pos[1] !== null && newXY[1] != pos[1]) ) {
+                       this.setXY(el, pos, true);
+                   }
+                }        
+        
+            };
+            
+            Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method setX
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+         * @param {Int} x The value to use as the X coordinate for the element(s).
+         */
+        setX: function(el, x) {
+            Y.Dom.setXY(el, [x, null]);
+        },
+        
+        /**
+         * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method setY
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+         * @param {Int} x To use as the Y coordinate for the element(s).
+         */
+        setY: function(el, y) {
+            Y.Dom.setXY(el, [null, y]);
+        },
+        
+        /**
+         * Returns the region position of the given element.
+         * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+         * @method getRegion
+         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+         * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
+         */
+        getRegion: function(el) {
+            var f = function(el) {
+                if ( (el.parentNode === null || el.offsetParent === null ||
+                        this.getStyle(el, 'display') == 'none') && el != el.ownerDocument.body) {
+                    return false;
+                }
+
+                var region = Y.Region.getRegion(el);
+                return region;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Returns the width of the client (viewport).
+         * @method getClientWidth
+         * @deprecated Now using getViewportWidth.  This interface left intact for back compat.
+         * @return {Int} The width of the viewable area of the page.
+         */
+        getClientWidth: function() {
+            return Y.Dom.getViewportWidth();
+        },
+        
+        /**
+         * Returns the height of the client (viewport).
+         * @method getClientHeight
+         * @deprecated Now using getViewportHeight.  This interface left intact for back compat.
+         * @return {Int} The height of the viewable area of the page.
+         */
+        getClientHeight: function() {
+            return Y.Dom.getViewportHeight();
+        },
+
+        /**
+         * Returns a array of HTMLElements with the given class.
+         * For optimized performance, include a tag and/or root node when possible.
+         * Note: This method operates against a live collection, so modifying the 
+         * collection in the callback (removing/appending nodes, etc.) will have
+         * side effects.  Instead you should iterate the returned nodes array,
+         * as you would with the native "getElementsByTagName" method. 
+         * @method getElementsByClassName
+         * @param {String} className The class name to match against
+         * @param {String} tag (optional) The tag name of the elements being collected
+         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point 
+         * @param {Function} apply (optional) A function to apply to each element when found 
+         * @return {Array} An array of elements that have the given class name
+         */
+        getElementsByClassName: function(className, tag, root, apply) {
+            className = lang.trim(className);
+            tag = tag || '*';
+            root = (root) ? Y.Dom.get(root) : null || document; 
+            if (!root) {
+                return [];
+            }
+
+            var nodes = [],
+                elements = root.getElementsByTagName(tag),
+                re = getClassRegEx(className);
+
+            for (var i = 0, len = elements.length; i < len; ++i) {
+                if ( re.test(elements[i].className) ) {
+                    nodes[nodes.length] = elements[i];
+                    if (apply) {
+                        apply.call(elements[i], elements[i]);
+                    }
+                }
+            }
+            
+            return nodes;
+        },
+
+        /**
+         * Determines whether an HTMLElement has the given className.
+         * @method hasClass
+         * @param {String | HTMLElement | Array} el The element or collection to test
+         * @param {String} className the class name to search for
+         * @return {Boolean | Array} A boolean value or array of boolean values
+         */
+        hasClass: function(el, className) {
+            var re = getClassRegEx(className);
+
+            var f = function(el) {
+                return re.test(el.className);
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+    
+        /**
+         * Adds a class name to a given element or collection of elements.
+         * @method addClass         
+         * @param {String | HTMLElement | Array} el The element or collection to add the class to
+         * @param {String} className the class name to add to the class attribute
+         * @return {Boolean | Array} A pass/fail boolean or array of booleans
+         */
+        addClass: function(el, className) {
+            var f = function(el) {
+                if (this.hasClass(el, className)) {
+                    return false; // already present
+                }
+                
+                
+                el.className = lang.trim([el.className, className].join(' '));
+                return true;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+    
+        /**
+         * Removes a class name from a given element or collection of elements.
+         * @method removeClass         
+         * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+         * @param {String} className the class name to remove from the class attribute
+         * @return {Boolean | Array} A pass/fail boolean or array of booleans
+         */
+        removeClass: function(el, className) {
+            var re = getClassRegEx(className);
+            
+            var f = function(el) {
+                var ret = false,
+                    current = el.className;
+
+                if (className && current && this.hasClass(el, className)) {
+                    
+                    el.className = current.replace(re, ' ');
+                    if ( this.hasClass(el, className) ) { // in case of multiple adjacent
+                        this.removeClass(el, className);
+                    }
+
+                    el.className = lang.trim(el.className); // remove any trailing spaces
+                    if (el.className === '') { // remove class attribute if empty
+                        var attr = (el.hasAttribute) ? 'class' : 'className';
+                        el.removeAttribute(attr);
+                    }
+                    ret = true;
+                }                 
+                return ret;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Replace a class with another class for a given element or collection of elements.
+         * If no oldClassName is present, the newClassName is simply added.
+         * @method replaceClass  
+         * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+         * @param {String} oldClassName the class name to be replaced
+         * @param {String} newClassName the class name that will be replacing the old class name
+         * @return {Boolean | Array} A pass/fail boolean or array of booleans
+         */
+        replaceClass: function(el, oldClassName, newClassName) {
+            if (!newClassName || oldClassName === newClassName) { // avoid infinite loop
+                return false;
+            }
+            
+            var re = getClassRegEx(oldClassName);
+
+            var f = function(el) {
+            
+                if ( !this.hasClass(el, oldClassName) ) {
+                    this.addClass(el, newClassName); // just add it if nothing to replace
+                    return true; // NOTE: return
+                }
+            
+                el.className = el.className.replace(re, ' ' + newClassName + ' ');
+
+                if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
+                    this.removeClass(el, oldClassName);
+                }
+
+                el.className = lang.trim(el.className); // remove any trailing spaces
+                return true;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Returns an ID and applies it to the element "el", if provided.
+         * @method generateId  
+         * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
+         * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
+         * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
+         */
+        generateId: function(el, prefix) {
+            prefix = prefix || 'yui-gen';
+
+            var f = function(el) {
+                if (el && el.id) { // do not override existing ID
+                    return el.id;
+                } 
+
+                var id = prefix + YAHOO.env._id_counter++;
+
+                if (el) {
+                    el.id = id;
+                }
+                
+                return id;
+            };
+
+            // batch fails when no element, so just generate and return single ID
+            return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
+        },
+        
+        /**
+         * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
+         * @method isAncestor
+         * @param {String | HTMLElement} haystack The possible ancestor
+         * @param {String | HTMLElement} needle The possible descendent
+         * @return {Boolean} Whether or not the haystack is an ancestor of needle
+         */
+        isAncestor: function(haystack, needle) {
+            haystack = Y.Dom.get(haystack);
+            needle = Y.Dom.get(needle);
+            
+            var ret = false;
+
+            if ( (haystack && needle) && (haystack.nodeType && needle.nodeType) ) {
+                if (haystack.contains && haystack !== needle) { // contains returns true when equal
+                    ret = haystack.contains(needle);
+                }
+                else if (haystack.compareDocumentPosition) { // gecko
+                    ret = !!(haystack.compareDocumentPosition(needle) & 16);
+                }
+            } else {
+            }
+            return ret;
+        },
+        
+        /**
+         * Determines whether an HTMLElement is present in the current document.
+         * @method inDocument         
+         * @param {String | HTMLElement} el The element to search for
+         * @return {Boolean} Whether or not the element is present in the current document
+         */
+        inDocument: function(el) {
+            return this.isAncestor(document.documentElement, el);
+        },
+        
+        /**
+         * Returns a array of HTMLElements that pass the test applied by supplied boolean method.
+         * For optimized performance, include a tag and/or root node when possible.
+         * Note: This method operates against a live collection, so modifying the 
+         * collection in the callback (removing/appending nodes, etc.) will have
+         * side effects.  Instead you should iterate the returned nodes array,
+         * as you would with the native "getElementsByTagName" method. 
+         * @method getElementsBy
+         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
+         * @param {String} tag (optional) The tag name of the elements being collected
+         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point 
+         * @param {Function} apply (optional) A function to apply to each element when found 
+         * @return {Array} Array of HTMLElements
+         */
+        getElementsBy: function(method, tag, root, apply) {
+            tag = tag || '*';
+            root = (root) ? Y.Dom.get(root) : null || document; 
+
+            if (!root) {
+                return [];
+            }
+
+            var nodes = [],
+                elements = root.getElementsByTagName(tag);
+            
+            for (var i = 0, len = elements.length; i < len; ++i) {
+                if ( method(elements[i]) ) {
+                    nodes[nodes.length] = elements[i];
+                    if (apply) {
+                        apply(elements[i]);
+                    }
+                }
+            }
+
+            
+            return nodes;
+        },
+        
+        /**
+         * Runs the supplied method against each item in the Collection/Array.
+         * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
+         * @method batch
+         * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
+         * @param {Function} method The method to apply to the element(s)
+         * @param {Any} o (optional) An optional arg that is passed to the supplied method
+         * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
+         * @return {Any | Array} The return value(s) from the supplied method
+         */
+        batch: function(el, method, o, override) {
+            el = (el && (el.tagName || el.item)) ? el : Y.Dom.get(el); // skip get() when possible
+
+            if (!el || !method) {
+                return false;
+            } 
+            var scope = (override) ? o : window;
+            
+            if (el.tagName || el.length === undefined) { // element or not array-like 
+                return method.call(scope, el, o);
+            } 
+
+            var collection = [];
+            
+            for (var i = 0, len = el.length; i < len; ++i) {
+                collection[collection.length] = method.call(scope, el[i], o);
+            }
+            
+            return collection;
+        },
+        
+        /**
+         * Returns the height of the document.
+         * @method getDocumentHeight
+         * @return {Int} The height of the actual document (which includes the body and its margin).
+         */
+        getDocumentHeight: function() {
+            var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
+
+            var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
+            return h;
+        },
+        
+        /**
+         * Returns the width of the document.
+         * @method getDocumentWidth
+         * @return {Int} The width of the actual document (which includes the body and its margin).
+         */
+        getDocumentWidth: function() {
+            var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
+            var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
+            return w;
+        },
+
+        /**
+         * Returns the current height of the viewport.
+         * @method getViewportHeight
+         * @return {Int} The height of the viewable area of the page (excludes scrollbars).
+         */
+        getViewportHeight: function() {
+            var height = self.innerHeight; // Safari, Opera
+            var mode = document.compatMode;
+        
+            if ( (mode || isIE) && !isOpera ) { // IE, Gecko
+                height = (mode == 'CSS1Compat') ?
+                        document.documentElement.clientHeight : // Standards
+                        document.body.clientHeight; // Quirks
+            }
+        
+            return height;
+        },
+        
+        /**
+         * Returns the current width of the viewport.
+         * @method getViewportWidth
+         * @return {Int} The width of the viewable area of the page (excludes scrollbars).
+         */
+        
+        getViewportWidth: function() {
+            var width = self.innerWidth;  // Safari
+            var mode = document.compatMode;
+            
+            if (mode || isIE) { // IE, Gecko, Opera
+                width = (mode == 'CSS1Compat') ?
+                        document.documentElement.clientWidth : // Standards
+                        document.body.clientWidth; // Quirks
+            }
+            return width;
+        },
+
+       /**
+         * Returns the nearest ancestor that passes the test applied by supplied boolean method.
+         * For performance reasons, IDs are not accepted and argument validation omitted.
+         * @method getAncestorBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
+         * @return {Object} HTMLElement or null if not found
+         */
+        getAncestorBy: function(node, method) {
+            while ( (node = node.parentNode) ) { // NOTE: assignment
+                if ( testElement(node, method) ) {
+                    return node;
+                }
+            } 
+
+            return null;
+        },
+        
+        /**
+         * Returns the nearest ancestor with the given className.
+         * @method getAncestorByClassName
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @param {String} className
+         * @return {Object} HTMLElement
+         */
+        getAncestorByClassName: function(node, className) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+            var method = function(el) { return Y.Dom.hasClass(el, className); };
+            return Y.Dom.getAncestorBy(node, method);
+        },
+
+        /**
+         * Returns the nearest ancestor with the given tagName.
+         * @method getAncestorByTagName
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @param {String} tagName
+         * @return {Object} HTMLElement
+         */
+        getAncestorByTagName: function(node, tagName) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+            var method = function(el) {
+                 return el.tagName && el.tagName.toUpperCase() == tagName.toUpperCase();
+            };
+
+            return Y.Dom.getAncestorBy(node, method);
+        },
+
+        /**
+         * Returns the previous sibling that is an HTMLElement. 
+         * For performance reasons, IDs are not accepted and argument validation omitted.
+         * Returns the nearest HTMLElement sibling if no method provided.
+         * @method getPreviousSiblingBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test siblings
+         * that receives the sibling node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getPreviousSiblingBy: function(node, method) {
+            while (node) {
+                node = node.previousSibling;
+                if ( testElement(node, method) ) {
+                    return node;
+                }
+            }
+            return null;
+        }, 
+
+        /**
+         * Returns the previous sibling that is an HTMLElement 
+         * @method getPreviousSibling
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getPreviousSibling: function(node) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+
+            return Y.Dom.getPreviousSiblingBy(node);
+        }, 
+
+        /**
+         * Returns the next HTMLElement sibling that passes the boolean method. 
+         * For performance reasons, IDs are not accepted and argument validation omitted.
+         * Returns the nearest HTMLElement sibling if no method provided.
+         * @method getNextSiblingBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test siblings
+         * that receives the sibling node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getNextSiblingBy: function(node, method) {
+            while (node) {
+                node = node.nextSibling;
+                if ( testElement(node, method) ) {
+                    return node;
+                }
+            }
+            return null;
+        }, 
+
+        /**
+         * Returns the next sibling that is an HTMLElement 
+         * @method getNextSibling
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getNextSibling: function(node) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+
+            return Y.Dom.getNextSiblingBy(node);
+        }, 
+
+        /**
+         * Returns the first HTMLElement child that passes the test method. 
+         * @method getFirstChildBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test children
+         * that receives the node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getFirstChildBy: function(node, method) {
+            var child = ( testElement(node.firstChild, method) ) ? node.firstChild : null;
+            return child || Y.Dom.getNextSiblingBy(node.firstChild, method);
+        }, 
+
+        /**
+         * Returns the first HTMLElement child. 
+         * @method getFirstChild
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getFirstChild: function(node, method) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+            return Y.Dom.getFirstChildBy(node);
+        }, 
+
+        /**
+         * Returns the last HTMLElement child that passes the test method. 
+         * @method getLastChildBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test children
+         * that receives the node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getLastChildBy: function(node, method) {
+            if (!node) {
+                return null;
+            }
+            var child = ( testElement(node.lastChild, method) ) ? node.lastChild : null;
+            return child || Y.Dom.getPreviousSiblingBy(node.lastChild, method);
+        }, 
+
+        /**
+         * Returns the last HTMLElement child. 
+         * @method getLastChild
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getLastChild: function(node) {
+            node = Y.Dom.get(node);
+            return Y.Dom.getLastChildBy(node);
+        }, 
+
+        /**
+         * Returns an array of HTMLElement childNodes that pass the test method. 
+         * @method getChildrenBy
+         * @param {HTMLElement} node The HTMLElement to start from
+         * @param {Function} method A boolean function used to test children
+         * that receives the node being tested as its only argument
+         * @return {Array} A static array of HTMLElements
+         */
+        getChildrenBy: function(node, method) {
+            var child = Y.Dom.getFirstChildBy(node, method);
+            var children = child ? [child] : [];
+
+            Y.Dom.getNextSiblingBy(child, function(node) {
+                if ( !method || method(node) ) {
+                    children[children.length] = node;
+                }
+                return false; // fail test to collect all children
+            });
+
+            return children;
+        },
+ 
+        /**
+         * Returns an array of HTMLElement childNodes. 
+         * @method getChildren
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Array} A static array of HTMLElements
+         */
+        getChildren: function(node) {
+            node = Y.Dom.get(node);
+            if (!node) {
+            }
+
+            return Y.Dom.getChildrenBy(node);
+        },
+ 
+        /**
+         * Returns the left scroll value of the document 
+         * @method getDocumentScrollLeft
+         * @param {HTMLDocument} document (optional) The document to get the scroll value of
+         * @return {Int}  The amount that the document is scrolled to the left
+         */
+        getDocumentScrollLeft: function(doc) {
+            doc = doc || document;
+            return Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
+        }, 
+
+        /**
+         * Returns the top scroll value of the document 
+         * @method getDocumentScrollTop
+         * @param {HTMLDocument} document (optional) The document to get the scroll value of
+         * @return {Int}  The amount that the document is scrolled to the top
+         */
+        getDocumentScrollTop: function(doc) {
+            doc = doc || document;
+            return Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
+        },
+
+        /**
+         * Inserts the new node as the previous sibling of the reference node 
+         * @method insertBefore
+         * @param {String | HTMLElement} newNode The node to be inserted
+         * @param {String | HTMLElement} referenceNode The node to insert the new node before 
+         * @return {HTMLElement} The node that was inserted (or null if insert fails) 
+         */
+        insertBefore: function(newNode, referenceNode) {
+            newNode = Y.Dom.get(newNode); 
+            referenceNode = Y.Dom.get(referenceNode); 
+            
+            if (!newNode || !referenceNode || !referenceNode.parentNode) {
+                return null;
+            }       
+
+            return referenceNode.parentNode.insertBefore(newNode, referenceNode); 
+        },
+
+        /**
+         * Inserts the new node as the next sibling of the reference node 
+         * @method insertAfter
+         * @param {String | HTMLElement} newNode The node to be inserted
+         * @param {String | HTMLElement} referenceNode The node to insert the new node after 
+         * @return {HTMLElement} The node that was inserted (or null if insert fails) 
+         */
+        insertAfter: function(newNode, referenceNode) {
+            newNode = Y.Dom.get(newNode); 
+            referenceNode = Y.Dom.get(referenceNode); 
+            
+            if (!newNode || !referenceNode || !referenceNode.parentNode) {
+                return null;
+            }       
+
+            if (referenceNode.nextSibling) {
+                return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); 
+            } else {
+                return referenceNode.parentNode.appendChild(newNode);
+            }
+        },
+
+        /**
+         * Creates a Region based on the viewport relative to the document. 
+         * @method getClientRegion
+         * @return {Region} A Region object representing the viewport which accounts for document scroll
+         */
+        getClientRegion: function() {
+            var t = Y.Dom.getDocumentScrollTop(),
+                l = Y.Dom.getDocumentScrollLeft(),
+                r = Y.Dom.getViewportWidth() + l,
+                b = Y.Dom.getViewportHeight() + t;
+
+            return new Y.Region(t, r, b, l);
+        }
+    };
+    
+    var getXY = function() {
+        if (document.documentElement.getBoundingClientRect) { // IE
+            return function(el) {
+                var box = el.getBoundingClientRect(),
+                    round = Math.round;
+
+                var rootNode = el.ownerDocument;
+                return [round(box.left + Y.Dom.getDocumentScrollLeft(rootNode)), round(box.top +
+                        Y.Dom.getDocumentScrollTop(rootNode))];
+            };
+        } else {
+            return function(el) { // manually calculate by crawling up offsetParents
+                var pos = [el.offsetLeft, el.offsetTop];
+                var parentNode = el.offsetParent;
+
+                // safari: subtract body offsets if el is abs (or any offsetParent), unless body is offsetParent
+                var accountForBody = (isSafari &&
+                        Y.Dom.getStyle(el, 'position') == 'absolute' &&
+                        el.offsetParent == el.ownerDocument.body);
+
+                if (parentNode != el) {
+                    while (parentNode) {
+                        pos[0] += parentNode.offsetLeft;
+                        pos[1] += parentNode.offsetTop;
+                        if (!accountForBody && isSafari && 
+                                Y.Dom.getStyle(parentNode,'position') == 'absolute' ) { 
+                            accountForBody = true;
+                        }
+                        parentNode = parentNode.offsetParent;
+                    }
+                }
+
+                if (accountForBody) { //safari doubles in this case
+                    pos[0] -= el.ownerDocument.body.offsetLeft;
+                    pos[1] -= el.ownerDocument.body.offsetTop;
+                } 
+                parentNode = el.parentNode;
+
+                // account for any scrolled ancestors
+                while ( parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName) ) 
+                {
+                    if (parentNode.scrollTop || parentNode.scrollLeft) {
+                        pos[0] -= parentNode.scrollLeft;
+                        pos[1] -= parentNode.scrollTop;
+                    }
+                    
+                    parentNode = parentNode.parentNode; 
+                }
+
+                return pos;
+            };
+        }
+    }() // NOTE: Executing for loadtime branching
+})();
+/**
+ * A region is a representation of an object on a grid.  It is defined
+ * by the top, right, bottom, left extents, so is rectangular by default.  If 
+ * other shapes are required, this class could be extended to support it.
+ * @namespace YAHOO.util
+ * @class Region
+ * @param {Int} t the top extent
+ * @param {Int} r the right extent
+ * @param {Int} b the bottom extent
+ * @param {Int} l the left extent
+ * @constructor
+ */
+YAHOO.util.Region = function(t, r, b, l) {
+
+    /**
+     * The region's top extent
+     * @property top
+     * @type Int
+     */
+    this.top = t;
+    
+    /**
+     * The region's top extent as index, for symmetry with set/getXY
+     * @property 1
+     * @type Int
+     */
+    this[1] = t;
+
+    /**
+     * The region's right extent
+     * @property right
+     * @type int
+     */
+    this.right = r;
+
+    /**
+     * The region's bottom extent
+     * @property bottom
+     * @type Int
+     */
+    this.bottom = b;
+
+    /**
+     * The region's left extent
+     * @property left
+     * @type Int
+     */
+    this.left = l;
+    
+    /**
+     * The region's left extent as index, for symmetry with set/getXY
+     * @property 0
+     * @type Int
+     */
+    this[0] = l;
+};
+
+/**
+ * Returns true if this region contains the region passed in
+ * @method contains
+ * @param  {Region}  region The region to evaluate
+ * @return {Boolean}        True if the region is contained with this region, 
+ *                          else false
+ */
+YAHOO.util.Region.prototype.contains = function(region) {
+    return ( region.left   >= this.left   && 
+             region.right  <= this.right  && 
+             region.top    >= this.top    && 
+             region.bottom <= this.bottom    );
+
+};
+
+/**
+ * Returns the area of the region
+ * @method getArea
+ * @return {Int} the region's area
+ */
+YAHOO.util.Region.prototype.getArea = function() {
+    return ( (this.bottom - this.top) * (this.right - this.left) );
+};
+
+/**
+ * Returns the region where the passed in region overlaps with this one
+ * @method intersect
+ * @param  {Region} region The region that intersects
+ * @return {Region}        The overlap region, or null if there is no overlap
+ */
+YAHOO.util.Region.prototype.intersect = function(region) {
+    var t = Math.max( this.top,    region.top    );
+    var r = Math.min( this.right,  region.right  );
+    var b = Math.min( this.bottom, region.bottom );
+    var l = Math.max( this.left,   region.left   );
+    
+    if (b >= t && r >= l) {
+        return new YAHOO.util.Region(t, r, b, l);
+    } else {
+        return null;
+    }
+};
+
+/**
+ * Returns the region representing the smallest region that can contain both
+ * the passed in region and this region.
+ * @method union
+ * @param  {Region} region The region that to create the union with
+ * @return {Region}        The union region
+ */
+YAHOO.util.Region.prototype.union = function(region) {
+    var t = Math.min( this.top,    region.top    );
+    var r = Math.max( this.right,  region.right  );
+    var b = Math.max( this.bottom, region.bottom );
+    var l = Math.min( this.left,   region.left   );
+
+    return new YAHOO.util.Region(t, r, b, l);
+};
+
+/**
+ * toString
+ * @method toString
+ * @return string the region properties
+ */
+YAHOO.util.Region.prototype.toString = function() {
+    return ( "Region {"    +
+             "top: "       + this.top    + 
+             ", right: "   + this.right  + 
+             ", bottom: "  + this.bottom + 
+             ", left: "    + this.left   + 
+             "}" );
+};
+
+/**
+ * Returns a region that is occupied by the DOM element
+ * @method getRegion
+ * @param  {HTMLElement} el The element
+ * @return {Region}         The region that the element occupies
+ * @static
+ */
+YAHOO.util.Region.getRegion = function(el) {
+    var p = YAHOO.util.Dom.getXY(el);
+
+    var t = p[1];
+    var r = p[0] + el.offsetWidth;
+    var b = p[1] + el.offsetHeight;
+    var l = p[0];
+
+    return new YAHOO.util.Region(t, r, b, l);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * A point is a region that is special in that it represents a single point on 
+ * the grid.
+ * @namespace YAHOO.util
+ * @class Point
+ * @param {Int} x The X position of the point
+ * @param {Int} y The Y position of the point
+ * @constructor
+ * @extends YAHOO.util.Region
+ */
+YAHOO.util.Point = function(x, y) {
+   if (YAHOO.lang.isArray(x)) { // accept input from Dom.getXY, Event.getXY, etc.
+      y = x[1]; // dont blow away x yet
+      x = x[0];
+   }
+   
+    /**
+     * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
+     * @property x
+     * @type Int
+     */
+
+    this.x = this.right = this.left = this[0] = x;
+     
+    /**
+     * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
+     * @property y
+     * @type Int
+     */
+    this.y = this.top = this.bottom = this[1] = y;
+};
+
+YAHOO.util.Point.prototype = new YAHOO.util.Region();
+
+YAHOO.register("dom", YAHOO.util.Dom, {version: "2.6.0", build: "1321"});
diff --git a/lib/yui-event.js b/lib/yui-event.js
new file mode 100644
index 0000000..17eb097
--- /dev/null
+++ b/lib/yui-event.js
@@ -0,0 +1,2562 @@
+/*
+Copyright (c) 2008, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.6.0
+*/
+
+/**
+ * The CustomEvent class lets you define events for your application
+ * that can be subscribed to by one or more independent component.
+ *
+ * @param {String}  type The type of event, which is passed to the callback
+ *                  when the event fires
+ * @param {Object}  oScope The context the event will fire from.  "this" will
+ *                  refer to this object in the callback.  Default value: 
+ *                  the window object.  The listener can override this.
+ * @param {boolean} silent pass true to prevent the event from writing to
+ *                  the debugsystem
+ * @param {int}     signature the signature that the custom event subscriber
+ *                  will receive. YAHOO.util.CustomEvent.LIST or 
+ *                  YAHOO.util.CustomEvent.FLAT.  The default is
+ *                  YAHOO.util.CustomEvent.LIST.
+ * @namespace YAHOO.util
+ * @class CustomEvent
+ * @constructor
+ */
+YAHOO.util.CustomEvent = function(type, oScope, silent, signature) {
+
+    /**
+     * The type of event, returned to subscribers when the event fires
+     * @property type
+     * @type string
+     */
+    this.type = type;
+
+    /**
+     * The scope the the event will fire from by default.  Defaults to the window 
+     * obj
+     * @property scope
+     * @type object
+     */
+    this.scope = oScope || window;
+
+    /**
+     * By default all custom events are logged in the debug build, set silent
+     * to true to disable debug outpu for this event.
+     * @property silent
+     * @type boolean
+     */
+    this.silent = silent;
+
+    /**
+     * Custom events support two styles of arguments provided to the event
+     * subscribers.  
+     * <ul>
+     * <li>YAHOO.util.CustomEvent.LIST: 
+     *   <ul>
+     *   <li>param1: event name</li>
+     *   <li>param2: array of arguments sent to fire</li>
+     *   <li>param3: <optional> a custom object supplied by the subscriber</li>
+     *   </ul>
+     * </li>
+     * <li>YAHOO.util.CustomEvent.FLAT
+     *   <ul>
+     *   <li>param1: the first argument passed to fire.  If you need to
+     *           pass multiple parameters, use and array or object literal</li>
+     *   <li>param2: <optional> a custom object supplied by the subscriber</li>
+     *   </ul>
+     * </li>
+     * </ul>
+     *   @property signature
+     *   @type int
+     */
+    this.signature = signature || YAHOO.util.CustomEvent.LIST;
+
+    /**
+     * The subscribers to this event
+     * @property subscribers
+     * @type Subscriber[]
+     */
+    this.subscribers = [];
+
+    if (!this.silent) {
+    }
+
+    var onsubscribeType = "_YUICEOnSubscribe";
+
+    // Only add subscribe events for events that are not generated by 
+    // CustomEvent
+    if (type !== onsubscribeType) {
+
+        /**
+         * Custom events provide a custom event that fires whenever there is
+         * a new subscriber to the event.  This provides an opportunity to
+         * handle the case where there is a non-repeating event that has
+         * already fired has a new subscriber.  
+         *
+         * @event subscribeEvent
+         * @type YAHOO.util.CustomEvent
+         * @param {Function} fn The function to execute
+         * @param {Object}   obj An object to be passed along when the event 
+         *                       fires
+         * @param {boolean|Object}  override If true, the obj passed in becomes 
+         *                                   the execution scope of the listener.
+         *                                   if an object, that object becomes the
+         *                                   the execution scope.
+         */
+        this.subscribeEvent = 
+                new YAHOO.util.CustomEvent(onsubscribeType, this, true);
+
+    } 
+
+
+    /**
+     * In order to make it possible to execute the rest of the subscriber
+     * stack when one thows an exception, the subscribers exceptions are
+     * caught.  The most recent exception is stored in this property
+     * @property lastError
+     * @type Error
+     */
+    this.lastError = null;
+};
+
+/**
+ * Subscriber listener sigature constant.  The LIST type returns three
+ * parameters: the event type, the array of args passed to fire, and
+ * the optional custom object
+ * @property YAHOO.util.CustomEvent.LIST
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.LIST = 0;
+
+/**
+ * Subscriber listener sigature constant.  The FLAT type returns two
+ * parameters: the first argument passed to fire and the optional 
+ * custom object
+ * @property YAHOO.util.CustomEvent.FLAT
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.FLAT = 1;
+
+YAHOO.util.CustomEvent.prototype = {
+
+    /**
+     * Subscribes the caller to this event
+     * @method subscribe
+     * @param {Function} fn        The function to execute
+     * @param {Object}   obj       An object to be passed along when the event 
+     *                             fires
+     * @param {boolean|Object}  override If true, the obj passed in becomes 
+     *                                   the execution scope of the listener.
+     *                                   if an object, that object becomes the
+     *                                   the execution scope.
+     */
+    subscribe: function(fn, obj, override) {
+
+        if (!fn) {
+throw new Error("Invalid callback for subscriber to '" + this.type + "'");
+        }
+
+        if (this.subscribeEvent) {
+            this.subscribeEvent.fire(fn, obj, override);
+        }
+
+        this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) );
+    },
+
+    /**
+     * Unsubscribes subscribers.
+     * @method unsubscribe
+     * @param {Function} fn  The subscribed function to remove, if not supplied
+     *                       all will be removed
+     * @param {Object}   obj  The custom object passed to subscribe.  This is
+     *                        optional, but if supplied will be used to
+     *                        disambiguate multiple listeners that are the same
+     *                        (e.g., you subscribe many object using a function
+     *                        that lives on the prototype)
+     * @return {boolean} True if the subscriber was found and detached.
+     */
+    unsubscribe: function(fn, obj) {
+
+        if (!fn) {
+            return this.unsubscribeAll();
+        }
+
+        var found = false;
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (s && s.contains(fn, obj)) {
+                this._delete(i);
+                found = true;
+            }
+        }
+
+        return found;
+    },
+
+    /**
+     * Notifies the subscribers.  The callback functions will be executed
+     * from the scope specified when the event was created, and with the 
+     * following parameters:
+     *   <ul>
+     *   <li>The type of event</li>
+     *   <li>All of the arguments fire() was executed with as an array</li>
+     *   <li>The custom object (if any) that was passed into the subscribe() 
+     *       method</li>
+     *   </ul>
+     * @method fire 
+     * @param {Object*} arguments an arbitrary set of parameters to pass to 
+     *                            the handler.
+     * @return {boolean} false if one of the subscribers returned false, 
+     *                   true otherwise
+     */
+    fire: function() {
+
+        this.lastError = null;
+
+        var errors = [],
+            len=this.subscribers.length;
+
+        if (!len && this.silent) {
+            return true;
+        }
+
+        var args=[].slice.call(arguments, 0), ret=true, i, rebuild=false;
+
+        if (!this.silent) {
+        }
+
+        // make a copy of the subscribers so that there are
+        // no index problems if one subscriber removes another.
+        var subs = this.subscribers.slice(), throwErrors = YAHOO.util.Event.throwErrors;
+
+        for (i=0; i<len; ++i) {
+            var s = subs[i];
+            if (!s) {
+                rebuild=true;
+            } else {
+                if (!this.silent) {
+                }
+
+                var scope = s.getScope(this.scope);
+
+                if (this.signature == YAHOO.util.CustomEvent.FLAT) {
+                    var param = null;
+                    if (args.length > 0) {
+                        param = args[0];
+                    }
+
+                    try {
+                        ret = s.fn.call(scope, param, s.obj);
+                    } catch(e) {
+                        this.lastError = e;
+                        // errors.push(e);
+                        if (throwErrors) {
+                            throw e;
+                        }
+                    }
+                } else {
+                    try {
+                        ret = s.fn.call(scope, this.type, args, s.obj);
+                    } catch(ex) {
+                        this.lastError = ex;
+                        if (throwErrors) {
+                            throw ex;
+                        }
+                    }
+                }
+
+                if (false === ret) {
+                    if (!this.silent) {
+                    }
+
+                    break;
+                    // return false;
+                }
+            }
+        }
+
+        return (ret !== false);
+    },
+
+    /**
+     * Removes all listeners
+     * @method unsubscribeAll
+     * @return {int} The number of listeners unsubscribed
+     */
+    unsubscribeAll: function() {
+        for (var i=this.subscribers.length-1; i>-1; i--) {
+            this._delete(i);
+        }
+
+        this.subscribers=[];
+
+        return i;
+    },
+
+    /**
+     * @method _delete
+     * @private
+     */
+    _delete: function(index) {
+        var s = this.subscribers[index];
+        if (s) {
+            delete s.fn;
+            delete s.obj;
+        }
+
+        // this.subscribers[index]=null;
+        this.subscribers.splice(index, 1);
+    },
+
+    /**
+     * @method toString
+     */
+    toString: function() {
+         return "CustomEvent: " + "'" + this.type  + "', " + 
+             "scope: " + this.scope;
+
+    }
+};
+
+/////////////////////////////////////////////////////////////////////
+
+/**
+ * Stores the subscriber information to be used when the event fires.
+ * @param {Function} fn       The function to execute
+ * @param {Object}   obj      An object to be passed along when the event fires
+ * @param {boolean}  override If true, the obj passed in becomes the execution
+ *                            scope of the listener
+ * @class Subscriber
+ * @constructor
+ */
+YAHOO.util.Subscriber = function(fn, obj, override) {
+
+    /**
+     * The callback that will be execute when the event fires
+     * @property fn
+     * @type function
+     */
+    this.fn = fn;
+
+    /**
+     * An optional custom object that will passed to the callback when
+     * the event fires
+     * @property obj
+     * @type object
+     */
+    this.obj = YAHOO.lang.isUndefined(obj) ? null : obj;
+
+    /**
+     * The default execution scope for the event listener is defined when the
+     * event is created (usually the object which contains the event).
+     * By setting override to true, the execution scope becomes the custom
+     * object passed in by the subscriber.  If override is an object, that 
+     * object becomes the scope.
+     * @property override
+     * @type boolean|object
+     */
+    this.override = override;
+
+};
+
+/**
+ * Returns the execution scope for this listener.  If override was set to true
+ * the custom obj will be the scope.  If override is an object, that is the
+ * scope, otherwise the default scope will be used.
+ * @method getScope
+ * @param {Object} defaultScope the scope to use if this listener does not
+ *                              override it.
+ */
+YAHOO.util.Subscriber.prototype.getScope = function(defaultScope) {
+    if (this.override) {
+        if (this.override === true) {
+            return this.obj;
+        } else {
+            return this.override;
+        }
+    }
+    return defaultScope;
+};
+
+/**
+ * Returns true if the fn and obj match this objects properties.
+ * Used by the unsubscribe method to match the right subscriber.
+ *
+ * @method contains
+ * @param {Function} fn the function to execute
+ * @param {Object} obj an object to be passed along when the event fires
+ * @return {boolean} true if the supplied arguments match this 
+ *                   subscriber's signature.
+ */
+YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {
+    if (obj) {
+        return (this.fn == fn && this.obj == obj);
+    } else {
+        return (this.fn == fn);
+    }
+};
+
+/**
+ * @method toString
+ */
+YAHOO.util.Subscriber.prototype.toString = function() {
+    return "Subscriber { obj: " + this.obj  + 
+           ", override: " +  (this.override || "no") + " }";
+};
+
+/**
+ * The Event Utility provides utilities for managing DOM Events and tools
+ * for building event systems
+ *
+ * @module event
+ * @title Event Utility
+ * @namespace YAHOO.util
+ * @requires yahoo
+ */
+
+// The first instance of Event will win if it is loaded more than once.
+// @TODO this needs to be changed so that only the state data that needs to
+// be preserved is kept, while methods are overwritten/added as needed.
+// This means that the module pattern can't be used.
+if (!YAHOO.util.Event) {
+
+/**
+ * The event utility provides functions to add and remove event listeners,
+ * event cleansing.  It also tries to automatically remove listeners it
+ * registers during the unload event.
+ *
+ * @class Event
+ * @static
+ */
+    YAHOO.util.Event = function() {
+
+        /**
+         * True after the onload event has fired
+         * @property loadComplete
+         * @type boolean
+         * @static
+         * @private
+         */
+        var loadComplete =  false;
+
+        /**
+         * Cache of wrapped listeners
+         * @property listeners
+         * @type array
+         * @static
+         * @private
+         */
+        var listeners = [];
+
+        /**
+         * User-defined unload function that will be fired before all events
+         * are detached
+         * @property unloadListeners
+         * @type array
+         * @static
+         * @private
+         */
+        var unloadListeners = [];
+
+        /**
+         * Cache of DOM0 event handlers to work around issues with DOM2 events
+         * in Safari
+         * @property legacyEvents
+         * @static
+         * @private
+         */
+        var legacyEvents = [];
+
+        /**
+         * Listener stack for DOM0 events
+         * @property legacyHandlers
+         * @static
+         * @private
+         */
+        var legacyHandlers = [];
+
+        /**
+         * The number of times to poll after window.onload.  This number is
+         * increased if additional late-bound handlers are requested after
+         * the page load.
+         * @property retryCount
+         * @static
+         * @private
+         */
+        var retryCount = 0;
+
+        /**
+         * onAvailable listeners
+         * @property onAvailStack
+         * @static
+         * @private
+         */
+        var onAvailStack = [];
+
+        /**
+         * Lookup table for legacy events
+         * @property legacyMap
+         * @static
+         * @private
+         */
+        var legacyMap = [];
+
+        /**
+         * Counter for auto id generation
+         * @property counter
+         * @static
+         * @private
+         */
+        var counter = 0;
+        
+        /**
+         * Normalized keycodes for webkit/safari
+         * @property webkitKeymap
+         * @type {int: int}
+         * @private
+         * @static
+         * @final
+         */
+        var webkitKeymap = {
+            63232: 38, // up
+            63233: 40, // down
+            63234: 37, // left
+            63235: 39, // right
+            63276: 33, // page up
+            63277: 34, // page down
+            25: 9      // SHIFT-TAB (Safari provides a different key code in
+                       // this case, even though the shiftKey modifier is set)
+        };
+        
+        // String constants used by the addFocusListener and removeFocusListener methods
+        var _FOCUS = YAHOO.env.ua.ie ? "focusin" : "focus";
+        var _BLUR = YAHOO.env.ua.ie ? "focusout" : "blur";      
+
+        return {
+
+            /**
+             * The number of times we should look for elements that are not
+             * in the DOM at the time the event is requested after the document
+             * has been loaded.  The default is 2000@amp;20 ms, so it will poll
+             * for 40 seconds or until all outstanding handlers are bound
+             * (whichever comes first).
+             * @property POLL_RETRYS
+             * @type int
+             * @static
+             * @final
+             */
+            POLL_RETRYS: 2000,
+
+            /**
+             * The poll interval in milliseconds
+             * @property POLL_INTERVAL
+             * @type int
+             * @static
+             * @final
+             */
+            POLL_INTERVAL: 20,
+
+            /**
+             * Element to bind, int constant
+             * @property EL
+             * @type int
+             * @static
+             * @final
+             */
+            EL: 0,
+
+            /**
+             * Type of event, int constant
+             * @property TYPE
+             * @type int
+             * @static
+             * @final
+             */
+            TYPE: 1,
+
+            /**
+             * Function to execute, int constant
+             * @property FN
+             * @type int
+             * @static
+             * @final
+             */
+            FN: 2,
+
+            /**
+             * Function wrapped for scope correction and cleanup, int constant
+             * @property WFN
+             * @type int
+             * @static
+             * @final
+             */
+            WFN: 3,
+
+            /**
+             * Object passed in by the user that will be returned as a 
+             * parameter to the callback, int constant.  Specific to
+             * unload listeners
+             * @property OBJ
+             * @type int
+             * @static
+             * @final
+             */
+            UNLOAD_OBJ: 3,
+
+            /**
+             * Adjusted scope, either the element we are registering the event
+             * on or the custom object passed in by the listener, int constant
+             * @property ADJ_SCOPE
+             * @type int
+             * @static
+             * @final
+             */
+            ADJ_SCOPE: 4,
+
+            /**
+             * The original obj passed into addListener
+             * @property OBJ
+             * @type int
+             * @static
+             * @final
+             */
+            OBJ: 5,
+
+            /**
+             * The original scope parameter passed into addListener
+             * @property OVERRIDE
+             * @type int
+             * @static
+             * @final
+             */
+            OVERRIDE: 6,
+
+            /**
+             * The original capture parameter passed into _addListener
+             * @property CAPTURE
+             * @type int
+             * @static
+             * @final
+             */
+            CAPTURE: 7,
+
+
+            /**
+             * addListener/removeListener can throw errors in unexpected scenarios.
+             * These errors are suppressed, the method returns false, and this property
+             * is set
+             * @property lastError
+             * @static
+             * @type Error
+             */
+            lastError: null,
+
+            /**
+             * Safari detection
+             * @property isSafari
+             * @private
+             * @static
+             * @deprecated use YAHOO.env.ua.webkit
+             */
+            isSafari: YAHOO.env.ua.webkit,
+            
+            /**
+             * webkit version
+             * @property webkit
+             * @type string
+             * @private
+             * @static
+             * @deprecated use YAHOO.env.ua.webkit
+             */
+            webkit: YAHOO.env.ua.webkit,
+            
+            /**
+             * IE detection 
+             * @property isIE
+             * @private
+             * @static
+             * @deprecated use YAHOO.env.ua.ie
+             */
+            isIE: YAHOO.env.ua.ie,
+
+            /**
+             * poll handle
+             * @property _interval
+             * @static
+             * @private
+             */
+            _interval: null,
+
+            /**
+             * document readystate poll handle
+             * @property _dri
+             * @static
+             * @private
+             */
+             _dri: null,
+
+            /**
+             * True when the document is initially usable
+             * @property DOMReady
+             * @type boolean
+             * @static
+             */
+            DOMReady: false,
+
+            /**
+             * Errors thrown by subscribers of custom events are caught
+             * and the error message is written to the debug console.  If
+             * this property is set to true, it will also re-throw the
+             * error.
+             * @property throwErrors
+             * @type boolean
+             * @default false
+             */
+            throwErrors: false,
+
+            /**
+             * @method startInterval
+             * @static
+             * @private
+             */
+            startInterval: function() {
+                if (!this._interval) {
+                    var self = this;
+                    var callback = function() { self._tryPreloadAttach(); };
+                    this._interval = setInterval(callback, this.POLL_INTERVAL);
+                }
+            },
+
+            /**
+             * Executes the supplied callback when the item with the supplied
+             * id is found.  This is meant to be used to execute behavior as
+             * soon as possible as the page loads.  If you use this after the
+             * initial page load it will poll for a fixed time for the element.
+             * The number of times it will poll and the frequency are
+             * configurable.  By default it will poll for 10 seconds.
+             *
+             * <p>The callback is executed with a single parameter:
+             * the custom object parameter, if provided.</p>
+             *
+             * @method onAvailable
+             *
+             * @param {string||string[]}   p_id the id of the element, or an array
+             * of ids to look for.
+             * @param {function} p_fn what to execute when the element is found.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean|object}  p_override If set to true, p_fn will execute
+             *                   in the scope of p_obj, if set to an object it
+             *                   will execute in the scope of that object
+             * @param checkContent {boolean} check child node readiness (onContentReady)
+             * @static
+             */
+            onAvailable: function(p_id, p_fn, p_obj, p_override, checkContent) {
+
+                var a = (YAHOO.lang.isString(p_id)) ? [p_id] : p_id;
+
+                for (var i=0; i<a.length; i=i+1) {
+                    onAvailStack.push({id:         a[i], 
+                                       fn:         p_fn, 
+                                       obj:        p_obj, 
+                                       override:   p_override, 
+                                       checkReady: checkContent });
+                }
+
+                retryCount = this.POLL_RETRYS;
+
+                this.startInterval();
+            },
+
+            /**
+             * Works the same way as onAvailable, but additionally checks the
+             * state of sibling elements to determine if the content of the
+             * available element is safe to modify.
+             *
+             * <p>The callback is executed with a single parameter:
+             * the custom object parameter, if provided.</p>
+             *
+             * @method onContentReady
+             *
+             * @param {string}   p_id the id of the element to look for.
+             * @param {function} p_fn what to execute when the element is ready.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean|object}  p_override If set to true, p_fn will execute
+             *                   in the scope of p_obj.  If an object, p_fn will
+             *                   exectute in the scope of that object
+             *
+             * @static
+             */
+            onContentReady: function(p_id, p_fn, p_obj, p_override) {
+                this.onAvailable(p_id, p_fn, p_obj, p_override, true);
+            },
+
+            /**
+             * Executes the supplied callback when the DOM is first usable.  This
+             * will execute immediately if called after the DOMReady event has
+             * fired.   @todo the DOMContentReady event does not fire when the
+             * script is dynamically injected into the page.  This means the
+             * DOMReady custom event will never fire in FireFox or Opera when the
+             * library is injected.  It _will_ fire in Safari, and the IE 
+             * implementation would allow for us to fire it if the defered script
+             * is not available.  We want this to behave the same in all browsers.
+             * Is there a way to identify when the script has been injected 
+             * instead of included inline?  Is there a way to know whether the 
+             * window onload event has fired without having had a listener attached 
+             * to it when it did so?
+             *
+             * <p>The callback is a CustomEvent, so the signature is:</p>
+             * <p>type &lt;string&gt;, args &lt;array&gt;, customobject &lt;object&gt;</p>
+             * <p>For DOMReady events, there are no fire argments, so the
+             * signature is:</p>
+             * <p>"DOMReady", [], obj</p>
+             *
+             *
+             * @method onDOMReady
+             *
+             * @param {function} p_fn what to execute when the element is found.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean|object}  p_scope If set to true, p_fn will execute
+             *                   in the scope of p_obj, if set to an object it
+             *                   will execute in the scope of that object
+             *
+             * @static
+             */
+            onDOMReady: function(p_fn, p_obj, p_override) {
+                if (this.DOMReady) {
+                    setTimeout(function() {
+                        var s = window;
+                        if (p_override) {
+                            if (p_override === true) {
+                                s = p_obj;
+                            } else {
+                                s = p_override;
+                            }
+                        }
+                        p_fn.call(s, "DOMReady", [], p_obj);
+                    }, 0);
+                } else {
+                    this.DOMReadyEvent.subscribe(p_fn, p_obj, p_override);
+                }
+            },
+
+
+            /**
+             * Appends an event handler
+             *
+             * @method _addListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to assign the 
+             *  listener to.
+             * @param {String}   sType     The type of event to append
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   obj    An arbitrary object that will be 
+             *                             passed as a parameter to the handler
+             * @param {Boolean|object}  override  If true, the obj passed in becomes
+             *                             the execution scope of the listener. If an
+             *                             object, this object becomes the execution
+             *                             scope.
+             * @param {boolen}      capture capture or bubble phase
+             * @return {Boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements 
+             *                        could not have the listener attached,
+             *                        or if the operation throws an exception.
+             * @private
+             * @static
+             */
+            _addListener: function(el, sType, fn, obj, override, capture) {
+
+                if (!fn || !fn.call) {
+                    return false;
+                }
+
+                // The el argument can be an array of elements or element ids.
+                if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (var i=0,len=el.length; i<len; ++i) {
+                        ok = this._addListener(el[i], 
+                                       sType, 
+                                       fn, 
+                                       obj, 
+                                       override, 
+                                       capture) && ok;
+                    }
+                    return ok;
+
+                } else if (YAHOO.lang.isString(el)) {
+                    var oEl = this.getEl(el);
+                    // If the el argument is a string, we assume it is 
+                    // actually the id of the element.  If the page is loaded
+                    // we convert el to the actual element, otherwise we 
+                    // defer attaching the event until onload event fires
+
+                    // check to see if we need to delay hooking up the event 
+                    // until after the page loads.
+                    if (oEl) {
+                        el = oEl;
+                    } else {
+                        // defer adding the event until the element is available
+                        this.onAvailable(el, function() {
+                           YAHOO.util.Event._addListener(el, sType, fn, obj, override, capture);
+                        });
+
+                        return true;
+                    }
+                }
+
+                // Element should be an html element or an array if we get 
+                // here.
+                if (!el) {
+                    return false;
+                }
+
+                // we need to make sure we fire registered unload events 
+                // prior to automatically unhooking them.  So we hang on to 
+                // these instead of attaching them to the window and fire the
+                // handles explicitly during our one unload event.
+                if ("unload" == sType && obj !== this) {
+                    unloadListeners[unloadListeners.length] =
+                            [el, sType, fn, obj, override, capture];
+                    return true;
+                }
+
+
+                // if the user chooses to override the scope, we use the custom
+                // object passed in, otherwise the executing scope will be the
+                // HTML element that the event is registered on
+                var scope = el;
+                if (override) {
+                    if (override === true) {
+                        scope = obj;
+                    } else {
+                        scope = override;
+                    }
+                }
+
+                // wrap the function so we can return the obj object when
+                // the event fires;
+                var wrappedFn = function(e) {
+                        return fn.call(scope, YAHOO.util.Event.getEvent(e, el), 
+                                obj);
+                    };
+
+                var li = [el, sType, fn, wrappedFn, scope, obj, override, capture];
+                var index = listeners.length;
+                // cache the listener so we can try to automatically unload
+                listeners[index] = li;
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+
+                    // Add a new dom0 wrapper if one is not detected for this
+                    // element
+                    if ( legacyIndex == -1 || 
+                                el != legacyEvents[legacyIndex][0] ) {
+
+                        legacyIndex = legacyEvents.length;
+                        legacyMap[el.id + sType] = legacyIndex;
+
+                        // cache the signature for the DOM0 event, and 
+                        // include the existing handler for the event, if any
+                        legacyEvents[legacyIndex] = 
+                            [el, sType, el["on" + sType]];
+                        legacyHandlers[legacyIndex] = [];
+
+                        el["on" + sType] = 
+                            function(e) {
+                                YAHOO.util.Event.fireLegacyEvent(
+                                    YAHOO.util.Event.getEvent(e), legacyIndex);
+                            };
+                    }
+
+                    // add a reference to the wrapped listener to our custom
+                    // stack of events
+                    //legacyHandlers[legacyIndex].push(index);
+                    legacyHandlers[legacyIndex].push(li);
+
+                } else {
+                    try {
+                        this._simpleAdd(el, sType, wrappedFn, capture);
+                    } catch(ex) {
+                        // handle an error trying to attach an event.  If it fails
+                        // we need to clean up the cache
+                        this.lastError = ex;
+                        this._removeListener(el, sType, fn, capture);
+                        return false;
+                    }
+                }
+
+                return true;
+                
+            },
+
+
+            /**
+             * Appends an event handler
+             *
+             * @method addListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to assign the 
+             *  listener to.
+             * @param {String}   sType     The type of event to append
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   obj    An arbitrary object that will be 
+             *                             passed as a parameter to the handler
+             * @param {Boolean|object}  override  If true, the obj passed in becomes
+             *                             the execution scope of the listener. If an
+             *                             object, this object becomes the execution
+             *                             scope.
+             * @return {Boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements 
+             *                        could not have the listener attached,
+             *                        or if the operation throws an exception.
+             * @static
+             */
+            addListener: function (el, sType, fn, obj, override) {
+                return this._addListener(el, sType, fn, obj, override, false);
+            },
+
+            /**
+             * Appends a focus event handler.  (The focusin event is used for Internet Explorer, 
+             * the focus, capture-event for Opera, WebKit, and Gecko.)
+             *
+             * @method addFocusListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to assign the 
+             *  listener to.
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   obj    An arbitrary object that will be 
+             *                             passed as a parameter to the handler
+             * @param {Boolean|object}  override  If true, the obj passed in becomes
+             *                             the execution scope of the listener. If an
+             *                             object, this object becomes the execution
+             *                             scope.
+             * @return {Boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements 
+             *                        could not have the listener attached,
+             *                        or if the operation throws an exception.
+             * @static
+             */
+            addFocusListener: function (el, fn, obj, override) {
+                return this._addListener(el, _FOCUS, fn, obj, override, true);
+            },          
+
+
+            /**
+             * Removes a focus event listener
+             *
+             * @method removeFocusListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to remove
+             *  the listener from.
+             * @param {Function} fn the method the event invokes.  If fn is
+             *  undefined, then all event handlers for the type of event are 
+             *  removed.
+             * @return {boolean} true if the unbind was successful, false 
+             *  otherwise.
+             * @static
+             */
+            removeFocusListener: function (el, fn) { 
+                return this._removeListener(el, _FOCUS, fn, true);
+            },
+
+            /**
+             * Appends a blur event handler.  (The focusout event is used for Internet Explorer, 
+             * the focusout, capture-event for Opera, WebKit, and Gecko.)
+             *
+             * @method addBlurListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to assign the 
+             *  listener to.
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   obj    An arbitrary object that will be 
+             *                             passed as a parameter to the handler
+             * @param {Boolean|object}  override  If true, the obj passed in becomes
+             *                             the execution scope of the listener. If an
+             *                             object, this object becomes the execution
+             *                             scope.
+             * @return {Boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements 
+             *                        could not have the listener attached,
+             *                        or if the operation throws an exception.
+             * @static
+             */
+            addBlurListener: function (el, fn, obj, override) {
+                return this._addListener(el, _BLUR, fn, obj, override, true);
+            },          
+
+            /**
+             * Removes a blur event listener
+             *
+             * @method removeBlurListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to remove
+             *  the listener from.
+             * @param {Function} fn the method the event invokes.  If fn is
+             *  undefined, then all event handlers for the type of event are 
+             *  removed.
+             * @return {boolean} true if the unbind was successful, false 
+             *  otherwise.
+             * @static
+             */
+            removeBlurListener: function (el, fn) { 
+            
+                return this._removeListener(el, _BLUR, fn, true);
+            
+            },
+
+            /**
+             * When using legacy events, the handler is routed to this object
+             * so we can fire our custom listener stack.
+             * @method fireLegacyEvent
+             * @static
+             * @private
+             */
+            fireLegacyEvent: function(e, legacyIndex) {
+                var ok=true, le, lh, li, scope, ret;
+                
+                lh = legacyHandlers[legacyIndex].slice();
+                for (var i=0, len=lh.length; i<len; ++i) {
+                // for (var i in lh.length) {
+                    li = lh[i];
+                    if ( li && li[this.WFN] ) {
+                        scope = li[this.ADJ_SCOPE];
+                        ret = li[this.WFN].call(scope, e);
+                        ok = (ok && ret);
+                    }
+                }
+
+                // Fire the original handler if we replaced one.  We fire this
+                // after the other events to keep stopPropagation/preventDefault
+                // that happened in the DOM0 handler from touching our DOM2
+                // substitute
+                le = legacyEvents[legacyIndex];
+                if (le && le[2]) {
+                    le[2](e);
+                }
+                
+                return ok;
+            },
+
+            /**
+             * Returns the legacy event index that matches the supplied 
+             * signature
+             * @method getLegacyIndex
+             * @static
+             * @private
+             */
+            getLegacyIndex: function(el, sType) {
+                var key = this.generateId(el) + sType;
+                if (typeof legacyMap[key] == "undefined") { 
+                    return -1;
+                } else {
+                    return legacyMap[key];
+                }
+            },
+
+            /**
+             * Logic that determines when we should automatically use legacy
+             * events instead of DOM2 events.  Currently this is limited to old
+             * Safari browsers with a broken preventDefault
+             * @method useLegacyEvent
+             * @static
+             * @private
+             */
+            useLegacyEvent: function(el, sType) {
+return (this.webkit && this.webkit < 419 && ("click"==sType || "dblclick"==sType));
+            },
+                    
+            /**
+             * Removes an event listener
+             *
+             * @method _removeListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to remove
+             *  the listener from.
+             * @param {String} sType the type of event to remove.
+             * @param {Function} fn the method the event invokes.  If fn is
+             *  undefined, then all event handlers for the type of event are 
+             *  removed.
+             * @param {boolen}      capture capture or bubble phase             
+             * @return {boolean} true if the unbind was successful, false 
+             *  otherwise.
+             * @static
+             * @private
+             */
+            _removeListener: function(el, sType, fn, capture) {
+                var i, len, li;
+
+                // The el argument can be a string
+                if (typeof el == "string") {
+                    el = this.getEl(el);
+                // The el argument can be an array of elements or element ids.
+                } else if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (i=el.length-1; i>-1; i--) {
+                        ok = ( this._removeListener(el[i], sType, fn, capture) && ok );
+                    }
+                    return ok;
+                }
+
+                if (!fn || !fn.call) {
+                    //return false;
+                    return this.purgeElement(el, false, sType);
+                }
+
+                if ("unload" == sType) {
+
+                    for (i=unloadListeners.length-1; i>-1; i--) {
+                        li = unloadListeners[i];
+                        if (li && 
+                            li[0] == el && 
+                            li[1] == sType && 
+                            li[2] == fn) {
+                                unloadListeners.splice(i, 1);
+                                // unloadListeners[i]=null;
+                                return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                var cacheItem = null;
+
+                // The index is a hidden parameter; needed to remove it from
+                // the method signature because it was tempting users to
+                // try and take advantage of it, which is not possible.
+                var index = arguments[4];
+  
+                if ("undefined" === typeof index) {
+                    index = this._getCacheIndex(el, sType, fn);
+                }
+
+                if (index >= 0) {
+                    cacheItem = listeners[index];
+                }
+
+                if (!el || !cacheItem) {
+                    return false;
+                }
+
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+                    var llist = legacyHandlers[legacyIndex];
+                    if (llist) {
+                        for (i=0, len=llist.length; i<len; ++i) {
+                        // for (i in llist.length) {
+                            li = llist[i];
+                            if (li && 
+                                li[this.EL] == el && 
+                                li[this.TYPE] == sType && 
+                                li[this.FN] == fn) {
+                                    llist.splice(i, 1);
+                                    // llist[i]=null;
+                                    break;
+                            }
+                        }
+                    }
+
+                } else {
+                    try {
+                        this._simpleRemove(el, sType, cacheItem[this.WFN], capture);
+                    } catch(ex) {
+                        this.lastError = ex;
+                        return false;
+                    }
+                }
+
+                // removed the wrapped handler
+                delete listeners[index][this.WFN];
+                delete listeners[index][this.FN];
+                listeners.splice(index, 1);
+                // listeners[index]=null;
+
+                return true;
+
+            },
+
+
+            /**
+             * Removes an event listener
+             *
+             * @method removeListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to remove
+             *  the listener from.
+             * @param {String} sType the type of event to remove.
+             * @param {Function} fn the method the event invokes.  If fn is
+             *  undefined, then all event handlers for the type of event are 
+             *  removed.
+             * @return {boolean} true if the unbind was successful, false 
+             *  otherwise.
+             * @static
+             */
+            removeListener: function(el, sType, fn) {
+
+				return this._removeListener(el, sType, fn, false);
+
+            },
+
+
+            /**
+             * Returns the event's target element.  Safari sometimes provides
+             * a text node, and this is automatically resolved to the text
+             * node's parent so that it behaves like other browsers.
+             * @method getTarget
+             * @param {Event} ev the event
+             * @param {boolean} resolveTextNode when set to true the target's
+             *                  parent will be returned if the target is a 
+             *                  text node.  @deprecated, the text node is
+             *                  now resolved automatically
+             * @return {HTMLElement} the event's target
+             * @static
+             */
+            getTarget: function(ev, resolveTextNode) {
+                var t = ev.target || ev.srcElement;
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * In some cases, some browsers will return a text node inside
+             * the actual element that was targeted.  This normalizes the
+             * return value for getTarget and getRelatedTarget.
+             * @method resolveTextNode
+             * @param {HTMLElement} node node to resolve
+             * @return {HTMLElement} the normized node
+             * @static
+             */
+            resolveTextNode: function(n) {
+                try {
+                    if (n && 3 == n.nodeType) {
+                        return n.parentNode;
+                    }
+                } catch(e) { }
+
+                return n;
+            },
+
+            /**
+             * Returns the event's pageX
+             * @method getPageX
+             * @param {Event} ev the event
+             * @return {int} the event's pageX
+             * @static
+             */
+            getPageX: function(ev) {
+                var x = ev.pageX;
+                if (!x && 0 !== x) {
+                    x = ev.clientX || 0;
+
+                    if ( this.isIE ) {
+                        x += this._getScrollLeft();
+                    }
+                }
+
+                return x;
+            },
+
+            /**
+             * Returns the event's pageY
+             * @method getPageY
+             * @param {Event} ev the event
+             * @return {int} the event's pageY
+             * @static
+             */
+            getPageY: function(ev) {
+                var y = ev.pageY;
+                if (!y && 0 !== y) {
+                    y = ev.clientY || 0;
+
+                    if ( this.isIE ) {
+                        y += this._getScrollTop();
+                    }
+                }
+
+
+                return y;
+            },
+
+            /**
+             * Returns the pageX and pageY properties as an indexed array.
+             * @method getXY
+             * @param {Event} ev the event
+             * @return {[x, y]} the pageX and pageY properties of the event
+             * @static
+             */
+            getXY: function(ev) {
+                return [this.getPageX(ev), this.getPageY(ev)];
+            },
+
+            /**
+             * Returns the event's related target 
+             * @method getRelatedTarget
+             * @param {Event} ev the event
+             * @return {HTMLElement} the event's relatedTarget
+             * @static
+             */
+            getRelatedTarget: function(ev) {
+                var t = ev.relatedTarget;
+                if (!t) {
+                    if (ev.type == "mouseout") {
+                        t = ev.toElement;
+                    } else if (ev.type == "mouseover") {
+                        t = ev.fromElement;
+                    }
+                }
+
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * Returns the time of the event.  If the time is not included, the
+             * event is modified using the current time.
+             * @method getTime
+             * @param {Event} ev the event
+             * @return {Date} the time of the event
+             * @static
+             */
+            getTime: function(ev) {
+                if (!ev.time) {
+                    var t = new Date().getTime();
+                    try {
+                        ev.time = t;
+                    } catch(ex) { 
+                        this.lastError = ex;
+                        return t;
+                    }
+                }
+
+                return ev.time;
+            },
+
+            /**
+             * Convenience method for stopPropagation + preventDefault
+             * @method stopEvent
+             * @param {Event} ev the event
+             * @static
+             */
+            stopEvent: function(ev) {
+                this.stopPropagation(ev);
+                this.preventDefault(ev);
+            },
+
+            /**
+             * Stops event propagation
+             * @method stopPropagation
+             * @param {Event} ev the event
+             * @static
+             */
+            stopPropagation: function(ev) {
+                if (ev.stopPropagation) {
+                    ev.stopPropagation();
+                } else {
+                    ev.cancelBubble = true;
+                }
+            },
+
+            /**
+             * Prevents the default behavior of the event
+             * @method preventDefault
+             * @param {Event} ev the event
+             * @static
+             */
+            preventDefault: function(ev) {
+                if (ev.preventDefault) {
+                    ev.preventDefault();
+                } else {
+                    ev.returnValue = false;
+                }
+            },
+             
+            /**
+             * Finds the event in the window object, the caller's arguments, or
+             * in the arguments of another method in the callstack.  This is
+             * executed automatically for events registered through the event
+             * manager, so the implementer should not normally need to execute
+             * this function at all.
+             * @method getEvent
+             * @param {Event} e the event parameter from the handler
+             * @param {HTMLElement} boundEl the element the listener is attached to
+             * @return {Event} the event 
+             * @static
+             */
+            getEvent: function(e, boundEl) {
+                var ev = e || window.event;
+
+                if (!ev) {
+                    var c = this.getEvent.caller;
+                    while (c) {
+                        ev = c.arguments[0];
+                        if (ev && Event == ev.constructor) {
+                            break;
+                        }
+                        c = c.caller;
+                    }
+                }
+
+                return ev;
+            },
+
+            /**
+             * Returns the charcode for an event
+             * @method getCharCode
+             * @param {Event} ev the event
+             * @return {int} the event's charCode
+             * @static
+             */
+            getCharCode: function(ev) {
+                var code = ev.keyCode || ev.charCode || 0;
+
+                // webkit key normalization
+                if (YAHOO.env.ua.webkit && (code in webkitKeymap)) {
+                    code = webkitKeymap[code];
+                }
+                return code;
+            },
+
+            /**
+             * Locating the saved event handler data by function ref
+             *
+             * @method _getCacheIndex
+             * @static
+             * @private
+             */
+            _getCacheIndex: function(el, sType, fn) {
+                for (var i=0, l=listeners.length; i<l; i=i+1) {
+                    var li = listeners[i];
+                    if ( li                 && 
+                         li[this.FN] == fn  && 
+                         li[this.EL] == el  && 
+                         li[this.TYPE] == sType ) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            },
+
+            /**
+             * Generates an unique ID for the element if it does not already 
+             * have one.
+             * @method generateId
+             * @param el the element to create the id for
+             * @return {string} the resulting id of the element
+             * @static
+             */
+            generateId: function(el) {
+                var id = el.id;
+
+                if (!id) {
+                    id = "yuievtautoid-" + counter;
+                    ++counter;
+                    el.id = id;
+                }
+
+                return id;
+            },
+
+
+            /**
+             * We want to be able to use getElementsByTagName as a collection
+             * to attach a group of events to.  Unfortunately, different 
+             * browsers return different types of collections.  This function
+             * tests to determine if the object is array-like.  It will also 
+             * fail if the object is an array, but is empty.
+             * @method _isValidCollection
+             * @param o the object to test
+             * @return {boolean} true if the object is array-like and populated
+             * @static
+             * @private
+             */
+            _isValidCollection: function(o) {
+                try {
+                    return ( o                     && // o is something
+                             typeof o !== "string" && // o is not a string
+                             o.length              && // o is indexed
+                             !o.tagName            && // o is not an HTML element
+                             !o.alert              && // o is not a window
+                             typeof o[0] !== "undefined" );
+                } catch(ex) {
+                    return false;
+                }
+
+            },
+
+            /**
+             * @private
+             * @property elCache
+             * DOM element cache
+             * @static
+             * @deprecated Elements are not cached due to issues that arise when
+             * elements are removed and re-added
+             */
+            elCache: {},
+
+            /**
+             * We cache elements bound by id because when the unload event 
+             * fires, we can no longer use document.getElementById
+             * @method getEl
+             * @static
+             * @private
+             * @deprecated Elements are not cached any longer
+             */
+            getEl: function(id) {
+                return (typeof id === "string") ? document.getElementById(id) : id;
+            },
+
+            /**
+             * Clears the element cache
+             * @deprecated Elements are not cached any longer
+             * @method clearCache
+             * @static
+             * @private
+             */
+            clearCache: function() { },
+
+            /**
+             * Custom event the fires when the dom is initially usable
+             * @event DOMReadyEvent
+             */
+            DOMReadyEvent: new YAHOO.util.CustomEvent("DOMReady", this),
+
+            /**
+             * hook up any deferred listeners
+             * @method _load
+             * @static
+             * @private
+             */
+            _load: function(e) {
+
+                if (!loadComplete) {
+                    loadComplete = true;
+                    var EU = YAHOO.util.Event;
+
+                    // Just in case DOMReady did not go off for some reason
+                    EU._ready();
+
+                    // Available elements may not have been detected before the
+                    // window load event fires. Try to find them now so that the
+                    // the user is more likely to get the onAvailable notifications
+                    // before the window load notification
+                    EU._tryPreloadAttach();
+
+                }
+            },
+
+            /**
+             * Fires the DOMReady event listeners the first time the document is
+             * usable.
+             * @method _ready
+             * @static
+             * @private
+             */
+            _ready: function(e) {
+                var EU = YAHOO.util.Event;
+                if (!EU.DOMReady) {
+                    EU.DOMReady=true;
+
+                    // Fire the content ready custom event
+                    EU.DOMReadyEvent.fire();
+
+                    // Remove the DOMContentLoaded (FF/Opera)
+                    EU._simpleRemove(document, "DOMContentLoaded", EU._ready);
+                }
+            },
+
+            /**
+             * Polling function that runs before the onload event fires, 
+             * attempting to attach to DOM Nodes as soon as they are 
+             * available
+             * @method _tryPreloadAttach
+             * @static
+             * @private
+             */
+            _tryPreloadAttach: function() {
+
+                if (onAvailStack.length === 0) {
+                    retryCount = 0;
+                    clearInterval(this._interval);
+                    this._interval = null;
+                    return;
+                }
+
+                if (this.locked) {
+                    return;
+                }
+
+                if (this.isIE) {
+                    // Hold off if DOMReady has not fired and check current
+                    // readyState to protect against the IE operation aborted
+                    // issue.
+                    if (!this.DOMReady) {
+                        this.startInterval();
+                        return;
+                    }
+                }
+
+                this.locked = true;
+
+
+                // keep trying until after the page is loaded.  We need to 
+                // check the page load state prior to trying to bind the 
+                // elements so that we can be certain all elements have been 
+                // tested appropriately
+                var tryAgain = !loadComplete;
+                if (!tryAgain) {
+                    tryAgain = (retryCount > 0 && onAvailStack.length > 0);
+                }
+
+                // onAvailable
+                var notAvail = [];
+
+                var executeItem = function (el, item) {
+                    var scope = el;
+                    if (item.override) {
+                        if (item.override === true) {
+                            scope = item.obj;
+                        } else {
+                            scope = item.override;
+                        }
+                    }
+                    item.fn.call(scope, item.obj);
+                };
+
+                var i, len, item, el, ready=[];
+
+                // onAvailable onContentReady
+                for (i=0, len=onAvailStack.length; i<len; i=i+1) {
+                    item = onAvailStack[i];
+                    if (item) {
+                        el = this.getEl(item.id);
+                        if (el) {
+                            if (item.checkReady) {
+                                if (loadComplete || el.nextSibling || !tryAgain) {
+                                    ready.push(item);
+                                    onAvailStack[i] = null;
+                                }
+                            } else {
+                                executeItem(el, item);
+                                onAvailStack[i] = null;
+                            }
+                        } else {
+                            notAvail.push(item);
+                        }
+                    }
+                }
+                
+                // make sure onContentReady fires after onAvailable
+                for (i=0, len=ready.length; i<len; i=i+1) {
+                    item = ready[i];
+                    executeItem(this.getEl(item.id), item);
+                }
+
+
+                retryCount--;
+
+                if (tryAgain) {
+                    for (i=onAvailStack.length-1; i>-1; i--) {
+                        item = onAvailStack[i];
+                        if (!item || !item.id) {
+                            onAvailStack.splice(i, 1);
+                        }
+                    }
+
+                    this.startInterval();
+                } else {
+                    clearInterval(this._interval);
+                    this._interval = null;
+                }
+
+                this.locked = false;
+
+            },
+
+            /**
+             * Removes all listeners attached to the given element via addListener.
+             * Optionally, the node's children can also be purged.
+             * Optionally, you can specify a specific type of event to remove.
+             * @method purgeElement
+             * @param {HTMLElement} el the element to purge
+             * @param {boolean} recurse recursively purge this element's children
+             * as well.  Use with caution.
+             * @param {string} sType optional type of listener to purge. If
+             * left out, all listeners will be removed
+             * @static
+             */
+            purgeElement: function(el, recurse, sType) {
+                var oEl = (YAHOO.lang.isString(el)) ? this.getEl(el) : el;
+                var elListeners = this.getListeners(oEl, sType), i, len;
+                if (elListeners) {
+                    for (i=elListeners.length-1; i>-1; i--) {
+                        var l = elListeners[i];
+                        this._removeListener(oEl, l.type, l.fn, l.capture);
+                    }
+                }
+
+                if (recurse && oEl && oEl.childNodes) {
+                    for (i=0,len=oEl.childNodes.length; i<len ; ++i) {
+                        this.purgeElement(oEl.childNodes[i], recurse, sType);
+                    }
+                }
+            },
+
+            /**
+             * Returns all listeners attached to the given element via addListener.
+             * Optionally, you can specify a specific type of event to return.
+             * @method getListeners
+             * @param el {HTMLElement|string} the element or element id to inspect 
+             * @param sType {string} optional type of listener to return. If
+             * left out, all listeners will be returned
+             * @return {Object} the listener. Contains the following fields:
+             * &nbsp;&nbsp;type:   (string)   the type of event
+             * &nbsp;&nbsp;fn:     (function) the callback supplied to addListener
+             * &nbsp;&nbsp;obj:    (object)   the custom object supplied to addListener
+             * &nbsp;&nbsp;adjust: (boolean|object)  whether or not to adjust the default scope
+             * &nbsp;&nbsp;scope: (boolean)  the derived scope based on the adjust parameter
+             * &nbsp;&nbsp;scope: (capture)  the capture parameter supplied to addListener
+             * &nbsp;&nbsp;index:  (int)      its position in the Event util listener cache
+             * @static
+             */           
+            getListeners: function(el, sType) {
+                var results=[], searchLists;
+                if (!sType) {
+                    searchLists = [listeners, unloadListeners];
+                } else if (sType === "unload") {
+                    searchLists = [unloadListeners];
+                } else {
+                    searchLists = [listeners];
+                }
+
+                var oEl = (YAHOO.lang.isString(el)) ? this.getEl(el) : el;
+
+                for (var j=0;j<searchLists.length; j=j+1) {
+                    var searchList = searchLists[j];
+                    if (searchList) {
+                        for (var i=0,len=searchList.length; i<len ; ++i) {
+                            var l = searchList[i];
+                            if ( l  && l[this.EL] === oEl && 
+                                    (!sType || sType === l[this.TYPE]) ) {
+                                results.push({
+                                    type:   l[this.TYPE],
+                                    fn:     l[this.FN],
+                                    obj:    l[this.OBJ],
+                                    adjust: l[this.OVERRIDE],
+                                    scope:  l[this.ADJ_SCOPE],
+                                    capture:  l[this.CAPTURE],                                    
+                                    index:  i
+                                });
+                            }
+                        }
+                    }
+                }
+
+                return (results.length) ? results : null;
+            },
+
+            /**
+             * Removes all listeners registered by pe.event.  Called 
+             * automatically during the unload event.
+             * @method _unload
+             * @static
+             * @private
+             */
+            _unload: function(e) {
+
+                var EU = YAHOO.util.Event, i, j, l, len, index,
+                         ul = unloadListeners.slice();
+
+                // execute and clear stored unload listeners
+                for (i=0,len=unloadListeners.length; i<len; ++i) {
+                    l = ul[i];
+                    if (l) {
+                        var scope = window;
+                        if (l[EU.ADJ_SCOPE]) {
+                            if (l[EU.ADJ_SCOPE] === true) {
+                                scope = l[EU.UNLOAD_OBJ];
+                            } else {
+                                scope = l[EU.ADJ_SCOPE];
+                            }
+                        }
+                        l[EU.FN].call(scope, EU.getEvent(e, l[EU.EL]), l[EU.UNLOAD_OBJ] );
+                        ul[i] = null;
+                        l=null;
+                        scope=null;
+                    }
+                }
+
+                unloadListeners = null;
+
+                // Remove listeners to handle IE memory leaks
+                //if (YAHOO.env.ua.ie && listeners && listeners.length > 0) {
+                
+                // 2.5.0 listeners are removed for all browsers again.  FireFox preserves
+                // at least some listeners between page refreshes, potentially causing
+                // errors during page load (mouseover listeners firing before they
+                // should if the user moves the mouse at the correct moment).
+                if (listeners) {
+                    for (j=listeners.length-1; j>-1; j--) {
+                        l = listeners[j];
+                        if (l) {
+                            EU._removeListener(l[EU.EL], l[EU.TYPE], l[EU.FN], l[EU.CAPTURE], j);
+                        } 
+                    }
+                    l=null;
+                }
+
+                legacyEvents = null;
+
+                EU._simpleRemove(window, "unload", EU._unload);
+
+            },
+
+            /**
+             * Returns scrollLeft
+             * @method _getScrollLeft
+             * @static
+             * @private
+             */
+            _getScrollLeft: function() {
+                return this._getScroll()[1];
+            },
+
+            /**
+             * Returns scrollTop
+             * @method _getScrollTop
+             * @static
+             * @private
+             */
+            _getScrollTop: function() {
+                return this._getScroll()[0];
+            },
+
+            /**
+             * Returns the scrollTop and scrollLeft.  Used to calculate the 
+             * pageX and pageY in Internet Explorer
+             * @method _getScroll
+             * @static
+             * @private
+             */
+            _getScroll: function() {
+                var dd = document.documentElement, db = document.body;
+                if (dd && (dd.scrollTop || dd.scrollLeft)) {
+                    return [dd.scrollTop, dd.scrollLeft];
+                } else if (db) {
+                    return [db.scrollTop, db.scrollLeft];
+                } else {
+                    return [0, 0];
+                }
+            },
+            
+            /**
+             * Used by old versions of CustomEvent, restored for backwards
+             * compatibility
+             * @method regCE
+             * @private
+             * @static
+             * @deprecated still here for backwards compatibility
+             */
+            regCE: function() {
+                // does nothing
+            },
+
+            /**
+             * Adds a DOM event directly without the caching, cleanup, scope adj, etc
+             *
+             * @method _simpleAdd
+             * @param {HTMLElement} el      the element to bind the handler to
+             * @param {string}      sType   the type of event handler
+             * @param {function}    fn      the callback to invoke
+             * @param {boolen}      capture capture or bubble phase
+             * @static
+             * @private
+             */
+            _simpleAdd: function () {
+                if (window.addEventListener) {
+                    return function(el, sType, fn, capture) {
+                        el.addEventListener(sType, fn, (capture));
+                    };
+                } else if (window.attachEvent) {
+                    return function(el, sType, fn, capture) {
+                        el.attachEvent("on" + sType, fn);
+                    };
+                } else {
+                    return function(){};
+                }
+            }(),
+
+            /**
+             * Basic remove listener
+             *
+             * @method _simpleRemove
+             * @param {HTMLElement} el      the element to bind the handler to
+             * @param {string}      sType   the type of event handler
+             * @param {function}    fn      the callback to invoke
+             * @param {boolen}      capture capture or bubble phase
+             * @static
+             * @private
+             */
+            _simpleRemove: function() {
+                if (window.removeEventListener) {
+                    return function (el, sType, fn, capture) {
+                        el.removeEventListener(sType, fn, (capture));
+                    };
+                } else if (window.detachEvent) {
+                    return function (el, sType, fn) {
+                        el.detachEvent("on" + sType, fn);
+                    };
+                } else {
+                    return function(){};
+                }
+            }()
+        };
+
+    }();
+
+    (function() {
+        var EU = YAHOO.util.Event;
+
+        /**
+         * YAHOO.util.Event.on is an alias for addListener
+         * @method on
+         * @see addListener
+         * @static
+         */
+        EU.on = EU.addListener;
+
+        /**
+         * YAHOO.util.Event.onFocus is an alias for addFocusListener
+         * @method on
+         * @see addFocusListener
+         * @static
+         */
+        EU.onFocus = EU.addFocusListener;
+
+        /**
+         * YAHOO.util.Event.onBlur is an alias for addBlurListener
+         * @method onBlur
+         * @see addBlurListener
+         * @static
+         */     
+        EU.onBlur = EU.addBlurListener;
+
+
+/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
+
+        // Internet Explorer: use the readyState of a defered script.
+        // This isolates what appears to be a safe moment to manipulate
+        // the DOM prior to when the document's readyState suggests
+        // it is safe to do so.
+        if (EU.isIE) {
+
+            // Process onAvailable/onContentReady items when the 
+            // DOM is ready.
+            YAHOO.util.Event.onDOMReady(
+                    YAHOO.util.Event._tryPreloadAttach,
+                    YAHOO.util.Event, true);
+            
+            var n = document.createElement('p');  
+
+            EU._dri = setInterval(function() {
+                try {
+                    // throws an error if doc is not ready
+                    n.doScroll('left');
+                    clearInterval(EU._dri);
+                    EU._dri = null;
+                    EU._ready();
+                    n = null;
+                } catch (ex) { 
+                }
+            }, EU.POLL_INTERVAL); 
+
+        
+        // The document's readyState in Safari currently will
+        // change to loaded/complete before images are loaded.
+        } else if (EU.webkit && EU.webkit < 525) {
+
+            EU._dri = setInterval(function() {
+                var rs=document.readyState;
+                if ("loaded" == rs || "complete" == rs) {
+                    clearInterval(EU._dri);
+                    EU._dri = null;
+                    EU._ready();
+                }
+            }, EU.POLL_INTERVAL); 
+
+        // FireFox and Opera: These browsers provide a event for this
+        // moment.  The latest WebKit releases now support this event.
+        } else {
+
+            EU._simpleAdd(document, "DOMContentLoaded", EU._ready);
+
+        }
+        /////////////////////////////////////////////////////////////
+
+
+        EU._simpleAdd(window, "load", EU._load);
+        EU._simpleAdd(window, "unload", EU._unload);
+        EU._tryPreloadAttach();
+    })();
+
+}
+/**
+ * EventProvider is designed to be used with YAHOO.augment to wrap 
+ * CustomEvents in an interface that allows events to be subscribed to 
+ * and fired by name.  This makes it possible for implementing code to
+ * subscribe to an event that either has not been created yet, or will
+ * not be created at all.
+ *
+ * @Class EventProvider
+ */
+YAHOO.util.EventProvider = function() { };
+
+YAHOO.util.EventProvider.prototype = {
+
+    /**
+     * Private storage of custom events
+     * @property __yui_events
+     * @type Object[]
+     * @private
+     */
+    __yui_events: null,
+
+    /**
+     * Private storage of custom event subscribers
+     * @property __yui_subscribers
+     * @type Object[]
+     * @private
+     */
+    __yui_subscribers: null,
+    
+    /**
+     * Subscribe to a CustomEvent by event type
+     *
+     * @method subscribe
+     * @param p_type     {string}   the type, or name of the event
+     * @param p_fn       {function} the function to exectute when the event fires
+     * @param p_obj      {Object}   An object to be passed along when the event 
+     *                              fires
+     * @param p_override {boolean}  If true, the obj passed in becomes the 
+     *                              execution scope of the listener
+     */
+    subscribe: function(p_type, p_fn, p_obj, p_override) {
+
+        this.__yui_events = this.__yui_events || {};
+        var ce = this.__yui_events[p_type];
+
+        if (ce) {
+            ce.subscribe(p_fn, p_obj, p_override);
+        } else {
+            this.__yui_subscribers = this.__yui_subscribers || {};
+            var subs = this.__yui_subscribers;
+            if (!subs[p_type]) {
+                subs[p_type] = [];
+            }
+            subs[p_type].push(
+                { fn: p_fn, obj: p_obj, override: p_override } );
+        }
+    },
+
+    /**
+     * Unsubscribes one or more listeners the from the specified event
+     * @method unsubscribe
+     * @param p_type {string}   The type, or name of the event.  If the type
+     *                          is not specified, it will attempt to remove
+     *                          the listener from all hosted events.
+     * @param p_fn   {Function} The subscribed function to unsubscribe, if not
+     *                          supplied, all subscribers will be removed.
+     * @param p_obj  {Object}   The custom object passed to subscribe.  This is
+     *                        optional, but if supplied will be used to
+     *                        disambiguate multiple listeners that are the same
+     *                        (e.g., you subscribe many object using a function
+     *                        that lives on the prototype)
+     * @return {boolean} true if the subscriber was found and detached.
+     */
+    unsubscribe: function(p_type, p_fn, p_obj) {
+        this.__yui_events = this.__yui_events || {};
+        var evts = this.__yui_events;
+        if (p_type) {
+            var ce = evts[p_type];
+            if (ce) {
+                return ce.unsubscribe(p_fn, p_obj);
+            }
+        } else {
+            var ret = true;
+            for (var i in evts) {
+                if (YAHOO.lang.hasOwnProperty(evts, i)) {
+                    ret = ret && evts[i].unsubscribe(p_fn, p_obj);
+                }
+            }
+            return ret;
+        }
+
+        return false;
+    },
+    
+    /**
+     * Removes all listeners from the specified event.  If the event type
+     * is not specified, all listeners from all hosted custom events will
+     * be removed.
+     * @method unsubscribeAll
+     * @param p_type {string}   The type, or name of the event
+     */
+    unsubscribeAll: function(p_type) {
+        return this.unsubscribe(p_type);
+    },
+
+    /**
+     * Creates a new custom event of the specified type.  If a custom event
+     * by that name already exists, it will not be re-created.  In either
+     * case the custom event is returned. 
+     *
+     * @method createEvent
+     *
+     * @param p_type {string} the type, or name of the event
+     * @param p_config {object} optional config params.  Valid properties are:
+     *
+     *  <ul>
+     *    <li>
+     *      scope: defines the default execution scope.  If not defined
+     *      the default scope will be this instance.
+     *    </li>
+     *    <li>
+     *      silent: if true, the custom event will not generate log messages.
+     *      This is false by default.
+     *    </li>
+     *    <li>
+     *      onSubscribeCallback: specifies a callback to execute when the
+     *      event has a new subscriber.  This will fire immediately for
+     *      each queued subscriber if any exist prior to the creation of
+     *      the event.
+     *    </li>
+     *  </ul>
+     *
+     *  @return {CustomEvent} the custom event
+     *
+     */
+    createEvent: function(p_type, p_config) {
+
+        this.__yui_events = this.__yui_events || {};
+        var opts = p_config || {};
+        var events = this.__yui_events;
+
+        if (events[p_type]) {
+        } else {
+
+            var scope  = opts.scope  || this;
+            var silent = (opts.silent);
+
+            var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
+                    YAHOO.util.CustomEvent.FLAT);
+            events[p_type] = ce;
+
+            if (opts.onSubscribeCallback) {
+                ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
+            }
+
+            this.__yui_subscribers = this.__yui_subscribers || {};
+            var qs = this.__yui_subscribers[p_type];
+
+            if (qs) {
+                for (var i=0; i<qs.length; ++i) {
+                    ce.subscribe(qs[i].fn, qs[i].obj, qs[i].override);
+                }
+            }
+        }
+
+        return events[p_type];
+    },
+
+
+   /**
+     * Fire a custom event by name.  The callback functions will be executed
+     * from the scope specified when the event was created, and with the 
+     * following parameters:
+     *   <ul>
+     *   <li>The first argument fire() was executed with</li>
+     *   <li>The custom object (if any) that was passed into the subscribe() 
+     *       method</li>
+     *   </ul>
+     * @method fireEvent
+     * @param p_type    {string}  the type, or name of the event
+     * @param arguments {Object*} an arbitrary set of parameters to pass to 
+     *                            the handler.
+     * @return {boolean} the return value from CustomEvent.fire
+     *                   
+     */
+    fireEvent: function(p_type, arg1, arg2, etc) {
+
+        this.__yui_events = this.__yui_events || {};
+        var ce = this.__yui_events[p_type];
+
+        if (!ce) {
+            return null;
+        }
+
+        var args = [];
+        for (var i=1; i<arguments.length; ++i) {
+            args.push(arguments[i]);
+        }
+        return ce.fire.apply(ce, args);
+    },
+
+    /**
+     * Returns true if the custom event of the provided type has been created
+     * with createEvent.
+     * @method hasEvent
+     * @param type {string} the type, or name of the event
+     */
+    hasEvent: function(type) {
+        if (this.__yui_events) {
+            if (this.__yui_events[type]) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+};
+
+//@TODO optimize
+//@TODO use event utility, lang abstractions
+//@TODO replace
+
+/**
+* KeyListener is a utility that provides an easy interface for listening for
+* keydown/keyup events fired against DOM elements.
+* @namespace YAHOO.util
+* @class KeyListener
+* @constructor
+* @param {HTMLElement} attachTo The element or element ID to which the key 
+*                               event should be attached
+* @param {String}      attachTo The element or element ID to which the key
+*                               event should be attached
+* @param {Object}      keyData  The object literal representing the key(s) 
+*                               to detect. Possible attributes are 
+*                               shift(boolean), alt(boolean), ctrl(boolean) 
+*                               and keys(either an int or an array of ints 
+*                               representing keycodes).
+* @param {Function}    handler  The CustomEvent handler to fire when the 
+*                               key event is detected
+* @param {Object}      handler  An object literal representing the handler. 
+* @param {String}      event    Optional. The event (keydown or keyup) to 
+*                               listen for. Defaults automatically to keydown.
+*
+* @knownissue the "keypress" event is completely broken in Safari 2.x and below.
+*             the workaround is use "keydown" for key listening.  However, if
+*             it is desired to prevent the default behavior of the keystroke,
+*             that can only be done on the keypress event.  This makes key
+*             handling quite ugly.
+* @knownissue keydown is also broken in Safari 2.x and below for the ESC key.
+*             There currently is no workaround other than choosing another
+*             key to listen for.
+*/
+YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {
+    if (!attachTo) {
+    } else if (!keyData) {
+    } else if (!handler) {
+    } 
+    
+    if (!event) {
+        event = YAHOO.util.KeyListener.KEYDOWN;
+    }
+
+    /**
+    * The CustomEvent fired internally when a key is pressed
+    * @event keyEvent
+    * @private
+    * @param {Object} keyData The object literal representing the key(s) to 
+    *                         detect. Possible attributes are shift(boolean), 
+    *                         alt(boolean), ctrl(boolean) and keys(either an 
+    *                         int or an array of ints representing keycodes).
+    */
+    var keyEvent = new YAHOO.util.CustomEvent("keyPressed");
+    
+    /**
+    * The CustomEvent fired when the KeyListener is enabled via the enable() 
+    * function
+    * @event enabledEvent
+    * @param {Object} keyData The object literal representing the key(s) to 
+    *                         detect. Possible attributes are shift(boolean), 
+    *                         alt(boolean), ctrl(boolean) and keys(either an 
+    *                         int or an array of ints representing keycodes).
+    */
+    this.enabledEvent = new YAHOO.util.CustomEvent("enabled");
+
+    /**
+    * The CustomEvent fired when the KeyListener is disabled via the 
+    * disable() function
+    * @event disabledEvent
+    * @param {Object} keyData The object literal representing the key(s) to 
+    *                         detect. Possible attributes are shift(boolean), 
+    *                         alt(boolean), ctrl(boolean) and keys(either an 
+    *                         int or an array of ints representing keycodes).
+    */
+    this.disabledEvent = new YAHOO.util.CustomEvent("disabled");
+
+    if (typeof attachTo == 'string') {
+        attachTo = document.getElementById(attachTo);
+    }
+
+    if (typeof handler == 'function') {
+        keyEvent.subscribe(handler);
+    } else {
+        keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);
+    }
+
+    /**
+    * Handles the key event when a key is pressed.
+    * @method handleKeyPress
+    * @param {DOMEvent} e   The keypress DOM event
+    * @param {Object}   obj The DOM event scope object
+    * @private
+    */
+    function handleKeyPress(e, obj) {
+        if (! keyData.shift) {  
+            keyData.shift = false; 
+        }
+        if (! keyData.alt) {    
+            keyData.alt = false;
+        }
+        if (! keyData.ctrl) {
+            keyData.ctrl = false;
+        }
+
+        // check held down modifying keys first
+        if (e.shiftKey == keyData.shift && 
+            e.altKey   == keyData.alt &&
+            e.ctrlKey  == keyData.ctrl) { // if we pass this, all modifiers match
+            
+            var dataItem;
+
+            if (keyData.keys instanceof Array) {
+                for (var i=0;i<keyData.keys.length;i++) {
+                    dataItem = keyData.keys[i];
+
+                    if (dataItem == e.charCode ) {
+                        keyEvent.fire(e.charCode, e);
+                        break;
+                    } else if (dataItem == e.keyCode) {
+                        keyEvent.fire(e.keyCode, e);
+                        break;
+                    }
+                }
+            } else {
+                dataItem = keyData.keys;
+                if (dataItem == e.charCode ) {
+                    keyEvent.fire(e.charCode, e);
+                } else if (dataItem == e.keyCode) {
+                    keyEvent.fire(e.keyCode, e);
+                }
+            }
+        }
+    }
+
+    /**
+    * Enables the KeyListener by attaching the DOM event listeners to the 
+    * target DOM element
+    * @method enable
+    */
+    this.enable = function() {
+        if (! this.enabled) {
+            YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);
+            this.enabledEvent.fire(keyData);
+        }
+        /**
+        * Boolean indicating the enabled/disabled state of the Tooltip
+        * @property enabled
+        * @type Boolean
+        */
+        this.enabled = true;
+    };
+
+    /**
+    * Disables the KeyListener by removing the DOM event listeners from the 
+    * target DOM element
+    * @method disable
+    */
+    this.disable = function() {
+        if (this.enabled) {
+            YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);
+            this.disabledEvent.fire(keyData);
+        }
+        this.enabled = false;
+    };
+
+    /**
+    * Returns a String representation of the object.
+    * @method toString
+    * @return {String}  The string representation of the KeyListener
+    */ 
+    this.toString = function() {
+        return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + 
+                (attachTo.id ? "[" + attachTo.id + "]" : "");
+    };
+
+};
+
+/**
+ * Constant representing the DOM "keydown" event.
+ * @property YAHOO.util.KeyListener.KEYDOWN
+ * @static
+ * @final
+ * @type String
+ */
+YAHOO.util.KeyListener.KEYDOWN = "keydown";
+
+/**
+ * Constant representing the DOM "keyup" event.
+ * @property YAHOO.util.KeyListener.KEYUP
+ * @static
+ * @final
+ * @type String
+ */
+YAHOO.util.KeyListener.KEYUP = "keyup";
+
+/**
+ * keycode constants for a subset of the special keys
+ * @property KEY
+ * @static
+ * @final
+ */
+YAHOO.util.KeyListener.KEY = {
+    ALT          : 18,
+    BACK_SPACE   : 8,
+    CAPS_LOCK    : 20,
+    CONTROL      : 17,
+    DELETE       : 46,
+    DOWN         : 40,
+    END          : 35,
+    ENTER        : 13,
+    ESCAPE       : 27,
+    HOME         : 36,
+    LEFT         : 37,
+    META         : 224,
+    NUM_LOCK     : 144,
+    PAGE_DOWN    : 34,
+    PAGE_UP      : 33, 
+    PAUSE        : 19,
+    PRINTSCREEN  : 44,
+    RIGHT        : 39,
+    SCROLL_LOCK  : 145,
+    SHIFT        : 16,
+    SPACE        : 32,
+    TAB          : 9,
+    UP           : 38
+};
+YAHOO.register("event", YAHOO.util.Event, {version: "2.6.0", build: "1321"});
diff --git a/lib/yui-selector.js b/lib/yui-selector.js
new file mode 100644
index 0000000..db222b5
--- /dev/null
+++ b/lib/yui-selector.js
@@ -0,0 +1,666 @@
+/*
+Copyright (c) 2008, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.6.0
+*/
+/**
+ * The selector module provides helper methods allowing CSS3 Selectors to be used with DOM elements.
+ * @module selector
+ * @title Selector Utility
+ * @namespace YAHOO.util
+ * @requires yahoo, dom
+ */
+
+(function() {
+/**
+ * Provides helper methods for collecting and filtering DOM elements.
+ * @namespace YAHOO.util
+ * @class Selector
+ * @static
+ */
+var Selector = function() {};
+
+var Y = YAHOO.util;
+
+var reNth = /^(?:([-]?\d*)(n){1}|(odd|even)$)*([-+]?\d*)$/;
+
+Selector.prototype = {
+    /**
+     * Default document for use queries 
+     * @property document
+     * @type object
+     * @default window.document
+     */
+    document: window.document,
+    /**
+     * Mapping of attributes to aliases, normally to work around HTMLAttributes
+     * that conflict with JS reserved words.
+     * @property attrAliases
+     * @type object
+     */
+    attrAliases: {
+    },
+
+    /**
+     * Mapping of shorthand tokens to corresponding attribute selector 
+     * @property shorthand
+     * @type object
+     */
+    shorthand: {
+        //'(?:(?:[^\\)\\]\\s*>+~,]+)(?:-?[_a-z]+[-\\w]))+#(-?[_a-z]+[-\\w]*)': '[id=$1]',
+        '\\#(-?[_a-z]+[-\\w]*)': '[id=$1]',
+        '\\.(-?[_a-z]+[-\\w]*)': '[class~=$1]'
+    },
+
+    /**
+     * List of operators and corresponding boolean functions. 
+     * These functions are passed the attribute and the current node's value of the attribute.
+     * @property operators
+     * @type object
+     */
+    operators: {
+        '=': function(attr, val) { return attr === val; }, // Equality
+        '!=': function(attr, val) { return attr !== val; }, // Inequality
+        '~=': function(attr, val) { // Match one of space seperated words 
+            var s = ' ';
+            return (s + attr + s).indexOf((s + val + s)) > -1;
+        },
+        '|=': function(attr, val) { return getRegExp('^' + val + '[-]?').test(attr); }, // Match start with value followed by optional hyphen
+        '^=': function(attr, val) { return attr.indexOf(val) === 0; }, // Match starts with value
+        '$=': function(attr, val) { return attr.lastIndexOf(val) === attr.length - val.length; }, // Match ends with value
+        '*=': function(attr, val) { return attr.indexOf(val) > -1; }, // Match contains value as substring 
+        '': function(attr, val) { return attr; } // Just test for existence of attribute
+    },
+
+    /**
+     * List of pseudo-classes and corresponding boolean functions. 
+     * These functions are called with the current node, and any value that was parsed with the pseudo regex.
+     * @property pseudos
+     * @type object
+     */
+    pseudos: {
+        'root': function(node) {
+            return node === node.ownerDocument.documentElement;
+        },
+
+        'nth-child': function(node, val) {
+            return getNth(node, val);
+        },
+
+        'nth-last-child': function(node, val) {
+            return getNth(node, val, null, true);
+        },
+
+        'nth-of-type': function(node, val) {
+            return getNth(node, val, node.tagName);
+        },
+         
+        'nth-last-of-type': function(node, val) {
+            return getNth(node, val, node.tagName, true);
+        },
+         
+        'first-child': function(node) {
+            return getChildren(node.parentNode)[0] === node;
+        },
+
+        'last-child': function(node) {
+            var children = getChildren(node.parentNode);
+            return children[children.length - 1] === node;
+        },
+
+        'first-of-type': function(node, val) {
+            return getChildren(node.parentNode, node.tagName.toLowerCase())[0];
+        },
+         
+        'last-of-type': function(node, val) {
+            var children = getChildren(node.parentNode, node.tagName.toLowerCase());
+            return children[children.length - 1];
+        },
+         
+        'only-child': function(node) {
+            var children = getChildren(node.parentNode);
+            return children.length === 1 && children[0] === node;
+        },
+
+        'only-of-type': function(node) {
+            return getChildren(node.parentNode, node.tagName.toLowerCase()).length === 1;
+        },
+
+        'empty': function(node) {
+            return node.childNodes.length === 0;
+        },
+
+        'not': function(node, simple) {
+            return !Selector.test(node, simple);
+        },
+
+        'contains': function(node, str) {
+            var text = node.innerText || node.textContent || '';
+            return text.indexOf(str) > -1;
+        },
+        'checked': function(node) {
+            return node.checked === true;
+        }
+    },
+
+    /**
+     * Test if the supplied node matches the supplied selector.
+     * @method test
+     *
+     * @param {HTMLElement | String} node An id or node reference to the HTMLElement being tested.
+     * @param {string} selector The CSS Selector to test the node against.
+     * @return{boolean} Whether or not the node matches the selector.
+     * @static
+    
+     */
+    test: function(node, selector) {
+        node = Selector.document.getElementById(node) || node;
+
+        if (!node) {
+            return false;
+        }
+
+        var groups = selector ? selector.split(',') : [];
+        if (groups.length) {
+            for (var i = 0, len = groups.length; i < len; ++i) {
+                if ( rTestNode(node, groups[i]) ) { // passes if ANY group matches
+                    return true;
+                }
+            }
+            return false;
+        }
+        return rTestNode(node, selector);
+    },
+
+    /**
+     * Filters a set of nodes based on a given CSS selector. 
+     * @method filter
+     *
+     * @param {array} nodes A set of nodes/ids to filter. 
+     * @param {string} selector The selector used to test each node.
+     * @return{array} An array of nodes from the supplied array that match the given selector.
+     * @static
+     */
+    filter: function(nodes, selector) {
+        nodes = nodes || [];
+
+        var node,
+            result = [],
+            tokens = tokenize(selector);
+
+        if (!nodes.item) { // if not HTMLCollection, handle arrays of ids and/or nodes
+            for (var i = 0, len = nodes.length; i < len; ++i) {
+                if (!nodes[i].tagName) { // tagName limits to HTMLElements 
+                    node = Selector.document.getElementById(nodes[i]);
+                    if (node) { // skip IDs that return null 
+                        nodes[i] = node;
+                    } else {
+                    }
+                }
+            }
+        }
+        result = rFilter(nodes, tokenize(selector)[0]);
+        clearParentCache();
+        return result;
+    },
+
+    /**
+     * Retrieves a set of nodes based on a given CSS selector. 
+     * @method query
+     *
+     * @param {string} selector The CSS Selector to test the node against.
+     * @param {HTMLElement | String} root optional An id or HTMLElement to start the query from. Defaults to Selector.document.
+     * @param {Boolean} firstOnly optional Whether or not to return only the first match.
+     * @return {Array} An array of nodes that match the given selector.
+     * @static
+     */
+    query: function(selector, root, firstOnly) {
+        var result = query(selector, root, firstOnly);
+        return result;
+    }
+};
+
+var query = function(selector, root, firstOnly, deDupe) {
+    var result =  (firstOnly) ? null : [];
+    if (!selector) {
+        return result;
+    }
+
+    var groups = selector.split(','); // TODO: handle comma in attribute/pseudo
+
+    if (groups.length > 1) {
+        var found;
+        for (var i = 0, len = groups.length; i < len; ++i) {
+            found = arguments.callee(groups[i], root, firstOnly, true);
+            result = firstOnly ? found : result.concat(found); 
+        }
+        clearFoundCache();
+        return result;
+    }
+
+    if (root && !root.nodeName) { // assume ID
+        root = Selector.document.getElementById(root);
+        if (!root) {
+            return result;
+        }
+    }
+
+    root = root || Selector.document;
+    var tokens = tokenize(selector);
+    var idToken = tokens[getIdTokenIndex(tokens)],
+        nodes = [],
+        node,
+        id,
+        token = tokens.pop() || {};
+        
+    if (idToken) {
+        id = getId(idToken.attributes);
+    }
+
+    // use id shortcut when possible
+    if (id) {
+        node = Selector.document.getElementById(id);
+
+        if (node && (root.nodeName == '#document' || contains(node, root))) {
+            if ( rTestNode(node, null, idToken) ) {
+                if (idToken === token) {
+                    nodes = [node]; // simple selector
+                } else {
+                    root = node; // start from here
+                }
+            }
+        } else {
+            return result;
+        }
+    }
+
+    if (root && !nodes.length) {
+        nodes = root.getElementsByTagName(token.tag);
+    }
+
+    if (nodes.length) {
+        result = rFilter(nodes, token, firstOnly, deDupe); 
+    }
+
+    clearParentCache();
+    return result;
+};
+
+var contains = function() {
+    if (document.documentElement.contains && !YAHOO.env.ua.webkit < 422)  { // IE & Opera, Safari < 3 contains is broken
+        return function(needle, haystack) {
+            return haystack.contains(needle);
+        };
+    } else if ( document.documentElement.compareDocumentPosition ) { // gecko
+        return function(needle, haystack) {
+            return !!(haystack.compareDocumentPosition(needle) & 16);
+        };
+    } else  { // Safari < 3
+        return function(needle, haystack) {
+            var parent = needle.parentNode;
+            while (parent) {
+                if (needle === parent) {
+                    return true;
+                }
+                parent = parent.parentNode;
+            } 
+            return false;
+        }; 
+    }
+}();
+
+var rFilter = function(nodes, token, firstOnly, deDupe) {
+    var result = firstOnly ? null : [];
+
+    for (var i = 0, len = nodes.length; i < len; i++) {
+        if (! rTestNode(nodes[i], '', token, deDupe)) {
+            continue;
+        }
+
+        if (firstOnly) {
+            return nodes[i];
+        }
+        if (deDupe) {
+            if (nodes[i]._found) {
+                continue;
+            }
+            nodes[i]._found = true;
+            foundCache[foundCache.length] = nodes[i];
+        }
+
+        result[result.length] = nodes[i];
+    }
+
+    return result;
+};
+
+var rTestNode = function(node, selector, token, deDupe) {
+    token = token || tokenize(selector).pop() || {};
+
+    if (!node.tagName ||
+        (token.tag !== '*' && node.tagName.toUpperCase() !== token.tag) ||
+        (deDupe && node._found) ) {
+        return false;
+    }
+
+    if (token.attributes.length) {
+        var attribute;
+        for (var i = 0, len = token.attributes.length; i < len; ++i) {
+            attribute = node.getAttribute(token.attributes[i][0], 2);
+            if (attribute === null || attribute === undefined) {
+                return false;
+            }
+            if ( Selector.operators[token.attributes[i][1]] &&
+                    !Selector.operators[token.attributes[i][1]](attribute, token.attributes[i][2])) {
+                return false;
+            }
+        }
+    }
+
+    if (token.pseudos.length) {
+        for (var i = 0, len = token.pseudos.length; i < len; ++i) {
+            if (Selector.pseudos[token.pseudos[i][0]] &&
+                    !Selector.pseudos[token.pseudos[i][0]](node, token.pseudos[i][1])) {
+                return false;
+            }
+        }
+    }
+
+    return (token.previous && token.previous.combinator !== ',') ?
+            combinators[token.previous.combinator](node, token) :
+            true;
+};
+
+
+var foundCache = [];
+var parentCache = [];
+var regexCache = {};
+
+var clearFoundCache = function() {
+    for (var i = 0, len = foundCache.length; i < len; ++i) {
+        try { // IE no like delete
+            delete foundCache[i]._found;
+        } catch(e) {
+            foundCache[i].removeAttribute('_found');
+        }
+    }
+    foundCache = [];
+};
+
+var clearParentCache = function() {
+    if (!document.documentElement.children) { // caching children lookups for gecko
+        return function() {
+            for (var i = 0, len = parentCache.length; i < len; ++i) {
+                delete parentCache[i]._children;
+            }
+            parentCache = [];
+        };
+    } else return function() {}; // do nothing
+}();
+
+var getRegExp = function(str, flags) {
+    flags = flags || '';
+    if (!regexCache[str + flags]) {
+        regexCache[str + flags] = new RegExp(str, flags);
+    }
+    return regexCache[str + flags];
+};
+
+var combinators = {
+    ' ': function(node, token) {
+        while (node = node.parentNode) {
+            if (rTestNode(node, '', token.previous)) {
+                return true;
+            }
+        }  
+        return false;
+    },
+
+    '>': function(node, token) {
+        return rTestNode(node.parentNode, null, token.previous);
+    },
+
+    '+': function(node, token) {
+        var sib = node.previousSibling;
+        while (sib && sib.nodeType !== 1) {
+            sib = sib.previousSibling;
+        }
+
+        if (sib && rTestNode(sib, null, token.previous)) {
+            return true; 
+        }
+        return false;
+    },
+
+    '~': function(node, token) {
+        var sib = node.previousSibling;
+        while (sib) {
+            if (sib.nodeType === 1 && rTestNode(sib, null, token.previous)) {
+                return true;
+            }
+            sib = sib.previousSibling;
+        }
+
+        return false;
+    }
+};
+
+var getChildren = function() {
+    if (document.documentElement.children) { // document for capability test
+        return function(node, tag) {
+            return (tag) ? node.children.tags(tag) : node.children || [];
+        };
+    } else {
+        return function(node, tag) {
+            if (node._children) {
+                return node._children;
+            }
+            var children = [],
+                childNodes = node.childNodes;
+
+            for (var i = 0, len = childNodes.length; i < len; ++i) {
+                if (childNodes[i].tagName) {
+                    if (!tag || childNodes[i].tagName.toLowerCase() === tag) {
+                        children[children.length] = childNodes[i];
+                    }
+                }
+            }
+            node._children = children;
+            parentCache[parentCache.length] = node;
+            return children;
+        };
+    }
+}();
+
+/*
+    an+b = get every _a_th node starting at the _b_th
+    0n+b = no repeat ("0" and "n" may both be omitted (together) , e.g. "0n+1" or "1", not "0+1"), return only the _b_th element
+    1n+b =  get every element starting from b ("1" may may be omitted, e.g. "1n+0" or "n+0" or "n")
+    an+0 = get every _a_th element, "0" may be omitted 
+*/
+var getNth = function(node, expr, tag, reverse) {
+    if (tag) tag = tag.toLowerCase();
+    reNth.test(expr);
+    var a = parseInt(RegExp.$1, 10), // include every _a_ elements (zero means no repeat, just first _a_)
+        n = RegExp.$2, // "n"
+        oddeven = RegExp.$3, // "odd" or "even"
+        b = parseInt(RegExp.$4, 10) || 0, // start scan from element _b_
+        result = [];
+
+    var siblings = getChildren(node.parentNode, tag);
+
+    if (oddeven) {
+        a = 2; // always every other
+        op = '+';
+        n = 'n';
+        b = (oddeven === 'odd') ? 1 : 0;
+    } else if ( isNaN(a) ) {
+        a = (n) ? 1 : 0; // start from the first or no repeat
+    }
+
+    if (a === 0) { // just the first
+        if (reverse) {
+            b = siblings.length - b + 1; 
+        }
+
+        if (siblings[b - 1] === node) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (a < 0) {
+        reverse = !!reverse;
+        a = Math.abs(a);
+    }
+
+    if (!reverse) {
+        for (var i = b - 1, len = siblings.length; i < len; i += a) {
+            if ( i >= 0 && siblings[i] === node ) {
+                return true;
+            }
+        }
+    } else {
+        for (var i = siblings.length - b, len = siblings.length; i >= 0; i -= a) {
+            if ( i < len && siblings[i] === node ) {
+                return true;
+            }
+        }
+    }
+    return false;
+};
+
+var getId = function(attr) {
+    for (var i = 0, len = attr.length; i < len; ++i) {
+        if (attr[i][0] == 'id' && attr[i][1] === '=') {
+            return attr[i][2];
+        }
+    }
+};
+
+var getIdTokenIndex = function(tokens) {
+    for (var i = 0, len = tokens.length; i < len; ++i) {
+        if (getId(tokens[i].attributes)) {
+            return i;
+        }
+    }
+    return -1;
+};
+
+var patterns = {
+    tag: /^((?:-?[_a-z]+[\w-]*)|\*)/i,
+    attributes: /^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,
+    //attributes: /^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^'"\]]*)['"]?\]*/i,
+    pseudos: /^:([-\w]+)(?:\(['"]?(.+)['"]?\))*/i,
+    combinator: /^\s*([>+~]|\s)\s*/
+};
+
+/**
+    Break selector into token units per simple selector.
+    Combinator is attached to left-hand selector.
+ */
+var tokenize = function(selector) {
+    var token = {},     // one token per simple selector (left selector holds combinator)
+        tokens = [],    // array of tokens
+        id,             // unique id for the simple selector (if found)
+        found = false,  // whether or not any matches were found this pass
+        match;          // the regex match
+
+    selector = replaceShorthand(selector); // convert ID and CLASS shortcuts to attributes
+
+    /*
+        Search for selector patterns, store, and strip them from the selector string
+        until no patterns match (invalid selector) or we run out of chars.
+
+        Multiple attributes and pseudos are allowed, in any order.
+        for example:
+            'form:first-child[type=button]:not(button)[lang|=en]'
+    */
+    do {
+        found = false; // reset after full pass
+        for (var re in patterns) {
+                if (!YAHOO.lang.hasOwnProperty(patterns, re)) {
+                    continue;
+                }
+                if (re != 'tag' && re != 'combinator') { // only one allowed
+                    token[re] = token[re] || [];
+                }
+            if (match = patterns[re].exec(selector)) { // note assignment
+                found = true;
+                if (re != 'tag' && re != 'combinator') { // only one allowed
+                    //token[re] = token[re] || [];
+
+                    // capture ID for fast path to element
+                    if (re === 'attributes' && match[1] === 'id') {
+                        token.id = match[3];
+                    }
+
+                    token[re].push(match.slice(1));
+                } else { // single selector (tag, combinator)
+                    token[re] = match[1];
+                }
+                selector = selector.replace(match[0], ''); // strip current match from selector
+                if (re === 'combinator' || !selector.length) { // next token or done
+                    token.attributes = fixAttributes(token.attributes);
+                    token.pseudos = token.pseudos || [];
+                    token.tag = token.tag ? token.tag.toUpperCase() : '*';
+                    tokens.push(token);
+
+                    token = { // prep next token
+                        previous: token
+                    };
+                }
+            }
+        }
+    } while (found);
+
+    return tokens;
+};
+
+var fixAttributes = function(attr) {
+    var aliases = Selector.attrAliases;
+    attr = attr || [];
+    for (var i = 0, len = attr.length; i < len; ++i) {
+        if (aliases[attr[i][0]]) { // convert reserved words, etc
+            attr[i][0] = aliases[attr[i][0]];
+        }
+        if (!attr[i][1]) { // use exists operator
+            attr[i][1] = '';
+        }
+    }
+    return attr;
+};
+
+var replaceShorthand = function(selector) {
+    var shorthand = Selector.shorthand;
+    var attrs = selector.match(patterns.attributes); // pull attributes to avoid false pos on "." and "#"
+    if (attrs) {
+        selector = selector.replace(patterns.attributes, 'REPLACED_ATTRIBUTE');
+    }
+    for (var re in shorthand) {
+        if (!YAHOO.lang.hasOwnProperty(shorthand, re)) {
+            continue;
+        }
+        selector = selector.replace(getRegExp(re, 'gi'), shorthand[re]);
+    }
+
+    if (attrs) {
+        for (var i = 0, len = attrs.length; i < len; ++i) {
+            selector = selector.replace('REPLACED_ATTRIBUTE', attrs[i]);
+        }
+    }
+    return selector;
+};
+
+Selector = new Selector();
+Selector.patterns = patterns;
+Y.Selector = Selector;
+
+if (YAHOO.env.ua.ie) { // rewrite class for IE (others use getAttribute('class')
+    Y.Selector.attrAliases['class'] = 'className';
+    Y.Selector.attrAliases['for'] = 'htmlFor';
+}
+
+})();
+YAHOO.register("selector", YAHOO.util.Selector, {version: "2.6.0", build: "1321"});
diff --git a/pngfix.js b/pngfix.js
new file mode 100644
index 0000000..ec211d1
--- /dev/null
+++ b/pngfix.js
@@ -0,0 +1,28 @@
+
+var arVersion = navigator.appVersion.split("MSIE")
+var version = parseFloat(arVersion[1])
+
+if ((version >= 5.5) && (document.body.filters)) 
+{
+   for(var i=0; i<document.images.length; i++)
+   {
+      var img = document.images[i]
+      var imgName = img.src.toUpperCase()
+      if (imgName.indexOf('.PNG') > -1)
+      {
+         var imgID = (img.id) ? "id='" + img.id + "' " : ""
+         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
+         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
+         var imgStyle = "display:inline-block;" + img.style.cssText 
+         if (img.align == "left") imgStyle = "float:left;" + imgStyle
+         if (img.align == "right") imgStyle = "float:right;" + imgStyle
+         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
+         var strNewHTML = "<span " + imgID + imgClass + imgTitle
+         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
+         img.outerHTML = strNewHTML
+         i = i-1
+      }
+   }
+}
\ No newline at end of file
diff --git a/reset.css b/reset.css
new file mode 100644
index 0000000..4a3cf94
--- /dev/null
+++ b/reset.css
@@ -0,0 +1,38 @@
+/* -------------------------------------------------------------- 
+  
+   reset.css
+   * Resets default browser CSS.
+   
+   Based on work by Eric Meyer:
+   * meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
+   
+-------------------------------------------------------------- */
+
+html, body, div, span, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, code,
+del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	font-weight: inherit;
+	font-style: inherit;
+	font-size: 100%;
+	font-family: inherit;
+	vertical-align: baseline;
+}
+
+
+body { line-height: 1.5; background: #fff; margin:1.5em 0; }
+
+/* Tables still need 'cellspacing="0"' in the markup. */
+caption, th, td { text-align: left; font-weight:400; }
+
+/* Remove possible quote marks (") from <q>, <blockquote>. */
+blockquote:before, blockquote:after, q:before, q:after { content: ""; }
+blockquote, q { quotes: "" ""; }
+
+a img { border: none; }
+
diff --git a/store.php b/store.php
new file mode 100644
index 0000000..3d38074
--- /dev/null
+++ b/store.php
@@ -0,0 +1,58 @@
+<?php
+
+	$server = 'mysql.dromaeo.com';
+	$user = 'dromaeo';
+	$pass = 'dromaeo';
+
+	require('JSON.php');
+
+	$json = new Services_JSON();
+        $sql = mysql_connect( $server, $user, $pass );
+
+        mysql_select_db( 'dromaeo' );
+
+	$id = str_replace(';', "", $_REQUEST['id']);
+
+	if ( $id ) {
+		$sets = array();
+		$ids = split(",", $id);
+
+		foreach ($ids as $i) {
+			$query = mysql_query( "SELECT * FROM runs WHERE id=$i;" );
+			$data = mysql_fetch_assoc($query);
+	
+			$query = mysql_query( "SELECT * FROM results WHERE run_id=$i;" );
+			$results = array();
+		
+			while ( $row = mysql_fetch_assoc($query) ) {
+				array_push($results, $row);
+			}
+
+			$data['results'] = $results;
+			$data['ip'] = '';
+
+			array_push($sets, $data);
+		}
+
+		echo $json->encode($sets);
+	} else {
+		$data = $json->decode(str_replace('\\"', '"', $_REQUEST['data']));
+
+		if ( $data ) {
+		mysql_query( sprintf("INSERT into runs VALUES(NULL,'%s','%s',NOW(),'%s');",
+			$_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR'], str_replace(';', "", $_REQUEST['style'])) );
+
+		$id = mysql_insert_id();
+
+		if ( $id ) {
+
+		foreach ($data as $row) {
+			mysql_query( sprintf("INSERT into results VALUES(NULL,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');",
+				$id, $row->collection, $row->version, $row->name, $row->scale, $row->median, $row->min, $row->max, $row->mean, $row->deviation, $row->runs) );
+		}
+
+		echo $id;
+		}
+		}
+	}
+?>
diff --git a/test-head.html b/test-head.html
new file mode 100644
index 0000000..481251c
--- /dev/null
+++ b/test-head.html
@@ -0,0 +1,4 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
diff --git a/test-head.js b/test-head.js
new file mode 100644
index 0000000..9839f99
--- /dev/null
+++ b/test-head.js
@@ -0,0 +1,2 @@
+(function(){
+
diff --git a/test-tail.html b/test-tail.html
new file mode 100644
index 0000000..1b4431b
--- /dev/null
+++ b/test-tail.html
@@ -0,0 +1,4 @@
+</script>
+</head>
+<body></body>
+</html>
diff --git a/test-tail.js b/test-tail.js
new file mode 100644
index 0000000..0319a0f
--- /dev/null
+++ b/test-tail.js
@@ -0,0 +1 @@
+})();
diff --git a/tests/MANIFEST.json b/tests/MANIFEST.json
new file mode 100644
index 0000000..24d6376
--- /dev/null
+++ b/tests/MANIFEST.json
@@ -0,0 +1,442 @@
+{
+"dromaeo-3d-cube": {
+	file: "dromaeo-3d-cube.html",
+	name: "Rotating 3D Cube",
+	origin: ["Simon Speich", "http://www.speich.net/computer/moztesting/3d.htm"],
+	desc: "Rotating the individual pixels of a cube. No rendering done.",
+	category: "Dromaeo JavaScript Tests",
+	tags: ["object", "array", "property", "math"]
+},
+"dromaeo-string-base64": {
+	file: "dromaeo-string-base64.html",
+	name: "Base 64 Encoding and Decoding",
+	origin: ["Mozilla", "http://mozilla.org/"],
+	desc: "Encode and decode a random string to base 64.",
+	category: "Dromaeo JavaScript Tests",
+	tags: ["string","array","looping","bitops"]
+},
+"dromaeo-core-eval": {
+	file: "dromaeo-core-eval.html",
+	name: "Code Evaluation",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Microtests of code evaluation (eval, new Function).",
+	category: "Dromaeo JavaScript Tests",
+	tags: ["eval","microtest"]
+},
+"dromaeo-object-array": {
+	file: "dromaeo-object-array.html",
+	name: "Arrays",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Microtests of arrays (construction, methods, access).",
+	category: "Dromaeo JavaScript Tests",
+	tags: ["array","microtest"]
+},
+"dromaeo-object-regexp": {
+	file: "dromaeo-object-regexp.html",
+	name: "Regular Expressions",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Microtests of regular expressions (construction, matching, replace).",
+	category: "Dromaeo JavaScript Tests",
+	tags: ["regexp","microtest"]
+},
+"dromaeo-object-string": {
+	file: "dromaeo-object-string.html",
+	name: "Strings",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Microtests of strings (concatenation, methods).",
+	category: "Dromaeo JavaScript Tests",
+	tags: ["string","microtest"]
+},
+"v8-crypto": {
+	file: "v8-crypto.html",
+	name: "RSA Encryption/Decryption",
+	origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
+	desc: "Encrypt a string and then decrypt it again using RSA.",
+	category: "V8 Benchmark Tests",
+	tags: ["looping","string","bitops"]
+},
+"v8-deltablue": {
+	file: "v8-deltablue.html",
+	name: "DeltaBlue Constraint Solving",
+	origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
+	desc: "Computing a number of limitations on a set of values.",
+	category: "V8 Benchmark Tests",
+	tags: ["looping","functions"]
+},
+"v8-earley-boyer": {
+	file: "v8-earley-boyer.html",
+	name: "String Parsing and Searching",
+	origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
+	desc: "Tests for parsing languages and searching strings.",
+	category: "V8 Benchmark Tests",
+	tags: ["looping","functions","string"]
+},
+"v8-raytrace": {
+	file: "v8-raytrace.html",
+	name: "RayTracer",
+	origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
+	desc: "Renders a scene using raytracing (no rendering done).",
+	category: "V8 Benchmark Tests",
+	tags: ["looping","functions","object"]
+},
+"v8-richards": {
+	file: "v8-richards.html",
+	name: "Richards Benchmarks",
+	origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
+	desc: "A series of benchmarks to test the quality of system implementation languages.",
+	category: "V8 Benchmark Tests",
+	tags: ["functions","object"]
+},
+"sunspider-3d-morph": {
+	file: "sunspider-3d-morph.html",
+	name: "3D Mesh Transformation",
+	origin: ["WebKit", "http://webkit.org/misc/morph.html"],
+	desc: "Transforming the points of a matrix. No visual output.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["array", "looping", "math"]
+},
+"sunspider-3d-raytrace": {
+	file: "sunspider-3d-raytrace.html",
+	name: "3D Raytrace",
+	origin: ["Apple", "http://apple.com/"],
+	desc: "Rendering a scene using raytracing techniques. No visual output.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["array", "functions", "math"]
+},
+"sunspider-access-binary-trees": {
+	file: "sunspider-access-binary-trees.html",
+	name: "Traversing Binary Trees",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Moving through an object representation of a binary tree.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["object", "recursion"]
+},
+"sunspider-access-fannkuch": {
+	file: "sunspider-access-fannkuch.html",
+	name: "Fannkuch",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Figure out the number of ways in which a set of numbers can be manipulated.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["array", "looping"]
+},
+"sunspider-access-nbody": {
+	file: "sunspider-access-nbody.html",
+	name: "N-Body Rotation and Gravity",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Compute the location of multiple planets based upon rotation and gravity.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["object", "property", "looping", "math"]
+},
+"sunspider-access-nsieve": {
+	file: "sunspider-access-nsieve.html",
+	name: "Prime Number Computation",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Compute the number of prime numbers in a specific range of numbers.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping", "array"]
+},
+"sunspider-bitops-3bit-bits-in-byte": {
+	file: "sunspider-bitops-3bit-bits-in-byte.html",
+	name: "Compute Bits in Byte",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Compute the number of bits in a number using bitops.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping", "bitops"]
+},
+"sunspider-bitops-bits-in-byte": {
+	file: "sunspider-bitops-bits-in-byte.html",
+	name: "Compute Bits in Byte (2)",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Compute the number of bits in a number using bitops.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping", "bitops"]
+},
+"sunspider-bitops-bitwise-and": {
+	file: "sunspider-bitops-bitwise-and.html",
+	name: "Bitwise And",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Compute a number by using a series of 'and' bit operations.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping", "bitops"]
+},
+"sunspider-bitops-nsieve-bits": {
+	file: "sunspider-bitops-nsieve-bits.html",
+	name: "Prime Number Computation (2)",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Compute the number of prime numbers in a specific range of numbers using bit operations.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping", "bitops", "array"]
+},
+"sunspider-controlflow-recursive": {
+	file: "sunspider-controlflow-recursive.html",
+	name: "Recursive Number Calculation",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Compute various numbers in a recursive manner.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["functions"]
+},
+"sunspider-crypto-aes": {
+	file: "sunspider-crypto-aes.html",
+	name: "AES Encryption/Decryption",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Encrypt a string and then decrypt it again using AES.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping","string","bitops"]
+},
+"sunspider-crypto-md5": {
+	file: "sunspider-crypto-md5.html",
+	name: "MD5 Hashing",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Hash a long string using MD5.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping","string"]
+},
+"sunspider-crypto-sha1": {
+	file: "sunspider-crypto-sha1.html",
+	name: "SHA1 Hashing",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Hash a long string using SHA1.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["looping","string"]
+},
+"sunspider-date-format-xparb": {
+	file: "sunspider-date-format-xparb.html",
+	name: "Date Formatting",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Converting a date into a string representation.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["date","string"]
+},
+"sunspider-date-format-tofte": {
+	file: "sunspider-date-format-tofte.html",
+	name: "Date Formatting (2)",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Converting a date into a string representation.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["date","string"]
+},
+"sunspider-math-cordic": {
+	file: "sunspider-math-cordic.html",
+	name: "Trigonometric Calculation",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Calculate values from hyperbolic and trigonometric functions.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["math","looping"]
+},
+"sunspider-math-partial-sums": {
+	file: "sunspider-math-partial-sums.html",
+	name: "Partial Sum Calculation",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Calculate the partial sum of a few different number series.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["math","looping"]
+},
+"sunspider-math-spectral-norm": {
+	file: "sunspider-math-spectral-norm.html",
+	name: "Spectral Norm of a Matrix",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Calculate the spectral norm of a matrix of numbers.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["array","looping","math"]
+},
+"sunspider-regexp-dna": {
+	file: "sunspider-regexp-dna.html",
+	name: "DNA Sequence Counting",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Counts occurences in a DNA sequence.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["string","regexp"]
+},
+"sunspider-string-fasta": {
+	file: "sunspider-string-fasta.html",
+	name: "DNA Sequence Alignment",
+	origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
+	desc: "Find DNA matches within a larger sequence.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["string","object","looping"]
+},
+"sunspider-string-tagcloud": {
+	file: "sunspider-string-tagcloud.html",
+	name: "Tag Cloud Creation",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Convert a JSON structure into an HTML tag cloud.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["string","regexp"]
+},
+"sunspider-string-unpack-code": {
+	file: "sunspider-string-unpack-code.html",
+	name: "Script Unpacking",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Decompressing scripts run through Dean Edwards' Packer.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["regexp","string","looping"]
+},
+"sunspider-string-validate-input": {
+	file: "sunspider-string-validate-input.html",
+	name: "Validate User Input",
+	origin: ["SunSpider", "http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"],
+	desc: "Test user input against a series of rules.",
+	category: "SunSpider JavaScript Tests",
+	tags: ["string","regexp"]
+},
+"dom-attr": {
+	file: "dom-attr.html",
+	name: "DOM Attributes",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Setting and getting DOM node attributes.",
+	category: "Dromaeo DOM Tests",
+	tags: ["dom","attributes"]
+},
+"dom-modify": {
+	file: "dom-modify.html",
+	name: "DOM Modification",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Creating and injecting DOM nodes into a document.",
+	category: "Dromaeo DOM Tests",
+	tags: ["dom","modify"]
+},
+"dom-query": {
+	file: "dom-query.html",
+	name: "DOM Query",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document.",
+	category: "Dromaeo DOM Tests",
+	tags: ["dom","query"]
+},
+"dom-traverse": {
+	file: "dom-traverse.html",
+	name: "DOM Traversal",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Traversing a DOM structure.",
+	category: "Dromaeo DOM Tests",
+	tags: ["dom","traverse"]
+},
+"jslib-attr-jquery": {
+	file: "jslib-attr-jquery.html",
+	name: "DOM Attributes (jQuery)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Setting and getting DOM node attributes using the jQuery JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","jquery","attributes"]
+},
+"jslib-attr-prototype": {
+	file: "jslib-attr-prototype.html",
+	name: "DOM Attributes (Prototype)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Setting and getting DOM node attributes using the Prototype JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","prototype","attributes"]
+},
+"jslib-event-jquery": {
+	file: "jslib-event-jquery.html",
+	name: "DOM Events (jQuery)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Binding, removing, and triggering DOM events using the jQuery JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","jquery","events"]
+},
+"jslib-event-prototype": {
+	file: "jslib-event-prototype.html",
+	name: "DOM Events (Prototype)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Binding, removing, and triggering DOM events using the Prototype JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","prototype","events"]
+},
+"jslib-modify-jquery": {
+	file: "jslib-modify-jquery.html",
+	name: "DOM Modification (jQuery)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Creating and injecting DOM nodes into a document using the jQuery JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","jquery","modify"]
+},
+"jslib-modify-prototype": {
+	file: "jslib-modify-prototype.html",
+	name: "DOM Modification (Prototype)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Creating and injecting DOM nodes into a document using the Prototype JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","prototype","modify"]
+},
+"jslib-style-jquery": {
+	file: "jslib-style-jquery.html",
+	name: "DOM Style (jQuery)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Getting and setting CSS information on DOM elements using the jQuery JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","jquery","style"]
+},
+"jslib-style-prototype": {
+	file: "jslib-style-prototype.html",
+	name: "DOM Style (Prototype)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Getting and setting CSS information on DOM elements using the Prototype JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","prototype","style"]
+},
+"jslib-traverse-jquery": {
+	file: "jslib-traverse-jquery.html",
+	name: "DOM Traversal (jQuery)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Traversing a DOM structure using the jQuery JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","jquery","traverse"]
+},
+"jslib-traverse-prototype": {
+	file: "jslib-traverse-prototype.html",
+	name: "DOM Traversal (Prototype)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Traversing a DOM structure using the Prototype JavaScript Library.",
+	category: "JavaScript Library Tests",
+	tags: ["dom","jslib","prototype","traverse"]
+},
+"cssquery-jquery": {
+	file: "cssquery-jquery.html",
+	name: "DOM Query (jQuery)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document using the jQuery JavaScript Library.",
+	category: "CSS Selector Tests",
+	tags: ["dom","jslib","jquery","query"]
+},
+"cssquery-prototype": {
+	file: "cssquery-prototype.html",
+	name: "DOM Query (Prototype)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document using the Prototype JavaScript Library.",
+	category: "CSS Selector Tests",
+	tags: ["dom","jslib","prototype","query"]
+},
+"cssquery-dojo": {
+	file: "cssquery-dojo.html",
+	name: "DOM Query (Dojo)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document using the Dojo JavaScript Library.",
+	category: "CSS Selector Tests",
+	tags: ["dom","jslib","dojo","query"]
+},
+"cssquery-ext": {
+	file: "cssquery-ext.html",
+	name: "DOM Query (ExtJS)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document using the ExtJS JavaScript Library.",
+	category: "CSS Selector Tests",
+	tags: ["dom","jslib","extjs","query"]
+},
+"cssquery-mootools": {
+	file: "cssquery-mootools.html",
+	name: "DOM Query (Mootools)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document using the Mootools JavaScript Library.",
+	category: "CSS Selector Tests",
+	tags: ["dom","jslib","mootools","query"]
+},
+"cssquery-yui": {
+	file: "cssquery-yui.html",
+	name: "DOM Query (Yahoo UI)",
+	origin: ["John Resig", "http://ejohn.org/"],
+	desc: "Querying DOM elements in a document using the Yahoo UI JavaScript Library.",
+	category: "CSS Selector Tests",
+	tags: ["dom","jslib","yui","query"]
+}
+}
diff --git a/tests/cssquery-dojo.html b/tests/cssquery-dojo.html
new file mode 100644
index 0000000..bda9a3a
--- /dev/null
+++ b/tests/cssquery-dojo.html
@@ -0,0 +1,3063 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/dojo.js"></script>
+<script>
+window.onload = function(){
+startTest("cssquery-dojo", '');
+
+// Try to force real results
+var ret, tmp;
+
+var html = document.body.innerHTML;
+var query = dojo.query;
+
+	prep(function(){
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+
+	test("Dojo - *", function(){
+		query("*");
+	});
+
+	test("Dojo - div:only-child", function(){
+		query("div:only-child");
+	});
+
+	test("Dojo - div:first-child", function(){
+		query("div:first-child");
+	});
+
+	test("Dojo - div:nth-child(even)", function(){
+		query("div:nth-child(even)");
+	});
+
+	test("Dojo - div:nth-child(2n)", function(){
+		query("div:nth-child(2n)");
+	});
+
+	test("Dojo - div:nth-child(odd)", function(){
+		query("div:nth-child(odd)");
+	});
+
+	test("Dojo - div:nth-child(2n+1)", function(){
+		query("div:nth-child(2n+1)");
+	});
+
+	test("Dojo - div:nth-child(n)", function(){
+		query("div:nth-child(n)");
+	});
+
+	test("Dojo - div:last-child", function(){
+		query("div:last-child");
+	});
+
+	test("Dojo - div > div", function(){
+		query("div > div");
+	});
+
+	test("Dojo - div + div", function(){
+		query("div + div");
+	});
+
+	test("Dojo - div ~ div", function(){
+		query("div ~ div");
+	});
+
+	test("Dojo - body", function(){
+		query("body");
+	});
+
+	test("Dojo - body div", function(){
+		query("body div");
+	});
+
+	test("Dojo - div", function(){
+		query("div");
+	});
+
+	test("Dojo - div div", function(){
+		query("div div");
+	});
+
+	test("Dojo - div div div", function(){
+		query("div div div");
+	});
+
+	test("Dojo - div, div, div", function(){
+		query("div, div, div");
+	});
+
+	test("Dojo - div, a, span", function(){
+		query("div, a, span");
+	});
+
+	test("Dojo - .dialog", function(){
+		query(".dialog");
+	});
+
+	test("Dojo - div.dialog", function(){
+		query("div.dialog");
+	});
+
+	test("Dojo - div .dialog", function(){
+		query("div .dialog");
+	});
+
+	test("Dojo - div.character, div.dialog", function(){
+		query("div.character, div.dialog");
+	});
+
+	test("Dojo - #speech5", function(){
+		query("#speech5");
+	});
+
+	//test("Dojo - div#speech5", function(){
+		//query("div#speech5");
+	//});
+
+	//test("Dojo - div #speech5", function(){
+		//query("div #speech5");
+	//});
+
+	test("Dojo - div.scene div.dialog", function(){
+		query("div.scene div.dialog");
+	});
+
+	//test("Dojo - div#scene1 div.dialog div", function(){
+		//query("div#scene1 div.dialog div");
+	//});
+
+	test("Dojo - #scene1 #speech1", function(){
+		query("#scene1 #speech1");
+	});
+
+	test("Dojo - div[class]", function(){
+		query("div[class]");
+	});
+
+	test("Dojo - div[class=dialog]", function(){
+		query("div[class=dialog]");
+	});
+
+	test("Dojo - div[class^=dia]", function(){
+		query("div[class^=dia]");
+	});
+
+	test("Dojo - div[class$=log]", function(){
+		query("div[class$=log]");
+	});
+
+	test("Dojo - div[class*=sce]", function(){
+		query("div[class*=sce]");
+	});
+
+	test("Dojo - div[class|=dialog]", function(){
+		query("div[class|=dialog]");
+	});
+
+	test("Dojo - div[class~=dialog]", function(){
+		query("div[class~=dialog]");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/cssquery-ext.html b/tests/cssquery-ext.html
new file mode 100644
index 0000000..99bfb75
--- /dev/null
+++ b/tests/cssquery-ext.html
@@ -0,0 +1,3064 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/ext-base.js"></script>
+<script src="../lib/ext-core.js"></script>
+<script>
+window.onload = function(){
+startTest("cssquery-ext", '');
+
+// Try to force real results
+var ret, tmp;
+
+var html = document.body.innerHTML;
+var query = Ext.DomQuery.select;
+
+	prep(function(){
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+	
+	test("Ext - *", function(){
+		query("*");
+	});
+
+	test("Ext - div:only-child", function(){
+		query("div:only-child");
+	});
+
+	test("Ext - div:first-child", function(){
+		query("div:first-child");
+	});
+
+	test("Ext - div:nth-child(even)", function(){
+		query("div:nth-child(even)");
+	});
+
+	test("Ext - div:nth-child(2n)", function(){
+		query("div:nth-child(2n)");
+	});
+
+	test("Ext - div:nth-child(odd)", function(){
+		query("div:nth-child(odd)");
+	});
+
+	test("Ext - div:nth-child(2n+1)", function(){
+		query("div:nth-child(2n+1)");
+	});
+
+	test("Ext - div:nth-child(n)", function(){
+		query("div:nth-child(n)");
+	});
+
+	test("Ext - div:last-child", function(){
+		query("div:last-child");
+	});
+
+	test("Ext - div > div", function(){
+		query("div > div");
+	});
+
+	test("Ext - div + div", function(){
+		query("div + div");
+	});
+
+	test("Ext - div ~ div", function(){
+		query("div ~ div");
+	});
+
+	test("Ext - body", function(){
+		query("body");
+	});
+
+	test("Ext - body div", function(){
+		query("body div");
+	});
+
+	test("Ext - div", function(){
+		query("div");
+	});
+
+	test("Ext - div div", function(){
+		query("div div");
+	});
+
+	test("Ext - div div div", function(){
+		query("div div div");
+	});
+
+	test("Ext - div, div, div", function(){
+		query("div, div, div");
+	});
+
+	test("Ext - div, a, span", function(){
+		query("div, a, span");
+	});
+
+	test("Ext - .dialog", function(){
+		query(".dialog");
+	});
+
+	test("Ext - div.dialog", function(){
+		query("div.dialog");
+	});
+
+	test("Ext - div .dialog", function(){
+		query("div .dialog");
+	});
+
+	test("Ext - div.character, div.dialog", function(){
+		query("div.character, div.dialog");
+	});
+
+	test("Ext - #speech5", function(){
+		query("#speech5");
+	});
+
+	test("Ext - div#speech5", function(){
+		query("div#speech5");
+	});
+
+	test("Ext - div #speech5", function(){
+		query("div #speech5");
+	});
+
+	test("Ext - div.scene div.dialog", function(){
+		query("div.scene div.dialog");
+	});
+
+	test("Ext - div#scene1 div.dialog div", function(){
+		query("div#scene1 div.dialog div");
+	});
+
+	test("Ext - #scene1 #speech1", function(){
+		query("#scene1 #speech1");
+	});
+
+	test("Ext - div[class]", function(){
+		query("div[class]");
+	});
+
+	test("Ext - div[class=dialog]", function(){
+		query("div[class=dialog]");
+	});
+
+	test("Ext - div[class^=dia]", function(){
+		query("div[class^=dia]");
+	});
+
+	test("Ext - div[class$=log]", function(){
+		query("div[class$=log]");
+	});
+
+	test("Ext - div[class*=sce]", function(){
+		query("div[class*=sce]");
+	});
+
+	test("Ext - div[class|=dialog]", function(){
+		query("div[class|=dialog]");
+	});
+
+	test("Ext - div[class~=dialog]", function(){
+		query("div[class~=dialog]");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/cssquery-jquery.html b/tests/cssquery-jquery.html
new file mode 100644
index 0000000..65e6ed8
--- /dev/null
+++ b/tests/cssquery-jquery.html
@@ -0,0 +1,3062 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/jquery.js"></script>
+<script>
+window.onload = function(){
+startTest("cssquery-jquery", '');
+
+// Try to force real results
+var ret, tmp;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+	
+	test("jQuery - *", function(){
+		jQuery("*");
+	});
+
+	test("jQuery - div:only-child", function(){
+		jQuery("div:only-child");
+	});
+
+	test("jQuery - div:first-child", function(){
+		jQuery("div:first-child");
+	});
+
+	test("jQuery - div:nth-child(even)", function(){
+		jQuery("div:nth-child(even)");
+	});
+
+	test("jQuery - div:nth-child(2n)", function(){
+		jQuery("div:nth-child(2n)");
+	});
+
+	test("jQuery - div:nth-child(odd)", function(){
+		jQuery("div:nth-child(odd)");
+	});
+
+	test("jQuery - div:nth-child(2n+1)", function(){
+		jQuery("div:nth-child(2n+1)");
+	});
+
+	test("jQuery - div:nth-child(n)", function(){
+		jQuery("div:nth-child(n)");
+	});
+
+	test("jQuery - div:last-child", function(){
+		jQuery("div:last-child");
+	});
+
+	test("jQuery - div > div", function(){
+		jQuery("div > div");
+	});
+
+	test("jQuery - div + div", function(){
+		jQuery("div + div");
+	});
+
+	test("jQuery - div ~ div", function(){
+		jQuery("div ~ div");
+	});
+
+	test("jQuery - body", function(){
+		jQuery("body");
+	});
+
+	test("jQuery - body div", function(){
+		jQuery("body div");
+	});
+
+	test("jQuery - div", function(){
+		jQuery("div");
+	});
+
+	test("jQuery - div div", function(){
+		jQuery("div div");
+	});
+
+	test("jQuery - div div div", function(){
+		jQuery("div div div");
+	});
+
+	test("jQuery - div, div, div", function(){
+		jQuery("div, div, div");
+	});
+
+	test("jQuery - div, a, span", function(){
+		jQuery("div, a, span");
+	});
+
+	test("jQuery - .dialog", function(){
+		jQuery(".dialog");
+	});
+
+	test("jQuery - div.dialog", function(){
+		jQuery("div.dialog");
+	});
+
+	test("jQuery - div .dialog", function(){
+		jQuery("div .dialog");
+	});
+
+	test("jQuery - div.character, div.dialog", function(){
+		jQuery("div.character, div.dialog");
+	});
+
+	test("jQuery - #speech5", function(){
+		jQuery("#speech5");
+	});
+
+	test("jQuery - div#speech5", function(){
+		jQuery("div#speech5");
+	});
+
+	test("jQuery - div #speech5", function(){
+		jQuery("div #speech5");
+	});
+
+	test("jQuery - div.scene div.dialog", function(){
+		jQuery("div.scene div.dialog");
+	});
+
+	test("jQuery - div#scene1 div.dialog div", function(){
+		jQuery("div#scene1 div.dialog div");
+	});
+
+	test("jQuery - #scene1 #speech1", function(){
+		jQuery("#scene1 #speech1");
+	});
+
+	test("jQuery - div[class]", function(){
+		jQuery("div[class]");
+	});
+
+	test("jQuery - div[class=dialog]", function(){
+		jQuery("div[class=dialog]");
+	});
+
+	test("jQuery - div[class^=dia]", function(){
+		jQuery("div[class^=dia]");
+	});
+
+	test("jQuery - div[class$=log]", function(){
+		jQuery("div[class$=log]");
+	});
+
+	test("jQuery - div[class*=sce]", function(){
+		jQuery("div[class*=sce]");
+	});
+
+	test("jQuery - div[class|=dialog]", function(){
+		jQuery("div[class|=dialog]");
+	});
+
+	test("jQuery - div[class~=dialog]", function(){
+		jQuery("div[class~=dialog]");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/cssquery-mootools.html b/tests/cssquery-mootools.html
new file mode 100644
index 0000000..c7d38f0
--- /dev/null
+++ b/tests/cssquery-mootools.html
@@ -0,0 +1,3062 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/mootools.js"></script>
+<script>
+window.onload = function(){
+startTest("cssquery-mootools", '');
+
+// Try to force real results
+var ret, tmp;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+	
+	test("Mootools - *", function(){
+		$$("*");
+	});
+
+	test("Mootools - div:only-child", function(){
+		$$("div:only-child");
+	});
+
+	test("Mootools - div:first-child", function(){
+		$$("div:first-child");
+	});
+
+	test("Mootools - div:nth-child(even)", function(){
+		$$("div:nth-child(even)");
+	});
+
+	test("Mootools - div:nth-child(2n)", function(){
+		$$("div:nth-child(2n)");
+	});
+
+	test("Mootools - div:nth-child(odd)", function(){
+		$$("div:nth-child(odd)");
+	});
+
+	test("Mootools - div:nth-child(2n+1)", function(){
+		$$("div:nth-child(2n+1)");
+	});
+
+	test("Mootools - div:nth-child(n)", function(){
+		$$("div:nth-child(n)");
+	});
+
+	test("Mootools - div:last-child", function(){
+		$$("div:last-child");
+	});
+
+	test("Mootools - div > div", function(){
+		$$("div > div");
+	});
+
+	test("Mootools - div + div", function(){
+		$$("div + div");
+	});
+
+	test("Mootools - div ~ div", function(){
+		$$("div ~ div");
+	});
+
+	test("Mootools - body", function(){
+		$$("body");
+	});
+
+	test("Mootools - body div", function(){
+		$$("body div");
+	});
+
+	test("Mootools - div", function(){
+		$$("div");
+	});
+
+	test("Mootools - div div", function(){
+		$$("div div");
+	});
+
+	test("Mootools - div div div", function(){
+		$$("div div div");
+	});
+
+	test("Mootools - div, div, div", function(){
+		$$("div, div, div");
+	});
+
+	test("Mootools - div, a, span", function(){
+		$$("div, a, span");
+	});
+
+	test("Mootools - .dialog", function(){
+		$$(".dialog");
+	});
+
+	test("Mootools - div.dialog", function(){
+		$$("div.dialog");
+	});
+
+	test("Mootools - div .dialog", function(){
+		$$("div .dialog");
+	});
+
+	test("Mootools - div.character, div.dialog", function(){
+		$$("div.character, div.dialog");
+	});
+
+	test("Mootools - #speech5", function(){
+		$$("#speech5");
+	});
+
+	test("Mootools - div#speech5", function(){
+		$$("div#speech5");
+	});
+
+	test("Mootools - div #speech5", function(){
+		$$("div #speech5");
+	});
+
+	test("Mootools - div.scene div.dialog", function(){
+		$$("div.scene div.dialog");
+	});
+
+	test("Mootools - div#scene1 div.dialog div", function(){
+		$$("div#scene1 div.dialog div");
+	});
+
+	test("Mootools - #scene1 #speech1", function(){
+		$$("#scene1 #speech1");
+	});
+
+	test("Mootools - div[class]", function(){
+		$$("div[class]");
+	});
+
+	test("Mootools - div[class=dialog]", function(){
+		$$("div[class=dialog]");
+	});
+
+	test("Mootools - div[class^=dia]", function(){
+		$$("div[class^=dia]");
+	});
+
+	test("Mootools - div[class$=log]", function(){
+		$$("div[class$=log]");
+	});
+
+	test("Mootools - div[class*=sce]", function(){
+		$$("div[class*=sce]");
+	});
+
+	test("Mootools - div[class|=dialog]", function(){
+		$$("div[class|=dialog]");
+	});
+
+	test("Mootools - div[class~=dialog]", function(){
+		$$("div[class~=dialog]");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/cssquery-prototype.html b/tests/cssquery-prototype.html
new file mode 100644
index 0000000..e16f932
--- /dev/null
+++ b/tests/cssquery-prototype.html
@@ -0,0 +1,3062 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/prototype.js"></script>
+<script>
+window.onload = function(){
+startTest("cssquery-prototype", '');
+
+// Try to force real results
+var ret, tmp;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+
+	test("Prototype - *", function(){
+		$$("*");
+	});
+
+	test("Prototype - div:only-child", function(){
+		$$("div:only-child");
+	});
+
+	test("Prototype - div:first-child", function(){
+		$$("div:first-child");
+	});
+
+	test("Prototype - div:nth-child(even)", function(){
+		$$("div:nth-child(even)");
+	});
+
+	test("Prototype - div:nth-child(2n)", function(){
+		$$("div:nth-child(2n)");
+	});
+
+	test("Prototype - div:nth-child(odd)", function(){
+		$$("div:nth-child(odd)");
+	});
+
+	test("Prototype - div:nth-child(2n+1)", function(){
+		$$("div:nth-child(2n+1)");
+	});
+
+	test("Prototype - div:nth-child(n)", function(){
+		$$("div:nth-child(n)");
+	});
+
+	test("Prototype - div:last-child", function(){
+		$$("div:last-child");
+	});
+
+	test("Prototype - div > div", function(){
+		$$("div > div");
+	});
+
+	test("Prototype - div + div", function(){
+		$$("div + div");
+	});
+
+	test("Prototype - div ~ div", function(){
+		$$("div ~ div");
+	});
+
+	test("Prototype - body", function(){
+		$$("body");
+	});
+
+	test("Prototype - body div", function(){
+		$$("body div");
+	});
+
+	test("Prototype - div", function(){
+		$$("div");
+	});
+
+	test("Prototype - div div", function(){
+		$$("div div");
+	});
+
+	test("Prototype - div div div", function(){
+		$$("div div div");
+	});
+
+	test("Prototype - div, div, div", function(){
+		$$("div, div, div");
+	});
+
+	test("Prototype - div, a, span", function(){
+		$$("div, a, span");
+	});
+
+	test("Prototype - .dialog", function(){
+		$$(".dialog");
+	});
+
+	test("Prototype - div.dialog", function(){
+		$$("div.dialog");
+	});
+
+	test("Prototype - div .dialog", function(){
+		$$("div .dialog");
+	});
+
+	test("Prototype - div.character, div.dialog", function(){
+		$$("div.character, div.dialog");
+	});
+
+	test("Prototype - #speech5", function(){
+		$$("#speech5");
+	});
+
+	test("Prototype - div#speech5", function(){
+		$$("div#speech5");
+	});
+
+	test("Prototype - div #speech5", function(){
+		$$("div #speech5");
+	});
+
+	test("Prototype - div.scene div.dialog", function(){
+		$$("div.scene div.dialog");
+	});
+
+	test("Prototype - div#scene1 div.dialog div", function(){
+		$$("div#scene1 div.dialog div");
+	});
+
+	test("Prototype - #scene1 #speech1", function(){
+		$$("#scene1 #speech1");
+	});
+
+	test("Prototype - div[class]", function(){
+		$$("div[class]");
+	});
+
+	test("Prototype - div[class=dialog]", function(){
+		$$("div[class=dialog]");
+	});
+
+	test("Prototype - div[class^=dia]", function(){
+		$$("div[class^=dia]");
+	});
+
+	test("Prototype - div[class$=log]", function(){
+		$$("div[class$=log]");
+	});
+
+	test("Prototype - div[class*=sce]", function(){
+		$$("div[class*=sce]");
+	});
+
+	test("Prototype - div[class|=dialog]", function(){
+		$$("div[class|=dialog]");
+	});
+
+	test("Prototype - div[class~=dialog]", function(){
+		$$("div[class~=dialog]");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/cssquery-yui.html b/tests/cssquery-yui.html
new file mode 100644
index 0000000..100bb24
--- /dev/null
+++ b/tests/cssquery-yui.html
@@ -0,0 +1,3065 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/yahoo.js"></script>
+<script src="../lib/yui-dom.js"></script>
+<script src="../lib/yui-selector.js"></script>
+<script>
+window.onload = function(){
+startTest("cssquery-yui", '');
+
+// Try to force real results
+var ret, tmp;
+
+var html = document.body.innerHTML;
+var query = YAHOO.util.Selector.query;
+
+	prep(function(){
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+	
+	test("YUI - *", function(){
+		query("*");
+	});
+
+	test("YUI - div:only-child", function(){
+		query("div:only-child");
+	});
+
+	test("YUI - div:first-child", function(){
+		query("div:first-child");
+	});
+
+	test("YUI - div:nth-child(even)", function(){
+		query("div:nth-child(even)");
+	});
+
+	test("YUI - div:nth-child(2n)", function(){
+		query("div:nth-child(2n)");
+	});
+
+	test("YUI - div:nth-child(odd)", function(){
+		query("div:nth-child(odd)");
+	});
+
+	test("YUI - div:nth-child(2n+1)", function(){
+		query("div:nth-child(2n+1)");
+	});
+
+	test("YUI - div:nth-child(n)", function(){
+		query("div:nth-child(n)");
+	});
+
+	test("YUI - div:last-child", function(){
+		query("div:last-child");
+	});
+
+	test("YUI - div > div", function(){
+		query("div > div");
+	});
+
+	test("YUI - div + div", function(){
+		query("div + div");
+	});
+
+	test("YUI - div ~ div", function(){
+		query("div ~ div");
+	});
+
+	test("YUI - body", function(){
+		query("body");
+	});
+
+	test("YUI - body div", function(){
+		query("body div");
+	});
+
+	test("YUI - div", function(){
+		query("div");
+	});
+
+	test("YUI - div div", function(){
+		query("div div");
+	});
+
+	test("YUI - div div div", function(){
+		query("div div div");
+	});
+
+	test("YUI - div, div, div", function(){
+		query("div, div, div");
+	});
+
+	test("YUI - div, a, span", function(){
+		query("div, a, span");
+	});
+
+	test("YUI - .dialog", function(){
+		query(".dialog");
+	});
+
+	test("YUI - div.dialog", function(){
+		query("div.dialog");
+	});
+
+	test("YUI - div .dialog", function(){
+		query("div .dialog");
+	});
+
+	test("YUI - div.character, div.dialog", function(){
+		query("div.character, div.dialog");
+	});
+
+	test("YUI - #speech5", function(){
+		query("#speech5");
+	});
+
+	test("YUI - div#speech5", function(){
+		query("div#speech5");
+	});
+
+	test("YUI - div #speech5", function(){
+		query("div #speech5");
+	});
+
+	test("YUI - div.scene div.dialog", function(){
+		query("div.scene div.dialog");
+	});
+
+	test("YUI - div#scene1 div.dialog div", function(){
+		query("div#scene1 div.dialog div");
+	});
+
+	test("YUI - #scene1 #speech1", function(){
+		query("#scene1 #speech1");
+	});
+
+	test("YUI - div[class]", function(){
+		query("div[class]");
+	});
+
+	test("YUI - div[class=dialog]", function(){
+		query("div[class=dialog]");
+	});
+
+	test("YUI - div[class^=dia]", function(){
+		query("div[class^=dia]");
+	});
+
+	test("YUI - div[class$=log]", function(){
+		query("div[class$=log]");
+	});
+
+	test("YUI - div[class*=sce]", function(){
+		query("div[class*=sce]");
+	});
+
+	test("YUI - div[class|=dialog]", function(){
+		query("div[class|=dialog]");
+	});
+
+	test("YUI - div[class~=dialog]", function(){
+		query("div[class~=dialog]");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/dom-attr.html b/tests/dom-attr.html
new file mode 100644
index 0000000..c560777
--- /dev/null
+++ b/tests/dom-attr.html
@@ -0,0 +1,2943 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){
+startTest("dom-attr", '');
+
+// Try to force real results
+var ret, tmp;
+
+var elem = document.getElementById("test1");
+var a = document.getElementsByTagName("a")[0];
+var num = 10240;
+	
+	test( "getAttribute", function(){
+		for ( var i = 0; i < num; i++ )
+			ret = elem.getAttribute("id");
+	});
+
+	test( "element.property", function(){
+		for ( var i = 0; i < num * 2; i++ )
+			ret = elem.id;
+	});
+
+	test( "setAttribute", function(){
+		for ( var i = 0; i < num; i++ )
+			a.setAttribute("id", "foo");
+	});
+
+	test( "element.property = value", function(){
+		for ( var i = 0; i < num; i++ )
+			a.id = "foo";
+	});
+
+	test( "element.expando = value", function(){
+		for ( var i = 0; i < num; i++ )
+			a["test" + num] = function(){};
+	});
+
+	test( "element.expando", function(){
+		for ( var i = 0; i < num; i++ )
+			ret = a["test" + num];
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test1"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test1"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test1 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/dom-modify.html b/tests/dom-modify.html
new file mode 100644
index 0000000..a2dbbe5
--- /dev/null
+++ b/tests/dom-modify.html
@@ -0,0 +1,2973 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){
+startTest("dom-modify", '');
+
+// Try to force real results
+var ret, tmp, str;
+
+var elems = [];
+var htmlstr = document.body.innerHTML;
+var div = document.createElement("div");
+var num = 400;
+
+for ( var i = 0; i < 1024; i++ )
+        str += String.fromCharCode( (25 * Math.random()) + 97 );
+
+	test( "createElement", function(){
+		for ( var i = 0; i < num; i++ ) {
+			ret = document.createElement("div");
+			ret = document.createElement("span");
+			ret = document.createElement("table");
+			ret = document.createElement("tr");
+			ret = document.createElement("select");
+		}
+	});
+
+	test( "createTextNode", function(){
+		for ( var i = 0; i < num; i++ ) {
+			ret = document.createTextNode(str);
+			ret = document.createTextNode(str + "2");
+			ret = document.createTextNode(str + "3");
+			ret = document.createTextNode(str + "4");
+			ret = document.createTextNode(str + "5");
+		}
+	});
+
+	/* Need a better way to test this
+	test( "removeChild", function(){
+		while ( document.body.firstChild )
+			document.body.removeChild( document.body.firstChild );
+	});
+	*/
+
+	test( "innerHTML", function(){
+		document.body.innerHTML = htmlstr;
+	});
+
+	prep(function(){
+		elems = [];
+		var telems = document.body.childNodes;
+		for ( var i = 0; i < telems.length; i++ )
+			elems.push( telems[i] );
+	});
+	
+	test( "cloneNode", function(){
+		for ( var i = 0; i < elems.length; i++ ) {
+			ret = elems[i].cloneNode(false);
+			ret = elems[i].cloneNode(true);
+			ret = elems[i].cloneNode(true);
+		}
+	});
+
+	test( "appendChild", function(){
+		for ( var i = 0; i < elems.length; i++ )
+			document.body.appendChild( elems[i] );
+	});
+
+	test( "insertBefore", function(){
+		for ( var i = 0; i < elems.length; i++ )
+			document.body.insertBefore( elems[i], document.body.firstChild );
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test1"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test1"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test1 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/dom-query.html b/tests/dom-query.html
new file mode 100644
index 0000000..18043dc
--- /dev/null
+++ b/tests/dom-query.html
@@ -0,0 +1,3000 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){
+startTest("dom-query", '');
+
+// Try to force real results
+var ret, tmp;
+var num = 40;
+var html = document.body.innerHTML;
+
+	prep(function(){
+		html = html.replace(/id="test(\w).*?"/g, 'id="test$1' + num + '"');
+		html = html.replace(/name="test.*?"/g, 'name="test' + num + '"');
+		html = html.replace(/class="foo.*?"/g, 'class="foo test' + num + ' bar"');
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+
+	test( "getElementById", function(){
+		for ( var i = 0; i < num * 30; i++ ) {
+			ret = document.getElementById("testA" + num).nodeType;
+			ret = document.getElementById("testB" + num).nodeType;
+			ret = document.getElementById("testC" + num).nodeType;
+			ret = document.getElementById("testD" + num).nodeType;
+			ret = document.getElementById("testE" + num).nodeType;
+			ret = document.getElementById("testF" + num).nodeType;
+		}
+	});
+
+	test( "getElementById (not in document)", function(){
+		for ( var i = 0; i < num * 30; i++ ) {
+			ret = document.getElementById("testA");
+			ret = document.getElementById("testB");
+			ret = document.getElementById("testC");
+			ret = document.getElementById("testD");
+			ret = document.getElementById("testE");
+			ret = document.getElementById("testF");
+		}
+	});
+
+	test( "getElementsByTagName(div)", function(){
+		for ( var i = 0; i < num; i++ ) {
+			var elems = document.getElementsByTagName("div");
+			ret = elems[elems.length-1].nodeType;
+		}
+	});
+
+	test( "getElementsByTagName(p)", function(){
+		for ( var i = 0; i < num; i++ ) {
+			var elems = document.getElementsByTagName("p");
+			ret = elems[elems.length-1].nodeType;
+		}
+	});
+
+	test( "getElementsByTagName(a)", function(){
+		for ( var i = 0; i < num; i++ ) {
+			var elems = document.getElementsByTagName("a");
+			ret = elems[elems.length-1].nodeType;
+		}
+	});
+
+	test( "getElementsByTagName(*)", function(){
+		for ( var i = 0; i < num; i++ ) {
+			var elems = document.getElementsByTagName("*");
+			ret = elems[elems.length-1].nodeType;
+		}
+	});
+
+	test( "getElementsByTagName (not in document)", function(){
+		for ( var i = 0; i < num; i++ ) {
+			var elems = document.getElementsByTagName("strong");
+			ret = elems.length == 0;
+		}
+	});
+
+	test( "getElementsByName", function(){
+		for ( var i = 0; i < num * 20; i++ ) {
+			var elems = document.getElementsByName("test" + num);
+			ret = elems[elems.length-1].nodeType;
+			var elems = document.getElementsByName("test" + num);
+			ret = elems[elems.length-1].nodeType;
+			var elems = document.getElementsByName("test" + num);
+			ret = elems[elems.length-1].nodeType;
+			var elems = document.getElementsByName("test" + num);
+			ret = elems[elems.length-1].nodeType;
+		}
+	});
+
+	test( "getElementsByName (not in document)", function(){
+		for ( var i = 0; i < num * 20; i++ ) {
+			ret = document.getElementsByName("test").length == 0;
+			ret = document.getElementsByName("test").length == 0;
+			ret = document.getElementsByName("test").length == 0;
+			ret = document.getElementsByName("test").length == 0;
+			ret = document.getElementsByName("test").length == 0;
+		}
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="testF10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2 id="testA10"><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2 id="testB10"><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2 id="testC10"><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2 id="testD10"><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2 id="testE10"><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/dom-traverse.html b/tests/dom-traverse.html
new file mode 100644
index 0000000..341d2f3
--- /dev/null
+++ b/tests/dom-traverse.html
@@ -0,0 +1,2972 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){
+startTest("dom-traverse", '');
+
+// Try to force real results
+var ret, tmp;
+var num = 40;
+var html = document.body.innerHTML;
+
+	prep(function(){
+		html = html.replace(/id="test.*?"/g, 'id="test' + num + '"');
+		html = html.replace(/name="test.*?"/g, 'name="test' + num + '"');
+		html = html.replace(/class="foo.*?"/g, 'class="foo test' + num + ' bar"');
+		var div = document.createElement("div");
+		div.innerHTML = html;
+		document.body.appendChild( div );
+	});
+
+	test( "firstChild", function(){
+		var nodes = document.body.childNodes, nl = nodes.length;
+
+		for ( var i = 0; i < num; i++ ) {
+			for ( var j = 0; j < nl; j++ ) {
+				var cur = nodes[j];
+				while ( cur )
+					cur = cur.firstChild;
+				ret = cur;
+			}
+		}
+	});
+
+	test( "lastChild", function(){
+		var nodes = document.body.childNodes, nl = nodes.length;
+
+		for ( var i = 0; i < num; i++ ) {
+			for ( var j = 0; j < nl; j++ ) {
+				var cur = nodes[j];
+				while ( cur )
+					cur = cur.lastChild;
+				ret = cur;
+			}
+		}
+	});
+
+	test( "nextSibling", function(){
+		for ( var i = 0; i < num * 2; i++ ) {
+			var cur = document.body.firstChild;
+			while ( cur )
+				cur = cur.nextSibling;
+			ret = cur;
+		}
+	});
+
+	test( "previousSibling", function(){
+		for ( var i = 0; i < num * 2; i++ ) {
+			var cur = document.body.lastChild;
+			while ( cur )
+				cur = cur.previousSibling;
+			ret = cur;
+		}
+	});
+
+	test( "childNodes", function(){
+		for ( var i = 0; i < num; i++ ) {
+			var nodes = document.body.childNodes;
+			for ( var j = 0; j < nodes.length; j++ )
+				ret = nodes[j];
+		}
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/dromaeo-3d-cube.html b/tests/dromaeo-3d-cube.html
new file mode 100644
index 0000000..8dde133
--- /dev/null
+++ b/tests/dromaeo-3d-cube.html
@@ -0,0 +1,340 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// 3D Cube Rotation
+// http://www.speich.net/computer/moztesting/3d.htm
+// Created by Simon Speich
+
+var Q = new Array();
+var MTrans = new Array();	// transformation matrix
+var MQube = new Array();	// position information of qube
+var I = new Array();			// entity matrix
+var Origin = new Object();
+var Testing = new Object();
+var LoopTimer;
+
+var DisplArea = new Object();
+DisplArea.Width = 300;
+DisplArea.Height = 300;
+
+function DrawLine(From, To) {
+	var x1 = From.V[0];
+	var x2 = To.V[0];
+	var y1 = From.V[1];
+	var y2 = To.V[1];
+	var dx = Math.abs(x2 - x1);
+	var dy = Math.abs(y2 - y1);
+	var x = x1;
+	var y = y1;
+	var IncX1, IncY1;
+	var IncX2, IncY2;	
+	var Den;
+  var Num;
+  var NumAdd;
+	var NumPix;
+
+	if (x2 >= x1) {	IncX1 = 1; IncX2 = 1;	}
+	else { IncX1 = -1; IncX2 = -1; }
+	if (y2 >= y1)	{	IncY1 = 1; IncY2 = 1; }
+	else { IncY1 = -1; IncY2 = -1; }
+	if (dx >= dy) {
+		IncX1 = 0;
+  	IncY2 = 0;
+  	Den = dx;
+  	Num = dx / 2;
+  	NumAdd = dy;
+		NumPix = dx;
+	}
+	else {
+		IncX2 = 0;
+	  IncY1 = 0;
+  	Den = dy;
+  	Num = dy / 2;
+  	NumAdd = dx;
+  	NumPix = dy;
+	}
+
+	NumPix = Math.round(Q.LastPx + NumPix);
+
+	var i = Q.LastPx;
+	for (; i < NumPix; i++) {
+		Num += NumAdd;
+	  if (Num >= Den) {
+    	Num -= Den;
+    	x += IncX1;
+    	y += IncY1;
+	  }
+  	x += IncX2;
+  	y += IncY2;
+	}
+	Q.LastPx = NumPix;
+}
+
+function CalcCross(V0, V1) {
+	var Cross = new Array();
+	Cross[0] = V0[1]*V1[2] - V0[2]*V1[1];
+	Cross[1] = V0[2]*V1[0] - V0[0]*V1[2];
+	Cross[2] = V0[0]*V1[1] - V0[1]*V1[0];
+	return Cross;
+}
+
+function CalcNormal(V0, V1, V2) {
+	var A = new Array(); 	var B = new Array(); 
+	for (var i = 0; i < 3; i++) {
+		A[i] = V0[i] - V1[i];
+		B[i] = V2[i] - V1[i];
+	}
+	A = CalcCross(A, B);
+	var Length = Math.sqrt(A[0]*A[0] + A[1]*A[1] + A[2]*A[2]); 
+	for (var i = 0; i < 3; i++) A[i] = A[i] / Length;
+	A[3] = 1;
+	return A;
+}
+
+function CreateP(X,Y,Z) {
+	this.V = [X,Y,Z,1];
+}
+
+// mulitplies two matrices
+function MMulti(M1, M2) {
+	var M = [[],[],[],[]];
+	var i = 0;
+	var j = 0;
+	for (; i < 4; i++) {
+		j = 0;
+		for (; j < 4; j++) M[i][j] = M1[i][0] * M2[0][j] + M1[i][1] * M2[1][j] + M1[i][2] * M2[2][j] + M1[i][3] * M2[3][j];
+	}
+	return M;
+}
+
+//multiplies matrix with vector
+function VMulti(M, V) {
+	var Vect = new Array();
+	var i = 0;
+	for (;i < 4; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2] + M[i][3] * V[3];
+	return Vect;
+}
+
+function VMulti2(M, V) {
+	var Vect = new Array();
+	var i = 0;
+	for (;i < 3; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2];
+	return Vect;
+}
+
+// add to matrices
+function MAdd(M1, M2) {
+	var M = [[],[],[],[]];
+	var i = 0;
+	var j = 0;
+	for (; i < 4; i++) {
+		j = 0;
+		for (; j < 4; j++) M[i][j] = M1[i][j] + M2[i][j];
+	}
+	return M;
+}
+
+function Translate(M, Dx, Dy, Dz) {
+	var T = [
+	[1,0,0,Dx],
+	[0,1,0,Dy],
+	[0,0,1,Dz],
+	[0,0,0,1]
+	];
+	return MMulti(T, M);
+}
+
+function RotateX(M, Phi) {
+	var a = Phi;
+	a *= Math.PI / 180;
+	var Cos = Math.cos(a);
+	var Sin = Math.sin(a);
+	var R = [
+	[1,0,0,0],
+	[0,Cos,-Sin,0],
+	[0,Sin,Cos,0],
+	[0,0,0,1]
+	];
+	return MMulti(R, M);
+}
+
+function RotateY(M, Phi) {
+	var a = Phi;
+	a *= Math.PI / 180;
+	var Cos = Math.cos(a);
+	var Sin = Math.sin(a);
+	var R = [
+	[Cos,0,Sin,0],
+	[0,1,0,0],
+	[-Sin,0,Cos,0],
+	[0,0,0,1]
+	];
+	return MMulti(R, M);
+}
+
+function RotateZ(M, Phi) {
+	var a = Phi;
+	a *= Math.PI / 180;
+	var Cos = Math.cos(a);
+	var Sin = Math.sin(a);
+	var R = [
+	[Cos,-Sin,0,0],
+	[Sin,Cos,0,0],
+	[0,0,1,0],   
+	[0,0,0,1]
+	];
+	return MMulti(R, M);
+}
+
+function DrawQube() {
+	// calc current normals
+	var CurN = new Array();
+	var i = 5;
+	Q.LastPx = 0;
+	for (; i > -1; i--) CurN[i] = VMulti2(MQube, Q.Normal[i]);
+	if (CurN[0][2] < 0) {
+		if (!Q.Line[0]) { DrawLine(Q[0], Q[1]); Q.Line[0] = true; };
+		if (!Q.Line[1]) { DrawLine(Q[1], Q[2]); Q.Line[1] = true; };
+		if (!Q.Line[2]) { DrawLine(Q[2], Q[3]); Q.Line[2] = true; };
+		if (!Q.Line[3]) { DrawLine(Q[3], Q[0]); Q.Line[3] = true; };
+	}
+	if (CurN[1][2] < 0) {
+		if (!Q.Line[2]) { DrawLine(Q[3], Q[2]); Q.Line[2] = true; };
+		if (!Q.Line[9]) { DrawLine(Q[2], Q[6]); Q.Line[9] = true; };
+		if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; };
+		if (!Q.Line[10]) { DrawLine(Q[7], Q[3]); Q.Line[10] = true; };
+	}
+	if (CurN[2][2] < 0) {
+		if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; };
+		if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; };
+		if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; };
+		if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; };
+	}
+	if (CurN[3][2] < 0) {
+		if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; };
+		if (!Q.Line[8]) { DrawLine(Q[5], Q[1]); Q.Line[8] = true; };
+		if (!Q.Line[0]) { DrawLine(Q[1], Q[0]); Q.Line[0] = true; };
+		if (!Q.Line[11]) { DrawLine(Q[0], Q[4]); Q.Line[11] = true; };
+	}
+	if (CurN[4][2] < 0) {
+		if (!Q.Line[11]) { DrawLine(Q[4], Q[0]); Q.Line[11] = true; };
+		if (!Q.Line[3]) { DrawLine(Q[0], Q[3]); Q.Line[3] = true; };
+		if (!Q.Line[10]) { DrawLine(Q[3], Q[7]); Q.Line[10] = true; };
+		if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; };
+	}
+	if (CurN[5][2] < 0) {
+		if (!Q.Line[8]) { DrawLine(Q[1], Q[5]); Q.Line[8] = true; };
+		if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; };
+		if (!Q.Line[9]) { DrawLine(Q[6], Q[2]); Q.Line[9] = true; };
+		if (!Q.Line[1]) { DrawLine(Q[2], Q[1]); Q.Line[1] = true; };
+	}
+	Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false];
+	Q.LastPx = 0;
+}
+
+function Loop() {
+	if (Testing.LoopCount > Testing.LoopMax) return;
+	var TestingStr = String(Testing.LoopCount);
+	while (TestingStr.length < 3) TestingStr = "0" + TestingStr;
+	MTrans = Translate(I, -Q[8].V[0], -Q[8].V[1], -Q[8].V[2]);
+	MTrans = RotateX(MTrans, 1);
+	MTrans = RotateY(MTrans, 3);
+	MTrans = RotateZ(MTrans, 5);
+	MTrans = Translate(MTrans, Q[8].V[0], Q[8].V[1], Q[8].V[2]);
+	MQube = MMulti(MTrans, MQube);
+	var i = 8;
+	for (; i > -1; i--) {
+		Q[i].V = VMulti(MTrans, Q[i].V);
+	}
+	DrawQube();
+	Testing.LoopCount++;
+	Loop();
+}
+
+function Init(CubeSize) {
+	// init/reset vars
+	Origin.V = [150,150,20,1];
+	Testing.LoopCount = 0;
+	Testing.LoopMax = 50;
+	Testing.TimeMax = 0;
+	Testing.TimeAvg = 0;
+	Testing.TimeMin = 0;
+	Testing.TimeTemp = 0;
+	Testing.TimeTotal = 0;
+	Testing.Init = false;
+
+	// transformation matrix
+	MTrans = [
+	[1,0,0,0],
+	[0,1,0,0],
+	[0,0,1,0],
+	[0,0,0,1]
+	];
+	
+	// position information of qube
+	MQube = [
+	[1,0,0,0],
+	[0,1,0,0],
+	[0,0,1,0],
+	[0,0,0,1]
+	];
+	
+	// entity matrix
+	I = [
+	[1,0,0,0],
+	[0,1,0,0],
+	[0,0,1,0],
+	[0,0,0,1]
+	];
+	
+	// create qube
+	Q[0] = new CreateP(-CubeSize,-CubeSize, CubeSize);
+	Q[1] = new CreateP(-CubeSize, CubeSize, CubeSize);
+	Q[2] = new CreateP( CubeSize, CubeSize, CubeSize);
+	Q[3] = new CreateP( CubeSize,-CubeSize, CubeSize);
+	Q[4] = new CreateP(-CubeSize,-CubeSize,-CubeSize);
+	Q[5] = new CreateP(-CubeSize, CubeSize,-CubeSize);
+	Q[6] = new CreateP( CubeSize, CubeSize,-CubeSize);
+	Q[7] = new CreateP( CubeSize,-CubeSize,-CubeSize);
+	
+	// center of gravity
+	Q[8] = new CreateP(0, 0, 0);
+	
+	// anti-clockwise edge check
+	Q.Edge = [[0,1,2],[3,2,6],[7,6,5],[4,5,1],[4,0,3],[1,5,6]];
+	
+	// calculate squad normals
+	Q.Normal = new Array();
+	for (var i = 0; i < Q.Edge.length; i++) Q.Normal[i] = CalcNormal(Q[Q.Edge[i][0]].V, Q[Q.Edge[i][1]].V, Q[Q.Edge[i][2]].V);
+	
+	// line drawn ?
+	Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false];
+	
+	// create line pixels
+	Q.NumPx = 9 * 2 * CubeSize;
+	for (var i = 0; i < Q.NumPx; i++) new CreateP(0,0,0);
+	
+	MTrans = Translate(MTrans, Origin.V[0], Origin.V[1], Origin.V[2]);
+	MQube = MMulti(MTrans, MQube);
+
+	var i = 0;
+	for (; i < 9; i++) {
+		Q[i].V = VMulti(MTrans, Q[i].V);
+	}
+	DrawQube();
+	Testing.Init = true;
+	Loop();
+}
+
+window.onload = function(){ startTest("dromaeo-3d-cube", '');
+
+test("Rotate 3D Cube", function(){
+	Init(20);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/dromaeo-core-eval.html b/tests/dromaeo-core-eval.html
new file mode 100644
index 0000000..aa2eea9
--- /dev/null
+++ b/tests/dromaeo-core-eval.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){ startTest("dromaeo-core-eval", '');
+
+// Try to force real results
+var ret, tmp;
+
+// The commands that we'll be evaling
+var cmd = 'var str="";for(var i=0;i<1000;i++){str += "a";}ret = str;';
+
+// TESTS: eval()
+var num = 4;
+
+prep(function(){
+	tmp = cmd;
+
+	for ( var n = 0; n < num; n++ )
+		tmp += tmp;
+});
+
+test( "Normal eval", function(){
+	eval(tmp);
+});
+
+test( "new Function", function(){
+	(new Function(tmp))();
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/dromaeo-object-array.html b/tests/dromaeo-object-array.html
new file mode 100644
index 0000000..65d9f06
--- /dev/null
+++ b/tests/dromaeo-object-array.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){ startTest("dromaeo-object-array", '');
+
+var ret = [], tmp, num = 500;
+var i = 1024;
+
+	// TESTS: Array Building
+
+	test("Array Construction, []", function(){
+		for ( var j = 0; j < i * 15; j++ ) {
+			ret = [];
+			ret.length = i;
+		}
+	});
+
+	test("Array Construction, new Array()", function(){
+		for ( var j = 0; j < i * 10; j++ )
+			ret = new Array(i);
+	});
+
+	test("Array Construction, unshift", function(){
+		ret = [];
+		for ( var j = 0; j < i; j++ )
+			ret.unshift(j);
+	});
+
+	test("Array Construction, splice", function(){
+		ret = [];
+		for ( var j = 0; j < i; j++ )
+			ret.splice(0,0,j);
+	});
+
+	test("Array Deconstruction, shift", function(){
+		var a = ret.slice();
+		for ( var j = 0; j < i; j++ )
+			tmp = a.shift();
+	});
+
+	test("Array Deconstruction, splice", function(){
+		var a = ret.slice();
+		for ( var j = 0; j < i; j++ )
+			tmp = a.splice(0,1);
+	});
+
+	test("Array Construction, push", function(){
+		ret = [];
+		for ( var j = 0; j < i * 25; j++ )
+			ret.push(j);
+	});
+
+	test("Array Deconstruction, pop", function(){
+		var a = ret.slice();
+		for ( var j = 0; j < i * 25; j++ )
+			tmp = a.pop();
+	});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/dromaeo-object-regexp.html b/tests/dromaeo-object-regexp.html
new file mode 100644
index 0000000..a6410d7
--- /dev/null
+++ b/tests/dromaeo-object-regexp.html
@@ -0,0 +1,354 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){ startTest("dromaeo-object-regexp", '');
+
+// Try to force real results
+var str = [], tmp, ret, re;
+var i = 65536;
+
+for ( var i = 0; i < 16384; i++ )
+	str.push( String.fromCharCode( (25 * Math.random()) + 97 ) );
+
+str = str.join("");
+str += str;
+str += str;
+
+	// TESTS: split
+
+	prep(function(){
+		re = //;
+		tmp = str;
+	});
+
+	test( "Compiled Object Empty Split", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.split( re );
+	});
+
+	prep(function(){
+		re = /a/;
+		tmp = str;
+	});
+
+	test( "Compiled Object Char Split", function(){
+		for ( var i = 0; i < 30; i++ )
+			ret = tmp.split( re );
+	});
+
+	prep(function(){
+		re = /.*/;
+		tmp = str;
+	});
+
+	test( "Compiled Object Variable Split", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.split( re );
+	});
+    
+	// TESTS: Compiled RegExps
+
+	prep(function(){ 
+		re = /aaaaaaaaaa/g;
+		tmp = str;
+	});
+    
+	test( "Compiled Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( re );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Test", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = re.test( tmp );
+	});
+    
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Empty Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled 12 Char Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "asdfasdfasdf" );
+	});
+	
+	prep(function(){
+		re = new RegExp("aaaaaaaaaa", "g");
+		tmp = str;
+	});
+    
+	test( "Compiled Object Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( re );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Object Test", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = re.test( tmp );
+	});
+    
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Object Empty Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Object 12 Char Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "asdfasdfasdf" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Object 12 Char Replace Function", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, function(all){
+			return "asdfasdfasdf";
+		});
+	});
+	
+	// TESTS: Variable Length
+	
+	prep(function(){
+		re = /a.*a/;
+		tmp = str;
+	});
+    
+	test( "Compiled Variable Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( re );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Variable Test", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = re.test( tmp );
+	});
+    
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Variable Empty Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Variable 12 Char Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "asdfasdfasdf" );
+	});
+	
+	prep(function(){
+		re = new RegExp("aaaaaaaaaa", "g");
+		tmp = str;
+	});
+    
+	test( "Compiled Variable Object Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( re );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Variable Object Test", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = re.test( tmp );
+	});
+    
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Compiled Variable Object Empty Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Variable Object 12 Char Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "asdfasdfasdf" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Variable Object 12 Char Replace Function", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, function(all){
+			return "asdfasdfasdf";
+		});
+	});
+	
+	// TESTS: Capturing
+	
+	prep(function(){
+		re = /aa(b)aa/g;
+		tmp = str;
+	});
+	
+	test( "Compiled Capture Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( re );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Capture Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "asdfasdfasdf" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Capture Replace with Capture", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, "asdf\\1asdfasdf" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Capture Replace with Capture Function", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, function(all,capture){
+			return "asdf" + capture + "asdfasdf";
+		});
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Compiled Capture Replace with Upperase Capture Function", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( re, function(all,capture){
+			return capture.toUpperCase();
+		});
+	});
+	
+	// TESTS: Uncompiled RegExps
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Uncompiled Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( /aaaaaaaaaa/g );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Uncompiled Test", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = (/aaaaaaaaaa/g).test( tmp );
+	});
+    
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Uncompiled Empty Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( /aaaaaaaaaa/g, "" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Uncompiled 12 Char Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( /aaaaaaaaaa/g, "asdfasdfasdf" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Uncompiled Object Match", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = tmp.match( new RegExp("aaaaaaaaaa", "g") );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Uncompiled Object Test", function(){
+		for ( var i = 0; i < 100; i++ )
+			ret = (new RegExp("aaaaaaaaaa", "g")).test( tmp );
+	});
+    
+	prep(function(){
+		tmp = str;
+	});
+    
+	test( "Uncompiled Object Empty Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( new RegExp("aaaaaaaaaa", "g"), "" );
+	});
+	
+	prep(function(){
+		tmp = str;
+	});
+	
+	test( "Uncompiled Object 12 Char Replace", function(){
+		for ( var i = 0; i < 50; i++ )
+			ret = tmp.replace( new RegExp("aaaaaaaaaa", "g"), "asdfasdfasdf" );
+	});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/dromaeo-object-string.html b/tests/dromaeo-object-string.html
new file mode 100644
index 0000000..80eedbe
--- /dev/null
+++ b/tests/dromaeo-object-string.html
@@ -0,0 +1,197 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+window.onload = function(){ startTest("dromaeo-object-string", '');
+
+// Try to force real results
+var ret;
+var num = 80000;
+
+// TESTS: String concatenation
+
+	test( "Concat String", function(){
+		var str = "";
+		for ( var i = 0; i < num; i++ )
+			str += "a";
+		ret = str;
+	});
+
+	test( "Concat String Object", function(){
+		var str = new String();
+		for ( var i = 0; i < num; i++ )
+			str += "a";
+		ret = str;
+	});
+
+	test( "Concat String from charCode", function(){
+		var str = "";
+		for ( var i = 0; i < num / 2; i++ )
+			str += String.fromCharCode(97);
+		ret = str;
+	});
+
+	test( "Array String Join", function(){
+		var str = [];
+		for ( var i = 0; i < num / 2; i++ )
+			str.push("a");
+		ret = str.join("");
+	});
+
+var ostr = [], tmp, num = 5000, tmpstr;
+
+for ( var i = 0; i < 16384; i++ )
+	ostr.push( String.fromCharCode( (25 * Math.random()) + 97 ) );
+
+ostr = ostr.join("");
+ostr += ostr;
+ostr += ostr;
+
+var str;
+var i = 52288;
+
+	prep(function(){
+		str = new String(ostr);
+	});
+
+	// TESTS: split
+	test( "String Split", function(){
+		ret = str.split("");
+	});
+
+	prep(function(){
+		tmpstr = str;
+		tmpstr += tmpstr;
+		tmpstr += tmpstr;
+		tmpstr += tmpstr;
+		tmpstr += tmpstr;
+	});
+
+	test( "String Split on Char", function(){
+		ret = tmpstr.split("a");
+	});
+
+	prep(function(){
+		str += str;
+	});
+
+	// TESTS: characters
+
+	test( "charAt", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.charAt(0);
+			ret = str.charAt(str.length - 1);
+			ret = str.charAt( 15000 );
+			ret = str.charAt( 12000 );
+		}
+	});
+
+	test( "[Number]", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str[0];
+			ret = str[str.length - 1];
+			ret = str[ 15000 ];
+			ret = str[ 10000 ];
+			ret = str[ 5000 ];
+		}
+	});
+
+	test( "charCodeAt", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.charCodeAt(0);
+			ret = str.charCodeAt(str.length - 1);
+			ret = str.charCodeAt( 15000 );
+			ret = str.charCodeAt( 10000 );
+			ret = str.charCodeAt( 5000 );
+		}
+	});
+
+	// TESTS: indexOf
+
+	test( "indexOf", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.indexOf("a");
+			ret = str.indexOf("b");
+			ret = str.indexOf("c");
+			ret = str.indexOf("d");
+		}
+	});
+
+	test( "lastIndexOf", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.lastIndexOf("a");
+			ret = str.lastIndexOf("b");
+			ret = str.lastIndexOf("c");
+			ret = str.lastIndexOf("d");
+		}
+	});
+
+	// TESTS: slice
+
+	test( "slice", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.slice(0);
+			ret = str.slice(0,5);
+			ret = str.slice(-1);
+			ret = str.slice(-6,-1);
+			ret = str.slice( 15000, 15005 );
+			ret = str.slice( 12000, -1 );
+		}
+	});
+
+	// TESTS: substr
+
+	test( "substr", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.substr(0);
+			ret = str.substr(0,5);
+			ret = str.substr(-1);
+			ret = str.substr(-6,1);
+			ret = str.substr( 15000, 5 );
+			ret = str.substr( 12000, 5 );
+		}
+	});
+
+	// TESTS: substring
+
+	test( "substring", function(){
+		for ( var j = 0; j < num; j++ ) {
+			ret = str.substring(0);
+			ret = str.substring(0,5);
+			ret = str.substring(-1);
+			ret = str.substring(-6,-1);
+			ret = str.substring( 15000, 15005 );
+			ret = str.substring( 12000, -1 );
+		}
+	});
+
+	// TESTS: toLower/UpperCase
+
+	test( "toLowerCase", function(){
+		for ( var j = 0; j < num / 1000; j++ ) {
+			ret = str.toLowerCase();
+		}
+	});
+
+	test( "toUpperCase", function(){
+		for ( var j = 0; j < num / 1000; j++ ) {
+			ret = str.toUpperCase();
+		}
+	});
+
+	// TESTS: comparing
+
+	test( "comparing", function(){
+		var tmp = str + "a";
+		for ( var j = 0; j < num / 1000; j++ ) {
+			ret = str == tmp;
+			ret = str < tmp;
+			ret = str > tmp;
+		}
+	});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/dromaeo-string-base64.html b/tests/dromaeo-string-base64.html
new file mode 100644
index 0000000..b541bbc
--- /dev/null
+++ b/tests/dromaeo-string-base64.html
@@ -0,0 +1,155 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla XML-RPC Client component.
+ *
+ * The Initial Developer of the Original Code is
+ * Digital Creations 2, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2000
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Martijn Pieters <mj@digicool.com> (original author)
+ *   Samuel Sieb <samuel@sieb.net>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// From: http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js#956
+
+/* Convert data (an array of integers) to a Base64 string. */
+var toBase64Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+var base64Pad = '=';
+
+function toBase64(data) {
+    var result = '';
+    var length = data.length;
+    var i;
+    // Convert every three bytes to 4 ascii characters.
+    for (i = 0; i < (length - 2); i += 3) {
+        result += toBase64Table[data.charCodeAt(i) >> 2];
+        result += toBase64Table[((data.charCodeAt(i) & 0x03) << 4) + (data.charCodeAt(i+1) >> 4)];
+        result += toBase64Table[((data.charCodeAt(i+1) & 0x0f) << 2) + (data.charCodeAt(i+2) >> 6)];
+        result += toBase64Table[data.charCodeAt(i+2) & 0x3f];
+    }
+
+    // Convert the remaining 1 or 2 bytes, pad out to 4 characters.
+    if (length%3) {
+        i = length - (length%3);
+        result += toBase64Table[data.charCodeAt(i) >> 2];
+        if ((length%3) == 2) {
+            result += toBase64Table[((data.charCodeAt(i) & 0x03) << 4) + (data.chartCodeAt(i+1) >> 4)];
+            result += toBase64Table[(data.charCodeAt(i+1) & 0x0f) << 2];
+            result += base64Pad;
+        } else {
+            result += toBase64Table[(data.charCodeAt(i) & 0x03) << 4];
+            result += base64Pad + base64Pad;
+        }
+    }
+
+    return result;
+}
+
+/* Convert Base64 data to a string */
+var toBinaryTable = [
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
+    52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1,
+    -1, 0, 1, 2,  3, 4, 5, 6,  7, 8, 9,10, 11,12,13,14,
+    15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
+    -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
+    41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
+];
+
+function base64ToString(data) {
+    var result = '';
+    var leftbits = 0; // number of bits decoded, but yet to be appended
+    var leftdata = 0; // bits decoded, but yet to be appended
+
+    // Convert one by one.
+    for (var i = 0; i < data.length; i++) {
+        var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
+        var padding = (data.charCodeAt(i) == base64Pad.charCodeAt(0));
+        // Skip illegal characters and whitespace
+        if (c == -1) continue;
+        
+        // Collect data into leftdata, update bitcount
+        leftdata = (leftdata << 6) | c;
+        leftbits += 6;
+
+        // If we have 8 or more bits, append 8 bits to the result
+        if (leftbits >= 8) {
+            leftbits -= 8;
+            // Append if not padding.
+            if (!padding)
+                result += String.fromCharCode((leftdata >> leftbits) & 0xff);
+            leftdata &= (1 << leftbits) - 1;
+        }
+    }
+
+    // If there are any bits left, the base64 string was corrupted
+    if (leftbits)
+        throw Components.Exception('Corrupted base64 string');
+
+    return result;
+}
+
+window.onload = function(){ startTest("dromaeo-string-base64", '');
+
+var str = [];
+
+for ( var i = 0; i < 4096; i++ )
+        str.push( String.fromCharCode( (25 * Math.random()) + 97 ) );
+
+str = str.join("");
+str += str;
+str += str;
+
+var base64;
+
+test( "Convert String to Base 64", function(){
+	base64 = toBase64(str);
+});
+
+prep(function(){
+	if ( !base64 )
+		base64 = toBase64(str);
+});
+
+test( "Convert Base 64 to String", function(){
+	if ( str !== base64ToString(base64) ) {
+		throw "String conversion mis-match.";
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/jslib-attr-jquery.html b/tests/jslib-attr-jquery.html
new file mode 100644
index 0000000..f872ea2
--- /dev/null
+++ b/tests/jslib-attr-jquery.html
@@ -0,0 +1,2949 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/jquery.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-attr-jquery", '');
+
+// Try to force real results
+var ret, tmp, div;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		div = jQuery("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("jQuery - addClass", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.addClass("foo");
+	});
+
+	test("jQuery - removeClass", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.removeClass("foo");
+	});
+
+	test("jQuery - hasClass x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.hasClass("test");
+	});
+
+	test("jQuery - attr(class) x100", function(){
+		for ( var i = 0; i < 1000; i++ )
+		ret = div.attr("class");
+	});
+
+	test("jQuery - attr(class,test)", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.attr("class","test");
+	});
+
+	test("jQuery - removeAttribute", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.removeAttr("id");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-attr-prototype.html b/tests/jslib-attr-prototype.html
new file mode 100644
index 0000000..596bb94
--- /dev/null
+++ b/tests/jslib-attr-prototype.html
@@ -0,0 +1,2949 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/prototype.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-attr-prototype", '');
+
+// Try to force real results
+var ret, tmp, div;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		div = $$("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("Prototype - addClassName", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("addClassName", "foo");
+	});
+
+	test("Prototype - removeClassName", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("removeClassName", "foo");
+	});
+
+	test("Prototype - hasClassName", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("hasClassName", "test");
+	});
+
+	test("Prototype - readAttribute", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("readAttribute", "class");
+	});
+
+	test("Prototype - writeAttribute", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("writeAttribute","class","test");
+	});
+
+	/* ???
+	test("Prototype - removeAttribute", function(){
+	});
+	*/
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-event-jquery.html b/tests/jslib-event-jquery.html
new file mode 100644
index 0000000..226cc0c
--- /dev/null
+++ b/tests/jslib-event-jquery.html
@@ -0,0 +1,2936 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/jquery.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-event-jquery", '');
+
+// Try to force real results
+var ret, tmp, div;
+
+var html = document.body.innerHTML;
+
+function testfn(){}
+
+	prep(function(){
+		div = jQuery("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("jQuery - bind", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.bind("click", testfn);
+	});
+
+	test("jQuery - trigger", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.trigger("click");
+	});
+
+	test("jQuery - unbind x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		div.unbind("click", testfn);
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-event-prototype.html b/tests/jslib-event-prototype.html
new file mode 100644
index 0000000..f70799c
--- /dev/null
+++ b/tests/jslib-event-prototype.html
@@ -0,0 +1,2936 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/prototype.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-event-prototype", '');
+
+// Try to force real results
+var ret, tmp, div;
+
+var html = document.body.innerHTML;
+
+function testfn(){}
+
+	prep(function(){
+		div = $$("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("Prototype - observe", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("observe", "click", testfn);
+	});
+
+	test("Prototype - fire", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("fire", "click");
+	});
+
+	test("Prototype - stopObserving", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("stopObserving", "click", testfn);
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-modify-jquery.html b/tests/jslib-modify-jquery.html
new file mode 100644
index 0000000..e566759
--- /dev/null
+++ b/tests/jslib-modify-jquery.html
@@ -0,0 +1,2960 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/jquery.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-modify-jquery", '');
+
+// Try to force real results
+var ret, tmp, div, a, dd;
+
+var html = document.body.innerHTML,
+	elem = document.createElement("div"),
+	elem2 = document.createElement("strong"),
+	elemStr = "<strong>some text</strong>";
+
+	prep(function(){
+		a = jQuery("a");
+		dd = jQuery("dd");
+		div = jQuery("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+
+	/* // Need to find a good way to test this
+	test("jQuery - wrap()", function(){
+		div.wrap( elem );
+	});
+	*/
+
+	test("jQuery - html()", function(){
+		dd.html( elemStr );
+	});
+
+	test("jQuery - before()", function(){
+		div.before( elemStr );
+	});
+
+	test("jQuery - after()", function(){
+		div.before( elemStr );
+	});
+
+	test("jQuery - prepend()", function(){
+		div.prepend( elemStr );
+	});
+
+	test("jQuery - append()", function(){
+		div.append( elemStr );
+	});
+
+	/* // Need a good way to test
+	test("jQuery - replaceWith()", function(){
+		div.replaceWith( elem );
+	});
+
+	test("jQuery - remove()", function(){
+		div.remove();
+	});
+	*/
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-modify-prototype.html b/tests/jslib-modify-prototype.html
new file mode 100644
index 0000000..bcf9651
--- /dev/null
+++ b/tests/jslib-modify-prototype.html
@@ -0,0 +1,2960 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/prototype.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-modify-prototype", '');
+
+// Try to force real results
+var ret, tmp, div, a, dd;
+
+var html = document.body.innerHTML,
+	elem = document.createElement("div"),
+	elem2 = document.createElement("strong"),
+	elemStr = "<strong>some text</strong>";
+
+	prep(function(){
+		a = $$("a");
+		dd = $$("dd");
+		div = $$("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+
+	/* // Need a good way to test this
+	test("Prototype - wrap()", function(){
+		div.invoke("wrap", "div");
+	});
+	*/
+
+	test("Prototype - update()", function(){
+		dd.invoke("update", elemStr);
+	});
+	
+	test("Prototype - before", function(){
+		div.invoke("insert", {before: elemStr});
+	});
+
+	test("Prototype - after", function(){
+		div.invoke("insert", {after: elemStr});
+	});
+
+	test("Prototype - prepend", function(){
+		div.invoke("insert", {top: elemStr});
+	});
+
+	test("Prototype - append", function(){
+		div.invoke("insert", {bottom: elemStr});
+	});
+
+	/* // Need a good way to test
+	test("Prototype - replace()", function(){
+		div.invoke("replace", elem );
+	});
+
+	test("Prototype - remove()", function(){
+		div.invoke("remove");
+	});
+	*/
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-style-jquery.html b/tests/jslib-style-jquery.html
new file mode 100644
index 0000000..74e3f61
--- /dev/null
+++ b/tests/jslib-style-jquery.html
@@ -0,0 +1,2958 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/jquery.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-style-jquery", '');
+
+// Try to force real results
+var ret, tmp, div;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		div = jQuery("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("jQuery - css(color) x100", function(){
+		for ( var i = 0; i < 1000; i++ )
+		ret = div.css("color");
+	});
+
+	test("jQuery - css(color,red)", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.css("color","red");
+	});
+
+	test("jQuery - height() x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.height();
+	});
+
+	test("jQuery - width() x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.width();
+	});
+
+	test("jQuery - .is(:visible)", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.is(":visible");
+	});
+
+	test("jQuery - .show()", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.show();
+	});
+
+	test("jQuery - .hide()", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.hide();
+	});
+
+	test("jQuery - .toggle()", function(){
+		div.toggle();
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-style-prototype.html b/tests/jslib-style-prototype.html
new file mode 100644
index 0000000..64fabd6
--- /dev/null
+++ b/tests/jslib-style-prototype.html
@@ -0,0 +1,2959 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/prototype.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-style-prototype", '');
+
+// Try to force real results
+var ret, tmp, div;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		div = $$("div");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("Prototype - getStyle()", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("getStyle","color");
+	});
+
+	test("Prototype - setStyle()", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("setStyle","color","red");
+	});
+
+	test("Prototype - getHeight()", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("getHeight");
+	});
+
+	test("Prototype - getWidth()", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("getWidth");
+	});
+
+	test("Prototype - visible()", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("visible");
+	});
+
+	test("Prototype - .show()", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("show");
+	});
+
+	test("Prototype - .hide()", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("hide");
+	});
+
+	test("Prototype - .toggle() x10", function(){
+		for ( var i = 0; i < 10; i++ )
+		div.invoke("toggle");
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-traverse-jquery.html b/tests/jslib-traverse-jquery.html
new file mode 100644
index 0000000..e336a97
--- /dev/null
+++ b/tests/jslib-traverse-jquery.html
@@ -0,0 +1,2960 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/jquery.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-traverse-jquery", '');
+
+// Try to force real results
+var ret, tmp, div, dd;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		div = jQuery("div");
+		dd = jQuery("dd");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("jQuery - parent x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.parent().length;
+	});
+
+	test("jQuery - parents x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.parents().length;
+	});
+
+	test("jQuery - prev x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.prev().length;
+	});
+
+	test("jQuery - prevAll", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = dd.prevAll().length;
+	});
+
+	test("jQuery - next x10", function(){
+		for ( var i = 0; i < 100; i++ )
+		ret = div.next().length;
+	});
+
+	test("jQuery - nextAll", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = dd.nextAll().length;
+	});
+
+	test("jQuery - siblings", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = dd.siblings().length;
+	});
+
+	test("jQuery - children", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.children().length;
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/jslib-traverse-prototype.html b/tests/jslib-traverse-prototype.html
new file mode 100644
index 0000000..c23ee41
--- /dev/null
+++ b/tests/jslib-traverse-prototype.html
@@ -0,0 +1,2960 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script src="../lib/prototype.js"></script>
+<script>
+window.onload = function(){
+startTest("jslib-traverse-prototype", '');
+
+// Try to force real results
+var ret, tmp, div, dd;
+
+var html = document.body.innerHTML;
+
+	prep(function(){
+		div = $$("div");
+		dd = $$("dd");
+		var tmp = document.createElement("div");
+		tmp.innerHTML = html;
+		document.body.appendChild( tmp );
+	});
+	
+	test("Prototype - up", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("up").length;
+	});
+
+	test("Prototype - ancestors", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("ancestors").length;
+	});
+
+	test("Prototype - previous", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("previous").length;
+	});
+
+	test("Prototype - previousSiblings", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = dd.invoke("previousSiblings").length;
+	});
+
+	test("Prototype - next", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("next").length;
+	});
+
+	test("Prototype - nextSiblings", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = dd.invoke("nextSiblings").length;
+	});
+
+	test("Prototype - siblings", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = dd.invoke("siblings").length;
+	});
+
+	test("Prototype - childElements", function(){
+		for ( var i = 0; i < 10; i++ )
+		ret = div.invoke("childElements").length;
+	});
+
+endTest();
+};
+</script>
+</head>
+<body>
+  <div class="head">
+   <p><a href="http://www.w3.org/"><img height=48 alt=W3C src="http://www.w3.org/Icons/w3c_home" width=72></a>
+
+   <h1 id="title">Selectors</h1>
+
+   <h2>W3C Working Draft 15 December 2005</h2>
+
+   <dl>
+
+    <dt>This version:
+
+    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">
+                 http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
+
+    <dt>Latest version:
+
+    <dd><a href="http://www.w3.org/TR/css3-selectors">
+                 http://www.w3.org/TR/css3-selectors</a>
+
+    <dt>Previous version:
+
+    <dd><a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113">
+                 http://www.w3.org/TR/2001/CR-css3-selectors-20011113</a>
+
+    <dt><a name=editors-list></a>Editors:
+
+    <dd class="vcard"><span class="fn">Daniel Glazman</span> (Invited Expert)</dd>
+
+    <dd class="vcard"><a lang="tr" class="url fn" href="http://www.tantek.com/">Tantek &Ccedil;elik</a> (Invited Expert)
+
+    <dd class="vcard"><a href="mailto:ian@hixie.ch" class="url fn">Ian Hickson</a> (<span
+    class="company"><a href="http://www.google.com/">Google</a></span>)
+
+    <dd class="vcard"><span class="fn">Peter Linss</span> (former editor, <span class="company"><a
+    href="http://www.netscape.com/">Netscape/AOL</a></span>)
+
+    <dd class="vcard"><span class="fn">John Williams</span> (former editor, <span class="company"><a
+    href="http://www.quark.com/">Quark, Inc.</a></span>)
+
+   </dl>
+
+   <p class="copyright"><a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+   Copyright</a> &copy; 2005 <a href="http://www.w3.org/"><abbr
+   title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup>
+   (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
+   Institute of Technology">MIT</abbr></a>, <a
+   href="http://www.ercim.org/"><acronym title="European Research
+   Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+   href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.  W3C
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
+   <a
+   href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+   use</a> rules apply.
+
+   <hr title="Separator for header">
+
+  </div>
+
+  <h2><a name=abstract></a>Abstract</h2>
+
+  <p><em>Selectors</em> are patterns that match against elements in a
+  tree. Selectors have been optimized for use with HTML and XML, and
+  are designed to be usable in performance-critical code.</p>
+
+  <p><acronym title="Cascading Style Sheets">CSS</acronym> (Cascading
+  Style Sheets) is a language for describing the rendering of <acronym
+  title="Hypertext Markup Language">HTML</acronym> and <acronym
+  title="Extensible Markup Language">XML</acronym> documents on
+  screen, on paper, in speech, etc. CSS uses Selectors for binding
+  style properties to elements in the document. This document
+  describes extensions to the selectors defined in CSS level 2. These
+  extended selectors will be used by CSS level 3.
+
+  <p>Selectors define the following function:</p>
+
+  <pre>expression &#x2217; element &rarr; boolean</pre>
+
+  <p>That is, given an element and a selector, this specification
+  defines whether that element matches the selector.</p>
+
+  <p>These expressions can also be used, for instance, to select a set
+  of elements, or a single element from a set of elements, by
+  evaluating the expression across all the elements in a
+  subtree. <acronym title="Simple Tree Transformation
+  Sheets">STTS</acronym> (Simple Tree Transformation Sheets), a
+  language for transforming XML trees, uses this mechanism. <a href="#refsSTTS">[STTS]</a></p>
+
+  <h2><a name=status></a>Status of this document</h2>
+
+  <p><em>This section describes the status of this document at the
+  time of its publication. Other documents may supersede this
+  document. A list of current W3C publications and the latest revision
+  of this technical report can be found in the <a
+  href="http://www.w3.org/TR/">W3C technical reports index at
+  http://www.w3.org/TR/.</a></em></p>
+
+  <p>This document describes the selectors that already exist in <a
+  href="#refsCSS1"><abbr title="CSS level 1">CSS1</abbr></a> and <a
+  href="#refsCSS21"><abbr title="CSS level 2">CSS2</abbr></a>, and
+  also proposes new selectors for <abbr title="CSS level
+  3">CSS3</abbr> and other languages that may need them.</p>
+
+  <p>The CSS Working Group doesn't expect that all implementations of
+  CSS3 will have to implement all selectors. Instead, there will
+  probably be a small number of variants of CSS3, called profiles. For
+  example, it may be that only a profile for interactive user agents
+  will include all of the selectors.</p>
+
+  <p>This specification is a last call working draft for the the <a
+  href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
+  (<a href="/Style/">Style Activity</a>). This
+  document is a revision of the <a
+  href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/">Candidate
+  Recommendation dated 2001 November 13</a>, and has incorporated
+  implementation feedback received in the past few years. It is
+  expected that this last call will proceed straight to Proposed
+  Recommendation stage since it is believed that interoperability will
+  be demonstrable.</p>
+
+  <p>All persons are encouraged to review and implement this
+  specification and return comments to the (<a
+  href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
+  public mailing list <a
+  href="http://www.w3.org/Mail/Lists.html#www-style">www-style</a>
+  (see <a href="http://www.w3.org/Mail/Request">instructions</a>). W3C
+  Members can also send comments directly to the CSS Working
+  Group.
+  The deadline for comments is 14 January 2006.</p>
+
+  <p>This is still a draft document and may be updated, replaced, or
+  obsoleted by other documents at any time. It is inappropriate to
+  cite a W3C Working Draft as other than &quot;work in progress&quot;.
+
+  <p>This document may be available in <a
+  href="http://www.w3.org/Style/css3-selectors-updates/translations">translation</a>.
+  The English version of this specification is the only normative
+  version.
+
+  <div class="subtoc">
+
+   <h2 id="test10"><a name=contents>Table of contents</a></h2>
+
+   <ul class="toc">
+    <li class="tocline2"><a href="#context">1. Introduction</a>
+     <ul>
+      <li><a href="#dependencies">1.1. Dependencies</a> </li>
+      <li><a href="#terminology">1.2. Terminology</a> </li>
+      <li><a href="#changesFromCSS2">1.3. Changes from CSS2</a> </li>
+     </ul>
+    <li class="tocline2"><a href="#selectors">2. Selectors</a>
+    <li class="tocline2"><a href="#casesens">3. Case sensitivity</a>
+    <li class="tocline2"><a href="#selector-syntax">4. Selector syntax</a>
+    <li class="tocline2"><a href="#grouping">5. Groups of selectors</a>
+    <li class="tocline2"><a href="#simple-selectors">6. Simple selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#type-selectors">6.1. Type selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#typenmsp">6.1.1. Type selectors and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#universal-selector">6.2. Universal selector</a>
+       <ul>
+        <li><a href="#univnmsp">6.2.1. Universal selector and namespaces</a></li>
+       </ul>
+      <li class="tocline3"><a href="#attribute-selectors">6.3. Attribute selectors</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#attribute-representation">6.3.1. Representation of attributes and attributes values</a>
+        <li><a href="#attribute-substrings">6.3.2. Substring matching attribute selectors</a>
+        <li class="tocline4"><a href="#attrnmsp">6.3.3. Attribute selectors and namespaces</a>
+        <li class="tocline4"><a href="#def-values">6.3.4. Default attribute values in DTDs</a></li>
+       </ul>
+      <li class="tocline3"><a href="#class-html">6.4. Class selectors</a>
+      <li class="tocline3"><a href="#id-selectors">6.5. ID selectors</a>
+      <li class="tocline3"><a href="#pseudo-classes">6.6. Pseudo-classes</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#dynamic-pseudos">6.6.1. Dynamic pseudo-classes</a>
+        <li class="tocline4"><a href="#target-pseudo">6.6.2. The :target pseudo-class</a>
+        <li class="tocline4"><a href="#lang-pseudo">6.6.3. The :lang() pseudo-class</a>
+        <li class="tocline4"><a href="#UIstates">6.6.4. UI element states pseudo-classes</a>
+        <li class="tocline4"><a href="#structural-pseudos">6.6.5. Structural pseudo-classes</a>
+         <ul>
+          <li><a href="#root-pseudo">:root pseudo-class</a>
+          <li><a href="#nth-child-pseudo">:nth-child() pseudo-class</a>
+          <li><a href="#nth-last-child-pseudo">:nth-last-child()</a>
+          <li><a href="#nth-of-type-pseudo">:nth-of-type() pseudo-class</a>
+          <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a>
+          <li><a href="#first-child-pseudo">:first-child pseudo-class</a>
+          <li><a href="#last-child-pseudo">:last-child pseudo-class</a>
+          <li><a href="#first-of-type-pseudo">:first-of-type pseudo-class</a>
+          <li><a href="#last-of-type-pseudo">:last-of-type pseudo-class</a>
+          <li><a href="#only-child-pseudo">:only-child pseudo-class</a>
+          <li><a href="#only-of-type-pseudo">:only-of-type pseudo-class</a>
+          <li><a href="#empty-pseudo">:empty pseudo-class</a></li>
+         </ul>
+        <li class="tocline4"><a href="#negation">6.6.7. The negation pseudo-class</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li><a href="#pseudo-elements">7. Pseudo-elements</a>
+     <ul>
+      <li><a href="#first-line">7.1. The ::first-line pseudo-element</a>
+      <li><a href="#first-letter">7.2. The ::first-letter pseudo-element</a>
+      <li><a href="#UIfragments">7.3. The ::selection pseudo-element</a>
+      <li><a href="#gen-content">7.4. The ::before and ::after pseudo-elements</a></li>
+     </ul>
+    <li class="tocline2"><a href="#combinators">8. Combinators</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#descendant-combinators">8.1. Descendant combinators</a>
+      <li class="tocline3"><a href="#child-combinators">8.2. Child combinators</a>
+      <li class="tocline3"><a href="#sibling-combinators">8.3. Sibling combinators</a>
+       <ul class="toc">
+        <li class="tocline4"><a href="#adjacent-sibling-combinators">8.3.1. Adjacent sibling combinator</a>
+        <li class="tocline4"><a href="#general-sibling-combinators">8.3.2. General sibling combinator</a></li>
+       </ul>
+      </li>
+     </ul>
+    <li class="tocline2"><a href="#specificity">9. Calculating a selector's specificity</a>
+    <li class="tocline2"><a href="#w3cselgrammar">10. The grammar of Selectors</a>
+     <ul class="toc">
+      <li class="tocline3"><a href="#grammar">10.1. Grammar</a>
+      <li class="tocline3"><a href="#lex">10.2. Lexical scanner</a></li>
+     </ul>
+    <li class="tocline2"><a href="#downlevel">11. Namespaces and down-level clients</a>
+    <li class="tocline2"><a href="#profiling">12. Profiles</a>
+    <li><a href="#Conformance">13. Conformance and requirements</a>
+    <li><a href="#Tests">14. Tests</a>
+    <li><a href="#ACKS">15. Acknowledgements</a>
+    <li class="tocline2"><a href="#references">16. References</a>
+   </ul>
+
+  </div>
+
+  <h2><a name=context>1. Introduction</a></h2>
+
+  <h3><a name=dependencies></a>1.1. Dependencies</h3>
+
+  <p>Some features of this specification are specific to CSS, or have
+  particular limitations or rules specific to CSS. In this
+  specification, these have been described in terms of CSS2.1. <a
+  href="#refsCSS21">[CSS21]</a></p>
+
+  <h3><a name=terminology></a>1.2. Terminology</h3>
+
+  <p>All of the text of this specification is normative except
+  examples, notes, and sections explicitly marked as
+  non-normative.</p>
+
+  <h3><a name=changesFromCSS2></a>1.3. Changes from CSS2</h3>
+ 
+  <p><em>This section is non-normative.</em></p>
+
+  <p>The main differences between the selectors in CSS2 and those in
+  Selectors are:
+
+  <ul>
+
+   <li>the list of basic definitions (selector, group of selectors,
+   simple selector, etc.) has been changed; in particular, what was
+   referred to in CSS2 as a simple selector is now called a sequence
+   of simple selectors, and the term "simple selector" is now used for
+   the components of this sequence</li>
+
+   <li>an optional namespace component is now allowed in type element
+   selectors, the universal selector and attribute selectors</li>
+
+   <li>a <a href="#general-sibling-combinators">new combinator</a> has been introduced</li>
+
+   <li>new simple selectors including substring matching attribute
+   selectors, and new pseudo-classes</li>
+
+   <li>new pseudo-elements, and introduction of the "::" convention
+   for pseudo-elements</li>
+
+   <li>the grammar has been rewritten</li>
+
+   <li>profiles to be added to specifications integrating Selectors
+   and defining the set of selectors which is actually supported by
+   each specification</li>
+
+   <li>Selectors are now a CSS3 Module and an independent
+   specification; other specifications can now refer to this document
+   independently of CSS</li>
+
+   <li>the specification now has its own test suite</li>
+
+  </ul>
+
+<h2><a name=selectors></a>2. Selectors</h2>
+
+<p><em>This section is non-normative, as it merely summarizes the
+following sections.</em></p>
+
+<p>A Selector represents a structure. This structure can be used as a
+condition (e.g. in a CSS rule) that determines which elements a
+selector matches in the document tree, or as a flat description of the
+HTML or XML fragment corresponding to that structure.</p>
+
+<p>Selectors may range from simple element names to rich contextual
+representations.</p>
+
+<p>The following table summarizes the Selector syntax:</p>
+
+<table class="selectorsReview">
+  <thead>
+  <tr>
+    <th class="pattern">Pattern</th>
+    <th class="meaning">Meaning</th>
+    <th class="described">Described in section</th>
+    <th class="origin">First defined in CSS level</th></tr>
+  <tbody>
+  <tr>
+    <td class="pattern">*</td>
+    <td class="meaning">any element</td>
+    <td class="described"><a
+      href="#universal-selector">Universal
+      selector</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E</td>
+    <td class="meaning">an element of type E</td>
+    <td class="described"><a
+      href="#type-selectors">Type selector</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E[foo]</td>
+    <td class="meaning">an E element with a "foo" attribute</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is exactly
+      equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo~="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value is a list of
+      space-separated values, one of which is exactly equal to "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E[foo^="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value begins exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo$="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value ends exactly
+      with the string "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[foo*="bar"]</td>
+    <td class="meaning">an E element whose "foo" attribute value contains the
+      substring "bar"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E[hreflang|="en"]</td>
+    <td class="meaning">an E element whose "hreflang" attribute has a hyphen-separated
+      list of values beginning (from the left) with "en"</td>
+    <td class="described"><a
+      href="#attribute-selectors">Attribute
+      selectors</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:root</td>
+    <td class="meaning">an E element, root of the document</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-child(n)</td>
+    <td class="meaning">an E element, the n-th child of its parent, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:nth-last-of-type(n)</td>
+    <td class="meaning">an E element, the n-th sibling of its type, counting
+      from the last one</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-child</td>
+    <td class="meaning">an E element, first child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:last-child</td>
+    <td class="meaning">an E element, last child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:first-of-type</td>
+    <td class="meaning">an E element, first sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:last-of-type</td>
+    <td class="meaning">an E element, last sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-child</td>
+    <td class="meaning">an E element, only child of its parent</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:only-of-type</td>
+    <td class="meaning">an E element, only sibling of its type</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:empty</td>
+    <td class="meaning">an E element that has no children (including text
+    nodes)</td>
+    <td class="described"><a
+      href="#structural-pseudos">Structural
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:link<br>E:visited</td>
+    <td class="meaning">an E element being the source anchor of a hyperlink of
+      which the target is not yet visited (:link) or already visited
+    (:visited)</td>
+    <td class="described"><a
+      href="#link">The link
+      pseudo-classes</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:active<br>E:hover<br>E:focus</td>
+    <td class="meaning">an E element during certain user actions</td>
+    <td class="described"><a
+      href="#useraction-pseudos">The user
+      action pseudo-classes</a></td>
+    <td class="origin">1 and 2</td></tr>
+  <tr>
+    <td class="pattern">E:target</td>
+    <td class="meaning">an E element being the target of the referring URI</td>
+    <td class="described"><a
+      href="#target-pseudo">The target
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:lang(fr)</td>
+    <td class="meaning">an element of type E in language "fr" (the document
+      language specifies how language is determined)</td>
+    <td class="described"><a
+      href="#lang-pseudo">The :lang()
+      pseudo-class</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E:enabled<br>E:disabled</td>
+    <td class="meaning">a user interface element E which is enabled or
+    disabled</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E:checked<!--<br>E:indeterminate--></td>
+    <td class="meaning">a user interface element E which is checked<!-- or in an
+      indeterminate state--> (for instance a radio-button or checkbox)</td>
+    <td class="described"><a
+      href="#UIstates">The UI element states
+      pseudo-classes</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::first-line</td>
+    <td class="meaning">the first formatted line of an E element</td>
+    <td class="described"><a
+      href="#first-line">The ::first-line
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::first-letter</td>
+    <td class="meaning">the first formatted letter of an E element</td>
+    <td class="described"><a
+      href="#first-letter">The ::first-letter
+      pseudo-element</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E::selection</td>
+    <td class="meaning">the portion of an E element that is currently
+      selected/highlighted by the user</td>
+    <td class="described"><a
+      href="#UIfragments">The UI element
+      fragments pseudo-elements</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E::before</td>
+    <td class="meaning">generated content before an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::before
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E::after</td>
+    <td class="meaning">generated content after an E element</td>
+    <td class="described"><a
+      href="#gen-content">The ::after
+      pseudo-element</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E.warning</td>
+    <td class="meaning">an E element whose class is
+"warning" (the document language specifies how class is determined).</td>
+    <td class="described"><a
+      href="#class-html">Class
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E#myid</td>
+    <td class="meaning">an E element with ID equal to "myid".</td>
+    <td class="described"><a
+      href="#id-selectors">ID
+    selectors</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E:not(s)</td>
+    <td class="meaning">an E element that does not match simple selector s</td>
+    <td class="described"><a
+      href="#negation">Negation
+      pseudo-class</a></td>
+    <td class="origin">3</td></tr>
+  <tr>
+    <td class="pattern">E F</td>
+    <td class="meaning">an F element descendant of an E element</td>
+    <td class="described"><a
+      href="#descendant-combinators">Descendant
+      combinator</a></td>
+    <td class="origin">1</td></tr>
+  <tr>
+    <td class="pattern">E &gt; F</td>
+    <td class="meaning">an F element child of an E element</td>
+    <td class="described"><a
+      href="#child-combinators">Child
+      combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E + F</td>
+    <td class="meaning">an F element immediately preceded by an E element</td>
+    <td class="described"><a
+      href="#adjacent-sibling-combinators">Adjacent sibling combinator</a></td>
+    <td class="origin">2</td></tr>
+  <tr>
+    <td class="pattern">E ~ F</td>
+    <td class="meaning">an F element preceded by an E element</td>
+    <td class="described"><a
+      href="#general-sibling-combinators">General sibling combinator</a></td>
+    <td class="origin">3</td></tr></tbody></table>
+
+<p>The meaning of each selector is derived from the table above by
+prepending "matches" to the contents of each cell in the "Meaning"
+column.</p>
+
+<h2><a name=casesens>3. Case sensitivity</a></h2>
+
+<p>The case sensitivity of document language element names, attribute
+names, and attribute values in selectors depends on the document
+language. For example, in HTML, element names are case-insensitive,
+but in XML, they are case-sensitive.</p>
+
+<h2><a name=selector-syntax>4. Selector syntax</a></h2>
+
+<p>A <dfn><a name=selector>selector</a></dfn> is a chain of one
+or more <a href="#sequence">sequences of simple selectors</a>
+separated by <a href="#combinators">combinators</a>.</p>
+
+<p>A <dfn><a name=sequence>sequence of simple selectors</a></dfn>
+is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
+that are not separated by a <a href="#combinators">combinator</a>. It
+always begins with a <a href="#type-selectors">type selector</a> or a
+<a href="#universal-selector">universal selector</a>. No other type
+selector or universal selector is allowed in the sequence.</p>
+
+<p>A <dfn><a name=simple-selectors-dfn></a><a
+href="#simple-selectors">simple selector</a></dfn> is either a <a
+href="#type-selectors">type selector</a>, <a
+href="#universal-selector">universal selector</a>, <a
+href="#attribute-selectors">attribute selector</a>, <a
+href="#class-html">class selector</a>, <a
+href="#id-selectors">ID selector</a>, <a
+href="#content-selectors">content selector</a>, or <a
+href="#pseudo-classes">pseudo-class</a>. One <a
+href="#pseudo-elements">pseudo-element</a> may be appended to the last
+sequence of simple selectors.</p>
+
+<p><dfn>Combinators</dfn> are: white space, &quot;greater-than
+sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
+<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).  White
+space may appear between a combinator and the simple selectors around
+it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
+(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
+feed" (U+000C) can occur in white space. Other space-like characters,
+such as "em-space" (U+2003) and "ideographic space" (U+3000), are
+never part of white space.</p>
+
+<p>The elements of a document tree that are represented by a selector
+are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
+selector consisting of a single sequence of simple selectors
+represents any element satisfying its requirements. Prepending another
+sequence of simple selectors and a combinator to a sequence imposes
+additional matching constraints, so the subjects of a selector are
+always a subset of the elements represented by the last sequence of
+simple selectors.</p>
+
+<p>An empty selector, containing no sequence of simple selectors and
+no pseudo-element, is an <a href="#Conformance">invalid
+selector</a>.</p>
+
+<h2><a name=grouping>5. Groups of selectors</a></h2>
+
+<p>When several selectors share the same declarations, they may be
+grouped into a comma-separated list. (A comma is U+002C.)</p>
+
+<div class="example">
+<p>CSS examples:</p>
+<p>In this example, we condense three rules with identical
+declarations into one. Thus,</p>
+<pre>h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }</pre>
+<p>is equivalent to:</p>
+<pre>h1, h2, h3 { font-family: sans-serif }</pre>
+</div>
+
+<p><strong>Warning</strong>: the equivalence is true in this example
+because all the selectors are valid selectors. If just one of these
+selectors were invalid, the entire group of selectors would be
+invalid. This would invalidate the rule for all three heading
+elements, whereas in the former case only one of the three individual
+heading rules would be invalidated.</p>
+
+
+<h2><a name=simple-selectors>6. Simple selectors</a></h2>
+
+<h3><a name=type-selectors>6.1. Type selector</a></h3>
+
+<p>A <dfn>type selector</dfn> is the name of a document language
+element type. A type selector represents an instance of the element
+type in the document tree.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents an <code>h1</code> element in the document tree:</p>
+ <pre>h1</pre>
+</div>
+
+
+<h4><a name=typenmsp>6.1.1. Type selectors and namespaces</a></h4>
+
+<p>Type selectors allow an optional namespace (<a
+href="#refsXMLNAMES">[XMLNAMES]</a>) component. A namespace prefix
+that has been previously declared may be prepended to the element name
+separated by the namespace separator &quot;vertical bar&quot;
+(U+007C, <code>|</code>).</p>
+
+<p>The namespace component may be left empty to indicate that the
+selector is only to represent elements with no declared namespace.</p>
+
+<p>An asterisk may be used for the namespace prefix, indicating that
+the selector represents elements in any namespace (including elements
+with no namespace).</p>
+
+<p>Element type selectors that have no namespace component (no
+namespace separator), represent elements without regard to the
+element's namespace (equivalent to "<code>*|</code>") unless a default
+namespace has been declared. If a default namespace has been declared,
+the selector will represent only elements in the default
+namespace.</p>
+
+<p>A type selector containing a namespace prefix that has not been
+previously declared is an <a href="#Conformance">invalid</a> selector.
+The mechanism for declaring a namespace prefix is left up to the
+language implementing Selectors. In CSS, such a mechanism is defined
+in the General Syntax module.</p>
+
+<p>In a namespace-aware client, element type selectors will only match
+against the <a
+href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+of the element's <a
+href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+name</a>. See <a href="#downlevel">below</a> for notes about matching
+behaviors in down-level clients.</p>
+
+<p>In summary:</p>
+
+<dl>
+  <dt><code>ns|E</code></dt>
+  <dd>elements with name E in namespace ns</dd>
+  <dt><code>*|E</code></dt>
+  <dd>elements with name E in any namespace, including those without any
+  declared namespace</dd>
+  <dt><code>|E</code></dt>
+  <dd>elements with name E without any declared namespace</dd>
+  <dt><code>E</code></dt>
+  <dd>if no default namespace has been specified, this is equivalent to *|E.
+  Otherwise it is equivalent to ns|E where ns is the default namespace.</dd>
+</dl>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <pre>@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }</pre>
+
+ <p>The first rule will match only <code>h1</code> elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The second rule will match all elements in the
+ "http://www.example.com" namespace.</p>
+
+ <p>The third rule will match only <code>h1</code> elements without
+ any declared namespace.</p>
+
+ <p>The fourth rule will match <code>h1</code> elements in any
+ namespace (including those without any declared namespace).</p>
+
+ <p>The last rule is equivalent to the fourth rule because no default
+ namespace has been defined.</p>
+
+</div>
+
+<h3><a name=universal-selector>6.2. Universal selector</a> </h3>
+
+<p>The <dfn>universal selector</dfn>, written &quot;asterisk&quot;
+(<code>*</code>), represents the qualified name of any element
+type. It represents any single element in the document tree in any
+namespace (including those without any declared namespace) if no
+default namespace has been specified. If a default namespace has been
+specified, see <a href="#univnmsp">Universal selector and
+Namespaces</a> below.</p>
+
+<p>If the universal selector is not the only component of a sequence
+of simple selectors, the <code>*</code> may be omitted.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <ul>
+  <li><code>*[hreflang|=en]</code> and <code>[hreflang|=en]</code> are equivalent,</li>
+  <li><code>*.warning</code> and <code>.warning</code> are equivalent,</li>
+  <li><code>*#myid</code> and <code>#myid</code> are equivalent.</li>
+ </ul>
+</div>
+
+<p class="note"><strong>Note:</strong> it is recommended that the
+<code>*</code>, representing the universal selector, not be
+omitted.</p>
+
+<h4><a name=univnmsp>6.2.1. Universal selector and namespaces</a></h4>
+
+<p>The universal selector allows an optional namespace component. It
+is used as follows:</p>
+
+<dl>
+ <dt><code>ns|*</code></dt>
+ <dd>all elements in namespace ns</dd>
+ <dt><code>*|*</code></dt>
+ <dd>all elements</dd>
+ <dt><code>|*</code></dt>
+ <dd>all elements without any declared namespace</dd>
+ <dt><code>*</code></dt>
+ <dd>if no default namespace has been specified, this is equivalent to *|*.
+ Otherwise it is equivalent to ns|* where ns is the default namespace.</dd>
+</dl>
+
+<p>A universal selector containing a namespace prefix that has not
+been previously declared is an <a href="#Conformance">invalid</a>
+selector.  The mechanism for declaring a namespace prefix is left up
+to the language implementing Selectors.  In CSS, such a mechanism is
+defined in the General Syntax module.</p>
+
+
+<h3><a name=attribute-selectors>6.3. Attribute selectors</a></h3>
+
+<p>Selectors allow the representation of an element's attributes. When
+a selector is used as an expression to match against an element,
+attribute selectors must be considered to match an element if that
+element has an attribute that matches the attribute represented by the
+attribute selector.</p>
+
+<h4><a name=attribute-representation>6.3.1. Attribute presence and values
+selectors</a></h4>
+
+<p>CSS2 introduced four attribute selectors:</p>
+
+<dl>
+  <dt><code>[att]</code>
+  <dd>Represents an element with the <code>att</code> attribute, whatever the value of
+  the attribute.</dd>
+  <dt><code>[att=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is exactly
+  "val".</dd>
+  <dt><code>[att~=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value is a <a
+  href="#whitespace">whitespace</a>-separated list of words, one of
+  which is exactly "val". If "val" contains whitespace, it will never
+  represent anything (since the words are <em>separated</em> by
+  spaces).</dd>
+  <dt><code>[att|=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute, its value either
+  being exactly "val" or beginning with "val" immediately followed by
+  "-" (U+002D).  This is primarily intended to allow language subcode
+  matches (e.g., the <code>hreflang</code> attribute on the
+  <code>link</code> element in HTML) as described in RFC 3066 (<a
+  href="#refsRFC3066">[RFC3066]</a>).  For <code>lang</code> (or
+  <code>xml:lang</code>) language subcode matching, please see <a
+  href="#lang-pseudo">the <code>:lang</code> pseudo-class</a>.</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names and values in selectors depends on
+the document language.</p>
+
+<div class="example">
+
+  <p>Examples:</p>
+
+  <p>The following attribute selector represents an <code>h1</code>
+  element that carries the <code>title</code> attribute, whatever its
+  value:</p>
+
+  <pre>h1[title]</pre>
+
+  <p>In the following example, the selector represents a
+  <code>span</code> element whose <code>class</code> attribute has
+  exactly the value "example":</p>
+
+  <pre>span[class="example"]</pre>
+
+  <p>Multiple attribute selectors can be used to represent several
+  attributes of an element, or several conditions on the same
+  attribute. Here, the selector represents a <code>span</code> element
+  whose <code>hello</code> attribute has exactly the value "Cleveland"
+  and whose <code>goodbye</code> attribute has exactly the value
+  "Columbus":</p>
+
+  <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre>
+
+  <p>The following selectors illustrate the differences between "="
+  and "~=".  The first selector will represent, for example, the value
+  "copyright copyleft copyeditor" on a <code>rel</code> attribute. The
+  second selector will only represent an <code>a</code> element with
+  an <code>href</code> attribute having the exact value
+  "http://www.w3.org/".</p>
+
+  <pre>a[rel~="copyright"]
+a[href="http://www.w3.org/"]</pre>
+
+  <p>The following selector represents a <code>link</code> element
+  whose <code>hreflang</code> attribute is exactly "fr".</p>
+
+  <pre>link[hreflang=fr]</pre>
+
+  <p>The following selector represents a <code>link</code> element for
+  which the values of the <code>hreflang</code> attribute begins with
+  "en", including "en", "en-US", and "en-cockney":</p>
+
+  <pre>link[hreflang|="en"]</pre>
+
+  <p>Similarly, the following selectors represents a
+  <code>DIALOGUE</code> element whenever it has one of two different
+  values for an attribute <code>character</code>:</p>
+
+  <pre>DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]</pre>
+
+</div>
+
+<h4><a name=attribute-substrings></a>6.3.2. Substring matching attribute
+selectors</h4>
+
+<p>Three additional attribute selectors are provided for matching
+substrings in the value of an attribute:</p>
+
+<dl>
+  <dt><code>[att^=val]</code></dt>
+  <dd>Represents an element with the <code>att</code> attribute whose value begins
+  with the prefix "val".</dd>
+  <dt><code>[att$=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value ends with
+  the suffix "val".</dd>
+  <dt><code>[att*=val]</code>
+  <dd>Represents an element with the <code>att</code> attribute whose value contains
+  at least one instance of the substring "val".</dd>
+</dl>
+
+<p>Attribute values must be identifiers or strings. The
+case-sensitivity of attribute names in selectors depends on the
+document language.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents an HTML <code>object</code>, referencing an
+ image:</p>
+ <pre>object[type^="image/"]</pre>
+ <p>The following selector represents an HTML anchor <code>a</code> with an
+ <code>href</code> attribute whose value ends with ".html".</p>
+ <pre>a[href$=".html"]</pre>
+ <p>The following selector represents an HTML paragraph with a <code>title</code>
+ attribute whose value contains the substring "hello"</p>
+ <pre>p[title*="hello"]</pre>
+</div>
+
+<h4><a name=attrnmsp>6.3.3. Attribute selectors and namespaces</a></h4>
+
+<p>Attribute selectors allow an optional namespace component to the
+attribute name. A namespace prefix that has been previously declared
+may be prepended to the attribute name separated by the namespace
+separator &quot;vertical bar&quot; (<code>|</code>). In keeping with
+the Namespaces in the XML recommendation, default namespaces do not
+apply to attributes, therefore attribute selectors without a namespace
+component apply only to attributes that have no declared namespace
+(equivalent to "<code>|attr</code>"). An asterisk may be used for the
+namespace prefix indicating that the selector is to match all
+attribute names without regard to the attribute's namespace.
+
+<p>An attribute selector with an attribute name containing a namespace
+prefix that has not been previously declared is an <a
+href="#Conformance">invalid</a> selector.  The mechanism for declaring
+a namespace prefix is left up to the language implementing Selectors.
+In CSS, such a mechanism is defined in the General Syntax module.
+
+<div class="example">
+  <p>CSS examples:</p>
+  <pre>@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }</pre>
+
+  <p>The first rule will match only elements with the attribute
+  <code>att</code> in the "http://www.example.com" namespace with the
+  value "val".</p>
+
+  <p>The second rule will match only elements with the attribute
+  <code>att</code> regardless of the namespace of the attribute
+  (including no declared namespace).</p>
+
+  <p>The last two rules are equivalent and will match only elements
+  with the attribute <code>att</code> where the attribute is not
+  declared to be in a namespace.</p>
+
+</div>
+
+<h4><a name=def-values>6.3.4. Default attribute values in DTDs</a></h4>
+
+<p>Attribute selectors represent explicitly set attribute values in
+the document tree. Default attribute values may be defined in a DTD or
+elsewhere, but cannot always be selected by attribute
+selectors. Selectors should be designed so that they work even if the
+default values are not included in the document tree.</p>
+
+<p>More precisely, a UA is <em>not</em> required to read an "external
+subset" of the DTD but <em>is</em> required to look for default
+attribute values in the document's "internal subset." (See <a
+href="#refsXML10">[XML10]</a> for definitions of these subsets.)</p>
+
+<p>A UA that recognizes an XML namespace <a
+href="#refsXMLNAMES">[XMLNAMES]</a> is not required to use its
+knowledge of that namespace to treat default attribute values as if
+they were present in the document. (For example, an XHTML UA is not
+required to use its built-in knowledge of the XHTML DTD.)</p>
+
+<p class="note"><strong>Note:</strong> Typically, implementations
+choose to ignore external subsets.</p>
+
+<div class="example">
+<p>Example:</p>
+
+<p>Consider an element EXAMPLE with an attribute "notation" that has a
+default value of "decimal". The DTD fragment might be</p>
+
+<pre class="dtd-example">&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal"></pre>
+
+<p>If the style sheet contains the rules</p>
+
+<pre>EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>the first rule will not match elements whose "notation" attribute
+is set by default, i.e. not set explicitly. To catch all cases, the
+attribute selector for the default value must be dropped:</p>
+
+<pre>EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }</pre>
+
+<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
+more specific than the tag
+selector alone, the style declarations in the second rule will override
+those in the first for elements that have a "notation" attribute value
+of "octal". Care has to be taken that all property declarations that
+are to apply only to the default case are overridden in the non-default
+cases' style rules.</p>
+
+</div>
+
+<h3><a name=class-html>6.4. Class selectors</a></h3>
+
+<p>Working with HTML, authors may use the period (U+002E,
+<code>.</code>) notation as an alternative to the <code>~=</code>
+notation when representing the <code>class</code> attribute. Thus, for
+HTML, <code>div.value</code> and <code>div[class~=value]</code> have
+the same meaning. The attribute value must immediately follow the
+&quot;period&quot; (<code>.</code>).</p>
+
+<p>UAs may apply selectors using the period (.) notation in XML
+documents if the UA has namespace-specific knowledge that allows it to
+determine which attribute is the &quot;class&quot; attribute for the
+respective namespace. One such example of namespace-specific knowledge
+is the prose in the specification for a particular namespace (e.g. SVG
+1.0 <a href="#refsSVG">[SVG]</a> describes the <a
+href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
+&quot;class&quot; attribute</a> and how a UA should interpret it, and
+similarly MathML 1.01 <a href="#refsMATH">[MATH]</a> describes the <a
+href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
+&quot;class&quot; attribute</a>.)</p>
+
+<div class="example">
+ <p>CSS examples:</p>
+
+ <p>We can assign style information to all elements with
+ <code>class~="pastoral"</code> as follows:</p>
+
+  <pre>*.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>or just</p>
+
+  <pre>.pastoral { color: green }  /* all elements with class~=pastoral */</pre>
+
+  <p>The following assigns style only to H1 elements with
+  <code>class~="pastoral"</code>:</p>
+
+  <pre>H1.pastoral { color: green }  /* H1 elements with class~=pastoral */</pre>
+
+  <p>Given these rules, the first H1 instance below would not have
+  green text, while the second would:</p>
+
+  <pre>&lt;H1&gt;Not green&lt;/H1&gt;
+&lt;H1 class="pastoral"&gt;Very green&lt;/H1&gt;</pre>
+
+</div>
+
+<p>To represent a subset of "class" values, each value must be preceded
+by a ".", in any order.</P>
+
+<div class="example">
+
+  <p>CSS example:</p>
+
+  <p>The following rule matches any P element whose "class" attribute
+  has been assigned a list of <a
+  href="#whitespace">whitespace</a>-separated values that includes
+  "pastoral" and "marine":</p>
+
+  <pre>p.pastoral.marine { color: green }</pre>
+
+  <p>This rule matches when <code>class="pastoral blue aqua
+  marine"</code> but does not match for <code>class="pastoral
+  blue"</code>.</p>
+
+</div>
+
+<p class="note"><strong>Note:</strong> Because CSS gives considerable
+power to the "class" attribute, authors could conceivably design their
+own "document language" based on elements with almost no associated
+presentation (such as DIV and SPAN in HTML) and assigning style
+information through the "class" attribute.  Authors should avoid this
+practice since the structural elements of a document language often
+have recognized and accepted meanings and author-defined classes may
+not.</p>
+
+<p class="note"><strong>Note:</strong> If an element has multiple
+class attributes, their values must be concatenated with spaces
+between the values before searching for the class. As of this time the
+working group is not aware of any manner in which this situation can
+be reached, however, so this behavior is explicitly non-normative in
+this specification.</p>
+
+<h3><a name=id-selectors>6.5. ID selectors</a></h3>
+
+<p>Document languages may contain attributes that are declared to be
+of type ID. What makes attributes of type ID special is that no two
+such attributes can have the same value in a document, regardless of
+the type of the elements that carry them; whatever the document
+language, an ID typed attribute can be used to uniquely identify its
+element. In HTML all ID attributes are named "id"; XML applications
+may name ID attributes differently, but the same restriction
+applies.</p>
+
+<p>An ID-typed attribute of a document language allows authors to
+assign an identifier to one element instance in the document tree. W3C
+ID selectors represent an element instance based on its identifier. An
+ID selector contains a &quot;number sign&quot; (U+0023,
+<code>#</code>) immediately followed by the ID value, which must be an
+identifier.</p>
+
+<p>Selectors does not specify how a UA knows the ID-typed attribute of
+an element. The UA may, e.g., read a document's DTD, have the
+information hard-coded or ask the user.
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following ID selector represents an <code>h1</code> element
+  whose ID-typed attribute has the value "chapter1":</p>
+  <pre>h1#chapter1</pre>
+  <p>The following ID selector represents any element whose ID-typed
+  attribute has the value "chapter1":</p>
+  <pre>#chapter1</pre>
+  <p>The following selector represents any element whose ID-typed
+  attribute has the value "z98y".</p>
+  <pre>*#z98y</pre>
+</div>
+
+<p class="note"><strong>Note.</strong> In XML 1.0 <a
+href="#refsXML10">[XML10]</a>, the information about which attribute
+contains an element's IDs is contained in a DTD or a schema. When
+parsing XML, UAs do not always read the DTD, and thus may not know
+what the ID of an element is (though a UA may have namespace-specific
+knowledge that allows it to determine which attribute is the ID
+attribute for that namespace). If a style sheet designer knows or
+suspects that a UA may not know what the ID of an element is, he
+should use normal attribute selectors instead:
+<code>[name=p371]</code> instead of <code>#p371</code>.  Elements in
+XML 1.0 documents without a DTD do not have IDs at all.</p>
+
+<p>If an element has multiple ID attributes, all of them must be
+treated as IDs for that element for the purposes of the ID
+selector. Such a situation could be reached using mixtures of xml:id,
+DOM3 Core, XML DTDs, and namespace-specific knowledge.</p>
+
+<h3><a name=pseudo-classes>6.6. Pseudo-classes</a></h3>
+
+<p>The pseudo-class concept is introduced to permit selection based on
+information that lies outside of the document tree or that cannot be
+expressed using the other simple selectors.</p>
+
+<p>A pseudo-class always consists of a &quot;colon&quot;
+(<code>:</code>) followed by the name of the pseudo-class and
+optionally by a value between parentheses.</p>
+
+<p>Pseudo-classes are allowed in all sequences of simple selectors
+contained in a selector. Pseudo-classes are allowed anywhere in
+sequences of simple selectors, after the leading type selector or
+universal selector (possibly omitted). Pseudo-class names are
+case-insensitive. Some pseudo-classes are mutually exclusive, while
+others can be applied simultaneously to the same
+element. Pseudo-classes may be dynamic, in the sense that an element
+may acquire or lose a pseudo-class while a user interacts with the
+document.</p>
+
+
+<h4><a name=dynamic-pseudos>6.6.1. Dynamic pseudo-classes</a></h4>
+
+<p>Dynamic pseudo-classes classify elements on characteristics other
+than their name, attributes, or content, in principle characteristics
+that cannot be deduced from the document tree.</p>
+
+<p>Dynamic pseudo-classes do not appear in the document source or
+document tree.</p>
+
+
+<h5>The <a name=link>link pseudo-classes: :link and :visited</a></h5>
+
+<p>User agents commonly display unvisited links differently from
+previously visited ones. Selectors
+provides the pseudo-classes <code>:link</code> and
+<code>:visited</code> to distinguish them:</p>
+
+<ul>
+  <li>The <code>:link</code> pseudo-class applies to links that have
+  not yet been visited.</li>
+  <li>The <code>:visited</code> pseudo-class applies once the link has
+  been visited by the user. </li>
+</ul>
+
+<p>After some amount of time, user agents may choose to return a
+visited link to the (unvisited) ':link' state.</p>
+
+<p>The two states are mutually exclusive.</p>
+
+<div class="example">
+
+  <p>Example:</p>
+
+  <p>The following selector represents links carrying class
+  <code>external</code> and already visited:</p>
+
+  <pre>a.external:visited</pre>
+
+</div>
+
+<p class="note"><strong>Note:</strong> It is possible for style sheet
+authors to abuse the :link and :visited pseudo-classes to determine
+which sites a user has visited without the user's consent.
+
+<p>UAs may therefore treat all links as unvisited links, or implement
+other measures to preserve the user's privacy while rendering visited
+and unvisited links differently.</p>
+
+<h5>The <a name=useraction-pseudos>user action pseudo-classes
+:hover, :active, and :focus</a></h5>
+
+<p>Interactive user agents sometimes change the rendering in response
+to user actions. Selectors provides
+three pseudo-classes for the selection of an element the user is
+acting on.</p>
+
+<ul>
+
+  <li>The <code>:hover</code> pseudo-class applies while the user
+  designates an element with a pointing device, but does not activate
+  it. For example, a visual user agent could apply this pseudo-class
+  when the cursor (mouse pointer) hovers over a box generated by the
+  element. User agents not that do not support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> do not have to support this pseudo-class. Some conforming
+  user agents that support <a
+  href="http://www.w3.org/TR/REC-CSS2/media.html#interactive-media-group">interactive
+  media</a> may not be able to support this pseudo-class (e.g., a pen
+  device that does not detect hovering).</li>
+
+  <li>The <code>:active</code> pseudo-class applies while an element
+  is being activated by the user. For example, between the times the
+  user presses the mouse button and releases it.</li>
+
+  <li>The <code>:focus</code> pseudo-class applies while an element
+  has the focus (accepts keyboard or mouse events, or other forms of
+  input). </li>
+
+</ul>
+
+<p>There may be document language or implementation specific limits on
+which elements can become <code>:active</code> or acquire
+<code>:focus</code>.</p>
+
+<p>These pseudo-classes are not mutually exclusive. An element may
+match several pseudo-classes at the same time.</p>
+
+<p>Selectors doesn't define if the parent of an element that is
+':active' or ':hover' is also in that state.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <pre>a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */</pre>
+  <p>An example of combining dynamic pseudo-classes:</p>
+  <pre>a:focus
+a:focus:hover</pre>
+  <p>The last selector matches <code>a</code> elements that are in
+  the pseudo-class :focus and in the pseudo-class :hover.</p>
+</div>
+
+<p class="note"><strong>Note:</strong> An element can be both ':visited'
+and ':active' (or ':link' and ':active').</p>
+
+<h4><a name=target-pseudo>6.6.2. The target pseudo-class :target</a></h4>
+
+<p>Some URIs refer to a location within a resource. This kind of URI
+ends with a &quot;number sign&quot; (#) followed by an anchor
+identifier (called the fragment identifier).</p>
+
+<p>URIs with fragment identifiers link to a certain element within the
+document, known as the target element. For instance, here is a URI
+pointing to an anchor named <code>section_2</code> in an HTML
+document:</p>
+
+<pre>http://example.com/html/top.html#section_2</pre>
+
+<p>A target element can be represented by the <code>:target</code>
+pseudo-class. If the document's URI has no fragment identifier, then
+the document has no target element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>p.note:target</pre>
+ <p>This selector represents a <code>p</code> element of class
+ <code>note</code> that is the target element of the referring
+ URI.</p>
+</div>
+
+<div class="example">
+ <p>CSS example:</p>
+ <p>Here, the <code>:target</code> pseudo-class is used to make the
+ target element red and place an image before it, if there is one:</p>
+ <pre>*:target { color : red }
+*:target::before { content : url(target.png) }</pre>
+</div>
+
+<h4><a name=lang-pseudo>6.6.3. The language pseudo-class :lang</a></h4>
+
+<p>If the document language specifies how the human language of an
+element is determined, it is possible to write selectors that
+represent an element based on its language. For example, in HTML <a
+href="#refsHTML4">[HTML4]</a>, the language is determined by a
+combination of the <code>lang</code> attribute, the <code>meta</code>
+element, and possibly by information from the protocol (such as HTTP
+headers). XML uses an attribute called <code>xml:lang</code>, and
+there may be other document language-specific methods for determining
+the language.</p>
+
+<p>The pseudo-class <code>:lang(C)</code> represents an element that
+is in language C. Whether an element is represented by a
+<code>:lang()</code> selector is based solely on the identifier C
+being either equal to, or a hyphen-separated substring of, the
+element's language value, in the same way as if performed by the <a
+href="#attribute-representation">'|='</a> operator in attribute
+selectors. The identifier C does not have to be a valid language
+name.</p>
+
+<p>C must not be empty. (If it is, the selector is invalid.)</p>
+
+<p class="note"><strong>Note:</strong> It is recommended that
+documents and protocols indicate language using codes from RFC 3066 <a
+href="#refsRFC3066">[RFC3066]</a> or its successor, and by means of
+"xml:lang" attributes in the case of XML-based documents <a
+href="#refsXML10">[XML10]</a>. See <a
+href="http://www.w3.org/International/questions/qa-lang-2or3.html">
+"FAQ: Two-letter or three-letter language codes."</a></p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The two following selectors represent an HTML document that is in
+  Belgian, French, or German. The two next selectors represent
+  <code>q</code> quotations in an arbitrary element in Belgian, French,
+  or German.</p>
+  <pre>html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) &gt; q
+:lang(de) &gt; q</pre>
+</div>
+
+<h4><a name=UIstates>6.6.4. The UI element states pseudo-classes</a></h4>
+
+<h5><a name=enableddisabled>The :enabled and :disabled pseudo-classes</a></h5>
+
+<p>The <code>:enabled</code> pseudo-class allows authors to customize
+the look of user interface elements that are enabled &mdash; which the
+user can select or activate in some fashion (e.g. clicking on a button
+with a mouse).  There is a need for such a pseudo-class because there
+is no way to programmatically specify the default appearance of say,
+an enabled <code>input</code> element without also specifying what it
+would look like when it was disabled.</p>
+
+<p>Similar to <code>:enabled</code>, <code>:disabled</code> allows the
+author to specify precisely how a disabled or inactive user interface
+element should look.</p>
+
+<p>Most elements will be neither enabled nor disabled.  An element is
+enabled if the user can either activate it or transfer the focus to
+it. An element is disabled if it could be enabled, but the user cannot
+presently activate it or transfer focus to it.</p>
+
+
+<h5><a name=checked>The :checked pseudo-class</a></h5>
+
+<p>Radio and checkbox elements can be toggled by the user. Some menu
+items are "checked" when the user selects them. When such elements are
+toggled "on" the <code>:checked</code> pseudo-class applies. The
+<code>:checked</code> pseudo-class initially applies to such elements
+that have the HTML4 <code>selected</code> and <code>checked</code>
+attributes as described in <a
+href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.2.1">Section
+17.2.1 of HTML4</a>, but of course the user can toggle "off" such
+elements in which case the <code>:checked</code> pseudo-class would no
+longer apply. While the <code>:checked</code> pseudo-class is dynamic
+in nature, and is altered by user action, since it can also be based
+on the presence of the semantic HTML4 <code>selected</code> and
+<code>checked</code> attributes, it applies to all media.
+
+
+<h5><a name=indeterminate>The :indeterminate pseudo-class</a></h5>
+
+<div class="note">
+
+<p>Radio and checkbox elements can be toggled by the user, but are
+sometimes in an indeterminate state, neither checked nor unchecked.
+This can be due to an element attribute, or DOM manipulation.</p>
+
+<p>A future version of this specification may introduce an 
+<code>:indeterminate</code> pseudo-class that applies to such elements.
+<!--While the <code>:indeterminate</code> pseudo-class is dynamic in
+nature, and is altered by user action, since it can also be based on
+the presence of an element attribute, it applies to all media.</p>
+
+<p>Components of a radio-group initialized with no pre-selected choice
+are an example of :indeterminate state.--></p>
+
+</div>
+
+
+<h4><a name=structural-pseudos>6.6.5. Structural pseudo-classes</a></h4>
+
+<p>Selectors introduces the concept of <dfn>structural
+pseudo-classes</dfn> to permit selection based on extra information that lies in
+the document tree but cannot be represented by other simple selectors or
+combinators. 
+
+<p>Note that standalone pieces of PCDATA (text nodes in the DOM) are
+not counted when calculating the position of an element in the list of
+children of its parent. When calculating the position of an element in
+the list of children of its parent, the index numbering starts at 1.
+
+
+<h5><a name=root-pseudo>:root pseudo-class</a></h5>
+
+<p>The <code>:root</code> pseudo-class represents an element that is
+the root of the document. In HTML 4, this is always the
+<code>HTML</code> element.
+
+
+<h5><a name=nth-child-pseudo>:nth-child() pseudo-class</a></h5>
+
+<p>The
+<code>:nth-child(<var>a</var><code>n</code>+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>before</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. In
+other words, this matches the <var>b</var>th child of an element after
+all the children have been split into groups of <var>a</var> elements
+each. For example, this allows the selectors to address every other
+row in a table, and could be used to alternate the color
+of paragraph text in a cycle of four. The <var>a</var> and
+<var>b</var> values must be zero, negative integers or positive
+integers. The index of the first child of an element is 1.
+
+<p>In addition to this, <code>:nth-child()</code> can take
+'<code>odd</code>' and '<code>even</code>' as arguments instead.
+'<code>odd</code>' has the same signification as <code>2n+1</code>,
+and '<code>even</code>' has the same signification as <code>2n</code>.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }</pre>
+</div>
+
+<p>When <var>a</var>=0, no repeating is used, so for example
+<code>:nth-child(0n+5)</code> matches only the fifth child. When
+<var>a</var>=0, the <var>a</var><code>n</code> part need not be
+included, so the syntax simplifies to
+<code>:nth-child(<var>b</var>)</code> and the last example simplifies
+to <code>:nth-child(5)</code>.
+
+<div class="example">
+<p>Examples:</p>
+<pre>foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */</pre>
+</div>
+
+<p>When <var>a</var>=1, the number may be omitted from the rule.
+
+<div class="example">
+<p>Examples:</p>
+<p>The following selectors are therefore equivalent:</p>
+<pre>bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */</pre>
+</div>
+
+<p>If <var>b</var>=0, then every <var>a</var>th element is picked. In
+such a case, the <var>b</var> part may be omitted.
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */</pre>
+</div>
+
+<p>If both <var>a</var> and <var>b</var> are equal to zero, the
+pseudo-class represents no element in the document tree.</p>
+
+<p>The value <var>a</var> can be negative, but only the positive
+values of <var>a</var><code>n</code>+<var>b</var>, for
+<code>n</code>&ge;0, may represent an element in the document
+tree.</p>
+
+<div class="example">
+<p>Example:</p>
+<pre>html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */</pre>
+</div>
+
+<p>When the value <var>b</var> is negative, the "+" character in the
+expression must be removed (it is effectively replaced by the "-"
+character indicating the negative value of <var>b</var>).</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */</pre>
+</div>
+
+
+<h5><a name=nth-last-child-pseudo>:nth-last-child() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-child(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings
+<strong>after</strong> it in the document tree, for a given positive
+integer or zero value of <code>n</code>, and has a parent element. See
+<code>:nth-child()</code> pseudo-class for the syntax of its argument.
+It also accepts the '<code>even</code>' and '<code>odd</code>' values
+as arguments.
+
+
+<div class="example">
+<p>Examples:</p>
+<pre>tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */</pre>
+</div>
+
+
+<h5><a name=nth-of-type-pseudo>:nth-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>before</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. In other words, this matches the <var>b</var>th child
+of that type after all the children of that type have been split into
+groups of a elements each. See <code>:nth-child()</code> pseudo-class
+for the syntax of its argument. It also accepts the
+'<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+<p>CSS example:</p>
+<p>This allows an author to alternate the position of floated images:</p>
+<pre>img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }</pre>
+</div>
+
+
+<h5><a name=nth-last-of-type-pseudo>:nth-last-of-type() pseudo-class</a></h5>
+
+<p>The <code>:nth-last-of-type(<var>a</var>n+<var>b</var>)</code>
+pseudo-class notation represents an element that has
+<var>a</var><code>n</code>+<var>b</var>-1 siblings with the same
+element name <strong>after</strong> it in the document tree, for a
+given zero or positive integer value of <code>n</code>, and has a
+parent element. See <code>:nth-child()</code> pseudo-class for the
+syntax of its argument. It also accepts the '<code>even</code>' and '<code>odd</code>' values.
+
+
+<div class="example">
+ <p>Example:</p>
+ <p>To represent all <code>h2</code> children of an XHTML
+ <code>body</code> except the first and last, one could use the
+ following selector:</p>
+ <pre>body &gt; h2:nth-of-type(n+2):nth-last-of-type(n+2)</pre>
+ <p>In this case, one could also use <code>:not()</code>, although the
+ selector ends up being just as long:</p>
+ <pre>body &gt; h2:not(:first-of-type):not(:last-of-type)</pre>
+</div>
+
+
+<h5><a name=first-child-pseudo>:first-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-child(1)</code>. The <code>:first-child</code> pseudo-class
+represents an element that is the first child of some other element.
+
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following selector represents a <code>p</code> element that is
+  the first child of a <code>div</code> element:</p>
+  <pre>div &gt; p:first-child</pre>
+  <p>This selector can represent the <code>p</code> inside the
+  <code>div</code> of the following fragment:</p>
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>but cannot represent the second <code>p</code> in the following
+fragment: 
+  <pre>&lt;p&gt; The last P before the note.&lt;/p&gt;
+&lt;div class="note"&gt;
+   &lt;h2&gt; Note &lt;/h2&gt;
+   &lt;p&gt; The first P inside the note.&lt;/p&gt;
+&lt;/div&gt;</pre>
+  <p>The following two selectors are usually equivalent:</p>
+  <pre>* &gt; a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */</pre>
+</div>
+
+<h5><a name=last-child-pseudo>:last-child pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-child(1)</code>. The <code>:last-child</code> pseudo-class
+represents an element that is the last child of some other element. 
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents a list item <code>li</code> that
+ is the last child of an ordered list <code>ol</code>.
+ <pre>ol &gt; li:last-child</pre>
+</div>
+
+<h5><a name=first-of-type-pseudo>:first-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-of-type(1)</code>. The <code>:first-of-type</code> pseudo-class
+represents an element that is the first sibling of its type in the list of
+children of its parent element. 
+
+<div class="example">
+<p>Example:</p>
+<p>The following selector represents a definition title
+<code>dt</code> inside a definition list <code>dl</code>, this
+<code>dt</code> being the first of its type in the list of children of
+its parent element.</p>
+<pre>dl dt:first-of-type</pre>
+<p>It is a valid description for the first two <code>dt</code>
+elements in the following example but not for the third one:</p>
+<pre>&lt;dl&gt;
+ &lt;dt&gt;gigogne&lt;/dt&gt;
+ &lt;dd&gt;
+  &lt;dl&gt;
+   &lt;dt&gt;fus&eacute;e&lt;/dt&gt;
+   &lt;dd&gt;multistage rocket&lt;/dd&gt;
+   &lt;dt&gt;table&lt;/dt&gt;
+   &lt;dd&gt;nest of tables&lt;/dd&gt;
+  &lt;/dl&gt;
+ &lt;/dd&gt;
+&lt;/dl&gt;</pre>
+</div>
+
+<h5><a name=last-of-type-pseudo>:last-of-type pseudo-class</a></h5>
+
+<p>Same as <code>:nth-last-of-type(1)</code>. The
+<code>:last-of-type</code> pseudo-class represents an element that is
+the last sibling of its type in the list of children of its parent
+element.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <p>The following selector represents the last data cell
+ <code>td</code> of a table row.</p>
+ <pre>tr &gt; td:last-of-type</pre>
+</div>
+
+<h5><a name=only-child-pseudo>:only-child pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children. Same as
+<code>:first-child:last-child</code> or
+<code>:nth-child(1):nth-last-child(1)</code>, but with a lower
+specificity.</p>
+
+<h5><a name=only-of-type-pseudo>:only-of-type pseudo-class</a></h5>
+
+<p>Represents an element that has a parent element and whose parent
+element has no other element children with the same element name. Same
+as <code>:first-of-type:last-of-type</code> or
+<code>:nth-of-type(1):nth-last-of-type(1)</code>, but with a lower
+specificity.</p>
+
+
+<h5><a name=empty-pseudo></a>:empty pseudo-class</h5>
+
+<p>The <code>:empty</code> pseudo-class represents an element that has
+no children at all. In terms of the DOM, only element nodes and text
+nodes (including CDATA nodes and entity references) whose data has a
+non-zero length must be considered as affecting emptiness; comments,
+PIs, and other nodes must not affect whether an element is considered
+empty or not.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p><code>p:empty</code> is a valid representation of the following fragment:</p>
+ <pre>&lt;p&gt;&lt;/p&gt;</pre>
+ <p><code>foo:empty</code> is not a valid representation for the
+ following fragments:</p>
+ <pre>&lt;foo&gt;bar&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;&lt;bar&gt;bla&lt;/bar&gt;&lt;/foo&gt;</pre>
+ <pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
+</div>
+
+<h4><a name=content-selectors>6.6.6. Blank</a></h4> <!-- It's the Return of Appendix H!!! Run away! -->
+
+<p>This section intentionally left blank.</p>
+<!-- (used to be :contains()) -->
+
+<h4><a name=negation></a>6.6.7. The negation pseudo-class</h4>
+
+<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
+functional notation taking a <a href="#simple-selectors-dfn">simple
+selector</a> (excluding the negation pseudo-class itself and
+pseudo-elements) as an argument. It represents an element that is not
+represented by the argument.
+
+<!-- pseudo-elements are not simple selectors, so the above paragraph
+may be a bit confusing -->
+
+<div class="example">
+  <p>Examples:</p>
+  <p>The following CSS selector matches all <code>button</code>
+  elements in an HTML document that are not disabled.</p>
+  <pre>button:not([DISABLED])</pre>
+  <p>The following selector represents all but <code>FOO</code>
+  elements.</p>
+  <pre>*:not(FOO)</pre>
+  <p>The following group of selectors represents all HTML elements
+  except links.</p>
+  <pre>html|*:not(:link):not(:visited)</pre>
+</div>
+
+<p>Default namespace declarations do not affect the argument of the
+negation pseudo-class unless the argument is a universal selector or a
+type selector.</p>
+
+<div class="example">
+  <p>Examples:</p>
+  <p>Assuming that the default namespace is bound to
+  "http://example.com/", the following selector represents all
+  elements that are not in that namespace:</p>
+  <pre>*|*:not(*)</pre>
+  <p>The following CSS selector matches any element being hovered,
+  regardless of its namespace. In particular, it is not limited to
+  only matching elements in the default namespace that are not being
+  hovered, and elements not in the default namespace don't match the
+  rule when they <em>are</em> being hovered.</p>
+  <pre>*|*:not(:hover)</pre>
+</div>
+
+<p class="note"><strong>Note</strong>: the :not() pseudo allows
+useless selectors to be written.  For instance <code>:not(*|*)</code>,
+which represents no element at all, or <code>foo:not(bar)</code>,
+which is equivalent to <code>foo</code> but with a higher
+specificity.</p>
+
+<h3><a name=pseudo-elements>7. Pseudo-elements</a></h3>
+
+<p>Pseudo-elements create abstractions about the document tree beyond
+those specified by the document language. For instance, document
+languages do not offer mechanisms to access the first letter or first
+line of an element's content. Pseudo-elements allow designers to refer
+to this otherwise inaccessible information. Pseudo-elements may also
+provide designers a way to refer to content that does not exist in the
+source document (e.g., the <code>::before</code> and
+<code>::after</code> pseudo-elements give access to generated
+content).</p>
+
+<p>A pseudo-element is made of two colons (<code>::</code>) followed
+by the name of the pseudo-element.</p>
+
+<p>This <code>::</code> notation is introduced by the current document
+in order to establish a discrimination between pseudo-classes and
+pseudo-elements.  For compatibility with existing style sheets, user
+agents must also accept the previous one-colon notation for
+pseudo-elements introduced in CSS levels 1 and 2 (namely,
+<code>:first-line</code>, <code>:first-letter</code>,
+<code>:before</code> and <code>:after</code>). This compatibility is
+not allowed for the new pseudo-elements introduced in CSS level 3.</p>
+
+<p>Only one pseudo-element may appear per selector, and if present it
+must appear after the sequence of simple selectors that represents the
+<a href="#subject">subjects</a> of the selector. <span class="note">A
+future version of this specification may allow multiple
+pesudo-elements per selector.</span></p>
+
+<h4><a name=first-line>7.1. The ::first-line pseudo-element</a></h4>
+
+<p>The <code>::first-line</code> pseudo-element describes the contents
+of the first formatted line of an element.
+
+<div class="example">
+<p>CSS example:</p>
+<pre>p::first-line { text-transform: uppercase }</pre>
+<p>The above rule means "change the letters of the first line of every
+paragraph to uppercase".</p>
+</div>
+
+<p>The selector <code>p::first-line</code> does not match any real
+HTML element. It does match a pseudo-element that conforming user
+agents will insert at the beginning of every paragraph.</p>
+
+<p>Note that the length of the first line depends on a number of
+factors, including the width of the page, the font size, etc.  Thus,
+an ordinary HTML paragraph such as:</p>
+
+<pre>
+&lt;P&gt;This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the lines of which happen to be broken as follows:
+
+<pre>
+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+</pre>
+
+<p>This paragraph might be "rewritten" by user agents to include the
+<em>fictional tag sequence</em> for <code>::first-line</code>. This
+fictional tag sequence helps to show how properties are inherited.</p>
+
+<pre>
+&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML 
+paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>If a pseudo-element breaks up a real element, the desired effect
+can often be described by a fictional tag sequence that closes and
+then re-opens the element. Thus, if we mark up the previous paragraph
+with a <code>span</code> element:</p>
+
+<pre>
+&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>the user agent could simulate start and end tags for
+<code>span</code> when inserting the fictional tag sequence for
+<code>::first-line</code>.
+
+<pre>
+&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a
+somewhat long HTML
+paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be
+broken into several
+lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.&lt;/P&gt;
+</pre>
+
+<p>In CSS, the <code>::first-line</code> pseudo-element can only be
+attached to a block-level element, an inline-block, a table-caption,
+or a table-cell.</p>
+
+<p><a name="first-formatted-line"></a>The "first formatted line" of an
+element may occur inside a
+block-level descendant in the same flow (i.e., a block-level
+descendant that is not positioned and not a float). E.g., the first
+line of the <code>div</code> in <code>&lt;DIV>&lt;P>This
+line...&lt;/P>&lt/DIV></code> is the first line of the <code>p</code> (assuming
+that both <code>p</code> and <code>div</code> are block-level).
+
+<p>The first line of a table-cell or inline-block cannot be the first
+formatted line of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first formatted line of the
+<code>div</code> is not the line "Hello".
+
+<p class="note">Note that the first line of the <code>p</code> in this
+fragment: <code>&lt;p&gt&lt;br&gt;First...</code> doesn't contain any
+letters (assuming the default style for <code>br</code> in HTML
+4). The word "First" is not on the first formatted line.
+
+<p>A UA should act as if the fictional start tags of the
+<code>::first-line</code> pseudo-elements were nested just inside the
+innermost enclosing block-level element. (Since CSS1 and CSS2 were
+silent on this case, authors should not rely on this behavior.) Here
+is an example. The fictional tag sequence for</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>First paragraph&lt;/P>
+  &lt;P>Second paragraph&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>is</p>
+
+<pre>
+&lt;DIV>
+  &lt;P>&lt;DIV::first-line>&lt;P::first-line>First paragraph&lt;/P::first-line>&lt;/DIV::first-line>&lt;/P>
+  &lt;P>&lt;P::first-line>Second paragraph&lt;/P::first-line>&lt;/P>
+&lt;/DIV>
+</pre>
+
+<p>The <code>::first-line</code> pseudo-element is similar to an
+inline-level element, but with certain restrictions. In CSS, the
+following properties apply to a <code>::first-line</code>
+pseudo-element: font properties, color property, background
+properties, 'word-spacing', 'letter-spacing', 'text-decoration',
+'vertical-align', 'text-transform', 'line-height'. UAs may apply other
+properties as well.</p>
+
+
+<h4><a name=first-letter>7.2. The ::first-letter pseudo-element</a></h4>
+
+<p>The <code>::first-letter</code> pseudo-element represents the first
+letter of the first line of a block, if it is not preceded by any
+other content (such as images or inline tables) on its line. The
+::first-letter pseudo-element may be used for "initial caps" and "drop
+caps", which are common typographical effects. This type of initial
+letter is similar to an inline-level element if its 'float' property
+is 'none'; otherwise, it is similar to a floated element.</p>
+
+<p>In CSS, these are the properties that apply to <code>::first-letter</code>
+pseudo-elements: font properties, 'text-decoration', 'text-transform',
+'letter-spacing', 'word-spacing' (when appropriate), 'line-height',
+'float', 'vertical-align' (only if 'float' is 'none'), margin
+properties, padding properties, border properties, color property,
+background properties.  UAs may apply other properties as well.  To
+allow UAs to render a typographically correct drop cap or initial cap,
+the UA may choose a line-height, width and height based on the shape
+of the letter, unlike for normal elements.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>This example shows a possible rendering of an initial cap. Note
+that the 'line-height' that is inherited by the <code>::first-letter</code>
+pseudo-element is 1.1, but the UA in this example has computed the
+height of the first letter differently, so that it doesn't cause any
+unnecessary space between the first two lines. Also note that the
+fictional start tag of the first letter is inside the <span>span</span>, and thus
+the font weight of the first letter is normal, not bold as the <span>span</span>:
+<pre>
+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+&lt;p>&lt;span>Het hemelsche&lt;/span> gerecht heeft zich ten lange lesten&lt;br>
+Erbarremt over my en mijn benaeuwde vesten&lt;br>
+En arme burgery, en op mijn volcx gebed&lt;br>
+En dagelix geschrey de bange stad ontzet.
+</pre>
+<div class="figure">
+<p><img src="initial-cap.png" alt="Image illustrating the ::first-letter pseudo-element">
+</div>
+</div>
+
+<div class="example">
+<p>The following CSS will make a drop cap initial letter span about two lines:</p>
+
+<pre>
+&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
+&lt;HTML&gt;
+ &lt;HEAD&gt;
+  &lt;TITLE&gt;Drop cap initial letter&lt;/TITLE&gt;
+  &lt;STYLE type="text/css"&gt;
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  &lt;/STYLE&gt;
+ &lt;/HEAD&gt;
+ &lt;BODY&gt;
+  &lt;P&gt;&lt;SPAN&gt;The first&lt;/SPAN&gt; few words of an article
+    in The Economist.&lt;/P&gt;
+ &lt;/BODY&gt;
+&lt;/HTML&gt;
+</pre>
+
+<p>This example might be formatted as follows:</p>
+
+<div class="figure">
+<P><img src="first-letter.gif" alt="Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements"></p>
+</div>
+
+<p>The <span class="index-inst" title="fictional tag
+sequence">fictional tag sequence</span> is:</p>
+
+<pre>
+&lt;P&gt;
+&lt;SPAN&gt;
+&lt;P::first-letter&gt;
+T
+&lt;/P::first-letter&gt;he first
+&lt;/SPAN&gt; 
+few words of an article in the Economist.
+&lt;/P&gt;
+</pre>
+
+<p>Note that the <code>::first-letter</code> pseudo-element tags abut
+the content (i.e., the initial character), while the ::first-line
+pseudo-element start tag is inserted right after the start tag of the
+block element.</p> </div>
+
+<p>In order to achieve traditional drop caps formatting, user agents
+may approximate font sizes, for example to align baselines. Also, the
+glyph outline may be taken into account when formatting.</p>
+
+<p>Punctuation (i.e, characters defined in Unicode in the "open" (Ps),
+"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po)
+punctuation classes), that precedes or follows the first letter should
+be included. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+<div class="figure">
+<P><img src="first-letter2.gif" alt="Quotes that precede the
+first letter should be included."></p>
+</div>
+
+<p>The <code>::first-letter</code> also applies if the first letter is
+in fact a digit, e.g., the "6" in "67 million dollars is a lot of
+money."</p>
+
+<p>In CSS, the <code>::first-letter</code> pseudo-element applies to
+block, list-item, table-cell, table-caption, and inline-block
+elements. <span class="note">A future version of this specification
+may allow this pesudo-element to apply to more element
+types.</span></p>
+
+<p>The <code>::first-letter</code> pseudo-element can be used with all
+such elements that contain text, or that have a descendant in the same
+flow that contains text. A UA should act as if the fictional start tag
+of the ::first-letter pseudo-element is just before the first text of
+the element, even if that first text is in a descendant.</p>
+
+<div class="example">
+<p>Example:</p>
+<p>The fictional tag sequence for this HTMLfragment:
+<pre>&lt;div>
+&lt;p>The first text.</pre>
+<p>is:
+<pre>&lt;div>
+&lt;p>&lt;div::first-letter>&lt;p::first-letter>T&lt;/...>&lt;/...>he first text.</pre>
+</div>
+
+<p>The first letter of a table-cell or inline-block cannot be the
+first letter of an ancestor element. Thus, in <code>&lt;DIV&gt;&lt;P
+STYLE="display: inline-block">Hello&lt;BR&gt;Goodbye&lt;/P&gt;
+etcetera&lt;/DIV&gt;</code> the first letter of the <code>div</code> is not the
+letter "H". In fact, the <code>div</code> doesn't have a first letter.
+
+<p>The first letter must occur on the <a
+href="#first-formatted-line">first formatted line.</a> For example, in
+this fragment: <code>&lt;p&gt&lt;br&gt;First...</code> the first line
+doesn't contain any letters and <code>::first-letter</code> doesn't
+match anything (assuming the default style for <code>br</code> in HTML
+4). In particular, it does not match the "F" of "First."
+
+<p>In CSS, if an element is a list item ('display: list-item'), the
+<code>::first-letter</code> applies to the first letter in the
+principal box after the marker. UAs may ignore
+<code>::first-letter</code> on list items with 'list-style-position:
+inside'. If an element has <code>::before</code> or
+<code>::after</code> content, the <code>::first-letter</code> applies
+to the first letter of the element <em>including</em> that content.
+
+<div class="example">
+<p>Example:</p>
+<p>After the rule 'p::before {content: "Note: "}', the selector
+'p::first-letter' matches the "N" of "Note".</p>
+</div>
+
+<p>Some languages may have specific rules about how to treat certain
+letter combinations. In Dutch, for example, if the letter combination
+"ij" appears at the beginning of a word, both letters should be
+considered within the <code>::first-letter</code> pseudo-element.
+
+<p>If the letters that would form the ::first-letter are not in the
+same element, such as "'T" in <code>&lt;p>'&lt;em>T...</code>, the UA
+may create a ::first-letter pseudo-element from one of the elements,
+both elements, or simply not create a pseudo-element.</p>
+
+<p>Similarly, if the first letter(s) of the block are not at the start
+of the line (for example due to bidirectional reordering), then the UA
+need not create the pseudo-element(s).
+
+<div class="example">
+<p>Example:</p>
+<p><a name="overlapping-example">The following example</a> illustrates
+how overlapping pseudo-elements may interact.  The first letter of
+each P element will be green with a font size of '24pt'. The rest of
+the first formatted line will be 'blue' while the rest of the
+paragraph will be 'red'.</p>
+
+<pre>p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+&lt;P&gt;Some text that ends up on two lines&lt;/P&gt;</pre>
+
+<p>Assuming that a line break will occur before the word "ends", the
+<span class="index-inst" title="fictional tag sequence">fictional tag
+sequence</span> for this fragment might be:</p>
+
+<pre>&lt;P&gt;
+&lt;P::first-line&gt;
+&lt;P::first-letter&gt; 
+S 
+&lt;/P::first-letter&gt;ome text that 
+&lt;/P::first-line&gt; 
+ends up on two lines 
+&lt;/P&gt;</pre>
+
+<p>Note that the <code>::first-letter</code> element is inside the <code>::first-line</code>
+element.  Properties set on <code>::first-line</code> are inherited by
+<code>::first-letter</code>, but are overridden if the same property is set on
+<code>::first-letter</code>.</p>
+</div>
+
+
+<h4><a name=UIfragments>7.3.</a> <a name=selection>The ::selection pseudo-element</a></h4>
+
+<p>The <code>::selection</code> pseudo-element applies to the portion
+of a document that has been highlighted by the user. This also
+applies, for example, to selected text within an editable text
+field. This pseudo-element should not be confused with the <code><a
+href="#checked">:checked</a></code> pseudo-class (which used to be
+named <code>:selected</code>)
+
+<p>Although the <code>::selection</code> pseudo-element is dynamic in
+nature, and is altered by user action, it is reasonable to expect that
+when a UA re-renders to a static medium (such as a printed page, see
+<a href="#refsCSS21">[CSS21]</a>) which was originally rendered to a
+dynamic medium (like screen), the UA may wish to transfer the current
+<code>::selection</code> state to that other medium, and have all the
+appropriate formatting and rendering take effect as well. This is not
+required &mdash; UAs may omit the <code>::selection</code>
+pseudo-element for static media.
+
+<p>These are the CSS properties that apply to <code>::selection</code>
+pseudo-elements: color, background, cursor (optional), outline
+(optional). The computed value of the 'background-image' property on
+<code>::selection</code> may be ignored.
+
+
+<h4><a name=gen-content>7.4. The ::before and ::after pseudo-elements</a></h4>
+
+<p>The <code>::before</code> and <code>::after</code> pseudo-elements
+can be used to describe generated content before or after an element's
+content. They are explained in CSS 2.1 <a
+href="#refsCSS21">[CSS21]</a>.</p>
+
+<p>When the <code>::first-letter</code> and <code>::first-line</code>
+pseudo-elements are combined with <code>::before</code> and
+<code>::after</code>, they apply to the first letter or line of the
+element including the inserted text.</p>
+
+<h2><a name=combinators>8. Combinators</a></h2>
+
+<h3><a name=descendant-combinators>8.1. Descendant combinator</a></h3>
+
+<p>At times, authors may want selectors to describe an element that is
+the descendant of another element in the document tree (e.g., "an
+<code>EM</code> element that is contained within an <code>H1</code>
+element"). Descendant combinators express such a relationship. A
+descendant combinator is <a href="#whitespace">white space</a> that
+separates two sequences of simple selectors.  A selector of the form
+"<code>A B</code>" represents an element <code>B</code> that is an
+arbitrary descendant of some ancestor element <code>A</code>.
+
+<div class="example">
+ <p>Examples:</p>
+ <p>For example, consider the following selector:</p>
+ <pre>h1 em</pre>
+ <p>It represents an <code>em</code> element being the descendant of
+ an <code>h1</code> element. It is a correct and valid, but partial,
+ description of the following fragment:</p>
+ <pre>&lt;h1&gt;This &lt;span class="myclass"&gt;headline
+is &lt;em&gt;very&lt;/em&gt; important&lt;/span&gt;&lt;/h1&gt;</pre>
+ <p>The following selector:</p>
+ <pre>div * p</pre>
+ <p>represents a <code>p</code> element that is a grandchild or later
+ descendant of a <code>div</code> element. Note the whitespace on
+ either side of the "*" is not part of the universal selector; the
+ whitespace is a combinator indicating that the DIV must be the
+ ancestor of some element, and that that element must be an ancestor
+ of the P.</p>
+ <p>The following selector, which combines descendant combinators and
+ <a href="#attribute-selectors">attribute selectors</a>, represents an
+ element that (1) has the <code>href</code> attribute set and (2) is
+ inside a <code>p</code> that is itself inside a <code>div</code>:</p>
+ <pre>div p *[href]</pre>
+</div>
+
+<h3><a name=child-combinators>8.2. Child combinators</a></h3>
+
+<p>A <dfn>child combinator</dfn> describes a childhood relationship
+between two elements. A child combinator is made of the
+&quot;greater-than sign&quot; (<code>&gt;</code>) character and
+separates two sequences of simple selectors.
+
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element that is
+ child of <code>body</code>:</p>
+ <pre>body &gt; p</pre>
+ <p>The following example combines descendant combinators and child
+ combinators.</p>
+ <pre>div ol&gt;li p</pre><!-- LEAVE THOSE SPACES OUT! see below -->
+ <p>It represents a <code>p</code> element that is a descendant of an
+ <code>li</code> element; the <code>li</code> element must be the
+ child of an <code>ol</code> element; the <code>ol</code> element must
+ be a descendant of a <code>div</code>. Notice that the optional white
+ space around the "&gt;" combinator has been left out.</p>
+</div>
+
+<p>For information on selecting the first child of an element, please
+see the section on the <code><a
+href="#structural-pseudos">:first-child</a></code> pseudo-class
+above.</p>
+
+<h3><a name=sibling-combinators>8.3. Sibling combinators</a></h3>
+
+<p>There are two different sibling combinators: the adjacent sibling
+combinator and the general sibling combinator. In both cases,
+non-element nodes (e.g. text between elements) are ignored when
+considering adjacency of elements.</p>
+
+<h4><a name=adjacent-sibling-combinators>8.3.1. Adjacent sibling combinator</a></h4>
+
+<p>The adjacent sibling combinator is made of the &quot;plus
+sign&quot; (U+002B, <code>+</code>) character that separates two
+sequences of simple selectors. The elements represented by the two
+sequences share the same parent in the document tree and the element
+represented by the first sequence immediately precedes the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Examples:</p>
+ <p>The following selector represents a <code>p</code> element
+ immediately following a <code>math</code> element:</p>
+ <pre>math + p</pre>
+ <p>The following selector is conceptually similar to the one in the
+ previous example, except that it adds an attribute selector &mdash; it
+ adds a constraint to the <code>h1</code> element, that it must have
+ <code>class="opener"</code>:</p>
+ <pre>h1.opener + h2</pre>
+</div>
+
+
+<h4><a name=general-sibling-combinators>8.3.2. General sibling combinator</a></h4>
+
+<p>The general sibling combinator is made of the &quot;tilde&quot;
+(U+007E, <code>~</code>) character that separates two sequences of
+simple selectors. The elements represented by the two sequences share
+the same parent in the document tree and the element represented by
+the first sequence precedes (not necessarily immediately) the element
+represented by the second one.</p>
+
+<div class="example">
+ <p>Example:</p>
+ <pre>h1 ~ pre</pre>
+ <p>represents a <code>pre</code> element following an <code>h1</code>. It
+ is a correct and valid, but partial, description of:</p>
+ <pre>&lt;h1&gt;Definition of the function a&lt;/h1&gt;
+&lt;p&gt;Function a(x) has to be applied to all figures in the table.&lt;/p&gt;
+&lt;pre&gt;function a(x) = 12x/13.5&lt;/pre&gt;</pre>
+</div>
+
+<h2><a name=specificity>9. Calculating a selector's specificity</a></h2>
+
+<p>A selector's specificity is calculated as follows:</p>
+
+<ul>
+  <li>count the number of ID selectors in the selector (= a)</li>
+  <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)</li>
+  <li>count the number of element names in the selector (= c)</li>
+  <li>ignore pseudo-elements</li>
+</ul>
+
+<p>Selectors inside <a href="#negation">the negation pseudo-class</a>
+are counted like any other, but the negation itself does not count as
+a pseudo-class.</p>
+
+<p>Concatenating the three numbers a-b-c (in a number system with a
+large base) gives the specificity.</p>
+
+<div class="example">
+<p>Examples:</p>
+<pre>*               /* a=0 b=0 c=0 -&gt; specificity =   0 */
+LI              /* a=0 b=0 c=1 -&gt; specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -&gt; specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -&gt; specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -&gt; specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -&gt; specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -&gt; specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -&gt; specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -&gt; specificity = 101 */
+</pre>
+</div>
+
+<p class="note"><strong>Note:</strong> the specificity of the styles
+specified in an HTML <code>style</code> attribute is described in CSS
+2.1. <a href="#refsCSS21">[CSS21]</a>.</p>
+
+<h2><a name=w3cselgrammar>10. The grammar of Selectors</a></h2>
+
+<h3><a name=grammar>10.1. Grammar</a></h3>
+
+<p>The grammar below defines the syntax of Selectors.  It is globally
+LL(1) and can be locally LL(2) (but note that most UA's should not use
+it directly, since it doesn't express the parsing conventions). The
+format of the productions is optimized for human consumption and some
+shorthand notations beyond Yacc (see <a href="#refsYACC">[YACC]</a>)
+are used:</p>
+
+<ul>
+  <li><b>*</b>: 0 or more
+  <li><b>+</b>: 1 or more
+  <li><b>?</b>: 0 or 1
+  <li><b>|</b>: separates alternatives
+  <li><b>[ ]</b>: grouping </li>
+</ul>
+
+<p>The productions are:</p>
+
+<pre>selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;</pre>
+
+
+<h3><a name=lex>10.2. Lexical scanner</a></h3>
+
+<p>The following is the <a name=x3>tokenizer</a>, written in Flex (see
+<a href="#refsFLEX">[FLEX]</a>) notation. The tokenizer is
+case-insensitive.</p>
+
+<p>The two occurrences of "\377" represent the highest character
+number that current versions of Flex can deal with (decimal 255). They
+should be read as "\4177777" (decimal 1114111), which is the highest
+possible code point in Unicode/ISO-10646. <a
+href="#refsUNICODE">[UNICODE]</a></p>
+
+<pre>%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}"&gt;"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"&lt;!--"           return CDO;
+"--&gt;"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;</pre>
+
+
+
+<h2><a name=downlevel>11. Namespaces and down-level clients</a></h2>
+
+<p>An important issue is the interaction of CSS selectors with XML
+documents in web clients that were produced prior to this
+document. Unfortunately, due to the fact that namespaces must be
+matched based on the URI which identifies the namespace, not the
+namespace prefix, some mechanism is required to identify namespaces in
+CSS by their URI as well. Without such a mechanism, it is impossible
+to construct a CSS style sheet which will properly match selectors in
+all cases against a random set of XML documents. However, given
+complete knowledge of the XML document to which a style sheet is to be
+applied, and a limited use of namespaces within the XML document, it
+is possible to construct a style sheet in which selectors would match
+elements and attributes correctly.</p>
+
+<p>It should be noted that a down-level CSS client will (if it
+properly conforms to CSS forward compatible parsing rules) ignore all
+<code>@namespace</code> at-rules, as well as all style rules that make
+use of namespace qualified element type or attribute selectors. The
+syntax of delimiting namespace prefixes in CSS was deliberately chosen
+so that down-level CSS clients would ignore the style rules rather
+than possibly match them incorrectly.</p>
+
+<p>The use of default namespaces in CSS makes it possible to write
+element type selectors that will function in both namespace aware CSS
+clients as well as down-level clients. It should be noted that
+down-level clients may incorrectly match selectors against XML
+elements in other namespaces.</p>
+
+<p>The following are scenarios and examples in which it is possible to
+construct style sheets which would function properly in web clients
+that do not implement this proposal.</p>
+
+<ol>
+  <li>
+
+   <p>The XML document does not use namespaces.</p>
+
+   <ul>
+
+    <li>In this case, it is obviously not necessary to declare or use
+    namespaces in the style sheet. Standard CSS element type and
+    attribute selectors will function adequately in a down-level
+    client.</li>
+
+    <li>In a CSS namespace aware client, the default behavior of
+    element selectors matching without regard to namespace will
+    function properly against all elements, since no namespaces are
+    present. However, the use of specific element type selectors that
+    match only elements that have no namespace ("<code>|name</code>")
+    will guarantee that selectors will match only XML elements that do
+    not have a declared namespace. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document defines a single, default namespace used
+   throughout the document. No namespace prefixes are used in element
+   names.</p>
+
+   <ul>
+
+    <li>In this case, a down-level client will function as if
+    namespaces were not used in the XML document at all. Standard CSS
+    element type and attribute selectors will match against all
+    elements. </li>
+
+   </ul>
+
+  </li>
+
+  <li>
+
+   <p>The XML document does <b>not</b> use a default namespace, all
+   namespace prefixes used are known to the style sheet author, and
+   there is a direct mapping between namespace prefixes and namespace
+   URIs. (A given prefix may only be mapped to one namespace URI
+   throughout the XML document; there may be multiple prefixes mapped
+   to the same URI).</p>
+
+   <ul>
+
+    <li>In this case, the down-level client will view and match
+    element type and attribute selectors based on their fully
+    qualified name, not the local part as outlined in the <a
+    href="#typenmsp">Type selectors and Namespaces</a> section. CSS
+    selectors may be declared using an escaped colon "<code>\:</code>"
+    to describe the fully qualified names, e.g.
+    "<code>html\:h1</code>" will match
+    <code>&lt;html:h1&gt;</code>. Selectors using the qualified name
+    will only match XML elements that use the same prefix. Other
+    namespace prefixes used in the XML that are mapped to the same URI
+    will not match as expected unless additional CSS style rules are
+    declared for them.</li>
+
+    <li>Note that selectors declared in this fashion will
+    <em>only</em> match in down-level clients. A CSS namespace aware
+    client will match element type and attribute selectors based on
+    the name's local part. Selectors declared with the fully
+    qualified name will not match (unless there is no namespace prefix
+    in the fully qualified name).</li>
+
+   </ul>
+
+  </li>
+
+ </ol>
+
+<p>In other scenarios: when the namespace prefixes used in the XML are
+not known in advance by the style sheet author; or a combination of
+elements with no namespace are used in conjunction with elements using
+a default namespace; or the same namespace prefix is mapped to
+<em>different</em> namespace URIs within the same document, or in
+different documents; it is impossible to construct a CSS style sheet
+that will function properly against all elements in those documents,
+unless, the style sheet is written using a namespace URI syntax (as
+outlined in this document or similar) and the document is processed by
+a CSS and XML namespace aware client.</p>
+
+<h2><a name=profiling>12. Profiles</a></h2>
+
+<p>Each specification using Selectors must define the subset of W3C
+Selectors it allows and excludes, and describe the local meaning of
+all the components of that subset.</p>
+
+<p>Non normative examples:
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 1</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>class selectors<br>ID selectors<br>:link,
+      :visited and :active pseudo-classes<br>descendant combinator
+     <br>::first-line and ::first-letter pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>universal selector<br>attribute selectors<br>:hover and :focus
+      pseudo-classes<br>:target pseudo-class<br>:lang() pseudo-class<br>all UI
+      element states pseudo-classes<br>all structural
+      pseudo-classes<br>negation pseudo-class<br>all
+      UI element fragments pseudo-elements<br>::before and ::after
+      pseudo-elements<br>child combinators<br>sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>only one class selector allowed per sequence of simple
+  selectors</td></tr></tbody></table><br><br>
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+    <td>CSS level 2</td></tr>
+  <tr>
+    <th>Accepts</th>
+    <td>type selectors<br>universal selector<br>attribute presence and
+      values selectors<br>class selectors<br>ID selectors<br>:link, :visited,
+      :active, :hover, :focus, :lang() and :first-child pseudo-classes
+     <br>descendant combinator<br>child combinator<br>adjacent sibling
+      combinator<br>::first-line and ::first-letter pseudo-elements<br>::before
+      and ::after pseudo-elements</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>
+      
+<p>content selectors<br>substring matching attribute
+      selectors<br>:target pseudo-classes<br>all UI element
+      states pseudo-classes<br>all structural pseudo-classes other
+      than :first-child<br>negation pseudo-class<br>all UI element
+      fragments pseudo-elements<br>general sibling combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>more than one class selector per sequence of simple selectors (CSS1
+      constraint) allowed</td></tr></tbody></table>
+
+<p>In CSS, selectors express pattern matching rules that determine which style
+rules apply to elements in the document tree. 
+
+<p>The following selector (CSS level 2) will <b>match</b> all anchors <code>a</code>
+with attribute <code>name</code> set inside a section 1 header <code>h1</code>: 
+<pre>h1 a[name]</pre>
+
+<p>All CSS declarations attached to such a selector are applied to elements
+matching it. </div>
+
+<div class="profile">
+<table class="tprofile">
+  <tbody>
+  <tr>
+    <th class="title" colspan=2>Selectors profile</th></tr>
+  <tr>
+    <th>Specification</th>
+      <td>STTS 3</td>
+    </tr>
+  <tr>
+    <th>Accepts</th>
+    <td>
+      
+<p>type selectors<br>universal selectors<br>attribute selectors<br>class
+      selectors<br>ID selectors<br>all structural pseudo-classes<br>
+          all combinators
+      
+<p>namespaces</td></tr>
+  <tr>
+    <th>Excludes</th>
+    <td>non-accepted pseudo-classes<br>pseudo-elements<br></td></tr>
+  <tr>
+    <th>Extra constraints</th>
+    <td>some selectors and combinators are not allowed in fragment
+      descriptions on the right side of STTS declarations.</td></tr></tbody></table>
+<form>
+<input type="text" name="test10"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+<input type="text" name="foo"/>
+</form>
+  
+<p>Selectors can be used in STTS 3 in two different
+    manners: 
+<ol>
+  <li>a selection mechanism equivalent to CSS selection mechanism: declarations
+  attached to a given selector are applied to elements matching that selector,
+  <li>fragment descriptions that appear on the right side of declarations.
+</li></ol></div>
+
+<h2><a name=Conformance></a>13. Conformance and requirements</h2>
+
+<p>This section defines conformance with the present specification only.
+
+<p>The inability of a user agent to implement part of this specification due to
+the limitations of a particular device (e.g., non interactive user agents will
+probably not implement dynamic pseudo-classes because they make no sense without
+interactivity) does not imply non-conformance.
+
+<p>All specifications reusing Selectors must contain a <a
+href="#profiling">Profile</a> listing the
+subset of Selectors it accepts or excludes, and describing the constraints
+it adds to the current specification. 
+
+<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a token
+which is not allowed at the current parsing point.
+
+<p>User agents must observe the rules for handling parsing errors:
+<ul>
+  <li>a simple selector containing an undeclared namespace prefix is invalid</li>
+  <li>a selector containing an invalid simple selector, an invalid combinator
+    or an invalid token is invalid. </li>
+  <li>a group of selectors containing an invalid selector is invalid.</li>
+</ul>
+
+<p class="foo test10 bar">Specifications reusing Selectors must define how to handle parsing
+errors. (In the case of CSS, the entire rule in which the selector is
+used is dropped.)</p>
+
+<!-- Apparently all these references are out of date:
+<p>Implementations of this specification must behave as
+"recipients of text data" as defined by <a href="#refsCWWW">[CWWW]</a>
+when parsing selectors and attempting matches. (In particular,
+implementations must assume the data is normalized and must not
+normalize it.) Normative rules for matching strings are defined in
+<a href="#refsCWWW">[CWWW]</a> and <a
+href="#refsUNICODE">[UNICODE]</a> and apply to implementations of this
+specification.</p>-->
+
+<h2><a name=Tests></a>14. Tests</h2>
+
+<p>This specification has <a
+href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/">a test
+suite</a> allowing user agents to verify their basic conformance to
+the specification. This test suite does not pretend to be exhaustive
+and does not cover all possible combined cases of Selectors.</p>
+
+<h2><a name=ACKS></a>15. Acknowledgements</h2>
+
+<p>The CSS working group would like to thank everyone who has sent
+comments on this specification over the years.</p>
+
+<p>The working group would like to extend special thanks to Donna
+McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed
+the final editorial review.</p>
+
+<h2><a name=references>16. References</a></h2>
+
+<dl class="refs">
+
+  <dt>[CSS1]
+  <dd><a name=refsCSS1></a> Bert Bos, H&aring;kon Wium Lie; "<cite>Cascading Style Sheets, level 1</cite>", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-CSS1">http://www.w3.org/TR/REC-CSS1</a></code>)
+
+  <dt>[CSS21]
+  <dd><a name=refsCSS21></a> Bert Bos, Tantek &Ccedil;elik, Ian Hickson, H&aring;kon Wium Lie, editors; "<cite>Cascading Style Sheets, level 2 revision 1</cite>", W3C Working Draft, 13 June 2005 
+  <dd>(<code><a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a></code>)
+
+  <dt>[CWWW]
+  <dd><a name=refsCWWW></a> Martin J. D&uuml;rst, Fran&ccedil;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "<cite>Character Model for the World Wide Web</cite>", W3C Recommendation, 15 February 2005
+  <dd>(<code><a href="http://www.w3.org/TR/charmod/">http://www.w3.org/TR/charmod/</a></code>)
+
+  <dt>[FLEX]
+  <dd><a name="refsFLEX"></a> "<cite>Flex: The Lexical Scanner Generator</cite>", Version 2.3.7, ISBN 1882114213
+
+  <dt>[HTML4]
+  <dd><a name="refsHTML4"></a> Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "<cite>HTML 4.01 Specification</cite>", W3C Recommendation, 24 December 1999
+  <dd>(<a href="http://www.w3.org/TR/html4/"><code>http://www.w3.org/TR/html4/</code></a>)
+
+  <dt>[MATH]
+  <dd><a name="refsMATH"></a> Patrick Ion, Robert Miner, editors; "<cite>Mathematical Markup Language (MathML) 1.01</cite>", W3C Recommendation, revision of 7 July 1999
+  <dd>(<code><a href="http://www.w3.org/TR/REC-MathML/">http://www.w3.org/TR/REC-MathML/</a></code>)
+
+  <dt>[RFC3066]
+  <dd><a name="refsRFC3066"></a> H. Alvestrand; "<cite>Tags for the Identification of Languages</cite>", Request for Comments 3066, January 2001
+  <dd>(<a href="http://www.ietf.org/rfc/rfc3066.txt"><code>http://www.ietf.org/rfc/rfc3066.txt</code></a>)
+
+  <dt>[STTS]
+  <dd><a name=refsSTTS></a> Daniel Glazman; "<cite>Simple Tree Transformation Sheets 3</cite>", Electricit&eacute; de France, submission to the W3C, 11 November 1998 
+  <dd>(<code><a href="http://www.w3.org/TR/NOTE-STTS3">http://www.w3.org/TR/NOTE-STTS3</a></code>)
+
+  <dt>[SVG]
+  <dd><a name="refsSVG"></a> Jon Ferraiolo, &#34276;&#27810; &#28147;, Dean Jackson, editors; "<cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>", W3C Recommendation, 14 January 2003
+  <dd>(<code><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></code>)
+
+  <dt>[UNICODE]</dt>
+  <dd><a name="refsUNICODE"></a> <cite><a
+   href="http://www.unicode.org/versions/Unicode4.1.0/">The Unicode Standard, Version 4.1</a></cite>, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by <a href="http://www.unicode.org/versions/Unicode4.0.1/">Unicode 4.0.1</a> and <a href="http://www.unicode.org/versions/Unicode4.1.0/">Unicode  4.1.0</a>.
+  <dd>(<code><a href="http://www.unicode.org/versions/">http://www.unicode.org/versions/</a></code>)</dd>
+
+  <dt>[XML10]
+  <dd><a name="refsXML10"></a> Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, Fran&ccedil;ois Yergeau, editors; "<cite>Extensible Markup Language (XML) 1.0 (Third Edition)</cite>", W3C Recommendation, 4 February 2004
+  <dd>(<a href="http://www.w3.org/TR/REC-xml/"><code>http://www.w3.org/TR/REC-xml/</code></a>)
+
+  <dt>[XMLNAMES]
+  <dd><a name="refsXMLNAMES"></a> Tim Bray, Dave Hollander, Andrew Layman, editors; "<cite>Namespaces in XML</cite>", W3C Recommendation, 14 January 1999
+  <dd>(<a href="http://www.w3.org/TR/REC-xml-names/"><code>http://www.w3.org/TR/REC-xml-names/</code></a>)
+
+  <dt>[YACC]
+  <dd><a name="refsYACC"></a> S. C. Johnson; "<cite>YACC &mdash; Yet another compiler compiler</cite>", Technical Report, Murray Hill, 1975
+
+</dl>
+</body>
+</html>
diff --git a/tests/sunspider-3d-morph.html b/tests/sunspider-3d-morph.html
new file mode 100644
index 0000000..8428f27
--- /dev/null
+++ b/tests/sunspider-3d-morph.html
@@ -0,0 +1,44 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// Test from here:
+// http://webkit.org/misc/morph.html
+
+window.onload = function(){ startTest("sunspider-3d-morph", '');
+
+var loops = 15, nx, nz, a;
+var size = 120;
+
+function morph(a,f) {
+    var PI2nx = Math.PI * 8/nx;
+    var sin = Math.sin;
+    var f30 = -(50 * sin(f*Math.PI*2));
+    
+    for (var i = 0; i < nz; ++i) {
+        for (var j = 0; j < nx; ++j) {
+            a[3*(i*nx+j)+1]    = sin((j-1) * PI2nx ) * -f30
+        }
+    }
+}
+
+    
+prep(function(){
+	nz = nx = size / 3;
+});
+
+test("Mesh Transform", function(){
+	a = Array();
+	for (var i=0; i < nx*nz*3; ++i)
+		a[i] = 0;
+
+	for (var i = 0; i < loops; ++i) {
+    		morph(a, i/loops)
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-3d-raytrace.html b/tests/sunspider-3d-raytrace.html
new file mode 100644
index 0000000..55ca405
--- /dev/null
+++ b/tests/sunspider-3d-raytrace.html
@@ -0,0 +1,460 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+function createVector(x,y,z) {
+    return new Array(x,y,z);
+}
+
+function sqrLengthVector(self) {
+    return self[0] * self[0] + self[1] * self[1] + self[2] * self[2];
+}
+
+function lengthVector(self) {
+    return Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]);
+}
+
+function addVector(self, v) {
+    self[0] += v[0];
+    self[1] += v[1];
+    self[2] += v[2];
+    return self;
+}
+
+function subVector(self, v) {
+    self[0] -= v[0];
+    self[1] -= v[1];
+    self[2] -= v[2];
+    return self;
+}
+
+function scaleVector(self, scale) {
+    self[0] *= scale;
+    self[1] *= scale;
+    self[2] *= scale;
+    return self;
+}
+
+function normaliseVector(self) {
+    var len = Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]);
+    self[0] /= len;
+    self[1] /= len;
+    self[2] /= len;
+    return self;
+}
+
+function add(v1, v2) {
+    return new Array(v1[0] + v2[0], v1[1] + v2[1], v1[2] + v2[2]);
+}
+
+function sub(v1, v2) {
+    return new Array(v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2]);
+}
+
+function scalev(v1, v2) {
+    return new Array(v1[0] * v2[0], v1[1] * v2[1], v1[2] * v2[2]);
+}
+
+function dot(v1, v2) {
+    return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
+}
+
+function scale(v, scale) {
+    return [v[0] * scale, v[1] * scale, v[2] * scale];
+}
+
+function cross(v1, v2) {
+    return [v1[1] * v2[2] - v1[2] * v2[1], 
+            v1[2] * v2[0] - v1[0] * v2[2],
+            v1[0] * v2[1] - v1[1] * v2[0]];
+
+}
+
+function normalise(v) {
+    var len = lengthVector(v);
+    return [v[0] / len, v[1] / len, v[2] / len];
+}
+
+function transformMatrix(self, v) {
+    var vals = self;
+    var x  = vals[0] * v[0] + vals[1] * v[1] + vals[2] * v[2] + vals[3];
+    var y  = vals[4] * v[0] + vals[5] * v[1] + vals[6] * v[2] + vals[7];
+    var z  = vals[8] * v[0] + vals[9] * v[1] + vals[10] * v[2] + vals[11];
+    return [x, y, z];
+}
+
+function invertMatrix(self) {
+    var temp = new Array(16);
+    var tx = -self[3];
+    var ty = -self[7];
+    var tz = -self[11];
+    for (h = 0; h < 3; h++) 
+        for (v = 0; v < 3; v++) 
+            temp[h + v * 4] = self[v + h * 4];
+    for (i = 0; i < 11; i++)
+        self[i] = temp[i];
+    self[3] = tx * self[0] + ty * self[1] + tz * self[2];
+    self[7] = tx * self[4] + ty * self[5] + tz * self[6];
+    self[11] = tx * self[8] + ty * self[9] + tz * self[10];
+    return self;
+}
+
+
+// Triangle intersection using barycentric coord method
+function Triangle(p1, p2, p3) {
+    var edge1 = sub(p3, p1);
+    var edge2 = sub(p2, p1);
+    var normal = cross(edge1, edge2);
+    if (Math.abs(normal[0]) > Math.abs(normal[1]))
+        if (Math.abs(normal[0]) > Math.abs(normal[2]))
+            this.axis = 0; 
+        else 
+            this.axis = 2;
+    else
+        if (Math.abs(normal[1]) > Math.abs(normal[2])) 
+            this.axis = 1;
+        else 
+            this.axis = 2;
+    var u = (this.axis + 1) % 3;
+    var v = (this.axis + 2) % 3;
+    var u1 = edge1[u];
+    var v1 = edge1[v];
+    
+    var u2 = edge2[u];
+    var v2 = edge2[v];
+    this.normal = normalise(normal);
+    this.nu = normal[u] / normal[this.axis];
+    this.nv = normal[v] / normal[this.axis];
+    this.nd = dot(normal, p1) / normal[this.axis];
+    var det = u1 * v2 - v1 * u2;
+    this.eu = p1[u];
+    this.ev = p1[v]; 
+    this.nu1 = u1 / det;
+    this.nv1 = -v1 / det;
+    this.nu2 = v2 / det;
+    this.nv2 = -u2 / det; 
+    this.material = [0.7, 0.7, 0.7];
+}
+
+Triangle.prototype.intersect = function(orig, dir, near, far) {
+    var u = (this.axis + 1) % 3;
+    var v = (this.axis + 2) % 3;
+    var d = dir[this.axis] + this.nu * dir[u] + this.nv * dir[v];
+    var t = (this.nd - orig[this.axis] - this.nu * orig[u] - this.nv * orig[v]) / d;
+    if (t < near || t > far)
+        return null;
+    var Pu = orig[u] + t * dir[u] - this.eu;
+    var Pv = orig[v] + t * dir[v] - this.ev;
+    var a2 = Pv * this.nu1 + Pu * this.nv1;
+    if (a2 < 0) 
+        return null;
+    var a3 = Pu * this.nu2 + Pv * this.nv2;
+    if (a3 < 0) 
+        return null;
+
+    if ((a2 + a3) > 1) 
+        return null;
+    return t;
+}
+
+function Scene(a_triangles) {
+    this.triangles = a_triangles;
+    this.lights = [];
+    this.ambient = [0,0,0];
+    this.background = [0.8,0.8,1];
+}
+var zero = new Array(0,0,0);
+
+Scene.prototype.intersect = function(origin, dir, near, far) {
+    var closest = null;
+    for (i = 0; i < this.triangles.length; i++) {
+        var triangle = this.triangles[i];   
+        var d = triangle.intersect(origin, dir, near, far);
+        if (d == null || d > far || d < near)
+            continue;
+        far = d;
+        closest = triangle;
+    }
+    
+    if (!closest)
+        return [this.background[0],this.background[1],this.background[2]];
+        
+    var normal = closest.normal;
+    var hit = add(origin, scale(dir, far)); 
+    if (dot(dir, normal) > 0)
+        normal = [-normal[0], -normal[1], -normal[2]];
+    
+    var colour = null;
+    if (closest.shader) {
+        colour = closest.shader(closest, hit, dir);
+    } else {
+        colour = closest.material;
+    }
+    
+    // do reflection
+    var reflected = null;
+    if (colour.reflection > 0.001) {
+        var reflection = addVector(scale(normal, -2*dot(dir, normal)), dir);
+        reflected = this.intersect(hit, reflection, 0.0001, 1000000);
+        if (colour.reflection >= 0.999999)
+            return reflected;
+    }
+    
+    var l = [this.ambient[0], this.ambient[1], this.ambient[2]];
+    for (var i = 0; i < this.lights.length; i++) {
+        var light = this.lights[i];
+        var toLight = sub(light, hit);
+        var distance = lengthVector(toLight);
+        scaleVector(toLight, 1.0/distance);
+        distance -= 0.0001;
+        if (this.blocked(hit, toLight, distance))
+            continue;
+        var nl = dot(normal, toLight);
+        if (nl > 0)
+            addVector(l, scale(light.colour, nl));
+    }
+    l = scalev(l, colour);
+    if (reflected) {
+        l = addVector(scaleVector(l, 1 - colour.reflection), scaleVector(reflected, colour.reflection));
+    }
+    return l;
+}
+
+Scene.prototype.blocked = function(O, D, far) {
+    var near = 0.0001;
+    var closest = null;
+    for (i = 0; i < this.triangles.length; i++) {
+        var triangle = this.triangles[i];   
+        var d = triangle.intersect(O, D, near, far);
+        if (d == null || d > far || d < near)
+            continue;
+        return true;
+    }
+    
+    return false;
+}
+
+
+// this camera code is from notes i made ages ago, it is from *somewhere* -- i cannot remember where
+// that somewhere is
+function Camera(origin, lookat, up) {
+    var zaxis = normaliseVector(subVector(lookat, origin));
+    var xaxis = normaliseVector(cross(up, zaxis));
+    var yaxis = normaliseVector(cross(xaxis, subVector([0,0,0], zaxis)));
+    var m = new Array(16);
+    m[0] = xaxis[0]; m[1] = xaxis[1]; m[2] = xaxis[2];
+    m[4] = yaxis[0]; m[5] = yaxis[1]; m[6] = yaxis[2];
+    m[8] = zaxis[0]; m[9] = zaxis[1]; m[10] = zaxis[2];
+    invertMatrix(m);
+    m[3] = 0; m[7] = 0; m[11] = 0;
+    this.origin = origin;
+    this.directions = new Array(4);
+    this.directions[0] = normalise([-0.7,  0.7, 1]);
+    this.directions[1] = normalise([ 0.7,  0.7, 1]);
+    this.directions[2] = normalise([ 0.7, -0.7, 1]);
+    this.directions[3] = normalise([-0.7, -0.7, 1]);
+    this.directions[0] = transformMatrix(m, this.directions[0]);
+    this.directions[1] = transformMatrix(m, this.directions[1]);
+    this.directions[2] = transformMatrix(m, this.directions[2]);
+    this.directions[3] = transformMatrix(m, this.directions[3]);
+}
+
+Camera.prototype.generateRayPair = function(y) {
+    rays = new Array(new Object(), new Object());
+    rays[0].origin = this.origin;
+    rays[1].origin = this.origin;
+    rays[0].dir = addVector(scale(this.directions[0], y), scale(this.directions[3], 1 - y));
+    rays[1].dir = addVector(scale(this.directions[1], y), scale(this.directions[2], 1 - y));
+    return rays;
+}
+
+function renderRows(camera, scene, pixels, width, height, starty, stopy) {
+    for (var y = starty; y < stopy; y++) {
+        var rays = camera.generateRayPair(y / height);
+        for (var x = 0; x < width; x++) {
+            var xp = x / width;
+            var origin = addVector(scale(rays[0].origin, xp), scale(rays[1].origin, 1 - xp));
+            var dir = normaliseVector(addVector(scale(rays[0].dir, xp), scale(rays[1].dir, 1 - xp)));
+            var l = scene.intersect(origin, dir);
+            pixels[y][x] = l;
+        }
+    }
+}
+
+Camera.prototype.render = function(scene, pixels, width, height) {
+    var cam = this;
+    var row = 0;
+    renderRows(cam, scene, pixels, width, height, 0, height);
+}
+
+
+
+function raytraceScene(size)
+{
+    var startDate = new Date().getTime();
+    var numTriangles = 2 * 6;
+    var triangles = new Array();//numTriangles);
+    var tfl = createVector(-10,  10, -10);
+    var tfr = createVector( 10,  10, -10);
+    var tbl = createVector(-10,  10,  10);
+    var tbr = createVector( 10,  10,  10);
+    var bfl = createVector(-10, -10, -10);
+    var bfr = createVector( 10, -10, -10);
+    var bbl = createVector(-10, -10,  10);
+    var bbr = createVector( 10, -10,  10);
+    
+    // cube!!!
+    // front
+    var i = 0;
+    
+    triangles[i++] = new Triangle(tfl, tfr, bfr);
+    triangles[i++] = new Triangle(tfl, bfr, bfl);
+    // back
+    triangles[i++] = new Triangle(tbl, tbr, bbr);
+    triangles[i++] = new Triangle(tbl, bbr, bbl);
+    //        triangles[i-1].material = [0.7,0.2,0.2];
+    //            triangles[i-1].material.reflection = 0.8;
+    // left
+    triangles[i++] = new Triangle(tbl, tfl, bbl);
+    //            triangles[i-1].reflection = 0.6;
+    triangles[i++] = new Triangle(tfl, bfl, bbl);
+    //            triangles[i-1].reflection = 0.6;
+    // right
+    triangles[i++] = new Triangle(tbr, tfr, bbr);
+    triangles[i++] = new Triangle(tfr, bfr, bbr);
+    // top
+    triangles[i++] = new Triangle(tbl, tbr, tfr);
+    triangles[i++] = new Triangle(tbl, tfr, tfl);
+    // bottom
+    triangles[i++] = new Triangle(bbl, bbr, bfr);
+    triangles[i++] = new Triangle(bbl, bfr, bfl);
+    
+    //Floor!!!!
+    var green = createVector(0.0, 0.4, 0.0);
+    var grey = createVector(0.4, 0.4, 0.4);
+    grey.reflection = 1.0;
+    var floorShader = function(tri, pos, view) {
+        var x = ((pos[0]/32) % 2 + 2) % 2;
+        var z = ((pos[2]/32 + 0.3) % 2 + 2) % 2;
+        if (x < 1 != z < 1) {
+            //in the real world we use the fresnel term...
+            //    var angle = 1-dot(view, tri.normal);
+            //   angle *= angle;
+            //  angle *= angle;
+            // angle *= angle;
+            //grey.reflection = angle;
+            return grey;
+        } else 
+            return green;
+    }
+    var ffl = createVector(-1000, -30, -1000);
+    var ffr = createVector( 1000, -30, -1000);
+    var fbl = createVector(-1000, -30,  1000);
+    var fbr = createVector( 1000, -30,  1000);
+    triangles[i++] = new Triangle(fbl, fbr, ffr);
+    triangles[i-1].shader = floorShader;
+    triangles[i++] = new Triangle(fbl, ffr, ffl);
+    triangles[i-1].shader = floorShader;
+    
+    var _scene = new Scene(triangles);
+    _scene.lights[0] = createVector(20, 38, -22);
+    _scene.lights[0].colour = createVector(0.7, 0.3, 0.3);
+    _scene.lights[1] = createVector(-23, 40, 17);
+    _scene.lights[1].colour = createVector(0.7, 0.3, 0.3);
+    _scene.lights[2] = createVector(23, 20, 17);
+    _scene.lights[2].colour = createVector(0.7, 0.7, 0.7);
+    _scene.ambient = createVector(0.1, 0.1, 0.1);
+    //  _scene.background = createVector(0.7, 0.7, 1.0);
+    
+    var pixels = new Array();
+    for (var y = 0; y < size; y++) {
+        pixels[y] = new Array();
+        for (var x = 0; x < size; x++) {
+            pixels[y][x] = 0;
+        }
+    }
+
+    var _camera = new Camera(createVector(-40, 40, 40), createVector(0, 0, 0), createVector(0, 1, 0));
+    _camera.render(_scene, pixels, size, size);
+
+    return pixels;
+}
+
+function arrayToCanvasCommands(pixels, size)
+{
+    var s = '<canvas id="renderCanvas" width="30px" height="30px"></canvas><scr' + 'ipt>\nvar pixels = [';
+    for (var y = 0; y < size; y++) {
+        s += "[";
+        for (var x = 0; x < size; x++) {
+            s += "[" + pixels[y][x] + "],";
+        }
+        s+= "],";
+    }
+    s += '];\n    var canvas = document.getElementById("renderCanvas").getContext("2d");\n\
+\n\
+\n\
+    var size = 20;\n\
+    canvas.fillStyle = "red";\n\
+    canvas.fillRect(0, 0, size, size);\n\
+    canvas.scale(1, -1);\n\
+    canvas.translate(0, -size);\n\
+\n\
+    if (!canvas.setFillColor)\n\
+        canvas.setFillColor = function(r, g, b, a) {\n\
+            this.fillStyle = "rgb("+[Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)]+")";\n\
+    }\n\
+\n\
+for (var y = 0; y < size; y++) {\n\
+  for (var x = 0; x < size; x++) {\n\
+    var l = pixels[y][x];\n\
+    canvas.setFillColor(l[0], l[1], l[2], 1);\n\
+    canvas.fillRect(x, y, 1, 1);\n\
+  }\n\
+}</scr' + 'ipt>';
+
+    return s;
+}
+
+window.onload = function(){ startTest("sunspider-3d-raytrace", '');
+
+var rayoutput;
+
+test("3D Raytrace", function(){
+	rayoutput = raytraceScene(15);
+});
+
+test("Convert pixels to canvas", function(){
+	for ( var i = 0; i < 10; i++ )
+		testOutput = arrayToCanvasCommands(rayoutput, 15);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-access-binary-trees.html b/tests/sunspider-access-binary-trees.html
new file mode 100644
index 0000000..d5e4da6
--- /dev/null
+++ b/tests/sunspider-access-binary-trees.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/* The Great Computer Language Shootout
+   http://shootout.alioth.debian.org/
+   contributed by Isaac Gouy */
+
+function TreeNode(left,right,item){
+   this.left = left;
+   this.right = right;
+   this.item = item;
+}
+
+TreeNode.prototype.itemCheck = function(){
+   if (this.left==null) return this.item;
+   else return this.item + this.left.itemCheck() - this.right.itemCheck();
+}
+
+function bottomUpTree(item,depth){
+   if (depth>0){
+      return new TreeNode(
+          bottomUpTree(2*item-1, depth-1)
+         ,bottomUpTree(2*item, depth-1)
+         ,item
+      );
+   }
+   else {
+      return new TreeNode(null,null,item);
+   }
+}
+
+window.onload = function(){ startTest("sunspider-access-binary-trees", '');
+
+var ret;
+
+test( "Binary Trees", function(){
+	for ( var n = 4; n <= 5; n += 1 ) {
+	var minDepth = 4;
+	var maxDepth = Math.max(minDepth + 2, n);
+	var stretchDepth = maxDepth + 1;
+	
+	var check = bottomUpTree(0,stretchDepth).itemCheck();
+	
+	var longLivedTree = bottomUpTree(0,maxDepth);
+	for (var depth=minDepth; depth<=maxDepth; depth+=2){
+	   var iterations = 1 << (maxDepth - depth + minDepth);
+	
+	   check = 0;
+	   for (var i=1; i<=iterations; i++){
+		  check += bottomUpTree(i,depth).itemCheck();
+		  check += bottomUpTree(-i,depth).itemCheck();
+	   }
+	}
+	
+	ret = longLivedTree.itemCheck();
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-access-fannkuch.html b/tests/sunspider-access-fannkuch.html
new file mode 100644
index 0000000..175ef2d
--- /dev/null
+++ b/tests/sunspider-access-fannkuch.html
@@ -0,0 +1,80 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/* The Great Computer Language Shootout
+   http://shootout.alioth.debian.org/
+   contributed by Isaac Gouy */
+
+function fannkuch(n) {
+   var check = 0;
+   var perm = Array(n);
+   var perm1 = Array(n);
+   var count = Array(n);
+   var maxPerm = Array(n);
+   var maxFlipsCount = 0;
+   var m = n - 1;
+
+   for (var i = 0; i < n; i++) perm1[i] = i;
+   var r = n;
+
+   while (true) {
+      // write-out the first 30 permutations
+      if (check < 30){
+         var s = "";
+         for(var i=0; i<n; i++) s += (perm1[i]+1).toString();
+         check++;
+      }
+
+      while (r != 1) { count[r - 1] = r; r--; }
+      if (!(perm1[0] == 0 || perm1[m] == m)) {
+         for (var i = 0; i < n; i++) perm[i] = perm1[i];
+
+         var flipsCount = 0;
+         var k;
+
+         while (!((k = perm[0]) == 0)) {
+            var k2 = (k + 1) >> 1;
+            for (var i = 0; i < k2; i++) {
+               var temp = perm[i]; perm[i] = perm[k - i]; perm[k - i] = temp;
+            }
+            flipsCount++;
+         }
+
+         if (flipsCount > maxFlipsCount) {
+            maxFlipsCount = flipsCount;
+            for (var i = 0; i < n; i++) maxPerm[i] = perm1[i];
+         }
+      }
+
+      while (true) {
+         if (r == n) return maxFlipsCount;
+         var perm0 = perm1[0];
+         var i = 0;
+         while (i < r) {
+            var j = i + 1;
+            perm1[i] = perm1[j];
+            i = j;
+         }
+         perm1[r] = perm0;
+
+         count[r] = count[r] - 1;
+         if (count[r] > 0) break;
+         r++;
+      }
+   }
+}
+
+window.onload = function(){ startTest("sunspider-access-fannkuch", '');
+
+var ret;
+
+test( "Pfannkuchen", function(){
+	ret = fannkuch(7);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-access-nbody.html b/tests/sunspider-access-nbody.html
new file mode 100644
index 0000000..6b8a3b7
--- /dev/null
+++ b/tests/sunspider-access-nbody.html
@@ -0,0 +1,181 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/* The Great Computer Language Shootout
+   http://shootout.alioth.debian.org/
+   contributed by Isaac Gouy */
+
+var PI = 3.141592653589793;
+var SOLAR_MASS = 4 * PI * PI;
+var DAYS_PER_YEAR = 365.24;
+
+function Body(x,y,z,vx,vy,vz,mass){
+   this.x = x;
+   this.y = y;
+   this.z = z;
+   this.vx = vx;
+   this.vy = vy;
+   this.vz = vz;
+   this.mass = mass;
+}
+
+Body.prototype.offsetMomentum = function(px,py,pz) {
+   this.vx = -px / SOLAR_MASS;
+   this.vy = -py / SOLAR_MASS;
+   this.vz = -pz / SOLAR_MASS;
+   return this;
+}
+
+function Jupiter(){
+   return new Body(
+      4.84143144246472090e+00,
+      -1.16032004402742839e+00,
+      -1.03622044471123109e-01,
+      1.66007664274403694e-03 * DAYS_PER_YEAR,
+      7.69901118419740425e-03 * DAYS_PER_YEAR,
+      -6.90460016972063023e-05 * DAYS_PER_YEAR,
+      9.54791938424326609e-04 * SOLAR_MASS
+   );
+}
+
+function Saturn(){
+   return new Body(
+      8.34336671824457987e+00,
+      4.12479856412430479e+00,
+      -4.03523417114321381e-01,
+      -2.76742510726862411e-03 * DAYS_PER_YEAR,
+      4.99852801234917238e-03 * DAYS_PER_YEAR,
+      2.30417297573763929e-05 * DAYS_PER_YEAR,
+      2.85885980666130812e-04 * SOLAR_MASS
+   );
+}
+
+function Uranus(){
+   return new Body(
+      1.28943695621391310e+01,
+      -1.51111514016986312e+01,
+      -2.23307578892655734e-01,
+      2.96460137564761618e-03 * DAYS_PER_YEAR,
+      2.37847173959480950e-03 * DAYS_PER_YEAR,
+      -2.96589568540237556e-05 * DAYS_PER_YEAR,
+      4.36624404335156298e-05 * SOLAR_MASS
+   );
+}
+
+function Neptune(){
+   return new Body(
+      1.53796971148509165e+01,
+      -2.59193146099879641e+01,
+      1.79258772950371181e-01,
+      2.68067772490389322e-03 * DAYS_PER_YEAR,
+      1.62824170038242295e-03 * DAYS_PER_YEAR,
+      -9.51592254519715870e-05 * DAYS_PER_YEAR,
+      5.15138902046611451e-05 * SOLAR_MASS
+   );
+}
+
+function Sun(){
+   return new Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS);
+}
+
+
+function NBodySystem(bodies){
+   this.bodies = bodies;
+   var px = 0.0;
+   var py = 0.0;
+   var pz = 0.0;
+   var size = this.bodies.length;
+   for (var i=0; i<size; i++){
+      var b = this.bodies[i];
+      var m = b.mass;
+      px += b.vx * m;
+      py += b.vy * m;
+      pz += b.vz * m;
+   }
+   this.bodies[0].offsetMomentum(px,py,pz);
+}
+
+NBodySystem.prototype.advance = function(dt){
+   var dx, dy, dz, distance, mag;
+   var size = this.bodies.length;
+
+   for (var i=0; i<size; i++) {
+      var bodyi = this.bodies[i];
+      for (var j=i+1; j<size; j++) {
+         var bodyj = this.bodies[j];
+         dx = bodyi.x - bodyj.x;
+         dy = bodyi.y - bodyj.y;
+         dz = bodyi.z - bodyj.z;
+
+         distance = Math.sqrt(dx*dx + dy*dy + dz*dz);
+         mag = dt / (distance * distance * distance);
+
+         bodyi.vx -= dx * bodyj.mass * mag;
+         bodyi.vy -= dy * bodyj.mass * mag;
+         bodyi.vz -= dz * bodyj.mass * mag;
+
+         bodyj.vx += dx * bodyi.mass * mag;
+         bodyj.vy += dy * bodyi.mass * mag;
+         bodyj.vz += dz * bodyi.mass * mag;
+      }
+   }
+
+   for (var i=0; i<size; i++) {
+      var body = this.bodies[i];
+      body.x += dt * body.vx;
+      body.y += dt * body.vy;
+      body.z += dt * body.vz;
+   }
+}
+
+NBodySystem.prototype.energy = function(){
+   var dx, dy, dz, distance;
+   var e = 0.0;
+   var size = this.bodies.length;
+
+   for (var i=0; i<size; i++) {
+      var bodyi = this.bodies[i];
+
+      e += 0.5 * bodyi.mass *
+         ( bodyi.vx * bodyi.vx
+         + bodyi.vy * bodyi.vy
+         + bodyi.vz * bodyi.vz );
+
+      for (var j=i+1; j<size; j++) {
+         var bodyj = this.bodies[j];
+         dx = bodyi.x - bodyj.x;
+         dy = bodyi.y - bodyj.y;
+         dz = bodyi.z - bodyj.z;
+
+         distance = Math.sqrt(dx*dx + dy*dy + dz*dz);
+         e -= (bodyi.mass * bodyj.mass) / distance;
+      }
+   }
+   return e;
+}
+
+window.onload = function(){ startTest("sunspider-access-nbody", '');
+
+var ret;
+
+test( "N-Body", function(){
+	for ( var n = 3; n <= 6; n *= 2 ) {
+	var bodies = new NBodySystem( Array(
+	   Sun(),Jupiter(),Saturn(),Uranus(),Neptune()
+	));
+	var max = n * 100;
+		
+	ret = bodies.energy();
+	for (var i=0; i<max; i++){
+		bodies.advance(0.01);
+	}
+	ret = bodies.energy();
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-access-nsieve.html b/tests/sunspider-access-nsieve.html
new file mode 100644
index 0000000..5c2d6c6
--- /dev/null
+++ b/tests/sunspider-access-nsieve.html
@@ -0,0 +1,48 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Great Computer Language Shootout
+// http://shootout.alioth.debian.org/
+//
+// modified by Isaac Gouy
+
+function pad(number,width){
+   var s = number.toString();
+   var prefixWidth = width - s.length;
+   if (prefixWidth>0){
+      for (var i=1; i<=prefixWidth; i++) s = " " + s;
+   }
+   return s;
+}
+
+function nsieve(m, isPrime){
+   var i, k, count;
+
+   for (i=2; i<=m; i++) { isPrime[i] = true; }
+   count = 0;
+
+   for (i=2; i<=m; i++){
+      if (isPrime[i]) {
+         for (k=i+i; k<=m; k+=i) isPrime[k] = false;
+         count++;
+      }
+   }
+   return count;
+}
+
+window.onload = function(){ startTest("sunspider-access-nsieve", '');
+
+test( "N-Sieve", function(){
+	for ( var i = 1; i <= 2; i++ ) {
+       	var m = (1<<i)*10000;
+       	var flags = Array(m+1);
+	nsieve(m,flags);
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-bitops-3bit-bits-in-byte.html b/tests/sunspider-bitops-3bit-bits-in-byte.html
new file mode 100644
index 0000000..3064688
--- /dev/null
+++ b/tests/sunspider-bitops-3bit-bits-in-byte.html
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// Copyright (c) 2004 by Arthur Langereis (arthur_ext at domain xfinitegames, tld com
+
+// 1 op = 6 ANDs, 3 SHRs, 3 SHLs, 4 assigns, 2 ADDs
+// O(1)
+function fast3bitlookup(b) {
+var c, bi3b = 0xE994; // 0b1110 1001 1001 0100; // 3 2 2 1  2 1 1 0
+c  = 3 & (bi3b >> ((b << 1) & 14));
+c += 3 & (bi3b >> ((b >> 2) & 14));
+c += 3 & (bi3b >> ((b >> 5) & 6));
+return c;
+
+/*
+lir4,0xE994; 9 instructions, no memory access, minimal register dependence, 6 shifts, 2 adds, 1 inline assign
+rlwinmr5,r3,1,28,30
+rlwinmr6,r3,30,28,30
+rlwinmr7,r3,27,29,30
+rlwnmr8,r4,r5,30,31
+rlwnmr9,r4,r6,30,31
+rlwnmr10,r4,r7,30,31
+addr3,r8,r9
+addr3,r3,r10
+*/
+}
+
+
+function TimeFunc(func) {
+var x, y, t;
+for(var x=0; x<250; x++)
+for(var y=0; y<256; y++) func(y);
+}
+
+window.onload = function(){ startTest("sunspider-bitops-3bit-bits-in-byte", '');
+
+test("3bit bits in byte", function(){
+	TimeFunc(fast3bitlookup);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-bitops-bits-in-byte.html b/tests/sunspider-bitops-bits-in-byte.html
new file mode 100644
index 0000000..ac3bceb
--- /dev/null
+++ b/tests/sunspider-bitops-bits-in-byte.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// Copyright (c) 2004 by Arthur Langereis (arthur_ext at domain xfinitegames, tld com)
+
+
+// 1 op = 2 assigns, 16 compare/branches, 8 ANDs, (0-8) ADDs, 8 SHLs
+// O(n)
+function bitsinbyte(b) {
+var m = 1, c = 0;
+while(m<0x100) {
+if(b & m) c++;
+m <<= 1;
+}
+return c;
+}
+
+function TimeFunc(func) {
+var x, y, t;
+for(var x=0; x<100; x++)
+for(var y=0; y<256; y++) func(y);
+}
+
+window.onload = function(){ startTest("sunspider-bitops-bits-in-byte", '');
+
+test("Bit in byte (2)", function(){
+	TimeFunc(bitsinbyte);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-bitops-bitwise-and.html b/tests/sunspider-bitops-bitwise-and.html
new file mode 100644
index 0000000..c82863b
--- /dev/null
+++ b/tests/sunspider-bitops-bitwise-and.html
@@ -0,0 +1,42 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+window.onload = function(){ startTest("sunspider-bitops-bitwise-and", '');
+
+test("Bitwise And", function(){
+	bitwiseAndValue = 4294967296;
+	for (var i = 0; i < 60000; i++)
+    		bitwiseAndValue = bitwiseAndValue & i;
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-bitops-nsieve-bits.html b/tests/sunspider-bitops-nsieve-bits.html
new file mode 100644
index 0000000..0bffde9
--- /dev/null
+++ b/tests/sunspider-bitops-nsieve-bits.html
@@ -0,0 +1,42 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Great Computer Language Shootout
+//  http://shootout.alioth.debian.org
+//
+//  Contributed by Ian Osgood
+
+function pad(n,width) {
+  var s = n.toString();
+  while (s.length < width) s = ' ' + s;
+  return s;
+}
+
+function primes(isPrime, n) {
+  var i, count = 0, m = 10000<<n, size = m+31>>5;
+
+  for (i=0; i<size; i++) isPrime[i] = 0xffffffff;
+
+  for (i=2; i<m; i++)
+    if (isPrime[i>>5] & 1<<(i&31)) {
+      for (var j=i+i; j<m; j+=i)
+        isPrime[j>>5] &= ~(1<<(j&31));
+      count++;
+    }
+}
+
+window.onload = function(){ startTest("sunspider-bitops-nsieve-bits", '');
+
+var i = 2;
+
+test( "N-Sieve Bits", function(){
+	var isPrime = new Array((10000<<i)+31>>5);
+	primes(isPrime, i);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-controlflow-recursive.html b/tests/sunspider-controlflow-recursive.html
new file mode 100644
index 0000000..0146c7d
--- /dev/null
+++ b/tests/sunspider-controlflow-recursive.html
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Computer Language Shootout
+// http://shootout.alioth.debian.org/
+// contributed by Isaac Gouy
+
+function ack(m,n){
+   if (m==0) { return n+1; }
+   if (n==0) { return ack(m-1,1); }
+   return ack(m-1, ack(m,n-1) );
+}
+
+function fib(n) {
+    if (n < 2){ return 1; }
+    return fib(n-2) + fib(n-1);
+}
+
+function tak(x,y,z) {
+	if (y >= x) return z;
+	return tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y));
+}
+
+window.onload = function(){ startTest("sunspider-controlflow-recursive", '');
+
+	test("Ack", function(){
+		for ( var i = 3; i <= 5; i++ )
+			ack(3,i);
+	});
+	
+	test("Fib", function(){
+		for ( var i = 3; i <= 5; i++ )
+			fib(17.0+i);
+	});
+	
+	test("Tak", function(){
+		for ( var i = 3; i <= 5; i++ )
+			tak(3*i+3,2*i+2,i+1);
+	});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-crypto-aes.html b/tests/sunspider-crypto-aes.html
new file mode 100644
index 0000000..d6c625d
--- /dev/null
+++ b/tests/sunspider-crypto-aes.html
@@ -0,0 +1,443 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
+
+/*
+ * AES Cipher function: encrypt 'input' with Rijndael algorithm
+ *
+ *   takes   byte-array 'input' (16 bytes)
+ *           2D byte-array key schedule 'w' (Nr+1 x Nb bytes)
+ *
+ *   applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage
+ *
+ *   returns byte-array encrypted value (16 bytes)
+ */
+function Cipher(input, w) {    // main Cipher function [§5.1]
+  var Nb = 4;               // block size (in words): no of columns in state (fixed at 4 for AES)
+  var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
+
+  var state = [[],[],[],[]];  // initialise 4xNb byte-array 'state' with input [§3.4]
+  for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];
+
+  state = AddRoundKey(state, w, 0, Nb);
+
+  for (var round=1; round<Nr; round++) {
+    state = SubBytes(state, Nb);
+    state = ShiftRows(state, Nb);
+    state = MixColumns(state, Nb);
+    state = AddRoundKey(state, w, round, Nb);
+  }
+
+  state = SubBytes(state, Nb);
+  state = ShiftRows(state, Nb);
+  state = AddRoundKey(state, w, Nr, Nb);
+
+  var output = new Array(4*Nb);  // convert state to 1-d array before returning [§3.4]
+  for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
+  return output;
+}
+
+
+function SubBytes(s, Nb) {    // apply SBox to state S [§5.1.1]
+  for (var r=0; r<4; r++) {
+    for (var c=0; c<Nb; c++) s[r][c] = Sbox[s[r][c]];
+  }
+  return s;
+}
+
+
+function ShiftRows(s, Nb) {    // shift row r of state S left by r bytes [§5.1.2]
+  var t = new Array(4);
+  for (var r=1; r<4; r++) {
+    for (var c=0; c<4; c++) t[c] = s[r][(c+r)%Nb];  // shift into temp copy
+    for (var c=0; c<4; c++) s[r][c] = t[c];         // and copy back
+  }          // note that this will work for Nb=4,5,6, but not 7,8 (always 4 for AES):
+  return s;  // see fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.311.pdf 
+}
+
+
+function MixColumns(s, Nb) {   // combine bytes of each col of state S [§5.1.3]
+  for (var c=0; c<4; c++) {
+    var a = new Array(4);  // 'a' is a copy of the current column from 's'
+    var b = new Array(4);  // 'b' is a•{02} in GF(2^8)
+    for (var i=0; i<4; i++) {
+      a[i] = s[i][c];
+      b[i] = s[i][c]&0x80 ? s[i][c]<<1 ^ 0x011b : s[i][c]<<1;
+    }
+    // a[n] ^ b[n] is a•{03} in GF(2^8)
+    s[0][c] = b[0] ^ a[1] ^ b[1] ^ a[2] ^ a[3]; // 2*a0 + 3*a1 + a2 + a3
+    s[1][c] = a[0] ^ b[1] ^ a[2] ^ b[2] ^ a[3]; // a0 * 2*a1 + 3*a2 + a3
+    s[2][c] = a[0] ^ a[1] ^ b[2] ^ a[3] ^ b[3]; // a0 + a1 + 2*a2 + 3*a3
+    s[3][c] = a[0] ^ b[0] ^ a[1] ^ a[2] ^ b[3]; // 3*a0 + a1 + a2 + 2*a3
+  }
+  return s;
+}
+
+
+function AddRoundKey(state, w, rnd, Nb) {  // xor Round Key into state S [§5.1.4]
+  for (var r=0; r<4; r++) {
+    for (var c=0; c<Nb; c++) state[r][c] ^= w[rnd*4+c][r];
+  }
+  return state;
+}
+
+
+function KeyExpansion(key) {  // generate Key Schedule (byte-array Nr+1 x Nb) from Key [§5.2]
+  var Nb = 4;            // block size (in words): no of columns in state (fixed at 4 for AES)
+  var Nk = key.length/4  // key length (in words): 4/6/8 for 128/192/256-bit keys
+  var Nr = Nk + 6;       // no of rounds: 10/12/14 for 128/192/256-bit keys
+
+  var w = new Array(Nb*(Nr+1));
+  var temp = new Array(4);
+
+  for (var i=0; i<Nk; i++) {
+    var r = [key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]];
+    w[i] = r;
+  }
+
+  for (var i=Nk; i<(Nb*(Nr+1)); i++) {
+    w[i] = new Array(4);
+    for (var t=0; t<4; t++) temp[t] = w[i-1][t];
+    if (i % Nk == 0) {
+      temp = SubWord(RotWord(temp));
+      for (var t=0; t<4; t++) temp[t] ^= Rcon[i/Nk][t];
+    } else if (Nk > 6 && i%Nk == 4) {
+      temp = SubWord(temp);
+    }
+    for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t];
+  }
+
+  return w;
+}
+
+function SubWord(w) {    // apply SBox to 4-byte word w
+  for (var i=0; i<4; i++) w[i] = Sbox[w[i]];
+  return w;
+}
+
+function RotWord(w) {    // rotate 4-byte word w left by one byte
+  w[4] = w[0];
+  for (var i=0; i<4; i++) w[i] = w[i+1];
+  return w;
+}
+
+
+// Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion [§5.1.1]
+var Sbox =  [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76,
+             0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0,
+             0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15,
+             0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75,
+             0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84,
+             0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf,
+             0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8,
+             0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2,
+             0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73,
+             0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb,
+             0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79,
+             0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08,
+             0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a,
+             0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e,
+             0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf,
+             0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16];
+
+// Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2]
+var Rcon = [ [0x00, 0x00, 0x00, 0x00],
+             [0x01, 0x00, 0x00, 0x00],
+             [0x02, 0x00, 0x00, 0x00],
+             [0x04, 0x00, 0x00, 0x00],
+             [0x08, 0x00, 0x00, 0x00],
+             [0x10, 0x00, 0x00, 0x00],
+             [0x20, 0x00, 0x00, 0x00],
+             [0x40, 0x00, 0x00, 0x00],
+             [0x80, 0x00, 0x00, 0x00],
+             [0x1b, 0x00, 0x00, 0x00],
+             [0x36, 0x00, 0x00, 0x00] ]; 
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
+
+/* 
+ * Use AES to encrypt 'plaintext' with 'password' using 'nBits' key, in 'Counter' mode of operation
+ *                           - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
+ *   for each block
+ *   - outputblock = cipher(counter, key)
+ *   - cipherblock = plaintext xor outputblock
+ */
+function AESEncryptCtr(plaintext, password, nBits) {
+  if (!(nBits==128 || nBits==192 || nBits==256)) return '';  // standard allows 128/192/256 bit keys
+
+  // for this example script, generate the key by applying Cipher to 1st 16/24/32 chars of password; 
+  // for real-world applications, a more secure approach would be to hash the password e.g. with SHA-1
+  var nBytes = nBits/8;  // no bytes in key
+  var pwBytes = new Array(nBytes);
+  for (var i=0; i<nBytes; i++) pwBytes[i] = password.charCodeAt(i) & 0xff;
+  var key = Cipher(pwBytes, KeyExpansion(pwBytes));
+  key = key.concat(key.slice(0, nBytes-16));  // key is now 16/24/32 bytes long
+
+  // initialise counter block (NIST SP800-38A §B.2): millisecond time-stamp for nonce in 1st 8 bytes,
+  // block counter in 2nd 8 bytes
+  var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
+  var counterBlock = new Array(blockSize);  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
+  var nonce = (new Date()).getTime();  // milliseconds since 1-Jan-1970
+
+  // encode nonce in two stages to cater for JavaScript 32-bit limit on bitwise ops
+  for (var i=0; i<4; i++) counterBlock[i] = (nonce >>> i*8) & 0xff;
+  for (var i=0; i<4; i++) counterBlock[i+4] = (nonce/0x100000000 >>> i*8) & 0xff; 
+
+  // generate key schedule - an expansion of the key into distinct Key Rounds for each round
+  var keySchedule = KeyExpansion(key);
+
+  var blockCount = Math.ceil(plaintext.length/blockSize);
+  var ciphertext = new Array(blockCount);  // ciphertext as array of strings
+  
+  for (var b=0; b<blockCount; b++) {
+    // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
+    // again done in two stages for 32-bit ops
+    for (var c=0; c<4; c++) counterBlock[15-c] = (b >>> c*8) & 0xff;
+    for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8)
+
+    var cipherCntr = Cipher(counterBlock, keySchedule);  // -- encrypt counter block --
+    
+    // calculate length of final block:
+    var blockLength = b<blockCount-1 ? blockSize : (plaintext.length-1)%blockSize+1;
+
+    var ct = '';
+    for (var i=0; i<blockLength; i++) {  // -- xor plaintext with ciphered counter byte-by-byte --
+      var plaintextByte = plaintext.charCodeAt(b*blockSize+i);
+      var cipherByte = plaintextByte ^ cipherCntr[i];
+      ct += String.fromCharCode(cipherByte);
+    }
+    // ct is now ciphertext for this block
+
+    ciphertext[b] = escCtrlChars(ct);  // escape troublesome characters in ciphertext
+  }
+
+  // convert the nonce to a string to go on the front of the ciphertext
+  var ctrTxt = '';
+  for (var i=0; i<8; i++) ctrTxt += String.fromCharCode(counterBlock[i]);
+  ctrTxt = escCtrlChars(ctrTxt);
+
+  // use '-' to separate blocks, use Array.join to concatenate arrays of strings for efficiency
+  return ctrTxt + '-' + ciphertext.join('-');
+}
+
+
+/* 
+ * Use AES to decrypt 'ciphertext' with 'password' using 'nBits' key, in Counter mode of operation
+ *
+ *   for each block
+ *   - outputblock = cipher(counter, key)
+ *   - cipherblock = plaintext xor outputblock
+ */
+function AESDecryptCtr(ciphertext, password, nBits) {
+  if (!(nBits==128 || nBits==192 || nBits==256)) return '';  // standard allows 128/192/256 bit keys
+
+  var nBytes = nBits/8;  // no bytes in key
+  var pwBytes = new Array(nBytes);
+  for (var i=0; i<nBytes; i++) pwBytes[i] = password.charCodeAt(i) & 0xff;
+  var pwKeySchedule = KeyExpansion(pwBytes);
+  var key = Cipher(pwBytes, pwKeySchedule);
+  key = key.concat(key.slice(0, nBytes-16));  // key is now 16/24/32 bytes long
+
+  var keySchedule = KeyExpansion(key);
+
+  ciphertext = ciphertext.split('-');  // split ciphertext into array of block-length strings 
+
+  // recover nonce from 1st element of ciphertext
+  var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
+  var counterBlock = new Array(blockSize);
+  var ctrTxt = unescCtrlChars(ciphertext[0]);
+  for (var i=0; i<8; i++) counterBlock[i] = ctrTxt.charCodeAt(i);
+
+  var plaintext = new Array(ciphertext.length-1);
+
+  for (var b=1; b<ciphertext.length; b++) {
+    // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
+    for (var c=0; c<4; c++) counterBlock[15-c] = ((b-1) >>> c*8) & 0xff;
+    for (var c=0; c<4; c++) counterBlock[15-c-4] = ((b/0x100000000-1) >>> c*8) & 0xff;
+
+    var cipherCntr = Cipher(counterBlock, keySchedule);  // encrypt counter block
+
+    ciphertext[b] = unescCtrlChars(ciphertext[b]);
+
+    var pt = '';
+    for (var i=0; i<ciphertext[b].length; i++) {
+      // -- xor plaintext with ciphered counter byte-by-byte --
+      var ciphertextByte = ciphertext[b].charCodeAt(i);
+      var plaintextByte = ciphertextByte ^ cipherCntr[i];
+      pt += String.fromCharCode(plaintextByte);
+    }
+    // pt is now plaintext for this block
+
+    plaintext[b-1] = pt;  // b-1 'cos no initial nonce block in plaintext
+  }
+
+  return plaintext.join('');
+}
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
+
+function escCtrlChars(str) {  // escape control chars which might cause problems handling ciphertext
+  return str.replace(/[\0\t\n\v\f\r\xa0'"!-]/g, function(c) { return '!' + c.charCodeAt(0) + '!'; });
+}  // \xa0 to cater for bug in Firefox; include '-' to leave it free for use as a block marker
+
+function unescCtrlChars(str) {  // unescape potentially problematic control characters
+  return str.replace(/!\d\d?\d?!/g, function(c) { return String.fromCharCode(c.slice(1,-1)); });
+}
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
+
+/*
+ * if escCtrlChars()/unescCtrlChars() still gives problems, use encodeBase64()/decodeBase64() instead
+ */
+var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+function encodeBase64(str) {  // http://tools.ietf.org/html/rfc4648
+   var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc='';
+   
+   str = encodeUTF8(str);  // encode multi-byte chars into UTF-8 for byte-array
+
+   do {  // pack three octets into four hexets
+      o1 = str.charCodeAt(i++);
+      o2 = str.charCodeAt(i++);
+      o3 = str.charCodeAt(i++);
+      
+      bits = o1<<16 | o2<<8 | o3;
+      
+      h1 = bits>>18 & 0x3f;
+      h2 = bits>>12 & 0x3f;
+      h3 = bits>>6 & 0x3f;
+      h4 = bits & 0x3f;
+      
+      // end of string? index to '=' in b64
+      if (isNaN(o3)) h4 = 64;
+      if (isNaN(o2)) h3 = 64;
+      
+      // use hexets to index into b64, and append result to encoded string
+      enc += b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
+   } while (i < str.length);
+   
+   return enc;
+}
+
+function decodeBase64(str) {
+   var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc='';
+
+   do {  // unpack four hexets into three octets using index points in b64
+      h1 = b64.indexOf(str.charAt(i++));
+      h2 = b64.indexOf(str.charAt(i++));
+      h3 = b64.indexOf(str.charAt(i++));
+      h4 = b64.indexOf(str.charAt(i++));
+      
+      bits = h1<<18 | h2<<12 | h3<<6 | h4;
+      
+      o1 = bits>>16 & 0xff;
+      o2 = bits>>8 & 0xff;
+      o3 = bits & 0xff;
+      
+      if (h3 == 64)      enc += String.fromCharCode(o1);
+      else if (h4 == 64) enc += String.fromCharCode(o1, o2);
+      else               enc += String.fromCharCode(o1, o2, o3);
+   } while (i < str.length);
+
+   return decodeUTF8(enc);  // decode UTF-8 byte-array back to Unicode
+}
+
+function encodeUTF8(str) {  // encode multi-byte string into utf-8 multiple single-byte characters 
+  str = str.replace(
+      /[\u0080-\u07ff]/g,  // U+0080 - U+07FF = 2-byte chars
+      function(c) { 
+        var cc = c.charCodeAt(0);
+        return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); }
+    );
+  str = str.replace(
+      /[\u0800-\uffff]/g,  // U+0800 - U+FFFF = 3-byte chars
+      function(c) { 
+        var cc = c.charCodeAt(0); 
+        return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); }
+    );
+  return str;
+}
+
+function decodeUTF8(str) {  // decode utf-8 encoded string back into multi-byte characters
+  str = str.replace(
+      /[\u00c0-\u00df][\u0080-\u00bf]/g,                 // 2-byte chars
+      function(c) { 
+        var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f;
+        return String.fromCharCode(cc); }
+    );
+  str = str.replace(
+      /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,  // 3-byte chars
+      function(c) { 
+        var cc = (c.charCodeAt(0)&0x0f)<<12 | (c.charCodeAt(1)&0x3f<<6) | c.charCodeAt(2)&0x3f; 
+        return String.fromCharCode(cc); }
+    );
+  return str;
+}
+
+
+function byteArrayToHexStr(b) {  // convert byte array to hex string for displaying test vectors
+  var s = '';
+  for (var i=0; i<b.length; i++) s += b[i].toString(16) + ' ';
+  return s;
+}
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
+
+
+var plainText = "ROMEO: But, soft! what light through yonder window breaks?\n\
+It is the east, and Juliet is the sun.\n\
+Arise, fair sun, and kill the envious moon,\n\
+Who is already sick and pale with grief,\n\
+That thou her maid art far more fair than she:\n\
+Be not her maid, since she is envious;\n\
+Her vestal livery is but sick and green\n\
+And none but fools do wear it; cast it off.\n\
+It is my lady, O, it is my love!\n\
+O, that she knew she were!\n\
+She speaks yet she says nothing: what of that?\n\
+Her eye discourses; I will answer it.\n\
+I am too bold, 'tis not to me she speaks:\n\
+Two of the fairest stars in all the heaven,\n\
+Having some business, do entreat her eyes\n\
+To twinkle in their spheres till they return.\n\
+What if her eyes were there, they in her head?\n\
+The brightness of her cheek would shame those stars,\n\
+As daylight doth a lamp; her eyes in heaven\n\
+Would through the airy region stream so bright\n\
+That birds would sing and think it were not night.\n\
+See, how she leans her cheek upon her hand!\n\
+O, that I were a glove upon that hand,\n\
+That I might touch that cheek!\n\
+JULIET: Ay me!\n\
+ROMEO: She speaks:\n\
+O, speak again, bright angel! for thou art\n\
+As glorious to this night, being o'er my head\n\
+As is a winged messenger of heaven\n\
+Unto the white-upturned wondering eyes\n\
+Of mortals that fall back to gaze on him\n\
+When he bestrides the lazy-pacing clouds\n\
+And sails upon the bosom of the air.";
+
+var password = "O Romeo, Romeo! wherefore art thou Romeo?";
+var cipherText, decryptedText;
+
+window.onload = function(){ startTest("sunspider-crypto-aes", '');
+
+test("AES Encrypt", function(){
+	cipherText = AESEncryptCtr(plainText, password, 256);
+});
+
+test("AES Decrypt", function(){
+	decryptedText = AESDecryptCtr(cipherText, password, 256);
+
+	if ( decryptedText !== plainText )
+		throw "Decryption failed.";
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-crypto-md5.html b/tests/sunspider-crypto-md5.html
new file mode 100644
index 0000000..ab1f6bd
--- /dev/null
+++ b/tests/sunspider-crypto-md5.html
@@ -0,0 +1,300 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+/*
+ * Configurable variables. You may need to tweak these to be compatible with
+ * the server-side, but the defaults work in most cases.
+ */
+var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
+var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
+var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */
+
+/*
+ * These are the functions you'll usually want to call
+ * They take string arguments and return either hex or base-64 encoded strings
+ */
+function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
+function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
+function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
+function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
+function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
+function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
+
+/*
+ * Perform a simple self-test to see if the VM is working
+ */
+function md5_vm_test()
+{
+  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
+}
+
+/*
+ * Calculate the MD5 of an array of little-endian words, and a bit length
+ */
+function core_md5(x, len)
+{
+  /* append padding */
+  x[len >> 5] |= 0x80 << ((len) % 32);
+  x[(((len + 64) >>> 9) << 4) + 14] = len;
+
+  var a =  1732584193;
+  var b = -271733879;
+  var c = -1732584194;
+  var d =  271733878;
+
+  for(var i = 0; i < x.length; i += 16)
+  {
+    var olda = a;
+    var oldb = b;
+    var oldc = c;
+    var oldd = d;
+
+    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
+    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
+    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
+    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
+    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
+    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
+    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
+    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
+    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
+    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
+    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
+    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
+    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
+    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
+    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
+    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
+
+    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
+    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
+    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
+    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
+    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
+    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
+    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
+    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
+    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
+    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
+    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
+    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
+    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
+    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
+    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
+    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
+
+    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
+    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
+    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
+    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
+    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
+    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
+    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
+    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
+    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
+    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
+    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
+    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
+    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
+    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
+    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
+    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
+
+    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
+    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
+    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
+    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
+    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
+    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
+    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
+    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
+    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
+    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
+    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
+    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
+    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
+    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
+    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
+    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
+
+    a = safe_add(a, olda);
+    b = safe_add(b, oldb);
+    c = safe_add(c, oldc);
+    d = safe_add(d, oldd);
+  }
+  return Array(a, b, c, d);
+
+}
+
+/*
+ * These functions implement the four basic operations the algorithm uses.
+ */
+function md5_cmn(q, a, b, x, s, t)
+{
+  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
+}
+function md5_ff(a, b, c, d, x, s, t)
+{
+  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+}
+function md5_gg(a, b, c, d, x, s, t)
+{
+  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
+}
+function md5_hh(a, b, c, d, x, s, t)
+{
+  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
+}
+function md5_ii(a, b, c, d, x, s, t)
+{
+  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
+}
+
+/*
+ * Calculate the HMAC-MD5, of a key and some data
+ */
+function core_hmac_md5(key, data)
+{
+  var bkey = str2binl(key);
+  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
+
+  var ipad = Array(16), opad = Array(16);
+  for(var i = 0; i < 16; i++)
+  {
+    ipad[i] = bkey[i] ^ 0x36363636;
+    opad[i] = bkey[i] ^ 0x5C5C5C5C;
+  }
+
+  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
+  return core_md5(opad.concat(hash), 512 + 128);
+}
+
+/*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+function safe_add(x, y)
+{
+  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+  return (msw << 16) | (lsw & 0xFFFF);
+}
+
+/*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+function bit_rol(num, cnt)
+{
+  return (num << cnt) | (num >>> (32 - cnt));
+}
+
+/*
+ * Convert a string to an array of little-endian words
+ * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
+ */
+function str2binl(str)
+{
+  var bin = Array();
+  var mask = (1 << chrsz) - 1;
+  for(var i = 0; i < str.length * chrsz; i += chrsz)
+    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
+  return bin;
+}
+
+/*
+ * Convert an array of little-endian words to a string
+ */
+function binl2str(bin)
+{
+  var str = "";
+  var mask = (1 << chrsz) - 1;
+  for(var i = 0; i < bin.length * 32; i += chrsz)
+    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
+  return str;
+}
+
+/*
+ * Convert an array of little-endian words to a hex string.
+ */
+function binl2hex(binarray)
+{
+  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+  var str = "";
+  for(var i = 0; i < binarray.length * 4; i++)
+  {
+    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
+           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
+  }
+  return str;
+}
+
+/*
+ * Convert an array of little-endian words to a base-64 string
+ */
+function binl2b64(binarray)
+{
+  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  var str = "";
+  for(var i = 0; i < binarray.length * 4; i += 3)
+  {
+    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
+                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
+                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
+    for(var j = 0; j < 4; j++)
+    {
+      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
+      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
+    }
+  }
+  return str;
+}
+
+var plainText = "Rebellious subjects, enemies to peace,\n\
+Profaners of this neighbour-stained steel,--\n\
+Will they not hear? What, ho! you men, you beasts,\n\
+That quench the fire of your pernicious rage\n\
+With purple fountains issuing from your veins,\n\
+On pain of torture, from those bloody hands\n\
+Throw your mistemper'd weapons to the ground,\n\
+And hear the sentence of your moved prince.\n\
+Three civil brawls, bred of an airy word,\n\
+By thee, old Capulet, and Montague,\n\
+Have thrice disturb'd the quiet of our streets,\n\
+And made Verona's ancient citizens\n\
+Cast by their grave beseeming ornaments,\n\
+To wield old partisans, in hands as old,\n\
+Canker'd with peace, to part your canker'd hate:\n\
+If ever you disturb our streets again,\n\
+Your lives shall pay the forfeit of the peace.\n\
+For this time, all the rest depart away:\n\
+You Capulet; shall go along with me:\n\
+And, Montague, come you this afternoon,\n\
+To know our further pleasure in this case,\n\
+To old Free-town, our common judgment-place.\n\
+Once more, on pain of death, all men depart."
+
+for (var i = 0; i <2; i++) {
+    plainText += plainText;
+}
+
+window.onload = function(){ startTest("sunspider-crypto-md5", '');
+
+test("MD5", function(){
+	var md5Output = hex_md5(plainText);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-crypto-sha1.html b/tests/sunspider-crypto-sha1.html
new file mode 100644
index 0000000..3a8b40f
--- /dev/null
+++ b/tests/sunspider-crypto-sha1.html
@@ -0,0 +1,238 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
+ * in FIPS PUB 180-1
+ * Version 2.1a Copyright Paul Johnston 2000 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for details.
+ */
+
+/*
+ * Configurable variables. You may need to tweak these to be compatible with
+ * the server-side, but the defaults work in most cases.
+ */
+var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
+var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
+var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */
+
+/*
+ * These are the functions you'll usually want to call
+ * They take string arguments and return either hex or base-64 encoded strings
+ */
+function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
+function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
+function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
+function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
+function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
+function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}
+
+/*
+ * Perform a simple self-test to see if the VM is working
+ */
+function sha1_vm_test()
+{
+  return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
+}
+
+/*
+ * Calculate the SHA-1 of an array of big-endian words, and a bit length
+ */
+function core_sha1(x, len)
+{
+  /* append padding */
+  x[len >> 5] |= 0x80 << (24 - len % 32);
+  x[((len + 64 >> 9) << 4) + 15] = len;
+
+  var w = Array(80);
+  var a =  1732584193;
+  var b = -271733879;
+  var c = -1732584194;
+  var d =  271733878;
+  var e = -1009589776;
+
+  for(var i = 0; i < x.length; i += 16)
+  {
+    var olda = a;
+    var oldb = b;
+    var oldc = c;
+    var oldd = d;
+    var olde = e;
+
+    for(var j = 0; j < 80; j++)
+    {
+      if(j < 16) w[j] = x[i + j];
+      else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
+      var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
+                       safe_add(safe_add(e, w[j]), sha1_kt(j)));
+      e = d;
+      d = c;
+      c = rol(b, 30);
+      b = a;
+      a = t;
+    }
+
+    a = safe_add(a, olda);
+    b = safe_add(b, oldb);
+    c = safe_add(c, oldc);
+    d = safe_add(d, oldd);
+    e = safe_add(e, olde);
+  }
+  return Array(a, b, c, d, e);
+
+}
+
+/*
+ * Perform the appropriate triplet combination function for the current
+ * iteration
+ */
+function sha1_ft(t, b, c, d)
+{
+  if(t < 20) return (b & c) | ((~b) & d);
+  if(t < 40) return b ^ c ^ d;
+  if(t < 60) return (b & c) | (b & d) | (c & d);
+  return b ^ c ^ d;
+}
+
+/*
+ * Determine the appropriate additive constant for the current iteration
+ */
+function sha1_kt(t)
+{
+  return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
+         (t < 60) ? -1894007588 : -899497514;
+}
+
+/*
+ * Calculate the HMAC-SHA1 of a key and some data
+ */
+function core_hmac_sha1(key, data)
+{
+  var bkey = str2binb(key);
+  if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);
+
+  var ipad = Array(16), opad = Array(16);
+  for(var i = 0; i < 16; i++)
+  {
+    ipad[i] = bkey[i] ^ 0x36363636;
+    opad[i] = bkey[i] ^ 0x5C5C5C5C;
+  }
+
+  var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
+  return core_sha1(opad.concat(hash), 512 + 160);
+}
+
+/*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+function safe_add(x, y)
+{
+  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+  return (msw << 16) | (lsw & 0xFFFF);
+}
+
+/*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+function rol(num, cnt)
+{
+  return (num << cnt) | (num >>> (32 - cnt));
+}
+
+/*
+ * Convert an 8-bit or 16-bit string to an array of big-endian words
+ * In 8-bit function, characters >255 have their hi-byte silently ignored.
+ */
+function str2binb(str)
+{
+  var bin = Array();
+  var mask = (1 << chrsz) - 1;
+  for(var i = 0; i < str.length * chrsz; i += chrsz)
+    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
+  return bin;
+}
+
+/*
+ * Convert an array of big-endian words to a string
+ */
+function binb2str(bin)
+{
+  var str = "";
+  var mask = (1 << chrsz) - 1;
+  for(var i = 0; i < bin.length * 32; i += chrsz)
+    str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);
+  return str;
+}
+
+/*
+ * Convert an array of big-endian words to a hex string.
+ */
+function binb2hex(binarray)
+{
+  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+  var str = "";
+  for(var i = 0; i < binarray.length * 4; i++)
+  {
+    str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
+           hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
+  }
+  return str;
+}
+
+/*
+ * Convert an array of big-endian words to a base-64 string
+ */
+function binb2b64(binarray)
+{
+  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  var str = "";
+  for(var i = 0; i < binarray.length * 4; i += 3)
+  {
+    var triplet = (((binarray[i   >> 2] >> 8 * (3 -  i   %4)) & 0xFF) << 16)
+                | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
+                |  ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
+    for(var j = 0; j < 4; j++)
+    {
+      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
+      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
+    }
+  }
+  return str;
+}
+
+
+var plainText = "Two households, both alike in dignity,\n\
+In fair Verona, where we lay our scene,\n\
+From ancient grudge break to new mutiny,\n\
+Where civil blood makes civil hands unclean.\n\
+From forth the fatal loins of these two foes\n\
+A pair of star-cross'd lovers take their life;\n\
+Whole misadventured piteous overthrows\n\
+Do with their death bury their parents' strife.\n\
+The fearful passage of their death-mark'd love,\n\
+And the continuance of their parents' rage,\n\
+Which, but their children's end, nought could remove,\n\
+Is now the two hours' traffic of our stage;\n\
+The which if you with patient ears attend,\n\
+What here shall miss, our toil shall strive to mend.";
+
+for (var i = 0; i <2; i++) {
+    plainText += plainText;
+}
+
+window.onload = function(){ startTest("sunspider-crypto-sha1", '');
+
+test("SHA1 Hashing", function(){
+	var sha1Output = hex_sha1(plainText);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-date-format-tofte.html b/tests/sunspider-date-format-tofte.html
new file mode 100644
index 0000000..02d720d
--- /dev/null
+++ b/tests/sunspider-date-format-tofte.html
@@ -0,0 +1,312 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+function arrayExists(array, x) {
+    for (var i = 0; i < array.length; i++) {
+        if (array[i] == x) return true;
+    }
+    return false;
+}
+
+Date.prototype.formatDate = function (input,time) {
+    // formatDate :
+    // a PHP date like function, for formatting date strings
+    // See: http://www.php.net/date
+    //
+    // input : format string
+    // time : epoch time (seconds, and optional)
+    //
+    // if time is not passed, formatting is based on 
+    // the current "this" date object's set time.
+    //
+    // supported:
+    // a, A, B, d, D, F, g, G, h, H, i, j, l (lowercase L), L, 
+    // m, M, n, O, r, s, S, t, U, w, W, y, Y, z
+    //
+    // unsupported:
+    // I (capital i), T, Z    
+
+    var switches =    ["a", "A", "B", "d", "D", "F", "g", "G", "h", "H", 
+                       "i", "j", "l", "L", "m", "M", "n", "O", "r", "s", 
+                       "S", "t", "U", "w", "W", "y", "Y", "z"];
+    var daysLong =    ["Sunday", "Monday", "Tuesday", "Wednesday", 
+                       "Thursday", "Friday", "Saturday"];
+    var daysShort =   ["Sun", "Mon", "Tue", "Wed", 
+                       "Thu", "Fri", "Sat"];
+    var monthsShort = ["Jan", "Feb", "Mar", "Apr",
+                       "May", "Jun", "Jul", "Aug", "Sep",
+                       "Oct", "Nov", "Dec"];
+    var monthsLong =  ["January", "February", "March", "April",
+                       "May", "June", "July", "August", "September",
+                       "October", "November", "December"];
+    var daysSuffix = ["st", "nd", "rd", "th", "th", "th", "th", // 1st - 7th
+                      "th", "th", "th", "th", "th", "th", "th", // 8th - 14th
+                      "th", "th", "th", "th", "th", "th", "st", // 15th - 21st
+                      "nd", "rd", "th", "th", "th", "th", "th", // 22nd - 28th
+                      "th", "th", "st"];                        // 29th - 31st
+
+    function a() {
+        // Lowercase Ante meridiem and Post meridiem
+        return self.getHours() > 11? "pm" : "am";
+    }
+    function A() {
+        // Uppercase Ante meridiem and Post meridiem
+        return self.getHours() > 11? "PM" : "AM";
+    }
+
+    function B(){
+        // Swatch internet time. code simply grabbed from ppk,
+        // since I was feeling lazy:
+        // http://www.xs4all.nl/~ppk/js/beat.html
+        var off = (self.getTimezoneOffset() + 60)*60;
+        var theSeconds = (self.getHours() * 3600) + 
+                         (self.getMinutes() * 60) + 
+                          self.getSeconds() + off;
+        var beat = Math.floor(theSeconds/86.4);
+        if (beat > 1000) beat -= 1000;
+        if (beat < 0) beat += 1000;
+        if ((""+beat).length == 1) beat = "00"+beat;
+        if ((""+beat).length == 2) beat = "0"+beat;
+        return beat;
+    }
+    
+    function d() {
+        // Day of the month, 2 digits with leading zeros
+        return new String(self.getDate()).length == 1?
+        "0"+self.getDate() : self.getDate();
+    }
+    function D() {
+        // A textual representation of a day, three letters
+        return daysShort[self.getDay()];
+    }
+    function F() {
+        // A full textual representation of a month
+        return monthsLong[self.getMonth()];
+    }
+    function g() {
+        // 12-hour format of an hour without leading zeros
+        return self.getHours() > 12? self.getHours()-12 : self.getHours();
+    }
+    function G() {
+        // 24-hour format of an hour without leading zeros
+        return self.getHours();
+    }
+    function h() {
+        // 12-hour format of an hour with leading zeros
+        if (self.getHours() > 12) {
+          var s = new String(self.getHours()-12);
+          return s.length == 1?
+          "0"+ (self.getHours()-12) : self.getHours()-12;
+        } else { 
+          var s = new String(self.getHours());
+          return s.length == 1?
+          "0"+self.getHours() : self.getHours();
+        }  
+    }
+    function H() {
+        // 24-hour format of an hour with leading zeros
+        return new String(self.getHours()).length == 1?
+        "0"+self.getHours() : self.getHours();
+    }
+    function i() {
+        // Minutes with leading zeros
+        return new String(self.getMinutes()).length == 1? 
+        "0"+self.getMinutes() : self.getMinutes(); 
+    }
+    function j() {
+        // Day of the month without leading zeros
+        return self.getDate();
+    }    
+    function l() {
+        // A full textual representation of the day of the week
+        return daysLong[self.getDay()];
+    }
+    function L() {
+        // leap year or not. 1 if leap year, 0 if not.
+        // the logic should match iso's 8601 standard.
+        var y_ = Y();
+        if (         
+            (y_ % 4 == 0 && y_ % 100 != 0) ||
+            (y_ % 4 == 0 && y_ % 100 == 0 && y_ % 400 == 0)
+            ) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+    function m() {
+        // Numeric representation of a month, with leading zeros
+        return self.getMonth() < 9?
+        "0"+(self.getMonth()+1) : 
+        self.getMonth()+1;
+    }
+    function M() {
+        // A short textual representation of a month, three letters
+        return monthsShort[self.getMonth()];
+    }
+    function n() {
+        // Numeric representation of a month, without leading zeros
+        return self.getMonth()+1;
+    }
+    function O() {
+        // Difference to Greenwich time (GMT) in hours
+        var os = Math.abs(self.getTimezoneOffset());
+        var h = ""+Math.floor(os/60);
+        var m = ""+(os%60);
+        h.length == 1? h = "0"+h:1;
+        m.length == 1? m = "0"+m:1;
+        return self.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m;
+    }
+    function r() {
+        // RFC 822 formatted date
+        var r; // result
+        //  Thu    ,     21          Dec         2000
+        r = D() + ", " + j() + " " + M() + " " + Y() +
+        //        16     :    01     :    07          +0200
+            " " + H() + ":" + i() + ":" + s() + " " + O();
+        return r;
+    }
+    function S() {
+        // English ordinal suffix for the day of the month, 2 characters
+        return daysSuffix[self.getDate()-1];
+    }
+    function s() {
+        // Seconds, with leading zeros
+        return new String(self.getSeconds()).length == 1?
+        "0"+self.getSeconds() : self.getSeconds();
+    }
+    function t() {
+
+        // thanks to Matt Bannon for some much needed code-fixes here!
+        var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31];
+        if (L()==1 && n()==2) return 29; // leap day
+        return daysinmonths[n()];
+    }
+    function U() {
+        // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
+        return Math.round(self.getTime()/1000);
+    }
+    function W() {
+        // Weeknumber, as per ISO specification:
+        // http://www.cl.cam.ac.uk/~mgk25/iso-time.html
+        
+        // if the day is three days before newyears eve,
+        // there's a chance it's "week 1" of next year.
+        // here we check for that.
+        var beforeNY = 364+L() - z();
+        var afterNY  = z();
+        var weekday = w()!=0?w()-1:6; // makes sunday (0), into 6.
+        if (beforeNY <= 2 && weekday <= 2-beforeNY) {
+            return 1;
+        }
+        // similarly, if the day is within threedays of newyears
+        // there's a chance it belongs in the old year.
+        var ny = new Date("January 1 " + Y() + " 00:00:00");
+        var nyDay = ny.getDay()!=0?ny.getDay()-1:6;
+        if (
+            (afterNY <= 2) && 
+            (nyDay >=4)  && 
+            (afterNY >= (6-nyDay))
+            ) {
+            // Since I'm not sure we can just always return 53,
+            // i call the function here again, using the last day
+            // of the previous year, as the date, and then just
+            // return that week.
+            var prevNY = new Date("December 31 " + (Y()-1) + " 00:00:00");
+            return prevNY.formatDate("W");
+        }
+        
+        // week 1, is the week that has the first thursday in it.
+        // note that this value is not zero index.
+        if (nyDay <= 3) {
+            // first day of the year fell on a thursday, or earlier.
+            return 1 + Math.floor( ( z() + nyDay ) / 7 );
+        } else {
+            // first day of the year fell on a friday, or later.
+            return 1 + Math.floor( ( z() - ( 7 - nyDay ) ) / 7 );
+        }
+    }
+    function w() {
+        // Numeric representation of the day of the week
+        return self.getDay();
+    }
+    
+    function Y() {
+        // A full numeric representation of a year, 4 digits
+
+        // we first check, if getFullYear is supported. if it
+        // is, we just use that. ppks code is nice, but wont
+        // work with dates outside 1900-2038, or something like that
+        if (self.getFullYear) {
+            var newDate = new Date("January 1 2001 00:00:00 +0000");
+            var x = newDate .getFullYear();
+            if (x == 2001) {              
+                // i trust the method now
+                return self.getFullYear();
+            }
+        }
+        // else, do this:
+        // codes thanks to ppk:
+        // http://www.xs4all.nl/~ppk/js/introdate.html
+        var x = self.getYear();
+        var y = x % 100;
+        y += (y < 38) ? 2000 : 1900;
+        return y;
+    }
+    function y() {
+        // A two-digit representation of a year
+        var y = Y()+"";
+        return y.substring(y.length-2,y.length);
+    }
+    function z() {
+        // The day of the year, zero indexed! 0 through 366
+        var t = new Date("January 1 " + Y() + " 00:00:00");
+        var diff = self.getTime() - t.getTime();
+        return Math.floor(diff/1000/60/60/24);
+    }
+        
+    var self = this;
+    if (time) {
+        // save time
+        var prevTime = self.getTime();
+        self.setTime(time);
+    }
+    
+    var ia = input.split("");
+    var ij = 0;
+    while (ia[ij]) {
+        if (ia[ij] == "\\") {
+            // this is our way of allowing users to escape stuff
+            ia.splice(ij,1);
+        } else {
+            if (arrayExists(switches,ia[ij])) {
+                ia[ij] = eval(ia[ij] + "()");
+            }
+        }
+        ij++;
+    }
+    // reset time, back to what it was
+    if (prevTime) {
+        self.setTime(prevTime);
+    }
+    return ia.join("");
+}
+
+var date = new Date("1/1/2007 1:11:11");
+
+window.onload = function(){ startTest("sunspider-date-format-tofte", '');
+
+test("Format Date", function(){
+	for (var i = 0; i < 50; ++i) {
+    		var shortFormat = date.formatDate("Y-m-d");
+    		var longFormat = date.formatDate("l, F d, Y g:i:s A");
+    		date.setTime(date.getTime() + 84266956);
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-date-format-xparb.html b/tests/sunspider-date-format-xparb.html
new file mode 100644
index 0000000..71f2096
--- /dev/null
+++ b/tests/sunspider-date-format-xparb.html
@@ -0,0 +1,431 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, version 2.1.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+ * details.
+ */
+
+Date.parseFunctions = {count:0};
+Date.parseRegexes = [];
+Date.formatFunctions = {count:0};
+
+Date.prototype.dateFormat = function(format) {
+    if (Date.formatFunctions[format] == null) {
+        Date.createNewFormat(format);
+    }
+    var func = Date.formatFunctions[format];
+    return this[func]();
+}
+
+Date.createNewFormat = function(format) {
+    var funcName = "format" + Date.formatFunctions.count++;
+    Date.formatFunctions[format] = funcName;
+    var code = "Date.prototype." + funcName + " = function(){return ";
+    var special = false;
+    var ch = '';
+    for (var i = 0; i < format.length; ++i) {
+        ch = format.charAt(i);
+        if (!special && ch == "\\") {
+            special = true;
+        }
+        else if (special) {
+            special = false;
+            code += "'" + String.escape(ch) + "' + ";
+        }
+        else {
+            code += Date.getFormatCode(ch);
+        }
+    }
+    eval(code.substring(0, code.length - 3) + ";}");
+}
+
+Date.getFormatCode = function(character) {
+    switch (character) {
+    case "d":
+        return "String.leftPad(this.getDate(), 2, '0') + ";
+    case "D":
+        return "Date.dayNames[this.getDay()].substring(0, 3) + ";
+    case "j":
+        return "this.getDate() + ";
+    case "l":
+        return "Date.dayNames[this.getDay()] + ";
+    case "S":
+        return "this.getSuffix() + ";
+    case "w":
+        return "this.getDay() + ";
+    case "z":
+        return "this.getDayOfYear() + ";
+    case "W":
+        return "this.getWeekOfYear() + ";
+    case "F":
+        return "Date.monthNames[this.getMonth()] + ";
+    case "m":
+        return "String.leftPad(this.getMonth() + 1, 2, '0') + ";
+    case "M":
+        return "Date.monthNames[this.getMonth()].substring(0, 3) + ";
+    case "n":
+        return "(this.getMonth() + 1) + ";
+    case "t":
+        return "this.getDaysInMonth() + ";
+    case "L":
+        return "(this.isLeapYear() ? 1 : 0) + ";
+    case "Y":
+        return "this.getFullYear() + ";
+    case "y":
+        return "('' + this.getFullYear()).substring(2, 4) + ";
+    case "a":
+        return "(this.getHours() < 12 ? 'am' : 'pm') + ";
+    case "A":
+        return "(this.getHours() < 12 ? 'AM' : 'PM') + ";
+    case "g":
+        return "((this.getHours() %12) ? this.getHours() % 12 : 12) + ";
+    case "G":
+        return "this.getHours() + ";
+    case "h":
+        return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";
+    case "H":
+        return "String.leftPad(this.getHours(), 2, '0') + ";
+    case "i":
+        return "String.leftPad(this.getMinutes(), 2, '0') + ";
+    case "s":
+        return "String.leftPad(this.getSeconds(), 2, '0') + ";
+    case "O":
+        return "this.getGMTOffset() + ";
+    case "T":
+        return "this.getTimezone() + ";
+    case "Z":
+        return "(this.getTimezoneOffset() * -60) + ";
+    default:
+        return "'" + String.escape(character) + "' + ";
+    }
+}
+
+Date.parseDate = function(input, format) {
+    if (Date.parseFunctions[format] == null) {
+        Date.createParser(format);
+    }
+    var func = Date.parseFunctions[format];
+    return Date[func](input);
+}
+
+Date.createParser = function(format) {
+    var funcName = "parse" + Date.parseFunctions.count++;
+    var regexNum = Date.parseRegexes.length;
+    var currentGroup = 1;
+    Date.parseFunctions[format] = funcName;
+
+    var code = "Date." + funcName + " = function(input){\n"
+        + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"
+        + "var d = new Date();\n"
+        + "y = d.getFullYear();\n"
+        + "m = d.getMonth();\n"
+        + "d = d.getDate();\n"
+        + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n"
+        + "if (results && results.length > 0) {"
+    var regex = "";
+
+    var special = false;
+    var ch = '';
+    for (var i = 0; i < format.length; ++i) {
+        ch = format.charAt(i);
+        if (!special && ch == "\\") {
+            special = true;
+        }
+        else if (special) {
+            special = false;
+            regex += String.escape(ch);
+        }
+        else {
+            obj = Date.formatCodeToRegex(ch, currentGroup);
+            currentGroup += obj.g;
+            regex += obj.s;
+            if (obj.g && obj.c) {
+                code += obj.c;
+            }
+        }
+    }
+
+    code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"
+        + "{return new Date(y, m, d, h, i, s);}\n"
+        + "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"
+        + "{return new Date(y, m, d, h, i);}\n"
+        + "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"
+        + "{return new Date(y, m, d, h);}\n"
+        + "else if (y > 0 && m >= 0 && d > 0)\n"
+        + "{return new Date(y, m, d);}\n"
+        + "else if (y > 0 && m >= 0)\n"
+        + "{return new Date(y, m);}\n"
+        + "else if (y > 0)\n"
+        + "{return new Date(y);}\n"
+        + "}return null;}";
+
+    Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$");
+    eval(code);
+}
+
+Date.formatCodeToRegex = function(character, currentGroup) {
+    switch (character) {
+    case "D":
+        return {g:0,
+        c:null,
+        s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};
+    case "j":
+    case "d":
+        return {g:1,
+            c:"d = parseInt(results[" + currentGroup + "], 10);\n",
+            s:"(\\d{1,2})"};
+    case "l":
+        return {g:0,
+            c:null,
+            s:"(?:" + Date.dayNames.join("|") + ")"};
+    case "S":
+        return {g:0,
+            c:null,
+            s:"(?:st|nd|rd|th)"};
+    case "w":
+        return {g:0,
+            c:null,
+            s:"\\d"};
+    case "z":
+        return {g:0,
+            c:null,
+            s:"(?:\\d{1,3})"};
+    case "W":
+        return {g:0,
+            c:null,
+            s:"(?:\\d{2})"};
+    case "F":
+        return {g:1,
+            c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n",
+            s:"(" + Date.monthNames.join("|") + ")"};
+    case "M":
+        return {g:1,
+            c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n",
+            s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};
+    case "n":
+    case "m":
+        return {g:1,
+            c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
+            s:"(\\d{1,2})"};
+    case "t":
+        return {g:0,
+            c:null,
+            s:"\\d{1,2}"};
+    case "L":
+        return {g:0,
+            c:null,
+            s:"(?:1|0)"};
+    case "Y":
+        return {g:1,
+            c:"y = parseInt(results[" + currentGroup + "], 10);\n",
+            s:"(\\d{4})"};
+    case "y":
+        return {g:1,
+            c:"var ty = parseInt(results[" + currentGroup + "], 10);\n"
+                + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
+            s:"(\\d{1,2})"};
+    case "a":
+        return {g:1,
+            c:"if (results[" + currentGroup + "] == 'am') {\n"
+                + "if (h == 12) { h = 0; }\n"
+                + "} else { if (h < 12) { h += 12; }}",
+            s:"(am|pm)"};
+    case "A":
+        return {g:1,
+            c:"if (results[" + currentGroup + "] == 'AM') {\n"
+                + "if (h == 12) { h = 0; }\n"
+                + "} else { if (h < 12) { h += 12; }}",
+            s:"(AM|PM)"};
+    case "g":
+    case "G":
+    case "h":
+    case "H":
+        return {g:1,
+            c:"h = parseInt(results[" + currentGroup + "], 10);\n",
+            s:"(\\d{1,2})"};
+    case "i":
+        return {g:1,
+            c:"i = parseInt(results[" + currentGroup + "], 10);\n",
+            s:"(\\d{2})"};
+    case "s":
+        return {g:1,
+            c:"s = parseInt(results[" + currentGroup + "], 10);\n",
+            s:"(\\d{2})"};
+    case "O":
+        return {g:0,
+            c:null,
+            s:"[+-]\\d{4}"};
+    case "T":
+        return {g:0,
+            c:null,
+            s:"[A-Z]{3}"};
+    case "Z":
+        return {g:0,
+            c:null,
+            s:"[+-]\\d{1,5}"};
+    default:
+        return {g:0,
+            c:null,
+            s:String.escape(character)};
+    }
+}
+
+Date.prototype.getTimezone = function() {
+    return this.toString().replace(
+        /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace(
+        /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3");
+}
+
+Date.prototype.getGMTOffset = function() {
+    return (this.getTimezoneOffset() > 0 ? "-" : "+")
+        + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0")
+        + String.leftPad(this.getTimezoneOffset() % 60, 2, "0");
+}
+
+Date.prototype.getDayOfYear = function() {
+    var num = 0;
+    Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
+    for (var i = 0; i < this.getMonth(); ++i) {
+        num += Date.daysInMonth[i];
+    }
+    return num + this.getDate() - 1;
+}
+
+Date.prototype.getWeekOfYear = function() {
+    // Skip to Thursday of this week
+    var now = this.getDayOfYear() + (4 - this.getDay());
+    // Find the first Thursday of the year
+    var jan1 = new Date(this.getFullYear(), 0, 1);
+    var then = (7 - jan1.getDay() + 4);
+    document.write(then);
+    return String.leftPad(((now - then) / 7) + 1, 2, "0");
+}
+
+Date.prototype.isLeapYear = function() {
+    var year = this.getFullYear();
+    return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
+}
+
+Date.prototype.getFirstDayOfMonth = function() {
+    var day = (this.getDay() - (this.getDate() - 1)) % 7;
+    return (day < 0) ? (day + 7) : day;
+}
+
+Date.prototype.getLastDayOfMonth = function() {
+    var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;
+    return (day < 0) ? (day + 7) : day;
+}
+
+Date.prototype.getDaysInMonth = function() {
+    Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
+    return Date.daysInMonth[this.getMonth()];
+}
+
+Date.prototype.getSuffix = function() {
+    switch (this.getDate()) {
+        case 1:
+        case 21:
+        case 31:
+            return "st";
+        case 2:
+        case 22:
+            return "nd";
+        case 3:
+        case 23:
+            return "rd";
+        default:
+            return "th";
+    }
+}
+
+String.escape = function(string) {
+    return string.replace(/('|\\)/g, "\\$1");
+}
+
+String.leftPad = function (val, size, ch) {
+    var result = new String(val);
+    if (ch == null) {
+        ch = " ";
+    }
+    while (result.length < size) {
+        result = ch + result;
+    }
+    return result;
+}
+
+Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
+Date.monthNames =
+   ["January",
+    "February",
+    "March",
+    "April",
+    "May",
+    "June",
+    "July",
+    "August",
+    "September",
+    "October",
+    "November",
+    "December"];
+Date.dayNames =
+   ["Sunday",
+    "Monday",
+    "Tuesday",
+    "Wednesday",
+    "Thursday",
+    "Friday",
+    "Saturday"];
+Date.y2kYear = 50;
+Date.monthNumbers = {
+    Jan:0,
+    Feb:1,
+    Mar:2,
+    Apr:3,
+    May:4,
+    Jun:5,
+    Jul:6,
+    Aug:7,
+    Sep:8,
+    Oct:9,
+    Nov:10,
+    Dec:11};
+Date.patterns = {
+    ISO8601LongPattern:"Y-m-d H:i:s",
+    ISO8601ShortPattern:"Y-m-d",
+    ShortDatePattern: "n/j/Y",
+    LongDatePattern: "l, F d, Y",
+    FullDateTimePattern: "l, F d, Y g:i:s A",
+    MonthDayPattern: "F d",
+    ShortTimePattern: "g:i A",
+    LongTimePattern: "g:i:s A",
+    SortableDateTimePattern: "Y-m-d\\TH:i:s",
+    UniversalSortableDateTimePattern: "Y-m-d H:i:sO",
+    YearMonthPattern: "F, Y"};
+
+var date = new Date("1/1/2007 1:11:11");
+
+window.onload = function(){ startTest("sunspider-date-format-xparb", '');
+
+test("Date Format (2)", function(){
+	for (i = 0; i < 400; ++i) {
+    		var shortFormat = date.dateFormat("Y-m-d");
+    		var longFormat = date.dateFormat("l, F d, Y g:i:s A");
+    		date.setTime(date.getTime() + 84266956);
+	}
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-math-cordic.html b/tests/sunspider-math-cordic.html
new file mode 100644
index 0000000..759c699
--- /dev/null
+++ b/tests/sunspider-math-cordic.html
@@ -0,0 +1,103 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * Copyright (C) Rich Moore.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+/////. Start CORDIC
+
+var AG_CONST = 0.6072529350;
+
+function FIXED(X)
+{
+  return X * 65536.0;
+}
+
+function FLOAT(X)
+{
+  return X / 65536.0;
+}
+
+function DEG2RAD(X)
+{
+  return 0.017453 * (X);
+}
+
+var Angles = [
+  FIXED(45.0), FIXED(26.565), FIXED(14.0362), FIXED(7.12502),
+  FIXED(3.57633), FIXED(1.78991), FIXED(0.895174), FIXED(0.447614),
+  FIXED(0.223811), FIXED(0.111906), FIXED(0.055953),
+  FIXED(0.027977) 
+              ];
+
+
+function cordicsincos() {
+    var X;
+    var Y;
+    var TargetAngle;
+    var CurrAngle;
+    var Step;
+ 
+    X = FIXED(AG_CONST);         /* AG_CONST * cos(0) */
+    Y = 0;                       /* AG_CONST * sin(0) */
+
+    TargetAngle = FIXED(28.027);
+    CurrAngle = 0;
+    for (Step = 0; Step < 12; Step++) {
+        var NewX;
+        if (TargetAngle > CurrAngle) {
+            NewX = X - (Y >> Step);
+            Y = (X >> Step) + Y;
+            X = NewX;
+            CurrAngle += Angles[Step];
+        } else {
+            NewX = X + (Y >> Step);
+            Y = -(X >> Step) + Y;
+            X = NewX;
+            CurrAngle -= Angles[Step];
+        }
+    }
+}
+
+///// End CORDIC
+
+function cordic( runs ) {
+  for ( var i = 0 ; i < runs ; i++ ) {
+      cordicsincos();
+  }
+}
+
+window.onload = function(){ startTest("sunspider-math-cordic", '');
+
+test("Cordic", function(){
+	cordic(2500);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-math-partial-sums.html b/tests/sunspider-math-partial-sums.html
new file mode 100644
index 0000000..2677cca
--- /dev/null
+++ b/tests/sunspider-math-partial-sums.html
@@ -0,0 +1,44 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Computer Language Shootout
+// http://shootout.alioth.debian.org/
+// contributed by Isaac Gouy
+
+function partial(n){
+	var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0;
+	var twothirds = 2.0/3.0;
+	var alt = -1.0;
+	var k2 = k3 = sk = ck = 0.0;
+	
+	for (var k = 1; k <= n; k++){
+		k2 = k*k;
+		k3 = k2*k;
+		sk = Math.sin(k);
+		ck = Math.cos(k);
+		alt = -alt;
+		
+		a1 += Math.pow(twothirds,k-1);
+		a2 += Math.pow(k,-0.5);
+		a3 += 1.0/(k*(k+1.0));
+		a4 += 1.0/(k3 * sk*sk);
+		a5 += 1.0/(k3 * ck*ck);
+		a6 += 1.0/k;
+		a7 += 1.0/k2;
+		a8 += alt/k;
+		a9 += alt/(2*k -1);
+	}
+}
+
+window.onload = function(){ startTest("sunspider-math-partial-sums", '');
+
+test( "Partial Sums", function(){
+	partial(2048);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-math-spectral-norm.html b/tests/sunspider-math-spectral-norm.html
new file mode 100644
index 0000000..c00bbac
--- /dev/null
+++ b/tests/sunspider-math-spectral-norm.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Great Computer Language Shootout
+// http://shootout.alioth.debian.org/
+//
+// contributed by Ian Osgood
+
+function A(i,j) {
+  return 1/((i+j)*(i+j+1)/2+i+1);
+}
+
+function Au(u,v) {
+  for (var i=0; i<u.length; ++i) {
+    var t = 0;
+    for (var j=0; j<u.length; ++j)
+      t += A(i,j) * u[j];
+    v[i] = t;
+  }
+}
+
+function Atu(u,v) {
+  for (var i=0; i<u.length; ++i) {
+    var t = 0;
+    for (var j=0; j<u.length; ++j)
+      t += A(j,i) * u[j];
+    v[i] = t;
+  }
+}
+
+function AtAu(u,v,w) {
+  Au(u,w);
+  Atu(w,v);
+}
+
+function spectralnorm(n) {
+  var i, u=[], v=[], w=[], vv=0, vBv=0;
+  for (i=0; i<n; ++i) {
+    u[i] = 1; v[i] = w[i] = 0;
+  }
+  for (i=0; i<10; ++i) {
+    AtAu(u,v,w);
+    AtAu(v,u,w);
+  }
+  for (i=0; i<n; ++i) {
+    vBv += u[i]*v[i];
+    vv  += v[i]*v[i];
+  }
+  return Math.sqrt(vBv/vv);
+}
+
+window.onload = function(){ startTest("sunspider-math-spectral-norm", '');
+
+test( "Spectral Norm", function(){
+	for (var i = 12; i <= 24; i *= 2)
+		spectralnorm(i);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-regexp-dna.html b/tests/sunspider-regexp-dna.html
new file mode 100644
index 0000000..c3f0e32
--- /dev/null
+++ b/tests/sunspider-regexp-dna.html
@@ -0,0 +1,1740 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Computer Language Shootout
+// http://shootout.alioth.debian.org/
+//
+// contributed by Jesse Millikan
+// Base on the Ruby version by jose fco. gonzalez
+
+var l;
+var dnaInput = ">ONE Homo sapiens alu\n\
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\n\
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\n\
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\n\
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\n\
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\n\
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA\n\
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA\n\
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG\n\
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA\n\
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT\n\
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC\n\
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG\n\
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC\n\
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG\n\
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\n\
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA\n\
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT\n\
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG\n\
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT\n\
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG\n\
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG\n\
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA\n\
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG\n\
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG\n\
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC\n\
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\n\
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA\n\
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT\n\
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC\n\
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT\n\
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC\n\
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG\n\
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG\n\
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC\n\
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT\n\
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC\n\
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA\n\
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA\n\
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA\n\
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG\n\
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT\n\
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA\n\
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA\n\
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC\n\
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT\n\
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG\n\
+GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC\n\
+GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC\n\
+GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG\n\
+TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA\n\
+AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG\n\
+GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT\n\
+CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC\n\
+TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG\n\
+ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC\n\
+GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA\n\
+ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA\n\
+CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA\n\
+CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA\n\
+ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG\n\
+CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG\n\
+AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC\n\
+CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG\n\
+AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC\n\
+CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG\n\
+CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG\n\
+CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG\n\
+CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC\n\
+ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA\n\
+AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC\n\
+TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC\n\
+ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG\n\
+CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG\n\
+AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT\n\
+AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA\n\
+TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC\n\
+CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA\n\
+TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG\n\
+CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT\n\
+GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG\n\
+GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG\n\
+CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG\n\
+GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG\n\
+GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT\n\
+AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT\n\
+GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT\n\
+CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG\n\
+GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC\n\
+TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT\n\
+CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG\n\
+ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG\n\
+CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG\n\
+AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA\n\
+CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG\n\
+CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC\n\
+ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC\n\
+GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC\n\
+GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG\n\
+GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT\n\
+TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG\n\
+CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA\n\
+GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG\n\
+CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC\n\
+GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG\n\
+CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA\n\
+CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG\n\
+CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA\n\
+ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC\n\
+CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT\n\
+GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA\n\
+AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG\n\
+ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC\n\
+TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA\n\
+GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC\n\
+GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG\n\
+TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC\n\
+AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA\n\
+ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA\n\
+GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\n\
+AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG\n\
+TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC\n\
+CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT\n\
+GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC\n\
+CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA\n\
+GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT\n\
+TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC\n\
+ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC\n\
+TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG\n\
+GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG\n\
+TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG\n\
+GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC\n\
+GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT\n\
+ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC\n\
+GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC\n\
+GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC\n\
+CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA\n\
+ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG\n\
+AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC\n\
+TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT\n\
+CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG\n\
+TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG\n\
+CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC\n\
+GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT\n\
+GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC\n\
+CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC\n\
+TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG\n\
+CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\n\
+AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG\n\
+AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG\n\
+AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT\n\
+GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA\n\
+TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC\n\
+AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA\n\
+AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG\n\
+CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC\n\
+TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG\n\
+GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT\n\
+CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG\n\
+CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG\n\
+GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA\n\
+AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA\n\
+GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC\n\
+TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC\n\
+CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA\n\
+GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG\n\
+CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG\n\
+AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG\n\
+ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC\n\
+ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC\n\
+AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC\n\
+GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG\n\
+GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT\n\
+CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC\n\
+GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC\n\
+CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\n\
+GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA\n\
+GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG\n\
+GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT\n\
+CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA\n\
+AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG\n\
+CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC\n\
+CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG\n\
+GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG\n\
+GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT\n\
+TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA\n\
+ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG\n\
+CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA\n\
+ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA\n\
+GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG\n\
+TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC\n\
+GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA\n\
+GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT\n\
+GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT\n\
+GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG\n\
+TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT\n\
+TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC\n\
+TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC\n\
+GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT\n\
+CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC\n\
+TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA\n\
+GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG\n\
+GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT\n\
+GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\n\
+ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG\n\
+GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG\n\
+CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA\n\
+CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT\n\
+CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC\n\
+GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC\n\
+TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG\n\
+GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC\n\
+AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG\n\
+GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG\n\
+CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG\n\
+GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG\n\
+ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG\n\
+GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA\n\
+AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC\n\
+CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG\n\
+TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA\n\
+AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG\n\
+GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA\n\
+CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG\n\
+AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG\n\
+CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG\n\
+GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT\n\
+CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA\n\
+AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG\n\
+AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC\n\
+CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT\n\
+GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\n\
+CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG\n\
+TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA\n\
+CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC\n\
+AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC\n\
+TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA\n\
+CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC\n\
+CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA\n\
+GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC\n\
+GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA\n\
+GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC\n\
+CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC\n\
+TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC\n\
+CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC\n\
+CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA\n\
+CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA\n\
+AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT\n\
+GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA\n\
+CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC\n\
+TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA\n\
+GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA\n\
+GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT\n\
+CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC\n\
+TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT\n\
+CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC\n\
+CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG\n\
+GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG\n\
+GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC\n\
+GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\n\
+GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG\n\
+TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA\n\
+ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG\n\
+CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC\n\
+AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG\n\
+GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT\n\
+CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC\n\
+GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA\n\
+TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC\n\
+GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA\n\
+GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC\n\
+AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC\n\
+AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA\n\
+CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG\n\
+CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG\n\
+AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG\n\
+GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT\n\
+GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC\n\
+GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG\n\
+CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC\n\
+CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG\n\
+CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC\n\
+GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC\n\
+TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC\n\
+CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA\n\
+CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC\n\
+AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG\n\
+AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA\n\
+GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\n\
+TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\n\
+AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\n\
+GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\n\
+CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\n\
+GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA\n\
+GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA\n\
+TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG\n\
+AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA\n\
+GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT\n\
+AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC\n\
+AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG\n\
+GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC\n\
+CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG\n\
+AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\n\
+TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA\n\
+TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT\n\
+GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG\n\
+TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT\n\
+CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG\n\
+CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG\n\
+TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA\n\
+CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG\n\
+AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG\n\
+GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC\n\
+TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\n\
+TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA\n\
+GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT\n\
+GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC\n\
+ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT\n\
+TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC\n\
+CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG\n\
+CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG\n\
+GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC\n\
+CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT\n\
+GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC\n\
+GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA\n\
+GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA\n\
+GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA\n\
+GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG\n\
+AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT\n\
+CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA\n\
+GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA\n\
+AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC\n\
+GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT\n\
+ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG\n\
+GAGGCTGAGGCAGGAGAATC\n\
+>TWO IUB ambiguity codes\n\
+cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg\n\
+tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa\n\
+NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt\n\
+cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga\n\
+gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa\n\
+HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca\n\
+tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt\n\
+tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt\n\
+acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct\n\
+tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt\n\
+gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa\n\
+accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt\n\
+RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt\n\
+tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag\n\
+cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg\n\
+ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat\n\
+actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg\n\
+YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa\n\
+KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata\n\
+aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa\n\
+aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg\n\
+gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc\n\
+tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK\n\
+tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt\n\
+ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg\n\
+ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa\n\
+BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt\n\
+aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc\n\
+tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc\n\
+cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac\n\
+aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga\n\
+tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga\n\
+aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD\n\
+gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg\n\
+ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV\n\
+taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa\n\
+ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat\n\
+gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg\n\
+gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa\n\
+tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt\n\
+tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt\n\
+taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca\n\
+cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag\n\
+aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt\n\
+cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt\n\
+ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW\n\
+attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag\n\
+ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa\n\
+attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc\n\
+tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta\n\
+aagacYRcaggattHaYgtKtaatgcVcaataMYacccatatcacgWDBtgaatcBaata\n\
+cKcttRaRtgatgaBDacggtaattaaYtataStgVHDtDctgactcaaatKtacaatgc\n\
+gYatBtRaDatHaactgtttatatDttttaaaKVccYcaaccNcBcgHaaVcattHctcg\n\
+attaaatBtatgcaaaaatYMctSactHatacgaWacattacMBgHttcgaatVaaaaca\n\
+BatatVtctgaaaaWtctRacgBMaatSgRgtgtcgactatcRtattaScctaStagKga\n\
+DcWgtYtDDWKRgRtHatRtggtcgaHgggcgtattaMgtcagccaBggWVcWctVaaat\n\
+tcgNaatcKWagcNaHtgaaaSaaagctcYctttRVtaaaatNtataaccKtaRgtttaM\n\
+tgtKaBtRtNaggaSattHatatWactcagtgtactaKctatttgRYYatKatgtccgtR\n\
+tttttatttaatatVgKtttgtatgtNtataRatWYNgtRtHggtaaKaYtKSDcatcKg\n\
+taaYatcSRctaVtSMWtVtRWHatttagataDtVggacagVcgKWagBgatBtaaagNc\n\
+aRtagcataBggactaacacRctKgttaatcctHgDgttKHHagttgttaatgHBtatHc\n\
+DaagtVaBaRccctVgtgDtacRHSctaagagcggWYaBtSaKtHBtaaactYacgNKBa\n\
+VYgtaacttagtVttcttaatgtBtatMtMtttaattaatBWccatRtttcatagVgMMt\n\
+agctStKctaMactacDNYgKYHgaWcgaHgagattacVgtttgtRaSttaWaVgataat\n\
+gtgtYtaStattattMtNgWtgttKaccaatagNYttattcgtatHcWtctaaaNVYKKt\n\
+tWtggcDtcgaagtNcagatacgcattaagaccWctgcagcttggNSgaNcHggatgtVt\n\
+catNtRaaBNcHVagagaaBtaaSggDaatWaatRccaVgggStctDaacataKttKatt\n\
+tggacYtattcSatcttagcaatgaVBMcttDattctYaaRgatgcattttNgVHtKcYR\n\
+aatRKctgtaaacRatVSagctgtWacBtKVatctgttttKcgtctaaDcaagtatcSat\n\
+aWVgcKKataWaYttcccSaatgaaaacccWgcRctWatNcWtBRttYaattataaNgac\n\
+acaatagtttVNtataNaYtaatRaVWKtBatKagtaatataDaNaaaaataMtaagaaS\n\
+tccBcaatNgaataWtHaNactgtcDtRcYaaVaaaaaDgtttRatctatgHtgttKtga\n\
+aNSgatactttcgagWaaatctKaaDaRttgtggKKagcDgataaattgSaacWaVtaNM\n\
+acKtcaDaaatttctRaaVcagNacaScRBatatctRatcctaNatWgRtcDcSaWSgtt\n\
+RtKaRtMtKaatgttBHcYaaBtgatSgaSWaScMgatNtctcctatttctYtatMatMt\n\
+RRtSaattaMtagaaaaStcgVgRttSVaScagtgDtttatcatcatacRcatatDctta\n\
+tcatVRtttataaHtattcYtcaaaatactttgVctagtaaYttagatagtSYacKaaac\n\
+gaaKtaaatagataatSatatgaaatSgKtaatVtttatcctgKHaatHattagaaccgt\n\
+YaaHactRcggSBNgtgctaaBagBttgtRttaaattYtVRaaaattgtaatVatttctc\n\
+ttcatgBcVgtgKgaHaaatattYatagWacNctgaaMcgaattStagWaSgtaaKagtt\n\
+ttaagaDgatKcctgtaHtcatggKttVDatcaaggtYcgccagNgtgcVttttagagat\n\
+gctaccacggggtNttttaSHaNtatNcctcatSaaVgtactgBHtagcaYggYVKNgta\n\
+KBcRttgaWatgaatVtagtcgattYgatgtaatttacDacSctgctaaaStttaWMagD\n\
+aaatcaVYctccgggcgaVtaaWtStaKMgDtttcaaMtVgBaatccagNaaatcYRMBg\n\
+gttWtaaScKttMWtYataRaDBMaDataatHBcacDaaKDactaMgagttDattaHatH\n\
+taYatDtattDcRNStgaatattSDttggtattaaNSYacttcDMgYgBatWtaMagact\n\
+VWttctttgYMaYaacRgHWaattgRtaagcattctMKVStatactacHVtatgatcBtV\n\
+NataaBttYtSttacKgggWgYDtgaVtYgatDaacattYgatggtRDaVDttNactaSa\n\
+MtgNttaacaaSaBStcDctaccacagacgcaHatMataWKYtaYattMcaMtgSttDag\n\
+cHacgatcaHttYaKHggagttccgatYcaatgatRaVRcaagatcagtatggScctata\n\
+ttaNtagcgacgtgKaaWaactSgagtMYtcttccaKtStaacggMtaagNttattatcg\n\
+tctaRcactctctDtaacWYtgaYaSaagaWtNtatttRacatgNaatgttattgWDDcN\n\
+aHcctgaaHacSgaataaRaataMHttatMtgaSDSKatatHHaNtacagtccaYatWtc\n\
+actaactatKDacSaStcggataHgYatagKtaatKagStaNgtatactatggRHacttg\n\
+tattatgtDVagDVaRctacMYattDgtttYgtctatggtKaRSttRccRtaaccttaga\n\
+gRatagSaaMaacgcaNtatgaaatcaRaagataatagatactcHaaYKBctccaagaRa\n\
+BaStNagataggcgaatgaMtagaatgtcaKttaaatgtaWcaBttaatRcggtgNcaca\n\
+aKtttScRtWtgcatagtttWYaagBttDKgcctttatMggNttattBtctagVtacata\n\
+aaYttacacaaRttcYtWttgHcaYYtaMgBaBatctNgcDtNttacgacDcgataaSat\n\
+YaSttWtcctatKaatgcagHaVaacgctgcatDtgttaSataaaaYSNttatagtaNYt\n\
+aDaaaNtggggacttaBggcHgcgtNtaaMcctggtVtaKcgNacNtatVaSWctWtgaW\n\
+cggNaBagctctgaYataMgaagatBSttctatacttgtgtKtaattttRagtDtacata\n\
+tatatgatNHVgBMtKtaKaNttDHaagatactHaccHtcatttaaagttVaMcNgHata\n\
+tKtaNtgYMccttatcaaNagctggacStttcNtggcaVtattactHaSttatgNMVatt\n\
+MMDtMactattattgWMSgtHBttStStgatatRaDaagattttctatMtaaaaaggtac\n\
+taaVttaSacNaatactgMttgacHaHRttgMacaaaatagttaatatWKRgacDgaRta\n\
+tatttattatcYttaWtgtBRtWatgHaaattHataagtVaDtWaVaWtgStcgtMSgaS\n\
+RgMKtaaataVacataatgtaSaatttagtcgaaHtaKaatgcacatcggRaggSKctDc\n\
+agtcSttcccStYtccRtctctYtcaaKcgagtaMttttcRaYDttgttatctaatcata\n\
+NctctgctatcaMatactataggDaHaaSttMtaDtcNatataattctMcStaaBYtaNa\n\
+gatgtaatHagagSttgWHVcttatKaYgDctcttggtgttMcRaVgSgggtagacaata\n\
+aDtaattSaDaNaHaBctattgNtaccaaRgaVtKNtaaYggHtaKKgHcatctWtctDt\n\
+ttctttggSDtNtaStagttataaacaattgcaBaBWggHgcaaaBtYgctaatgaaatW\n\
+cDcttHtcMtWWattBHatcatcaaatctKMagtDNatttWaBtHaaaNgMttaaStagt\n\
+tctctaatDtcRVaYttgttMtRtgtcaSaaYVgSWDRtaatagctcagDgcWWaaaBaa\n\
+RaBctgVgggNgDWStNaNBKcBctaaKtttDcttBaaggBttgaccatgaaaNgttttt\n\
+tttatctatgttataccaaDRaaSagtaVtDtcaWatBtacattaWacttaSgtattggD\n\
+gKaaatScaattacgWcagKHaaccaYcRcaRttaDttRtttHgaHVggcttBaRgtccc\n\
+tDatKaVtKtcRgYtaKttacgtatBtStaagcaattaagaRgBagSaattccSWYttta\n\
+ttVaataNctgHgttaaNBgcVYgtRtcccagWNaaaacaDNaBcaaaaRVtcWMgBagM\n\
+tttattacgDacttBtactatcattggaaatVccggttRttcatagttVYcatYaSHaHc\n\
+ttaaagcNWaHataaaRWtctVtRYtagHtaaaYMataHYtNBctNtKaatattStgaMc\n\
+BtRgctaKtgcScSttDgYatcVtggaaKtaagatWccHccgKYctaNNctacaWctttt\n\
+gcRtgtVcgaKttcMRHgctaHtVaataaDtatgKDcttatBtDttggNtacttttMtga\n\
+acRattaaNagaactcaaaBBVtcDtcgaStaDctgaaaSgttMaDtcgttcaccaaaag\n\
+gWtcKcgSMtcDtatgtttStaaBtatagDcatYatWtaaaBacaKgcaDatgRggaaYc\n\
+taRtccagattDaWtttggacBaVcHtHtaacDacYgtaatataMagaatgHMatcttat\n\
+acgtatttttatattacHactgttataMgStYaattYaccaattgagtcaaattaYtgta\n\
+tcatgMcaDcgggtcttDtKgcatgWRtataatatRacacNRBttcHtBgcRttgtgcgt\n\
+catacMtttBctatctBaatcattMttMYgattaaVYatgDaatVagtattDacaacDMa\n\
+tcMtHcccataagatgBggaccattVWtRtSacatgctcaaggggYtttDtaaNgNtaaB\n\
+atggaatgtctRtaBgBtcNYatatNRtagaacMgagSaSDDSaDcctRagtVWSHtVSR\n\
+ggaacaBVaccgtttaStagaacaMtactccagtttVctaaRaaHttNcttagcaattta\n\
+ttaatRtaaaatctaacDaBttggSagagctacHtaaRWgattcaaBtctRtSHaNtgta\n\
+cattVcaHaNaagtataccacaWtaRtaaVKgMYaWgttaKggKMtKcgWatcaDatYtK\n\
+SttgtacgaccNctSaattcDcatcttcaaaDKttacHtggttHggRRaRcaWacaMtBW\n\
+VHSHgaaMcKattgtaRWttScNattBBatYtaNRgcggaagacHSaattRtttcYgacc\n\
+BRccMacccKgatgaacttcgDgHcaaaaaRtatatDtatYVtttttHgSHaSaatagct\n\
+NYtaHYaVYttattNtttgaaaYtaKttWtctaNtgagaaaNctNDctaaHgttagDcRt\n\
+tatagccBaacgcaRBtRctRtggtaMYYttWtgataatcgaataattattataVaaaaa\n\
+ttacNRVYcaaMacNatRttcKatMctgaagactaattataaYgcKcaSYaatMNctcaa\n\
+cgtgatttttBacNtgatDccaattattKWWcattttatatatgatBcDtaaaagttgaa\n\
+VtaHtaHHtBtataRBgtgDtaataMttRtDgDcttattNtggtctatctaaBcatctaR\n\
+atgNacWtaatgaagtcMNaacNgHttatactaWgcNtaStaRgttaaHacccgaYStac\n\
+aaaatWggaYaWgaattattcMaactcBKaaaRVNcaNRDcYcgaBctKaacaaaaaSgc\n\
+tccYBBHYaVagaatagaaaacagYtctVccaMtcgtttVatcaatttDRtgWctagtac\n\
+RttMctgtDctttcKtWttttataaatgVttgBKtgtKWDaWagMtaaagaaattDVtag\n\
+gttacatcatttatgtcgMHaVcttaBtVRtcgtaYgBRHatttHgaBcKaYWaatcNSc\n\
+tagtaaaaatttacaatcactSWacgtaatgKttWattagttttNaggtctcaagtcact\n\
+attcttctaagKggaataMgtttcataagataaaaatagattatDgcBVHWgaBKttDgc\n\
+atRHaagcaYcRaattattatgtMatatattgHDtcaDtcaaaHctStattaatHaccga\n\
+cNattgatatattttgtgtDtRatagSacaMtcRtcattcccgacacSattgttKaWatt\n\
+NHcaacttccgtttSRtgtctgDcgctcaaMagVtBctBMcMcWtgtaacgactctcttR\n\
+ggRKSttgYtYatDccagttDgaKccacgVatWcataVaaagaataMgtgataaKYaaat\n\
+cHDaacgataYctRtcYatcgcaMgtNttaBttttgatttaRtStgcaacaaaataccVg\n\
+aaDgtVgDcStctatatttattaaaaRKDatagaaagaKaaYYcaYSgKStctccSttac\n\
+agtcNactttDVttagaaagMHttRaNcSaRaMgBttattggtttaRMggatggcKDgWR\n\
+tNaataataWKKacttcKWaaagNaBttaBatMHtccattaacttccccYtcBcYRtaga\n\
+ttaagctaaYBDttaNtgaaaccHcaRMtKtaaHMcNBttaNaNcVcgVttWNtDaBatg\n\
+ataaVtcWKcttRggWatcattgaRagHgaattNtatttctctattaattaatgaDaaMa\n\
+tacgttgggcHaYVaaNaDDttHtcaaHtcVVDgBVagcMacgtgttaaBRNtatRtcag\n\
+taagaggtttaagacaVaaggttaWatctccgtVtaDtcDatttccVatgtacNtttccg\n\
+tHttatKgScBatgtVgHtYcWagcaKtaMYaaHgtaattaSaHcgcagtWNaatNccNN\n\
+YcacgVaagaRacttctcattcccRtgtgtaattagcSttaaStWaMtctNNcSMacatt\n\
+ataaactaDgtatWgtagtttaagaaaattgtagtNagtcaataaatttgatMMYactaa\n\
+tatcggBWDtVcYttcDHtVttatacYaRgaMaacaStaatcRttttVtagaDtcacWat\n\
+ttWtgaaaagaaagNRacDtttStVatBaDNtaactatatcBSMcccaSttccggaMatg\n\
+attaaWatKMaBaBatttgataNctgttKtVaagtcagScgaaaDggaWgtgttttKtWt\n\
+atttHaatgtagttcactaaKMagttSYBtKtaYgaactcagagRtatagtVtatcaaaW\n\
+YagcgNtaDagtacNSaaYDgatBgtcgataacYDtaaactacagWDcYKaagtttatta\n\
+gcatcgagttKcatDaattgattatDtcagRtWSKtcgNtMaaaaacaMttKcaWcaaSV\n\
+MaaaccagMVtaMaDtMaHaBgaacataBBVtaatVYaNSWcSgNtDNaaKacacBttta\n\
+tKtgtttcaaHaMctcagtaacgtcgYtactDcgcctaNgagagcYgatattttaaattt\n\
+ccattttacatttDaaRctattttWctttacgtDatYtttcagacgcaaVttagtaaKaa\n\
+aRtgVtccataBggacttatttgtttaWNtgttVWtaWNVDaattgtatttBaagcBtaa\n\
+BttaaVatcHcaVgacattccNggtcgacKttaaaRtagRtctWagaYggtgMtataatM\n\
+tgaaRttattttgWcttNtDRRgMDKacagaaaaggaaaRStcccagtYccVattaNaaK\n\
+StNWtgacaVtagaagcttSaaDtcacaacgDYacWDYtgtttKatcVtgcMaDaSKStV\n\
+cgtagaaWaKaagtttcHaHgMgMtctataagBtKaaaKKcactggagRRttaagaBaaN\n\
+atVVcgRcKSttDaactagtSttSattgttgaaRYatggttVttaataaHttccaagDtg\n\
+atNWtaagHtgcYtaactRgcaatgMgtgtRaatRaNaacHKtagactactggaatttcg\n\
+ccataacgMctRgatgttaccctaHgtgWaYcactcacYaattcttaBtgacttaaacct\n\
+gYgaWatgBttcttVttcgttWttMcNYgtaaaatctYgMgaaattacNgaHgaacDVVM\n\
+tttggtHtctaaRgtacagacgHtVtaBMNBgattagcttaRcttacaHcRctgttcaaD\n\
+BggttKaacatgKtttYataVaNattccgMcgcgtagtRaVVaattaKaatggttRgaMc\n\
+agtatcWBttNtHagctaatctagaaNaaacaYBctatcgcVctBtgcaaagDgttVtga\n\
+HtactSNYtaaNccatgtgDacgaVtDcgKaRtacDcttgctaagggcagMDagggtBWR\n\
+tttSgccttttttaacgtcHctaVtVDtagatcaNMaVtcVacatHctDWNaataRgcgt\n\
+aVHaggtaaaaSgtttMtattDgBtctgatSgtRagagYtctSaKWaataMgattRKtaa\n\
+catttYcgtaacacattRWtBtcggtaaatMtaaacBatttctKagtcDtttgcBtKYYB\n\
+aKttctVttgttaDtgattttcttccacttgSaaacggaaaNDaattcYNNaWcgaaYat\n\
+tttMgcBtcatRtgtaaagatgaWtgaccaYBHgaatagataVVtHtttVgYBtMctaMt\n\
+cctgaDcYttgtccaaaRNtacagcMctKaaaggatttacatgtttaaWSaYaKttBtag\n\
+DacactagctMtttNaKtctttcNcSattNacttggaacaatDagtattRtgSHaataat\n\
+gccVgacccgatactatccctgtRctttgagaSgatcatatcgDcagWaaHSgctYYWta\n\
+tHttggttctttatVattatcgactaagtgtagcatVgtgHMtttgtttcgttaKattcM\n\
+atttgtttWcaaStNatgtHcaaaDtaagBaKBtRgaBgDtSagtatMtaacYaatYtVc\n\
+KatgtgcaacVaaaatactKcRgtaYtgtNgBBNcKtcttaccttKgaRaYcaNKtactt\n\
+tgagSBtgtRagaNgcaaaNcacagtVtttHWatgttaNatBgtttaatNgVtctgaata\n\
+tcaRtattcttttttttRaaKcRStctcggDgKagattaMaaaKtcaHacttaataataK\n\
+taRgDtKVBttttcgtKaggHHcatgttagHggttNctcgtatKKagVagRaaaggaaBt\n\
+NatttVKcRttaHctaHtcaaatgtaggHccaBataNaNaggttgcWaatctgatYcaaa\n\
+HaatWtaVgaaBttagtaagaKKtaaaKtRHatMaDBtBctagcatWtatttgWttVaaa\n\
+ScMNattRactttgtYtttaaaagtaagtMtaMaSttMBtatgaBtttaKtgaatgagYg\n\
+tNNacMtcNRacMMHcttWtgtRtctttaacaacattattcYaMagBaacYttMatcttK\n\
+cRMtgMNccattaRttNatHaHNaSaaHMacacaVaatacaKaSttHatattMtVatWga\n\
+ttttttaYctttKttHgScWaacgHtttcaVaaMgaacagNatcgttaacaaaaagtaca\n\
+HBNaattgttKtcttVttaaBtctgctacgBgcWtttcaggacacatMgacatcccagcg\n\
+gMgaVKaBattgacttaatgacacacaaaaaatRKaaBctacgtRaDcgtagcVBaacDS\n\
+BHaaaaSacatatacagacRNatcttNaaVtaaaataHattagtaaaaSWccgtatWatg\n\
+gDttaactattgcccatcttHaSgYataBttBaactattBtcHtgatcaataSttaBtat\n\
+KSHYttWggtcYtttBttaataccRgVatStaHaKagaatNtagRMNgtcttYaaSaact\n\
+cagDSgagaaYtMttDtMRVgWKWtgMaKtKaDttttgactatacataatcNtatNaHat\n\
+tVagacgYgatatatttttgtStWaaatctWaMgagaRttRatacgStgattcttaagaD\n\
+taWccaaatRcagcagaaNKagtaaDggcgccBtYtagSBMtactaaataMataBSacRM\n\
+gDgattMMgtcHtcaYDtRaDaacggttDaggcMtttatgttaNctaattaVacgaaMMt\n\
+aatDccSgtattgaRtWWaccaccgagtactMcgVNgctDctaMScatagcgtcaactat\n\
+acRacgHRttgctatttaatgaattataYKttgtaagWgtYttgcHgMtaMattWaWVta\n\
+RgcttgYgttBHtYataSccStBtgtagMgtDtggcVaaSBaatagDttgBgtctttctc\n\
+attttaNagtHKtaMWcYactVcgcgtatMVtttRacVagDaatcttgctBBcRDgcaac\n\
+KttgatSKtYtagBMagaRtcgBattHcBWcaactgatttaatttWDccatttatcgagS\n\
+KaWttataHactaHMttaatHtggaHtHagaatgtKtaaRactgtttMatacgatcaagD\n\
+gatKaDctataMggtHDtggHacctttRtatcttYattttgacttgaaSaataaatYcgB\n\
+aaaaccgNatVBttMacHaKaataagtatKgtcaagactcttaHttcggaattgttDtct\n\
+aaccHttttWaaatgaaatataaaWattccYDtKtaaaacggtgaggWVtctattagtga\n\
+ctattaagtMgtttaagcatttgSgaaatatccHaaggMaaaattttcWtatKctagDtY\n\
+tMcctagagHcactttactatacaaacattaacttaHatcVMYattYgVgtMttaaRtga\n\
+aataaDatcaHgtHHatKcDYaatcttMtNcgatYatgSaMaNtcttKcWataScKggta\n\
+tcttacgcttWaaagNatgMgHtctttNtaacVtgttcMaaRatccggggactcMtttaY\n\
+MtcWRgNctgNccKatcttgYDcMgattNYaRagatHaaHgKctcataRDttacatBatc\n\
+cattgDWttatttaWgtcggagaaaaatacaatacSNtgggtttccttacSMaagBatta\n\
+caMaNcactMttatgaRBacYcYtcaaaWtagctSaacttWgDMHgaggatgBVgcHaDt\n\
+ggaactttggtcNatNgtaKaBcccaNtaagttBaacagtatacDYttcctNgWgcgSMc\n\
+acatStctHatgRcNcgtacacaatRttMggaNKKggataaaSaYcMVcMgtaMaHtgat\n\
+tYMatYcggtcttcctHtcDccgtgRatcattgcgccgatatMaaYaataaYSggatagc\n\
+gcBtNtaaaScaKgttBgagVagttaKagagtatVaactaSacWactSaKatWccaKaaa\n\
+atBKgaaKtDMattttgtaaatcRctMatcaaMagMttDgVatggMaaWgttcgaWatga\n\
+aatttgRtYtattaWHKcRgctacatKttctaccaaHttRatctaYattaaWatVNccat\n\
+NgagtcKttKataStRaatatattcctRWatDctVagttYDgSBaatYgttttgtVaatt\n\
+taatagcagMatRaacttBctattgtMagagattaaactaMatVtHtaaatctRgaaaaa\n\
+aaatttWacaacaYccYDSaattMatgaccKtaBKWBattgtcaagcHKaagttMMtaat\n\
+ttcKcMagNaaKagattggMagaggtaatttYacatcWaaDgatMgKHacMacgcVaaca\n\
+DtaDatatYggttBcgtatgWgaSatttgtagaHYRVacaRtctHaaRtatgaactaata\n\
+tctSSBgggaaHMWtcaagatKgagtDaSatagttgattVRatNtctMtcSaagaSHaat\n\
+aNataataRaaRgattctttaataaagWaRHcYgcatgtWRcttgaaggaMcaataBRaa\n\
+ccagStaaacNtttcaatataYtaatatgHaDgcStcWttaacctaRgtYaRtataKtgM\n\
+ttttatgactaaaatttacYatcccRWtttHRtattaaatgtttatatttgttYaatMca\n\
+RcSVaaDatcgtaYMcatgtagacatgaaattgRtcaaYaaYtRBatKacttataccaNa\n\
+aattVaBtctggacaagKaaYaaatatWtMtatcYaaVNtcgHaactBaagKcHgtctac\n\
+aatWtaDtSgtaHcataHtactgataNctRgttMtDcDttatHtcgtacatcccaggStt\n\
+aBgtcacacWtccNMcNatMVaVgtccDYStatMaccDatggYaRKaaagataRatttHK\n\
+tSaaatDgataaacttaHgttgVBtcttVttHgDacgaKatgtatatNYataactctSat\n\
+atatattgcHRRYttStggaactHgttttYtttaWtatMcttttctatctDtagVHYgMR\n\
+BgtHttcctaatYRttKtaagatggaVRataKDctaMtKBNtMtHNtWtttYcVtattMc\n\
+gRaacMcctNSctcatttaaagDcaHtYccSgatgcaatYaaaaDcttcgtaWtaattct\n\
+cgttttScttggtaatctttYgtctaactKataHacctMctcttacHtKataacacagcN\n\
+RatgKatttttSaaatRYcgDttaMRcgaaattactMtgcgtaagcgttatBtttttaat\n\
+taagtNacatHgttcRgacKcBBtVgatKttcgaBaatactDRgtRtgaNacWtcacYtt\n\
+aaKcgttctHaKttaNaMgWgWaggtctRgaKgWttSttBtDcNtgtttacaaatYcDRt\n\
+gVtgcctattcNtctaaaDMNttttNtggctgagaVctDaacVtWccaagtaacacaNct\n\
+gaScattccDHcVBatcgatgtMtaatBgHaatDctMYgagaatgYWKcctaatNaStHa\n\
+aaKccgHgcgtYaaYtattgtStgtgcaaRtattaKatattagaWVtcaMtBagttatta\n\
+gNaWHcVgcaattttDcMtgtaRHVYtHtctgtaaaaHVtMKacatcgNaatttMatatg\n\
+ttgttactagWYtaRacgataKagYNKcattataNaRtgaacKaYgcaaYYacaNccHat\n\
+MatDcNgtHttRaWttagaaDcaaaaaatagggtKDtStaDaRtaVtHWKNtgtattVct\n\
+SVgRgataDaRaWataBgaagaaKtaataaYgDcaStaNgtaDaaggtattHaRaWMYaY\n\
+aWtggttHYgagVtgtgcttttcaaDKcagVcgttagacNaaWtagtaataDttctggtt\n\
+VcatcataaagtgKaaaNaMtaBBaattaatWaattgctHaVKaSgDaaVKaHtatatat\n\
+HatcatSBagNgHtatcHYMHgttDgtaHtBttWatcgtttaRaattgStKgSKNWKatc\n\
+agDtctcagatttctRtYtBatBgHHtKaWtgYBgacVVWaKtacKcDttKMaKaVcggt\n\
+gttataagaataaHaatattagtataatMHgttYgaRttagtaRtcaaVatacggtcMcg\n\
+agtaaRttacWgactKRYataaaagSattYaWgagatYagKagatgSaagKgttaatMgg\n\
+tataatgttWYttatgagaaacctNVataatHcccKtDctcctaatactggctHggaSag\n\
+gRtKHaWaattcgSatMatttagaggcYtctaMcgctcataSatatgRagacNaaDagga\n\
+VBagaYttKtacNaKgtSYtagttggaWcatcWttaatctatgaVtcgtgtMtatcaYcg\n\
+tRccaaYgDctgcMgtgtWgacWtgataacacgcgctBtgttaKtYDtatDcatcagKaV\n\
+MctaatcttgVcaaRgcRMtDcgattaHttcaNatgaatMtactacVgtRgatggaWttt\n\
+actaaKatgagSaaKggtaNtactVaYtaaKRagaacccacaMtaaMtKtatBcttgtaa\n\
+WBtMctaataaVcDaaYtcRHBtcgttNtaaHatttBNgRStVDattBatVtaagttaYa\n\
+tVattaagaBcacggtSgtVtatttaRattgatgtaHDKgcaatattKtggcctatgaWD\n\
+KRYcggattgRctatNgatacaatMNttctgtcRBYRaaaHctNYattcHtaWcaattct\n\
+BtMKtVgYataatMgYtcagcttMDataVtggRtKtgaatgccNcRttcaMtRgattaac\n\
+attRcagcctHtWMtgtDRagaKaBtgDttYaaaaKatKgatctVaaYaacWcgcatagB\n\
+VtaNtRtYRaggBaaBtgKgttacataagagcatgtRattccacttaccatRaaatgWgD\n\
+aMHaYVgVtaSctatcgKaatatattaDgacccYagtgtaYNaaatKcagtBRgagtcca\n\
+tgKgaaaccBgaagBtgSttWtacgatWHaYatcgatttRaaNRgcaNaKVacaNtDgat\n\
+tgHVaatcDaagcgtatgcNttaDataatcSataaKcaataaHWataBtttatBtcaKtK\n\
+tatagttaDgSaYctacaRatNtaWctSaatatttYaKaKtaccWtatcRagacttaYtt\n\
+VcKgSDcgagaagatccHtaattctSttatggtKYgtMaHagVaBRatttctgtRgtcta\n\
+tgggtaHKgtHacHtSYacgtacacHatacKaaBaVaccaDtatcSaataaHaagagaat\n\
+ScagactataaRttagcaaVcaHataKgDacatWccccaagcaBgagWatctaYttgaaa\n\
+tctVNcYtttWagHcgcgcDcVaaatgttKcHtNtcaatagtgtNRaactttttcaatgg\n\
+WgBcgDtgVgtttctacMtaaataaaRggaaacWaHttaRtNtgctaaRRtVBctYtVta\n\
+tDcattDtgaccYatagatYRKatNYKttNgcctagtaWtgaactaMVaacctgaStttc\n\
+tgaKVtaaVaRKDttVtVctaDNtataaaDtccccaagtWtcgatcactDgYaBcatcct\n\
+MtVtacDaaBtYtMaKNatNtcaNacgDatYcatcgcaRatWBgaacWttKttagYtaat\n\
+tcggttgSWttttDWctttacYtatatWtcatDtMgtBttgRtVDggttaacYtacgtac\n\
+atgaattgaaWcttMStaDgtatattgaDtcRBcattSgaaVBRgagccaaKtttcDgcg\n\
+aSMtatgWattaKttWtgDBMaggBBttBaatWttRtgcNtHcgttttHtKtcWtagHSt\n\
+aacagttgatatBtaWSaWggtaataaMttaKacDaatactcBttcaatatHttcBaaSa\n\
+aatYggtaRtatNtHcaatcaHtagVtgtattataNggaMtcttHtNagctaaaggtaga\n\
+YctMattNaMVNtcKtactBKcaHHcBttaSagaKacataYgctaKaYgttYcgacWVtt\n\
+WtSagcaacatcccHaccKtcttaacgaKttcacKtNtacHtatatRtaaatacactaBt\n\
+ttgaHaRttggttWtatYagcatYDatcggagagcWBataagRtacctataRKgtBgatg\n\
+aDatataSttagBaHtaatNtaDWcWtgtaattacagKttcNtMagtattaNgtctcgtc\n\
+ctcttBaHaKcKccgtRcaaYagSattaagtKataDatatatagtcDtaacaWHcaKttD\n\
+gaaRcgtgYttgtcatatNtatttttatggccHtgDtYHtWgttatYaacaattcaWtat\n\
+NgctcaaaSttRgctaatcaaatNatcgtttaBtNNVtgttataagcaaagattBacgtD\n\
+atttNatttaaaDcBgtaSKgacgtagataatttcHMVNttgttBtDtgtaWKaaRMcKM\n\
+tHtaVtagataWctccNNaSWtVaHatctcMgggDgtNHtDaDttatatVWttgttattt\n\
+aacctttcacaaggaSaDcggttttttatatVtctgVtaacaStDVaKactaMtttaSNa\n\
+gtgaaattaNacttSKctattcctctaSagKcaVttaagNaVcttaVaaRNaHaaHttat\n\
+gtHttgtgatMccaggtaDcgaccgtWgtWMtttaHcRtattgScctatttKtaaccaag\n\
+tYagaHgtWcHaatgccKNRtttagtMYSgaDatctgtgaWDtccMNcgHgcaaacNDaa\n\
+aRaStDWtcaaaaHKtaNBctagBtgtattaactaattttVctagaatggcWSatMaccc\n\
+ttHttaSgSgtgMRcatRVKtatctgaaaccDNatYgaaVHNgatMgHRtacttaaaRta\n\
+tStRtDtatDttYatattHggaBcttHgcgattgaKcKtttcRataMtcgaVttWacatN\n\
+catacctRataDDatVaWNcggttgaHtgtMacVtttaBHtgagVttMaataattatgtt\n\
+cttagtttgtgcDtSatttgBtcaacHattaaBagVWcgcaSYttMgcttacYKtVtatc\n\
+aYaKctgBatgcgggcYcaaaaacgNtctagKBtattatctttKtaVttatagtaYtRag\n\
+NtaYataaVtgaatatcHgcaaRataHtacacatgtaNtgtcgYatWMatttgaactacR\n\
+ctaWtWtatacaatctBatatgYtaagtatgtgtatSttactVatcttYtaBcKgRaSgg\n\
+RaaaaatgcagtaaaWgtaRgcgataatcBaataccgtatttttccatcNHtatWYgatH\n\
+SaaaDHttgctgtccHtggggcctaataatttttctatattYWtcattBtgBRcVttaVM\n\
+RSgctaatMagtYtttaaaaatBRtcBttcaaVtaacagctccSaaSttKNtHtKYcagc\n\
+agaaaccccRtttttaaDcDtaStatccaagcgctHtatcttaDRYgatDHtWcaaaBcW\n\
+gKWHttHataagHacgMNKttMKHccaYcatMVaacgttaKgYcaVaaBtacgcaacttt\n\
+MctaaHaatgtBatgagaSatgtatgSRgHgWaVWgataaatatttccKagVgataattW\n\
+aHNcYggaaatgctHtKtaDtctaaagtMaatVDVactWtSaaWaaMtaHtaSKtcBRaN\n\
+cttStggtBttacNagcatagRgtKtgcgaacaacBcgKaatgataagatgaaaattgta\n\
+ctgcgggtccHHWHaaNacaBttNKtKtcaaBatatgctaHNgtKcDWgtttatNgVDHg\n\
+accaacWctKaaggHttgaRgYaatHcaBacaatgagcaaattactgtaVaaYaDtagat\n\
+tgagNKggtggtgKtWKaatacagDRtatRaMRtgattDggtcaaYRtatttNtagaDtc\n\
+acaaSDctDtataatcgtactaHttatacaatYaacaaHttHatHtgcgatRRttNgcat\n\
+SVtacWWgaaggagtatVMaVaaattScDDKNcaYBYaDatHgtctatBagcaacaagaa\n\
+tgagaaRcataaKNaRtBDatcaaacgcattttttaaBtcSgtacaRggatgtMNaattg\n\
+gatatWtgagtattaaaVctgcaYMtatgatttttYgaHtgtcttaagWBttHttgtctt\n\
+attDtcgtatWtataataSgctaHagcDVcNtaatcaagtaBDaWaDgtttagYctaNcc\n\
+DtaKtaHcttaataacccaRKtacaVaatNgcWRaMgaattatgaBaaagattVYaHMDc\n\
+aDHtcRcgYtcttaaaWaaaVKgatacRtttRRKYgaatacaWVacVcRtatMacaBtac\n\
+tggMataaattttHggNagSctacHgtBagcgtcgtgattNtttgatSaaggMttctttc\n\
+ttNtYNagBtaaacaaatttMgaccttacataattgYtcgacBtVMctgStgMDtagtaR\n\
+ctHtatgttcatatVRNWataDKatWcgaaaaagttaaaagcacgHNacgtaatctttMR\n\
+tgacttttDacctataaacgaaatatgattagaactccSYtaBctttaataacWgaaaYa\n\
+tagatgWttcatKtNgatttttcaagHtaYgaaRaDaagtaggagcttatVtagtctttc\n\
+attaaaatcgKtattaRttacagVaDatgcatVgattgggtctttHVtagKaaRBtaHta\n\
+aggccccaaaaKatggtttaMWgtBtaaacttcactttKHtcgatctccctaYaBacMgt\n\
+cttBaBaNgcgaaacaatctagtHccHtKttcRtRVttccVctttcatacYagMVtMcag\n\
+aMaaacaataBctgYtaatRaaagattaaccatVRatHtaRagcgcaBcgDttStttttc\n\
+VtttaDtKgcaaWaaaaatSccMcVatgtKgtaKgcgatatgtagtSaaaDttatacaaa\n\
+catYaRRcVRHctKtcgacKttaaVctaDaatgttMggRcWaacttttHaDaKaDaBctg\n\
+taggcgtttaHBccatccattcNHtDaYtaataMttacggctNVaacDattgatatttta\n\
+cVttSaattacaaRtataNDgacVtgaacataVRttttaDtcaaacataYDBtttaatBa\n\
+DtttYDaDaMccMttNBttatatgagaaMgaNtattHccNataattcaHagtgaaggDga\n\
+tgtatatatgYatgaStcataaBStWacgtcccataRMaaDattggttaaattcMKtctM\n\
+acaBSactcggaatDDgatDgcWctaacaccgggaVcacWKVacggtaNatatacctMta\n\
+tgatagtgcaKagggVaDtgtaacttggagtcKatatcgMcttRaMagcattaBRaStct\n\
+YSggaHYtacaactMBaagDcaBDRaaacMYacaHaattagcattaaaHgcgctaaggSc\n\
+cKtgaaKtNaBtatDDcKBSaVtgatVYaagVtctSgMctacgttaacWaaattctSgtD\n\
+actaaStaaattgcagBBRVctaatatacctNttMcRggctttMttagacRaHcaBaacV\n\
+KgaataHttttMgYgattcYaNRgttMgcVaaacaVVcDHaatttgKtMYgtatBtVVct\n\
+WgVtatHtacaaHttcacgatagcagtaaNattBatatatttcVgaDagcggttMaagtc\n\
+ScHagaaatgcYNggcgtttttMtStggtRatctacttaaatVVtBacttHNttttaRca\n\
+aatcacagHgagagtMgatcSWaNRacagDtatactaaDKaSRtgattctccatSaaRtt\n\
+aaYctacacNtaRtaactggatgaccYtacactttaattaattgattYgttcagDtNKtt\n\
+agDttaaaaaaaBtttaaNaYWKMBaaaacVcBMtatWtgBatatgaacVtattMtYatM\n\
+NYDKNcKgDttDaVtaaaatgggatttctgtaaatWtctcWgtVVagtcgRgacttcccc\n\
+taDcacagcRcagagtgtWSatgtacatgttaaSttgtaaHcgatgggMagtgaacttat\n\
+RtttaVcaccaWaMgtactaatSSaHtcMgaaYtatcgaaggYgggcgtgaNDtgttMNg\n\
+aNDMtaattcgVttttaacatgVatgtWVMatatcaKgaaattcaBcctccWcttgaaWH\n\
+tWgHtcgNWgaRgctcBgSgaattgcaaHtgattgtgNagtDttHHgBttaaWcaaWagc\n\
+aSaHHtaaaVctRaaMagtaDaatHtDMtcVaWMtagSagcttHSattaacaaagtRacM\n\
+tRtctgttagcMtcaBatVKtKtKacgagaSNatSactgtatatcBctgagVtYactgta\n\
+aattaaaggcYgDHgtaacatSRDatMMccHatKgttaacgactKtgKagtcttcaaHRV\n\
+tccttKgtSataatttacaactggatDNgaacttcaRtVaagDcaWatcBctctHYatHa\n\
+DaaatttagYatSatccaWtttagaaatVaacBatHcatcgtacaatatcgcNYRcaata\n\
+YaRaYtgattVttgaatgaVaactcRcaNStgtgtattMtgaggtNttBaDRcgaaaagc\n\
+tNgBcWaWgtSaDcVtgVaatMKBtttcgtttctaaHctaaagYactgMtatBDtcStga\n\
+ccgtSDattYaataHctgggaYYttcggttaWaatctggtRagWMaDagtaacBccacta\n\
+cgHWMKaatgatWatcctgHcaBaSctVtcMtgtDttacctaVgatYcWaDRaaaaRtag\n\
+atcgaMagtggaRaWctctgMgcWttaagKBRtaaDaaWtctgtaagYMttactaHtaat\n\
+cttcataacggcacBtSgcgttNHtgtHccatgttttaaagtatcgaKtMttVcataYBB\n\
+aKtaMVaVgtattNDSataHcagtWMtaggtaSaaKgttgBtVtttgttatcatKcgHac\n\
+acRtctHatNVagSBgatgHtgaRaSgttRcctaacaaattDNttgacctaaYtBgaaaa\n\
+tagttattactcttttgatgtNNtVtgtatMgtcttRttcatttgatgacacttcHSaaa\n\
+ccaWWDtWagtaRDDVNacVaRatgttBccttaatHtgtaaacStcVNtcacaSRttcYa\n\
+gacagaMMttttgMcNttBcgWBtactgVtaRttctccaaYHBtaaagaBattaYacgat\n\
+ttacatctgtaaMKaRYtttttactaaVatWgctBtttDVttctggcDaHaggDaagtcg\n\
+aWcaagtagtWttHtgKtVataStccaMcWcaagataagatcactctHatgtcYgaKcat\n\
+cagatactaagNSStHcctRRNtattgtccttagttagMVgtatagactaactctVcaat\n\
+MctgtttgtgttgccttatWgtaBVtttctggMcaaKgDWtcgtaaYStgSactatttHg\n\
+atctgKagtagBtVacRaagRtMctatgggcaaaKaaaatacttcHctaRtgtDcttDat\n\
+taggaaatttcYHaRaaBttaatggcacKtgctHVcaDcaaaVDaaaVcgMttgtNagcg\n\
+taDWgtcgttaatDgKgagcSatatcSHtagtagttggtgtHaWtaHKtatagctgtVga\n\
+ttaBVaatgaataagtaatVatSttaHctttKtttgtagttaccttaatcgtagtcctgB\n\
+cgactatttVcMacHaaaggaatgDatggKtaHtgStatattaaSagctWcctccRtata\n\
+BaDYcgttgcNaagaggatRaaaYtaWgNtSMcaatttactaacatttaaWttHtatBat\n\
+tgtcgacaatNgattgcNgtMaaaKaBDattHacttggtRtttaYaacgVactBtaBaKt\n\
+gBttatgVttgtVttcaatcWcNctDBaaBgaDHacBttattNtgtDtatttVSaaacag\n\
+gatgcRatSgtaSaNtgBatagttcHBgcBBaaattaHgtDattatDaKaatBaaYaaMa\n\
+ataaataKtttYtagtBgMatNcatgtttgaNagtgttgtgKaNaSagtttgaSMaYBca\n\
+aaacDStagttVacaaaaactaaWttBaagtctgtgcgtMgtaattctcctacctcaNtt\n\
+taaccaaaaVtBcacataacaccccBcWMtatVtggaatgaWtcaaWaaaaaaaaWtDta\n\
+atatRcctDWtcctaccMtVVatKttaWaaKaaatataaagScHBagaggBaSMtaWaVt\n\
+atattactSaaaKNaactatNatccttgaYctattcaaaVgatttYHcRagattttaSat\n\
+aggttattcVtaaagaKgtattattKtRttNcggcRgtgtgtWYtaacHgKatKgatYta\n\
+cYagDtWcHBDctctgRaYKaYagcactKcacSaRtBttttBHKcMtNtcBatttatttt\n\
+tgSatVgaaagaWtcDtagDatatgMacaacRgatatatgtttgtKtNRaatatNatgYc\n\
+aHtgHataacKtgagtagtaacYttaNccaaatHcacaacaVDtagtaYtccagcattNt\n\
+acKtBtactaaagaBatVtKaaHBctgStgtBgtatgaSNtgDataaccctgtagcaBgt\n\
+gatcttaDataStgaMaccaSBBgWagtacKcgattgaDgNNaaaacacagtSatBacKD\n\
+gcgtataBKcatacactaSaatYtYcDaactHttcatRtttaatcaattataRtttgtaa\n\
+gMcgNttcatcBtYBagtNWNMtSHcattcRctttttRWgaKacKttgggagBcgttcgc\n\
+MaWHtaatactgtctctatttataVgtttaBScttttaBMaNaatMacactYtBMggtHa\n\
+cMagtaRtctgcatttaHtcaaaatttgagKtgNtactBacaHtcgtatttctMaSRagc\n\
+agttaatgtNtaaattgagagWcKtaNttagVtacgatttgaatttcgRtgtWcVatcgt\n\
+taaDVctgtttBWgaccagaaagtcSgtVtatagaBccttttcctaaattgHtatcggRa\n\
+ttttcaaggcYSKaagWaWtRactaaaacccBatMtttBaatYtaagaactSttcgaaSc\n\
+aatagtattgaccaagtgttttctaacatgtttNVaatcaaagagaaaNattaaRtttta\n\
+VaaaccgcaggNMtatattVctcaagaggaacgBgtttaacaagttcKcYaatatactaa\n\
+ccBaaaSggttcNtattctagttRtBacgScVctcaatttaatYtaaaaaaatgSaatga\n\
+tagaMBRatgRcMcgttgaWHtcaVYgaatYtaatctttYttatRaWtctgBtDcgatNa\n\
+tcKaBaDgatgtaNatWKctccgatattaacattNaaacDatgBgttctgtDtaaaMggt\n\
+gaBaSHataacgccSctaBtttaRBtcNHcDatcDcctagagtcRtaBgWttDRVHagat\n\
+tYatgtatcWtaHtttYcattWtaaagtctNgtStggRNcgcggagSSaaagaaaatYcH\n\
+DtcgctttaatgYcKBVSgtattRaYBaDaaatBgtatgaHtaaRaRgcaSWNtagatHa\n\
+acttNctBtcaccatctMcatattccaSatttgcgaDagDgtatYtaaaVDtaagtttWV\n\
+aagtagYatRttaagDcNgacKBcScagHtattatcDaDactaaaaaYgHttBcgaDttg\n\
+gataaaKSRcBMaBcgaBSttcWtgNBatRaccgattcatttataacggHVtaattcaca\n\
+agagVttaaRaatVVRKcgWtVgacctgDgYaaHaWtctttcacMagggatVgactagMa\n\
+aataKaaNWagKatagNaaWtaaaatttgaattttatttgctaaVgaHatBatcaaBWcB\n\
+gttcMatcgBaaNgttcgSNaggSaRtttgHtRtattaNttcDcatSaVttttcgaaaaa\n\
+ttgHatctaRaggSaNatMDaaatDcacgattttagaHgHaWtYgattaatHNSttatMS\n\
+gggNtcKtYatRggtttgtMWVtttaYtagcagBagHaYagttatatggtBacYcattaR\n\
+SataBatMtttaaatctHcaaaSaaaagttNSaaWcWRccRtKaagtBWtcaaattSttM\n\
+tattggaaaccttaacgttBtWatttatatWcDaatagattcctScacctaagggRaaYt\n\
+aNaatgVtBcttaaBaacaMVaaattatStYgRcctgtactatcMcVKatttcgSgatRH\n\
+MaaaHtagtaaHtVgcaaataatatcgKKtgccaatBNgaaWcVttgagttaKatagttc\n\
+aggKDatDtattgaKaVcaKtaataDataataHSaHcattagttaatRVYcNaHtaRcaa\n\
+ggtNHcgtcaaccaBaaagYtHWaaaRcKgaYaaDttgcWYtataRgaatatgtYtgcKt\n\
+aNttWacatYHctRaDtYtattcBttttatcSataYaYgttWaRagcacHMgtttHtYtt\n\
+YaatcggtatStttcgtRSattaaDaKMaatatactaNBaWgctacacYtgaYVgtgHta\n\
+aaRaaRgHtagtWattataaaSDaaWtgMattatcgaaaagtaYRSaWtSgNtBgagcRY\n\
+aMDtactaacttaWgtatctagacaagNtattHggataatYttYatcataDcgHgttBtt\n\
+ctttVttgccgaaWtaaaacgKgtatctaaaaaNtccDtaDatBMaMggaatNKtatBaa\n\
+atVtccRaHtaSacataHattgtttKVYattcataVaattWtcgtgMttcttKtgtctaa\n\
+cVtatctatatBRataactcgKatStatattcatHHRttKtccaacgtgggtgRgtgaMt\n\
+attattggctatcgtgacMtRcBDtcttgtactaatRHttttaagatcgVMDStattatY\n\
+BtttDttgtBtNttgRcMtYtgBacHaWaBaatDKctaagtgaaactaatgRaaKgatcc\n\
+aagNaaaatattaggWNtaagtatacttttKcgtcggSYtcttgRctataYcttatataa\n\
+agtatattaatttataVaacacaDHatctatttttKYVatHRactttaBHccaWagtact\n\
+BtcacgaVgcgttRtttttttSVgtSagtBaaattctgaHgactcttgMcattttagVta\n\
+agaattHctHtcaDaaNtaacRggWatagttcgtSttgaDatcNgNagctagDgatcNtt\n\
+KgttgtaDtctttRaaYStRatDtgMggactSttaDtagSaVtBDttgtDgccatcacaM\n\
+attaaaMtNacaVcgSWcVaaDatcaHaatgaattaMtatccVtctBtaattgtWattat\n\
+BRcWcaatgNNtactWYtDaKttaaatcactcagtRaaRgatggtKgcgccaaHgaggat\n\
+StattYcaNMtcaBttacttatgagDaNtaMgaaWtgtttcttctaHtMNgttatctaWW\n\
+atMtBtaaatagDVatgtBYtatcggcttaagacMRtaHScgatatYgRDtcattatSDa\n\
+HggaaataNgaWSRRaaaBaatagBattaDctttgHWNttacaataaaaaaatacggttt\n\
+gHgVtaHtWMttNtBtctagtMcgKMgHgYtataHaNagWtcaacYattaataYRgtaWK\n\
+gaBctataaccgatttaHaNBRaRaMtccggtNgacMtctcatttgcaattcWgMactta\n\
+caaDaaNtactWatVtttagccttMaatcagVaagtctVaaDaBtattaattaYtNaYtg\n\
+gattaKtaKctYaMtattYgatattataatKtVgDcttatatNBtcgttgtStttttMag\n\
+aggttaHYSttcKgtcKtDNtataagttataagSgttatDtRttattgttttSNggRtca\n\
+aKMNatgaatattgtBWtaMacctgggYgaSgaagYataagattacgagaatBtggtRcV\n\
+HtgYggaDgaYaKagWagctatagacgaaHgtWaNgacttHRatVaWacKYtgRVNgVcS\n\
+gRWctacatcKSactctgWYtBggtataagcttNRttVtgRcaWaaatDMatYattaact\n\
+ttcgaagRatSctgccttgcRKaccHtttSNVagtagHagBagttagaccaRtataBcca\n\
+taatSHatRtcHagacBWatagcaMtacaRtgtgaaBatctKRtScttccaNaatcNgta\n\
+atatWtcaMgactctBtWtaaNactHaaaaRctcgcatggctMcaaNtcagaaaaacaca\n\
+gtggggWttRttagtaagaVctVMtcgaatcttcMaaaHcaHBttcgattatgtcaDagc\n\
+YRtBtYcgacMgtDcagcgaNgttaataatagcagKYYtcgtaBtYctMaRtaRtDagaa\n\
+aacacatgYaBttgattattcgaaNttBctSataaMataWRgaHtttccgtDgaYtatgg\n\
+tDgHKgMtatttVtMtVagttaRatMattRagataaccctKctMtSttgaHagtcStcta\n\
+tttccSagatgttccacgaggYNttHRacgattcDatatDcataaaatBBttatcgaHtN\n\
+HaaatatDNaggctgaNcaaggagttBttMgRagVatBcRtaWgatgBtSgaKtcgHttt\n\
+gaatcaaDaHttcSBgHcagtVaaSttDcagccgttNBtgttHagYtattctttRWaaVt\n\
+SttcatatKaaRaaaNacaVtVctMtSDtDtRHRcgtaatgctcttaaatSacacaatcg\n\
+HattcaWcttaaaatHaaatcNctWttaNMcMtaKctVtcctaagYgatgatcYaaaRac\n\
+tctaRDaYagtaacgtDgaggaaatctcaaacatcaScttcKttNtaccatNtaNataca\n\
+tttHaaDHgcaDatMWaaBttcRggctMaagctVYcacgatcaDttatYtaatcKatWat\n\
+caatVYtNagatttgattgaYttttYgacttVtcKaRagaaaHVgDtaMatKYagagttN\n\
+atWttaccNtYtcDWgSatgaRgtMatgKtcgacaagWtacttaagtcgKtgatccttNc\n\
+ttatagMatHVggtagcgHctatagccctYttggtaattKNaacgaaYatatVctaataM\n\
+aaaYtgVtcKaYtaataacagaatHcacVagatYWHttagaaSMaatWtYtgtaaagNaa\n\
+acaVgaWtcacNWgataNttcaSagctMDaRttgNactaccgataMaaatgtttattDtc\n\
+aagacgctDHYYatggttcaagccNctccttcMctttagacBtaaWtaWVHggaaaaNat\n\
+ttaDtDtgctaaHHtMtatNtMtagtcatttgcaaaRatacagRHtatDNtgtDgaatVg\n\
+tVNtcaaatYBMaaaagcaKgtgatgatMgWWMaHttttMgMagatDtataaattaacca\n\
+actMtacataaattgRataatacgBtKtaataattRgtatDagDtcRDacctatRcagag\n\
+cSHatNtcaScNtttggacNtaaggaccgtgKNttgttNcttgaaRgYgRtNtcagttBc\n\
+ttttcHtKtgcttYaaNgYagtaaatgaatggWaMattBHtatctatSgtcYtgcHtaat\n\
+tHgaaMtHcagaaSatggtatgccaHBtYtcNattWtgtNgctttaggtttgtWatNtgH\n\
+tgcDttactttttttgcNtactKtWRaVcttcatagtgSNKaNccgaataaBttataata\n\
+YtSagctttaaatSttggctaaKSaatRccgWHgagDttaaatcatgagMtcgagtVtaD\n\
+ggaBtatttgDacataaacgtagYRagBWtgDStKDgatgaagttcattatttaKWcata\n\
+aatWRgatataRgttRacaaNKttNtKagaaYaStaactScattattaacgatttaaatg\n\
+DtaattagatHgaYataaactatggggatVHtgccgtNgatNYcaStRtagaccacWcaM\n\
+tatRagHgVactYtWHtcttcatgatWgagaKggagtatgaWtDtVtNaNtcgYYgtaaa\n\
+ctttaDtBactagtaDctatagtaatatttatatataacgHaaaRagKattSagttYtSt\n\
+>THREE Homo sapiens frequency\n\
+agagagacgatgaaaattaatcgtcaatacgctggcgaacactgagggggacccaatgct\n\
+cttctcggtctaaaaaggaatgtgtcagaaattggtcagttcaaaagtagaccggatctt\n\
+tgcggagaacaattcacggaacgtagcgttgggaaatatcctttctaccacacatcggat\n\
+tttcgccctctcccattatttattgtgttctcacatagaattattgtttagacatccctc\n\
+gttgtatggagagttgcccgagcgtaaaggcataatccatataccgccgggtgagtgacc\n\
+tgaaattgtttttagttgggatttcgctatggattagcttacacgaagagattctaatgg\n\
+tactataggataattataatgctgcgtggcgcagtacaccgttacaaacgtcgttcgcat\n\
+atgtggctaacacggtgaaaatacctacatcgtatttgcaatttcggtcgtttcatagag\n\
+cgcattgaattactcaaaaattatatatgttgattatttgattagactgcgtggaaagaa\n\
+ggggtactcaagccatttgtaaaagctgcatctcgcttaagtttgagagcttacattagt\n\
+ctatttcagtcttctaggaaatgtctgtgtgagtggttgtcgtccataggtcactggcat\n\
+atgcgattcatgacatgctaaactaagaaagtagattactattaccggcatgcctaatgc\n\
+gattgcactgctatgaaggtgcggacgtcgcgcccatgtagccctgataataccaatact\n\
+tacatttggtcagcaattctgacattatacctagcacccataaatttactcagacttgag\n\
+gacaggctcttggagtcgatcttctgtttgtatgcatgtgatcatatagatgaataagcg\n\
+atgcgactagttagggcatagtatagatctgtgtatacagttcagctgaacgtccgcgag\n\
+tggaagtacagctgagatctatcctaaaatgcaaccatatcgttcacacatgatatgaac\n\
+ccagggggaaacattgagttcagttaaattggcagcgaatcccccaagaagaaggcggag\n\
+tgacgttgaacgggcttatggtttttcagtacttcctccgtataagttgagcgaaatgta\n\
+aacagaataatcgttgtgttaacaacattaaaatcgcggaatatgatgagaatacacagt\n\
+gtgagcatttcacttgtaaaatatctttggtagaacttactttgctttaaatatgttaaa\n\
+ccgatctaataatctacaaaacggtagattttgcctagcacattgcgtccttctctattc\n\
+agatagaggcaatactcagaaggttttatccaaagcactgtgttgactaacctaagtttt\n\
+agtctaataatcatgattgattataggtgccgtggactacatgactcgtccacaaataat\n\
+acttagcagatcagcaattggccaagcacccgacttttatttaatggttgtgcaatagtc\n\
+cagattcgtattcgggactctttcaaataatagtttcctggcatctaagtaagaaaagct\n\
+cataaggaagcgatattatgacacgctcttccgccgctgttttgaaacttgagtattgct\n\
+cgtccgaaattgagggtcacttcaaaatttactgagaagacgaagatcgactaaagttaa\n\
+aatgctagtccacagttggtcaagttgaattcatccacgagttatatagctattttaatt\n\
+tatagtcgagtgtacaaaaaacatccacaataagatttatcttagaataacaacccccgt\n\
+atcatcgaaatcctccgttatggcctgactcctcgagcttatagcatttgtgctggcgct\n\
+cttgccaggaacttgctcgcgaggtggtgacgagtgagatgatcagtttcattatgatga\n\
+tacgattttatcgcgactagttaatcatcatagcaagtaaaatttgaattatgtcattat\n\
+catgctccattaacaggttatttaattgatactgacgaaattttttcacaatgggttttc\n\
+tagaatttaatatcagtaattgaagccttcataggggtcctactagtatcctacacgacg\n\
+caggtccgcagtatcctggagggacgtgttactgattaaaagggtcaaaggaatgaaggc\n\
+tcacaatgttacctgcttcaccatagtgagccgatgagttttacattagtactaaatccc\n\
+aaatcatactttacgatgaggcttgctagcgctaaagagaatacatacaccaccacatag\n\
+aattgttagcgatgatatcaaatagactcctggaagtgtcagggggaaactgttcaatat\n\
+ttcgtccacaggactgaccaggcatggaaaagactgacgttggaaactataccatctcac\n\
+gcccgacgcttcactaattgatgatccaaaaaatatagcccggattcctgattagcaaag\n\
+ggttcacagagaaagatattatcgacgtatatcccaaaaaacagacgtaatgtgcatctt\n\
+cgaatcgggatgaatacttgtatcataaaaatgtgacctctagtatacaggttaatgtta\n\
+gtgatacacaatactcgtgggccatgggttctcaaataaaatgtaatattgcgtcgatca\n\
+ctcacccacgtatttggtctaattatgttttatttagtgacaatccaatagataaccggt\n\
+cctattaagggctatatttttagcgaccacgcgtttaaacaaaggattgtatgtagatgg\n\
+taccagtttaattgccagtgggcaatcctaagcaaaatgagattctatcctaaagtttgg\n\
+gcttgatataagatttcggatgtatgggttttataatcgttggagagctcaatcatgagc\n\
+taatacatggatttcgctacctcaccgagagaccttgcatgaagaattctaaccaaaagt\n\
+ttaataggccggattggattgagttaattaagaccttgttcagtcatagtaaaaaccctt\n\
+aaattttaccgattgacaaagtgagcagtcgcaataccctatgcgaaacgcctcgatagt\n\
+gactaggtatacaaggtttttgagttcctttgaaatagttaactaatttaaaattaatta\n\
+acgacatggaaatcacagaacctaatgctttgtaggagttatttatgctgtttactgcct\n\
+ctacaaccctaataaagcagtcctaagaatgaaacgcatcttttagttcagaaagtggta\n\
+tccagggtggtcaatttaataaattcaacatcgggtctcaggatattcggtcatataatt\n\
+tattaagggctcttcgagtcttactctgagtgaaattggaaacagtcatccttttcgttg\n\
+tgaggcatcttacaccgctatcgatatacaatgcattccaccgcggtgtcccgtacacaa\n\
+ggaaacttgttaccttggggatataagaaaactcacacgtctcattattaaactgagtac\n\
+aatttttgcacgagaaagtaatgcaatacaatatgatgaaagccagctaatgaaaaggga\n\
+tggaacgcacctcggatctgttgcactggattaaaatccgattatttttaaaaatattca\n\
+gtgctagagcatatcaggtctacttttttatctggtatgtaaagcccacggagcgatagt\n\
+gagatccttacgactcaacgaaaagttataacataactcccgttagccaaagcccaatcc\n\
+cgattactgccctaccctaacgtctgccatctaaatatcgaacttgttatgatcaatgtg\n\
+actacctcccaccctttccccttcatttgttccactggggataagctagcgttttcagaa\n\
+tcaatgcaataagaatagccaattgtctcacttcatcagagctcttggcaattccaggcg\n\
+ctacgtggttctggaatatattcatttttcaaatagtaatacgtttagtgttgctattgt\n\
+ctacacgtttggatattacgttatgtgagcggacatcaatagttgtctaactctttagta\n\
+agccagagatagcactcttagcgaatggataccatcttccataagtttagttaatagtcc\n\
+gaaacaactgcttcgagcatatttgaacctccttgtaggcaaatagcctcttcaaagcaa\n\
+tcttactaatagatagagtttgttttaagggactactagaaatgggacaatcttaatagt\n\
+atgacctaaactgacatttaaagatatatccaggtggcaagcataaagatcattgcgcca\n\
+cctccaccgtgggattacttatcagtcgatatcctatatgctaagtttgcgacggcagaa\n\
+tacaaactaagctgagttgatgctaaccttacctatgataccccattggaccggttaaca\n\
+gccctacttattccaaataaaagaacttttatgctgtagaagctattatagtgatgcctg\n\
+gtaacttcagtatattaaaatgacacacatacgccatatagagctcctggaactttgaat\n\
+aatgagcgaacttcgaagttgaagagcaagaaaccatatgtcacggttgcctaaagcccg\n\
+gtaaccagacatgtgctatcattgatcattatcgaggttttcataaccttgacccattat\n\
+cggctgtgcgcggacaagtacttaaatcactagtttcttcacctgcttatcggtaagaaa\n\
+taaggttggcaaagaatcgcataagacggacgtagagccgcagcgttgtgcgagtccagg\n\
+tgcatgcgcagcaataggattttaaattttgttccatttttaatttagccgtaaggatgt\n\
+ccgtaaatgattgaaaattggattcaatctttgggcctatgctactggaacctgatcgac\n\
+aaaatttcaaacatacgttaactccgaaagaccgtatttttgcggctagaatagtcagtc\n\
+gcttggagccatataccttaccacttaaacgacgtgctcctgtagttgaaatataaacag\n\
+aacacaaagactaccgatcatatcaactgaagatctttgtaactttgaggcgaagcaccc\n\
+tcttcgagacaactaagagtaaagtaccgggcgccgcaaggagtcgattgggaccctaaa\n\
+tcttgacgaattgctaagaggctcagagctaccactgtaatttctctagagcccataata\n\
+aatgaacgatacatccgtaggtagcacctaagggattataatggaagccaaatgcagtta\n\
+ataatattatatactggcgtacacgattcgacggatctctcacatagtgattcacgaccc\n\
+ccccctttgattgacacagcgtcagcattttgcaagaacgatcttctgcatagggtgcgc\n\
+caccgtaaggatgacgtcgaagctacaactgggtataatttaccatgcttccctgatgct\n\
+gagtgcaatacactaagaatgagtttttaccccatatcaccagtatttgttctgttattg\n\
+cgaagaaatggctatgctgagttggcgactaaagtcacccatcctttttattaggtaacc\n\
+ccctcccttaaactaactgatttgctggagctgccctgcatacatatactttatcattta\n\
+tggacgtccgtgacgcttattatccaccatagtcgatatgctacacggattcattaatgg\n\
+atcgtaggagtttaagttatatttactaagatcggtctcggctactatcccgccttaccc\n\
+ggcgctatttacggccatttttaatatattgacggtaattattcctatggtttcgaccgc\n\
+acgtccttggacaagaaagaatggcaaaaaaaatgtaaaagaaaaaaaatattgagtccc\n\
+taccatcatataaaaaatatgtgatgagtaacttgacgaaatgttagtggttattaaaga\n\
+ctatctattacaccttttgttttctgtcgtagtatattaaagtctagaagccttacagga\n\
+aaatcagggttatacagccgatactccgcagcatgaatcatcgaggaggtgtcctaccat\n\
+cgcgccttgtaatcttgtctgtgtatactgtatttagaccttttatacaaagtaaatatc\n\
+tcggctttatgtgattgggaggggcctactcaaacatgatgacttgacctaataatcact\n\
+gtgcgggcgtcttatgactagctattccttgaaatccaccaccaaatggttaatatgtaa\n\
+aaactttgacgatgaaacaaggtgaatgtgtagttactttgtgtaattagctgcgtcgag\n\
+cattgcttgtaaaaccgtcaatcgcacacgttacttccataaaatttctacgaatacacc\n\
+cttcttaaaaaaaacgtaggaattcacgagtttaacaaacgataactgtataaagtggaa\n\
+gtccgaagaaagcagatgcccgaactactcgaagatgtttcgttttcttaaccatagggg\n\
+cttcttaatggcccactacgcacattttgttcaagcccgagagggacatccccattacgg\n\
+gagtattactaaaactgttccgtaatacgttcagcaagggatgaaaaaggccactgctca\n\
+agttattgacgtgggagtattacatcggaagcctgaatcccacactatgatggtctgtac\n\
+aggcctagggactgcgtctagacggtattaccggcttctaatcatacgatcgtgagtctt\n\
+aacgggaagtaaggctcacacctaccccaaaccatttatctatgtaagtataaaattgtg\n\
+cgtaagtgttcaaagtggacaataaagacgtggcaaaaacccccgcacataagccgcttt\n\
+agatttcacaaataccaatgcggttaaaaacatccttgagtcgtacatacaccatactcg\n\
+cgttaaacggatataacagaagataataaatccggatgtggagtcggtgtaactatagaa\n\
+agccaagtgaaataatgcttaccagtcatttagctatacggctttcatttcatgtcaaga\n\
+gggtggagtttgacctgtacagttgatatatcaccgatacttagaactcacctaaagcta\n\
+aaattgctcgcagcgtgtaatccgcatattacaaacaatagatgggattcattatacata\n\
+agacacgatgatctgctttttcaggttgcgagatgttgcctatcgtcaatcgagtcctgc\n\
+cttacaccacttaaacaaaagtattgacagggaacctattttcgaggtattatatagtcc\n\
+agcttgaatatcaatttgacagttaacctagtgaaaatcagtaagaggaaatacgccaca\n\
+ttctccagtgaaattctacgggttatcgtctagtccaactatcaattataactcacgaga\n\
+tataagtaaattctcgtacttggcctgatttttattatactttggatccttagtaaacag\n\
+gaagggagaaaccttcaacgaaaaacactggattttgttttactctcaaagctcttatat\n\
+gacggaaataccctgtcaagtcttaactttattactagactaatgaaatgggcttggggt\n\
+ggccagaatcatagtacaatttagcggatacactattcggactttcctatcggctgtctg\n\
+gttggataagtatggggactaataggctagacatacctatacttaaactatacaggcgtc\n\
+atctatctctgcaactttggagttccctgatgttctcccgccctttgggttcacatcttc\n\
+tataccgacacccctaataacgattagtttgtgggttagagtaaattaatacggttaata\n\
+ttaatgtatcgttgaaaagctggtgtcgccaataaggtaaccggctaggcagagtatatg\n\
+tcacgaagtataactaccctaatgataagctgtaggaataaaattaatgctgtctctaag\n\
+cgaagagatatttccgactctgttttaatgacgaatctcattacttctgacttgcaaatg\n\
+ttcaatatggcacggtttcacggcacctttgtgacgcatataatgaacttagaagattat\n\
+aacgacggaactttatatgataatccgttacgattaaagaatctgttaaatatcataatg\n\
+gcattcagttctagaccgtgcatcatggtaaacttactttctctgcatggcgacatacat\n\
+ttcgctattcaaattcgcgtgtggttacacccactcgcacctttggaatattaagagaag\n\
+atgatcagaaaatccattcgctcaatttttctgacgtacgtctaatttatcctaggagac\n\
+aaatcgttttatgtctctcacatttttgaagaaaggttcgagagacaatactcaggtcct\n\
+gaactgctagaagatactcggtggagcgtggcaacaatgaaaaactcgtgacataaatga\n\
+atgatacttttccaagttcagttaagtgaatatgtttaacatacccggcttttcgatctt\n\
+aagctgacgctggacgtgcgagtaatgtcagtctcttacatacactagtgactccaagtt\n\
+tcgtcaaaaacgccccctcccttctcgagcccactcacgctatgtattgacgcgaacttg\n\
+ttcgggatcagacttttcaggagttcggtcgcgtgtccctatgtgctaatatataagtta\n\
+gatcgcattagatgctaatctgaatacttatagacgaccttcaacgagaacgggtaccac\n\
+cttgaggctagagttaggtgtgaaacgacaggtagggacatataaaatttgagtgcggct\n\
+ttagttaagggtttaattacctactcaaacatcacgctcgcgcccttcgtacgtaatcga\n\
+ccatctagaggctaaggggactgtactaggtagtgattaatgatatcctagacgcacgtg\n\
+ccttagatcttcagactctgatggtccgcgatcaccgtaattgtagtcctccaactcgat\n\
+cactttgttggcgtcaaagaaattacgatatctaaatacttataatacaataaccaagga\n\
+tgagaatgactcatcgcgttggagttatattgcttgaagttctatggaatgaaagcacgt\n\
+tatctgccgtcccaatatctccagtgagctaattcattggacggtccactttgatcaatc\n\
+cccgaggagatgttcggacactttagtctgtaacacttagcgttgagaccacgaacaatt\n\
+gattactcagtcttgaaggtgttttccaaagttcattttaaataagactacgataggcct\n\
+ttcctattgatataaactacccggctctgttgttcgtgtgagtcgtacttctctgtgttt\n\
+ttctgattatagcaagattcgattcttagtgtaaacagcgatttttatttgacccgtcaa\n\
+tgagaagcgcataggatctaagcaaaattatcaagttgtgccacaaggtaagatctttcc\n\
+agttattgcaggtaggatgtatcccacgttgatagtatgaggtctgacgtcaactgtcta\n\
+ggagagttgaccgcgtgcgggtacaccggatttgcatcgatgttgagaacgcagaactcc\n\
+cactgtcgtggcggcgttcctgatatttagcaagaggcgttgataaagccctcatcatct\n\
+agatctcgacctcatctgccctcttgctccatcattttctacacagactactttcctatc\n\
+tacgttagtataattgctttctatcttagtatcatttagagcttctccgtcaacaggttc\n\
+gtgctattaaagttagtacgaaagggacaacttgtagcaacgcatttaatcggttttcga\n\
+ctacttcgcacaaaatcagataaagaagtttgtcattctattagacattgaattgcgcaa\n\
+ttgacttgtaccacttatgatcgaacactgaatcaagactgtgattaactaaaatagaca\n\
+agccactatatcaactaataaaaacgcccctggtggtcgaacatagttgactacaggata\n\
+attaattggactggagccattacattctctacaatcgtatcacttcccaagtagacaact\n\
+ttgaccttgtagtttcatgtacaaaaaaatgctttcgcaggagcacattggtagttcaat\n\
+agtttcatgggaacctcttgagccgtcttctgtgggtgtgttcggatagtaggtactgat\n\
+aaagtcgtgtcgctttcgatgagagggaattcaccggaaaacaccttggttaacaggata\n\
+gtctatgtaaacttcgagacatgtttaagagttaccagcttaatccacggtgctctacta\n\
+gtatcatcagctgtcttgcctcgcctagaaatatgcattctatcgttatcctatcaacgg\n\
+ttgccgtactgagcagccttattgtggaagagtaatatataaatgtagtcttgtctttac\n\
+gaagcagacgtaagtaataatgacttggaataccaaaactaaacatagtggattatcata\n\
+ctcaagaactctccagataaataacagtttttacgatacgtcaccaatgagcttaaagat\n\
+taggatcctcaaaactgatacaaacgctaattcatttgttattggatccagtatcagtta\n\
+aactgaatggagtgaagattgtagaatgttgttctggcctcgcatggggtctaggtgata\n\
+tacaatttctcatacttacacggtagtggaaatctgattctagcttcgtagctgactata\n\
+ctcaaggaaccactgctcaaggtaggagactagttccgaccctacagtcaaagtggccga\n\
+agcttaaactatagactagttgttaaatgctgatttcaagatatcatctatatacagttt\n\
+ggacaattatgtgtgcgaaactaaaattcatgctattcagatggatttcacttatgcctt\n\
+agaaacagatattgcccgagctcaatcaacagttttagccggaaacaatcgaagcatagg\n\
+gacaatgtatcttttcctaaattgccatgtgcagatttctgagtgtcacgaagcgcataa\n\
+tagaatcttgtgttgcctcaactcgttgaaaagtttaaaacaatcgcagcagtctttttg\n\
+gggtctactgtgtgtttgcaaaataactgaaagaaacgcttgaacaactctgaagtagct\n\
+cgagtactcattaaagtgtaacacattagtgaatatcggccaatgaaccaaacgcttccc\n\
+ggtacgctatctctctcatcgggaggcgatgtgcaggttatctacgaaagcatcccttta\n\
+cgttgagagtgtcgatgcatgaacctcattgtaacaatagcccagcaaattctcatacgt\n\
+gcctcagggtccgggcgtactcctccatggaagggcgcgcatctagtgttataccaactc\n\
+gctttttaactactatgctgtagttctacaggcatagtggccagtattttctaacttctc\n\
+tggatagatgctctcactcctcatccatcacggcttcagtttacgtcttacttgcttgtt\n\
+cagcaacggatggaggcattaagtatcttcactgttccctaaaattgctgttcaatatca\n\
+aagtaaggacgatacagggaaagctcaagcacactcattgaatactgccccagttgcaac\n\
+ctcacttaatctgacaaaaataatgactactctaagtgttgcggaagcagtctcttccac\n\
+gagcttgtctgtatcacttcgtataggcatgtaactcgatagacacgaacaccgagtgag\n\
+aaactatattcttgcttccgtgtgtgtgacaccaggtaattgatgcggatataagctgga\n\
+gatcactcacgcccacacaaggcgctgctacctctttattccaatgtgtaagaatttgct\n\
+aacttcatttctagaccgcagctttgcggtcataatttcacggtacggacccttgggtta\n\
+gagacttgataacacacttcgcagtttccaccgcgcacatgttttagtggcttctaacat\n\
+agaatttttgttgtgacataaagagtgcgtgggagacttgcccgaccgttaagccataat\n\
+caattgaaagccccgtgagtcacatctaattggttgtactgcgcatttagctatccttta\n\
+gctgactcgaagagattcgattcctaatataggttaattagatggctgccgcgcgaagta\n\
+aaacgtgaaaaacgtagtgcgcagatctgcataactcgcgcttaattacttatgagtagt\n\
+tccaagttcgctacgttatgagagagattggaattaagcaaatatgttttatggtgattt\n\
+tgggatgagaaggactgctaagtacggctactaaacaaatttctaaaaccgccatctacc\n\
+ttatcttggagacatttaagttgtatatgtcactagtctagcttttgtctgtgggacgcg\n\
+ttctcggaatgagggaaatgcaagagccgattcatcaaatgcttatctaagaaagtagtg\n\
+gactattacaccaagcacgaatgccagggaactgctttcttgctcaggacctcgcgacaa\n\
+ggtaccccgcataagtcctagaattacatttggtcagcaatgctgacatttgaccgtgaa\n\
+aacataattttaatcagaaggcagctcacccgcttgctctagatcttatctttgtatgaa\n\
+tgtcagaatttactgcaatatccgttccgaatagtgagggcttagtatagttctctgtat\n\
+acaggtcacatcaaactccccctgtcctagtacagctctgagctttaattaattgcatac\n\
+atttccttcaatcatcagatgaaaacaccgcgaatcatgctcttctcgtatagggcaaga\n\
+gaagcaacaaacaactagcccgactcacgttcatccgccgtatccttgttcagttcttac\n\
+tccgtattaggtcagcgaaatctaatcagaataatcggtcgcgtatcaaaattaaaatcc\n\
+cgcttgaggttgacaattaaaacgctgagcagttatcggctattagatagtggggtgaaa\n\
+gtaattggctggaattatgttaaaacgtgatattaagctaaaatacgctacttgttgccg\n\
+acctaattcagtcattcgatattcagttagagccaagaataacaagcttgtataaattga\n\
+acggggtgcactaaacgatgtgttactctaatattcagcttggagtatacctgaaggcga\n\
+attcatgtatcggccaataataagacgttgaagatcacaatttggactagcaaaagaagg\n\
+tgatttatgcgtggggattgagtccactgtacgagtacggtctctggaaaattataggtt\n\
+cagggaatataaggaagtaaagataattaccaagagatttttggtatcgctatgacccag\n\
+aggtgttctaacgtctgttttgatccgcagaatttctgcctcaatgcatatttgacggac\n\
+ttgaactagagcctctaaagttaaatggcgacgcaactgttcctaaacttcaattattac\n\
+tactctttttttcctagggtattgtagaggccagtggacaaaataaatcaaatttaagat\n\
+gtttcggacattaacatcccccgtagcatagaaatcatcagttatccaatctctcatcga\n\
+gcttttacaatttctgctggcgctatggacagcatatgccgcgagacctccgcaagactc\n\
+acttgatcactgtaagtatcttcattagaggttagagcctatagttaagctgctgaccta\n\
+gtaaaattggtattttctaattttattgctcaagttaaaggttagtgaagggataatgac\n\
+gttatttttgaacaatgggttgtattcaattttatatcacgaatggaacccttcattccc\n\
+ggcataatactagacgacacgaacaagctccgatctatcagccaggcacgtgttaaggtt\n\
+taattccggcaaaccaatgaagcatcaaaaggtgacctgatgcaacttagggtcacgatg\n\
+agtttttcaggactacttattacctattaataagttaacatgagccttcataccccgtaa\n\
+gacaatacatactccaccaattagaattctgagccatcttatctttttgtatcatcgaag\n\
+ggtatggccgaataggttaattagttactcctaacgtctctacaggcatgcatttgacgc\n\
+accttcgaaaatagtcaatctctcgccacacgcgtctagtatgcagcatcaaaaatatag\n\
+tccacggtttccggattaccaaacgcggcaaagagaaacattgtatcgacggagataact\n\
+taatacagaaggaaggggcatcttcgaatacggatgaataattctatctgtttattctga\n\
+catcttgttttcaggttaatcttacgcattcaaatgacgcctgccccatgcgtgcgcaat\n\
+tattttctaatattgacgagagcaatctcactccttttgggtctatttatgttttattga\n\
+ggcacaagcctatacagaacaggtactattaaggccgtgagtgtgagactcaaaccgtgg\n\
+aaacaaaggatgggttgttcttggtacaagttttagtgcatgtgggcaatccttaccaaa\n\
+atcagatgctatccttaactttgggctgcatttaagatggcggttggaggcctgtgagaa\n\
+tcctgcgtgtcatctttaatgaccgaattcatccatgtagattcagatcacacactcatt\n\
+ccttgatgttgtctaaacaaaagttgttgtggacgcattggagggagttaagtaacaact\n\
+tgggatcgcatacttataaaaattatatgttaaactttcacaaacgctgaagtccaaagt\n\
+aactagcccaaacgcctcgagagtcactaggtattaatggtgtttgagttcctgtgaaat\n\
+agtgttcgaaggtaaaatttatgtaccaaatcgaaagaacacttaataaggcttgcttgc\n\
+acggaggtatgatgtttactgactctacaaccctaattttccagtacgtacattcattcc\n\
+aataggttagttctcaaagtgctatacaggctcctcaattgatgatatgcttcagccgct\n\
+ctatggatattagctcattttatttaggaagcccgcttagaggcttactatgagggaaat\n\
+gccaaaatgtcatacttttcggtgtgtcccatatgacaccgctttacatagaatttgaat\n\
+taaaacgcgctctcccgttcactaccatacttggtaccgtgcgcatattacatatagata\n\
+taggatcattttttaaagctgtactaggtttgatcgacaatcttatgctatactatatga\n\
+tgtaaccctcataatcaataccgatcgtacgatcctagcataggtggcaagcgattttat\n\
+gccgattattgtgttaaatagtctgtgagtgtgattatcagggctacgttggtagagggg\n\
+ttgtatagacctcgcacacattgtgacatacttaacaatatacgaaaactgatataataa\n\
+atccccttacccaaacaccaatcccgttgaatcaactaccataacgtctcccatataaat\n\
+tgcctacttgtttgcataaatctgaatacataacaccattgcaccttcttgtgttccaat\n\
+cccgttaagattgccttgtcagatgatatgcaagaacaatagcatttgctagcaattatt\n\
+aacagctcttcgaattgcctccacataacgcgggagggtatattttaatttggcaaatac\n\
+taagtactgttggcgtcatatgctattaacggttggatattaagttatgtcagccgtaag\n\
+caagagtgggcgaaatattttgttacccagtgagagcactcttagagtttggatacaata\n\
+ggccatatgttgacttaagaggacgtaactacgccgtacaccattgttcaaccgacttct\n\
+tggcaaatagaatcgtattagcaatcttaagaatagagacacgttcgtgttagggtatac\n\
+tacaaatccgaaaatcttaagaggatcacctaaactgaaatttatacatatttcaacgtg\n\
+gatagatttaacataattcagccacctccaacctgggagtaattttcagtagatttacta\n\
+gatgattagtggcccaacgcacttgactatataagatctggggatcctaacctgacctat\n\
+gagacaaaattggaaacgttaacagcccttatgtgtacaaagaaaagtaagttgttgctg\n\
+ttcaacagatgatagtcatgacgcgtaacttcactatagtaaattgaaacaaatacgcaa\n\
+tttagacagaatggtacggtcatgaatgacagtaattcgaagtgctagaccaacttaaaa\n\
+taggtaaacgtgcccgaaaccccccttaacagaaagctgctatcatggtgcagtatcgac\n\
+gtgttcagaaacttgtaacttttgagcaggtccgagcacatggaagtatatcacgtgttt\n\
+ctgaaccggcttatccctaagatatatccgtcgcaaactttcgatttagtcccacgtaga\n\
+gcccaagcgttgtgcgactccacgtgcatgcccagaaatacgagtttaaatttggttaca\n\
+tggttaattttgaccgaagcatcgcactttatgattgataattggattcaatatgtcgcc\n\
+ctatgcgaatgcaacatgatccacaatttggctataagacgtttaatccgtatcacactt\n\
+tgtttgcggctagtatagtaacgcccgtgcaccaagagtcagtaacaattataagtactc\n\
+cgcaggtacttcaaatataaaaactaatcaaacacgacccatatgatcatctgaagatat\n\
+ttggaactttctcgacaaccaccctcgtactcaatacttacactaatcgacaggcacacg\n\
+caacgtgtacagtcgcaccatattgagtcaagatttgcttagtggcgatgagcgtacacg\n\
+cttatttctctagtcacaattagttatctacgagacatcacgagggagcaaataagcgat\n\
+gttatggctacacataggcacgtatgaatatgatataagccagttaaacagtcgaaccat\n\
+cgagcaaattctcatgcaccaacccacacgttgaggcacaaagagtaagctgtttgaatg\n\
+taacttcttctgctgagcgggccccaacgtaaggatcaactagaagagaaaactcggtat\n\
+tagtttaaatgcgtcacggagcatgagtgcatttcactaagaatgtctgtgtaaccaata\n\
+taacatctatttgttatctgattgcctacttatggctttgcggtcgtggcgactaatgtc\n\
+tccaatccttttgaggtcggtaccaactccctttaaattacgctgtgcaggctcatgcac\n\
+tgcatacatatacggtagcaggtagggacctcacgcacccttattataatcaatagtagt\n\
+tatcagtcaacgaggcaggaatgctgaggtcgaggtgttggtatattttctatgtgccgt\n\
+ctaggcgactatcacgcattaccaggcgagatttaagccaattttgaatatagtcaacgt\n\
+aatttttactatgggttccaccgaaacgccttgcacaactaagaatcccataaaatatcg\n\
+atatcaaataaaagattgtgtcaataccttcatatatattttttcggttgactaacgtga\n\
+actaaggttaggggttttgtatgtctatataggaaacagtttcttttctgtcctacttta\n\
+gtaaagtcttcaagccttactccaaaatcacggtgattaagccgttactcagcagcatga\n\
+ttctgcctgctcgggtcctaaaatccagccttgtaagagtcgctgtgtattagctaggga\n\
+gacctttgttaaaaaggatatatcgcggcgggatgtgagtgcgtggcgcatactcaatct\n\
+tcagctcgtgtcattataatatctctcccccacgcttttcactagatatgccgtgtaagc\n\
+aaacaccttatgcttaatttcgaaaatattggtacttgaaaaaagctgtaggggtactta\n\
+atgtctggtaggagatcaggagagaattgagtgtaaaaccgtaaagccctcacctgactt\n\
+catgtaaatggcttagaagactccatgatttaataaatactacgaaggaaagactggatc\n\
+taaagataactctagtaaggccaactcccttcaatgctgttgccagttataatccaagag\n\
+ctgtccttttctgaaccatagcggcttctgaagcgaactagaagcaaagttggttctagc\n\
+cagacagccacataccctgtacgggtgtattactaaaactggtccggtattagttcacca\n\
+agggaggaattaggcaaaggatctaggtatgcaagtcggagtattacatccctaccctga\n\
+atccatcaataggttcctctgtactggccttcgcaatgagtattcaaggttgtacagccg\n\
+tataataataagatagtgactatgaacgggaagtaacccgctcaccttccccaaaacatt\n\
+gttatatctaagtattaaagtctgccgtagtgttaatactcgaaaataaacaactggcaa\n\
+attacaccgcacttaagccgcttttgatttatatttttccaatgcgcttttaaaaataat\n\
+tcagtcctacatactaattaagacccttaaacggagatatcacaagttaagttttaacca\n\
+tctcgactaggtggaactatagatacccaactcaatttatcattacctgtaatgttccta\n\
+gaaggattgcatttcatgtcaagacggtggagtttcacagcgaaacttcagtgtgaacag\n\
+attctgagaaatcacctaaacctattagtcagagcacccggttagaaccagttgtcaaaa\n\
+aatagagcggttgcatgagacagaagtaacgatgagatccgttgtaacgttgagacatct\n\
+ggcctatcgtcaatacagtcctcccttaaaaatatttttaaatactaggcaaacccaaca\n\
+taggttagtcctatgtgatacgccacatggtatatcattttgtaacgttacctagggata\n\
+atcaggaagtggaattacgcaaaagtagacagtgaaatgcttagggttatagtctagtcc\n\
+aaagataaaggataaagcacgtcagagaactatattagccgaatgggaatcattgttagg\n\
+agactgtggatcatgtctaaaaagcaacgcagaaacagtcatcgaaaaaatctcgttttt\n\
+gtttgaatctaaaagagctttgatgaccgatagtacctgtatactagttactgtattacg\n\
+tgtctaatgatttcggattggggtccccagaatcagacgtcattgtagacgattcaagtt\n\
+taccaatttaatttcccagctctccttggagaactatcgccaataattgcagtcactttc\n\
+cttttctgaaacgataaagccgtcagagttctctgcaacgttggacttacctgaggttct\n\
+aacccactttcggttctaatagtagttaacgacacaacgaataacctttactgtggggct\n\
+ttcacgatattttttcgcttattattaatggttacgtcataagctggtgtccaaattaag\n\
+gttaccggcttcgcagagtagttgtatccaagtataacttccctaatcataagatcgagg\n\
+tagaaaattaatgctgtctctaaccgaacagatatgtcccactatgtggtatggacgttg\n\
+ctaattacttctgaagggaaattggtcattatggatacgtgtctaccatcaggtcggacg\n\
+cagatatggttctgtcttcagttgatccaccgttctttataggataataactgacgatta\n\
+aagattatggtaaatagattaagccaattctcttcttgtcagtgaagcatccttaactga\n\
+cttgctctgcagcccctcatacatttagctattcaaagtaccggctcgtttcaaactctc\n\
+ccacctttggaagaggttgtcaacttgataagtatatcatttacagcattttttcggacg\n\
+tacctctaatgtttcattgcagaaaattagttttttctatcgcacattttgcaagtaacg\n\
+ttagagacacaattatctgcgaatgaactgctagatctgacgaccgggagcctcgcaaat\n\
+atcaaaaaagactgacatatatcaaggagtcgttgacaagtgctggtaagtcaattggtt\n\
+tatctgtcccggcgtttcgatcttaagctgaccatgcacggcagagtaatgtcactctcg\n\
+ttcttacaagtctgtctccaagggtcggcaaaaaagacccctccattctcgagcccactc\n\
+acgatatgtagggacgacaacttgtgcggcttatgaattgtctggactgcgggcgagggt\n\
+ccatatctccgaagttagaagggacatacctttagatgataagatcaattcttattgacg\n\
+aaattcatccacaacggggaacaacttcaccctagacttacgtctgaaaagacacctagc\n\
+gtcttataaaaggtcagtgccccgtttcgtaaggctggaattacctacgcaaacttaaac\n\
+ctcgcgcccttccttacgtatcgacaagatagaggctatcgcgaatgtactacggaggca\n\
+tgaatcatatactagaaccaagtgcctgtgatattaacaagatgatccgacgcgagcacc\n\
+gtaattctaggcataaaactccagcaatttgggggccgaaaacaaatgacgttagctaat\n\
+taattatatgacatgatcaaaggaggtcaatcacgcatcgagttcgacgtatattcattg\n\
+aacttcgtgcgtttgaaagaaacttttatgaaggcaaaattgatcctgtctcctatttca\n\
+tgcgtacctcctagttgataattccccgagcagtggttaggacacttttgtcggtatcaa\n\
+gttccggtctcaaaacgtaaaattctgtaatctgtatggatggtctgtgaattagttaat\n\
+ttttatgaagtcgtcgagacgcagttcctattgatttattctaaacggagatgtgcttcg\n\
+tgggactcggaagtagatctgtgtttatgattattgctactttagatgctgactgttaac\n\
+tccgtgttgtttttcaaccgtatatcacaaccgaattggatagaacctatagtttcaagt\n\
+tctgccacaaggtatcatatttacagttagtgctggttgcttctttcaaacgtggtgagt\n\
+ttgtgctatcacgtcaacggtagagctcagtggaccgagtgcgcgttcaaccctgttcca\n\
+gagagggtgtgatagcacatataccacgctcgtcgaggcgttcatgatagtttgcaagag\n\
+ccggtgttaaacacatattattattgttatccaactaatcggacctatgcataaagcatt\n\
+gtctaaacagaataattgcctatatacggtagttttagtgatttatatcttagtatcagt\n\
+tagagcttcgaactcttcaggttcctcatatttaacgttcttcgaaagcgaaaacttcta\n\
+caaacgaatgtaagcggttttccaagtagtacctataaatcacagaaagatctgtctcag\n\
+tatagttgaaatggtattcagctagtgacgtgtaccaattatcatagttcactcaagcaa\n\
+gacgctcattaacgaatatagacaagacactatatcatataataaaaaagaacatggtgc\n\
+tcgaacatagttgaattcaccatattgaaggggaatgctgacatgtaattcgctactaga\n\
+cgatcaattccctacttgtcaaagttgaactggtacgttcttggaattaaatatgattgc\n\
+gctggaccaaattgcgacttcttgagtttcagggcaaacgattgagccggaggatgtccg\n\
+tctcttacctttcttgcttatgataaacgacggtccctgtacatcactgggaattctcag\n\
+caaaaataattgggtaaatcgagactcgatgtattcggccacaaaggtgttagacgttaa\n\
+agattattcaacggggcgataataggatcataaccggtatgcaagcgcattgaaagagcc\n\
+atgagatccttatccgataaacgctgcacggtatgtgcagccttattgtcgatcacgaat\n\
+ttataaatgtagtctgggctgtaagttgaagacctaagttataatgaagtgcaataccaa\n\
+atcgattcatagtggattatcagactcaagatatctcctgataaattacagttgttaaga\n\
+tacggataaaatgagatttaagattagcagcctctaatctgtttcaatcccgttggaatg\n\
+tggtatgcgatcaaggttaagttaaaatcaagcctgtcttcagtcttgattcttgttctg\n\
+ccatcgcatgcggtctacgtgagttaatatgtagcttacgttctagcttgtgctaatctg\n\
+agtatagattcgtagaggaatattatcaagcttccacgcctcaacgtacgtgtattggtc\n\
+acacaagacactaaaagtggaagtagcgtaaactatagtctagttgttaaatgctcagtt\n\
+cttgttatattcgatatactcttggctaatttatgtctgagtatataaaattaatgatat\n\
+taacttgcatttcacggatcccttagaaaaagattttgaccgagcgcattataaacggtt\n\
+acaccgaatcaatagaagcatacccaatagctttctttgaatttattgcctgcgcaactt\n\
+ggctgactctctagatccgaataattctatatggtcgtgacgaaactagttcattactgt\n\
+ttaaaatgccaacatgtcttttgggccgataatggctctttgcaaaattactcaatgata\n\
+cgattgatcaaagcggtagttgctagtggtagcatgtaagtctatcaaatgtctgattat\n\
+ccgaaaatcttccaaaagagtccacgtaccatatctatctcatagcgacgcgaggggaac\n\
+cttatctaactatcattccatttaccgggtgactctcgatgcaggatccgattgggataa\n\
+attgcccagaaatggctcattcctgactaagggtaaggccgttctcagcaagggaacccc\n\
+gcgaatctaggcttataccatctagattgttaactacttgcctgtagttctacagccata\n\
+ctggacagttgtttctaaatgatcgggattcatgctagcactcctctgaatgcaccgcgt\n\
+aagtttaactattacgtccgtgggcagataaggatggaggctgtatgtatcttaactgtt\n\
+acctaatatggctggtaattatcaaagtaaggaccttaatgccatagcgctagcaatcgc\n\
+tttgtatactgaccatgtgccaacctctcttaatctgtaaaatataatgtcttagctaac\n\
+tgtggacgatcatgtctctgcctagagcttcgctgtatcaattcctatagccagcgtact\n\
+agtgacacaacaacaccgtgtgagaaaagatattagtccttacgtctgtctctctacagc\n\
+ttattgatgaggattgaacatggacatatagctccccctcaaaagcagatgctacctctt\n\
+tattccattctcgaacatttgccgaacttaatttcgacaaacctgaggtcacgtcttaat\n\
+ttatcggtaacgtcacgtccctttgagactggataaatatattaccaggggccaacgagc\n\
+aattgttggaggcgcttctataatacaaggtgtcttgtcaaagaaagacggcgtgcgtct\n\
+cgtgcaactcacttaaccaatattaatgtgaaacccccctctctcacatcttatgcggtg\n\
+tactgccctggtacatttcctgtacaggactccaacagtgtagattcctaagatagctgt\n\
+tggagttgcctcacgccagatcgaaaaactgaataaactagtgagctgagctgcagaaat\n\
+accgcttaattacttatgactagttcaaagggacctacgtgatgtcagacattgcaagga\n\
+agaaattaggtttgtgcgtcattttggctggactagcactccttacttcccctactattc\n\
+aaatgtcgtaaacagcatgagacaggatcgtgctgacatttaaggtctattgggaacgag\n\
+gctacctttggtcgcgcgctcgcgttctccgaatgaccgaaatgcatgagcacagtatgc\n\
+aattgcttatagatctaaggtctggtcgttgaaaccaagcacgtaggcctgggaaatcag\n\
+ttcttcctcagcaactacacaaaagcgtccaagcattagtacttgtagtaaatgtccgaa\n\
+cctatgcgctcatttgaaagtcaaaaaatatttttaagcagtaggcacctaacccgattc\n\
+ctctacttagtagctttctttgattctcagaattgactgcaatatcactgcacaattctg\n\
+tgccattactagacttctctgtattaacgtctcatcttactaacactcgcctaggacaca\n\
+tctgagagtgaagtatttcaatacatttactgaaatcttcagttctaaaatccccgaata\n\
+aggctcttatcggtttggccaacacaagaaaaaaacttcttgcaccactcaccttcatac\n\
+gcaggagcctggggaacttagtaataactatttcggcagacaaagcttataacaagttgc\n\
+cggcgcgtataatatttaaaagaccccttgagctgctcaattaaaacgctcacctggtat\n\
+aggctattagatagtgccgtcttagtaaggggcgggaattatcggataaactgatatttt\n\
+gataaaataaccgacttgttcacgacataagtcactaaggagattttatctttctccaaa\n\
+gtatatcttccttggataatttcaaagcgctgcaatttaagttctgttactagtttatgc\n\
+tgctgggaggtgaccggaaggcgtagtaatctagaggcaaattataagaagttcatcata\n\
+tcattttcgactacaaaaacaaggtgttgtatgccggcgcattgtgtaaactggacgagt\n\
+accctagatggaaaattatacgttaagccaagatttcgatgtaatgataattacctacac\n\
+atttttgctatccataggaacaagagctgttctataggctcgtggcatacgaacatttgc\n\
+tgccgctatgaatattggaagctcttcaactacagactctattcttaattgccgtcgaaa\n\
+atgggccgaatcggctattattaatactcggtttttccgaggggattgttgtcgacagtc\n\
+gtaattattattaatattgatgttggtgaggtcatttaaatacaaccttgcagacaatga\n\
+ataagggatccaatctctcatactccttttacaattgctcatgcccctatgcaaacctta\n\
+tgccgccacacctccgcaactctctcttctgaactgtaagtagcttcattactggtttga\n\
+gactatactgaagctgatgacattctaaaatggctattttcgaatgtgattcataatgtt\n\
+tatcgtttgggatggcagaatcacgttatttttgatatagcccgggtattctattgtata\n\
+gaacgtatgctacaagtcattccccgaagaagactagaagtaaacaacatgcgaccatcg\n\
+ttaagccacgcaaggctgtagctttatttcccgataacctatcttccataaatagcggac\n\
+agcaggatactgacgctcaacatcagtggttatggtctaatttttaacttttaataaggt\n\
+aacttcagcaggcatacacagtaactctttaatttataatcaaattagaagtctgacact\n\
+tcttatatttttctatcatccaacgcgatcgcccattagcttattgtgttactaataacg\n\
+tatctaaaccaatccttttcaagctactgcctatattgtcaatatatacaaacaacagga\n\
+tagtaggctgcttaaaaaatattgtcaaccgtgtacgctttacaatacccggaaatcaca\n\
+aactttgtagacaacgagtgaaatttatacactacgaagggccagcgtacaagacccatg\n\
+aattaggcgatatgtttattctgacatattggtttatccttaatctgtcgctgtaaaatg\n\
+aagccgcccccatccctgcgaattttttttcgaagattcacgactgaaatataaatacgt\n\
+ttggctatatttatgttggagggaggcaatagcctttactgttaaccgaagatttagcca\n\
+gtgagtgtgacactaaaacactggaataaatgcaggcgttcttctgggtaaaaggtttag\n\
+tcaatctcgcctataagttcatatagctctggatataattatctggcccatgcatttatc\n\
+atggcgcttggtgccctgtgtgaagccggcctctcatattgaaggtccgaagtattccat\n\
+gtacattaagatcactctctcattcatgcatcttggcttaacaaatctggttgtccaagc\n\
+tttccaggcacgtatggtacaaattcggatcgaatacttataaaaatgatatgttaaact\n\
+gtctaaaacgctcatctacaaagtaaagtgcactaaccaatagagtctcaagaccgtgta\n\
+atgctggtgcactgaatgtgtaatacggttagaagggattagttatgttacaaatccatt\n\
+gaaaacttaagaagcattgcgtgctcggagggtgcatcttttatcaagagactaacatta\n\
+ttttcaacgacgtacatgctttacaatagggtacttatcaaacgccgagaaacgcgccta\n\
+tagtgatgttatgattatgacccgatatccattggaccgaattttatgtaggttcccagc\n\
+gtactcgcgtaatatctcggtattgccataatgtaatacttgtcggtctctcccagatga\n\
+aaaagcgttacagagtatttcaatgaaaaacagcgcgcaacgtcaatacctttaggggta\n\
+acggccgctgatttcatatagatatacgataagttggtatagctctactaggtggcatcc\n\
+acaatcgttgcatttactatagctggttacaatcataatctataccgttccttacatact\n\
+accatagcgggatagcgtttttttgccgttgattgggtttaagaggatgtcagtctcatt\n\
+atatccgattcggtgggagagccgttgttttcaaatcgcacactttgtgacataatgtac\n\
+aagataacaaaactgatataagatataaactgtcaatatcaccttgacacttgaatcaaa\n\
+gtaaattaactcgcaaatataatttgactaattgggtgcagatttctcaattaataaaaa\n\
+aatggcaccggatgggcttacaagccccttatcattcacttgtatcatgatttccaagaa\n\
+caatagaatttgctagcaagtatgaacagagattcgaattgcatccacagtacgccggag\n\
+cgtttattttaatgtggatatgacgatgtactgttggcggcatttgctagtaaccggtcc\n\
+ttatttacgtagcgcacacgtaagcatgtctgggagaaatatggtggtacaatctcagag\n\
+aaagattacagtttggtttaaataggacttatcgggtcggaagtggaacttaataagcag\n\
+tacacaattgggcaacagacgtcttgcctattacaataggattacaatgcgttagatttc\n\
+agacacgttcgtgtttggctattcgtcaattccctaaatagttagacgatcaactattat\n\
+caaagtgattctttgttcatcctccattcatgtaacagatggcacactacgcataacgcc\n\
+gaggaattttaacgagatttaagagagcagttcgggcacaacccacttgactttataaca\n\
+gctcggcagcataaacggtaatatgtgacaaatttccaaacgttataagaacgtatgtgt\n\
+acttagaaaactaagtggttcatgttcaacagatgtgacgcagcaagcctaacttatcta\n\
+ttggttttgctataaaagaacaaagttacacagaatcctaagggcttgtttcacacttat\n\
+gcctagtgcttcaccatcttaaaatagcgaaaccggcacgaatcaaaccttaaaacaatg\n\
+cgcagatattggtgatggtgactccgggtatgataatggtaactgttgaccagcgcccac\n\
+ctcatcgaagtatagaaagtggttaggataaggatgagaccgaacttatttccggccata\n\
+actttagattttctacctagtacacaacatcagggcggacacgaaaccgccatcacatca\n\
+tataccaggtttaatttgcttaatgggggaagtgtcaacgaaccttcgaactttagcagg\n\
+catatggccattatatatggccccagagcagaatgctacagcagacaaaatttggattta\n\
+tgtagtttaatacctatcaaacttggtgtgaccatacttgtctaacgacagtgcacaaag\n\
+tgtaagttacaattattactactcagcagcttctgcaatgataaaatcttatcatacacg\n\
+tcacatatgataatatctacttagggggaacgggctccacaacctacatagtactcaata\n\
+cttacactattcgacaggcacaccaaacctgtacagtcccaaaagattgagtcaactttg\n\
+cagtactgcagatcacagtaatagcttagttagcgagtcaaaattagttttctacgagac\n\
+tgcacgaccgtgcaaatttccgatgtgttggctacaaatagcaacgtatgaatttgtttg\n\
+aagccacgtaaactgtacaaccttagagataagtctcaggctactaaaaacacgttgtgg\n\
+cactaacaggatcatggttgattcttacttattcggctgaccggcccaataagtaacctt\n\
+caactagaacagaataatcgggagtagtttaattcagtcaaggtgcaggtctcattgtaa\n\
+ctaacaagctctgtgtaaccaagttaaaatcgttttcttagcggattccctacttatgga\n\
+tttgagctcgtccacaatattcgatacaagaagtttgtggtccgtaacaacgaaatttta\n\
+attacgctgtgcagcctcatccaaggaattaatagaaggttgatggtaggctccgaacgc\n\
+tccatgattataatcaagtggactgtgcagtaaacgaggaaggtatcctgacgtcgtggt\n\
+gttcgtttttgttatttgtgccctatacgagtagataaaccatgaacagcacagtgtgaa\n\
+cccatggttgattttaggctaccttatttttaatttccgttacacagaaacgaattccac\n\
+aactaacatgccattaatttttcgatatcttataaaagatggtcgaaattcattcattta\n\
+ttttttttcggttctcgaaagtcaactaagctgtcgcgttttgtttctctttagaggtaa\n\
+aagtggctttgatctcctacgtttggatactagtcaaccattactccatttgatccgtga\n\
+gtatcacctgtctaacatccagcattatgactcctcggcgaagaaaagacacacttctta\n\
+gagtcgatgtgtattagctagggacacagttgtttaatacgatagtgagcccagggaggg\n\
+cagtgcgtcccccagtagatttattcagctagtgtaagtataagatatctcacccacgag\n\
+gttcaagtgatatgcagtcttagaataatacttatcctgaatttcgatattatgggtact\n\
+tcaataatccgctagcgctactttatgtctcgttggacagcaggacacatggcagtctta\n\
+aacactaaagacatcacctgaatgaatgtaatgggattacaagaatcaatgaggtattat\n\
+atacgacgtaggaaactctggatatatacagtaatctagttacgccatcgcacttcattc\n\
+ctctggaaacttagaagacatcagctgtacgtggaggaaccagacccccgtatgtagcca\n\
+aatagaaccaaagttgcttatacaaacacacccaatgacaatggaccgctggagttcgta\n\
+aactcggaacgtagtactgcacaaacccagcatttagcaataggagctacgtatgcaact\n\
+cccacgtggtaataccttcaagctatcaatatataggtgcctagctaatcgcattcgcaa\n\
+gcagtattcaagcttgtaaaccagtataataattacagaggctctatgaaacccaacttt\n\
+ccagctaaaagtcccaattaaatggttatttcgtacttttaaagtcgcccgttctgttat\n\
+tacgcgaattgattctactccaaaattaaacacaaattatcaaccgtttcatttatattt\n\
+gtcaatgcagctgtttaaaataaggctctactaaattataattaagacacttattaccag\n\
+atttctctagttaagtttgaaccagctcgactaccgcgaaagatacattcccttctctat\n\
+ttttcagttcatctatgggtcagagaagcattgaatttattctattcaccctcgtcgttc\n\
+acagcgaatcgtcagtgtgatcagtgtatgagaaatatcctaaaccgtttagtcagacca\n\
+cacgcttagaacaagtggtctaaaaagactgccctggaaggagtaagaagtatacagctg\n\
+atccggtgtatccttcagtcatctgccctatactaattacacgacgcaaggaaaaatagg\n\
+tttattttctaggcaaacccttcataggtgactccgatgtgttacgaatcatgcttgaga\n\
+atgtgctatcgttaccgacggataataacgatctccaatgaaccaaatgtagaatgtcta\n\
+ttgattacccttttactattcgacttagagataggagatagaacctcagtgtactttttt\n\
+agccgaatgggaatctttgggaggtgaatggccataaggtcgtaaatccaaccctcttaa\n\
+agtcttccatattatatcgttgttcgtggaatcgataacagatttgttgacccatagtaa\n\
+atgtatactagtttatgttgtaagtgtagattgttttccgattgccgtccaaactttatg\n\
+tcgtaattgtagaccagtaaagttgaccaaggtaagtgcccagcgatcctgcgagatcga\n\
+tcgccaatttttccagtcactgtaagtgtaggtttagataaagccgtatgagttatatca\n\
+taagggcctcggaaagcagcttcgaaccaaagttcccttataatagtagtttaactataa\n\
+aagtatatactggtctgtcgccctttcacgatttgttttaccggtttatgaagcgttacg\n\
+tcattagagcggctccaatttaaggttaacggcttccatgtgtagttgtatacaaggata\n\
+acttaaagtatctgttcagcgagctagttaagttatcctcgatagaacacaactcagagg\n\
+tcccaagatcgggtttgcaacttgctaatttattctcaaggcaaattgggaattatcgat\n\
+acctgtataccataaggtcgctcgatgtgatgcttatgtcttctggtgatcctaccttag\n\
+ttagtgctgattaacggaacattaatgtttatcgttttgagatttagccaattctctgat\n\
+tctaactcaagatgccttatctgacgtgctatgcagcccctaagtattttacattgtaat\n\
+aggacacgctcctttaaaactcgccaaaaggtcgttgtggttctctactggttaactata\n\
+taatttacagctttgttgagctagttcctctttggtttaagtcctcaatattagttggtt\n\
+cgagcgataagttggctagttaccttagtcactatattagatccgaatgttatgcttcat\n\
+ctgaagaccgccaccctccaaaatttcttttaagactcacttattgcaaggtgtaggtga\n\
+attcggctcgtttctcaagtggtgtatctgtacacgagtttccatattttcatcaacagc\n\
+caccgcacacttatgtcactctaggtattaaaagtcgctctacaaggggacgcaattaag\n\
+aaacagacatgctagtcaaaaataaacatagcgaggcaccactaattcggccgcttatca\n\
+atgggatgctctgcgcgagacgcgccagagctcagtagttagttcggacatacatttact\n\
+tcagatgatcaattagttttctacaaatgcttactctaccccgaaaaaagtcaccagact\n\
+cttacgtctctttagtatccttccgtcttatataaggtcagtcccccgtttcggtaccct\n\
+ggaatttactaagaataatgaaacagcccccaaggacgtacgtttacaaatgatagacca\n\
+gatcgcctagcttattccgacgcatgttgcatagaattgaaccaacggaatgtgagagta\n\
+actagatgagccgaccacagcacccgtttgcgtcgcagaatacgcctgatagttcggcca\n\
+cgaaatcatatgtcctttgagtattaagtatttgtaatgatcaatcgagctcaagcaagc\n\
+ttacacttcctcggatattcagggaacttagtgcctttgaaagatacgttgatcaacgaa\n\
+aaattgataatggctcatatggaatgcctacctcatagtgctgaattaacacagcactgc\n\
+ggacctaacttttcgaggtttcaagttcacgtctcaaaacctaataggctggaatatgta\n\
+gggatcctcggtgaatttgtgattgggtttgttgtagtactgaccaagtgaatattcttt\n\
+ttttctaaaagcagatctgctgccgggcactacgaaggagatctctgtgtatcattattg\n\
+cttcttgacatgatgactcttaaatcactgtgggtgtgcaaaacgatagcacaacccaat\n\
+tcgatagtacatattgttgatacttcgcactaaaccgttcatatttaaaggttgtgctcc\n\
+ttccttcgttaaatactggtgacttggtcctatctactattagctagacctctggggaac\n\
+cacgcccccgtaaaacctgtgcaagagagggggtcatacatcttagacatcgcgcctcca\n\
+ccagggaagcattgggtgattgaccaggtgtgtaacaaatatgattattcttatactaat\n\
+attagcaaagatgcataatgatttgtattaaatgtataattgaattgataagggtctttt\n\
+agtcagtgatagagtagtataaggtagacattagaactcttaaccggacgcagatttttc\n\
+ggtcttagtaagccaattagtcgacaaaacaaggtaagagcggttactagtagtacctat\n\
+aatgcactgaatcttcggtcgaagtatagttctaatgctatgcagattgtgacggcgaca\n\
+aatgttcagacttatatcatgaaacaagctcttgtaagtattgacaaatgaaaagattga\n\
+atatttttaaatacaaaatgcgcctacttattaggggaattaaccagattgaaggccaat\n\
+cctcacatgtaatgagataatagacgataaatgaaattcttgtaatagttgaactgctac\n\
+gtgatgggtattatatatgattgagatcctccaattgccgacgtcttgtcttgatgccca\n\
+aaagattgtcaacgaggagctccctcgcgtacctgtcgtccgtatcataaacgacgcgac\n\
+atgtacagcactccgaagtataagcaataataatgcgggtaatccagactagatcttttc\n\
+ggactcaatgcggtttcacggtaaacatgattaataccggagagtagtcgagcttatcag\n\
+cgatgcaagcgaattcattgtgccaggagatacgttgcagataaaaccggcaacgtatgt\n\
+caacaagttttggcgatctcgttgtttgtattcgacgaggcgcgggaacttcaagaacta\n\
+tcgtatattcaagtccattaccttttagtttcagactggtggagctgactaaagttatat\n\
+catcattttgtacactggtttagttaacgataatttcagatttaacatgaccagacgata\n\
+atcgctgtatatccagttggaatgtggtttgccagaaaggttaacttataatcaagcctc\n\
+tcttcagtcttgattcgtcgtatcccatccattgcgctatacctcagtgtatttggagct\n\
+gtagttataccgtgtgctaagatcagtagacatgacgagagcaatattatctaccttaca\n\
+agcatcaacggacgtctagtcggaacaaaagactctaaaactcgaacttcaggttaatat\n\
+actatagttctgtattcagcagttattcttatattcgatattatcttgcctattggatgt\n\
+ctgactttagtatattaatcatagtatctgccatgtaaaggtgccagtactaaatctgtt\n\
+tcacagtgcgaattataaacggttacaaccattaaagacaacaagaccctatagctttat\n\
+ttgaattttgtcaatgcgcaacttggagctcgcgatacatcccaattagtctatagggtc\n\
+gggacgattctacggcatttctggttataatgacaacatggattgtggcccgagaatcgc\n\
+tctttcattaattaagcaatcattacagtcttataagcgctacttccgagtggtagcagg\n\
+taactcgatataaggtcgcatgagccgaatagcttaaaaaacaggccaccgaacattgat\n\
+agagaataccgaccacagcgcaacctttgattactttcattaaattgtacggctcactcg\n\
+acatcaagcttaagattgcgataatgtgaactcaaatggatcagtactgaagaaccgtaa\n\
+cccacttcgcagaaagcgtacccagagaagatacgctgttacaatatacagggtgaaatt\n\
+attgcctgttcttcgtaaccatttcgccaaacttggttagaaatgatagccattcatgat\n\
+agaaataagctgaatgataccagtatctttaactatgtagtcagggggaagataacgatg\n\
+gtccatgtatgtttctgatatgtgacagtattggccgcgtaatttgctaacgaagctact\n\
+taatgcctttgagcttcatatagatttctttaatcaaaatcggcaaaaagatagtatgag\n\
+ctataatatatgctagtagagaactctggaccatcatctatatgaatactgattcgagcg\n\
+tgcaattactttagcctgcgtactactgactctacaaaacactctgagataagtttgtag\n\
+tcagtaagtcgctctctataaaccttttggatgaccattgtacagccacttatagatccc\n\
+aataaatagcacaggagacagagtttttcaatgctcgatcatttgccgatagtattttcg\n\
+tctaacctcagggcacctattatttgatacctaacctaacggccctttcacaatggagaa\n\
+atatatgacatcgggacaaacacaaatggtgggtggccaggagatatgacatggtggcgt\n\
+ctctaagaaacacggactccctctaggcaaactcacgtaaccaattttaatgtcaaacaa\n\
+aacgctcgaaaagattttgccgtgtaatgacctggtacattgactggtcaggaatacatc\n\
+actgtagttgccgtagtgtcctgttggtgttccatcaagacacatcgtataacgcaattt\n\
+acgacggacatcagatcaagttatacagattatttaagtatcacgtgtgcattgggacat\n\
+aagggatctcacacatgccttggaacatttttgctttgtgccgctttttcgctgcactac\n\
+caatccttacttaccagtatattcaaaggtcgttaacagaatgagaaaggttagggctct\n\
+aagttatcgtcgattgggatagacgagacatttgcgagcgccctccacggatacgaatct\n\
+cccatatcaatgtgaactggatgctatgcagtttagttcttacgtctcctagtggtaaaa\n\
+atcaaagtagcactcgcatagcagttattcagaacctaatacacaaaaccgtcaaacatt\n\
+ttctaattctaggtatgggccgatcataggagctaaggtgaaactcataaatgttttgtt\n\
+agatctagcatcctaaaaagatgcatatactgagtagctggcgtgcattctctcaattgt\n\
+atcctttttaactgaactagtcggtcccatttcgtgactgagatctattaaccgataaga\n\
+ttaataacactcgcattcgtatcagctcagagtgaagtttttcaataatttgactgatat\n\
+attaacttctaaaataaccctttaagcctcggatccgtttcccaatcacatcaaaaattc\n\
+ttattccaactatctacggattaacaacgtgcatggggatcgtagtaagaacttgttccg\n\
+atcactttgagtatatcaagttgacggcccggttattattgaatagaaacattcacctgc\n\
+taaattaaataccgcacatcggatacccgatttcagagggccgtcttactaagggcaggc\n\
+tttgttcggtttaactgagatgttcattattttacagtatgcttcaactaatatgtaacg\n\
+aaggacagtggatctgtctccatagtagatcttcagtcgtgaatttcataccgctcctat\n\
+ttaagttcgcgttcgagttgttgatcatggcacgtgaaagcaacccctagtattctagac\n\
+gaaaattttttctagttcatctgataatttgccaattcaaaaacaaccgctggtttcccg\n\
+gcgcattctctaaaatggaagtcgaacctagagccattatttgtcggtaacccatgagtt\n\
+ccttcttttcagaagttaatacactgtggtcctatacagaggaaaaacagcggttatata\n\
+cgatcgtggcataacaacattggatcaagatagcaatttggctacctattctaattctca\n\
+ctagattcggtattccactacaatatcggcagattaggattggatgaataatcggtgttt\n\
+aagtccggttgcgtctccaatctcctaatttttattaatattgatcttggtgacctattg\n\
+taaataaaaacttcaagactttgaataacggtgaaaagatagaagactcatttgaaaatg\n\
+gatcatccacagatccaaacattagcaagacactaatccccaactagctattctgatcgc\n\
+gatcgtgctgcagtactcctgtcacaatagtctgttcatgatctaattctttttgggctt\n\
+tgttcgatggtgattcagaatctttatccggtcgcttccctgtagctactttgtggggat\n\
+attgcccggggattatagggttgagatcgtttcctaaaagtatttaaaccaagtagactt\n\
+caactaaactacatcagaacatcgtgaagacaccatacgcggtacctttatttaccgata\n\
+acatttcttcaagaaataccggtaagcagcataatgaccctaaacagctcggggtatcgt\n\
+cgtagttttaaattttatttaggttactgctcaaggaataaaaactaactatttaattta\n\
+taataatattacaaggctcacactgattagatttgtctataagacttcgcgatcccccat\n\
+taccggattgtcttaagaataaactagataaaccatgcattttctagataaggcctttag\n\
+tctaattagatacaaaaaacacgatagttgcatccttaatttattgtgtcaaacctggaa\n\
+ccttttaattacccgcaaatcactttatgtcgagactacctctgaaatttattatctacc\n\
+taccgcatgaggacttgaaccatcttgtaggagttatgtttattagctaagattcgttta\n\
+tcctgtagcggtccatgtatattcaacaagcaaaaagcactcagaattgtttttagttga\n\
+gtcaagactgatatataaataagtttccctagttttttcgtggtgggacgatattgaatt\n\
+gaatcttaaccgaagagtttcccactctgtcgcacaataatacacgccaatatttccagc\n\
+cctgcttatgccttaatcggttactcaatctcccattgaagttcattttgatctgcatag\n\
+aagtttcgggcccagccttttttctgccaccttcctccaagctctgtagacgcactctaa\n\
+gattgatgctcacatgtattaattctacattaacataaatatataagtcatgcatcttcg\n\
+agtaaaatatctggttctccaacatgtcctggcacgtatcgttataatgcccatacatgt\n\
+agtattaaaatgattgggttaactggatattaagatcatcgaaattgtaaagtcaaatta\n\
+acaatactgtctcaagaccgtgtattcctcgtgctcggaagggctattacgcttacttcc\n\
+gttttggtatcttaatatgactttcaaaaattaagttgcagtgagtcctacctgcgtgca\n\
+tcggttagcaagagtataaaagttgtttaaacgaactacttgctttacaataccggtcgt\n\
+atatatcgccgtgaatccagaagattgtcttctttggattatcaaccgagatcctgtgga\n\
+ccgatgttttgggaccttcacagaggactccaggtagagctcgcttttgcattaatctaa\n\
+gaattgtacctctctaaaagatctaaaacagtgaatgtgtatttcatggaaaaacacaga\n\
+gaaacgtaaattactttaggccgaaaggcacatgagttattatacatatacgagatggtg\n\
+gtatacatcgaattcggggcatacactatagttgcattgtatttagctgctttaaataat\n\
+atgatattaccttccttacataagacattaccggcataccctggttttcaacttgtgggg\n\
+ctttttgacgatcgcactctcatttgatccgagtagggcggtgacccctgcttttcaaat\n\
+acaaaaatttcgctatgaaggtaatagattacttttcgctgttatgatagaaacggtaaa\n\
+tttaaaattgaaacttctagaaaagtaaagtaacgagaaatgattttgtgaataatgcgg\n\
+tcatgattgcgcaagtaagaaaaaaaggcaaaaggatgcgcggaatagaaacttatcagt\n\
+cacgggtatcttgatttcattcttcttgtcaattgccgacataggatgaaatcagattcc\n\
+aatgcaatacacagtaacccccacccttgattgtaatgtcgatttgaagttgtacgcgtc\n\
+gacgaagtggatagtatacgggccttttgtacggtgcgatcaactatgaatctcggcgag\n\
+ttagatggtcgtacaatctcacacatagaggtcacttgcctgtaatgacgaattttcggc\n\
+taggtactcgaactttattagaagtaaaaatgtgggcaaaagaaggattccattttacaa\n\
+gacgattacaatgagttacatgtctctcaacgtagtctttccctagtagtctttgaacta\n\
+tttaggtactccagaaaattttagcaaagggtttctgtgtgaatccgccattcatgttta\n\
+tgatggaacaataagaataacgccctcgtatgttatcgacagtgaagtcagcagttcggc\n\
+caaaaacatattcaatttagtacagatccccagaagttaagctaagtgctctaaaatggc\n\
+ctaaacggttatcaaagtaggtctaattactatactaacgggtgcatcgtaataactgct\n\
+gtcgatgcaacactatatgatagtgtcgttttgctatatatgtacaatgtgacaaagaag\n\
+ccttagcgattcttgcaaacttaggacttcggattctcaatcttaaatgtccgaaaacgc\n\
+aaagattcaaaaatttaatctatgagcagatatgcctgatggtgactacgcgtatgttaa\n\
+ggctaaatgttgacaaccgcacacataatcgaactattgatagtcgggagcataaccagg\n\
+tgaacgtactttgttcacgacatttattgacatgttctaaatacgtctcaaaatcacggc\n\
+gcactagaaaacgcaatcaaatcattgtcctggtttaagggccgtaatgccggtagtgtc\n\
+aaacttcatgagaactttagctggcttttggccagtatttagggaccaagagcactagcc\n\
+ttaagctgaatattttgccatttatctactgttataactttaaaacttggtggcaccaga\n\
+cttgtcgatacacacgcatcaatctgtaacgtaaaaggtttactaagaacaagcgtagga\n\
+attgagtttatattatatttaaactaaaagatgatattagcttctgagggcgatagggct\n\
+ccaaatcataaagaggaatatattattacacgattagaaacccacaacatacctcgaatc\n\
+gcccaaaagtttgacgaaacttggcagtactccacatctcagtaatacagttgggagagt\n\
+ctcaaatgttgttttattactcaatgaaccaccctcataatttcactgctgttccattaa\n\
+atttgcaaacgatcatttgctttgaagaaacgtaaaatcgacaaaattacagataagtag\n\
+atgcataataaaaaaaactgctcgctataacacgatcatcgtgcattcttacttaggagc\n\
+atcacccgcacaataacgtaccttaaactacaacactattagaccgagtactgtaattca\n\
+cgaaagctcaagctcgcattgtaaagaacttgctctctcgtaaaatgtgataatagtttg\n\
+cggagaggattcaattattttccattgcacctactccactagattcgataaaagaaggtg\n\
+gtcctcccttaaaaagaaatgttaagtaacatcggaaccataagcaaagcatgtaagtga\n\
+accgtcatccttccctaagaaacataaaggtttttaataatgtcgactgtgaactataac\n\
+tgcatcctttcctgacctactccggttccttgttgttatttctgaacgagaccagtagat\n\
+aaacaatgtaaaccacagtgggtaccaatggtgcatgtgacgctaccgttgttttaagtg\n\
+cccgtacaaacataagaagtcataatcttacttgaaattaattttgccttttattttttt\n\
+tcaggctcgaaattaatgatttgttttttttgaccttctagttacgctaatatgcggtcg\n\
+cctgtggtttctattgagtcctataacgggatgggatctaatacgtttggttactagtaa\n\
+acaaggtataaatttgataccggagtatcaactgtataacatcaagctttatgactcata\n\
+cgcgaagtaatgacacaaggctttcaggagatcgcgagtacagagccactaaggggtgta\n\
+ttacgatagtgacaccaccgagcgcactcactccccaagtagatttatgatcctacgcta\n\
+agtattagatatataaccaaagaggttctagtcagtgcaactcttagaataataattagc\n\
+cggttttgcctttttaggcctaatgcaatattcagctagcccttatgtatctcgcgttcc\n\
+acagcaccactcatggcacgcgtttaaactaatcaaatataatctatgaatgttatgcca\n\
+gtacttgaataaatcaggttttttataagtccttgcatactctcgttatatactgttaga\n\
+gtcttaccccatagaaattctttcatctgcaaacttagaagaattctcagctacggggag\n\
+cataaagtccccaggatgttgacaaatacaacaaatgtggcttatacaaacactccatat\n\
+gaaaatcgaaccctcgtggtagttttagccgaaccttgtacggataaatccctccatttt\n\
+ccaatagcagatacctatcctactacctcgtggtattaaattaaagcttgaaatatagag\n\
+ctgcatagcttatccaattcccaagcacgagtctaccgtcgtaaccacgatttgatttac\n\
+agacgctagagcaaacccatctttaaacatataagtaaaaattaaagggtgagtgcgtac\n\
+gtgtttactagcaacttcgcttattaagacaattgtttataagccataattaaaaacata\n\
+tgttcaacaggttcattgatatttgtaattgcacaggtttttaataaggatctacgtaag\n\
+tataatgaacaaactttttaccagagttatattctgtactttgaaaatgctcctctaccg\n\
+ccttagagactttcaattagattttttgcagttaatctatgcgtaagtgaaccatgcaag\n\
+ggatgcgattcaaccgcctcgtgctaaccctatcgtctgtctcataactgtaggtctaat\n\
+ataattttcagttttcgaacacataaccctttgaaaatctgctatttaatgtctcacctg\n\
+catgcactatcttctatactgctcagaacggctatacgtcactatgctccaagtgacgat\n\
+ttaaacgaagcaaggaataataggtttattttagtgcaaaacaattaagtgcggactacg\n\
+tgctctttacaataagccttgtgattgggctataggttaagtcccatattaacgatctcc\n\
+aatgtacaaaatcgacaatcgctttgcattacccggttactagtcgaattacagatagct\n\
+gttagatactcactctaattttggacaacaatcccaatcttggggtcgtctatcgcctga\n\
+agctcgtaaatccttccatcttaaacgattacatattatagacttgttcggggtagagat\n\
+atcacagttgtgcaaacattgtaaatcgatactagtttatgttggtagtctagttgcttt\n\
+taccattccccgaaaaacttgatctactatttcgacaacagtaaacttgaactaggtaag\n\
+tgaaaacagagaatgcctcatagtgccactatttgtccactatatgtaagtgtagcttta\n\
+cataatccactatgactgagatcattacggcctaggaaagcagcgtagaaaaaaagggcc\n\
+cggatattacgactgtaactataaaactagttactggtagcgcgccatgtatagatttgt\n\
+tttaccggttgtggttgcgttaacgaatttcagccgcgaaaattgatccgttaaccagtc\n\
+catctcgacttctataaaacgataaagtaaagttgatgttcagcctccttcttatggttg\n\
+catcgagagtacactactcagtgggaaatagatcggggttcctacttcagattgtattat\n\
+ctaggcaattgccgattgtgccatacctggataaaataagctacctacatgtgatgctta\n\
+tctattatcgtcatactaccttagggtgtcctgttgaacgctacattaatctttagccgt\n\
+ttgagatgttccaatggataggagtctaacgcatgatgaagtttaggaaggcagagcatc\n\
+ccactaagtatgtgacagtgtatttcgaaacgagacgttataaatagaaaaaaggtcctt\n\
+ctggttctattctgctgaactattgaatggaaagattggttgacctacgtactatttgct\n\
+tgaagtcatcaatttgacggggtgagagacatatggtgcatactttacggactctatatt\n\
+ttagatcagaagcttagcagtcttctctacaccccctcacgacataattgcttttaagaa\n\
+tctatgtttgattcctctacgggaattcggatccgttcgcatgtgcggtttatctaaacc\n\
+aggggacatatgttcagctaaagcatacgaacactttgctaactagacgtatgtatagta\n\
+gctataaatcccgacgatatttacaaaaagaaatgagactcaaatatatacatagcgacc\n\
+ctacacttattcgcaccctgatctaggcgatcctagcacccacacccgaaagtgagcact\n\
+agtgtcttccgtattaaatttactgcagttgagattttagttgtctactaaggattactc\n\
+taacccgtaataaggatcaagactcggtactagctttactatcattccctatgtgttttc\n\
+ctaactcacaagggtacgtaccagcctatgtaattacaataatgataaagacacaaagga\n\
+agtaactttacaaatgagtctccagttacactagcttagtccctcccatcttgctttgaa\n\
+gtctaaatacgcaatctctgaggatatacagcagaagaacactcataacgttggagtcca\n\
+agaattagactcatagggcccccaacatttaatatgtactgtgagtttgaaggtgttcta\n\
+ttgttaattcctgctcttgatacatgacacgtactccgtgtttaaggcttcggactgact\n\
+ttctttcataagttgagcaacgaaaatttcagaatcgataagttggattcactaactaat\n\
+acggctgattgaaaactccactccggacctatatggtcgacctttatacgtaaccgatat\n\
+aaaacttataggctggtatatcgagccttcctagcgcaatttcggatggggtttcttcta\n\
+ctactcaacaacggaatagtctttgtttagtaaaccagagctcaggacgcccaatacgta\n\
+ggagagcgctgtggagcatgtgtcattatggactggagcactcttaaatcactctgcgtg\n\
+tgctaaacgatagatcataacatgtcctgagtaaattttcttgatacgtcgcaatatacc\n\
+gttattagttaaacgttctcatccgtcatgcgtgaaatacggctgtcgtgctcagatata\n\
+ctattagcgactcatctcgcctaacacgcacacgtataaactcggaatgactgccgctct\n\
+tacatattagaaatacagactacaccacggaagcattgggtcattctcaaccgctgtata\n\
+aaagatgattagtcttataataagattaccaaagaggcagaatcatgggtagtaaatcta\n\
+ttattcaagtgattaccgtcgtgtaggcagggagtgaggacgagatggtactcaggacaa\n\
+atattaaccggacgaagtggtttacgtcgtactttcactattagtagtaaatacaaggta\n\
+acaccggggaatagtactaaatataatgatatctatcttcgggagaacgagtcgtctatt\n\
+gctttgaacattctcaaggcgtaaaatgtgctgacttatagcatgatacaaccgattgtt\n\
+acttttgtctattcaaaagattgaatagttttttatacaaaagccgcatacttatgacgg\n\
+ctagtatacagtttcatcccctagcatcaatgctatggacagtattgaacttataggaaa\n\
+ttcttctaatagggcaaatccgtcgtgatgcctattttttttcagtcacatcctcaaatg\n\
+gcactagtattgtcgggatcccattaacaggctcaaccacgagctcacgcgaggacatgt\n\
+agtccgtatctttaacgaagcgacagcgacagaactcccatggataaccaattataaggc\n\
+ccgtaatcctctagacatcgtttaccaataaatccgctttctccgtaatcatgttgaata\n\
+ccccagagtagtccagatgataaccgatgaaacacaagtctttctcaatgcacttacggt\n\
+gaacttattaccgccaacgtagctcatcaaggttgcgacatctagttgtgtgtttgcgac\n\
+gagcccagcgaacttcatcaactttcgtatattcaacgccttgtaattttactttaagac\n\
+gcctggtgatgtagattcttagataatcagtttgttatcggctgtactttaccataattt\n\
+cacaggtttcaggtcaagaagattatagctgtatatacagttccatgctcggtgcacaga\n\
+aacgtgatcggataataatcaatcgcttatgtcgtctttaggcgtatccaatacatgccc\n\
+cgataccgcagtgtatttcgacatgtaggtataccgtcgcatttgagctcgagtcaggac\n\
+gtcagctagattagattccttaatagaatataccgacctctagtccgaactaaactatag\n\
+ataacgccaacttcaggttaattgtctagtcgtctgtttgcagatgggattcttagatga\n\
+gtgagtatcggccatattggttcgagcactttagtttttgatgcataggatatgcaatgt\n\
+atagctgaaagtactttatctgtttcaaactcacattgattaaaccggtaaacctttaaa\n\
+gactacaagaaaatattcagtgagggcaattttgtcaatcacaatcttccagctagagat\n\
+acttcacaatttgtcttgaggctacgcaacattagacggattttcgcgttttattgaaat\n\
+aatcgaggggcccaagagtatccatagttcattttgtaagatttctttacaggcttatta\n\
+cagcttcttcagactcctacatgcttacgagttatatgctagcatgtgaacaatagatta\n\
+atatacaggaaaacgtacattgagagagatgaccctacacagcgcaaccgttgagtactt\n\
+tcattaaagggtaacgctctcgagacagcatccttaagatggccttattgtcaaatcatt\n\
+tgcagaagtacgcaagatccctaaccaacgtagaagaatccctacaaacacatgagacgc\n\
+ggtgaaaatagacagggtgttagtattcaatcttcggagtatcaatttcgccaatcttgg\n\
+tgagaaagcataccctttcttcagagaaagaagatcaatcataacactatctttaacgag\n\
+gtacgcacgcgcatcattacctgcctccatggatctttaggatagcggaaagtattggca\n\
+gcgtattgtgatttcgttcctactttatcaatttcacattcatatacatgtcttttatca\n\
+aaatcgccaataagataggatgagctatattagatgctagtagagttcgcgccaacatca\n\
+tcgataggaatactcaggacagcgtgataggacttttcaatccctaatactctctataat\n\
+tataactctctcttaagtttggaggcagtaacgcgctctatataatcagtttgctgcacc\n\
+attcttcagcctctgatacatacaaataaattccacagcagtaagagggtttaattgaga\n\
+catcttgggaacttaggattttactctaacatcaccgaaacgattattggataccgtacc\n\
+taaacgaactttctcaaggcagtaatataggacatccgcaataacacaaatgctgcctcc\n\
+ccaggagttatgtcttcctggaggctatatcttacacccactcactataggcaaactaaa\n\
+gtttaaatgttgattgtctaaaaaaaagatagataagagttggccggcgtagcacatgcg\n\
+aaagtgaatcgtaagctataattctctggacttgaagttctgtcctgttcctctgcaaga\n\
+aacaaacttcctttaaagctatttacgacgcacatctcagcaagttataaacatgttgga\n\
+agtttctagtcggaattcccaaagaacggatctatctaatgcattcctacatttttcctg\n\
+tctgccgatggtgccatcctattcaaagaatttcttaaaagtagattaaatgggactttt\n\
+aacaatgagtaaccttacgcctctaagggttcctcgagtgccatacaccagtcaggtccg\n\
+agccacatacacggagaacattctaacatagcattctcaactcgatcatttgcaggttac\n\
+ttctttcctatcctagtgctaaaaatcatacttgcaatcccatagcacggattaagaacc\n\
+taagaaacaattcagtaaaacatgttcgaattcttggtatgggaacatcattgcagctat\n\
+ggtctaacgcattaatgtttgggtacatcttccatcatataaacaggaagagtctgacga\n\
+cagggagtgcttgcgatcatgtctatcattgtgaaatcaaattgtagctcacatgtcgtc\n\
+tatgagagcgtgtatccgataagatttagaaaaatagaagtcgtataagatctcactgaa\n\
+cttttgaatgaatgtgaagcatatatgatctgctttaataaaactttatccataggatac\n\
+gtttccaaatcaattcaataattattagtcaaaatagataaggatgaacaacctgaaggc\n\
+cgatcggacgtagaaagtggtcccatcactttgagttgatattgttgaaccacacgttat\n\
+tatggttttcaaacagtctcaggatattgtatatacagataatccgataccagttgtctg\n\
+acgcccctcttacgtaccccaccctttgtgacgtttaaagcagttgttcagtattttaaa\n\
+ctaggcggcaactaatttggaaagaagcacagtggatatgtctaaattcttgttattcag\n\
+gcctgaatttaatacaccgcatagttaacttcgcggtagagttgttcatcatgcctcctc\n\
+taagctaccacttctatgatacaccaatagttgttctacggaatctgataattggccaag\n\
+tcataaacttccgctgcgttcaacccccttgctcgaatatccaactcgaaaagacagcct\n\
+tttggtgtccggaacaaatcagttacttcttttctgatgttaattctctgtggtcagata\n\
+cagaccaaaaactccgcggatttaccatcctccaagaacaaatttgcatcaacatagcat\n\
+tttggctacatattctaagtctcaatagtttaggttttcaactacattatcccaacatta\n\
+ggattggaggaataatagctgggtaagtccccttgcgtctacaatcgactattttttatg\n\
+aatatgcttctgccgcacctatggttattaaaaaagtcatgactttgaagaaccctgaaa\n\
+agatagatgaatcaggtgtaatggcagcagccaaagagcatataattagcaacactctaa\n\
+gaacattatagatatgatgatagcgatcgtcatgatgttatccggtcacaatagtagctt\n\
+catcagctaattcgttttgccagtggtgacttgcgctggaagaatcgttatacggtccct\n\
+tccctcttgatacggtgggggcttattcaaccgcgtggattgggttgtcatacttgcatt\n\
+aaacgatgtaaaccatctagtagtcaactatactaaatcacaaaatagtgatcaatacat\n\
+acccgcttcatggttttaaccatttaattgattaaagatattccgctaagaaccattatc\n\
+tacctaaactgatcgccgtatcctagtagtttgaaatttgatgtaccgtaatgatcaacg\n\
+aagtaaaacgttatattgtatgtagaataataggtcttggagctaaatgatgtgattggt\n\
+agtgaagacttacccttacaactttaccggtttctcggaagaatatactagagaatcaat\n\
+gcatgggctacataagcactttagtctaatgagataaaaaatacacgagtcttccatcat\n\
+gaattttttgtcgaaaaactcgaacctggtaatttaaaccatatatctttatgtcgtcaa\n\
+taactctcatatgttttatataacttcccaatcacgacttgtaactgcttgttcgactga\n\
+gctgtttgagctatgaggccgggatccggttgagctacatctatttgctacaagaaaaat\n\
+gaaagcacatttgttgggagttctggctacactcatagagaaataagtggcccgagtggg\n\
+tgcggcctgcctccatattcaagtgtatcttaaaccaagtggttccaacgctcgcgctaa\n\
+agaattaaagcctttatttcctccacggagtagcccgtaatccggttcgaaagagaccat\n\
+tgaagttaattttcatatccagtgaagtttaggcacaagcatgtgttctgccacatgcct\n\
+caaagcgctcttcaaccaagatatgattcatcctaacttcgatgaatgcgtctgtaacat\n\
+aaatatagaaggaatgattcggcgagttaattttcgccttctccaacatggcatccctac\n\
+gttcgttataaggaccatacatgtaggttttaaaggtttgcggttaatcgatatttacat\n\
+catagaaattctatagtcaaatttacaagactctagatactcactcgttgcagccggcta\n\
+ggaagcgctttgtaccttacttcccttttcgttgcgtaatatgaatttcatatagtaagt\n\
+tcaaggcactcatacctccgtgaagagggtagatagactattaaagttgtttaatagtac\n\
+gtattgatggaaatgacccgtaggagatttaccactcaatccacaagattcgctgctgtg\n\
+cattatcaaaacagtgcatgtcgaaacatgggttgggtccttcaaacacgaatccaggta\n\
+gagatacctttgcaattttt\n";
+
+dnaInput = dnaInput + dnaInput + dnaInput;
+
+var ilen, clen,
+ seqs = [
+  /agggtaaa|tttaccct/ig,
+  /[cgt]gggtaaa|tttaccc[acg]/ig,
+  /a[act]ggtaaa|tttacc[agt]t/ig],
+ seqs2 = [/ag[act]gtaaa|tttac[agt]ct/ig,
+  /agg[act]taaa|ttta[agt]cct/ig,
+  /aggg[acg]aaa|ttt[cgt]ccct/ig],
+  seqs3 = [/agggt[cgt]aa|tt[acg]accct/ig,
+  /agggta[cgt]a|t[acg]taccct/ig,
+  /agggtaa[cgt]|[acg]ttaccct/ig],
+ subs = {
+  B: '(c|g|t)', D: '(a|g|t)', H: '(a|c|t)', K: '(g|t)',
+  M: '(a|c)', N: '(a|c|g|t)', R: '(a|g)', S: '(c|t)',
+  V: '(a|c|g)', W: '(a|t)', Y: '(c|t)' }
+
+ilen = dnaInput.length;
+
+// There is no in-place substitution
+dnaInput = dnaInput.replace(/>.*\n|\n/g,"")
+clen = dnaInput.length
+
+var dnaOutputString;
+
+window.onload = function(){ startTest("sunspider-regexp-dna", '');
+
+test("DNA Match (1)", function(){
+	for(i in seqs)
+    		dnaOutputString += seqs[i].source + " " + (dnaInput.match(seqs[i]) || []).length + "\n";
+ 		// match returns null if no matches, so replace with empty
+});
+
+test("DNA Match (2)", function(){
+	for(i in seqs2)
+    		dnaOutputString += seqs2[i].source + " " + (dnaInput.match(seqs2[i]) || []).length + "\n";
+ 		// match returns null if no matches, so replace with empty
+});
+
+test("DNA Match (3)", function(){
+	for(i in seqs3)
+    		dnaOutputString += seqs3[i].source + " " + (dnaInput.match(seqs3[i]) || []).length + "\n";
+ 		// match returns null if no matches, so replace with empty
+});
+
+test("DNA Replace", function(){
+	for(k in subs)
+		dnaInput = dnaInput.replace(k, subs[k]) // FIXME: Would like this to be a global substitution in a future version of SunSpider.
+		// search string, replacement string, flags
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-string-fasta.html b/tests/sunspider-string-fasta.html
new file mode 100644
index 0000000..774a7f1
--- /dev/null
+++ b/tests/sunspider-string-fasta.html
@@ -0,0 +1,104 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Great Computer Language Shootout
+//  http://shootout.alioth.debian.org
+//
+//  Contributed by Ian Osgood
+
+var last = 42, A = 3877, C = 29573, M = 139968;
+
+function rand(max) {
+  last = (last * A + C) % M;
+  return max * last / M;
+}
+
+var ALU =
+  "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" +
+  "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" +
+  "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" +
+  "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" +
+  "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
+  "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
+  "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
+
+var IUB = {
+  a:0.27, c:0.12, g:0.12, t:0.27,
+  B:0.02, D:0.02, H:0.02, K:0.02,
+  M:0.02, N:0.02, R:0.02, S:0.02,
+  V:0.02, W:0.02, Y:0.02
+}
+
+var HomoSap = {
+  a: 0.3029549426680,
+  c: 0.1979883004921,
+  g: 0.1975473066391,
+  t: 0.3015094502008
+}
+
+function makeCumulative(table) {
+  var last = null;
+  for (var c in table) {
+    if (last) table[c] += table[last];
+    last = c;
+  }
+}
+
+function fastaRepeat(n, seq) {
+  var seqi = 0, lenOut = 60;
+  while (n>0) {
+    if (n<lenOut) lenOut = n;
+    if (seqi + lenOut < seq.length) {
+      ret = seq.substring(seqi, seqi+lenOut);
+      seqi += lenOut;
+    } else {
+      var s = seq.substring(seqi);
+      seqi = lenOut - s.length;
+      ret = s + seq.substring(0, seqi);
+    }
+    n -= lenOut;
+  }
+}
+
+function fastaRandom(n, table) {
+  var line = new Array(60);
+  makeCumulative(table);
+  while (n>0) {
+    if (n<line.length) line = new Array(n);
+    for (var i=0; i<line.length; i++) {
+      var r = rand(1);
+      for (var c in table) {
+        if (r < table[c]) {
+          line[i] = c;
+          break;
+        }
+      }
+    }
+    ret = line.join('');
+    n -= line.length;
+  }
+}
+
+window.onload = function(){ startTest("sunspider-string-fasta", '');
+
+var ret;
+var n = 16;
+
+test( "Homo sapiens alu", function(){
+	ret = fastaRepeat(4*n*10000, ALU);
+});
+	
+test( "IUB ambiguity codes", function(){
+	ret = fastaRandom(3*n*100, IUB);
+});
+	
+test( "Homo sapiens frequency", function(){
+	ret = fastaRandom(5*n*100, HomoSap);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-string-tagcloud.html b/tests/sunspider-string-tagcloud.html
new file mode 100644
index 0000000..a847743
--- /dev/null
+++ b/tests/sunspider-string-tagcloud.html
@@ -0,0 +1,282 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+/*
+    Portions from:
+    json.js
+    2007-10-10
+
+    Public Domain
+*/
+
+// This test parses a JSON string giving tag names and popularity, and
+// generates html markup for a "tagcloud" view.
+
+if (!Object.prototype.toJSONString) {
+
+    Array.prototype.toJSONString = function (w) {
+        var a = [],     // The array holding the partial texts.
+            i,          // Loop counter.
+            l = this.length,
+            v;          // The value to be stringified.
+
+        for (i = 0; i < l; i += 1) {
+            v = this[i];
+            switch (typeof v) {
+            case 'object':
+
+                if (v && typeof v.toJSONString === 'function') {
+                    a.push(v.toJSONString(w));
+                } else {
+                    a.push('null');
+                }
+                break;
+
+            case 'string':
+            case 'number':
+            case 'boolean':
+                a.push(v.toJSONString());
+                break;
+            default:
+                a.push('null');
+            }
+        }
+
+        return '[' + a.join(',') + ']';
+    };
+
+
+    Boolean.prototype.toJSONString = function () {
+        return String(this);
+    };
+
+
+    Date.prototype.toJSONString = function () {
+
+        function f(n) {
+
+            return n < 10 ? '0' + n : n;
+        }
+
+        return '"' + this.getUTCFullYear()   + '-' +
+                   f(this.getUTCMonth() + 1) + '-' +
+                   f(this.getUTCDate())      + 'T' +
+                   f(this.getUTCHours())     + ':' +
+                   f(this.getUTCMinutes())   + ':' +
+                   f(this.getUTCSeconds())   + 'Z"';
+    };
+
+
+    Number.prototype.toJSONString = function () {
+
+        return isFinite(this) ? String(this) : 'null';
+    };
+
+
+    Object.prototype.toJSONString = function (w) {
+        var a = [],     // The array holding the partial texts.
+            k,          // The current key.
+            i,          // The loop counter.
+            v;          // The current value.
+
+        if (w) {
+            for (i = 0; i < w.length; i += 1) {
+                k = w[i];
+                if (typeof k === 'string') {
+                    v = this[k];
+                    switch (typeof v) {
+                    case 'object':
+
+                        if (v) {
+                            if (typeof v.toJSONString === 'function') {
+                                a.push(k.toJSONString() + ':' +
+                                       v.toJSONString(w));
+                            }
+                        } else {
+                            a.push(k.toJSONString() + ':null');
+                        }
+                        break;
+
+                    case 'string':
+                    case 'number':
+                    case 'boolean':
+                        a.push(k.toJSONString() + ':' + v.toJSONString());
+
+                    }
+                }
+            }
+        } else {
+
+            for (k in this) {
+                if (typeof k === 'string' &&
+                        Object.prototype.hasOwnProperty.apply(this, [k])) {
+                    v = this[k];
+                    switch (typeof v) {
+                    case 'object':
+
+                        if (v) {
+                            if (typeof v.toJSONString === 'function') {
+                                a.push(k.toJSONString() + ':' +
+                                       v.toJSONString());
+                            }
+                        } else {
+                            a.push(k.toJSONString() + ':null');
+                        }
+                        break;
+
+                    case 'string':
+                    case 'number':
+                    case 'boolean':
+                        a.push(k.toJSONString() + ':' + v.toJSONString());
+
+                    }
+                }
+            }
+        }
+
+        return '{' + a.join(',') + '}';
+    };
+
+
+    (function (s) {
+
+        var m = {
+            '\b': '\\b',
+            '\t': '\\t',
+            '\n': '\\n',
+            '\f': '\\f',
+            '\r': '\\r',
+            '"' : '\\"',
+            '\\': '\\\\'
+        };
+
+
+        s.parseJSON = function (filter) {
+            var j;
+
+            function walk(k, v) {
+                var i, n;
+                if (v && typeof v === 'object') {
+                    for (i in v) {
+                        if (Object.prototype.hasOwnProperty.apply(v, [i])) {
+                            n = walk(i, v[i]);
+                            if (n !== undefined) {
+                                v[i] = n;
+                            }
+                        }
+                    }
+                }
+                return filter(k, v);
+            }
+
+            if (/^[\],:{}\s]*$/.test(this.replace(/\\./g, '@').
+                    replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, ']').
+                    replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+                j = eval('(' + this + ')');
+
+                return typeof filter === 'function' ? walk('', j) : j;
+            }
+
+            throw new SyntaxError('parseJSON');
+        };
+
+
+        s.toJSONString = function () {
+
+            if (/["\\\x00-\x1f]/.test(this)) {
+                return '"' + this.replace(/[\x00-\x1f\\"]/g, function (a) {
+                    var c = m[a];
+                    if (c) {
+                        return c;
+                    }
+                    c = a.charCodeAt();
+                    return '\\u00' + Math.floor(c / 16).toString(16) +
+                                               (c % 16).toString(16);
+                }) + '"';
+            }
+            return '"' + this + '"';
+        };
+    })(String.prototype);
+}
+
+var tagInfoJSON = '[\n  {\n    \"tag\": "titillation",\n    \"popularity\": 4294967296\n  },\n  {\n    \"tag\": "foamless",\n    \"popularity\": 1257718401\n  },\n  {\n    \"tag\": "snarler",\n    \"popularity\": 613166183\n  },\n  {\n    \"tag\": "multangularness",\n    \"popularity\": 368304452\n  },\n  {\n    \"tag\": "Fesapo unventurous",\n    \"popularity\": 248026512\n  },\n  {\n    \"tag\": "esthesioblast",\n    \"popularity\": 179556755\n  },\n  {\n    \"tag\": "echeneidoid",\n    \"popularity\": 136641578\n  },\n  {\n    \"tag\": "embryoctony",\n    \"popularity\": 107852576\n  },\n  {\n    \"tag\": "undilatory",\n    \"popularity\": 87537981\n  },\n  {\n    \"tag\": "predisregard",\n    \"popularity\": 72630939\n  },\n  {\n    \"tag\": "allergenic",\n    \"popularity\": 61345190\n  },\n  {\n    \"tag\": "uncloudy",\n    \"popularity\": 52580571\n  },\n  {\n    \"tag\": "unforeseeably",\n    \"popularity\": 45628109\n  },\n  {\n    \"tag\": "sturniform",\n    \"popularity\": 40013489\n  },\n  {\n    \"tag\": "anesthetize",\n    \"popularity\": 35409226\n  },\n  {\n    \"tag\": "ametabolia",\n    \"popularity\": 31583050\n  },\n  {\n    \"tag\": "angiopathy",\n    \"popularity\": 28366350\n  },\n  {\n    \"tag\": "sultanaship",\n    \"popularity\": 25634218\n  },\n  {\n    \"tag\": "Frenchwise",\n    \"popularity\": 23292461\n  },\n  {\n    \"tag\": "cerviconasal",\n    \"popularity\": 21268909\n  },\n  {\n    \"tag\": "mercurialness",\n    \"popularity\": 19507481\n  },\n  {\n    \"tag\": "glutelin venditate",\n    \"popularity\": 17964042\n  },\n  {\n    \"tag\": "acred overblack",\n    \"popularity\": 16603454\n  },\n  {\n    \"tag\": "Atik",\n    \"popularity\": 15397451\n  },\n  {\n    \"tag\": "puncturer",\n    \"popularity\": 14323077\n  },\n  {\n    \"tag\": "pukatea",\n    \"popularity\": 13361525\n  },\n  {\n    \"tag\": "suberize",\n    \"popularity\": 12497261\n  },\n  {\n    \"tag\": "Godfrey",\n    \"popularity\": 11717365\n  },\n  {\n    \"tag\": "tetraptote",\n    \"popularity\": 11011011\n  },\n  {\n    \"tag\": "lucidness",\n    \"popularity\": 10369074\n  },\n  {\n    \"tag\": "tartness",\n    \"popularity\": 9783815\n  },\n  {\n    \"tag\": "axfetch",\n    \"popularity\": 9248634\n  },\n  {\n    \"tag\": "preacquittal",\n    \"popularity\": 8757877\n  },\n  {\n    \"tag\": "matris",\n    \"popularity\": 8306671\n  },\n  {\n    \"tag\": "hyphenate",\n    \"popularity\": 7890801\n  },\n  {\n    \"tag\": "semifabulous",\n    \"popularity\": 7506606\n  },\n  {\n    \"tag\": "oppressiveness",\n    \"popularity\": 7150890\n  },\n  {\n    \"tag\": "Protococcales",\n    \"popularity\": 6820856\n  },\n  {\n    \"tag\": "unpreventive",\n    \"popularity\": 6514045\n  },\n  {\n    \"tag\": "Cordia",\n    \"popularity\": 6228289\n  },\n  {\n    \"tag\": "Wakamba leaflike",\n    \"popularity\": 5961668\n  },\n  {\n    \"tag\": "dacryoma",\n    \"popularity\": 5712480\n  },\n  {\n    \"tag\": "inguinal",\n    \"popularity\": 5479211\n  },\n  {\n    \"tag\": "responseless",\n    \"popularity\": 5260507\n  },\n  {\n    \"tag\": "supplementarily",\n    \"popularity\": 5055158\n  },\n  {\n    \"tag\": "emu",\n    \"popularity\": 4862079\n  },\n  {\n    \"tag\": "countermeet",\n    \"popularity\": 4680292\n  },\n  {\n    \"tag\": "purrer",\n    \"popularity\": 4508918\n  },\n  {\n    \"tag\": "Corallinaceae",\n    \"popularity\": 4347162\n  },\n  {\n    \"tag\": "speculum",\n    \"popularity\": 4194304\n  },\n  {\n    \"tag\": "crimpness",\n    \"popularity\": 4049690\n  },\n  {\n    \"tag\": "antidetonant",\n    \"popularity\": 3912727\n  },\n  {\n    \"tag\": "topeewallah",\n    \"popularity\": 3782875\n  },\n  {\n    \"tag\": "fidalgo ballant",\n    \"popularity\": 3659640\n  },\n  {\n    \"tag\": "utriculose",\n    \"popularity\": 3542572\n  },\n  {\n    \"tag\": "testata",\n    \"popularity\": 3431259\n  },\n  {\n    \"tag\": "beltmaking",\n    \"popularity\": 3325322\n  },\n  {\n    \"tag\": "necrotype",\n    \"popularity\": 3224413\n  },\n  {\n    \"tag\": "ovistic",\n    \"popularity\": 3128215\n  },\n  {\n    \"tag\": "swindlership",\n    \"popularity\": 3036431\n  },\n  {\n    \"tag\": "augustal",\n    \"popularity\": 2948792\n  },\n  {\n    \"tag\": "Titoist",\n    \"popularity\": 2865047\n  },\n  {\n    \"tag\": "trisoctahedral",\n    \"popularity\": 2784963\n  },\n  {\n    \"tag\": "sequestrator",\n    \"popularity\": 2708327\n  },\n  {\n    \"tag\": "sideburns",\n    \"popularity\": 2634939\n  },\n  {\n    \"tag\": "paraphrasia",\n    \"popularity\": 2564616\n  },\n  {\n    \"tag\": "graminology unbay",\n    \"popularity\": 2497185\n  },\n  {\n    \"tag\": "acaridomatium emargination",\n    \"popularity\": 2432487\n  },\n  {\n    \"tag\": "roofward",\n    \"popularity\": 2370373\n  },\n  {\n    \"tag\": "lauder",\n    \"popularity\": 2310705\n  },\n  {\n    \"tag\": "subjunctive",\n    \"popularity\": 2253354\n  },\n  {\n    \"tag\": "subelongate",\n    \"popularity\": 2198199\n  },\n  {\n    \"tag\": "guacimo",\n    \"popularity\": 2145128\n  },\n  {\n    \"tag\": "cockade",\n    \"popularity\": 2094033\n  },\n  {\n    \"tag\": "misgauge",\n    \"popularity\": 2044818\n  },\n  {\n    \"tag\": "unexpensive",\n    \"popularity\": 1997388\n  },\n  {\n    \"tag\": "chebel",\n    \"popularity\": 1951657\n  },\n  {\n    \"tag\": "unpursuing",\n    \"popularity\": 1907543\n  },\n  {\n    \"tag\": "kilobar",\n    \"popularity\": 1864969\n  },\n  {\n    \"tag\": "obsecration",\n    \"popularity\": 1823863\n  },\n  {\n    \"tag\": "nacarine",\n    \"popularity\": 1784157\n  },\n  {\n    \"tag\": "spirituosity",\n    \"popularity\": 1745787\n  },\n  {\n    \"tag\": "movableness deity",\n    \"popularity\": 1708692\n  },\n  {\n    \"tag\": "exostracism",\n    \"popularity\": 1672816\n  },\n  {\n    \"tag\": "archipterygium",\n    \"popularity\": 1638104\n  },\n  {\n    \"tag\": "monostrophic",\n    \"popularity\": 1604506\n  },\n  {\n    \"tag\": "gynecide",\n    \"popularity\": 1571974\n  },\n  {\n    \"tag\": "gladden",\n    \"popularity\": 1540462\n  },\n  {\n    \"tag\": "throughbred",\n    \"popularity\": 1509927\n  },\n  {\n    \"tag\": "groper",\n    \"popularity\": 1480329\n  },\n  {\n    \"tag\": "Xenosaurus",\n    \"popularity\": 1451628\n  },\n  {\n    \"tag\": "photoetcher",\n    \"popularity\": 1423788\n  },\n  {\n    \"tag\": "glucosid",\n    \"popularity\": 1396775\n  },\n  {\n    \"tag\": "Galtonian",\n    \"popularity\": 1370555\n  },\n  {\n    \"tag\": "mesosporic",\n    \"popularity\": 1345097\n  },\n  {\n    \"tag\": "theody",\n    \"popularity\": 1320370\n  },\n  {\n    \"tag\": "zaffer",\n    \"popularity\": 1296348\n  },\n  {\n    \"tag\": "probiology",\n    \"popularity\": 1273003\n  },\n  {\n    \"tag\": "rhizomic",\n    \"popularity\": 1250308\n  },\n  {\n    \"tag\": "superphosphate",\n    \"popularity\": 1228240\n  },\n  {\n    \"tag\": "Hippolytan",\n    \"popularity\": 1206776\n  },\n  {\n    \"tag\": "garget",\n    \"popularity\": 1185892\n  },\n  {\n    \"tag\": "diploplacula",\n    \"popularity\": 1165568\n  },\n  {\n    \"tag\": "orohydrographical",\n    \"popularity\": 1145785\n  },\n  {\n    \"tag\": "enhypostatize",\n    \"popularity\": 1126521\n  },\n  {\n    \"tag\": "polisman",\n    \"popularity\": 1107759\n  },\n  {\n    \"tag\": "acetometer",\n    \"popularity\": 1089482\n  },\n  {\n    \"tag\": "unsnatched",\n    \"popularity\": 1071672\n  },\n  {\n    \"tag\": "yabber",\n    \"popularity\": 1054313\n  },\n  {\n    \"tag\": "demiwolf",\n    \"popularity\": 1037390\n  },\n  {\n    \"tag\": "chromascope",\n    \"popularity\": 1020888\n  },\n  {\n    \"tag\": "seamanship",\n    \"popularity\": 1004794\n  },\n  {\n    \"tag\": "nonfenestrated",\n    \"popularity\": 989092\n  },\n  {\n    \"tag\": "hydrophytism",\n    \"popularity\": 973771\n  },\n  {\n    \"tag\": "dotter",\n    \"popularity\": 958819\n  },\n  {\n    \"tag\": "thermoperiodism",\n    \"popularity\": 944222\n  },\n  {\n    \"tag\": "unlawyerlike",\n    \"popularity\": 929970\n  },\n  {\n    \"tag\": "enantiomeride citywards",\n    \"popularity\": 916052\n  },\n  {\n    \"tag\": "unmetallurgical",\n    \"popularity\": 902456\n  },\n  {\n    \"tag\": "prickled",\n    \"popularity\": 889174\n  },\n  {\n    \"tag\": "strangerwise manioc",\n    \"popularity\": 876195\n  },\n  {\n    \"tag\": "incisorial",\n    \"popularity\": 863510\n  },\n  {\n    \"tag\": "irrationalize",\n    \"popularity\": 851110\n  },\n  {\n    \"tag\": "nasology",\n    \"popularity\": 838987\n  },\n  {\n    \"tag\": "fatuism",\n    \"popularity\": 827131\n  },\n  {\n    \"tag\": "Huk",\n    \"popularity\": 815535\n  },\n  {\n    \"tag\": "properispomenon",\n    \"popularity\": 804192\n  },\n  {\n    \"tag\": "unpummelled",\n    \"popularity\": 793094\n  },\n  {\n    \"tag\": "technographically",\n    \"popularity\": 782233\n  },\n  {\n    \"tag\": "underfurnish",\n    \"popularity\": 771603\n  },\n  {\n    \"tag\": "sinter",\n    \"popularity\": 761198\n  },\n  {\n    \"tag\": "lateroanterior",\n    \"popularity\": 751010\n  },\n  {\n    \"tag\": "nonpersonification",\n    \"popularity\": 741034\n  },\n  {\n    \"tag\": "Sitophilus",\n    \"popularity\": 731264\n  },\n  {\n    \"tag\": "unstudded overexerted",\n    \"popularity\": 721694\n  },\n  {\n    \"tag\": "tracheation",\n    \"popularity\": 712318\n  },\n  {\n    \"tag\": "thirteenth begloze",\n    \"popularity\": 703131\n  },\n  {\n    \"tag\": "bespice",\n    \"popularity\": 694129\n  },\n  {\n    \"tag\": "doppia",\n    \"popularity\": 685305\n  },\n  {\n    \"tag\": "unadorned",\n    \"popularity\": 676656\n  },\n  {\n    \"tag\": "dovelet engraff",\n    \"popularity\": 668176\n  },\n  {\n    \"tag\": "diphyozooid",\n    \"popularity\": 659862\n  },\n  {\n    \"tag\": "mure",\n    \"popularity\": 651708\n  },\n  {\n    \"tag\": "Tripitaka",\n    \"popularity\": 643710\n  },\n  {\n    \"tag\": "Billjim",\n    \"popularity\": 635865\n  },\n  {\n    \"tag\": "pyramidical",\n    \"popularity\": 628169\n  },\n  {\n    \"tag\": "circumlocutionist",\n    \"popularity\": 620617\n  },\n  {\n    \"tag\": "slapstick",\n    \"popularity\": 613207\n  },\n  {\n    \"tag\": "preobedience",\n    \"popularity\": 605934\n  },\n  {\n    \"tag\": "unfriarlike",\n    \"popularity\": 598795\n  },\n  {\n    \"tag\": "microchromosome",\n    \"popularity\": 591786\n  },\n  {\n    \"tag\": "Orphicism",\n    \"popularity\": 584905\n  },\n  {\n    \"tag\": "peel",\n    \"popularity\": 578149\n  },\n  {\n    \"tag\": "obediential",\n    \"popularity\": 571514\n  },\n  {\n    \"tag\": "Peripatidea",\n    \"popularity\": 564997\n  },\n  {\n    \"tag\": "undoubtful",\n    \"popularity\": 558596\n  },\n  {\n    \"tag\": "lodgeable",\n    \"popularity\": 552307\n  },\n  {\n    \"tag\": "pustulated woodchat",\n    \"popularity\": 546129\n  },\n  {\n    \"tag\": "antepast",\n    \"popularity\": 540057\n  },\n  {\n    \"tag\": "sagittoid matrimoniously",\n    \"popularity\": 534091\n  },\n  {\n    \"tag\": "Albizzia",\n    \"popularity\": 528228\n  },\n  {\n    \"tag\": "Elateridae unnewness",\n    \"popularity\": 522464\n  },\n  {\n    \"tag\": "convertingness",\n    \"popularity\": 516798\n  },\n  {\n    \"tag\": "Pelew",\n    \"popularity\": 511228\n  },\n  {\n    \"tag\": "recapitulation",\n    \"popularity\": 505751\n  },\n  {\n    \"tag\": "shack",\n    \"popularity\": 500365\n  },\n  {\n    \"tag\": "unmellowed",\n    \"popularity\": 495069\n  },\n  {\n    \"tag\": "pavis capering",\n    \"popularity\": 489859\n  },\n  {\n    \"tag\": "fanfare",\n    \"popularity\": 484735\n  },\n  {\n    \"tag\": "sole",\n    \"popularity\": 479695\n  },\n  {\n    \"tag\": "subarcuate",\n    \"popularity\": 474735\n  },\n  {\n    \"tag\": "multivious",\n    \"popularity\": 469856\n  },\n  {\n    \"tag\": "squandermania",\n    \"popularity\": 465054\n  },\n  {\n    \"tag\": "scintle",\n    \"popularity\": 460329\n  },\n  {\n    \"tag\": "hash chirognomic",\n    \"popularity\": 455679\n  },\n  {\n    \"tag\": "linseed",\n    \"popularity\": 451101\n  },\n  {\n    \"tag\": "redoubtable",\n    \"popularity\": 446596\n  },\n  {\n    \"tag\": "poachy reimpact",\n    \"popularity\": 442160\n  },\n  {\n    \"tag\": "limestone",\n    \"popularity\": 437792\n  },\n  {\n    \"tag\": "serranid",\n    \"popularity\": 433492\n  },\n  {\n    \"tag\": "pohna",\n    \"popularity\": 429258\n  },\n  {\n    \"tag\": "warwolf",\n    \"popularity\": 425088\n  },\n  {\n    \"tag\": "ruthenous",\n    \"popularity\": 420981\n  },\n  {\n    \"tag\": "dover",\n    \"popularity\": 416935\n  },\n  {\n    \"tag\": "deuteroalbumose",\n    \"popularity\": 412950\n  },\n  {\n    \"tag\": "pseudoprophetic",\n    \"popularity\": 409025\n  },\n  {\n    \"tag\": "dissoluteness",\n    \"popularity\": 405157\n  },\n  {\n    \"tag\": "preinvention",\n    \"popularity\": 401347\n  },\n  {\n    \"tag\": "swagbellied",\n    \"popularity\": 397592\n  },\n  {\n    \"tag\": "Ophidia",\n    \"popularity\": 393892\n  },\n  {\n    \"tag\": "equanimity",\n    \"popularity\": 390245\n  },\n  {\n    \"tag\": "troutful",\n    \"popularity\": 386651\n  },\n  {\n    \"tag\": "uke",\n    \"popularity\": 383108\n  },\n  {\n    \"tag\": "preacquaint",\n    \"popularity\": 379616\n  },\n  {\n    \"tag\": "shoq",\n    \"popularity\": 376174\n  },\n  {\n    \"tag\": "yox",\n    \"popularity\": 372780\n  },\n  {\n    \"tag\": "unelemental",\n    \"popularity\": 369434\n  },\n  {\n    \"tag\": "Yavapai",\n    \"popularity\": 366134\n  },\n  {\n    \"tag\": "joulean",\n    \"popularity\": 362880\n  },\n  {\n    \"tag\": "dracontine",\n    \"popularity\": 359672\n  },\n  {\n    \"tag\": "hardmouth",\n    \"popularity\": 356507\n  },\n  {\n    \"tag\": "sylvanize",\n    \"popularity\": 353386\n  },\n  {\n    \"tag\": "intraparenchymatous meadowbur",\n    \"popularity\": 350308\n  },\n  {\n    \"tag\": "uncharily",\n    \"popularity\": 347271\n  },\n  {\n    \"tag\": "redtab flexibly",\n    \"popularity\": 344275\n  },\n  {\n    \"tag\": "centervelic",\n    \"popularity\": 341319\n  },\n  {\n    \"tag\": "unravellable",\n    \"popularity\": 338403\n  },\n  {\n    \"tag\": "infortunately",\n    \"popularity\": 335526\n  },\n  {\n    \"tag\": "cannel",\n    \"popularity\": 332687\n  },\n  {\n    \"tag\": "oxyblepsia",\n    \"popularity\": 329885\n  },\n  {\n    \"tag\": "Damon",\n    \"popularity\": 327120\n  },\n  {\n    \"tag\": "etherin",\n    \"popularity\": 324391\n  },\n  {\n    \"tag\": "luminal",\n    \"popularity\": 321697\n  },\n  {\n    \"tag\": "interrogatorily presbyte",\n    \"popularity\": 319038\n  },\n  {\n    \"tag\": "hemiclastic",\n    \"popularity\": 316414\n  },\n  {\n    \"tag\": "poh flush",\n    \"popularity\": 313823\n  },\n  {\n    \"tag\": "Psoroptes",\n    \"popularity\": 311265\n  },\n  {\n    \"tag\": "dispirit",\n    \"popularity\": 308740\n  },\n  {\n    \"tag\": "nashgab",\n    \"popularity\": 306246\n  },\n  {\n    \"tag\": "Aphidiinae",\n    \"popularity\": 303784\n  },\n  {\n    \"tag\": "rhapsody nonconstruction",\n    \"popularity\": 301353\n  },\n  {\n    \"tag\": "Osmond",\n    \"popularity\": 298952\n  },\n  {\n    \"tag\": "Leonis",\n    \"popularity\": 296581\n  },\n  {\n    \"tag\": "Lemnian",\n    \"popularity\": 294239\n  },\n  {\n    \"tag\": "acetonic gnathonic",\n    \"popularity\": 291926\n  },\n  {\n    \"tag\": "surculus",\n    \"popularity\": 289641\n  },\n  {\n    \"tag\": "diagonally",\n    \"popularity\": 287384\n  },\n  {\n    \"tag\": "counterpenalty",\n    \"popularity\": 285154\n  },\n  {\n    \"tag\": "Eugenie",\n    \"popularity\": 282952\n  },\n  {\n    \"tag\": "hornbook",\n    \"popularity\": 280776\n  },\n  {\n    \"tag\": "miscoin",\n    \"popularity\": 278626\n  },\n  {\n    \"tag\": "admi",\n    \"popularity\": 276501\n  },\n  {\n    \"tag\": "Tarmac",\n    \"popularity\": 274402\n  },\n  {\n    \"tag\": "inexplicable",\n    \"popularity\": 272328\n  },\n  {\n    \"tag\": "rascallion",\n    \"popularity\": 270278\n  },\n  {\n    \"tag\": "dusterman",\n    \"popularity\": 268252\n  },\n  {\n    \"tag\": "osteostomous unhoroscopic",\n    \"popularity\": 266250\n  },\n  {\n    \"tag\": "spinibulbar",\n    \"popularity\": 264271\n  },\n  {\n    \"tag\": "phototelegraphically",\n    \"popularity\": 262315\n  },\n  {\n    \"tag\": "Manihot",\n    \"popularity\": 260381\n  },\n  {\n    \"tag\": "neighborhood",\n    \"popularity\": 258470\n  },\n  {\n    \"tag\": "Vincetoxicum",\n    \"popularity\": 256581\n  },\n  {\n    \"tag\": "khirka",\n    \"popularity\": 254713\n  },\n  {\n    \"tag\": "conscriptive",\n    \"popularity\": 252866\n  },\n  {\n    \"tag\": "synechthran",\n    \"popularity\": 251040\n  },\n  {\n    \"tag\": "Guttiferales",\n    \"popularity\": 249235\n  },\n  {\n    \"tag\": "roomful",\n    \"popularity\": 247450\n  },\n  {\n    \"tag\": "germinal",\n    \"popularity\": 245685\n  },\n  {\n    \"tag\": "untraitorous",\n    \"popularity\": 243939\n  },\n  {\n    \"tag\": "nondissenting",\n    \"popularity\": 242213\n  },\n  {\n    \"tag\": "amotion",\n    \"popularity\": 240506\n  },\n  {\n    \"tag\": "badious",\n    \"popularity\": 238817\n  },\n  {\n    \"tag\": "sumpit",\n    \"popularity\": 237147\n  },\n  {\n    \"tag\": "ectozoic",\n    \"popularity\": 235496\n  },\n  {\n    \"tag\": "elvet",\n    \"popularity\": 233862\n  },\n  {\n    \"tag\": "underclerk",\n    \"popularity\": 232246\n  },\n  {\n    \"tag\": "reticency",\n    \"popularity\": 230647\n  },\n  {\n    \"tag\": "neutroclusion",\n    \"popularity\": 229065\n  },\n  {\n    \"tag\": "unbelieving",\n    \"popularity\": 227500\n  },\n  {\n    \"tag\": "histogenetic",\n    \"popularity\": 225952\n  },\n  {\n    \"tag\": "dermamyiasis",\n    \"popularity\": 224421\n  },\n  {\n    \"tag\": "telenergy",\n    \"popularity\": 222905\n  },\n  {\n    \"tag\": "axiomatic",\n    \"popularity\": 221406\n  },\n  {\n    \"tag\": "undominoed",\n    \"popularity\": 219922\n  },\n  {\n    \"tag\": "periosteoma",\n    \"popularity\": 218454\n  },\n  {\n    \"tag\": "justiciaryship",\n    \"popularity\": 217001\n  },\n  {\n    \"tag\": "autoluminescence",\n    \"popularity\": 215563\n  },\n  {\n    \"tag\": "osmous",\n    \"popularity\": 214140\n  },\n  {\n    \"tag\": "borgh",\n    \"popularity\": 212731\n  },\n  {\n    \"tag\": "bedebt",\n    \"popularity\": 211337\n  },\n  {\n    \"tag\": "considerableness adenoidism",\n    \"popularity\": 209957\n  },\n  {\n    \"tag\": "sailorizing",\n    \"popularity\": 208592\n  },\n  {\n    \"tag\": "Montauk",\n    \"popularity\": 207240\n  },\n  {\n    \"tag\": "Bridget",\n    \"popularity\": 205901\n  },\n  {\n    \"tag\": "Gekkota",\n    \"popularity\": 204577\n  },\n  {\n    \"tag\": "subcorymbose",\n    \"popularity\": 203265\n  },\n  {\n    \"tag\": "undersap",\n    \"popularity\": 201967\n  },\n  {\n    \"tag\": "poikilothermic",\n    \"popularity\": 200681\n  },\n  {\n    \"tag\": "enneatical",\n    \"popularity\": 199409\n  },\n  {\n    \"tag\": "martinetism",\n    \"popularity\": 198148\n  },\n  {\n    \"tag\": "sustanedly",\n    \"popularity\": 196901\n  },\n  {\n    \"tag\": "declaration",\n    \"popularity\": 195665\n  },\n  {\n    \"tag\": "myringoplasty",\n    \"popularity\": 194442\n  },\n  {\n    \"tag\": "Ginkgo",\n    \"popularity\": 193230\n  },\n  {\n    \"tag\": "unrecurrent",\n    \"popularity\": 192031\n  },\n  {\n    \"tag\": "proprecedent",\n    \"popularity\": 190843\n  },\n  {\n    \"tag\": "roadman",\n    \"popularity\": 189666\n  },\n  {\n    \"tag\": "elemin",\n    \"popularity\": 188501\n  },\n  {\n    \"tag\": "maggot",\n    \"popularity\": 187347\n  },\n  {\n    \"tag\": "alitrunk",\n    \"popularity\": 186204\n  },\n  {\n    \"tag\": "introspection",\n    \"popularity\": 185071\n  },\n  {\n    \"tag\": "batiker",\n    \"popularity\": 183950\n  },\n  {\n    \"tag\": "backhatch oversettle",\n    \"popularity\": 182839\n  },\n  {\n    \"tag\": "thresherman",\n    \"popularity\": 181738\n  },\n  {\n    \"tag\": "protemperance",\n    \"popularity\": 180648\n  },\n  {\n    \"tag\": "undern",\n    \"popularity\": 179568\n  },\n  {\n    \"tag\": "tweeg",\n    \"popularity\": 178498\n  },\n  {\n    \"tag\": "crosspath",\n    \"popularity\": 177438\n  },\n  {\n    \"tag\": "Tangaridae",\n    \"popularity\": 176388\n  },\n  {\n    \"tag\": "scrutation",\n    \"popularity\": 175348\n  },\n  {\n    \"tag\": "piecemaker",\n    \"popularity\": 174317\n  },\n  {\n    \"tag\": "paster",\n    \"popularity\": 173296\n  },\n  {\n    \"tag\": "unpretendingness",\n    \"popularity\": 172284\n  },\n  {\n    \"tag\": "inframundane",\n    \"popularity\": 171281\n  },\n  {\n    \"tag\": "kiblah",\n    \"popularity\": 170287\n  },\n  {\n    \"tag\": "playwrighting",\n    \"popularity\": 169302\n  },\n  {\n    \"tag\": "gonepoiesis snowslip",\n    \"popularity\": 168326\n  },\n  {\n    \"tag\": "hoodwise",\n    \"popularity\": 167359\n  },\n  {\n    \"tag\": "postseason",\n    \"popularity\": 166401\n  },\n  {\n    \"tag\": "equivocality",\n    \"popularity\": 165451\n  },\n  {\n    \"tag\": "Opiliaceae nuclease",\n    \"popularity\": 164509\n  },\n  {\n    \"tag\": "sextipara",\n    \"popularity\": 163576\n  },\n  {\n    \"tag\": "weeper",\n    \"popularity\": 162651\n  },\n  {\n    \"tag\": "frambesia",\n    \"popularity\": 161735\n  },\n  {\n    \"tag\": "answerable",\n    \"popularity\": 160826\n  },\n  {\n    \"tag\": "Trichosporum",\n    \"popularity\": 159925\n  },\n  {\n    \"tag\": "cajuputol",\n    \"popularity\": 159033\n  },\n  {\n    \"tag\": "pleomorphous",\n    \"popularity\": 158148\n  },\n  {\n    \"tag\": "aculeolate",\n    \"popularity\": 157270\n  },\n  {\n    \"tag\": "wherever",\n    \"popularity\": 156400\n  },\n  {\n    \"tag\": "collapse",\n    \"popularity\": 155538\n  },\n  {\n    \"tag\": "porky",\n    \"popularity\": 154683\n  },\n  {\n    \"tag\": "perule",\n    \"popularity\": 153836\n  },\n  {\n    \"tag\": "Nevada",\n    \"popularity\": 152996\n  },\n  {\n    \"tag\": "conalbumin",\n    \"popularity\": 152162\n  },\n  {\n    \"tag\": "tsunami",\n    \"popularity\": 151336\n  },\n  {\n    \"tag\": "Gulf",\n    \"popularity\": 150517\n  },\n  {\n    \"tag\": "hertz",\n    \"popularity\": 149705\n  },\n  {\n    \"tag\": "limmock",\n    \"popularity\": 148900\n  },\n  {\n    \"tag\": "Tartarize",\n    \"popularity\": 148101\n  },\n  {\n    \"tag\": "entosphenoid",\n    \"popularity\": 147310\n  },\n  {\n    \"tag\": "ibis",\n    \"popularity\": 146524\n  },\n  {\n    \"tag\": "unyeaned",\n    \"popularity\": 145746\n  },\n  {\n    \"tag\": "tritural",\n    \"popularity\": 144973\n  },\n  {\n    \"tag\": "hundredary",\n    \"popularity\": 144207\n  },\n  {\n    \"tag\": "stolonlike",\n    \"popularity\": 143448\n  },\n  {\n    \"tag\": "chorister",\n    \"popularity\": 142694\n  },\n  {\n    \"tag\": "mismove",\n    \"popularity\": 141947\n  },\n  {\n    \"tag\": "Andine",\n    \"popularity\": 141206\n  },\n  {\n    \"tag\": "Annette proneur escribe",\n    \"popularity\": 140471\n  },\n  {\n    \"tag\": "exoperidium",\n    \"popularity\": 139742\n  },\n  {\n    \"tag\": "disedge",\n    \"popularity\": 139019\n  },\n  {\n    \"tag\": "hypochloruria",\n    \"popularity\": 138302\n  },\n  {\n    \"tag\": "prepupa",\n    \"popularity\": 137590\n  },\n  {\n    \"tag\": "assent",\n    \"popularity\": 136884\n  },\n  {\n    \"tag\": "hydrazobenzene",\n    \"popularity\": 136184\n  },\n  {\n    \"tag\": "emballonurid",\n    \"popularity\": 135489\n  },\n  {\n    \"tag\": "roselle",\n    \"popularity\": 134800\n  },\n  {\n    \"tag\": "unifiedly",\n    \"popularity\": 134117\n  },\n  {\n    \"tag\": "clang",\n    \"popularity\": 133439\n  },\n  {\n    \"tag\": "acetolytic",\n    \"popularity\": 132766\n  },\n  {\n    \"tag\": "cladodont",\n    \"popularity\": 132098\n  },\n  {\n    \"tag\": "recoast",\n    \"popularity\": 131436\n  },\n  {\n    \"tag\": "celebrated tydie Eocarboniferous",\n    \"popularity\": 130779\n  },\n  {\n    \"tag\": "superconsciousness",\n    \"popularity\": 130127\n  },\n  {\n    \"tag\": "soberness",\n    \"popularity\": 129480\n  },\n  {\n    \"tag\": "panoramist",\n    \"popularity\": 128838\n  },\n  {\n    \"tag\": "Orbitolina",\n    \"popularity\": 128201\n  },\n  {\n    \"tag\": "overlewd",\n    \"popularity\": 127569\n  },\n  {\n    \"tag\": "demiquaver",\n    \"popularity\": 126942\n  },\n  {\n    \"tag\": "kamelaukion",\n    \"popularity\": 126319\n  },\n  {\n    \"tag\": "flancard",\n    \"popularity\": 125702\n  },\n  {\n    \"tag\": "tricuspid",\n    \"popularity\": 125089\n  },\n  {\n    \"tag\": "bepelt",\n    \"popularity\": 124480\n  },\n  {\n    \"tag\": "decuplet",\n    \"popularity\": 123877\n  },\n  {\n    \"tag\": "Rockies",\n    \"popularity\": 123278\n  },\n  {\n    \"tag\": "unforgeability",\n    \"popularity\": 122683\n  },\n  {\n    \"tag\": "mocha",\n    \"popularity\": 122093\n  },\n  {\n    \"tag\": "scrunge",\n    \"popularity\": 121507\n  },\n  {\n    \"tag\": "delighter",\n    \"popularity\": 120926\n  },\n  {\n    \"tag\": "willey Microtinae",\n    \"popularity\": 120349\n  },\n  {\n    \"tag\": "unhuntable",\n    \"popularity\": 119777\n  },\n  {\n    \"tag\": "historically",\n    \"popularity\": 119208\n  },\n  {\n    \"tag\": "vicegerentship",\n    \"popularity\": 118644\n  },\n  {\n    \"tag\": "hemangiosarcoma",\n    \"popularity\": 118084\n  },\n  {\n    \"tag\": "harpago",\n    \"popularity\": 117528\n  },\n  {\n    \"tag\": "unionoid",\n    \"popularity\": 116976\n  },\n  {\n    \"tag\": "wiseman",\n    \"popularity\": 116429\n  },\n  {\n    \"tag\": "diclinism",\n    \"popularity\": 115885\n  },\n  {\n    \"tag\": "Maud",\n    \"popularity\": 115345\n  },\n  {\n    \"tag\": "scaphocephalism",\n    \"popularity\": 114809\n  },\n  {\n    \"tag\": "obtenebration",\n    \"popularity\": 114277\n  },\n  {\n    \"tag\": "cymar predreadnought",\n    \"popularity\": 113749\n  },\n  {\n    \"tag\": "discommend",\n    \"popularity\": 113225\n  },\n  {\n    \"tag\": "crude",\n    \"popularity\": 112704\n  },\n  {\n    \"tag\": "upflash",\n    \"popularity\": 112187\n  },\n  {\n    \"tag\": "saltimbank",\n    \"popularity\": 111674\n  },\n  {\n    \"tag\": "posthysterical",\n    \"popularity\": 111165\n  },\n  {\n    \"tag\": "trample",\n    \"popularity\": 110659\n  },\n  {\n    \"tag\": "ungirthed",\n    \"popularity\": 110157\n  },\n  {\n    \"tag\": "unshakable",\n    \"popularity\": 109658\n  },\n  {\n    \"tag\": "hepatocystic",\n    \"popularity\": 109163\n  },\n  {\n    \"tag\": "psammophyte",\n    \"popularity\": 108671\n  },\n  {\n    \"tag\": "millionfold",\n    \"popularity\": 108183\n  },\n  {\n    \"tag\": "outtaste",\n    \"popularity\": 107698\n  },\n  {\n    \"tag\": "poppycockish",\n    \"popularity\": 107217\n  },\n  {\n    \"tag\": "viduine",\n    \"popularity\": 106739\n  },\n  {\n    \"tag\": "pleasureman",\n    \"popularity\": 106264\n  },\n  {\n    \"tag\": "cholesterolemia",\n    \"popularity\": 105792\n  },\n  {\n    \"tag\": "hostlerwife",\n    \"popularity\": 105324\n  },\n  {\n    \"tag\": "figure undergrass",\n    \"popularity\": 104859\n  },\n  {\n    \"tag\": "bedrape",\n    \"popularity\": 104398\n  },\n  {\n    \"tag\": "nuttishness",\n    \"popularity\": 103939\n  },\n  {\n    \"tag\": "fow",\n    \"popularity\": 103484\n  },\n  {\n    \"tag\": "rachianesthesia",\n    \"popularity\": 103031\n  },\n  {\n    \"tag\": "recruitable",\n    \"popularity\": 102582\n  },\n  {\n    \"tag\": "semianatomical Oenotheraceae",\n    \"popularity\": 102136\n  },\n  {\n    \"tag\": "extracapsular",\n    \"popularity\": 101693\n  },\n  {\n    \"tag\": "unsigneted",\n    \"popularity\": 101253\n  },\n  {\n    \"tag\": "fissural",\n    \"popularity\": 100816\n  },\n  {\n    \"tag\": "ayous",\n    \"popularity\": 100381\n  },\n  {\n    \"tag\": "crestfallenness odontograph",\n    \"popularity\": 99950\n  },\n  {\n    \"tag\": "monopodium",\n    \"popularity\": 99522\n  },\n  {\n    \"tag\": "germfree",\n    \"popularity\": 99096\n  },\n  {\n    \"tag\": "dauphin",\n    \"popularity\": 98673\n  },\n  {\n    \"tag\": "nonagesimal",\n    \"popularity\": 98254\n  },\n  {\n    \"tag\": "waterchat",\n    \"popularity\": 97836\n  },\n  {\n    \"tag\": "Entelodon",\n    \"popularity\": 97422\n  },\n  {\n    \"tag\": "semischolastic",\n    \"popularity\": 97010\n  },\n  {\n    \"tag\": "somata",\n    \"popularity\": 96602\n  },\n  {\n    \"tag\": "expositorily",\n    \"popularity\": 96195\n  },\n  {\n    \"tag\": "bass",\n    \"popularity\": 95792\n  },\n  {\n    \"tag\": "calorimetry",\n    \"popularity\": 95391\n  },\n  {\n    \"tag\": "entireness",\n    \"popularity\": 94993\n  },\n  {\n    \"tag\": "ratline soppiness",\n    \"popularity\": 94597\n  },\n  {\n    \"tag\": "shor",\n    \"popularity\": 94204\n  },\n  {\n    \"tag\": "coprecipitation",\n    \"popularity\": 93813\n  },\n  {\n    \"tag\": "unblushingly",\n    \"popularity\": 93425\n  },\n  {\n    \"tag\": "macarize",\n    \"popularity\": 93040\n  },\n  {\n    \"tag\": "scruplesomeness",\n    \"popularity\": 92657\n  },\n  {\n    \"tag\": "offsaddle",\n    \"popularity\": 92276\n  },\n  {\n    \"tag\": "hypertragical",\n    \"popularity\": 91898\n  },\n  {\n    \"tag\": "uncassock loined",\n    \"popularity\": 91522\n  },\n  {\n    \"tag\": "interlobate",\n    \"popularity\": 91149\n  },\n  {\n    \"tag\": "releasor orrisroot stoloniferously",\n    \"popularity\": 90778\n  },\n  {\n    \"tag\": "elementoid",\n    \"popularity\": 90410\n  },\n  {\n    \"tag\": "Lentilla",\n    \"popularity\": 90043\n  },\n  {\n    \"tag\": "distressing",\n    \"popularity\": 89679\n  },\n  {\n    \"tag\": "hydrodrome",\n    \"popularity\": 89318\n  },\n  {\n    \"tag\": "Jeannette",\n    \"popularity\": 88958\n  },\n  {\n    \"tag\": "Kuli",\n    \"popularity\": 88601\n  },\n  {\n    \"tag\": "taxinomist",\n    \"popularity\": 88246\n  },\n  {\n    \"tag\": "southwestwardly",\n    \"popularity\": 87894\n  },\n  {\n    \"tag\": "polyparia",\n    \"popularity\": 87543\n  },\n  {\n    \"tag\": "exmeridian",\n    \"popularity\": 87195\n  },\n  {\n    \"tag\": "splenius regimentaled",\n    \"popularity\": 86849\n  },\n  {\n    \"tag\": "Sphaeropsidaceae",\n    \"popularity\": 86505\n  },\n  {\n    \"tag\": "unbegun",\n    \"popularity\": 86163\n  },\n  {\n    \"tag\": "something",\n    \"popularity\": 85823\n  },\n  {\n    \"tag\": "contaminable nonexpulsion",\n    \"popularity\": 85486\n  },\n  {\n    \"tag\": "douser",\n    \"popularity\": 85150\n  },\n  {\n    \"tag\": "prostrike",\n    \"popularity\": 84817\n  },\n  {\n    \"tag\": "worky",\n    \"popularity\": 84485\n  },\n  {\n    \"tag\": "folliful",\n    \"popularity\": 84156\n  },\n  {\n    \"tag\": "prioracy",\n    \"popularity\": 83828\n  },\n  {\n    \"tag\": "undermentioned",\n    \"popularity\": 83503\n  },\n  {\n    \"tag\": "Judaica",\n    \"popularity\": 83179\n  },\n  {\n    \"tag\": "multifarious",\n    \"popularity\": 82858\n  },\n  {\n    \"tag\": "poogye",\n    \"popularity\": 82538\n  },\n  {\n    \"tag\": "Sparganium",\n    \"popularity\": 82221\n  },\n  {\n    \"tag\": "thurrock",\n    \"popularity\": 81905\n  },\n  {\n    \"tag\": "outblush",\n    \"popularity\": 81591\n  },\n  {\n    \"tag\": "Strophanthus supraordination",\n    \"popularity\": 81279\n  },\n  {\n    \"tag\": "gingerroot",\n    \"popularity\": 80969\n  },\n  {\n    \"tag\": "unconscient",\n    \"popularity\": 80661\n  },\n  {\n    \"tag\": "unconstitutionally",\n    \"popularity\": 80354\n  },\n  {\n    \"tag\": "plaguily",\n    \"popularity\": 80050\n  },\n  {\n    \"tag\": "waterily equatorwards",\n    \"popularity\": 79747\n  },\n  {\n    \"tag\": "nondeposition",\n    \"popularity\": 79446\n  },\n  {\n    \"tag\": "dronishly",\n    \"popularity\": 79147\n  },\n  {\n    \"tag\": "gateado",\n    \"popularity\": 78849\n  },\n  {\n    \"tag\": "dislink",\n    \"popularity\": 78553\n  },\n  {\n    \"tag\": "Joceline",\n    \"popularity\": 78259\n  },\n  {\n    \"tag\": "amphiboliferous",\n    \"popularity\": 77967\n  },\n  {\n    \"tag\": "bushrope",\n    \"popularity\": 77676\n  },\n  {\n    \"tag\": "plumicorn sulphosalicylic",\n    \"popularity\": 77387\n  },\n  {\n    \"tag\": "nonefficiency",\n    \"popularity\": 77100\n  },\n  {\n    \"tag\": "hieroscopy",\n    \"popularity\": 76815\n  },\n  {\n    \"tag\": "causativeness",\n    \"popularity\": 76531\n  },\n  {\n    \"tag\": "swird paleoeremology",\n    \"popularity\": 76249\n  },\n  {\n    \"tag\": "camphoric",\n    \"popularity\": 75968\n  },\n  {\n    \"tag\": "retaining",\n    \"popularity\": 75689\n  },\n  {\n    \"tag\": "thyreoprotein",\n    \"popularity\": 75411\n  },\n  {\n    \"tag\": "carbona",\n    \"popularity\": 75136\n  },\n  {\n    \"tag\": "protectively",\n    \"popularity\": 74861\n  },\n  {\n    \"tag\": "mosasaur",\n    \"popularity\": 74589\n  },\n  {\n    \"tag\": "reciprocator",\n    \"popularity\": 74317\n  },\n  {\n    \"tag\": "detentive",\n    \"popularity\": 74048\n  },\n  {\n    \"tag\": "supravital",\n    \"popularity\": 73780\n  },\n  {\n    \"tag\": "Vespertilionidae",\n    \"popularity\": 73513\n  },\n  {\n    \"tag\": "parka",\n    \"popularity\": 73248\n  },\n  {\n    \"tag\": "pickaway",\n    \"popularity\": 72984\n  },\n  {\n    \"tag\": "oleaceous",\n    \"popularity\": 72722\n  },\n  {\n    \"tag\": "anticogitative",\n    \"popularity\": 72462\n  },\n  {\n    \"tag\": "woe",\n    \"popularity\": 72203\n  },\n  {\n    \"tag\": "skeuomorph",\n    \"popularity\": 71945\n  },\n  {\n    \"tag\": "helpmeet",\n    \"popularity\": 71689\n  },\n  {\n    \"tag\": "Hexactinellida brickmaking",\n    \"popularity\": 71434\n  },\n  {\n    \"tag\": "resink",\n    \"popularity\": 71180\n  },\n  {\n    \"tag\": "diluter",\n    \"popularity\": 70928\n  },\n  {\n    \"tag\": "micromicron",\n    \"popularity\": 70677\n  },\n  {\n    \"tag\": "parentage",\n    \"popularity\": 70428\n  },\n  {\n    \"tag\": "galactorrhoea",\n    \"popularity\": 70180\n  },\n  {\n    \"tag\": "gey",\n    \"popularity\": 69934\n  },\n  {\n    \"tag\": "gesticulatory",\n    \"popularity\": 69689\n  },\n  {\n    \"tag\": "wergil",\n    \"popularity\": 69445\n  },\n  {\n    \"tag\": "Lecanora",\n    \"popularity\": 69202\n  },\n  {\n    \"tag\": "malanders karst",\n    \"popularity\": 68961\n  },\n  {\n    \"tag\": "vibetoite",\n    \"popularity\": 68721\n  },\n  {\n    \"tag\": "unrequitedness",\n    \"popularity\": 68483\n  },\n  {\n    \"tag\": "outwash",\n    \"popularity\": 68245\n  },\n  {\n    \"tag\": "unsacred",\n    \"popularity\": 68009\n  },\n  {\n    \"tag\": "unabetted dividend",\n    \"popularity\": 67775\n  },\n  {\n    \"tag\": "untraveling",\n    \"popularity\": 67541\n  },\n  {\n    \"tag\": "thermobattery",\n    \"popularity\": 67309\n  },\n  {\n    \"tag\": "polypragmist",\n    \"popularity\": 67078\n  },\n  {\n    \"tag\": "irrefutableness",\n    \"popularity\": 66848\n  },\n  {\n    \"tag\": "remiges",\n    \"popularity\": 66620\n  },\n  {\n    \"tag\": "implode",\n    \"popularity\": 66393\n  },\n  {\n    \"tag\": "superfluousness",\n    \"popularity\": 66166\n  },\n  {\n    \"tag\": "croakily unalleviated",\n    \"popularity\": 65942\n  },\n  {\n    \"tag\": "edicule",\n    \"popularity\": 65718\n  },\n  {\n    \"tag\": "entophytous",\n    \"popularity\": 65495\n  },\n  {\n    \"tag\": "benefactorship Toryish",\n    \"popularity\": 65274\n  },\n  {\n    \"tag\": "pseudoamateurish",\n    \"popularity\": 65054\n  },\n  {\n    \"tag\": "flueless Iguanodontoidea snipnose",\n    \"popularity\": 64835\n  },\n  {\n    \"tag\": "zealotical Zamicrus interpole",\n    \"popularity\": 64617\n  },\n  {\n    \"tag\": "whereabout",\n    \"popularity\": 64401\n  },\n  {\n    \"tag\": "benzazide",\n    \"popularity\": 64185\n  },\n  {\n    \"tag\": "pokeweed",\n    \"popularity\": 63971\n  },\n  {\n    \"tag\": "calamitoid",\n    \"popularity\": 63757\n  },\n  {\n    \"tag\": "sporozoal",\n    \"popularity\": 63545\n  },\n  {\n    \"tag\": "physcioid Welshwoman",\n    \"popularity\": 63334\n  },\n  {\n    \"tag\": "wanting",\n    \"popularity\": 63124\n  },\n  {\n    \"tag\": "unencumbering",\n    \"popularity\": 62915\n  },\n  {\n    \"tag\": "Tupi",\n    \"popularity\": 62707\n  },\n  {\n    \"tag\": "potbank",\n    \"popularity\": 62501\n  },\n  {\n    \"tag\": "bulked",\n    \"popularity\": 62295\n  },\n  {\n    \"tag\": "uparise",\n    \"popularity\": 62090\n  },\n  {\n    \"tag\": "Sudra",\n    \"popularity\": 61887\n  },\n  {\n    \"tag\": "hyperscrupulosity",\n    \"popularity\": 61684\n  },\n  {\n    \"tag\": "subterraneously unmaid",\n    \"popularity\": 61483\n  },\n  {\n    \"tag\": "poisonousness",\n    \"popularity\": 61282\n  },\n  {\n    \"tag\": "phare",\n    \"popularity\": 61083\n  },\n  {\n    \"tag\": "dicynodont",\n    \"popularity\": 60884\n  },\n  {\n    \"tag\": "chewer",\n    \"popularity\": 60687\n  },\n  {\n    \"tag\": "uliginous",\n    \"popularity\": 60490\n  },\n  {\n    \"tag\": "tinman",\n    \"popularity\": 60295\n  },\n  {\n    \"tag\": "coconut",\n    \"popularity\": 60100\n  },\n  {\n    \"tag\": "phryganeoid",\n    \"popularity\": 59907\n  },\n  {\n    \"tag\": "bismillah",\n    \"popularity\": 59714\n  },\n  {\n    \"tag\": "tautomeric",\n    \"popularity\": 59523\n  },\n  {\n    \"tag\": "jerquer",\n    \"popularity\": 59332\n  },\n  {\n    \"tag\": "Dryopithecinae",\n    \"popularity\": 59143\n  },\n  {\n    \"tag\": "ghizite",\n    \"popularity\": 58954\n  },\n  {\n    \"tag\": "unliveable",\n    \"popularity\": 58766\n  },\n  {\n    \"tag\": "craftsmaster",\n    \"popularity\": 58579\n  },\n  {\n    \"tag\": "semiscenic",\n    \"popularity\": 58394\n  },\n  {\n    \"tag\": "danaid",\n    \"popularity\": 58209\n  },\n  {\n    \"tag\": "flawful",\n    \"popularity\": 58025\n  },\n  {\n    \"tag\": "risibleness",\n    \"popularity\": 57841\n  },\n  {\n    \"tag\": "Muscovite",\n    \"popularity\": 57659\n  },\n  {\n    \"tag\": "snaringly",\n    \"popularity\": 57478\n  },\n  {\n    \"tag\": "brilliantwise",\n    \"popularity\": 57297\n  },\n  {\n    \"tag\": "plebeity",\n    \"popularity\": 57118\n  },\n  {\n    \"tag\": "historicalness",\n    \"popularity\": 56939\n  },\n  {\n    \"tag\": "piecemeal",\n    \"popularity\": 56761\n  },\n  {\n    \"tag\": "maxillipedary",\n    \"popularity\": 56584\n  },\n  {\n    \"tag\": "Hypenantron",\n    \"popularity\": 56408\n  },\n  {\n    \"tag\": "quaintness avigate",\n    \"popularity\": 56233\n  },\n  {\n    \"tag\": "ave",\n    \"popularity\": 56059\n  },\n  {\n    \"tag\": "mediaevally",\n    \"popularity\": 55885\n  },\n  {\n    \"tag\": "brucite",\n    \"popularity\": 55712\n  },\n  {\n    \"tag\": "Schwendenerian",\n    \"popularity\": 55541\n  },\n  {\n    \"tag\": "julole",\n    \"popularity\": 55370\n  },\n  {\n    \"tag\": "palaeolith",\n    \"popularity\": 55199\n  },\n  {\n    \"tag\": "cotyledonary",\n    \"popularity\": 55030\n  },\n  {\n    \"tag\": "rond",\n    \"popularity\": 54861\n  },\n  {\n    \"tag\": "boomster tassoo",\n    \"popularity\": 54694\n  },\n  {\n    \"tag\": "cattishly",\n    \"popularity\": 54527\n  },\n  {\n    \"tag\": "tonguefence",\n    \"popularity\": 54360\n  },\n  {\n    \"tag\": "hexastylar triskele",\n    \"popularity\": 54195\n  },\n  {\n    \"tag\": "ariot",\n    \"popularity\": 54030\n  },\n  {\n    \"tag\": "intarsist",\n    \"popularity\": 53867\n  },\n  {\n    \"tag\": "Oscines",\n    \"popularity\": 53704\n  },\n  {\n    \"tag\": "Spaniolize",\n    \"popularity\": 53541\n  },\n  {\n    \"tag\": "smellfungus",\n    \"popularity\": 53380\n  },\n  {\n    \"tag\": "redisplay",\n    \"popularity\": 53219\n  },\n  {\n    \"tag\": "phosphene",\n    \"popularity\": 53059\n  },\n  {\n    \"tag\": "phycomycete",\n    \"popularity\": 52900\n  },\n  {\n    \"tag\": "prophetic",\n    \"popularity\": 52741\n  },\n  {\n    \"tag\": "overtrustful",\n    \"popularity\": 52584\n  },\n  {\n    \"tag\": "pinitol",\n    \"popularity\": 52427\n  },\n  {\n    \"tag\": "asthmatic",\n    \"popularity\": 52270\n  },\n  {\n    \"tag\": "convulsive",\n    \"popularity\": 52115\n  },\n  {\n    \"tag\": "draughtswoman",\n    \"popularity\": 51960\n  },\n  {\n    \"tag\": "unetymologizable",\n    \"popularity\": 51806\n  },\n  {\n    \"tag\": "centrarchoid",\n    \"popularity\": 51652\n  },\n  {\n    \"tag\": "mesioincisal",\n    \"popularity\": 51500\n  },\n  {\n    \"tag\": "transbaikal",\n    \"popularity\": 51348\n  },\n  {\n    \"tag\": "silveriness",\n    \"popularity\": 51196\n  },\n  {\n    \"tag\": "costotomy",\n    \"popularity\": 51046\n  },\n  {\n    \"tag\": "caracore",\n    \"popularity\": 50896\n  },\n  {\n    \"tag\": "depotentiation",\n    \"popularity\": 50747\n  },\n  {\n    \"tag\": "glossoepiglottidean",\n    \"popularity\": 50598\n  },\n  {\n    \"tag\": "upswell",\n    \"popularity\": 50450\n  },\n  {\n    \"tag\": "flecnodal",\n    \"popularity\": 50303\n  },\n  {\n    \"tag\": "coventrate",\n    \"popularity\": 50157\n  },\n  {\n    \"tag\": "duchesse",\n    \"popularity\": 50011\n  },\n  {\n    \"tag\": "excisemanship trophied",\n    \"popularity\": 49866\n  },\n  {\n    \"tag\": "cytinaceous",\n    \"popularity\": 49721\n  },\n  {\n    \"tag\": "assuringly",\n    \"popularity\": 49577\n  },\n  {\n    \"tag\": "unconducted upliftitis",\n    \"popularity\": 49434\n  },\n  {\n    \"tag\": "rachicentesis",\n    \"popularity\": 49292\n  },\n  {\n    \"tag\": "antiangular",\n    \"popularity\": 49150\n  },\n  {\n    \"tag\": "advisal",\n    \"popularity\": 49008\n  },\n  {\n    \"tag\": "birdcatcher",\n    \"popularity\": 48868\n  },\n  {\n    \"tag\": "secularistic",\n    \"popularity\": 48728\n  },\n  {\n    \"tag\": "grandeeism superinformal",\n    \"popularity\": 48588\n  },\n  {\n    \"tag\": "unapprehension",\n    \"popularity\": 48449\n  },\n  {\n    \"tag\": "excipulum",\n    \"popularity\": 48311\n  },\n  {\n    \"tag\": "decimole",\n    \"popularity\": 48174\n  },\n  {\n    \"tag\": "semidrachm",\n    \"popularity\": 48037\n  },\n  {\n    \"tag\": "uvulotome",\n    \"popularity\": 47901\n  },\n  {\n    \"tag\": "Lemaneaceae",\n    \"popularity\": 47765\n  },\n  {\n    \"tag\": "corrade",\n    \"popularity\": 47630\n  },\n  {\n    \"tag\": "Kuroshio",\n    \"popularity\": 47495\n  },\n  {\n    \"tag\": "Araliophyllum",\n    \"popularity\": 47361\n  },\n  {\n    \"tag\": "victoriousness cardiosphygmograph",\n    \"popularity\": 47228\n  },\n  {\n    \"tag\": "reinvent",\n    \"popularity\": 47095\n  },\n  {\n    \"tag\": "Macrotolagus",\n    \"popularity\": 46963\n  },\n  {\n    \"tag\": "strenuousness",\n    \"popularity\": 46831\n  },\n  {\n    \"tag\": "deviability",\n    \"popularity\": 46700\n  },\n  {\n    \"tag\": "phyllospondylous",\n    \"popularity\": 46570\n  },\n  {\n    \"tag\": "bisect rudderhole",\n    \"popularity\": 46440\n  },\n  {\n    \"tag\": "crownwork",\n    \"popularity\": 46311\n  },\n  {\n    \"tag\": "Ascalabota",\n    \"popularity\": 46182\n  },\n  {\n    \"tag\": "prostatomyomectomy",\n    \"popularity\": 46054\n  },\n  {\n    \"tag\": "neurosyphilis",\n    \"popularity\": 45926\n  },\n  {\n    \"tag\": "tabloid scraplet",\n    \"popularity\": 45799\n  },\n  {\n    \"tag\": "nonmedullated servility",\n    \"popularity\": 45673\n  },\n  {\n    \"tag\": "melopoeic practicalization",\n    \"popularity\": 45547\n  },\n  {\n    \"tag\": "nonrhythmic",\n    \"popularity\": 45421\n  },\n  {\n    \"tag\": "deplorer",\n    \"popularity\": 45296\n  },\n  {\n    \"tag\": "Ophion",\n    \"popularity\": 45172\n  },\n  {\n    \"tag\": "subprioress",\n    \"popularity\": 45048\n  },\n  {\n    \"tag\": "semiregular",\n    \"popularity\": 44925\n  },\n  {\n    \"tag\": "praelection",\n    \"popularity\": 44802\n  },\n  {\n    \"tag\": "discinct",\n    \"popularity\": 44680\n  },\n  {\n    \"tag\": "preplace",\n    \"popularity\": 44558\n  },\n  {\n    \"tag\": "paternoster",\n    \"popularity\": 44437\n  },\n  {\n    \"tag\": "suboccipital",\n    \"popularity\": 44316\n  },\n  {\n    \"tag\": "Teutophil",\n    \"popularity\": 44196\n  },\n  {\n    \"tag\": "tracheole",\n    \"popularity\": 44076\n  },\n  {\n    \"tag\": "subsmile",\n    \"popularity\": 43957\n  },\n  {\n    \"tag\": "nonapostatizing",\n    \"popularity\": 43839\n  },\n  {\n    \"tag\": "cleidotomy",\n    \"popularity\": 43720\n  },\n  {\n    \"tag\": "hingle",\n    \"popularity\": 43603\n  },\n  {\n    \"tag\": "jocoque",\n    \"popularity\": 43486\n  },\n  {\n    \"tag\": "trundler notidanian",\n    \"popularity\": 43369\n  },\n  {\n    \"tag\": "strangling misdaub",\n    \"popularity\": 43253\n  },\n  {\n    \"tag\": "noncancellable",\n    \"popularity\": 43137\n  },\n  {\n    \"tag\": "lavabo",\n    \"popularity\": 43022\n  },\n  {\n    \"tag\": "lanterloo",\n    \"popularity\": 42907\n  },\n  {\n    \"tag\": "uncitizenly",\n    \"popularity\": 42793\n  },\n  {\n    \"tag\": "autoturning",\n    \"popularity\": 42679\n  },\n  {\n    \"tag\": "Haganah",\n    \"popularity\": 42566\n  },\n  {\n    \"tag\": "Glecoma",\n    \"popularity\": 42453\n  },\n  {\n    \"tag\": "membered",\n    \"popularity\": 42341\n  },\n  {\n    \"tag\": "consuetudinal",\n    \"popularity\": 42229\n  },\n  {\n    \"tag\": "gatehouse",\n    \"popularity\": 42117\n  },\n  {\n    \"tag\": "tetherball",\n    \"popularity\": 42006\n  },\n  {\n    \"tag\": "counterrevolutionist numismatical",\n    \"popularity\": 41896\n  },\n  {\n    \"tag\": "pagehood plateiasmus",\n    \"popularity\": 41786\n  },\n  {\n    \"tag\": "pelterer",\n    \"popularity\": 41676\n  },\n  {\n    \"tag\": "splenemphraxis",\n    \"popularity\": 41567\n  },\n  {\n    \"tag\": "Crypturidae",\n    \"popularity\": 41458\n  },\n  {\n    \"tag\": "caboodle",\n    \"popularity\": 41350\n  },\n  {\n    \"tag\": "Filaria",\n    \"popularity\": 41242\n  },\n  {\n    \"tag\": "noninvincibility",\n    \"popularity\": 41135\n  },\n  {\n    \"tag\": "preadvertisement",\n    \"popularity\": 41028\n  },\n  {\n    \"tag\": "bathrobe",\n    \"popularity\": 40921\n  },\n  {\n    \"tag\": "nitrifier",\n    \"popularity\": 40815\n  },\n  {\n    \"tag\": "furthermore",\n    \"popularity\": 40709\n  },\n  {\n    \"tag\": "recrate",\n    \"popularity\": 40604\n  },\n  {\n    \"tag\": "inexist",\n    \"popularity\": 40499\n  },\n  {\n    \"tag\": "Mocoan",\n    \"popularity\": 40395\n  },\n  {\n    \"tag\": "forint",\n    \"popularity\": 40291\n  },\n  {\n    \"tag\": "cardiomyoliposis",\n    \"popularity\": 40187\n  },\n  {\n    \"tag\": "channeling",\n    \"popularity\": 40084\n  },\n  {\n    \"tag\": "quebrachine",\n    \"popularity\": 39981\n  },\n  {\n    \"tag\": "magistery",\n    \"popularity\": 39879\n  },\n  {\n    \"tag\": "koko",\n    \"popularity\": 39777\n  },\n  {\n    \"tag\": "nobilify",\n    \"popularity\": 39676\n  },\n  {\n    \"tag\": "articulate taprooted",\n    \"popularity\": 39575\n  },\n  {\n    \"tag\": "cardiotonic Nicaragua",\n    \"popularity\": 39474\n  },\n  {\n    \"tag\": "assertiveness",\n    \"popularity\": 39374\n  },\n  {\n    \"tag\": "springtail",\n    \"popularity\": 39274\n  },\n  {\n    \"tag\": "spontoon",\n    \"popularity\": 39174\n  },\n  {\n    \"tag\": "plesiobiosis",\n    \"popularity\": 39075\n  },\n  {\n    \"tag\": "rooinek",\n    \"popularity\": 38976\n  },\n  {\n    \"tag\": "hairif falsehood",\n    \"popularity\": 38878\n  },\n  {\n    \"tag\": "synodally",\n    \"popularity\": 38780\n  },\n  {\n    \"tag\": "biodynamics",\n    \"popularity\": 38683\n  },\n  {\n    \"tag\": "trickling",\n    \"popularity\": 38585\n  },\n  {\n    \"tag\": "oxfly daystar",\n    \"popularity\": 38489\n  },\n  {\n    \"tag\": "epicycloidal",\n    \"popularity\": 38392\n  },\n  {\n    \"tag\": "shorthand",\n    \"popularity\": 38296\n  },\n  {\n    \"tag\": "herpolhode",\n    \"popularity\": 38201\n  },\n  {\n    \"tag\": "polysynthesism",\n    \"popularity\": 38105\n  },\n  {\n    \"tag\": "cany",\n    \"popularity\": 38010\n  },\n  {\n    \"tag\": "sideage",\n    \"popularity\": 37916\n  },\n  {\n    \"tag\": "strainableness",\n    \"popularity\": 37822\n  },\n  {\n    \"tag\": "superformidable",\n    \"popularity\": 37728\n  },\n  {\n    \"tag\": "slendang",\n    \"popularity\": 37634\n  },\n  {\n    \"tag\": "impropriation",\n    \"popularity\": 37541\n  },\n  {\n    \"tag\": "ficklehearted",\n    \"popularity\": 37449\n  },\n  {\n    \"tag\": "wintrify",\n    \"popularity\": 37356\n  },\n  {\n    \"tag\": "geomorphogenist",\n    \"popularity\": 37264\n  },\n  {\n    \"tag\": "smuggleable",\n    \"popularity\": 37173\n  },\n  {\n    \"tag\": "delapsion",\n    \"popularity\": 37081\n  },\n  {\n    \"tag\": "projective",\n    \"popularity\": 36990\n  },\n  {\n    \"tag\": "unglue exfoliation",\n    \"popularity\": 36900\n  },\n  {\n    \"tag\": "Acerae",\n    \"popularity\": 36810\n  },\n  {\n    \"tag\": "unstaged",\n    \"popularity\": 36720\n  },\n  {\n    \"tag\": "ranal",\n    \"popularity\": 36630\n  },\n  {\n    \"tag\": "worrier",\n    \"popularity\": 36541\n  },\n  {\n    \"tag\": "unhid",\n    \"popularity\": 36452\n  },\n  {\n    \"tag\": "adequation",\n    \"popularity\": 36363\n  },\n  {\n    \"tag\": "strongylid Sokotri",\n    \"popularity\": 36275\n  },\n  {\n    \"tag\": "fumingly",\n    \"popularity\": 36187\n  },\n  {\n    \"tag\": "gynosporangium phaenogenetic",\n    \"popularity\": 36100\n  },\n  {\n    \"tag\": "uniunguiculate",\n    \"popularity\": 36012\n  },\n  {\n    \"tag\": "prudelike",\n    \"popularity\": 35926\n  },\n  {\n    \"tag\": "seminomata",\n    \"popularity\": 35839\n  },\n  {\n    \"tag\": "trinklet",\n    \"popularity\": 35753\n  },\n  {\n    \"tag\": "risorial",\n    \"popularity\": 35667\n  },\n  {\n    \"tag\": "pericardiocentesis",\n    \"popularity\": 35581\n  },\n  {\n    \"tag\": "filmist",\n    \"popularity\": 35496\n  },\n  {\n    \"tag\": "Nana",\n    \"popularity\": 35411\n  }]'; //,\n  {\n    \"tag\": "cynipoid",\n    \"popularity\": 35326\n  },\n  {\n    \"tag\": "cteniform",\n    \"popularity\": 35242\n  },\n  {\n    \"tag\": "semiflex",\n    \"popularity\": 35158\n  },\n  {\n    \"tag\": "solstitially",\n    \"popularity\": 35074\n  },\n  {\n    \"tag\": "Algarsife",\n    \"popularity\": 34991\n  },\n  {\n    \"tag\": "noncriminal",\n    \"popularity\": 34908\n  },\n  {\n    \"tag\": "compassion",\n    \"popularity\": 34825\n  },\n  {\n    \"tag\": "Buddhic",\n    \"popularity\": 34743\n  },\n  {\n    \"tag\": "vellicative dactylically hotfoot",\n    \"popularity\": 34661\n  },\n  {\n    \"tag\": "chicory",\n    \"popularity\": 34579\n  },\n  {\n    \"tag\": "transperitoneally",\n    \"popularity\": 34497\n  },\n  {\n    \"tag\": "pennae",\n    \"popularity\": 34416\n  },\n  {\n    \"tag\": "Flamandize",\n    \"popularity\": 34335\n  },\n  {\n    \"tag\": "underviewer",\n    \"popularity\": 34254\n  },\n  {\n    \"tag\": "assoil",\n    \"popularity\": 34174\n  },\n  {\n    \"tag\": "saccharobacillus",\n    \"popularity\": 34094\n  },\n  {\n    \"tag\": "biacetylene",\n    \"popularity\": 34014\n  },\n  {\n    \"tag\": "mouchardism",\n    \"popularity\": 33935\n  },\n  {\n    \"tag\": "anisomeric",\n    \"popularity\": 33856\n  },\n  {\n    \"tag\": "digestive",\n    \"popularity\": 33777\n  },\n  {\n    \"tag\": "darlingly",\n    \"popularity\": 33698\n  },\n  {\n    \"tag\": "liman",\n    \"popularity\": 33620\n  },\n  {\n    \"tag\": "soldanrie",\n    \"popularity\": 33542\n  },\n  {\n    \"tag\": "sully",\n    \"popularity\": 33464\n  },\n  {\n    \"tag\": "brightsmith",\n    \"popularity\": 33387\n  },\n  {\n    \"tag\": "inwrap antiliturgist ureterocervical",\n    \"popularity\": 33309\n  },\n  {\n    \"tag\": "discommodity",\n    \"popularity\": 33232\n  },\n  {\n    \"tag\": "typical aggrandizer",\n    \"popularity\": 33156\n  },\n  {\n    \"tag\": "xenogeny",\n    \"popularity\": 33079\n  },\n  {\n    \"tag\": "uncountrified",\n    \"popularity\": 33003\n  },\n  {\n    \"tag\": "Podarge",\n    \"popularity\": 32928\n  },\n  {\n    \"tag\": "uninterviewed",\n    \"popularity\": 32852\n  },\n  {\n    \"tag\": "underprior",\n    \"popularity\": 32777\n  },\n  {\n    \"tag\": "leiomyomatous",\n    \"popularity\": 32702\n  },\n  {\n    \"tag\": "postdysenteric",\n    \"popularity\": 32627\n  },\n  {\n    \"tag\": "Fusicladium",\n    \"popularity\": 32553\n  },\n  {\n    \"tag\": "Dulcinea",\n    \"popularity\": 32478\n  },\n  {\n    \"tag\": "interspersion",\n    \"popularity\": 32404\n  },\n  {\n    \"tag\": "preobligate",\n    \"popularity\": 32331\n  },\n  {\n    \"tag\": "subaggregate",\n    \"popularity\": 32257\n  },\n  {\n    \"tag\": "grammarianism",\n    \"popularity\": 32184\n  },\n  {\n    \"tag\": "palikar",\n    \"popularity\": 32111\n  },\n  {\n    \"tag\": "facileness",\n    \"popularity\": 32039\n  },\n  {\n    \"tag\": "deuterofibrinose",\n    \"popularity\": 31966\n  },\n  {\n    \"tag\": "pseudesthesia",\n    \"popularity\": 31894\n  },\n  {\n    \"tag\": "sedimentary",\n    \"popularity\": 31822\n  },\n  {\n    \"tag\": "typewrite",\n    \"popularity\": 31751\n  },\n  {\n    \"tag\": "immemorable",\n    \"popularity\": 31679\n  },\n  {\n    \"tag\": "Myrtus",\n    \"popularity\": 31608\n  },\n  {\n    \"tag\": "hauchecornite",\n    \"popularity\": 31537\n  },\n  {\n    \"tag\": "galleylike",\n    \"popularity\": 31467\n  },\n  {\n    \"tag\": "thimber",\n    \"popularity\": 31396\n  },\n  {\n    \"tag\": "Hegelianism",\n    \"popularity\": 31326\n  },\n  {\n    \"tag\": "strig",\n    \"popularity\": 31256\n  },\n  {\n    \"tag\": "skyre",\n    \"popularity\": 31187\n  },\n  {\n    \"tag\": "eupepticism",\n    \"popularity\": 31117\n  },\n  {\n    \"tag\": "eponymism",\n    \"popularity\": 31048\n  },\n  {\n    \"tag\": "flunkeyhood",\n    \"popularity\": 30979\n  },\n  {\n    \"tag\": "Abama",\n    \"popularity\": 30911\n  },\n  {\n    \"tag\": "adiadochokinesis",\n    \"popularity\": 30842\n  },\n  {\n    \"tag\": "spendthrifty",\n    \"popularity\": 30774\n  },\n  {\n    \"tag\": "chalcedony",\n    \"popularity\": 30706\n  },\n  {\n    \"tag\": "authorism",\n    \"popularity\": 30638\n  },\n  {\n    \"tag\": "nasturtium",\n    \"popularity\": 30571\n  },\n  {\n    \"tag\": "Acanthocereus",\n    \"popularity\": 30504\n  },\n  {\n    \"tag\": "uncollapsible",\n    \"popularity\": 30437\n  },\n  {\n    \"tag\": "excursionist",\n    \"popularity\": 30370\n  },\n  {\n    \"tag\": "fogbow",\n    \"popularity\": 30303\n  },\n  {\n    \"tag\": "overlie",\n    \"popularity\": 30237\n  },\n  {\n    \"tag\": "velours",\n    \"popularity\": 30171\n  },\n  {\n    \"tag\": "zoodendria madrigal stagbush",\n    \"popularity\": 30105\n  },\n  {\n    \"tag\": "imi",\n    \"popularity\": 30039\n  },\n  {\n    \"tag\": "cojudge",\n    \"popularity\": 29974\n  },\n  {\n    \"tag\": "depurate argal",\n    \"popularity\": 29909\n  },\n  {\n    \"tag\": "unrecognition",\n    \"popularity\": 29844\n  },\n  {\n    \"tag\": "paunchful",\n    \"popularity\": 29779\n  },\n  {\n    \"tag\": "invalued",\n    \"popularity\": 29714\n  },\n  {\n    \"tag\": "probang",\n    \"popularity\": 29650\n  },\n  {\n    \"tag\": "chetvert",\n    \"popularity\": 29586\n  },\n  {\n    \"tag\": "enactable",\n    \"popularity\": 29522\n  },\n  {\n    \"tag\": "detoxicate adhibit",\n    \"popularity\": 29458\n  },\n  {\n    \"tag\": "kullaite",\n    \"popularity\": 29395\n  },\n  {\n    \"tag\": "undazzling",\n    \"popularity\": 29332\n  },\n  {\n    \"tag\": "excalation",\n    \"popularity\": 29269\n  },\n  {\n    \"tag\": "sievings",\n    \"popularity\": 29206\n  },\n  {\n    \"tag\": "disenthral",\n    \"popularity\": 29143\n  },\n  {\n    \"tag\": "disinterestedly",\n    \"popularity\": 29081\n  },\n  {\n    \"tag\": "stanner",\n    \"popularity\": 29018\n  },\n  {\n    \"tag\": "recapitulative",\n    \"popularity\": 28956\n  },\n  {\n    \"tag\": "objectivist",\n    \"popularity\": 28895\n  },\n  {\n    \"tag\": "hypermetropia",\n    \"popularity\": 28833\n  },\n  {\n    \"tag\": "incumbency",\n    \"popularity\": 28772\n  },\n  {\n    \"tag\": "protegee",\n    \"popularity\": 28711\n  },\n  {\n    \"tag\": "zealotic",\n    \"popularity\": 28650\n  },\n  {\n    \"tag\": "predebit",\n    \"popularity\": 28589\n  },\n  {\n    \"tag\": "cupolar",\n    \"popularity\": 28528\n  },\n  {\n    \"tag\": "unattributed",\n    \"popularity\": 28468\n  },\n  {\n    \"tag\": "louisine",\n    \"popularity\": 28408\n  },\n  {\n    \"tag\": "illustrate",\n    \"popularity\": 28348\n  },\n  {\n    \"tag\": "inofficiousness",\n    \"popularity\": 28288\n  },\n  {\n    \"tag\": "Americawards",\n    \"popularity\": 28228\n  },\n  {\n    \"tag\": "foreflap",\n    \"popularity\": 28169\n  },\n  {\n    \"tag\": "eruditeness",\n    \"popularity\": 28110\n  },\n  {\n    \"tag\": "copiopsia",\n    \"popularity\": 28051\n  },\n  {\n    \"tag\": "sporuliferous",\n    \"popularity\": 27992\n  },\n  {\n    \"tag\": "muttering",\n    \"popularity\": 27934\n  },\n  {\n    \"tag\": "prepsychology adrip",\n    \"popularity\": 27875\n  },\n  {\n    \"tag\": "unfriendly",\n    \"popularity\": 27817\n  },\n  {\n    \"tag\": "sulphanilic",\n    \"popularity\": 27759\n  },\n  {\n    \"tag\": "Coelococcus",\n    \"popularity\": 27701\n  },\n  {\n    \"tag\": "undoubtfulness",\n    \"popularity\": 27643\n  },\n  {\n    \"tag\": "flaringly",\n    \"popularity\": 27586\n  },\n  {\n    \"tag\": "unordain",\n    \"popularity\": 27529\n  },\n  {\n    \"tag\": "fratchety",\n    \"popularity\": 27472\n  },\n  {\n    \"tag\": "decadentism dolefully",\n    \"popularity\": 27415\n  },\n  {\n    \"tag\": "synthronus",\n    \"popularity\": 27358\n  },\n  {\n    \"tag\": "maiid",\n    \"popularity\": 27301\n  },\n  {\n    \"tag\": "rhinobyon",\n    \"popularity\": 27245\n  },\n  {\n    \"tag\": "Didynamia",\n    \"popularity\": 27189\n  },\n  {\n    \"tag\": "millionairedom",\n    \"popularity\": 27133\n  },\n  {\n    \"tag\": "mulierine",\n    \"popularity\": 27077\n  },\n  {\n    \"tag\": "Mayo",\n    \"popularity\": 27021\n  },\n  {\n    \"tag\": "perceivedness",\n    \"popularity\": 26966\n  },\n  {\n    \"tag\": "unadoration",\n    \"popularity\": 26911\n  },\n  {\n    \"tag\": "regraft",\n    \"popularity\": 26856\n  },\n  {\n    \"tag\": "witch",\n    \"popularity\": 26801\n  },\n  {\n    \"tag\": "ungrow",\n    \"popularity\": 26746\n  },\n  {\n    \"tag\": "glossopharyngeus",\n    \"popularity\": 26691\n  },\n  {\n    \"tag\": "unstirrable",\n    \"popularity\": 26637\n  },\n  {\n    \"tag\": "synodsman",\n    \"popularity\": 26583\n  },\n  {\n    \"tag\": "placentalian",\n    \"popularity\": 26529\n  },\n  {\n    \"tag\": "corpulently",\n    \"popularity\": 26475\n  },\n  {\n    \"tag\": "photochromoscope",\n    \"popularity\": 26421\n  },\n  {\n    \"tag\": "indusiate retinasphaltum chokestrap",\n    \"popularity\": 26368\n  },\n  {\n    \"tag\": "murdrum",\n    \"popularity\": 26314\n  },\n  {\n    \"tag\": "belatedness",\n    \"popularity\": 26261\n  },\n  {\n    \"tag\": "Cochin",\n    \"popularity\": 26208\n  },\n  {\n    \"tag\": "Leonist",\n    \"popularity\": 26155\n  },\n  {\n    \"tag\": "keeker confined",\n    \"popularity\": 26102\n  },\n  {\n    \"tag\": "unintellectual",\n    \"popularity\": 26050\n  },\n  {\n    \"tag\": "nymphaline bait",\n    \"popularity\": 25997\n  },\n  {\n    \"tag\": "sarcosporidiosis",\n    \"popularity\": 25945\n  },\n  {\n    \"tag\": "catawamptiously",\n    \"popularity\": 25893\n  },\n  {\n    \"tag\": "outshame",\n    \"popularity\": 25841\n  },\n  {\n    \"tag\": "animalism",\n    \"popularity\": 25790\n  },\n  {\n    \"tag\": "epithalamial",\n    \"popularity\": 25738\n  },\n  {\n    \"tag\": "ganner",\n    \"popularity\": 25687\n  },\n  {\n    \"tag\": "desilicify",\n    \"popularity\": 25635\n  },\n  {\n    \"tag\": "dandyism",\n    \"popularity\": 25584\n  },\n  {\n    \"tag\": "hyleg",\n    \"popularity\": 25533\n  },\n  {\n    \"tag\": "photophysical",\n    \"popularity\": 25483\n  },\n  {\n    \"tag\": "underload",\n    \"popularity\": 25432\n  },\n  {\n    \"tag\": "unintrusive",\n    \"popularity\": 25382\n  },\n  {\n    \"tag\": "succinamic",\n    \"popularity\": 25331\n  },\n  {\n    \"tag\": "matchy",\n    \"popularity\": 25281\n  },\n  {\n    \"tag\": "concordal",\n    \"popularity\": 25231\n  },\n  {\n    \"tag\": "exteriority",\n    \"popularity\": 25181\n  },\n  {\n    \"tag\": "sterculiad",\n    \"popularity\": 25132\n  },\n  {\n    \"tag\": "sulfoxylic",\n    \"popularity\": 25082\n  },\n  {\n    \"tag\": "oversubscription",\n    \"popularity\": 25033\n  },\n  {\n    \"tag\": "chiasmic",\n    \"popularity\": 24984\n  },\n  {\n    \"tag\": "pseudoparthenogenesis",\n    \"popularity\": 24935\n  },\n  {\n    \"tag\": "indorse",\n    \"popularity\": 24886\n  },\n  {\n    \"tag\": "Krishnaite",\n    \"popularity\": 24837\n  },\n  {\n    \"tag\": "calcinize",\n    \"popularity\": 24788\n  },\n  {\n    \"tag\": "rhodium",\n    \"popularity\": 24740\n  },\n  {\n    \"tag\": "tragopan",\n    \"popularity\": 24692\n  },\n  {\n    \"tag\": "overwhelmingly",\n    \"popularity\": 24643\n  },\n  {\n    \"tag\": "procidence accorporate",\n    \"popularity\": 24595\n  },\n  {\n    \"tag\": "polemize speelless",\n    \"popularity\": 24548\n  },\n  {\n    \"tag\": "radiocarpal goran",\n    \"popularity\": 24500\n  },\n  {\n    \"tag\": "counteroffer Pelodytes",\n    \"popularity\": 24452\n  },\n  {\n    \"tag\": "lionhearted",\n    \"popularity\": 24405\n  },\n  {\n    \"tag\": "paramastoid",\n    \"popularity\": 24358\n  },\n  {\n    \"tag\": "murine",\n    \"popularity\": 24310\n  },\n  {\n    \"tag\": "woodbined",\n    \"popularity\": 24263\n  },\n  {\n    \"tag\": "packthread",\n    \"popularity\": 24217\n  },\n  {\n    \"tag\": "citreous",\n    \"popularity\": 24170\n  },\n  {\n    \"tag\": "unfallaciously",\n    \"popularity\": 24123\n  },\n  {\n    \"tag\": "tentwork reincarnadine",\n    \"popularity\": 24077\n  },\n  {\n    \"tag\": "verminousness",\n    \"popularity\": 24030\n  },\n  {\n    \"tag\": "sillometer",\n    \"popularity\": 23984\n  },\n  {\n    \"tag\": "jointy",\n    \"popularity\": 23938\n  },\n  {\n    \"tag\": "streptolysin",\n    \"popularity\": 23892\n  },\n  {\n    \"tag\": "Florentinism",\n    \"popularity\": 23847\n  },\n  {\n    \"tag\": "monosomatous",\n    \"popularity\": 23801\n  },\n  {\n    \"tag\": "capsulociliary",\n    \"popularity\": 23756\n  },\n  {\n    \"tag\": "organum",\n    \"popularity\": 23710\n  },\n  {\n    \"tag\": "overtly",\n    \"popularity\": 23665\n  },\n  {\n    \"tag\": "ophthalmoscopical",\n    \"popularity\": 23620\n  },\n  {\n    \"tag\": "supposititiously",\n    \"popularity\": 23575\n  },\n  {\n    \"tag\": "radiochemistry",\n    \"popularity\": 23530\n  },\n  {\n    \"tag\": "flaxtail",\n    \"popularity\": 23486\n  },\n  {\n    \"tag\": "pretympanic",\n    \"popularity\": 23441\n  },\n  {\n    \"tag\": "auscultation",\n    \"popularity\": 23397\n  },\n  {\n    \"tag\": "hairdresser",\n    \"popularity\": 23352\n  },\n  {\n    \"tag\": "chaffless",\n    \"popularity\": 23308\n  },\n  {\n    \"tag\": "polioencephalitis",\n    \"popularity\": 23264\n  },\n  {\n    \"tag\": "axolotl",\n    \"popularity\": 23220\n  },\n  {\n    \"tag\": "smous",\n    \"popularity\": 23177\n  },\n  {\n    \"tag\": "morgen disenamour toothed",\n    \"popularity\": 23133\n  },\n  {\n    \"tag\": "chaiseless",\n    \"popularity\": 23089\n  },\n  {\n    \"tag\": "frugally",\n    \"popularity\": 23046\n  },\n  {\n    \"tag\": "combustive antievolutionist cinenegative",\n    \"popularity\": 23003\n  },\n  {\n    \"tag\": "malacolite",\n    \"popularity\": 22960\n  },\n  {\n    \"tag\": "borne",\n    \"popularity\": 22917\n  },\n  {\n    \"tag\": "mercaptole",\n    \"popularity\": 22874\n  },\n  {\n    \"tag\": "judicatory",\n    \"popularity\": 22831\n  },\n  {\n    \"tag\": "noctivagation",\n    \"popularity\": 22789\n  },\n  {\n    \"tag\": "synthete",\n    \"popularity\": 22746\n  },\n  {\n    \"tag\": "tomboyism",\n    \"popularity\": 22704\n  },\n  {\n    \"tag\": "serranoid",\n    \"popularity\": 22661\n  },\n  {\n    \"tag\": "impostorism",\n    \"popularity\": 22619\n  },\n  {\n    \"tag\": "flagellosis Talitha",\n    \"popularity\": 22577\n  },\n  {\n    \"tag\": "pseudoviscous",\n    \"popularity\": 22535\n  },\n  {\n    \"tag\": "Galleriidae",\n    \"popularity\": 22494\n  },\n  {\n    \"tag\": "undulation didelph Comintern",\n    \"popularity\": 22452\n  },\n  {\n    \"tag\": "triangulopyramidal",\n    \"popularity\": 22411\n  },\n  {\n    \"tag\": "middlings",\n    \"popularity\": 22369\n  },\n  {\n    \"tag\": "piperazin",\n    \"popularity\": 22328\n  },\n  {\n    \"tag\": "endostitis",\n    \"popularity\": 22287\n  },\n  {\n    \"tag\": "swordlike",\n    \"popularity\": 22246\n  },\n  {\n    \"tag\": "forthwith",\n    \"popularity\": 22205\n  },\n  {\n    \"tag\": "menaceful",\n    \"popularity\": 22164\n  },\n  {\n    \"tag\": "explantation defective",\n    \"popularity\": 22123\n  },\n  {\n    \"tag\": "arrear",\n    \"popularity\": 22083\n  },\n  {\n    \"tag\": "engraft",\n    \"popularity\": 22042\n  },\n  {\n    \"tag\": "revolunteer",\n    \"popularity\": 22002\n  },\n  {\n    \"tag\": "foliaceous",\n    \"popularity\": 21962\n  },\n  {\n    \"tag\": "pseudograph",\n    \"popularity\": 21922\n  },\n  {\n    \"tag\": "maenaite",\n    \"popularity\": 21882\n  },\n  {\n    \"tag\": "interfinger",\n    \"popularity\": 21842\n  },\n  {\n    \"tag\": "macroscopically",\n    \"popularity\": 21802\n  },\n  {\n    \"tag\": "bluewood",\n    \"popularity\": 21762\n  },\n  {\n    \"tag\": "chikara",\n    \"popularity\": 21723\n  },\n  {\n    \"tag\": "reprehension diazeuxis nickelous",\n    \"popularity\": 21683\n  },\n  {\n    \"tag\": "vacuation",\n    \"popularity\": 21644\n  },\n  {\n    \"tag\": "Sartish",\n    \"popularity\": 21605\n  },\n  {\n    \"tag\": "pseudogyny",\n    \"popularity\": 21566\n  },\n  {\n    \"tag\": "friedcake",\n    \"popularity\": 21527\n  },\n  {\n    \"tag\": "thraw",\n    \"popularity\": 21488\n  },\n  {\n    \"tag\": "bifid",\n    \"popularity\": 21449\n  },\n  {\n    \"tag\": "truthlessly",\n    \"popularity\": 21411\n  },\n  {\n    \"tag\": "lungy",\n    \"popularity\": 21372\n  },\n  {\n    \"tag\": "fluoborite",\n    \"popularity\": 21334\n  },\n  {\n    \"tag\": "anthropolithic",\n    \"popularity\": 21295\n  },\n  {\n    \"tag\": "coachee straw",\n    \"popularity\": 21257\n  },\n  {\n    \"tag\": "dehorner Grecize",\n    \"popularity\": 21219\n  },\n  {\n    \"tag\": "spondylopyosis",\n    \"popularity\": 21181\n  },\n  {\n    \"tag\": "institutionary",\n    \"popularity\": 21143\n  },\n  {\n    \"tag\": "agentry",\n    \"popularity\": 21105\n  },\n  {\n    \"tag\": "musing bietle",\n    \"popularity\": 21068\n  },\n  {\n    \"tag\": "cormophyte",\n    \"popularity\": 21030\n  },\n  {\n    \"tag\": "semielliptic",\n    \"popularity\": 20993\n  },\n  {\n    \"tag\": "ependytes",\n    \"popularity\": 20955\n  },\n  {\n    \"tag\": "coachmaster",\n    \"popularity\": 20918\n  },\n  {\n    \"tag\": "overexuberant",\n    \"popularity\": 20881\n  },\n  {\n    \"tag\": "selectable",\n    \"popularity\": 20844\n  },\n  {\n    \"tag\": "saclike",\n    \"popularity\": 20807\n  },\n  {\n    \"tag\": "mullion",\n    \"popularity\": 20770\n  },\n  {\n    \"tag\": "pantheonize prevalency",\n    \"popularity\": 20733\n  },\n  {\n    \"tag\": "trophosperm",\n    \"popularity\": 20697\n  },\n  {\n    \"tag\": "paraphrasist",\n    \"popularity\": 20660\n  },\n  {\n    \"tag\": "undercarry",\n    \"popularity\": 20624\n  },\n  {\n    \"tag\": "thallogenic",\n    \"popularity\": 20587\n  },\n  {\n    \"tag\": "bulgy forbid",\n    \"popularity\": 20551\n  },\n  {\n    \"tag\": "proliquor gratulatory",\n    \"popularity\": 20515\n  },\n  {\n    \"tag\": "booker",\n    \"popularity\": 20479\n  },\n  {\n    \"tag\": "wizen",\n    \"popularity\": 20443\n  },\n  {\n    \"tag\": "synchondrosially",\n    \"popularity\": 20407\n  },\n  {\n    \"tag\": "herbless",\n    \"popularity\": 20371\n  },\n  {\n    \"tag\": "arfvedsonite",\n    \"popularity\": 20336\n  },\n  {\n    \"tag\": "Neuroptera",\n    \"popularity\": 20300\n  },\n  {\n    \"tag\": "fingerstone",\n    \"popularity\": 20265\n  },\n  {\n    \"tag\": "Odontoglossae",\n    \"popularity\": 20229\n  },\n  {\n    \"tag\": "transmigrator",\n    \"popularity\": 20194\n  },\n  {\n    \"tag\": "Dehaites",\n    \"popularity\": 20159\n  },\n  {\n    \"tag\": "Molinist",\n    \"popularity\": 20124\n  },\n  {\n    \"tag\": "novelistic",\n    \"popularity\": 20089\n  },\n  {\n    \"tag\": "astelic",\n    \"popularity\": 20054\n  },\n  {\n    \"tag\": "pyelometry",\n    \"popularity\": 20019\n  },\n  {\n    \"tag\": "pigmentation",\n    \"popularity\": 19984\n  },\n  {\n    \"tag\": "epinaos",\n    \"popularity\": 19950\n  },\n  {\n    \"tag\": "outdare",\n    \"popularity\": 19915\n  },\n  {\n    \"tag\": "Funje philaristocracy",\n    \"popularity\": 19881\n  },\n  {\n    \"tag\": "keddah",\n    \"popularity\": 19846\n  },\n  {\n    \"tag\": "axoidean",\n    \"popularity\": 19812\n  },\n  {\n    \"tag\": "ovule",\n    \"popularity\": 19778\n  },\n  {\n    \"tag\": "solidify",\n    \"popularity\": 19744\n  },\n  {\n    \"tag\": "noncelestial",\n    \"popularity\": 19710\n  },\n  {\n    \"tag\": "overmultiplication",\n    \"popularity\": 19676\n  },\n  {\n    \"tag\": "hexatetrahedron",\n    \"popularity\": 19642\n  },\n  {\n    \"tag\": "pliciform",\n    \"popularity\": 19609\n  },\n  {\n    \"tag\": "zimbalon",\n    \"popularity\": 19575\n  },\n  {\n    \"tag\": "annexational",\n    \"popularity\": 19542\n  },\n  {\n    \"tag\": "eurhodol",\n    \"popularity\": 19508\n  },\n  {\n    \"tag\": "yark",\n    \"popularity\": 19475\n  },\n  {\n    \"tag\": "illegality nitroalizarin",\n    \"popularity\": 19442\n  },\n  {\n    \"tag\": "quadratum",\n    \"popularity\": 19409\n  },\n  {\n    \"tag\": "saccharine",\n    \"popularity\": 19376\n  },\n  {\n    \"tag\": "unemploy",\n    \"popularity\": 19343\n  },\n  {\n    \"tag\": "uniclinal unipotent",\n    \"popularity\": 19310\n  },\n  {\n    \"tag\": "turbo",\n    \"popularity\": 19277\n  },\n  {\n    \"tag\": "sybarism",\n    \"popularity\": 19244\n  },\n  {\n    \"tag\": "motacilline",\n    \"popularity\": 19212\n  },\n  {\n    \"tag\": "weaselly",\n    \"popularity\": 19179\n  },\n  {\n    \"tag\": "plastid",\n    \"popularity\": 19147\n  },\n  {\n    \"tag\": "wasting",\n    \"popularity\": 19114\n  },\n  {\n    \"tag\": "begrime fluting",\n    \"popularity\": 19082\n  },\n  {\n    \"tag\": "Nephilinae",\n    \"popularity\": 19050\n  },\n  {\n    \"tag\": "disregardance",\n    \"popularity\": 19018\n  },\n  {\n    \"tag\": "Shakerlike",\n    \"popularity\": 18986\n  },\n  {\n    \"tag\": "uniped",\n    \"popularity\": 18954\n  },\n  {\n    \"tag\": "knap",\n    \"popularity\": 18922\n  },\n  {\n    \"tag\": "electivism undergardener",\n    \"popularity\": 18890\n  },\n  {\n    \"tag\": "hulverheaded",\n    \"popularity\": 18858\n  },\n  {\n    \"tag\": "unruptured",\n    \"popularity\": 18827\n  },\n  {\n    \"tag\": "solemnize credently",\n    \"popularity\": 18795\n  },\n  {\n    \"tag\": "pentastomoid possessingly",\n    \"popularity\": 18764\n  },\n  {\n    \"tag\": "octose",\n    \"popularity\": 18733\n  },\n  {\n    \"tag\": "psithurism indefensibility",\n    \"popularity\": 18701\n  },\n  {\n    \"tag\": "torrentuous cyanometer subcrenate",\n    \"popularity\": 18670\n  },\n  {\n    \"tag\": "photoplaywright tapaculo",\n    \"popularity\": 18639\n  },\n  {\n    \"tag\": "univalence",\n    \"popularity\": 18608\n  },\n  {\n    \"tag\": "Porthetria",\n    \"popularity\": 18577\n  },\n  {\n    \"tag\": "funambulo",\n    \"popularity\": 18546\n  },\n  {\n    \"tag\": "pedion",\n    \"popularity\": 18515\n  },\n  {\n    \"tag\": "horticulturally",\n    \"popularity\": 18485\n  },\n  {\n    \"tag\": "marennin",\n    \"popularity\": 18454\n  },\n  {\n    \"tag\": "horselaugh",\n    \"popularity\": 18423\n  },\n  {\n    \"tag\": "semiexecutive",\n    \"popularity\": 18393\n  },\n  {\n    \"tag\": "Monopteridae",\n    \"popularity\": 18363\n  },\n  {\n    \"tag\": "commonable",\n    \"popularity\": 18332\n  },\n  {\n    \"tag\": "dreariment",\n    \"popularity\": 18302\n  },\n  {\n    \"tag\": "disbud",\n    \"popularity\": 18272\n  },\n  {\n    \"tag\": "monocled",\n    \"popularity\": 18242\n  },\n  {\n    \"tag\": "hurlbarrow",\n    \"popularity\": 18212\n  },\n  {\n    \"tag\": "opiateproof",\n    \"popularity\": 18182\n  },\n  {\n    \"tag\": "Fahrenheit",\n    \"popularity\": 18152\n  },\n  {\n    \"tag\": "writhed",\n    \"popularity\": 18122\n  },\n  {\n    \"tag\": "Volstead",\n    \"popularity\": 18093\n  },\n  {\n    \"tag\": "yesternight",\n    \"popularity\": 18063\n  },\n  {\n    \"tag\": "readmittance",\n    \"popularity\": 18033\n  },\n  {\n    \"tag\": "reiterable",\n    \"popularity\": 18004\n  },\n  {\n    \"tag\": "triquetral",\n    \"popularity\": 17975\n  },\n  {\n    \"tag\": "guillotinement",\n    \"popularity\": 17945\n  },\n  {\n    \"tag\": "repermission",\n    \"popularity\": 17916\n  },\n  {\n    \"tag\": "assishly",\n    \"popularity\": 17887\n  },\n  {\n    \"tag\": "daidle",\n    \"popularity\": 17858\n  },\n  {\n    \"tag\": "prismatoid",\n    \"popularity\": 17829\n  },\n  {\n    \"tag\": "irreptitious",\n    \"popularity\": 17800\n  },\n  {\n    \"tag\": "sourdeline",\n    \"popularity\": 17771\n  },\n  {\n    \"tag\": "Austrian",\n    \"popularity\": 17742\n  },\n  {\n    \"tag\": "psychorrhagic",\n    \"popularity\": 17713\n  },\n  {\n    \"tag\": "Monumbo",\n    \"popularity\": 17685\n  },\n  {\n    \"tag\": "cloiochoanitic",\n    \"popularity\": 17656\n  },\n  {\n    \"tag\": "hant",\n    \"popularity\": 17628\n  },\n  {\n    \"tag\": "roily pulldown",\n    \"popularity\": 17599\n  },\n  {\n    \"tag\": "recongratulation",\n    \"popularity\": 17571\n  },\n  {\n    \"tag\": "Peking",\n    \"popularity\": 17543\n  },\n  {\n    \"tag\": "erdvark",\n    \"popularity\": 17514\n  },\n  {\n    \"tag\": "antimnemonic",\n    \"popularity\": 17486\n  },\n  {\n    \"tag\": "noncapillarity",\n    \"popularity\": 17458\n  },\n  {\n    \"tag\": "irrepressive",\n    \"popularity\": 17430\n  },\n  {\n    \"tag\": "Petromyzontes",\n    \"popularity\": 17402\n  },\n  {\n    \"tag\": "piscatorially",\n    \"popularity\": 17374\n  },\n  {\n    \"tag\": "cholesterosis",\n    \"popularity\": 17346\n  },\n  {\n    \"tag\": "denunciate",\n    \"popularity\": 17319\n  },\n  {\n    \"tag\": "unmetalled",\n    \"popularity\": 17291\n  },\n  {\n    \"tag\": "Tigris enruin",\n    \"popularity\": 17263\n  },\n  {\n    \"tag\": "anaspalin",\n    \"popularity\": 17236\n  },\n  {\n    \"tag\": "monodromy",\n    \"popularity\": 17208\n  },\n  {\n    \"tag\": "Canichanan",\n    \"popularity\": 17181\n  },\n  {\n    \"tag\": "mesolabe",\n    \"popularity\": 17154\n  },\n  {\n    \"tag\": "trichothallic overcunningness",\n    \"popularity\": 17127\n  },\n  {\n    \"tag\": "spinsterishly",\n    \"popularity\": 17099\n  },\n  {\n    \"tag\": "sensilla",\n    \"popularity\": 17072\n  },\n  {\n    \"tag\": "wifelkin",\n    \"popularity\": 17045\n  },\n  {\n    \"tag\": "suppositionless",\n    \"popularity\": 17018\n  },\n  {\n    \"tag\": "irksomeness",\n    \"popularity\": 16991\n  },\n  {\n    \"tag\": "sanbenito",\n    \"popularity\": 16964\n  },\n  {\n    \"tag\": "nonstatement",\n    \"popularity\": 16938\n  },\n  {\n    \"tag\": "phenoloid",\n    \"popularity\": 16911\n  },\n  {\n    \"tag\": "Steinberger",\n    \"popularity\": 16884\n  },\n  {\n    \"tag\": "replicated boom",\n    \"popularity\": 16858\n  },\n  {\n    \"tag\": "sciomachiology",\n    \"popularity\": 16831\n  },\n  {\n    \"tag\": "starwise",\n    \"popularity\": 16805\n  },\n  {\n    \"tag\": "prerich",\n    \"popularity\": 16778\n  },\n  {\n    \"tag\": "unspawned",\n    \"popularity\": 16752\n  },\n  {\n    \"tag\": "unindentable",\n    \"popularity\": 16726\n  },\n  {\n    \"tag\": "stromatic",\n    \"popularity\": 16700\n  },\n  {\n    \"tag\": "fetishize",\n    \"popularity\": 16673\n  },\n  {\n    \"tag\": "dihydroxy",\n    \"popularity\": 16647\n  },\n  {\n    \"tag\": "precaudal",\n    \"popularity\": 16621\n  },\n  {\n    \"tag\": "Madagascar",\n    \"popularity\": 16595\n  },\n  {\n    \"tag\": "repinement",\n    \"popularity\": 16570\n  },\n  {\n    \"tag\": "noncathedral wenzel",\n    \"popularity\": 16544\n  },\n  {\n    \"tag\": "corollike",\n    \"popularity\": 16518\n  },\n  {\n    \"tag\": "pubes unamortization",\n    \"popularity\": 16492\n  },\n  {\n    \"tag\": "brickcroft",\n    \"popularity\": 16467\n  },\n  {\n    \"tag\": "intertrabecular",\n    \"popularity\": 16441\n  },\n  {\n    \"tag\": "formulaic",\n    \"popularity\": 16416\n  },\n  {\n    \"tag\": "arienzo",\n    \"popularity\": 16390\n  },\n  {\n    \"tag\": "Mazzinian",\n    \"popularity\": 16365\n  },\n  {\n    \"tag\": "wallowishly",\n    \"popularity\": 16339\n  },\n  {\n    \"tag\": "sysselman",\n    \"popularity\": 16314\n  },\n  {\n    \"tag\": "seligmannite",\n    \"popularity\": 16289\n  },\n  {\n    \"tag\": "harlequinery",\n    \"popularity\": 16264\n  },\n  {\n    \"tag\": "zucchetto",\n    \"popularity\": 16239\n  },\n  {\n    \"tag\": "malonyl",\n    \"popularity\": 16214\n  },\n  {\n    \"tag\": "patwari",\n    \"popularity\": 16189\n  },\n  {\n    \"tag\": "neoholmia venturesomeness",\n    \"popularity\": 16164\n  },\n  {\n    \"tag\": "Dehwar",\n    \"popularity\": 16139\n  },\n  {\n    \"tag\": "fetiferous",\n    \"popularity\": 16114\n  },\n  {\n    \"tag\": "chromatophore",\n    \"popularity\": 16090\n  },\n  {\n    \"tag\": "reregistration",\n    \"popularity\": 16065\n  },\n  {\n    \"tag\": "alienor",\n    \"popularity\": 16040\n  },\n  {\n    \"tag\": "Hexagynia",\n    \"popularity\": 16016\n  },\n  {\n    \"tag\": "cerebrotonia",\n    \"popularity\": 15991\n  },\n  {\n    \"tag\": "deedbox",\n    \"popularity\": 15967\n  },\n  {\n    \"tag\": "staab",\n    \"popularity\": 15943\n  },\n  {\n    \"tag\": "uratemia",\n    \"popularity\": 15918\n  },\n  {\n    \"tag\": "flaunt",\n    \"popularity\": 15894\n  },\n  {\n    \"tag\": "bogy",\n    \"popularity\": 15870\n  },\n  {\n    \"tag\": "subcartilaginous",\n    \"popularity\": 15846\n  },\n  {\n    \"tag\": "protonephridial",\n    \"popularity\": 15822\n  },\n  {\n    \"tag\": "Boswellia",\n    \"popularity\": 15798\n  },\n  {\n    \"tag\": "relaxant untiaraed protoepiphyte",\n    \"popularity\": 15774\n  },\n  {\n    \"tag\": "nesslerization",\n    \"popularity\": 15750\n  },\n  {\n    \"tag\": "precession",\n    \"popularity\": 15726\n  },\n  {\n    \"tag\": "peat",\n    \"popularity\": 15702\n  },\n  {\n    \"tag\": "unbit",\n    \"popularity\": 15678\n  },\n  {\n    \"tag\": "snailish",\n    \"popularity\": 15655\n  },\n  {\n    \"tag\": "porismatical",\n    \"popularity\": 15631\n  },\n  {\n    \"tag\": "hooflike",\n    \"popularity\": 15608\n  },\n  {\n    \"tag\": "resuppose phene cranic",\n    \"popularity\": 15584\n  },\n  {\n    \"tag\": "peptonization kipskin",\n    \"popularity\": 15561\n  },\n  {\n    \"tag\": "birdstone",\n    \"popularity\": 15537\n  },\n  {\n    \"tag\": "empty inferoanterior",\n    \"popularity\": 15514\n  },\n  {\n    \"tag\": "androtauric",\n    \"popularity\": 15491\n  },\n  {\n    \"tag\": "triamide",\n    \"popularity\": 15467\n  },\n  {\n    \"tag\": "showmanry",\n    \"popularity\": 15444\n  },\n  {\n    \"tag\": "doing",\n    \"popularity\": 15421\n  },\n  {\n    \"tag\": "bouchaleen",\n    \"popularity\": 15398\n  },\n  {\n    \"tag\": "precollude",\n    \"popularity\": 15375\n  },\n  {\n    \"tag\": "finger",\n    \"popularity\": 15352\n  },\n  {\n    \"tag\": "limnetic intermessenger",\n    \"popularity\": 15329\n  },\n  {\n    \"tag\": "uncharitable picrotoxic",\n    \"popularity\": 15306\n  },\n  {\n    \"tag\": "nationalizer Phasmidae",\n    \"popularity\": 15283\n  },\n  {\n    \"tag\": "laughingstock",\n    \"popularity\": 15261\n  },\n  {\n    \"tag\": "nondeferential",\n    \"popularity\": 15238\n  },\n  {\n    \"tag\": "uproariously",\n    \"popularity\": 15215\n  },\n  {\n    \"tag\": "manzanilla",\n    \"popularity\": 15193\n  },\n  {\n    \"tag\": "khahoon",\n    \"popularity\": 15170\n  },\n  {\n    \"tag\": "olericulturally longshanks",\n    \"popularity\": 15148\n  },\n  {\n    \"tag\": "enthusiastically methionic",\n    \"popularity\": 15125\n  },\n  {\n    \"tag\": "pobs",\n    \"popularity\": 15103\n  },\n  {\n    \"tag\": "tricarpellate",\n    \"popularity\": 15081\n  },\n  {\n    \"tag\": "souterrain",\n    \"popularity\": 15058\n  },\n  {\n    \"tag\": "tethelin",\n    \"popularity\": 15036\n  },\n  {\n    \"tag\": "tartle",\n    \"popularity\": 15014\n  },\n  {\n    \"tag\": "tidelike",\n    \"popularity\": 14992\n  },\n  {\n    \"tag\": "cosmoramic",\n    \"popularity\": 14970\n  },\n  {\n    \"tag\": "pretardiness",\n    \"popularity\": 14948\n  },\n  {\n    \"tag\": "insoul",\n    \"popularity\": 14926\n  },\n  {\n    \"tag\": "anthroxan",\n    \"popularity\": 14904\n  },\n  {\n    \"tag\": "jilter",\n    \"popularity\": 14882\n  },\n  {\n    \"tag\": "pectinibranchian trematode",\n    \"popularity\": 14860\n  },\n  {\n    \"tag\": "Renaissancist",\n    \"popularity\": 14838\n  },\n  {\n    \"tag\": "imaginant",\n    \"popularity\": 14817\n  },\n  {\n    \"tag\": "supercensure",\n    \"popularity\": 14795\n  },\n  {\n    \"tag\": "festilogy",\n    \"popularity\": 14773\n  },\n  {\n    \"tag\": "regression",\n    \"popularity\": 14752\n  },\n  {\n    \"tag\": "mesobregmate languorously",\n    \"popularity\": 14730\n  },\n  {\n    \"tag\": "unsupernaturalized",\n    \"popularity\": 14709\n  },\n  {\n    \"tag\": "boobyish",\n    \"popularity\": 14687\n  },\n  {\n    \"tag\": "scopolamine",\n    \"popularity\": 14666\n  },\n  {\n    \"tag\": "reamputation unchristianly",\n    \"popularity\": 14645\n  },\n  {\n    \"tag\": "cuneatic",\n    \"popularity\": 14623\n  },\n  {\n    \"tag\": "heathberry",\n    \"popularity\": 14602\n  },\n  {\n    \"tag\": "hate",\n    \"popularity\": 14581\n  },\n  {\n    \"tag\": "redeemableness",\n    \"popularity\": 14560\n  },\n  {\n    \"tag\": "damasse",\n    \"popularity\": 14539\n  },\n  {\n    \"tag\": "thrillsome",\n    \"popularity\": 14518\n  },\n  {\n    \"tag\": "disseverment",\n    \"popularity\": 14497\n  },\n  {\n    \"tag\": "underbishopric Ostyak",\n    \"popularity\": 14476\n  },\n  {\n    \"tag\": "Exoascales",\n    \"popularity\": 14455\n  },\n  {\n    \"tag\": "soiled",\n    \"popularity\": 14434\n  },\n  {\n    \"tag\": "Cain",\n    \"popularity\": 14413\n  },\n  {\n    \"tag\": "mismanageable arenae",\n    \"popularity\": 14392\n  },\n  {\n    \"tag\": "manducate unhinderably",\n    \"popularity\": 14372\n  },\n  {\n    \"tag\": "peregrin",\n    \"popularity\": 14351\n  },\n  {\n    \"tag\": "musicianly",\n    \"popularity\": 14330\n  },\n  {\n    \"tag\": "aln",\n    \"popularity\": 14310\n  },\n  {\n    \"tag\": "intercentrum",\n    \"popularity\": 14289\n  },\n  {\n    \"tag\": "roothold",\n    \"popularity\": 14269\n  },\n  {\n    \"tag\": "jane aneurism",\n    \"popularity\": 14248\n  },\n  {\n    \"tag\": "insinuatively forefeel phytolatrous",\n    \"popularity\": 14228\n  },\n  {\n    \"tag\": "kanchil",\n    \"popularity\": 14208\n  },\n  {\n    \"tag\": "Austrophile",\n    \"popularity\": 14187\n  },\n  {\n    \"tag\": "unterrorized",\n    \"popularity\": 14167\n  },\n  {\n    \"tag\": "admeasure",\n    \"popularity\": 14147\n  },\n  {\n    \"tag\": "electrodissolution",\n    \"popularity\": 14127\n  },\n  {\n    \"tag\": "unweddedly",\n    \"popularity\": 14107\n  },\n  {\n    \"tag\": "unannoying",\n    \"popularity\": 14087\n  },\n  {\n    \"tag\": "uningenuous",\n    \"popularity\": 14067\n  },\n  {\n    \"tag\": "omnibenevolent",\n    \"popularity\": 14047\n  },\n  {\n    \"tag\": "commissure",\n    \"popularity\": 14027\n  },\n  {\n    \"tag\": "tellureted",\n    \"popularity\": 14007\n  },\n  {\n    \"tag\": "suffragan",\n    \"popularity\": 13987\n  },\n  {\n    \"tag\": "sphaeriaceous",\n    \"popularity\": 13967\n  },\n  {\n    \"tag\": "unfearing",\n    \"popularity\": 13947\n  },\n  {\n    \"tag\": "stentoriousness precounsellor",\n    \"popularity\": 13928\n  },\n  {\n    \"tag\": "haemaspectroscope",\n    \"popularity\": 13908\n  },\n  {\n    \"tag\": "teras",\n    \"popularity\": 13888\n  },\n  {\n    \"tag\": "pulicine",\n    \"popularity\": 13869\n  },\n  {\n    \"tag\": "colicystopyelitis",\n    \"popularity\": 13849\n  },\n  {\n    \"tag\": "Physalia",\n    \"popularity\": 13830\n  },\n  {\n    \"tag\": "Saxicolidae",\n    \"popularity\": 13810\n  },\n  {\n    \"tag\": "peritonital",\n    \"popularity\": 13791\n  },\n  {\n    \"tag\": "dysphotic",\n    \"popularity\": 13771\n  },\n  {\n    \"tag\": "unabandoned",\n    \"popularity\": 13752\n  },\n  {\n    \"tag\": "rashful",\n    \"popularity\": 13733\n  },\n  {\n    \"tag\": "goodyness Manobo",\n    \"popularity\": 13714\n  },\n  {\n    \"tag\": "glaring",\n    \"popularity\": 13694\n  },\n  {\n    \"tag\": "horrorful",\n    \"popularity\": 13675\n  },\n  {\n    \"tag\": "intercepting",\n    \"popularity\": 13656\n  },\n  {\n    \"tag\": "semifine",\n    \"popularity\": 13637\n  },\n  {\n    \"tag\": "Gaypoo",\n    \"popularity\": 13618\n  },\n  {\n    \"tag\": "Metrosideros",\n    \"popularity\": 13599\n  },\n  {\n    \"tag\": "thoracicolumbar",\n    \"popularity\": 13580\n  },\n  {\n    \"tag\": "unserried",\n    \"popularity\": 13561\n  },\n  {\n    \"tag\": "keeperess cauterization",\n    \"popularity\": 13542\n  },\n  {\n    \"tag\": "administrant",\n    \"popularity\": 13523\n  },\n  {\n    \"tag\": "unpropitiatedness",\n    \"popularity\": 13505\n  },\n  {\n    \"tag\": "pensileness",\n    \"popularity\": 13486\n  },\n  {\n    \"tag\": "quinaldic unreceivable",\n    \"popularity\": 13467\n  },\n  {\n    \"tag\": "Carnaria",\n    \"popularity\": 13448\n  },\n  {\n    \"tag\": "azothionium wurrus",\n    \"popularity\": 13430\n  },\n  {\n    \"tag\": "mistresshood",\n    \"popularity\": 13411\n  },\n  {\n    \"tag\": "Savara",\n    \"popularity\": 13393\n  },\n  {\n    \"tag\": "dasyurine",\n    \"popularity\": 13374\n  },\n  {\n    \"tag\": "superideal",\n    \"popularity\": 13356\n  },\n  {\n    \"tag\": "Parisianize",\n    \"popularity\": 13337\n  },\n  {\n    \"tag\": "underearth",\n    \"popularity\": 13319\n  },\n  {\n    \"tag\": "athrogenic",\n    \"popularity\": 13301\n  },\n  {\n    \"tag\": "communicate",\n    \"popularity\": 13282\n  },\n  {\n    \"tag\": "denervation enworthed",\n    \"popularity\": 13264\n  },\n  {\n    \"tag\": "subbromide",\n    \"popularity\": 13246\n  },\n  {\n    \"tag\": "stenocoriasis",\n    \"popularity\": 13228\n  },\n  {\n    \"tag\": "facetiousness",\n    \"popularity\": 13209\n  },\n  {\n    \"tag\": "twaddling",\n    \"popularity\": 13191\n  },\n  {\n    \"tag\": "tetartoconid",\n    \"popularity\": 13173\n  },\n  {\n    \"tag\": "audiophile",\n    \"popularity\": 13155\n  },\n  {\n    \"tag\": "fustigate",\n    \"popularity\": 13137\n  },\n  {\n    \"tag\": "Sorbian cacophonia",\n    \"popularity\": 13119\n  },\n  {\n    \"tag\": "fondish",\n    \"popularity\": 13101\n  },\n  {\n    \"tag\": "endomastoiditis",\n    \"popularity\": 13084\n  },\n  {\n    \"tag\": "sniptious",\n    \"popularity\": 13066\n  },\n  {\n    \"tag\": "glochidiate",\n    \"popularity\": 13048\n  },\n  {\n    \"tag\": "polycarboxylic",\n    \"popularity\": 13030\n  },\n  {\n    \"tag\": "stamp",\n    \"popularity\": 13012\n  },\n  {\n    \"tag\": "tritonymph endotoxoid",\n    \"popularity\": 12995\n  },\n  {\n    \"tag\": "wolfskin",\n    \"popularity\": 12977\n  },\n  {\n    \"tag\": "oncosimeter",\n    \"popularity\": 12959\n  },\n  {\n    \"tag\": "outward",\n    \"popularity\": 12942\n  },\n  {\n    \"tag\": "circumscribed",\n    \"popularity\": 12924\n  },\n  {\n    \"tag\": "autohemolytic",\n    \"popularity\": 12907\n  },\n  {\n    \"tag\": "isorhamnose",\n    \"popularity\": 12889\n  },\n  {\n    \"tag\": "monarchomachic",\n    \"popularity\": 12872\n  },\n  {\n    \"tag\": "phaenomenon",\n    \"popularity\": 12855\n  },\n  {\n    \"tag\": "angiopressure",\n    \"popularity\": 12837\n  },\n  {\n    \"tag\": "similarize",\n    \"popularity\": 12820\n  },\n  {\n    \"tag\": "unseeable",\n    \"popularity\": 12803\n  },\n  {\n    \"tag\": "Toryize",\n    \"popularity\": 12785\n  },\n  {\n    \"tag\": "fruitling",\n    \"popularity\": 12768\n  },\n  {\n    \"tag\": "axle",\n    \"popularity\": 12751\n  },\n  {\n    \"tag\": "priestal cocked",\n    \"popularity\": 12734\n  },\n  {\n    \"tag\": "serotoxin",\n    \"popularity\": 12717\n  },\n  {\n    \"tag\": "unmovably",\n    \"popularity\": 12700\n  },\n  {\n    \"tag\": "darbha",\n    \"popularity\": 12683\n  },\n  {\n    \"tag\": "Mongolize",\n    \"popularity\": 12666\n  },\n  {\n    \"tag\": "clusteringly",\n    \"popularity\": 12649\n  },\n  {\n    \"tag\": "tendence",\n    \"popularity\": 12632\n  },\n  {\n    \"tag\": "foziness",\n    \"popularity\": 12615\n  },\n  {\n    \"tag\": "brickkiln lithify",\n    \"popularity\": 12598\n  },\n  {\n    \"tag\": "unpriest",\n    \"popularity\": 12581\n  },\n  {\n    \"tag\": "convincer",\n    \"popularity\": 12564\n  },\n  {\n    \"tag\": "mornlike",\n    \"popularity\": 12548\n  },\n  {\n    \"tag\": "overaddiction ostentatiousness",\n    \"popularity\": 12531\n  },\n  {\n    \"tag\": "diffusively moccasin pendom",\n    \"popularity\": 12514\n  },\n  {\n    \"tag\": "boose",\n    \"popularity\": 12498\n  },\n  {\n    \"tag\": "myonosus",\n    \"popularity\": 12481\n  },\n  {\n    \"tag\": "handsome",\n    \"popularity\": 12464\n  },\n  {\n    \"tag\": "paroxysmic",\n    \"popularity\": 12448\n  },\n  {\n    \"tag\": "Ulidian",\n    \"popularity\": 12431\n  },\n  {\n    \"tag\": "heartache",\n    \"popularity\": 12415\n  },\n  {\n    \"tag\": "torporize",\n    \"popularity\": 12398\n  },\n  {\n    \"tag\": "hippish",\n    \"popularity\": 12382\n  },\n  {\n    \"tag\": "stigmal militation",\n    \"popularity\": 12366\n  },\n  {\n    \"tag\": "matmaker",\n    \"popularity\": 12349\n  },\n  {\n    \"tag\": "marantaceous bivoluminous",\n    \"popularity\": 12333\n  },\n  {\n    \"tag\": "Uraniidae",\n    \"popularity\": 12317\n  },\n  {\n    \"tag\": "risper",\n    \"popularity\": 12301\n  },\n  {\n    \"tag\": "tintinnabulation",\n    \"popularity\": 12284\n  },\n  {\n    \"tag\": "tributorian",\n    \"popularity\": 12268\n  },\n  {\n    \"tag\": "ashamedly",\n    \"popularity\": 12252\n  },\n  {\n    \"tag\": "Macrourus",\n    \"popularity\": 12236\n  },\n  {\n    \"tag\": "Chora",\n    \"popularity\": 12220\n  },\n  {\n    \"tag\": "caul",\n    \"popularity\": 12204\n  },\n  {\n    \"tag\": "exsector",\n    \"popularity\": 12188\n  },\n  {\n    \"tag\": "acutish",\n    \"popularity\": 12172\n  },\n  {\n    \"tag\": "amphichrome",\n    \"popularity\": 12156\n  },\n  {\n    \"tag\": "guarder",\n    \"popularity\": 12140\n  },\n  {\n    \"tag\": "sculpturally",\n    \"popularity\": 12124\n  },\n  {\n    \"tag\": "benightmare",\n    \"popularity\": 12108\n  },\n  {\n    \"tag\": "chucky",\n    \"popularity\": 12093\n  },\n  {\n    \"tag\": "Venetian",\n    \"popularity\": 12077\n  },\n  {\n    \"tag\": "autotheater",\n    \"popularity\": 12061\n  },\n  {\n    \"tag\": "planarioid",\n    \"popularity\": 12045\n  },\n  {\n    \"tag\": "handkerchiefful",\n    \"popularity\": 12030\n  },\n  {\n    \"tag\": "fuliginousness potentize",\n    \"popularity\": 12014\n  },\n  {\n    \"tag\": "pantheum",\n    \"popularity\": 11998\n  },\n  {\n    \"tag\": "heavyweight",\n    \"popularity\": 11983\n  },\n  {\n    \"tag\": "unbrick",\n    \"popularity\": 11967\n  },\n  {\n    \"tag\": "duomachy",\n    \"popularity\": 11952\n  },\n  {\n    \"tag\": "polyphyodont",\n    \"popularity\": 11936\n  },\n  {\n    \"tag\": "hibernacle",\n    \"popularity\": 11921\n  },\n  {\n    \"tag\": "undistend",\n    \"popularity\": 11905\n  },\n  {\n    \"tag\": "hystericky",\n    \"popularity\": 11890\n  },\n  {\n    \"tag\": "paleolimnology",\n    \"popularity\": 11875\n  },\n  {\n    \"tag\": "cedarware",\n    \"popularity\": 11859\n  },\n  {\n    \"tag\": "overwrested",\n    \"popularity\": 11844\n  },\n  {\n    \"tag\": "Syriacism",\n    \"popularity\": 11829\n  },\n  {\n    \"tag\": "pretan",\n    \"popularity\": 11813\n  },\n  {\n    \"tag\": "formant",\n    \"popularity\": 11798\n  },\n  {\n    \"tag\": "pharmacopoeist Fedia",\n    \"popularity\": 11783\n  },\n  {\n    \"tag\": "exorcist eerisome",\n    \"popularity\": 11768\n  },\n  {\n    \"tag\": "separation",\n    \"popularity\": 11753\n  },\n  {\n    \"tag\": "infancy",\n    \"popularity\": 11738\n  },\n  {\n    \"tag\": "ecrasite",\n    \"popularity\": 11723\n  },\n  {\n    \"tag\": "propolize",\n    \"popularity\": 11708\n  },\n  {\n    \"tag\": "uncram phyllin",\n    \"popularity\": 11693\n  },\n  {\n    \"tag\": "thymopathy",\n    \"popularity\": 11678\n  },\n  {\n    \"tag\": "omniscient",\n    \"popularity\": 11663\n  },\n  {\n    \"tag\": "coussinet hazer",\n    \"popularity\": 11648\n  },\n  {\n    \"tag\": "contributiveness",\n    \"popularity\": 11633\n  },\n  {\n    \"tag\": "septifluous",\n    \"popularity\": 11618\n  },\n  {\n    \"tag\": "halfness",\n    \"popularity\": 11603\n  },\n  {\n    \"tag\": "tocher",\n    \"popularity\": 11589\n  },\n  {\n    \"tag\": "monotonist",\n    \"popularity\": 11574\n  },\n  {\n    \"tag\": "headchair",\n    \"popularity\": 11559\n  },\n  {\n    \"tag\": "everywhence",\n    \"popularity\": 11544\n  },\n  {\n    \"tag\": "gerate",\n    \"popularity\": 11530\n  },\n  {\n    \"tag\": "unrepellent",\n    \"popularity\": 11515\n  },\n  {\n    \"tag\": "inidoneous",\n    \"popularity\": 11500\n  },\n  {\n    \"tag\": "Rifi",\n    \"popularity\": 11486\n  },\n  {\n    \"tag\": "unstop",\n    \"popularity\": 11471\n  },\n  {\n    \"tag\": "conformer",\n    \"popularity\": 11457\n  },\n  {\n    \"tag\": "vivisectionally",\n    \"popularity\": 11442\n  },\n  {\n    \"tag\": "nonfinishing",\n    \"popularity\": 11428\n  },\n  {\n    \"tag\": "tyranness",\n    \"popularity\": 11413\n  },\n  {\n    \"tag\": "shepherdage havoc",\n    \"popularity\": 11399\n  },\n  {\n    \"tag\": "coronale",\n    \"popularity\": 11385\n  },\n  {\n    \"tag\": "airmarker",\n    \"popularity\": 11370\n  },\n  {\n    \"tag\": "subpanel",\n    \"popularity\": 11356\n  },\n  {\n    \"tag\": "conciliation",\n    \"popularity\": 11342\n  },\n  {\n    \"tag\": "supergun",\n    \"popularity\": 11327\n  },\n  {\n    \"tag\": "photoheliography",\n    \"popularity\": 11313\n  },\n  {\n    \"tag\": "cacosmia",\n    \"popularity\": 11299\n  },\n  {\n    \"tag\": "caressant",\n    \"popularity\": 11285\n  },\n  {\n    \"tag\": "swivet",\n    \"popularity\": 11270\n  },\n  {\n    \"tag\": "coddler",\n    \"popularity\": 11256\n  },\n  {\n    \"tag\": "rakehellish",\n    \"popularity\": 11242\n  },\n  {\n    \"tag\": "recohabitation",\n    \"popularity\": 11228\n  },\n  {\n    \"tag\": "postillator",\n    \"popularity\": 11214\n  },\n  {\n    \"tag\": "receipt",\n    \"popularity\": 11200\n  },\n  {\n    \"tag\": "nonconformistical",\n    \"popularity\": 11186\n  },\n  {\n    \"tag\": "unglorified",\n    \"popularity\": 11172\n  },\n  {\n    \"tag\": "unordinariness",\n    \"popularity\": 11158\n  },\n  {\n    \"tag\": "tetrahydroxy",\n    \"popularity\": 11144\n  },\n  {\n    \"tag\": "haploperistomic corporeity",\n    \"popularity\": 11130\n  },\n  {\n    \"tag\": "varical",\n    \"popularity\": 11117\n  },\n  {\n    \"tag\": "pilferment",\n    \"popularity\": 11103\n  },\n  {\n    \"tag\": "reverentially playcraft",\n    \"popularity\": 11089\n  },\n  {\n    \"tag\": "unretentive",\n    \"popularity\": 11075\n  },\n  {\n    \"tag\": "readiness",\n    \"popularity\": 11061\n  },\n  {\n    \"tag\": "thermomagnetism",\n    \"popularity\": 11048\n  },\n  {\n    \"tag\": "spotless",\n    \"popularity\": 11034\n  },\n  {\n    \"tag\": "semishrubby",\n    \"popularity\": 11020\n  },\n  {\n    \"tag\": "metrotomy",\n    \"popularity\": 11007\n  },\n  {\n    \"tag\": "hocker",\n    \"popularity\": 10993\n  },\n  {\n    \"tag\": "anecdotal",\n    \"popularity\": 10979\n  },\n  {\n    \"tag\": "tetrabelodont",\n    \"popularity\": 10966\n  },\n  {\n    \"tag\": "Ramillied",\n    \"popularity\": 10952\n  },\n  {\n    \"tag\": "sympatheticism",\n    \"popularity\": 10939\n  },\n  {\n    \"tag\": "kiskatom",\n    \"popularity\": 10925\n  },\n  {\n    \"tag\": "concyclically",\n    \"popularity\": 10912\n  },\n  {\n    \"tag\": "tunicless",\n    \"popularity\": 10899\n  },\n  {\n    \"tag\": "formalistic",\n    \"popularity\": 10885\n  },\n  {\n    \"tag\": "thermacogenesis",\n    \"popularity\": 10872\n  },\n  {\n    \"tag\": "multimotored",\n    \"popularity\": 10858\n  },\n  {\n    \"tag\": "inversive",\n    \"popularity\": 10845\n  },\n  {\n    \"tag\": "Jatki",\n    \"popularity\": 10832\n  },\n  {\n    \"tag\": "highest",\n    \"popularity\": 10818\n  },\n  {\n    \"tag\": "rubidic",\n    \"popularity\": 10805\n  },\n  {\n    \"tag\": "acranial",\n    \"popularity\": 10792\n  },\n  {\n    \"tag\": "pulvinulus",\n    \"popularity\": 10779\n  },\n  {\n    \"tag\": "nattiness",\n    \"popularity\": 10766\n  },\n  {\n    \"tag\": "antisimoniacal",\n    \"popularity\": 10752\n  },\n  {\n    \"tag\": "tetanize",\n    \"popularity\": 10739\n  },\n  {\n    \"tag\": "spectrophobia",\n    \"popularity\": 10726\n  },\n  {\n    \"tag\": "monopolitical",\n    \"popularity\": 10713\n  },\n  {\n    \"tag\": "teallite",\n    \"popularity\": 10700\n  },\n  {\n    \"tag\": "alicyclic interpellator",\n    \"popularity\": 10687\n  },\n  {\n    \"tag\": "nonsynthesized",\n    \"popularity\": 10674\n  },\n  {\n    \"tag\": "wheelwrighting",\n    \"popularity\": 10661\n  },\n  {\n    \"tag\": "pelliculate",\n    \"popularity\": 10648\n  },\n  {\n    \"tag\": "Euphyllopoda",\n    \"popularity\": 10635\n  },\n  {\n    \"tag\": "graver",\n    \"popularity\": 10622\n  },\n  {\n    \"tag\": "automorph",\n    \"popularity\": 10609\n  },\n  {\n    \"tag\": "underhanded",\n    \"popularity\": 10597\n  },\n  {\n    \"tag\": "causal",\n    \"popularity\": 10584\n  },\n  {\n    \"tag\": "odoom",\n    \"popularity\": 10571\n  },\n  {\n    \"tag\": "apodictical",\n    \"popularity\": 10558\n  },\n  {\n    \"tag\": "foundery",\n    \"popularity\": 10545\n  },\n  {\n    \"tag\": "unneighbored",\n    \"popularity\": 10533\n  },\n  {\n    \"tag\": "woolshearing",\n    \"popularity\": 10520\n  },\n  {\n    \"tag\": "boschveld",\n    \"popularity\": 10507\n  },\n  {\n    \"tag\": "unhardened lipopod",\n    \"popularity\": 10495\n  },\n  {\n    \"tag\": "unenriching",\n    \"popularity\": 10482\n  },\n  {\n    \"tag\": "spak",\n    \"popularity\": 10469\n  },\n  {\n    \"tag\": "yogasana",\n    \"popularity\": 10457\n  },\n  {\n    \"tag\": "depoetize",\n    \"popularity\": 10444\n  },\n  {\n    \"tag\": "parousiamania",\n    \"popularity\": 10432\n  },\n  {\n    \"tag\": "longlegs",\n    \"popularity\": 10419\n  },\n  {\n    \"tag\": "gelatinizability",\n    \"popularity\": 10407\n  },\n  {\n    \"tag\": "edeology",\n    \"popularity\": 10394\n  },\n  {\n    \"tag\": "sodwork",\n    \"popularity\": 10382\n  },\n  {\n    \"tag\": "somnambule",\n    \"popularity\": 10369\n  },\n  {\n    \"tag\": "antiquing",\n    \"popularity\": 10357\n  },\n  {\n    \"tag\": "intaker",\n    \"popularity\": 10344\n  },\n  {\n    \"tag\": "Gerberia",\n    \"popularity\": 10332\n  },\n  {\n    \"tag\": "preadmit",\n    \"popularity\": 10320\n  },\n  {\n    \"tag\": "bullhorn",\n    \"popularity\": 10307\n  },\n  {\n    \"tag\": "sororal",\n    \"popularity\": 10295\n  },\n  {\n    \"tag\": "phaeophyceous",\n    \"popularity\": 10283\n  },\n  {\n    \"tag\": "omphalopsychite",\n    \"popularity\": 10271\n  },\n  {\n    \"tag\": "substantious",\n    \"popularity\": 10258\n  },\n  {\n    \"tag\": "undemonstratively",\n    \"popularity\": 10246\n  },\n  {\n    \"tag\": "corallike blackit",\n    \"popularity\": 10234\n  },\n  {\n    \"tag\": "amoebous",\n    \"popularity\": 10222\n  },\n  {\n    \"tag\": "Polypodium",\n    \"popularity\": 10210\n  },\n  {\n    \"tag\": "blodite",\n    \"popularity\": 10198\n  },\n  {\n    \"tag\": "hordarian",\n    \"popularity\": 10186\n  },\n  {\n    \"tag\": "nonmoral",\n    \"popularity\": 10174\n  },\n  {\n    \"tag\": "dredgeful",\n    \"popularity\": 10162\n  },\n  {\n    \"tag\": "nourishingly",\n    \"popularity\": 10150\n  },\n  {\n    \"tag\": "seamy",\n    \"popularity\": 10138\n  },\n  {\n    \"tag\": "vara",\n    \"popularity\": 10126\n  },\n  {\n    \"tag\": "incorruptibleness",\n    \"popularity\": 10114\n  },\n  {\n    \"tag\": "manipulator",\n    \"popularity\": 10102\n  },\n  {\n    \"tag\": "chromodiascope uncountably",\n    \"popularity\": 10090\n  },\n  {\n    \"tag\": "typhemia",\n    \"popularity\": 10078\n  },\n  {\n    \"tag\": "Smalcaldic",\n    \"popularity\": 10066\n  },\n  {\n    \"tag\": "precontrive",\n    \"popularity\": 10054\n  },\n  {\n    \"tag\": "sowarry",\n    \"popularity\": 10042\n  },\n  {\n    \"tag\": "monopodic",\n    \"popularity\": 10031\n  },\n  {\n    \"tag\": "recodify",\n    \"popularity\": 10019\n  },\n  {\n    \"tag\": "phosphowolframic rimple",\n    \"popularity\": 10007\n  },\n  {\n    \"tag\": "triconch",\n    \"popularity\": 9995\n  },\n  {\n    \"tag\": "pycnodontoid",\n    \"popularity\": 9984\n  },\n  {\n    \"tag\": "bradyspermatism",\n    \"popularity\": 9972\n  },\n  {\n    \"tag\": "extensionist",\n    \"popularity\": 9960\n  },\n  {\n    \"tag\": "characterize",\n    \"popularity\": 9949\n  },\n  {\n    \"tag\": "anatreptic proteolytic",\n    \"popularity\": 9937\n  },\n  {\n    \"tag\": "waterboard",\n    \"popularity\": 9925\n  },\n  {\n    \"tag\": "allopathically",\n    \"popularity\": 9914\n  },\n  {\n    \"tag\": "arithmetician",\n    \"popularity\": 9902\n  },\n  {\n    \"tag\": "subsist",\n    \"popularity\": 9891\n  },\n  {\n    \"tag\": "Islamitish",\n    \"popularity\": 9879\n  },\n  {\n    \"tag\": "biddy",\n    \"popularity\": 9868\n  },\n  {\n    \"tag\": "reverberation",\n    \"popularity\": 9856\n  },\n  {\n    \"tag\": "Zaporogue",\n    \"popularity\": 9845\n  },\n  {\n    \"tag\": "soapberry",\n    \"popularity\": 9833\n  },\n  {\n    \"tag\": "physiognomics",\n    \"popularity\": 9822\n  },\n  {\n    \"tag\": "hospitalization",\n    \"popularity\": 9810\n  },\n  {\n    \"tag\": "dissembler",\n    \"popularity\": 9799\n  },\n  {\n    \"tag\": "festinate",\n    \"popularity\": 9788\n  },\n  {\n    \"tag\": "angiectopia",\n    \"popularity\": 9776\n  },\n  {\n    \"tag\": "Pulicidae",\n    \"popularity\": 9765\n  },\n  {\n    \"tag\": "beslimer",\n    \"popularity\": 9754\n  },\n  {\n    \"tag\": "nontreaty",\n    \"popularity\": 9743\n  },\n  {\n    \"tag\": "unhaggled",\n    \"popularity\": 9731\n  },\n  {\n    \"tag\": "catfall",\n    \"popularity\": 9720\n  },\n  {\n    \"tag\": "stola",\n    \"popularity\": 9709\n  },\n  {\n    \"tag\": "pataco",\n    \"popularity\": 9698\n  },\n  {\n    \"tag\": "ontologistic",\n    \"popularity\": 9686\n  },\n  {\n    \"tag\": "aerosphere",\n    \"popularity\": 9675\n  },\n  {\n    \"tag\": "deobstruent",\n    \"popularity\": 9664\n  },\n  {\n    \"tag\": "threepence",\n    \"popularity\": 9653\n  },\n  {\n    \"tag\": "cyprinoid",\n    \"popularity\": 9642\n  },\n  {\n    \"tag\": "overbank",\n    \"popularity\": 9631\n  },\n  {\n    \"tag\": "prostyle",\n    \"popularity\": 9620\n  },\n  {\n    \"tag\": "photoactivation",\n    \"popularity\": 9609\n  },\n  {\n    \"tag\": "homothetic",\n    \"popularity\": 9598\n  },\n  {\n    \"tag\": "roguedom",\n    \"popularity\": 9587\n  },\n  {\n    \"tag\": "underschool",\n    \"popularity\": 9576\n  },\n  {\n    \"tag\": "tractility",\n    \"popularity\": 9565\n  },\n  {\n    \"tag\": "gardenin",\n    \"popularity\": 9554\n  },\n  {\n    \"tag\": "Micromastictora",\n    \"popularity\": 9543\n  },\n  {\n    \"tag\": "gossypine",\n    \"popularity\": 9532\n  },\n  {\n    \"tag\": "amylodyspepsia",\n    \"popularity\": 9521\n  },\n  {\n    \"tag\": "Luciana",\n    \"popularity\": 9510\n  },\n  {\n    \"tag\": "meetly nonfisherman",\n    \"popularity\": 9500\n  },\n  {\n    \"tag\": "backhanded",\n    \"popularity\": 9489\n  },\n  {\n    \"tag\": "decrustation",\n    \"popularity\": 9478\n  },\n  {\n    \"tag\": "pinrail",\n    \"popularity\": 9467\n  },\n  {\n    \"tag\": "Mahori",\n    \"popularity\": 9456\n  },\n  {\n    \"tag\": "unsizable",\n    \"popularity\": 9446\n  },\n  {\n    \"tag\": "disawa",\n    \"popularity\": 9435\n  },\n  {\n    \"tag\": "launderability inconsidered",\n    \"popularity\": 9424\n  },\n  {\n    \"tag\": "unclassical",\n    \"popularity\": 9414\n  },\n  {\n    \"tag\": "inobtrusiveness",\n    \"popularity\": 9403\n  },\n  {\n    \"tag\": "sialogenous",\n    \"popularity\": 9392\n  },\n  {\n    \"tag\": "sulphonamide",\n    \"popularity\": 9382\n  },\n  {\n    \"tag\": "diluvion",\n    \"popularity\": 9371\n  },\n  {\n    \"tag\": "deuteranope",\n    \"popularity\": 9361\n  },\n  {\n    \"tag\": "addition",\n    \"popularity\": 9350\n  },\n  {\n    \"tag\": "bockeret",\n    \"popularity\": 9339\n  },\n  {\n    \"tag\": "unidentified",\n    \"popularity\": 9329\n  },\n  {\n    \"tag\": "caryatic",\n    \"popularity\": 9318\n  },\n  {\n    \"tag\": "misattribution",\n    \"popularity\": 9308\n  },\n  {\n    \"tag\": "outray",\n    \"popularity\": 9297\n  },\n  {\n    \"tag\": "areometrical",\n    \"popularity\": 9287\n  },\n  {\n    \"tag\": "antilogism",\n    \"popularity\": 9277\n  },\n  {\n    \"tag\": "inadjustable",\n    \"popularity\": 9266\n  },\n  {\n    \"tag\": "byssus",\n    \"popularity\": 9256\n  },\n  {\n    \"tag\": "trun",\n    \"popularity\": 9245\n  },\n  {\n    \"tag\": "thereology",\n    \"popularity\": 9235\n  },\n  {\n    \"tag\": "extort",\n    \"popularity\": 9225\n  },\n  {\n    \"tag\": "bumpkin",\n    \"popularity\": 9214\n  },\n  {\n    \"tag\": "sulphobenzide",\n    \"popularity\": 9204\n  },\n  {\n    \"tag\": "hydrogeology",\n    \"popularity\": 9194\n  },\n  {\n    \"tag\": "nidulariaceous",\n    \"popularity\": 9183\n  },\n  {\n    \"tag\": "propodiale",\n    \"popularity\": 9173\n  },\n  {\n    \"tag\": "fierily",\n    \"popularity\": 9163\n  },\n  {\n    \"tag\": "aerotonometry",\n    \"popularity\": 9153\n  },\n  {\n    \"tag\": "pelobatid oversuperstitious",\n    \"popularity\": 9142\n  },\n  {\n    \"tag\": "restringent",\n    \"popularity\": 9132\n  },\n  {\n    \"tag\": "tetrapodic",\n    \"popularity\": 9122\n  },\n  {\n    \"tag\": "heroicness Vendidad",\n    \"popularity\": 9112\n  },\n  {\n    \"tag\": "Sphingurus",\n    \"popularity\": 9102\n  },\n  {\n    \"tag\": "sclerote",\n    \"popularity\": 9092\n  },\n  {\n    \"tag\": "unkeyed",\n    \"popularity\": 9082\n  },\n  {\n    \"tag\": "superparliamentary",\n    \"popularity\": 9072\n  },\n  {\n    \"tag\": "hetericism",\n    \"popularity\": 9061\n  },\n  {\n    \"tag\": "hucklebone",\n    \"popularity\": 9051\n  },\n  {\n    \"tag\": "yojan",\n    \"popularity\": 9041\n  },\n  {\n    \"tag\": "bossed",\n    \"popularity\": 9031\n  },\n  {\n    \"tag\": "spiderwork",\n    \"popularity\": 9021\n  },\n  {\n    \"tag\": "millfeed dullery",\n    \"popularity\": 9011\n  },\n  {\n    \"tag\": "adnoun",\n    \"popularity\": 9001\n  },\n  {\n    \"tag\": "mesometric",\n    \"popularity\": 8992\n  },\n  {\n    \"tag\": "doublehandedness",\n    \"popularity\": 8982\n  },\n  {\n    \"tag\": "suppurant",\n    \"popularity\": 8972\n  },\n  {\n    \"tag\": "Berlinize",\n    \"popularity\": 8962\n  },\n  {\n    \"tag\": "sontag",\n    \"popularity\": 8952\n  },\n  {\n    \"tag\": "biplane",\n    \"popularity\": 8942\n  },\n  {\n    \"tag\": "insula",\n    \"popularity\": 8932\n  },\n  {\n    \"tag\": "unbrand",\n    \"popularity\": 8922\n  },\n  {\n    \"tag\": "Basilosaurus",\n    \"popularity\": 8913\n  },\n  {\n    \"tag\": "prenomination",\n    \"popularity\": 8903\n  },\n  {\n    \"tag\": "untextual",\n    \"popularity\": 8893\n  },\n  {\n    \"tag\": "coleslaw",\n    \"popularity\": 8883\n  },\n  {\n    \"tag\": "langsyne",\n    \"popularity\": 8874\n  },\n  {\n    \"tag\": "impede",\n    \"popularity\": 8864\n  },\n  {\n    \"tag\": "irrigator",\n    \"popularity\": 8854\n  },\n  {\n    \"tag\": "deflocculation",\n    \"popularity\": 8844\n  },\n  {\n    \"tag\": "narghile",\n    \"popularity\": 8835\n  },\n  {\n    \"tag\": "unguardedly ebenaceous",\n    \"popularity\": 8825\n  },\n  {\n    \"tag\": "conversantly subocular",\n    \"popularity\": 8815\n  },\n  {\n    \"tag\": "hydroponic",\n    \"popularity\": 8806\n  },\n  {\n    \"tag\": "anthropopsychism",\n    \"popularity\": 8796\n  },\n  {\n    \"tag\": "panoptic",\n    \"popularity\": 8787\n  },\n  {\n    \"tag\": "insufferable",\n    \"popularity\": 8777\n  },\n  {\n    \"tag\": "salema",\n    \"popularity\": 8768\n  },\n  {\n    \"tag\": "Myriapoda",\n    \"popularity\": 8758\n  },\n  {\n    \"tag\": "regarrison",\n    \"popularity\": 8748\n  },\n  {\n    \"tag\": "overlearned",\n    \"popularity\": 8739\n  },\n  {\n    \"tag\": "ultraroyalist conventical bureaucratical",\n    \"popularity\": 8729\n  },\n  {\n    \"tag\": "epicaridan",\n    \"popularity\": 8720\n  },\n  {\n    \"tag\": "poetastress",\n    \"popularity\": 8711\n  },\n  {\n    \"tag\": "monophthalmus",\n    \"popularity\": 8701\n  },\n  {\n    \"tag\": "simnel",\n    \"popularity\": 8692\n  },\n  {\n    \"tag\": "compotor",\n    \"popularity\": 8682\n  },\n  {\n    \"tag\": "hydrolase",\n    \"popularity\": 8673\n  },\n  {\n    \"tag\": "attemptless",\n    \"popularity\": 8663\n  },\n  {\n    \"tag\": "visceroptosis",\n    \"popularity\": 8654\n  },\n  {\n    \"tag\": "unpreparedly",\n    \"popularity\": 8645\n  },\n  {\n    \"tag\": "mastage",\n    \"popularity\": 8635\n  },\n  {\n    \"tag\": "preinfluence",\n    \"popularity\": 8626\n  },\n  {\n    \"tag\": "Siwan",\n    \"popularity\": 8617\n  },\n  {\n    \"tag\": "ceratotheca belvedere",\n    \"popularity\": 8607\n  },\n  {\n    \"tag\": "disenablement",\n    \"popularity\": 8598\n  },\n  {\n    \"tag\": "nine",\n    \"popularity\": 8589\n  },\n  {\n    \"tag\": "spellingdown abridgment",\n    \"popularity\": 8580\n  },\n  {\n    \"tag\": "twilightless",\n    \"popularity\": 8571\n  },\n  {\n    \"tag\": "overflow",\n    \"popularity\": 8561\n  },\n  {\n    \"tag\": "mismeasurement",\n    \"popularity\": 8552\n  },\n  {\n    \"tag\": "nawabship",\n    \"popularity\": 8543\n  },\n  {\n    \"tag\": "Phrynosoma",\n    \"popularity\": 8534\n  },\n  {\n    \"tag\": "unanticipatingly",\n    \"popularity\": 8525\n  },\n  {\n    \"tag\": "blankite",\n    \"popularity\": 8516\n  },\n  {\n    \"tag\": "role",\n    \"popularity\": 8506\n  },\n  {\n    \"tag\": "peperine edelweiss",\n    \"popularity\": 8497\n  },\n  {\n    \"tag\": "unhysterical",\n    \"popularity\": 8488\n  },\n  {\n    \"tag\": "attentiveness",\n    \"popularity\": 8479\n  },\n  {\n    \"tag\": "scintillant",\n    \"popularity\": 8470\n  },\n  {\n    \"tag\": "stenostomatous",\n    \"popularity\": 8461\n  },\n  {\n    \"tag\": "pectinite",\n    \"popularity\": 8452\n  },\n  {\n    \"tag\": "herring",\n    \"popularity\": 8443\n  },\n  {\n    \"tag\": "interroom",\n    \"popularity\": 8434\n  },\n  {\n    \"tag\": "laccol",\n    \"popularity\": 8425\n  },\n  {\n    \"tag\": "unpartably kylite",\n    \"popularity\": 8416\n  },\n  {\n    \"tag\": "spirivalve",\n    \"popularity\": 8407\n  },\n  {\n    \"tag\": "hoosegow",\n    \"popularity\": 8398\n  },\n  {\n    \"tag\": "doat",\n    \"popularity\": 8389\n  },\n  {\n    \"tag\": "amphibian",\n    \"popularity\": 8380\n  },\n  {\n    \"tag\": "exposit",\n    \"popularity\": 8371\n  },\n  {\n    \"tag\": "canopy",\n    \"popularity\": 8363\n  },\n  {\n    \"tag\": "houndlike",\n    \"popularity\": 8354\n  },\n  {\n    \"tag\": "spikebill",\n    \"popularity\": 8345\n  },\n  {\n    \"tag\": "wiseacre pyrotechnic",\n    \"popularity\": 8336\n  },\n  {\n    \"tag\": "confessingly woodman",\n    \"popularity\": 8327\n  },\n  {\n    \"tag\": "overside",\n    \"popularity\": 8318\n  },\n  {\n    \"tag\": "oftwhiles",\n    \"popularity\": 8310\n  },\n  {\n    \"tag\": "Musophagidae",\n    \"popularity\": 8301\n  },\n  {\n    \"tag\": "slumberer",\n    \"popularity\": 8292\n  },\n  {\n    \"tag\": "leiotrichy",\n    \"popularity\": 8283\n  },\n  {\n    \"tag\": "Mantispidae",\n    \"popularity\": 8275\n  },\n  {\n    \"tag\": "perceptually",\n    \"popularity\": 8266\n  },\n  {\n    \"tag\": "biller",\n    \"popularity\": 8257\n  },\n  {\n    \"tag\": "eudaemonical",\n    \"popularity\": 8249\n  },\n  {\n    \"tag\": "underfiend",\n    \"popularity\": 8240\n  },\n  {\n    \"tag\": "impartible",\n    \"popularity\": 8231\n  },\n  {\n    \"tag\": "saxicavous",\n    \"popularity\": 8223\n  },\n  {\n    \"tag\": "yapster",\n    \"popularity\": 8214\n  },\n  {\n    \"tag\": "aliseptal",\n    \"popularity\": 8205\n  },\n  {\n    \"tag\": "omniparient",\n    \"popularity\": 8197\n  },\n  {\n    \"tag\": "nishiki",\n    \"popularity\": 8188\n  },\n  {\n    \"tag\": "yuzluk",\n    \"popularity\": 8180\n  },\n  {\n    \"tag\": "solderer",\n    \"popularity\": 8171\n  },\n  {\n    \"tag\": "Pinna",\n    \"popularity\": 8162\n  },\n  {\n    \"tag\": "reinterfere",\n    \"popularity\": 8154\n  },\n  {\n    \"tag\": "superepic",\n    \"popularity\": 8145\n  },\n  {\n    \"tag\": "ronquil",\n    \"popularity\": 8137\n  },\n  {\n    \"tag\": "bratstvo",\n    \"popularity\": 8128\n  },\n  {\n    \"tag\": "Thea",\n    \"popularity\": 8120\n  },\n  {\n    \"tag\": "hermaphroditical",\n    \"popularity\": 8111\n  },\n  {\n    \"tag\": "enlief",\n    \"popularity\": 8103\n  },\n  {\n    \"tag\": "Jesuate",\n    \"popularity\": 8095\n  },\n  {\n    \"tag\": "gaysome",\n    \"popularity\": 8086\n  },\n  {\n    \"tag\": "iliohypogastric",\n    \"popularity\": 8078\n  },\n  {\n    \"tag\": "regardance",\n    \"popularity\": 8069\n  },\n  {\n    \"tag\": "cumulately",\n    \"popularity\": 8061\n  },\n  {\n    \"tag\": "haustorial nucleolocentrosome",\n    \"popularity\": 8053\n  },\n  {\n    \"tag\": "cosmocrat",\n    \"popularity\": 8044\n  },\n  {\n    \"tag\": "onyxitis",\n    \"popularity\": 8036\n  },\n  {\n    \"tag\": "Cabinda",\n    \"popularity\": 8028\n  },\n  {\n    \"tag\": "coresort",\n    \"popularity\": 8019\n  },\n  {\n    \"tag\": "drusy preformant",\n    \"popularity\": 8011\n  },\n  {\n    \"tag\": "piningly",\n    \"popularity\": 8003\n  },\n  {\n    \"tag\": "bootlessly",\n    \"popularity\": 7994\n  },\n  {\n    \"tag\": "talari",\n    \"popularity\": 7986\n  },\n  {\n    \"tag\": "amidoacetal",\n    \"popularity\": 7978\n  },\n  {\n    \"tag\": "pschent",\n    \"popularity\": 7970\n  },\n  {\n    \"tag\": "consumptional scarer titivate",\n    \"popularity\": 7962\n  },\n  {\n    \"tag\": "Anserinae",\n    \"popularity\": 7953\n  },\n  {\n    \"tag\": "flaunter",\n    \"popularity\": 7945\n  },\n  {\n    \"tag\": "reindeer",\n    \"popularity\": 7937\n  },\n  {\n    \"tag\": "disparage",\n    \"popularity\": 7929\n  },\n  {\n    \"tag\": "superheat",\n    \"popularity\": 7921\n  },\n  {\n    \"tag\": "Chromatium",\n    \"popularity\": 7912\n  },\n  {\n    \"tag\": "Tina",\n    \"popularity\": 7904\n  },\n  {\n    \"tag\": "rededicatory",\n    \"popularity\": 7896\n  },\n  {\n    \"tag\": "nontransient",\n    \"popularity\": 7888\n  },\n  {\n    \"tag\": "Phocaean brinkless",\n    \"popularity\": 7880\n  },\n  {\n    \"tag\": "ventriculose",\n    \"popularity\": 7872\n  },\n  {\n    \"tag\": "upplough",\n    \"popularity\": 7864\n  },\n  {\n    \"tag\": "succorless",\n    \"popularity\": 7856\n  },\n  {\n    \"tag\": "hayrake",\n    \"popularity\": 7848\n  },\n  {\n    \"tag\": "merriness amorphia",\n    \"popularity\": 7840\n  },\n  {\n    \"tag\": "merycism",\n    \"popularity\": 7832\n  },\n  {\n    \"tag\": "checkrow",\n    \"popularity\": 7824\n  },\n  {\n    \"tag\": "scry",\n    \"popularity\": 7816\n  },\n  {\n    \"tag\": "obvolve",\n    \"popularity\": 7808\n  },\n  {\n    \"tag\": "orchard",\n    \"popularity\": 7800\n  },\n  {\n    \"tag\": "isomerize",\n    \"popularity\": 7792\n  },\n  {\n    \"tag\": "competitrix",\n    \"popularity\": 7784\n  },\n  {\n    \"tag\": "unbannered",\n    \"popularity\": 7776\n  },\n  {\n    \"tag\": "undoctrined",\n    \"popularity\": 7768\n  },\n  {\n    \"tag\": "theologian",\n    \"popularity\": 7760\n  },\n  {\n    \"tag\": "nebby",\n    \"popularity\": 7752\n  },\n  {\n    \"tag\": "Cardiazol",\n    \"popularity\": 7745\n  },\n  {\n    \"tag\": "phagedenic",\n    \"popularity\": 7737\n  },\n  {\n    \"tag\": "nostalgic",\n    \"popularity\": 7729\n  },\n  {\n    \"tag\": "orthodoxy",\n    \"popularity\": 7721\n  },\n  {\n    \"tag\": "oversanguine",\n    \"popularity\": 7713\n  },\n  {\n    \"tag\": "lish",\n    \"popularity\": 7705\n  },\n  {\n    \"tag\": "ketogenic",\n    \"popularity\": 7698\n  },\n  {\n    \"tag\": "syndicalize",\n    \"popularity\": 7690\n  },\n  {\n    \"tag\": "leeftail",\n    \"popularity\": 7682\n  },\n  {\n    \"tag\": "bulbomedullary",\n    \"popularity\": 7674\n  },\n  {\n    \"tag\": "reletter",\n    \"popularity\": 7667\n  },\n  {\n    \"tag\": "bitterly",\n    \"popularity\": 7659\n  },\n  {\n    \"tag\": "participatory",\n    \"popularity\": 7651\n  },\n  {\n    \"tag\": "baldberry",\n    \"popularity\": 7643\n  },\n  {\n    \"tag\": "prowaterpower",\n    \"popularity\": 7636\n  },\n  {\n    \"tag\": "lexicographical",\n    \"popularity\": 7628\n  },\n  {\n    \"tag\": "Anisodactyli",\n    \"popularity\": 7620\n  },\n  {\n    \"tag\": "amphipodous",\n    \"popularity\": 7613\n  },\n  {\n    \"tag\": "triglandular",\n    \"popularity\": 7605\n  },\n  {\n    \"tag\": "xanthopsin",\n    \"popularity\": 7597\n  },\n  {\n    \"tag\": "indefinitude",\n    \"popularity\": 7590\n  },\n  {\n    \"tag\": "bookworm",\n    \"popularity\": 7582\n  },\n  {\n    \"tag\": "suffocative",\n    \"popularity\": 7574\n  },\n  {\n    \"tag\": "uncongested tyrant",\n    \"popularity\": 7567\n  },\n  {\n    \"tag\": "alow harmoniously Pamir",\n    \"popularity\": 7559\n  },\n  {\n    \"tag\": "monander",\n    \"popularity\": 7552\n  },\n  {\n    \"tag\": "bagatelle",\n    \"popularity\": 7544\n  },\n  {\n    \"tag\": "membranology",\n    \"popularity\": 7537\n  },\n  {\n    \"tag\": "parturifacient",\n    \"popularity\": 7529\n  },\n  {\n    \"tag\": "excitovascular",\n    \"popularity\": 7522\n  },\n  {\n    \"tag\": "homopolar",\n    \"popularity\": 7514\n  },\n  {\n    \"tag\": "phobiac",\n    \"popularity\": 7507\n  },\n  {\n    \"tag\": "clype",\n    \"popularity\": 7499\n  },\n  {\n    \"tag\": "unsubversive",\n    \"popularity\": 7492\n  },\n  {\n    \"tag\": "bostrychoidal scorpionwort",\n    \"popularity\": 7484\n  },\n  {\n    \"tag\": "biliteralism",\n    \"popularity\": 7477\n  },\n  {\n    \"tag\": "dentatocostate",\n    \"popularity\": 7469\n  },\n  {\n    \"tag\": "Pici",\n    \"popularity\": 7462\n  },\n  {\n    \"tag\": "sideritic",\n    \"popularity\": 7454\n  },\n  {\n    \"tag\": "syntaxis",\n    \"popularity\": 7447\n  },\n  {\n    \"tag\": "ingest",\n    \"popularity\": 7440\n  },\n  {\n    \"tag\": "rigmarolish",\n    \"popularity\": 7432\n  },\n  {\n    \"tag\": "ocreaceous",\n    \"popularity\": 7425\n  },\n  {\n    \"tag\": "hyperbrachyskelic",\n    \"popularity\": 7418\n  },\n  {\n    \"tag\": "basophobia",\n    \"popularity\": 7410\n  },\n  {\n    \"tag\": "substantialness",\n    \"popularity\": 7403\n  },\n  {\n    \"tag\": "agglutinoid",\n    \"popularity\": 7396\n  },\n  {\n    \"tag\": "longleaf",\n    \"popularity\": 7388\n  },\n  {\n    \"tag\": "electroengraving",\n    \"popularity\": 7381\n  },\n  {\n    \"tag\": "laparoenterotomy",\n    \"popularity\": 7374\n  },\n  {\n    \"tag\": "oxalylurea",\n    \"popularity\": 7366\n  },\n  {\n    \"tag\": "unattaintedly",\n    \"popularity\": 7359\n  },\n  {\n    \"tag\": "pennystone",\n    \"popularity\": 7352\n  },\n  {\n    \"tag\": "Plumbaginaceae",\n    \"popularity\": 7345\n  },\n  {\n    \"tag\": "horntip",\n    \"popularity\": 7337\n  },\n  {\n    \"tag\": "begrudge",\n    \"popularity\": 7330\n  },\n  {\n    \"tag\": "bechignoned",\n    \"popularity\": 7323\n  },\n  {\n    \"tag\": "hologonidium",\n    \"popularity\": 7316\n  },\n  {\n    \"tag\": "Pulian",\n    \"popularity\": 7309\n  },\n  {\n    \"tag\": "gratulation",\n    \"popularity\": 7301\n  },\n  {\n    \"tag\": "Sebright",\n    \"popularity\": 7294\n  },\n  {\n    \"tag\": "coinstantaneous emotionally",\n    \"popularity\": 7287\n  },\n  {\n    \"tag\": "thoracostracan",\n    \"popularity\": 7280\n  },\n  {\n    \"tag\": "saurodont",\n    \"popularity\": 7273\n  },\n  {\n    \"tag\": "coseat",\n    \"popularity\": 7266\n  },\n  {\n    \"tag\": "irascibility",\n    \"popularity\": 7259\n  },\n  {\n    \"tag\": "occlude",\n    \"popularity\": 7251\n  },\n  {\n    \"tag\": "metallurgist",\n    \"popularity\": 7244\n  },\n  {\n    \"tag\": "extraviolet",\n    \"popularity\": 7237\n  },\n  {\n    \"tag\": "clinic",\n    \"popularity\": 7230\n  },\n  {\n    \"tag\": "skater",\n    \"popularity\": 7223\n  },\n  {\n    \"tag\": "linguistic",\n    \"popularity\": 7216\n  },\n  {\n    \"tag\": "attacheship",\n    \"popularity\": 7209\n  },\n  {\n    \"tag\": "Rachianectes",\n    \"popularity\": 7202\n  },\n  {\n    \"tag\": "foliolose",\n    \"popularity\": 7195\n  },\n  {\n    \"tag\": "claudetite",\n    \"popularity\": 7188\n  },\n  {\n    \"tag\": "aphidian scratching",\n    \"popularity\": 7181\n  },\n  {\n    \"tag\": "Carida",\n    \"popularity\": 7174\n  },\n  {\n    \"tag\": "tiepin polymicroscope",\n    \"popularity\": 7167\n  },\n  {\n    \"tag\": "telpherage",\n    \"popularity\": 7160\n  },\n  {\n    \"tag\": "meek",\n    \"popularity\": 7153\n  },\n  {\n    \"tag\": "swiftness",\n    \"popularity\": 7146\n  },\n  {\n    \"tag\": "gentes",\n    \"popularity\": 7139\n  },\n  {\n    \"tag\": "uncommemorated",\n    \"popularity\": 7132\n  },\n  {\n    \"tag\": "Lazarus",\n    \"popularity\": 7125\n  },\n  {\n    \"tag\": "redivive",\n    \"popularity\": 7119\n  },\n  {\n    \"tag\": "nonfebrile",\n    \"popularity\": 7112\n  },\n  {\n    \"tag\": "nymphet",\n    \"popularity\": 7105\n  },\n  {\n    \"tag\": "areologically",\n    \"popularity\": 7098\n  },\n  {\n    \"tag\": "undonkey",\n    \"popularity\": 7091\n  },\n  {\n    \"tag\": "projecting",\n    \"popularity\": 7084\n  },\n  {\n    \"tag\": "pinnigrade",\n    \"popularity\": 7077\n  },\n  {\n    \"tag\": "butylation",\n    \"popularity\": 7071\n  },\n  {\n    \"tag\": "philologistic lenticle",\n    \"popularity\": 7064\n  },\n  {\n    \"tag\": "nooky",\n    \"popularity\": 7057\n  },\n  {\n    \"tag\": "incestuousness",\n    \"popularity\": 7050\n  },\n  {\n    \"tag\": "palingenetically",\n    \"popularity\": 7043\n  },\n  {\n    \"tag\": "mitochondria",\n    \"popularity\": 7037\n  },\n  {\n    \"tag\": "truthify",\n    \"popularity\": 7030\n  },\n  {\n    \"tag\": "titanyl",\n    \"popularity\": 7023\n  },\n  {\n    \"tag\": "bestride",\n    \"popularity\": 7016\n  },\n  {\n    \"tag\": "chende",\n    \"popularity\": 7010\n  },\n  {\n    \"tag\": "Chaucerian monophote",\n    \"popularity\": 7003\n  },\n  {\n    \"tag\": "cutback",\n    \"popularity\": 6996\n  },\n  {\n    \"tag\": "unpatiently",\n    \"popularity\": 6989\n  },\n  {\n    \"tag\": "subvitreous",\n    \"popularity\": 6983\n  },\n  {\n    \"tag\": "organizable",\n    \"popularity\": 6976\n  },\n  {\n    \"tag\": "anniverse uncomprehensible",\n    \"popularity\": 6969\n  },\n  {\n    \"tag\": "hyalescence",\n    \"popularity\": 6963\n  },\n  {\n    \"tag\": "amniochorial",\n    \"popularity\": 6956\n  },\n  {\n    \"tag\": "Corybantian",\n    \"popularity\": 6949\n  },\n  {\n    \"tag\": "genocide Scaphitidae",\n    \"popularity\": 6943\n  },\n  {\n    \"tag\": "accordionist",\n    \"popularity\": 6936\n  },\n  {\n    \"tag\": "becheck",\n    \"popularity\": 6930\n  },\n  {\n    \"tag\": "overproduce",\n    \"popularity\": 6923\n  },\n  {\n    \"tag\": "unmaniac frijolillo",\n    \"popularity\": 6916\n  },\n  {\n    \"tag\": "multisulcated",\n    \"popularity\": 6910\n  },\n  {\n    \"tag\": "wennebergite",\n    \"popularity\": 6903\n  },\n  {\n    \"tag\": "tautousious mowth",\n    \"popularity\": 6897\n  },\n  {\n    \"tag\": "marigold",\n    \"popularity\": 6890\n  },\n  {\n    \"tag\": "affray",\n    \"popularity\": 6884\n  },\n  {\n    \"tag\": "nonidolatrous",\n    \"popularity\": 6877\n  },\n  {\n    \"tag\": "aphrasia",\n    \"popularity\": 6871\n  },\n  {\n    \"tag\": "muddlingly",\n    \"popularity\": 6864\n  },\n  {\n    \"tag\": "clear",\n    \"popularity\": 6858\n  },\n  {\n    \"tag\": "Clitoria",\n    \"popularity\": 6851\n  },\n  {\n    \"tag\": "apportionment underwaist",\n    \"popularity\": 6845\n  },\n  {\n    \"tag\": "kodakist",\n    \"popularity\": 6838\n  },\n  {\n    \"tag\": "Momotidae",\n    \"popularity\": 6832\n  },\n  {\n    \"tag\": "cryptovalency",\n    \"popularity\": 6825\n  },\n  {\n    \"tag\": "floe",\n    \"popularity\": 6819\n  },\n  {\n    \"tag\": "aphagia",\n    \"popularity\": 6812\n  },\n  {\n    \"tag\": "brontograph",\n    \"popularity\": 6806\n  },\n  {\n    \"tag\": "tubulous",\n    \"popularity\": 6799\n  },\n  {\n    \"tag\": "unhorse",\n    \"popularity\": 6793\n  },\n  {\n    \"tag\": "chlordane",\n    \"popularity\": 6787\n  },\n  {\n    \"tag\": "colloquy brochan",\n    \"popularity\": 6780\n  },\n  {\n    \"tag\": "sloosh",\n    \"popularity\": 6774\n  },\n  {\n    \"tag\": "battered",\n    \"popularity\": 6767\n  },\n  {\n    \"tag\": "monocularity pluriguttulate",\n    \"popularity\": 6761\n  },\n  {\n    \"tag\": "chiastoneury",\n    \"popularity\": 6755\n  },\n  {\n    \"tag\": "Sanguinaria",\n    \"popularity\": 6748\n  },\n  {\n    \"tag\": "confessionary",\n    \"popularity\": 6742\n  },\n  {\n    \"tag\": "enzymic",\n    \"popularity\": 6736\n  },\n  {\n    \"tag\": "cord",\n    \"popularity\": 6729\n  },\n  {\n    \"tag\": "oviducal",\n    \"popularity\": 6723\n  },\n  {\n    \"tag\": "crozzle outsea",\n    \"popularity\": 6717\n  },\n  {\n    \"tag\": "balladical",\n    \"popularity\": 6710\n  },\n  {\n    \"tag\": "uncollectibleness",\n    \"popularity\": 6704\n  },\n  {\n    \"tag\": "predorsal",\n    \"popularity\": 6698\n  },\n  {\n    \"tag\": "reauthenticate",\n    \"popularity\": 6692\n  },\n  {\n    \"tag\": "ravissant",\n    \"popularity\": 6685\n  },\n  {\n    \"tag\": "advantageousness",\n    \"popularity\": 6679\n  },\n  {\n    \"tag\": "rung",\n    \"popularity\": 6673\n  },\n  {\n    \"tag\": "duncedom",\n    \"popularity\": 6667\n  },\n  {\n    \"tag\": "hematolite",\n    \"popularity\": 6660\n  },\n  {\n    \"tag\": "thisness",\n    \"popularity\": 6654\n  },\n  {\n    \"tag\": "mapau",\n    \"popularity\": 6648\n  },\n  {\n    \"tag\": "Hecatic",\n    \"popularity\": 6642\n  },\n  {\n    \"tag\": "meningoencephalocele",\n    \"popularity\": 6636\n  },\n  {\n    \"tag\": "confection sorra",\n    \"popularity\": 6630\n  },\n  {\n    \"tag\": "unsedate",\n    \"popularity\": 6623\n  },\n  {\n    \"tag\": "meningocerebritis",\n    \"popularity\": 6617\n  },\n  {\n    \"tag\": "biopsychological",\n    \"popularity\": 6611\n  },\n  {\n    \"tag\": "clavicithern",\n    \"popularity\": 6605\n  },\n  {\n    \"tag\": "resun",\n    \"popularity\": 6599\n  },\n  {\n    \"tag\": "bayamo",\n    \"popularity\": 6593\n  },\n  {\n    \"tag\": "seeableness",\n    \"popularity\": 6587\n  },\n  {\n    \"tag\": "hypsidolichocephalism",\n    \"popularity\": 6581\n  },\n  {\n    \"tag\": "salivous",\n    \"popularity\": 6574\n  },\n  {\n    \"tag\": "neumatize",\n    \"popularity\": 6568\n  },\n  {\n    \"tag\": "stree",\n    \"popularity\": 6562\n  },\n  {\n    \"tag\": "markshot",\n    \"popularity\": 6556\n  },\n  {\n    \"tag\": "phraseologically",\n    \"popularity\": 6550\n  },\n  {\n    \"tag\": "yealing",\n    \"popularity\": 6544\n  },\n  {\n    \"tag\": "puggy",\n    \"popularity\": 6538\n  },\n  {\n    \"tag\": "sexadecimal",\n    \"popularity\": 6532\n  },\n  {\n    \"tag\": "unofficerlike",\n    \"popularity\": 6526\n  },\n  {\n    \"tag\": "curiosa",\n    \"popularity\": 6520\n  },\n  {\n    \"tag\": "pedomotor",\n    \"popularity\": 6514\n  },\n  {\n    \"tag\": "astrally",\n    \"popularity\": 6508\n  },\n  {\n    \"tag\": "prosomatic",\n    \"popularity\": 6502\n  },\n  {\n    \"tag\": "bulletheaded",\n    \"popularity\": 6496\n  },\n  {\n    \"tag\": "fortuned",\n    \"popularity\": 6490\n  },\n  {\n    \"tag\": "pixy",\n    \"popularity\": 6484\n  },\n  {\n    \"tag\": "protectrix",\n    \"popularity\": 6478\n  },\n  {\n    \"tag\": "arthritical",\n    \"popularity\": 6472\n  },\n  {\n    \"tag\": "coction",\n    \"popularity\": 6466\n  },\n  {\n    \"tag\": "Anthropos",\n    \"popularity\": 6460\n  },\n  {\n    \"tag\": "runer",\n    \"popularity\": 6454\n  },\n  {\n    \"tag\": "prenotify",\n    \"popularity\": 6449\n  },\n  {\n    \"tag\": "microspheric gastroparalysis",\n    \"popularity\": 6443\n  },\n  {\n    \"tag\": "Jovicentrical",\n    \"popularity\": 6437\n  },\n  {\n    \"tag\": "ceratopsid",\n    \"popularity\": 6431\n  },\n  {\n    \"tag\": "Theodoric",\n    \"popularity\": 6425\n  },\n  {\n    \"tag\": "Pactolus",\n    \"popularity\": 6419\n  },\n  {\n    \"tag\": "spawning",\n    \"popularity\": 6413\n  },\n  {\n    \"tag\": "nonconfidential",\n    \"popularity\": 6407\n  },\n  {\n    \"tag\": "halotrichite infumate",\n    \"popularity\": 6402\n  },\n  {\n    \"tag\": "undiscriminatingly",\n    \"popularity\": 6396\n  },\n  {\n    \"tag\": "unexasperated",\n    \"popularity\": 6390\n  },\n  {\n    \"tag\": "isoeugenol",\n    \"popularity\": 6384\n  },\n  {\n    \"tag\": "pressboard",\n    \"popularity\": 6378\n  },\n  {\n    \"tag\": "unshrew",\n    \"popularity\": 6372\n  },\n  {\n    \"tag\": "huffingly",\n    \"popularity\": 6367\n  },\n  {\n    \"tag\": "wagaun",\n    \"popularity\": 6361\n  },\n  {\n    \"tag\": "squirt Philistine",\n    \"popularity\": 6355\n  },\n  {\n    \"tag\": "kryptic",\n    \"popularity\": 6349\n  },\n  {\n    \"tag\": "paraform",\n    \"popularity\": 6344\n  },\n  {\n    \"tag\": "preverify",\n    \"popularity\": 6338\n  },\n  {\n    \"tag\": "dalar",\n    \"popularity\": 6332\n  },\n  {\n    \"tag\": "interdictor appraisingly",\n    \"popularity\": 6326\n  },\n  {\n    \"tag\": "chipped",\n    \"popularity\": 6321\n  },\n  {\n    \"tag\": "Pteropoda",\n    \"popularity\": 6315\n  },\n  {\n    \"tag\": "Bohairic",\n    \"popularity\": 6309\n  },\n  {\n    \"tag\": "felting",\n    \"popularity\": 6303\n  },\n  {\n    \"tag\": "compurgatorial",\n    \"popularity\": 6298\n  },\n  {\n    \"tag\": "unclead",\n    \"popularity\": 6292\n  },\n  {\n    \"tag\": "stockish",\n    \"popularity\": 6286\n  },\n  {\n    \"tag\": "mulligatawny",\n    \"popularity\": 6281\n  },\n  {\n    \"tag\": "Monotheletism",\n    \"popularity\": 6275\n  },\n  {\n    \"tag\": "lutanist",\n    \"popularity\": 6269\n  },\n  {\n    \"tag\": "gluttonize",\n    \"popularity\": 6264\n  },\n  {\n    \"tag\": "hackneyed",\n    \"popularity\": 6258\n  },\n  {\n    \"tag\": "yield",\n    \"popularity\": 6253\n  },\n  {\n    \"tag\": "sulphonamido",\n    \"popularity\": 6247\n  },\n  {\n    \"tag\": "granulative",\n    \"popularity\": 6241\n  },\n  {\n    \"tag\": "swingy",\n    \"popularity\": 6236\n  },\n  {\n    \"tag\": "Desmidiales",\n    \"popularity\": 6230\n  },\n  {\n    \"tag\": "tootlish",\n    \"popularity\": 6224\n  },\n  {\n    \"tag\": "unsatisfiedly",\n    \"popularity\": 6219\n  },\n  {\n    \"tag\": "burucha",\n    \"popularity\": 6213\n  },\n  {\n    \"tag\": "premeditatingly",\n    \"popularity\": 6208\n  },\n  {\n    \"tag\": "cowrie",\n    \"popularity\": 6202\n  },\n  {\n    \"tag\": "pleurolysis",\n    \"popularity\": 6197\n  },\n  {\n    \"tag\": "nationalist",\n    \"popularity\": 6191\n  },\n  {\n    \"tag\": "Pholadacea",\n    \"popularity\": 6186\n  },\n  {\n    \"tag\": "anakrousis",\n    \"popularity\": 6180\n  },\n  {\n    \"tag\": "proctorial",\n    \"popularity\": 6175\n  },\n  {\n    \"tag\": "cavillation",\n    \"popularity\": 6169\n  },\n  {\n    \"tag\": "cervicobregmatic",\n    \"popularity\": 6163\n  },\n  {\n    \"tag\": "interspecific",\n    \"popularity\": 6158\n  },\n  {\n    \"tag\": "Teutonity",\n    \"popularity\": 6152\n  },\n  {\n    \"tag\": "snakeholing",\n    \"popularity\": 6147\n  },\n  {\n    \"tag\": "balcony",\n    \"popularity\": 6142\n  },\n  {\n    \"tag\": "latchless",\n    \"popularity\": 6136\n  },\n  {\n    \"tag\": "Mithraea",\n    \"popularity\": 6131\n  },\n  {\n    \"tag\": "pseudepigraph",\n    \"popularity\": 6125\n  },\n  {\n    \"tag\": "flosser",\n    \"popularity\": 6120\n  },\n  {\n    \"tag\": "kotyle",\n    \"popularity\": 6114\n  },\n  {\n    \"tag\": "outdo",\n    \"popularity\": 6109\n  },\n  {\n    \"tag\": "interclerical",\n    \"popularity\": 6103\n  },\n  {\n    \"tag\": "aurar",\n    \"popularity\": 6098\n  },\n  {\n    \"tag\": "apophyseal",\n    \"popularity\": 6093\n  },\n  {\n    \"tag\": "Miro",\n    \"popularity\": 6087\n  },\n  {\n    \"tag\": "Priscillian",\n    \"popularity\": 6082\n  },\n  {\n    \"tag\": "alluvia",\n    \"popularity\": 6076\n  },\n  {\n    \"tag\": "exordize",\n    \"popularity\": 6071\n  },\n  {\n    \"tag\": "breakage",\n    \"popularity\": 6066\n  },\n  {\n    \"tag\": "unclosable",\n    \"popularity\": 6060\n  },\n  {\n    \"tag\": "monocondylous",\n    \"popularity\": 6055\n  },\n  {\n    \"tag\": "dyarchy",\n    \"popularity\": 6050\n  },\n  {\n    \"tag\": "subchelate",\n    \"popularity\": 6044\n  },\n  {\n    \"tag\": "hearsay",\n    \"popularity\": 6039\n  },\n  {\n    \"tag\": "prestigiously",\n    \"popularity\": 6034\n  },\n  {\n    \"tag\": "unimuscular",\n    \"popularity\": 6028\n  },\n  {\n    \"tag\": "lingwort",\n    \"popularity\": 6023\n  },\n  {\n    \"tag\": "jealous",\n    \"popularity\": 6018\n  },\n  {\n    \"tag\": "artilleryman",\n    \"popularity\": 6012\n  },\n  {\n    \"tag\": "phantasmagorially",\n    \"popularity\": 6007\n  },\n  {\n    \"tag\": "stagnum",\n    \"popularity\": 6002\n  },\n  {\n    \"tag\": "organotropism shatteringly",\n    \"popularity\": 5997\n  },\n  {\n    \"tag\": "Mytilus Hebraist",\n    \"popularity\": 5991\n  },\n  {\n    \"tag\": "returf",\n    \"popularity\": 5986\n  },\n  {\n    \"tag\": "townfolk",\n    \"popularity\": 5981\n  },\n  {\n    \"tag\": "propitiative",\n    \"popularity\": 5976\n  },\n  {\n    \"tag\": "Anita unsullied",\n    \"popularity\": 5970\n  },\n  {\n    \"tag\": "bandoleered",\n    \"popularity\": 5965\n  },\n  {\n    \"tag\": "cubby",\n    \"popularity\": 5960\n  },\n  {\n    \"tag\": "Hexanchus",\n    \"popularity\": 5955\n  },\n  {\n    \"tag\": "circuminsular",\n    \"popularity\": 5949\n  },\n  {\n    \"tag\": "chamberletted eumycete",\n    \"popularity\": 5944\n  },\n  {\n    \"tag\": "secure",\n    \"popularity\": 5939\n  },\n  {\n    \"tag\": "Edwardean",\n    \"popularity\": 5934\n  },\n  {\n    \"tag\": "strenth",\n    \"popularity\": 5929\n  },\n  {\n    \"tag\": "exhaustless",\n    \"popularity\": 5923\n  },\n  {\n    \"tag\": "electioneerer",\n    \"popularity\": 5918\n  },\n  {\n    \"tag\": "estoile",\n    \"popularity\": 5913\n  },\n  {\n    \"tag\": "redden",\n    \"popularity\": 5908\n  },\n  {\n    \"tag\": "solicitee",\n    \"popularity\": 5903\n  },\n  {\n    \"tag\": "nonpatented",\n    \"popularity\": 5898\n  },\n  {\n    \"tag\": "lemming",\n    \"popularity\": 5893\n  },\n  {\n    \"tag\": "marled subalate",\n    \"popularity\": 5887\n  },\n  {\n    \"tag\": "premial horizonward",\n    \"popularity\": 5882\n  },\n  {\n    \"tag\": "nonrefueling",\n    \"popularity\": 5877\n  },\n  {\n    \"tag\": "rupturewort",\n    \"popularity\": 5872\n  },\n  {\n    \"tag\": "unfed",\n    \"popularity\": 5867\n  },\n  {\n    \"tag\": "empanelment",\n    \"popularity\": 5862\n  },\n  {\n    \"tag\": "isoosmosis",\n    \"popularity\": 5857\n  },\n  {\n    \"tag\": "jipijapa",\n    \"popularity\": 5852\n  },\n  {\n    \"tag\": "Fiji",\n    \"popularity\": 5847\n  },\n  {\n    \"tag\": "interferant",\n    \"popularity\": 5842\n  },\n  {\n    \"tag\": "reconstitution",\n    \"popularity\": 5837\n  },\n  {\n    \"tag\": "dockyardman",\n    \"popularity\": 5832\n  },\n  {\n    \"tag\": "dolichopodous",\n    \"popularity\": 5826\n  },\n  {\n    \"tag\": "whiteworm",\n    \"popularity\": 5821\n  },\n  {\n    \"tag\": "atheistically",\n    \"popularity\": 5816\n  },\n  {\n    \"tag\": "nonconcern",\n    \"popularity\": 5811\n  },\n  {\n    \"tag\": "scarabaeidoid",\n    \"popularity\": 5806\n  },\n  {\n    \"tag\": "triumviri",\n    \"popularity\": 5801\n  },\n  {\n    \"tag\": "rakit",\n    \"popularity\": 5796\n  },\n  {\n    \"tag\": "leecheater",\n    \"popularity\": 5791\n  },\n  {\n    \"tag\": "Arthrostraca",\n    \"popularity\": 5786\n  },\n  {\n    \"tag\": "upknit",\n    \"popularity\": 5781\n  },\n  {\n    \"tag\": "tymbalon",\n    \"popularity\": 5776\n  },\n  {\n    \"tag\": "inventurous",\n    \"popularity\": 5771\n  },\n  {\n    \"tag\": "perradiate",\n    \"popularity\": 5766\n  },\n  {\n    \"tag\": "seer",\n    \"popularity\": 5762\n  },\n  {\n    \"tag\": "Auricularia",\n    \"popularity\": 5757\n  },\n  {\n    \"tag\": "wettish exclusivity",\n    \"popularity\": 5752\n  },\n  {\n    \"tag\": "arteriosympathectomy",\n    \"popularity\": 5747\n  },\n  {\n    \"tag\": "tunlike",\n    \"popularity\": 5742\n  },\n  {\n    \"tag\": "cephalocercal",\n    \"popularity\": 5737\n  },\n  {\n    \"tag\": "meaninglessness",\n    \"popularity\": 5732\n  },\n  {\n    \"tag\": "fountful",\n    \"popularity\": 5727\n  },\n  {\n    \"tag\": "appraisement",\n    \"popularity\": 5722\n  },\n  {\n    \"tag\": "geniculated",\n    \"popularity\": 5717\n  },\n  {\n    \"tag\": "rotator",\n    \"popularity\": 5712\n  },\n  {\n    \"tag\": "foremarch biography",\n    \"popularity\": 5707\n  },\n  {\n    \"tag\": "arid",\n    \"popularity\": 5703\n  },\n  {\n    \"tag\": "inapprehensible",\n    \"popularity\": 5698\n  },\n  {\n    \"tag\": "chlorosulphonic",\n    \"popularity\": 5693\n  },\n  {\n    \"tag\": "braguette",\n    \"popularity\": 5688\n  },\n  {\n    \"tag\": "panophthalmitis",\n    \"popularity\": 5683\n  },\n  {\n    \"tag\": "pro objurgatorily",\n    \"popularity\": 5678\n  },\n  {\n    \"tag\": "zooplasty",\n    \"popularity\": 5673\n  },\n  {\n    \"tag\": "Terebratulidae",\n    \"popularity\": 5669\n  },\n  {\n    \"tag\": "Mahran",\n    \"popularity\": 5664\n  },\n  {\n    \"tag\": "anthologize merocele",\n    \"popularity\": 5659\n  },\n  {\n    \"tag\": "firecracker chiropractic",\n    \"popularity\": 5654\n  },\n  {\n    \"tag\": "tenorist",\n    \"popularity\": 5649\n  },\n  {\n    \"tag\": "amphitene",\n    \"popularity\": 5645\n  },\n  {\n    \"tag\": "silverbush toadstone",\n    \"popularity\": 5640\n  },\n  {\n    \"tag\": "entozoological",\n    \"popularity\": 5635\n  },\n  {\n    \"tag\": "trustlessness",\n    \"popularity\": 5630\n  },\n  {\n    \"tag\": "reassay",\n    \"popularity\": 5625\n  },\n  {\n    \"tag\": "chrysalides",\n    \"popularity\": 5621\n  },\n  {\n    \"tag\": "truncation",\n    \"popularity\": 5616\n  },\n  {\n    \"tag\": "unwavered mausoleal",\n    \"popularity\": 5611\n  },\n  {\n    \"tag\": "unserrated",\n    \"popularity\": 5606\n  },\n  {\n    \"tag\": "frampler",\n    \"popularity\": 5602\n  },\n  {\n    \"tag\": "celestial",\n    \"popularity\": 5597\n  },\n  {\n    \"tag\": "depreter",\n    \"popularity\": 5592\n  },\n  {\n    \"tag\": "retaliate",\n    \"popularity\": 5588\n  },\n  {\n    \"tag\": "decempunctate",\n    \"popularity\": 5583\n  },\n  {\n    \"tag\": "submitter",\n    \"popularity\": 5578\n  },\n  {\n    \"tag\": "phenothiazine",\n    \"popularity\": 5573\n  },\n  {\n    \"tag\": "hobbledehoyish",\n    \"popularity\": 5569\n  },\n  {\n    \"tag\": "erraticness",\n    \"popularity\": 5564\n  },\n  {\n    \"tag\": "ovariodysneuria",\n    \"popularity\": 5559\n  },\n  {\n    \"tag\": "puja",\n    \"popularity\": 5555\n  },\n  {\n    \"tag\": "cesspool",\n    \"popularity\": 5550\n  },\n  {\n    \"tag\": "sonation",\n    \"popularity\": 5545\n  },\n  {\n    \"tag\": "moggan",\n    \"popularity\": 5541\n  },\n  {\n    \"tag\": "overjutting",\n    \"popularity\": 5536\n  },\n  {\n    \"tag\": "cohobate",\n    \"popularity\": 5531\n  },\n  {\n    \"tag\": "Distoma",\n    \"popularity\": 5527\n  },\n  {\n    \"tag\": "Plectognathi",\n    \"popularity\": 5522\n  },\n  {\n    \"tag\": "dumple caliphate",\n    \"popularity\": 5517\n  },\n  {\n    \"tag\": "shiko",\n    \"popularity\": 5513\n  },\n  {\n    \"tag\": "downness",\n    \"popularity\": 5508\n  },\n  {\n    \"tag\": "whippletree",\n    \"popularity\": 5504\n  },\n  {\n    \"tag\": "nymphaeum",\n    \"popularity\": 5499\n  },\n  {\n    \"tag\": "there trest",\n    \"popularity\": 5494\n  },\n  {\n    \"tag\": "psychrometer",\n    \"popularity\": 5490\n  },\n  {\n    \"tag\": "pyelograph",\n    \"popularity\": 5485\n  },\n  {\n    \"tag\": "unsalvable",\n    \"popularity\": 5481\n  },\n  {\n    \"tag\": "bescreen",\n    \"popularity\": 5476\n  },\n  {\n    \"tag\": "cushy",\n    \"popularity\": 5471\n  },\n  {\n    \"tag\": "plicatolobate",\n    \"popularity\": 5467\n  },\n  {\n    \"tag\": "lakie",\n    \"popularity\": 5462\n  },\n  {\n    \"tag\": "anthropodeoxycholic",\n    \"popularity\": 5458\n  },\n  {\n    \"tag\": "resatisfaction",\n    \"popularity\": 5453\n  },\n  {\n    \"tag\": "unravelment unaccidental",\n    \"popularity\": 5449\n  },\n  {\n    \"tag\": "telewriter monogeneous",\n    \"popularity\": 5444\n  },\n  {\n    \"tag\": "unsabred",\n    \"popularity\": 5440\n  },\n  {\n    \"tag\": "startlingly",\n    \"popularity\": 5435\n  },\n  {\n    \"tag\": "Aralia",\n    \"popularity\": 5431\n  },\n  {\n    \"tag\": "alamonti",\n    \"popularity\": 5426\n  },\n  {\n    \"tag\": "Franklinization",\n    \"popularity\": 5422\n  },\n  {\n    \"tag\": "parliament",\n    \"popularity\": 5417\n  },\n  {\n    \"tag\": "schoolkeeper",\n    \"popularity\": 5413\n  },\n  {\n    \"tag\": "nonsociety",\n    \"popularity\": 5408\n  },\n  {\n    \"tag\": "parenthetic",\n    \"popularity\": 5404\n  },\n  {\n    \"tag\": "stog",\n    \"popularity\": 5399\n  },\n  {\n    \"tag\": "Pristipomidae",\n    \"popularity\": 5395\n  },\n  {\n    \"tag\": "exocarp",\n    \"popularity\": 5390\n  },\n  {\n    \"tag\": "monaxonial",\n    \"popularity\": 5386\n  },\n  {\n    \"tag\": "tramroad",\n    \"popularity\": 5381\n  },\n  {\n    \"tag\": "hookah",\n    \"popularity\": 5377\n  },\n  {\n    \"tag\": "saccharonic",\n    \"popularity\": 5372\n  },\n  {\n    \"tag\": "perimetrium",\n    \"popularity\": 5368\n  },\n  {\n    \"tag\": "libelluloid",\n    \"popularity\": 5364\n  },\n  {\n    \"tag\": "overrunningly",\n    \"popularity\": 5359\n  },\n  {\n    \"tag\": "untwister",\n    \"popularity\": 5355\n  },\n  {\n    \"tag\": "ninnyhammer",\n    \"popularity\": 5350\n  },\n  {\n    \"tag\": "metranate",\n    \"popularity\": 5346\n  },\n  {\n    \"tag\": "sarcoblast",\n    \"popularity\": 5341\n  },\n  {\n    \"tag\": "porkish",\n    \"popularity\": 5337\n  },\n  {\n    \"tag\": "chauvinistic",\n    \"popularity\": 5333\n  },\n  {\n    \"tag\": "sexagesimal",\n    \"popularity\": 5328\n  },\n  {\n    \"tag\": "hematogenic",\n    \"popularity\": 5324\n  },\n  {\n    \"tag\": "selfpreservatory",\n    \"popularity\": 5320\n  },\n  {\n    \"tag\": "myelauxe",\n    \"popularity\": 5315\n  },\n  {\n    \"tag\": "triply",\n    \"popularity\": 5311\n  },\n  {\n    \"tag\": "metaphysicous",\n    \"popularity\": 5306\n  },\n  {\n    \"tag\": "vitrinoid",\n    \"popularity\": 5302\n  },\n  {\n    \"tag\": "glabellae",\n    \"popularity\": 5298\n  },\n  {\n    \"tag\": "moonlighter",\n    \"popularity\": 5293\n  },\n  {\n    \"tag\": "monotheistically epexegetical",\n    \"popularity\": 5289\n  },\n  {\n    \"tag\": "pseudolateral",\n    \"popularity\": 5285\n  },\n  {\n    \"tag\": "heptamethylene",\n    \"popularity\": 5280\n  },\n  {\n    \"tag\": "salvadora",\n    \"popularity\": 5276\n  },\n  {\n    \"tag\": "unjovial diphenylthiourea",\n    \"popularity\": 5272\n  },\n  {\n    \"tag\": "thievishness",\n    \"popularity\": 5268\n  },\n  {\n    \"tag\": "unridable",\n    \"popularity\": 5263\n  },\n  {\n    \"tag\": "underhandedly",\n    \"popularity\": 5259\n  },\n  {\n    \"tag\": "fungiform",\n    \"popularity\": 5255\n  },\n  {\n    \"tag\": "scruffle",\n    \"popularity\": 5250\n  },\n  {\n    \"tag\": "preindisposition",\n    \"popularity\": 5246\n  },\n  {\n    \"tag\": "Amadis",\n    \"popularity\": 5242\n  },\n  {\n    \"tag\": "Culex",\n    \"popularity\": 5238\n  },\n  {\n    \"tag\": "churning",\n    \"popularity\": 5233\n  },\n  {\n    \"tag\": "imperite",\n    \"popularity\": 5229\n  },\n  {\n    \"tag\": "levorotation",\n    \"popularity\": 5225\n  },\n  {\n    \"tag\": "barbate",\n    \"popularity\": 5221\n  },\n  {\n    \"tag\": "knotwort",\n    \"popularity\": 5216\n  },\n  {\n    \"tag\": "gypsiferous",\n    \"popularity\": 5212\n  },\n  {\n    \"tag\": "tourmalinic",\n    \"popularity\": 5208\n  },\n  {\n    \"tag\": "helleboric",\n    \"popularity\": 5204\n  },\n  {\n    \"tag\": "pneumograph",\n    \"popularity\": 5199\n  },\n  {\n    \"tag\": "Peltigeraceae",\n    \"popularity\": 5195\n  },\n  {\n    \"tag\": "busine",\n    \"popularity\": 5191\n  },\n  {\n    \"tag\": "Ailuridae",\n    \"popularity\": 5187\n  },\n  {\n    \"tag\": "azotate",\n    \"popularity\": 5183\n  },\n  {\n    \"tag\": "unlikable",\n    \"popularity\": 5178\n  },\n  {\n    \"tag\": "sloyd",\n    \"popularity\": 5174\n  },\n  {\n    \"tag\": "biblioclasm",\n    \"popularity\": 5170\n  },\n  {\n    \"tag\": "Seres",\n    \"popularity\": 5166\n  },\n  {\n    \"tag\": "unaccurateness",\n    \"popularity\": 5162\n  },\n  {\n    \"tag\": "scrollwise",\n    \"popularity\": 5157\n  },\n  {\n    \"tag\": "flandowser",\n    \"popularity\": 5153\n  },\n  {\n    \"tag\": "unblackened",\n    \"popularity\": 5149\n  },\n  {\n    \"tag\": "schistosternia",\n    \"popularity\": 5145\n  },\n  {\n    \"tag\": "fuse",\n    \"popularity\": 5141\n  },\n  {\n    \"tag\": "narthecal",\n    \"popularity\": 5137\n  },\n  {\n    \"tag\": "Cueva",\n    \"popularity\": 5133\n  },\n  {\n    \"tag\": "appositeness",\n    \"popularity\": 5128\n  },\n  {\n    \"tag\": "proindustrial",\n    \"popularity\": 5124\n  },\n  {\n    \"tag\": "dermatorrhoea",\n    \"popularity\": 5120\n  },\n  {\n    \"tag\": "oxyurous tendential",\n    \"popularity\": 5116\n  },\n  {\n    \"tag\": "isopurpurin",\n    \"popularity\": 5112\n  },\n  {\n    \"tag\": "impose",\n    \"popularity\": 5108\n  },\n  {\n    \"tag\": "wordsmanship",\n    \"popularity\": 5104\n  },\n  {\n    \"tag\": "saturator",\n    \"popularity\": 5100\n  },\n  {\n    \"tag\": "Nordicity",\n    \"popularity\": 5096\n  },\n  {\n    \"tag\": "interaccuse",\n    \"popularity\": 5092\n  },\n  {\n    \"tag\": "acridinic",\n    \"popularity\": 5087\n  },\n  {\n    \"tag\": "scholion",\n    \"popularity\": 5083\n  },\n  {\n    \"tag\": "pseudoaconitine",\n    \"popularity\": 5079\n  },\n  {\n    \"tag\": "doctorial",\n    \"popularity\": 5075\n  },\n  {\n    \"tag\": "Etchimin",\n    \"popularity\": 5071\n  },\n  {\n    \"tag\": "oliviform",\n    \"popularity\": 5067\n  },\n  {\n    \"tag\": "Pele",\n    \"popularity\": 5063\n  },\n  {\n    \"tag\": "Chiromantis Progymnasium",\n    \"popularity\": 5059\n  },\n  {\n    \"tag\": "toxosis",\n    \"popularity\": 5055\n  },\n  {\n    \"tag\": "spadilla",\n    \"popularity\": 5051\n  },\n  {\n    \"tag\": "Actinopterygii",\n    \"popularity\": 5047\n  },\n  {\n    \"tag\": "untiring",\n    \"popularity\": 5043\n  },\n  {\n    \"tag\": "butyral",\n    \"popularity\": 5039\n  },\n  {\n    \"tag\": "Gymnoderinae",\n    \"popularity\": 5035\n  },\n  {\n    \"tag\": "testudo",\n    \"popularity\": 5031\n  },\n  {\n    \"tag\": "frigorify",\n    \"popularity\": 5027\n  },\n  {\n    \"tag\": "aliency",\n    \"popularity\": 5023\n  },\n  {\n    \"tag\": "jargon",\n    \"popularity\": 5019\n  },\n  {\n    \"tag\": "counterservice",\n    \"popularity\": 5015\n  },\n  {\n    \"tag\": "isostrychnine",\n    \"popularity\": 5011\n  },\n  {\n    \"tag\": "tellership",\n    \"popularity\": 5007\n  },\n  {\n    \"tag\": "miscegenetic",\n    \"popularity\": 5003\n  },\n  {\n    \"tag\": "sorcer",\n    \"popularity\": 4999\n  },\n  {\n    \"tag\": "tilewright",\n    \"popularity\": 4995\n  },\n  {\n    \"tag\": "cyanoplastid",\n    \"popularity\": 4991\n  },\n  {\n    \"tag\": "fluxionally",\n    \"popularity\": 4987\n  },\n  {\n    \"tag\": "proudhearted",\n    \"popularity\": 4983\n  },\n  {\n    \"tag\": "blithely",\n    \"popularity\": 4979\n  },\n  {\n    \"tag\": "jestproof",\n    \"popularity\": 4975\n  },\n  {\n    \"tag\": "jestwise",\n    \"popularity\": 4971\n  },\n  {\n    \"tag\": "nonassimilable",\n    \"popularity\": 4967\n  },\n  {\n    \"tag\": "compurgation",\n    \"popularity\": 4964\n  },\n  {\n    \"tag\": "unhate",\n    \"popularity\": 4960\n  },\n  {\n    \"tag\": "haplodonty",\n    \"popularity\": 4956\n  },\n  {\n    \"tag\": "cardholder",\n    \"popularity\": 4952\n  },\n  {\n    \"tag\": "rainlight megohmmeter overstout",\n    \"popularity\": 4948\n  },\n  {\n    \"tag\": "itchless",\n    \"popularity\": 4944\n  },\n  {\n    \"tag\": "begiggle",\n    \"popularity\": 4940\n  },\n  {\n    \"tag\": "chromatosphere",\n    \"popularity\": 4936\n  },\n  {\n    \"tag\": "typicality",\n    \"popularity\": 4932\n  },\n  {\n    \"tag\": "overgrown",\n    \"popularity\": 4928\n  },\n  {\n    \"tag\": "envolume",\n    \"popularity\": 4925\n  },\n  {\n    \"tag\": "pachycholia",\n    \"popularity\": 4921\n  },\n  {\n    \"tag\": "passageable",\n    \"popularity\": 4917\n  },\n  {\n    \"tag\": "pathopoiesis",\n    \"popularity\": 4913\n  },\n  {\n    \"tag\": "overbreak",\n    \"popularity\": 4909\n  },\n  {\n    \"tag\": "satyric",\n    \"popularity\": 4905\n  },\n  {\n    \"tag\": "unaudited",\n    \"popularity\": 4901\n  },\n  {\n    \"tag\": "whimble",\n    \"popularity\": 4898\n  },\n  {\n    \"tag\": "pressureless",\n    \"popularity\": 4894\n  },\n  {\n    \"tag\": "Selene",\n    \"popularity\": 4890\n  },\n  {\n    \"tag\": "slithery",\n    \"popularity\": 4886\n  },\n  {\n    \"tag\": "nondisfigurement",\n    \"popularity\": 4882\n  },\n  {\n    \"tag\": "overdelicious",\n    \"popularity\": 4878\n  },\n  {\n    \"tag\": "Perca",\n    \"popularity\": 4875\n  },\n  {\n    \"tag\": "Palladium",\n    \"popularity\": 4871\n  },\n  {\n    \"tag\": "insagacity",\n    \"popularity\": 4867\n  },\n  {\n    \"tag\": "peristoma",\n    \"popularity\": 4863\n  },\n  {\n    \"tag\": "uncreativeness",\n    \"popularity\": 4859\n  },\n  {\n    \"tag\": "incomparability surfboarding",\n    \"popularity\": 4856\n  },\n  {\n    \"tag\": "bacillar",\n    \"popularity\": 4852\n  },\n  {\n    \"tag\": "ulcerative",\n    \"popularity\": 4848\n  },\n  {\n    \"tag\": "stychomythia",\n    \"popularity\": 4844\n  },\n  {\n    \"tag\": "sesma somatics nonentry",\n    \"popularity\": 4840\n  },\n  {\n    \"tag\": "unsepulchred",\n    \"popularity\": 4837\n  },\n  {\n    \"tag\": "cephalanthium",\n    \"popularity\": 4833\n  },\n  {\n    \"tag\": "Asiaticization",\n    \"popularity\": 4829\n  },\n  {\n    \"tag\": "killeen",\n    \"popularity\": 4825\n  },\n  {\n    \"tag\": "Pseudococcus",\n    \"popularity\": 4822\n  },\n  {\n    \"tag\": "untractable",\n    \"popularity\": 4818\n  },\n  {\n    \"tag\": "apolegamic",\n    \"popularity\": 4814\n  },\n  {\n    \"tag\": "hyperpnea",\n    \"popularity\": 4810\n  },\n  {\n    \"tag\": "martyrolatry",\n    \"popularity\": 4807\n  },\n  {\n    \"tag\": "Sarmatic",\n    \"popularity\": 4803\n  },\n  {\n    \"tag\": "nonsurface",\n    \"popularity\": 4799\n  },\n  {\n    \"tag\": "adjoined",\n    \"popularity\": 4796\n  },\n  {\n    \"tag\": "vasiform",\n    \"popularity\": 4792\n  },\n  {\n    \"tag\": "tastelessness",\n    \"popularity\": 4788\n  },\n  {\n    \"tag\": "rumbo",\n    \"popularity\": 4784\n  },\n  {\n    \"tag\": "subdititious",\n    \"popularity\": 4781\n  },\n  {\n    \"tag\": "reparticipation",\n    \"popularity\": 4777\n  },\n  {\n    \"tag\": "Yorkshireism",\n    \"popularity\": 4773\n  },\n  {\n    \"tag\": "outcrow",\n    \"popularity\": 4770\n  },\n  {\n    \"tag\": "casserole",\n    \"popularity\": 4766\n  },\n  {\n    \"tag\": "semideltaic",\n    \"popularity\": 4762\n  },\n  {\n    \"tag\": "freemason",\n    \"popularity\": 4759\n  },\n  {\n    \"tag\": "catkin",\n    \"popularity\": 4755\n  },\n  {\n    \"tag\": "conscient",\n    \"popularity\": 4751\n  },\n  {\n    \"tag\": "reliably",\n    \"popularity\": 4748\n  },\n  {\n    \"tag\": "Telembi",\n    \"popularity\": 4744\n  },\n  {\n    \"tag\": "hide",\n    \"popularity\": 4740\n  },\n  {\n    \"tag\": "social",\n    \"popularity\": 4737\n  },\n  {\n    \"tag\": "ichneutic",\n    \"popularity\": 4733\n  },\n  {\n    \"tag\": "polypotome blouse pentagrammatic",\n    \"popularity\": 4729\n  },\n  {\n    \"tag\": "airdrome pesthole",\n    \"popularity\": 4726\n  },\n  {\n    \"tag\": "unportended",\n    \"popularity\": 4722\n  },\n  {\n    \"tag\": "sheerly",\n    \"popularity\": 4719\n  },\n  {\n    \"tag\": "acardiac",\n    \"popularity\": 4715\n  },\n  {\n    \"tag\": "fetor",\n    \"popularity\": 4711\n  },\n  {\n    \"tag\": "storax",\n    \"popularity\": 4708\n  },\n  {\n    \"tag\": "syndactylic",\n    \"popularity\": 4704\n  },\n  {\n    \"tag\": "otiatrics",\n    \"popularity\": 4700\n  },\n  {\n    \"tag\": "range",\n    \"popularity\": 4697\n  },\n  {\n    \"tag\": "branchway",\n    \"popularity\": 4693\n  },\n  {\n    \"tag\": "beatific",\n    \"popularity\": 4690\n  },\n  {\n    \"tag\": "Rugosa",\n    \"popularity\": 4686\n  },\n  {\n    \"tag\": "rafty",\n    \"popularity\": 4682\n  },\n  {\n    \"tag\": "gapy",\n    \"popularity\": 4679\n  },\n  {\n    \"tag\": "heterocercal",\n    \"popularity\": 4675\n  },\n  {\n    \"tag\": "actinopterygious",\n    \"popularity\": 4672\n  },\n  {\n    \"tag\": "glauconite",\n    \"popularity\": 4668\n  },\n  {\n    \"tag\": "limbless priest",\n    \"popularity\": 4665\n  },\n  {\n    \"tag\": "chrysene",\n    \"popularity\": 4661\n  },\n  {\n    \"tag\": "isentropic",\n    \"popularity\": 4658\n  },\n  {\n    \"tag\": "lairdess",\n    \"popularity\": 4654\n  },\n  {\n    \"tag\": "butterhead choliambic",\n    \"popularity\": 4650\n  },\n  {\n    \"tag\": "hexaseme",\n    \"popularity\": 4647\n  },\n  {\n    \"tag\": "treeify",\n    \"popularity\": 4643\n  },\n  {\n    \"tag\": "coronetted fructify",\n    \"popularity\": 4640\n  },\n  {\n    \"tag\": "admiralty",\n    \"popularity\": 4636\n  },\n  {\n    \"tag\": "Flosculariidae",\n    \"popularity\": 4633\n  },\n  {\n    \"tag\": "limaceous",\n    \"popularity\": 4629\n  },\n  {\n    \"tag\": "subterconscious",\n    \"popularity\": 4626\n  },\n  {\n    \"tag\": "stayless",\n    \"popularity\": 4622\n  },\n  {\n    \"tag\": "psha",\n    \"popularity\": 4619\n  },\n  {\n    \"tag\": "Mediterraneanize",\n    \"popularity\": 4615\n  },\n  {\n    \"tag\": "impenetrably",\n    \"popularity\": 4612\n  },\n  {\n    \"tag\": "Myrmeleonidae",\n    \"popularity\": 4608\n  },\n  {\n    \"tag\": "germander",\n    \"popularity\": 4605\n  },\n  {\n    \"tag\": "Buri",\n    \"popularity\": 4601\n  },\n  {\n    \"tag\": "papyrotamia",\n    \"popularity\": 4598\n  },\n  {\n    \"tag\": "Toxylon",\n    \"popularity\": 4594\n  },\n  {\n    \"tag\": "batatilla",\n    \"popularity\": 4591\n  },\n  {\n    \"tag\": "fabella assumer",\n    \"popularity\": 4587\n  },\n  {\n    \"tag\": "macromethod",\n    \"popularity\": 4584\n  },\n  {\n    \"tag\": "Blechnum",\n    \"popularity\": 4580\n  },\n  {\n    \"tag\": "pantography",\n    \"popularity\": 4577\n  },\n  {\n    \"tag\": "seminovel",\n    \"popularity\": 4574\n  },\n  {\n    \"tag\": "disembarrassment",\n    \"popularity\": 4570\n  },\n  {\n    \"tag\": "bushmaking",\n    \"popularity\": 4567\n  },\n  {\n    \"tag\": "neurosis",\n    \"popularity\": 4563\n  },\n  {\n    \"tag\": "Animalia",\n    \"popularity\": 4560\n  },\n  {\n    \"tag\": "Bernice",\n    \"popularity\": 4556\n  },\n  {\n    \"tag\": "wisen",\n    \"popularity\": 4553\n  },\n  {\n    \"tag\": "subhymenium",\n    \"popularity\": 4549\n  },\n  {\n    \"tag\": "esophagomycosis",\n    \"popularity\": 4546\n  },\n  {\n    \"tag\": "wireworks",\n    \"popularity\": 4543\n  },\n  {\n    \"tag\": "Sabellidae",\n    \"popularity\": 4539\n  },\n  {\n    \"tag\": "fustianish",\n    \"popularity\": 4536\n  },\n  {\n    \"tag\": "professively",\n    \"popularity\": 4532\n  },\n  {\n    \"tag\": "overcorruptly",\n    \"popularity\": 4529\n  },\n  {\n    \"tag\": "overcreep",\n    \"popularity\": 4526\n  },\n  {\n    \"tag\": "Castilloa",\n    \"popularity\": 4522\n  },\n  {\n    \"tag\": "forelady Georgie",\n    \"popularity\": 4519\n  },\n  {\n    \"tag\": "outsider",\n    \"popularity\": 4515\n  },\n  {\n    \"tag\": "Enukki",\n    \"popularity\": 4512\n  },\n  {\n    \"tag\": "gypsy",\n    \"popularity\": 4509\n  },\n  {\n    \"tag\": "Passamaquoddy",\n    \"popularity\": 4505\n  },\n  {\n    \"tag\": "reposit",\n    \"popularity\": 4502\n  },\n  {\n    \"tag\": "overtenderness",\n    \"popularity\": 4499\n  },\n  {\n    \"tag\": "keratome",\n    \"popularity\": 4495\n  },\n  {\n    \"tag\": "interclavicular hypermonosyllable Susanna",\n    \"popularity\": 4492\n  },\n  {\n    \"tag\": "mispropose",\n    \"popularity\": 4489\n  },\n  {\n    \"tag\": "Membranipora",\n    \"popularity\": 4485\n  },\n  {\n    \"tag\": "lampad",\n    \"popularity\": 4482\n  },\n  {\n    \"tag\": "header",\n    \"popularity\": 4479\n  },\n  {\n    \"tag\": "triseriate",\n    \"popularity\": 4475\n  },\n  {\n    \"tag\": "distrainment",\n    \"popularity\": 4472\n  },\n  {\n    \"tag\": "staphyloplastic",\n    \"popularity\": 4469\n  },\n  {\n    \"tag\": "outscour",\n    \"popularity\": 4465\n  },\n  {\n    \"tag\": "tallowmaking",\n    \"popularity\": 4462\n  },\n  {\n    \"tag\": "plugger",\n    \"popularity\": 4459\n  },\n  {\n    \"tag\": "fashionize",\n    \"popularity\": 4455\n  },\n  {\n    \"tag\": "puzzle",\n    \"popularity\": 4452\n  },\n  {\n    \"tag\": "imbrue",\n    \"popularity\": 4449\n  },\n  {\n    \"tag\": "osteoblast",\n    \"popularity\": 4445\n  },\n  {\n    \"tag\": "Hydrocores",\n    \"popularity\": 4442\n  },\n  {\n    \"tag\": "Lutra",\n    \"popularity\": 4439\n  },\n  {\n    \"tag\": "upridge scarfy",\n    \"popularity\": 4435\n  },\n  {\n    \"tag\": "ancon taffle",\n    \"popularity\": 4432\n  },\n  {\n    \"tag\": "impest",\n    \"popularity\": 4429\n  },\n  {\n    \"tag\": "uncollatedness",\n    \"popularity\": 4426\n  },\n  {\n    \"tag\": "hypersensitize",\n    \"popularity\": 4422\n  },\n  {\n    \"tag\": "autographically",\n    \"popularity\": 4419\n  },\n  {\n    \"tag\": "louther",\n    \"popularity\": 4416\n  },\n  {\n    \"tag\": "Ollie",\n    \"popularity\": 4413\n  },\n  {\n    \"tag\": "recompensate",\n    \"popularity\": 4409\n  },\n  {\n    \"tag\": "Shan",\n    \"popularity\": 4406\n  },\n  {\n    \"tag\": "brachycnemic",\n    \"popularity\": 4403\n  },\n  {\n    \"tag\": "Carinatae",\n    \"popularity\": 4399\n  },\n  {\n    \"tag\": "geotherm",\n    \"popularity\": 4396\n  },\n  {\n    \"tag\": "sawback",\n    \"popularity\": 4393\n  },\n  {\n    \"tag\": "Novatianist",\n    \"popularity\": 4390\n  },\n  {\n    \"tag\": "reapproach",\n    \"popularity\": 4387\n  },\n  {\n    \"tag\": "myelopoietic",\n    \"popularity\": 4383\n  },\n  {\n    \"tag\": "cyanin",\n    \"popularity\": 4380\n  },\n  {\n    \"tag\": "unsmutted",\n    \"popularity\": 4377\n  },\n  {\n    \"tag\": "nonpapist",\n    \"popularity\": 4374\n  },\n  {\n    \"tag\": "transbaikalian",\n    \"popularity\": 4370\n  },\n  {\n    \"tag\": "connately",\n    \"popularity\": 4367\n  },\n  {\n    \"tag\": "tenderize iterance",\n    \"popularity\": 4364\n  },\n  {\n    \"tag\": "hydrostatical",\n    \"popularity\": 4361\n  },\n  {\n    \"tag\": "unflag",\n    \"popularity\": 4358\n  },\n  {\n    \"tag\": "translate",\n    \"popularity\": 4354\n  },\n  {\n    \"tag\": "Scorzonera",\n    \"popularity\": 4351\n  },\n  {\n    \"tag\": "uncomforted",\n    \"popularity\": 4348\n  },\n  {\n    \"tag\": "risser varied",\n    \"popularity\": 4345\n  },\n  {\n    \"tag\": "plumbate",\n    \"popularity\": 4342\n  },\n  {\n    \"tag\": "Usneaceae",\n    \"popularity\": 4338\n  },\n  {\n    \"tag\": "fohat",\n    \"popularity\": 4335\n  },\n  {\n    \"tag\": "slagging",\n    \"popularity\": 4332\n  },\n  {\n    \"tag\": "superserious",\n    \"popularity\": 4329\n  },\n  {\n    \"tag\": "theocracy",\n    \"popularity\": 4326\n  },\n  {\n    \"tag\": "valonia",\n    \"popularity\": 4323\n  },\n  {\n    \"tag\": "Sapindales",\n    \"popularity\": 4319\n  },\n  {\n    \"tag\": "palaeozoologist",\n    \"popularity\": 4316\n  },\n  {\n    \"tag\": "yalb",\n    \"popularity\": 4313\n  },\n  {\n    \"tag\": "unviewed",\n    \"popularity\": 4310\n  },\n  {\n    \"tag\": "polyarteritis",\n    \"popularity\": 4307\n  },\n  {\n    \"tag\": "vectorial",\n    \"popularity\": 4304\n  },\n  {\n    \"tag\": "skimpingly",\n    \"popularity\": 4301\n  },\n  {\n    \"tag\": "athort",\n    \"popularity\": 4297\n  },\n  {\n    \"tag\": "tribofluorescence",\n    \"popularity\": 4294\n  },\n  {\n    \"tag\": "benzonitrol",\n    \"popularity\": 4291\n  },\n  {\n    \"tag\": "swiller subobtuse subjacency",\n    \"popularity\": 4288\n  },\n  {\n    \"tag\": "uncompassed",\n    \"popularity\": 4285\n  },\n  {\n    \"tag\": "cacochymia",\n    \"popularity\": 4282\n  },\n  {\n    \"tag\": "commensalist butadiene",\n    \"popularity\": 4279\n  },\n  {\n    \"tag\": "culpable",\n    \"popularity\": 4276\n  },\n  {\n    \"tag\": "contributive",\n    \"popularity\": 4273\n  },\n  {\n    \"tag\": "attemperately",\n    \"popularity\": 4269\n  },\n  {\n    \"tag\": "spelt",\n    \"popularity\": 4266\n  },\n  {\n    \"tag\": "exoneration",\n    \"popularity\": 4263\n  },\n  {\n    \"tag\": "antivivisectionist",\n    \"popularity\": 4260\n  },\n  {\n    \"tag\": "granitification",\n    \"popularity\": 4257\n  },\n  {\n    \"tag\": "palladize",\n    \"popularity\": 4254\n  },\n  {\n    \"tag\": "marksmanship",\n    \"popularity\": 4251\n  },\n  {\n    \"tag\": "bullydom",\n    \"popularity\": 4248\n  },\n  {\n    \"tag\": "spirality",\n    \"popularity\": 4245\n  },\n  {\n    \"tag\": "caliginous",\n    \"popularity\": 4242\n  },\n  {\n    \"tag\": "reportedly",\n    \"popularity\": 4239\n  },\n  {\n    \"tag\": "polyad",\n    \"popularity\": 4236\n  },\n  {\n    \"tag\": "arthroempyesis",\n    \"popularity\": 4233\n  },\n  {\n    \"tag\": "semibay facultatively",\n    \"popularity\": 4229\n  },\n  {\n    \"tag\": "metastatically",\n    \"popularity\": 4226\n  },\n  {\n    \"tag\": "prophetically",\n    \"popularity\": 4223\n  },\n  {\n    \"tag\": "Linguatula elapid",\n    \"popularity\": 4220\n  },\n  {\n    \"tag\": "pyknatom",\n    \"popularity\": 4217\n  },\n  {\n    \"tag\": "centimeter",\n    \"popularity\": 4214\n  },\n  {\n    \"tag\": "mensurate",\n    \"popularity\": 4211\n  },\n  {\n    \"tag\": "migraine",\n    \"popularity\": 4208\n  },\n  {\n    \"tag\": "pentagamist",\n    \"popularity\": 4205\n  },\n  {\n    \"tag\": "querken",\n    \"popularity\": 4202\n  },\n  {\n    \"tag\": "ambulance",\n    \"popularity\": 4199\n  },\n  {\n    \"tag\": "Stokavian",\n    \"popularity\": 4196\n  },\n  {\n    \"tag\": "malvasian",\n    \"popularity\": 4193\n  },\n  {\n    \"tag\": "uncouthsome",\n    \"popularity\": 4190\n  },\n  {\n    \"tag\": "readable",\n    \"popularity\": 4187\n  },\n  {\n    \"tag\": "enlodge",\n    \"popularity\": 4184\n  },\n  {\n    \"tag\": "plasterwise Appendiculariidae perspectograph",\n    \"popularity\": 4181\n  },\n  {\n    \"tag\": "inkweed",\n    \"popularity\": 4178\n  },\n  {\n    \"tag\": "streep",\n    \"popularity\": 4175\n  },\n  {\n    \"tag\": "diadelphian cultured",\n    \"popularity\": 4172\n  },\n  {\n    \"tag\": "hymenopterous",\n    \"popularity\": 4169\n  },\n  {\n    \"tag\": "unexorableness",\n    \"popularity\": 4166\n  },\n  {\n    \"tag\": "cascaron",\n    \"popularity\": 4163\n  },\n  {\n    \"tag\": "undaintiness",\n    \"popularity\": 4160\n  },\n  {\n    \"tag\": "Curtana",\n    \"popularity\": 4157\n  },\n  {\n    \"tag\": "scurvied",\n    \"popularity\": 4154\n  },\n  {\n    \"tag\": "molluscoidal",\n    \"popularity\": 4151\n  },\n  {\n    \"tag\": "yurt",\n    \"popularity\": 4148\n  },\n  {\n    \"tag\": "deciduitis",\n    \"popularity\": 4145\n  },\n  {\n    \"tag\": "creephole",\n    \"popularity\": 4142\n  },\n  {\n    \"tag\": "quatrefeuille",\n    \"popularity\": 4139\n  },\n  {\n    \"tag\": "bicapitate adenomatome",\n    \"popularity\": 4136\n  },\n  {\n    \"tag\": "damassin",\n    \"popularity\": 4134\n  },\n  {\n    \"tag\": "planching",\n    \"popularity\": 4131\n  },\n  {\n    \"tag\": "dashedly inferential",\n    \"popularity\": 4128\n  },\n  {\n    \"tag\": "lobe",\n    \"popularity\": 4125\n  },\n  {\n    \"tag\": "Hyrachyus",\n    \"popularity\": 4122\n  },\n  {\n    \"tag\": "knab",\n    \"popularity\": 4119\n  },\n  {\n    \"tag\": "discohexaster",\n    \"popularity\": 4116\n  },\n  {\n    \"tag\": "malign",\n    \"popularity\": 4113\n  },\n  {\n    \"tag\": "pedagoguism",\n    \"popularity\": 4110\n  },\n  {\n    \"tag\": "shrubbery",\n    \"popularity\": 4107\n  },\n  {\n    \"tag\": "undershrub",\n    \"popularity\": 4104\n  },\n  {\n    \"tag\": "bureaucrat",\n    \"popularity\": 4101\n  },\n  {\n    \"tag\": "pantaleon",\n    \"popularity\": 4098\n  },\n  {\n    \"tag\": "mesoventral",\n    \"popularity\": 4096\n  }]';
+
+function makeTagCloud(tagInfo)
+{
+    var output = '<div class="tagCloud" style="width: 100%">';
+
+    tagInfo.sort(function(a, b) { if (a.tag < b.tag) { return -1; } else if (a.tag == b.tag) { return 0; } else return 1; });
+
+    for (var i = 0; i < tagInfo.length; i++) {
+        var tag = tagInfo[i].tag;
+
+        var validates = true;
+        for (var j = 0; j < tag.length; j++) {
+            var ch = tag.charCodeAt(j);
+            if (ch < 0x20 || ch >= 0x7f) {
+                validates = false;
+                break;
+            }
+        }
+
+        if (!validates)
+            continue;
+
+        var url = "http://example.com/tag/" + tag.replace(" ", "").toLowerCase();
+        var popularity = tagInfo[i].popularity;
+        var color = 'rgb(' + Math.floor(255 * (popularity - 12) / 20) + ', 0, 255)';
+        output += ' <a href="' + url + '" style="font-size: ' + popularity + 'px; color: ' + color + '">' + tag + '</a> \n';
+    }
+
+    output += '</div>';
+    output.replace(" ", "&nbsp;");
+
+    return output;
+}
+
+window.onload = function(){
+startTest("sunspider-string-tagcloud", '');
+
+var tagInfo;
+
+test("Parse JSON", function(){
+	var log2 = Math.log(2);
+	tagInfo = tagInfoJSON.parseJSON(function(a, b) { if (a == "popularity") { return Math.log(b) / log2; } else {return b; } });
+});
+
+test("Make Tag Cloud", function(){
+	var tagcloud = makeTagCloud(tagInfo);
+});
+
+endTest();
+};
+</script>
+</body>
+</html>
diff --git a/tests/sunspider-string-unpack-code.html b/tests/sunspider-string-unpack-code.html
new file mode 100644
index 0000000..012e563
--- /dev/null
+++ b/tests/sunspider-string-unpack-code.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// This test case unpacks the compressed code for the MochiKit,
+// jQuery, Dojo and Prototype JavaScript libraries.
+
+window.onload = function(){ startTest("sunspider-string-unpack-code", '');
+
+test("Unpack Code", function(){
+
+/***
+    MochiKit.MochiKit 1.3.1 : PACKED VERSION
+    THIS FILE IS AUTOMATICALLY GENERATED.  If creating patches, please
+    diff against the source tree, not this file.
+
+    See <http://mochikit.com/> for documentation, downloads, license, etc.
+
+    (c) 2005 Bob Ippolito.  All rights Reserved.
+***/
+
+
+var decompressedMochiKit = function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('if(H(1q)!="L"){1q.2X("B.J")}if(H(B)=="L"){B={}}if(H(B.J)=="L"){B.J={}}B.J.1Y="1.3.1";B.J.1r="B.J";B.J.2l=G(7V,vR){if(7V===O){7V={}}R(u i=1;i<M.K;i++){u o=M[i];if(H(o)!="L"&&o!==O){R(u k in o){7V[k]=o[k]}}}F 7V};B.J.2l(B.J,{1K:G(){F"["+D.1r+" "+D.1Y+"]"},1l:G(){F D.1K()},4f:G(n){if(M.K===0){n=1}F G(){F n++}},4L:G(mw){u me=M.2U;if(M.K==1){me.1U=mw;F Y me()}},bg:G(vQ){u X=[];u m=B.J;u aw=m.1R(O,M);1M(aw.K){u o=aw.2P();if(o&&H(o)=="3n"&&H(o.K)=="2y"){R(u i=o.K-1;i>=0;i--){aw.e9(o[i])}}N{X.1c(o)}}F X},1R:G(7U,1i,av){if(!av){av=0}if(1i){u l=1i.K;if(H(l)!="2y"){if(H(B.15)!="L"){1i=B.15.2G(1i);l=1i.K}N{14 Y 3p("au 2E an at-as 3W B.15 2E ar")}}if(!7U){7U=[]}R(u i=av;i<l;i++){7U.1c(1i[i])}}F 7U},8Z:G(5g,1i){if(5g===O){5g={}}R(u i=1;i<M.K;i++){u o=M[i];if(H(o)!="L"&&o!==O){R(u k in o){u v=o[k];if(H(5g[k])=="3n"&&H(v)=="3n"){M.2U(5g[k],v)}N{5g[k]=v}}}}F 5g},lO:G(6c,1i){if(6c===O){6c={}}R(u i=1;i<M.K;i++){u o=M[i];R(u k in o){if(!(k in 6c)){6c[k]=o[k]}}}F 6c},lN:G(1i){u fj=[];R(u mv in 1i){fj.1c(mv)}F fj},lM:G(1i){u fh=[];u e;R(u fi in 1i){u v;1f{v=1i[fi]}1e(e){2V}fh.1c([fi,v])}F fh},jq:G(fg,ff,fe){fe.1U=Y B.J.5a(fg.1r+"."+ff);fg[ff]=fe},4i:{7L:G(a){F!!a},vP:G(a){F!a},eE:G(a){F a},2E:G(a){F~a},vO:G(a){F-a},vN:G(a,b){F a+b},vM:G(a,b){F a-b},4u:G(a,b){F a/b},vL:G(a,b){F a%b},vK:G(a,b){F a*b},3W:G(a,b){F a&b},or:G(a,b){F a|b},vJ:G(a,b){F a^b},vI:G(a,b){F a<<b},vH:G(a,b){F a>>b},vG:G(a,b){F a>>>b},eq:G(a,b){F a==b},ne:G(a,b){F a!=b},gt:G(a,b){F a>b},ge:G(a,b){F a>=b},lt:G(a,b){F a<b},le:G(a,b){F a<=b},vF:G(a,b){F B.J.2f(a,b)===0},vE:G(a,b){F B.J.2f(a,b)!==0},vD:G(a,b){F B.J.2f(a,b)==1},vC:G(a,b){F B.J.2f(a,b)!=-1},vB:G(a,b){F B.J.2f(a,b)==-1},vA:G(a,b){F B.J.2f(a,b)!=1},vz:G(a,b){F a&&b},vy:G(a,b){F a||b},vx:G(a,b){F b in a}},24:G(mu){F G(){F D[mu].1w(D,M)}},lL:G(mt){F G(a9){F a9[mt]}},66:G(){u fd={};R(u i=0;i<M.K;i++){u 6b=M[i];fd[6b]=6b}F G(){R(u i=0;i<M.K;i++){if(!(H(M[i])in fd)){F 1m}}F 1h}},lJ:G(){R(u i=0;i<M.K;i++){if(M[i]!==O){F 1m}}F 1h},lK:G(){R(u i=0;i<M.K;i++){u o=M[i];if(!(H(o)=="L"||o===O)){F 1m}}F 1h},lI:G(1i){F!B.J.7e.1w(D,M)},7e:G(1i){R(u i=0;i<M.K;i++){u o=M[i];if(!(o&&o.K)){F 1m}}F 1h},3A:G(){R(u i=0;i<M.K;i++){u o=M[i];u 6b=H(o);if((6b!="3n"&&!(6b=="G"&&H(o.vw)=="G"))||o===O||H(o.K)!="2y"){F 1m}}F 1h},eN:G(){R(u i=0;i<M.K;i++){u o=M[i];if(H(o)!="3n"||o===O||H(o.9P)!="G"){F 1m}}F 1h},lH:G(fn){if(fn===O){F B.J.1R(O,M,1)}u fc=[];R(u i=1;i<M.K;i++){fc.1c(fn(M[i]))}F fc},2r:G(fn,1g){u m=B.J;u 6a=B.15;u fb=m.3A;if(M.K<=2){if(!fb(1g)){if(6a){1g=6a.2G(1g);if(fn===O){F 1g}}N{14 Y 3p("au 2E an at-as 3W B.15 2E ar")}}if(fn===O){F m.1R(O,1g)}u 69=[];R(u i=0;i<1g.K;i++){69.1c(fn(1g[i]))}F 69}N{if(fn===O){fn=7o}u 7T=O;R(i=1;i<M.K;i++){if(!fb(M[i])){if(6a){F 6a.2G(6a.4c.1w(O,M))}N{14 Y 3p("au 2E an at-as 3W B.15 2E ar")}}u l=M[i].K;if(7T===O||7T>l){7T=l}}69=[];R(i=0;i<7T;i++){u fa=[];R(u j=1;j<M.K;j++){fa.1c(M[j][i])}69.1c(fn.1w(D,fa))}F 69}},lG:G(fn){u f9=[];if(fn===O){fn=B.J.4i.7L}R(u i=1;i<M.K;i++){u o=M[i];if(fn(o)){f9.1c(o)}}F f9},47:G(fn,1g,7S){u aq=[];u m=B.J;if(!m.3A(1g)){if(B.15){1g=B.15.2G(1g)}N{14 Y 3p("au 2E an at-as 3W B.15 2E ar")}}if(fn===O){fn=m.4i.7L}if(H(7o.1U.47)=="G"){F 7o.1U.47.cz(1g,fn,7S)}N{if(H(7S)=="L"||7S===O){R(u i=0;i<1g.K;i++){u o=1g[i];if(fn(o)){aq.1c(o)}}}N{R(i=0;i<1g.K;i++){o=1g[i];if(fn.cz(7S,o)){aq.1c(o)}}}}F aq},mq:G(7R){F G(){hd(M.K){3j 0:F 7R();3j 1:F 7R(M[0]);3j 2:F 7R(M[0],M[1]);3j 3:F 7R(M[0],M[1],M[2])}u f8=[];R(u i=0;i<M.K;i++){f8.1c("M["+i+"]")}F dB("(1A("+f8.2b(",")+"))")}},lv:G(mr,ms){u m=B.J;F m.1O.1w(D,m.1R([ms,mr],M,2))},1O:G(3c,4o){if(H(3c)=="1n"){3c=4o[3c]}u ao=3c.f5;u 5f=3c.am;u f6=3c.f7;u m=B.J;if(H(3c)=="G"&&H(3c.1w)=="L"){3c=m.mq(3c)}if(H(ao)!="G"){ao=3c}if(H(4o)!="L"){f6=4o}if(H(5f)=="L"){5f=[]}N{5f=5f.9T()}m.1R(5f,M,2);u 7Q=G(){u ap=M;u me=M.2U;if(me.am.K>0){ap=m.2o(me.am,ap)}u 4o=me.f7;if(!4o){4o=D}F me.f5.1w(4o,ap)};7Q.f7=f6;7Q.f5=ao;7Q.am=5f;F 7Q},lF:G(7P){u mp=B.J.1O;R(u k in 7P){u f4=7P[k];if(H(f4)=="G"){7P[k]=mp(f4,7P)}}},5u:G(mo,mn,ml,mk){B.J.ae.5M(mo,mn,ml,mk)},mj:{"5L":1h,"1n":1h,"2y":1h},2f:G(a,b){if(a==b){F 0}u f3=(H(a)=="L"||a===O);u f2=(H(b)=="L"||b===O);if(f3&&f2){F 0}N{if(f3){F-1}N{if(f2){F 1}}}u m=B.J;u f1=m.mj;if(!(H(a)in f1&&H(b)in f1)){1f{F m.ae.3C(a,b)}1e(e){if(e!=m.4d){14 e}}}if(a<b){F-1}N{if(a>b){F 1}}u f0=m.U;14 Y 3p(f0(a)+" 3W "+f0(b)+" 9v 2E be vv")},eM:G(a,b){F B.J.2f(a.9P(),b.9P())},eL:G(a,b){u mi=B.J.2f;u 7O=a.K;u al=0;if(7O>b.K){al=1;7O=b.K}N{if(7O<b.K){al=-1}}R(u i=0;i<7O;i++){u 4j=mi(a[i],b[i]);if(4j){F 4j}}F al},7M:G(mh,mg,mf,md){B.J.ad.5M(mh,mg,mf,md)},U:G(o){if(H(o)=="L"){F"L"}N{if(o===O){F"O"}}1f{if(H(o.1K)=="G"){F o.1K()}N{if(H(o.U)=="G"&&o.U!=M.2U){F o.U()}}F B.J.ad.3C(o)}1e(e){if(H(o.1r)=="1n"&&(o.1l==cZ.1U.1l||o.1l==vu.1U.1l)){F o.1r}}1f{u eZ=(o+"")}1e(e){F"["+H(o)+"]"}if(H(o)=="G"){o=eZ.23(/^\\s+/,"");u 5n=o.2A("{");if(5n!=-1){o=o.3H(0,5n)+"{...}"}}F eZ},eK:G(o){u m=B.J;F"["+m.2r(m.U,o).2b(", ")+"]"},ac:G(o){F("\\""+o.23(/(["\\\\])/g,"\\\\$1")+"\\"").23(/[\\f]/g,"\\\\f").23(/[\\b]/g,"\\\\b").23(/[\\n]/g,"\\\\n").23(/[\\t]/g,"\\\\t").23(/[\\r]/g,"\\\\r")},eJ:G(o){F o+""},ly:G(mc,mb,ma,m9){B.J.ab.5M(mc,mb,ma,m9)},lx:G(){F dB("("+M[0]+")")},lz:G(o){u 5e=H(o);if(5e=="L"){F"L"}N{if(5e=="2y"||5e=="5L"){F o+""}N{if(o===O){F"O"}}}u m=B.J;u eY=m.ac;if(5e=="1n"){F eY(o)}u me=M.2U;u 3S;if(H(o.m8)=="G"){3S=o.m8();if(o!==3S){F me(3S)}}if(H(o.m7)=="G"){3S=o.m7();if(o!==3S){F me(3S)}}if(5e!="G"&&H(o.K)=="2y"){u X=[];R(u i=0;i<o.K;i++){u 2i=me(o[i]);if(H(2i)!="1n"){2i="L"}X.1c(2i)}F"["+X.2b(", ")+"]"}1f{3S=m.ab.3C(o);F me(3S)}1e(e){if(e!=m.4d){14 e}}if(5e=="G"){F O}X=[];R(u k in o){u ak;if(H(k)=="2y"){ak="\\""+k+"\\""}N{if(H(k)=="1n"){ak=eY(k)}N{2V}}2i=me(o[k]);if(H(2i)!="1n"){2V}X.1c(ak+":"+2i)}F"{"+X.2b(", ")+"}"},lE:G(a,b){F(B.J.2f(a,b)===0)},lD:G(eX,4n){if(eX.K!=4n.K){F 1m}F(B.J.2f(eX,4n)===0)},2o:G(){u eW=[];u m6=B.J.1R;R(u i=0;i<M.K;i++){m6(eW,M[i])}F eW},eR:G(2h){u m=B.J;u eU=m.2f;if(M.K==1){F G(a,b){F eU(a[2h],b[2h])}}u eV=m.1R(O,M);F G(a,b){u aj=0;R(u i=0;(aj===0)&&(i<eV.K);i++){u 2h=eV[i];aj=eU(a[2h],b[2h])}F aj}},lC:G(2h){u m5=B.J.eR.1w(D,M);F G(a,b){F m5(b,a)}},2z:G(m4){u m=B.J;F m.1O.1w(D,m.1R([m4,L],M,1))},67:G(m0,1g){if(1g.K===0){F O}u ai=1g[0];u m3=B.J.2f;R(u i=1;i<1g.K;i++){u o=1g[i];if(m3(o,ai)==m0){ai=o}}F ai},lB:G(){F B.J.67(1,M)},lA:G(){F B.J.67(-1,M)},bi:G(1g,lY,lZ,3B){if(H(3B)=="L"||3B===O){3B=1g.K}R(u i=(lZ||0);i<3B;i++){if(1g[i]===lY){F i}}F-1},eO:G(1g,lW,lX,3B){if(H(3B)=="L"||3B===O){3B=1g.K}u 4j=B.J.2f;R(u i=(lX||0);i<3B;i++){if(4j(1g[i],lW)===0){F i}}F-1},d4:G(1j,lV){u ah=[1j];u lU=B.J.1R;1M(ah.K){u X=lV(ah.2P());if(X){lU(ah,X)}}},3f:G(ag){u 2w=ag.1r;if(H(2w)=="L"){2w=""}N{2w=2w+"."}R(u 1b in ag){u o=ag[1b];if(H(o)=="G"&&H(o.1r)=="L"){1f{o.1r=2w+1b}1e(e){}}}},dw:G(3s,68){if(H(B.S)!="L"&&M.K==1&&(H(3s)=="1n"||(H(3s.3T)!="L"&&3s.3T>0))){u kv=B.S.d5(3s);3s=kv[0];68=kv[1]}N{if(M.K==1){u o=3s;3s=[];68=[];R(u k in o){u v=o[k];if(H(v)!="G"){3s.1c(k);68.1c(v)}}}}u W=[];u lT=28.2a(3s.K,68.K);u eT=B.J.af;R(u i=0;i<lT;i++){v=68[i];if(H(v)!="L"&&v!==O){W.1c(eT(3s[i])+"="+eT(v))}}F W.2b("&")},lw:G(lS,lQ){u 7N=lS.23(/\\+/g,"%20").2R("&");u o={};u 5d;if(H(lR)!="L"){5d=lR}N{5d=vt}if(lQ){R(u i=0;i<7N.K;i++){u 2n=7N[i].2R("=");u 1b=5d(2n[0]);u 4n=o[1b];if(!(4n 2C 7o)){4n=[];o[1b]=4n}4n.1c(5d(2n[1]))}}N{R(i=0;i<7N.K;i++){2n=7N[i].2R("=");o[5d(2n[0])]=5d(2n[1])}}F o}});B.J.4a=G(){D.4m=[]};B.J.4a.1U={5M:G(1b,eS,3y,lP){if(lP){D.4m.e9([1b,eS,3y])}N{D.4m.1c([1b,eS,3y])}},3C:G(){R(u i=0;i<D.4m.K;i++){u 2n=D.4m[i];if(2n[1].1w(D,M)){F 2n[2].1w(D,M)}}14 B.J.4d},vs:G(1b){R(u i=0;i<D.4m.K;i++){u 2n=D.4m[i];if(2n[0]==1b){D.4m.4y(i,1);F 1h}}F 1m}};B.J.1z=["4f","4L","1R","2l","8Z","lO","lN","lM","5a","4i","24","lL","66","lo","ln","lK","lJ","lI","7e","3A","eN","lH","2r","lG","47","1O","lF","4d","4a","5u","2f","7M","U","lE","lD","2o","eR","lC","2z","lm","67","lp","eI","lB","lA","d4","ll","af","dw","lz","ly","lx","lw","eO","bi","bg","lv"];B.J.1W=["3f","ae","ad","ab","eM","eL","eK","ac","eJ"];B.J.2Y=G(lu,eP){if(H(B.eQ)=="L"){B.eQ=(B.3d||(H(1x)=="L"&&H(1q)=="L"))}if(!B.eQ){F}u 1p=eP.2k[":1p"];R(u i=0;i<1p.K;i++){lu[1p[i]]=eP[1p[i]]}};B.J.2d=G(){u m=D;m.vr=m.24;m.vq=m.eO;if(H(ls)!="L"){m.af=G(lr){F ls(lr).23(/\\\'/g,"%27")}}N{m.af=G(lq){F vp(lq).23(/\\+/g,"%2B").23(/\\"/g,"%22").W.23(/\\\'/g,"%27")}}m.5a=G(1b){D.43=1b;D.1b=1b};m.5a.1U=Y 2x();m.2l(m.5a.1U,{U:G(){if(D.43&&D.43!=D.1b){F D.1b+"("+m.U(D.43)+")"}N{F D.1b+"()"}},1l:m.24("U")});m.4d=Y m.5a("B.J.4d");m.lp=m.2z(m.67,1);m.eI=m.2z(m.67,-1);m.lo=m.66("G");m.ln=m.66("L");m.lm=m.2z(m.2l,O);m.ll=m.2z(m.2r,O);m.ae=Y m.4a();m.5u("vo",m.eN,m.eM);m.5u("ej",m.3A,m.eL);m.ad=Y m.4a();m.7M("ej",m.3A,m.eK);m.7M("1n",m.66("1n"),m.ac);m.7M("vn",m.66("2y","5L"),m.eJ);m.ab=Y m.4a();u 1p=m.2o(m.1z,m.1W);m.2k={":3e":m.2o(m.1W),":1p":1p};m.3f(D)};B.J.2d();if(!B.3d){2f=B.J.2f}B.J.2Y(D,B.J);if(H(1q)!="L"){1q.2X("B.15");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.J",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.15 3F on B.J!"}if(H(B.15)=="L"){B.15={}}B.15.1r="B.15";B.15.1Y="1.3.1";B.J.2l(B.15,{1K:G(){F"["+D.1r+" "+D.1Y+"]"},1l:G(){F D.1K()},9W:G(1b,lk,lj,lh){B.15.9Y.5M(1b,lk,lj,lh)},1Q:G(3R,lg){u I=B.15;if(M.K==2){F I.9Z(G(a){F a!=lg},3R)}if(H(3R.1a)=="G"){F 3R}N{if(H(3R.1Q)=="G"){F 3R.1Q()}}1f{F I.9Y.3C(3R)}1e(e){u m=B.J;if(e==m.4d){e=Y 3p(H(3R)+": "+m.U(3R)+" is 2E vm")}14 e}},eu:G(n){if(!n){n=0}u m=B.J;F{U:G(){F"eu("+n+")"},1l:m.24("U"),1a:m.4f(n)}},et:G(p){u I=B.15;u m=B.J;u 1g=[];u lf=I.1Q(p);F{U:G(){F"et(...)"},1l:m.24("U"),1a:G(){1f{u W=lf.1a();1g.1c(W);F W}1e(e){if(e!=I.25){14 e}if(1g.K===0){D.1a=G(){14 I.25}}N{u i=-1;D.1a=G(){i=(i+1)%1g.K;F 1g[i]}}F D.1a()}}}},7b:G(Q,n){u m=B.J;if(H(n)=="L"){F{U:G(){F"7b("+m.U(Q)+")"},1l:m.24("U"),1a:G(){F Q}}}F{U:G(){F"7b("+m.U(Q)+", "+n+")"},1l:m.24("U"),1a:G(){if(n<=0){14 B.15.25}n-=1;F Q}}},1a:G(ld){F ld.1a()},es:G(p,q){u m=B.J;u 1a=B.15.1a;u lc=m.2r(1Q,M);F{U:G(){F"es(...)"},1l:m.24("U"),1a:G(){F m.2r(1a,lc)}}},a1:G(3b,1V){u m=B.J;1V=B.15.1Q(1V);if(3b===O){3b=m.4i.7L}F{U:G(){F"a1(...)"},1l:m.24("U"),1a:G(){1M(1h){u W=1V.1a();if(3b(W)){F W}}F L}}},a0:G(3b,1V){u m=B.J;1V=B.15.1Q(1V);if(3b===O){3b=m.4i.7L}F{U:G(){F"a0(...)"},1l:m.24("U"),1a:G(){1M(1h){u W=1V.1a();if(!3b(W)){F W}}F L}}},er:G(1V){u I=B.15;u m=B.J;1V=I.1Q(1V);u 5c=0;u 2J=0;u 3a=1;u i=-1;if(M.K==2){2J=M[1]}N{if(M.K==3){5c=M[1];2J=M[2]}N{5c=M[1];2J=M[2];3a=M[3]}}F{U:G(){F"er("+["...",5c,2J,3a].2b(", ")+")"},1l:m.24("U"),1a:G(){u W;1M(i<5c){W=1V.1a();i++}if(5c>=2J){14 I.25}5c+=3a;F W}}},4c:G(aa,p,q){u m=B.J;u I=B.15;u lb=m.2r(I.1Q,m.1R(O,M,1));u 2r=m.2r;u 1a=I.1a;F{U:G(){F"4c(...)"},1l:m.24("U"),1a:G(){F aa.1w(D,2r(1a,lb))}}},ep:G(aa,1V,I){1V=B.15.1Q(1V);u m=B.J;F{U:G(){F"ep(...)"},1l:m.24("U"),1a:G(){F aa.1w(I,1V.1a())}}},55:G(p,q){u I=B.15;u m=B.J;if(M.K==1){F I.1Q(M[0])}u 64=m.2r(I.1Q,M);F{U:G(){F"55(...)"},1l:m.24("U"),1a:G(){1M(64.K>1){1f{F 64[0].1a()}1e(e){if(e!=I.25){14 e}64.2P()}}if(64.K==1){u a9=64.2P();D.1a=m.1O("1a",a9);F D.1a()}14 I.25}}},9Z:G(3b,1V){u I=B.15;1V=I.1Q(1V);F{U:G(){F"9Z(...)"},1l:B.J.24("U"),1a:G(){u W=1V.1a();if(!3b(W)){D.1a=G(){14 I.25};D.1a()}F W}}},eo:G(3b,1V){1V=B.15.1Q(1V);u m=B.J;u 1O=m.1O;F{"U":G(){F"eo(...)"},"1l":m.24("U"),"1a":G(){1M(1h){u W=1V.1a();if(!3b(W)){2K}}D.1a=1O("1a",1V);F W}}},a7:G(63,2u,la){2u.62[63]=-1;u m=B.J;u l9=m.eI;F{U:G(){F"en("+63+", ...)"},1l:m.24("U"),1a:G(){u W;u i=2u.62[63];if(i==2u.29){W=la.1a();2u.a8.1c(W);2u.29+=1;2u.62[63]+=1}N{W=2u.a8[i-2u.2a];2u.62[63]+=1;if(i==2u.2a&&l9(2u.62)!=2u.2a){2u.2a+=1;2u.a8.2P()}}F W}}},en:G(a6,n){u W=[];u 2u={"62":[],"a8":[],"29":-1,"2a":-1};if(M.K==1){n=2}u I=B.15;a6=I.1Q(a6);u a7=I.a7;R(u i=0;i<n;i++){W.1c(a7(i,2u,a6))}F W},2G:G(4l){u m=B.J;if(H(4l.9T)=="G"){F 4l.9T()}N{if(m.3A(4l)){F m.2o(4l)}}u I=B.15;4l=I.1Q(4l);u W=[];1f{1M(1h){W.1c(4l.1a())}}1e(e){if(e!=I.25){14 e}F W}F L},7H:G(fn,7K,l8){u i=0;u x=l8;u I=B.15;7K=I.1Q(7K);if(M.K<3){1f{x=7K.1a()}1e(e){if(e==I.25){e=Y 3p("7H() of vl vk vj no vi 3m")}14 e}i++}1f{1M(1h){x=fn(x,7K.1a())}}1e(e){if(e!=I.25){14 e}}F x},7I:G(){u 4k=0;u 2J=0;u 3a=1;if(M.K==1){2J=M[0]}N{if(M.K==2){4k=M[0];2J=M[1]}N{if(M.K==3){4k=M[0];2J=M[1];3a=M[2]}N{14 Y 3p("7I() vh 1, 2, or 3 M!")}}}if(3a===0){14 Y 3p("7I() 3a 5p 2E be 0")}F{1a:G(){if((3a>0&&4k>=2J)||(3a<0&&4k<=2J)){14 B.15.25}u W=4k;4k+=3a;F W},U:G(){F"7I("+[4k,2J,3a].2b(", ")+")"},1l:B.J.24("U")}},l0:G(a5,l7){u x=l7||0;u I=B.15;a5=I.1Q(a5);1f{1M(1h){x+=a5.1a()}}1e(e){if(e!=I.25){14 e}}F x},em:G(a4){u I=B.15;a4=I.1Q(a4);1f{1M(1h){a4.1a()}}1e(e){if(e!=I.25){14 e}}},9a:G(7J,1A,I){u m=B.J;if(M.K>2){1A=m.1O(1A,I)}if(m.3A(7J)){1f{R(u i=0;i<7J.K;i++){1A(7J[i])}}1e(e){if(e!=B.15.25){14 e}}}N{I=B.15;I.em(I.4c(1A,7J))}},kZ:G(l6,1A){u I=B.15;1f{I.a0(1A,l6).1a();F 1m}1e(e){if(e!=I.25){14 e}F 1h}},kY:G(l5,4j){u W=B.15.2G(l5);if(M.K==1){4j=B.J.2f}W.iz(4j);F W},kX:G(l4){u W=B.15.2G(l4);W.vg();F W},kW:G(l3,1A){u I=B.15;1f{I.a1(1A,l3).1a();F 1h}1e(e){if(e!=I.25){14 e}F 1m}},kV:G(1g,5b){if(B.J.3A(5b)){R(u i=0;i<5b.K;i++){1g.1c(5b[i])}}N{u I=B.15;5b=I.1Q(5b);1f{1M(1h){1g.1c(5b.1a())}}1e(e){if(e!=I.25){14 e}}}F 1g},ek:G(a3,eH){u m=B.J;u I=B.15;if(M.K<2){eH=m.4i.eE}a3=I.1Q(a3);u pk=L;u k=L;u v;G eF(){v=a3.1a();k=eH(v)}G l2(){u 7j=v;v=L;F 7j}u eG=1h;F{U:G(){F"ek(...)"},1a:G(){1M(k==pk){eF();if(eG){eG=1m;2K}}pk=k;F[k,{1a:G(){if(v==L){eF()}if(k!=pk){14 I.25}F l2()}}]}}},kU:G(a2,eD){u m=B.J;u I=B.15;if(M.K<2){eD=m.4i.eE}a2=I.1Q(a2);u ey=[];u eA=1h;u ez;1M(1h){1f{u eB=a2.1a();u 2h=eD(eB)}1e(e){if(e==I.25){2K}14 e}if(eA||2h!=ez){u eC=[];ey.1c([2h,eC])}eC.1c(eB);eA=1m;ez=2h}F ey},9X:G(ex){u i=0;F{U:G(){F"9X(...)"},1l:B.J.24("U"),1a:G(){if(i>=ex.K){14 B.15.25}F ex[i++]}}},eh:G(ew){F(ew&&H(ew.ei)=="G")},9V:G(l1){F{U:G(){F"9V(...)"},1l:B.J.24("U"),1a:G(){u W=l1.ei();if(W===O||W===L){14 B.15.25}F W}}}});B.15.1W=["9Y","9X","eh","9V",];B.15.1z=["25","9W","1Q","eu","et","7b","1a","es","a1","a0","er","4c","ep","55","9Z","eo","en","2G","7H","7I","l0","em","9a","kZ","kY","kX","kW","kV","ek","kU"];B.15.2d=G(){u m=B.J;D.25=Y m.5a("25");D.9Y=Y m.4a();D.9W("ej",m.3A,D.9X);D.9W("ei",D.eh,D.9V);D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};B.15.2d();if(!B.3d){7H=B.15.7H}B.J.2Y(D,B.15);if(H(1q)!="L"){1q.2X("B.1H");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.J",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.1H 3F on B.J!"}if(H(B.1H)=="L"){B.1H={}}B.1H.1r="B.1H";B.1H.1Y="1.3.1";B.1H.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1H.1l=G(){F D.1K()};B.1H.1z=["5C","49","7A","kR","2L","5Z","kG","ch","kE","kC"];B.1H.1W=["ef","e8","e7"];B.1H.49=G(1P,kT,3z){D.1P=1P;D.3N=kT;D.3z=3z;D.vf=Y 3Q()};B.1H.49.1U={U:G(){u m=B.J;F"49("+m.2r(m.U,[D.1P,D.3N,D.3z]).2b(", ")+")"},1l:B.J.24("U")};B.J.2l(B.1H,{ef:G(7F){u I=B.1H;if(H(7F)=="1n"){7F=I.5C[7F]}F G(1t){u 7G=1t.3N;if(H(7G)=="1n"){7G=I.5C[7G]}F 7G>=7F}},e8:G(){u kS=B.1H.49;R(u i=0;i<M.K;i++){if(!(M[i]2C kS)){F 1m}}F 1h},e7:G(a,b){F B.J.2f([a.3N,a.3z],[b.3N,b.3z])},kR:G(1t){cq("1P: "+1t.1P+"\\ve: "+1t.3N+"\\vd: "+1t.3z.2b(" "))}});B.1H.7A=G(7E){D.4f=0;if(H(7E)=="L"||7E===O){7E=-1}D.ec=7E;D.4h=[];D.7C={};D.e5=1m};B.1H.7A.1U={vc:G(){D.4h.4y(0,D.4h.K)},kK:G(1t){if(H(2O)!="L"&&2O.eg&&2O.eg.5Z){2O.eg.5Z(1t)}N{if(H(7h)!="L"&&7h.kQ){7h.kQ(1t)}N{if(H(5X)=="G"){5X(1t)}}}},kL:G(1t){R(u k in D.7C){u 2n=D.7C[k];if(2n.kO!=k||(2n[0]&&!2n[0](1t))){2V}2n[1](1t)}},hE:G(ee,7D,kP){if(H(7D)=="1n"){7D=B.1H.ef(7D)}u ed=[7D,kP];ed.kO=ee;D.7C[ee]=ed},c9:G(kN){gi D.7C[kN]},kH:G(kM,vb){u 1t=Y B.1H.49(D.4f,kM,B.J.1R(O,M,1));D.4h.1c(1t);D.kL(1t);if(D.e5){D.kK(1t.3N+": "+1t.3z.2b(" "))}D.4f+=1;1M(D.ec>=0&&D.4h.K>D.ec){D.4h.2P()}},c8:G(9U){u ea=0;if(!(H(9U)=="L"||9U===O)){ea=28.29(0,D.4h.K-9U)}F D.4h.9T(ea)},kJ:G(7B){if(H(7B)=="L"||7B===O){7B=30}u 9S=D.c8(7B);if(9S.K){u 1g=2r(G(m){F"\\n  ["+m.1P+"] "+m.3N+": "+m.3z.2b(" ")},9S);1g.e9("va "+9S.K+" v9:");F 1g.2b("")}F""},v8:G(kI){if(H(B.1I)=="L"){cq(D.kJ())}N{B.1I.bY(kI||1m)}}};B.1H.2d=G(){D.5C={8M:40,8L:50,8K:30,8J:20,8I:10};u m=B.J;m.5u("49",D.e8,D.e7);u 61=m.2z;u e6=D.7A;u 60=e6.1U.kH;m.2l(D.7A.1U,{kF:61(60,"8I"),5Z:61(60,"8J"),dE:61(60,"8M"),kD:61(60,"8L"),kB:61(60,"8K")});u I=D;u 5Y=G(1b){F G(){I.2L[1b].1w(I.2L,M)}};D.5Z=5Y("5Z");D.kG=5Y("dE");D.ch=5Y("kF");D.kE=5Y("kD");D.kC=5Y("kB");D.2L=Y e6();D.2L.e5=1h;D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};if(H(5X)=="L"&&H(2v)!="L"&&2v.kA&&H(kz)!="L"){5X=G(){5X.3G=M;u ev=2v.kA("v7");ev.v6("5X",1m,1h);kz(ev)}}B.1H.2d();B.J.2Y(D,B.1H);if(H(1q)!="L"){1q.2X("B.1D")}if(H(B)=="L"){B={}}if(H(B.1D)=="L"){B.1D={}}B.1D.1r="B.1D";B.1D.1Y="1.3.1";B.1D.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1D.1l=G(){F D.1K()};B.1D.ks=G(1y){1y=1y+"";if(H(1y)!="1n"||1y.K===0){F O}u 7z=1y.2R("-");if(7z.K===0){F O}F Y 3Q(7z[0],7z[1]-1,7z[2])};B.1D.ky=/(\\d{4,})(?:-(\\d{1,2})(?:-(\\d{1,2})(?:[T ](\\d{1,2}):(\\d{1,2})(?::(\\d{1,2})(?:\\.(\\d+))?)?(?:(Z)|([+-])(\\d{1,2})(?::(\\d{1,2}))?)?)?)?)?/;B.1D.kr=G(1y){1y=1y+"";if(H(1y)!="1n"||1y.K===0){F O}u X=1y.3C(B.1D.ky);if(H(X)=="L"||X===O){F O}u 5W,7y,7x,9R,2a,9Q,7w;5W=3w(X[1],10);if(H(X[2])=="L"||X[2]===""){F Y 3Q(5W)}7y=3w(X[2],10)-1;7x=3w(X[3],10);if(H(X[4])=="L"||X[4]===""){F Y 3Q(5W,7y,7x)}9R=3w(X[4],10);2a=3w(X[5],10);9Q=(H(X[6])!="L"&&X[6]!=="")?3w(X[6],10):0;if(H(X[7])!="L"&&X[7]!==""){7w=28.ha(c5*4M("0."+X[7]))}N{7w=0}if((H(X[8])=="L"||X[8]==="")&&(H(X[9])=="L"||X[9]==="")){F Y 3Q(5W,7y,7x,9R,2a,9Q,7w)}u 58;if(H(X[9])!="L"&&X[9]!==""){58=3w(X[10],10)*v5;if(H(X[11])!="L"&&X[11]!==""){58+=3w(X[11],10)*kw}if(X[9]=="-"){58=-58}}N{58=0}F Y 3Q(3Q.v4(5W,7y,7x,9R,2a,9Q,7w)-58)};B.1D.dY=G(2g,kx){if(H(2g)=="L"||2g===O){F O}u hh=2g.v3();u mm=2g.v2();u ss=2g.v1();u 1g=[((kx&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)];F 1g.2b(":")};B.1D.kq=G(2g,7v){if(H(2g)=="L"||2g===O){F O}u ku=7v?"T":" ";u kt=7v?"Z":"";if(7v){2g=Y 3Q(2g.9P()+(2g.v0()*kw))}F B.1D.dX(2g)+ku+B.1D.dY(2g,7v)+kt};B.1D.dX=G(2g){if(H(2g)=="L"||2g===O){F O}u e4=B.1D.e3;F[2g.dZ(),e4(2g.e1()+1),e4(2g.e0())].2b("-")};B.1D.kp=G(d){d=d+"";if(H(d)!="1n"||d.K===0){F O}u a=d.2R("/");F Y 3Q(a[2],a[0]-1,a[1])};B.1D.e3=G(n){F(n>9)?n:"0"+n};B.1D.ko=G(d){if(H(d)=="L"||d===O){F O}u e2=B.1D.e3;F[e2(d.e1()+1),e2(d.e0()),d.dZ()].2b("/")};B.1D.kn=G(d){if(H(d)=="L"||d===O){F O}F[d.e1()+1,d.e0(),d.dZ()].2b("/")};B.1D.1z=["ks","kr","dY","kq","dX","kp","ko","kn"];B.1D.1W=[];B.1D.2k={":3e":B.1D.1z,":1p":B.1D.1z};B.1D.2d=G(){u 2w=D.1r+".";R(u k in D){u o=D[k];if(H(o)=="G"&&H(o.1r)=="L"){1f{o.1r=2w+k}1e(e){}}}};B.1D.2d();if(H(B.J)!="L"){B.J.2Y(D,B.1D)}N{(G(km,dW){if((H(1x)=="L"&&H(1q)=="L")||(H(B.3d)=="5L"&&B.3d)){u 1p=dW.2k[":1p"];R(u i=0;i<1p.K;i++){km[1p[i]]=dW[1p[i]]}}})(D,B.1D)}if(H(1q)!="L"){1q.2X("B.1s")}if(H(B)=="L"){B={}}if(H(B.1s)=="L"){B.1s={}}B.1s.1r="B.1s";B.1s.1Y="1.3.1";B.1s.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1s.1l=G(){F D.1K()};B.1s.ke=G(kl,kk,kj,ki,kh,dV,kg,9N,kf){F G(1P){1P=4M(1P);if(H(1P)=="L"||1P===O||k8(1P)){F kl}u 9L=kk;u 9K=kj;if(1P<0){1P=-1P}N{9L=9L.23(/-/,"")}u me=M.2U;u 9M=B.1s.dJ(ki);if(kh){1P=1P*3k;9K=9M.9y+9K}1P=B.1s.dK(1P,dV);u 9O=1P.2R(/\\./);u 3r=9O[0];u 3P=(9O.K==1)?"":9O[1];u X="";1M(3r.K<kg){3r="0"+3r}if(9N){1M(3r.K>9N){u i=3r.K-9N;X=9M.9A+3r.2W(i,3r.K)+X;3r=3r.2W(0,i)}}X=3r+X;if(dV>0){1M(3P.K<kf){3P=3P+"0"}X=X+9M.9z+3P}F 9L+X+9K}};B.1s.k5=G(9J,9H,9G){if(H(9H)=="L"){9H=""}u 3q=9J.3C(/((?:[0#]+,)?[0#]+)(?:\\.([0#]+))?(%)?/);if(!3q){14 3p("uZ uY")}u 7u=9J.3H(0,3q.c6);u kd=9J.3H(3q.c6+3q[0].K);if(7u.uX(/-/)==-1){7u=7u+"-"}u 9I=3q[1];u 3P=(H(3q[2])=="1n"&&3q[2]!="")?3q[2]:"";u kc=(H(3q[3])=="1n"&&3q[3]!="");u dU=9I.2R(/,/);u 9F;if(H(9G)=="L"){9G="dG"}if(dU.K==1){9F=O}N{9F=dU[1].K}u ka=9I.K-9I.23(/0/g,"").K;u k9=3P.K-3P.23(/0/g,"").K;u kb=3P.K;u W=B.1s.ke(9H,7u,kd,9G,kc,kb,ka,9F,k9);u m=B.J;if(m){u fn=M.2U;u 3G=m.2o(M);W.U=G(){F[I.1r,"(",2r(m.U,3G).2b(", "),")"].2b("")}}F W};B.1s.dJ=G(4g){if(H(4g)=="L"||4g===O){4g="dG"}if(H(4g)=="1n"){u W=B.1s.5V[4g];if(H(W)=="1n"){W=M.2U(W);B.1s.5V[4g]=W}F W}N{F 4g}};B.1s.k4=G(dT,9E){if(9E){u X=dT/9E;if(!k8(X)){F B.1s.9B(dT/9E)}}F"0"};B.1s.9B=G(dS){u dR=(dS<0?"-":"");u s=28.8B(28.uW(dS)*3k).1l();if(s=="0"){F s}if(s.K<3){1M(s.3Z(s.K-1)=="0"){s=s.2W(0,s.K-1)}F dR+"0."+s}u 5E=dR+s.2W(0,s.K-2);u 7t=s.2W(s.K-2,s.K);if(7t=="uV"){F 5E}N{if(7t.3Z(1)=="0"){F 5E+"."+7t.3Z(0)}N{F 5E+"."+7t}}};B.1s.dI=G(1y,dQ){1y=1y+"";if(H(1y)!="1n"){F O}if(!dQ){F 1y.23(/^\\s+/,"")}N{F 1y.23(Y 8V("^["+dQ+"]+"),"")}};B.1s.dH=G(1y,dP){1y=1y+"";if(H(1y)!="1n"){F O}if(!dP){F 1y.23(/\\s+$/,"")}N{F 1y.23(Y 8V("["+dP+"]+$"),"")}};B.1s.k2=G(1y,dO){u I=B.1s;F I.dH(I.dI(1y,dO),dO)};B.1s.dL=G(9D,9C){9D=28.8B(9D*28.dN(10,9C));u X=(9D*28.dN(10,-9C)).6I(9C);if(X.3Z(0)=="."){X="0"+X}F X};B.1s.dK=G(k7,dM){F B.1s.dL(k7+0.5*28.dN(10,-dM),dM)};B.1s.k3=G(k6){F B.1s.9B(3k*k6)+"%"};B.1s.1z=["dL","dK","k5","dJ","k4","9B","k3","dI","dH","k2"];B.1s.5V={k1:{9A:",",9z:".",9y:"%"},uU:{9A:".",9z:",",9y:"%"},uT:{9A:" ",9z:",",9y:"%"},"dG":"k1"};B.1s.1W=[];B.1s.2k={":1p":B.1s.1z,":3e":B.1s.1z};B.1s.2d=G(){u 2w=D.1r+".";u k,v,o;R(k in D.5V){o=D.5V[k];if(H(o)=="3n"){o.U=G(){F D.1r};o.1r=2w+"5V."+k}}R(k in D){o=D[k];if(H(o)=="G"&&H(o.1r)=="L"){1f{o.1r=2w+k}1e(e){}}}};B.1s.2d();if(H(B.J)!="L"){B.J.2Y(D,B.1s)}N{(G(k0,dF){if((H(1x)=="L"&&H(1q)=="L")||(H(B.3d)=="5L"&&B.3d)){u 1p=dF.2k[":1p"];R(u i=0;i<1p.K;i++){k0[1p[i]]=dF[1p[i]]}}})(D,B.1s)}if(H(1q)!="L"){1q.2X("B.1k");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.J",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.1k 3F on B.J!"}if(H(B.1k)=="L"){B.1k={}}B.1k.1r="B.1k";B.1k.1Y="1.3.1";B.1k.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1k.1l=G(){F D.1K()};B.1k.2t=G(jZ){D.55=[];D.id=D.7n();D.2H=-1;D.54=0;D.53=[O,O];D.7m=jZ;D.7l=1m;D.7r=1m};B.1k.2t.1U={U:G(){u 7s;if(D.2H==-1){7s="uS"}N{if(D.2H===0){7s="uR"}N{7s="dE"}}F"2t("+D.id+", "+7s+")"},1l:B.J.24("U"),7n:B.J.4f(),jY:G(){u I=B.1k;if(D.2H==-1){if(D.7m){D.7m(D)}N{D.7l=1h}if(D.2H==-1){D.52(Y I.di(D))}}N{if((D.2H===0)&&(D.53[0]2C I.2t)){D.53[0].jY()}}},jQ:G(){D.54++},jX:G(){D.54--;if((D.54===0)&&(D.2H>=0)){D.9u()}},jR:G(X){D.9x(X);D.jX()},9x:G(X){D.2H=((X 2C 2x)?1:0);D.53[D.2H]=X;D.9u()},dD:G(){if(D.2H!=-1){if(!D.7l){14 Y B.1k.dj(D)}D.7l=1m;F}},3o:G(X){D.dD();if(X 2C B.1k.2t){14 Y 2x("2t jW 9v aB be 7r if jV jU jT jS of a 3o")}D.9x(X)},52:G(X){D.dD();u I=B.1k;if(X 2C I.2t){14 Y 2x("2t jW 9v aB be 7r if jV jU jT jS of a 3o")}if(!(X 2C 2x)){X=Y I.9p(X)}D.9x(X)},jP:G(fn){if(M.K>1){fn=B.J.2z.1w(O,M)}F D.9w(fn,fn)},5Q:G(fn){if(M.K>1){fn=B.J.2z.1w(O,M)}F D.9w(fn,O)},jA:G(fn){if(M.K>1){fn=B.J.2z.1w(O,M)}F D.9w(O,fn)},9w:G(cb,eb){if(D.7r){14 Y 2x("uQ uP 9v 2E be re-uO")}D.55.1c([cb,eb]);if(D.2H>=0){D.9u()}F D},9u:G(){u dC=D.55;u 56=D.2H;u X=D.53[56];u I=D;u cb=O;1M(dC.K>0&&D.54===0){u 2n=dC.2P();u f=2n[56];if(f===O){2V}1f{X=f(X);56=((X 2C 2x)?1:0);if(X 2C B.1k.2t){cb=G(X){I.jR(X)};D.jQ()}}1e(3O){56=1;if(!(3O 2C 2x)){3O=Y B.1k.9p(3O)}X=3O}}D.2H=56;D.53[56]=X;if(cb&&D.54){X.jP(cb);X.7r=1h}}};B.J.2l(B.1k,{dk:G(){F dB("("+M[0].jN+")")},dp:G(uN){u d=Y B.1k.2t();d.3o.1w(d,M);F d},9q:G(uM){u d=Y B.1k.2t();d.52.1w(d,M);F d},do:G(){u I=M.2U;if(!I.7q){u dy=[G(){F Y 7q()},G(){F Y dA("jO.dz")},G(){F Y dA("uL.dz")},G(){F Y dA("jO.dz.4.0")},G(){14 Y B.1k.dh("uK uJ 2E uI 7q")}];R(u i=0;i<dy.K;i++){u 1A=dy[i];1f{I.7q=1A;F 1A()}1e(e){}}}F I.7q()},dx:G(){},jK:G(d){if(D.uH==4){1f{D.5T=O}1e(e){1f{D.5T=B.1k.dx}1e(e){}}u 5U=O;1f{5U=D.jm;if(!5U&&B.J.7e(D.jN)){5U=jM}}1e(e){}if(5U==hQ||5U==jM){d.3o(D)}N{u 3O=Y B.1k.dg(D,"uG uF");if(3O.2y){d.52(3O)}N{d.52(3O)}}}},jL:G(2s){1f{2s.5T=O}1e(e){1f{2s.5T=B.1k.dx}1e(e){}}2s.uE()},dl:G(2s,7p){if(H(7p)=="L"||7p===O){7p=""}u m=B.J;u I=B.1k;u d=Y I.2t(m.2z(I.jL,2s));1f{2s.5T=m.1O(I.jK,2s,d);2s.uD(7p)}1e(e){1f{2s.5T=O}1e(uC){}d.52(e)}F d},dn:G(5F){u I=B.1k;u 2s=I.do();if(M.K>1){u m=B.J;u qs=m.dw.1w(O,m.1R(O,M,1));if(qs){5F+="?"+qs}}2s.cp("uB",5F,1h);F I.dl(2s)},jv:G(5F){u I=B.1k;u d=I.dn.1w(I,M);d=d.5Q(I.dk);F d},dm:G(jJ,dv){u d=Y B.1k.2t();u m=B.J;if(H(dv)!="L"){d.5Q(G(){F dv})}u jI=uA(m.1O("3o",d),28.8B(jJ*c5));d.7m=G(){1f{uz(jI)}1e(e){}};F d},ju:G(jH,1A){u m=B.J;u jG=m.2z.1w(m,m.1R(O,M,1));F B.1k.dm(jH).5Q(G(X){F jG()})}});B.1k.5O=G(){D.5S=[];D.4e=1m;D.id=D.7n()};B.1k.5O.1U={bX:B.1k.5O,uy:G(){d=Y B.1k.2t();if(D.4e){D.5S.1c(d)}N{D.4e=1h;d.3o(D)}F d},jF:G(){if(!D.4e){14 3p("ux to jF an jE 5O")}D.4e=1m;if(D.5S.K>0){D.4e=1h;D.5S.2P().3o(D)}},7n:B.J.4f(),U:G(){u 9t;if(D.4e){9t="4e, "+D.5S.K+" 5S"}N{9t="jE"}F"5O("+D.id+", "+9t+")"},1l:B.J.24("U")};B.1k.7i=G(2G,du,jC,jB,jD){D.2G=2G;D.9r=Y 7o(D.2G.K);D.55=[];D.id=D.7n();D.2H=-1;D.54=0;D.53=[O,O];D.7m=jD;D.7l=1m;if(D.2G.K===0&&!du){D.3o(D.9r)}D.dr=0;D.jz=du;D.jy=jC;D.jx=jB;u 9s=0;B.J.2r(B.J.1O(G(d){d.5Q(B.J.1O(D.dt,D),9s,1h);d.jA(B.J.1O(D.dt,D),9s,1m);9s+=1},D),D.2G)};B.J.2l(B.1k.7i.1U,B.1k.2t.1U);B.J.2l(B.1k.7i.1U,{dt:G(ds,7k,5R){D.9r[ds]=[7k,5R];D.dr+=1;if(D.2H!==0){if(7k&&D.jz){D.3o([ds,5R])}N{if(!7k&&D.jy){D.52(5R)}N{if(D.dr==D.2G.K){D.3o(D.9r)}}}}if(!7k&&D.jx){5R=O}F 5R}});B.1k.jt=G(jw){u d=Y B.1k.7i(jw,1m,1h,1m);d.5Q(G(dq){u 7j=[];R(u i=0;i<dq.K;i++){7j.1c(dq[i][1])}F 7j});F d};B.1k.jr=G(1A){u I=B.1k;u 5P;1f{u r=1A.1w(O,B.J.1R([],M,1));if(r 2C I.2t){5P=r}N{if(r 2C 2x){5P=I.9q(r)}N{5P=I.dp(r)}}}1e(e){5P=I.9q(e)}F 5P};B.1k.1z=["dj","di","dh","9p","dg","2t","dp","9q","do","dn","jv","dm","ju","dl","5O","7i","jt","jr"];B.1k.1W=["dk"];B.1k.2d=G(){u m=B.J;u ne=m.2z(m.jq,D);ne("dj",G(jp){D.jo=jp});ne("di",G(jn){D.jo=jn});ne("dh",G(1t){D.43=1t});ne("9p",G(1t){D.43=1t});ne("dg",G(2s,1t){D.2s=2s;D.43=1t;1f{D.2y=2s.jm}1e(e){}});D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};B.1k.2d();B.J.2Y(D,B.1k);if(H(1q)!="L"){1q.2X("B.S");1q.2M("B.15")}if(H(1x)!="L"){1x.26("B.15",[])}1f{if(H(B.15)=="L"){14""}}1e(e){14"B.S 3F on B.15!"}if(H(B.S)=="L"){B.S={}}B.S.1r="B.S";B.S.1Y="1.3.1";B.S.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.S.1l=G(){F D.1K()};B.S.1z=["d5","cr","b9","95","94","j3","9k","cX","cw","iT","iV","4X","9j","iQ","hS","cs","ia","i9","i8","i7","i6","i5","i4","hV","i3","i2","i1","cu","hW","ct","i0","hZ","hY","hX","P","io","il","ik","ij","cm","ih","ii","ig","ie","ic","cv","8d","A","6m","ib","1E","$","4q","aH","cO","cN","iM","5G","iK","9d","9e","iH","iD","9c","iB","cG","97","hU","hT","iw","jh","jb","j6","j5","jk","jl"];B.S.1W=["9b"];B.S.5N=G(w,h){D.w=w;D.h=h};B.S.5N.1U.U=G(){u U=B.J.U;F"{w: "+U(D.w)+", h: "+U(D.h)+"}"};B.S.5t=G(x,y){D.x=x;D.y=y};B.S.5t.1U.U=G(){u U=B.J.U;F"{x: "+U(D.x)+", y: "+U(D.y)+"}"};B.S.5t.1U.1l=G(){F D.U()};B.J.2l(B.S,{jl:G(Q,o){Q=B.S.1E(Q);B.S.4X(Q,{"1T":{"9o":o,"-hL-9o":o,"-uw-9o":o,"47":" uv(9o="+(o*3k)+")"}})},jk:G(){u d=Y B.S.5N();u w=B.S.3X;u b=B.S.1Z.5s;if(w.jj){d.w=w.jj;d.h=w.uu}N{if(b.dd.9n){d.w=b.dd.9n;d.h=b.dd.ji}N{if(b&&b.9n){d.w=b.9n;d.h=b.ji}}}F d},jh:G(Q){u I=B.S;if(H(Q.w)=="2y"||H(Q.h)=="2y"){F Y I.5N(Q.w||0,Q.h||0)}Q=I.1E(Q);if(!Q){F L}if(I.4q(Q,"3u")!="98"){F Y I.5N(Q.jg||0,Q.ci||0)}u s=Q.1T;u je=s.dc;u jf=s.6P;s.dc="fR";s.6P="j8";s.3u="";u jd=Q.jg;u jc=Q.ci;s.3u="98";s.6P=jf;s.dc=je;F Y I.5N(jd,jc)},jb:G(Q,4Z){u I=B.S;Q=I.1E(Q);if(!Q){F L}u c=Y I.5t(0,0);if(Q.x&&Q.y){c.x+=Q.x||0;c.y+=Q.y||0;F c}N{if(Q.3t===O||I.4q(Q,"3u")=="98"){F L}}u 51=O;u 2j=O;u d=B.S.1Z;u de=d.7Z;u b=d.5s;if(Q.ja){51=Q.ja();c.x+=51.2I+(de.6y||b.6y)-(de.8q||b.8q);c.y+=51.3D+(de.4C||b.4C)-(de.8p||b.8p)}N{if(d.j9){51=d.j9(Q);c.x+=51.x;c.y+=51.y}N{if(Q.8g){c.x+=Q.db;c.y+=Q.da;2j=Q.8g;if(2j!=Q){1M(2j){c.x+=2j.db;c.y+=2j.da;2j=2j.8g}}u ua=ut.us.8G();if((H(7h)!="L"&&4M(7h.ur())<9)||(ua.2A("uq")!=-1&&I.4q(Q,"6P")=="j8")){c.x-=b.db;c.y-=b.da}}}}if(H(4Z)!="L"){4Z=M.2U(4Z);if(4Z){c.x-=(4Z.x||0);c.y-=(4Z.y||0)}}if(Q.3t){2j=Q.3t}N{2j=O}1M(2j&&2j.j7!="uo"&&2j.j7!="co"){c.x-=2j.6y;c.y-=2j.4C;if(2j.3t){2j=2j.3t}N{2j=O}}F c},j6:G(Q,d9,7g){Q=B.S.1E(Q);if(H(7g)=="L"){7g="px"}B.S.4X(Q,{"1T":{"5A":d9.w+7g,"3V":d9.h+7g}})},j5:G(Q,d8,7f){Q=B.S.1E(Q);if(H(7f)=="L"){7f="px"}B.S.4X(Q,{"1T":{"2I":d8.x+7f,"3D":d8.y+7f}})},cr:G(){F B.S.3X},b9:G(){F B.S.1Z},95:G(2m,1A){u I=B.S;u d6=I.1Z;u d7=I.un;u W;1f{I.3X=2m;I.1Z=2m.2v;W=1A()}1e(e){I.3X=d7;I.1Z=d6;14 e}I.3X=d7;I.1Z=d6;F W},d5:G(Q){u 7d=[];u 7c=[];u m=B.J;u I=B.S;if(H(Q)=="L"||Q===O){Q=I.1Z}N{Q=I.1E(Q)}m.d4(Q,G(Q){u 1b=Q.1b;if(m.7e(1b)){u 4Y=Q.cD;if(4Y=="cv"&&(Q.1J=="um"||Q.1J=="uk")&&!Q.ip){F O}if(4Y=="ct"){if(Q.j4>=0){u 9m=Q.1S[Q.j4];7d.1c(1b);7c.1c((9m.3m)?9m.3m:9m.7X);F O}7d.1c(1b);7c.1c("");F O}if(4Y=="cu"||4Y=="P"||4Y=="8d"||4Y=="6m"){F Q.5h}7d.1c(1b);7c.1c(Q.3m||"");F O}F Q.5h});F[7d,7c]},94:G(1N,1A){u I=B.S;u d3=I.1Z;u W;1f{I.1Z=1N;W=1A()}1e(e){I.1Z=d3;14 e}I.1Z=d3;F W},j3:G(1b,j2,3y,j1){B.S.9b.5M(1b,j2,3y,j1)},9k:G(1j,7a){u im=B.15;u I=B.S;u 1Q=im.1Q;u iY=im.7b;u 4c=im.4c;u iX=I.9b;u iZ=I.9k;u iW=B.J.4d;1M(1h){if(H(1j)=="L"||1j===O){F O}if(H(1j.3T)!="L"&&1j.3T>0){F 1j}if(H(1j)=="2y"||H(1j)=="5L"){1j=1j.1l()}if(H(1j)=="1n"){F I.1Z.4S(1j)}if(H(1j.j0)=="G"){1j=1j.j0(7a);2V}if(H(1j)=="G"){1j=1j(7a);2V}u 9l=O;1f{9l=1Q(1j)}1e(e){}if(9l){F 4c(iZ,9l,iY(7a))}1f{1j=iX.3C(1j,7a);2V}1e(e){if(e!=iW){14 e}}F I.1Z.4S(1j.1l())}F L},iV:G(1j,79,iU){u o={};o[79]=iU;1f{F B.S.4X(1j,o)}1e(e){}F O},iT:G(1j,79){u I=B.S;u d2=I.4U.99[79];1j=I.1E(1j);1f{if(d2){F 1j[d2]}F 1j.fm(79)}1e(e){}F O},4X:G(1j,5K){u Q=1j;u I=B.S;if(H(1j)=="1n"){Q=I.1E(1j)}if(5K){u d0=B.J.8Z;if(I.4U.6X){R(u k in 5K){u v=5K[k];if(H(v)=="3n"&&H(Q[k])=="3n"){d0(Q[k],v)}N{if(k.2W(0,2)=="on"){if(H(v)=="1n"){v=Y cZ(v)}Q[k]=v}N{Q.4p(k,v)}}}}N{u iS=I.4U.99;R(k in 5K){v=5K[k];u d1=iS[k];if(k=="1T"&&H(v)=="1n"){Q.1T.3x=v}N{if(H(d1)=="1n"){Q[d1]=v}N{if(H(Q[k])=="3n"&&H(v)=="3n"){d0(Q[k],v)}N{if(k.2W(0,2)=="on"){if(H(v)=="1n"){v=Y cZ(v)}Q[k]=v}N{Q.4p(k,v)}}}}}}}F Q},9j:G(1j){u Q=1j;u I=B.S;if(H(1j)=="1n"){Q=I.1E(1j)}u 78=[I.9k(B.J.1R(O,M,1),Q)];u iR=B.J.2o;1M(78.K){u n=78.2P();if(H(n)=="L"||n===O){}N{if(H(n.3T)=="2y"){Q.2c(n)}N{78=iR(n,78)}}}F Q},iQ:G(1j){u Q=1j;u I=B.S;if(H(1j)=="1n"){Q=I.1E(1j);M[0]=Q}u cY;1M((cY=Q.6n)){Q.6S(cY)}if(M.K<2){F Q}N{F I.9j.1w(D,M)}},cX:G(1b,4b){u Q;u I=B.S;u m=B.J;if(H(4b)=="1n"||H(4b)=="2y"){u 3G=m.1R([1b,O],M,1);F M.2U.1w(D,3G)}if(H(1b)=="1n"){if(4b&&"1b"in 4b&&!I.4U.6X){1b=("<"+1b+" 1b=\\""+I.9c(4b.1b)+"\\">")}Q=I.1Z.2S(1b)}N{Q=1b}if(4b){I.4X(Q,4b)}if(M.K<=2){F Q}N{u 3G=m.1R([Q],M,2);F I.9j.1w(D,3G)}},cw:G(){u m=B.J;F m.2z.1w(D,m.1R([B.S.cX],M))},cs:G(5J,1d){u I=B.S;5J=I.1E(5J);u cW=5J.3t;if(1d){1d=I.1E(1d);cW.uj(1d,5J)}N{cW.6S(5J)}F 1d},1E:G(id){u I=B.S;if(M.K==1){F((H(id)=="1n")?I.1Z.hN(id):id)}N{F B.J.2r(I.1E,M)}},4q:G(iP,cV,cU){if(M.K==2){cU=cV}u I=B.S;u el=I.1E(iP);u 77=I.1Z;if(!el||el==77){F L}if(el.iO){F el.iO[cV]}if(H(77.5k)=="L"){F L}if(77.5k===O){F L}u 9i=77.5k.g4(el,O);if(H(9i)=="L"||9i===O){F L}F 9i.6q(cU)},aH:G(76,9g,4W){u I=B.S;if(H(76)=="L"||76===O){76="*"}if(H(4W)=="L"||4W===O){4W=I.1Z}4W=I.1E(4W);u 9h=(4W.fr(76)||I.1Z.1p);if(H(9g)=="L"||9g===O){F B.J.1R(O,9h)}u cR=[];R(u i=0;i<9h.K;i++){u cS=9h[i];u cT=cS.3M.2R(" ");R(u j=0;j<cT.K;j++){if(cT[j]==9g){cR.1c(cS);2K}}}F cR},iN:G(5I,9f){u W=G(){u cQ=M.2U.5H;R(u i=0;i<cQ.K;i++){if(cQ[i].1w(D,M)===1m){2K}}if(9f){1f{D[5I]=O}1e(e){}}};W.5H=[];F W},cO:G(cP,5I,1A,9f){u I=B.S;u 4V=cP[5I];u 75=4V;if(!(H(4V)=="G"&&H(4V.5H)=="3n"&&4V.5H!==O)){75=I.iN(5I,9f);if(H(4V)=="G"){75.5H.1c(4V)}cP[5I]=75}75.5H.1c(1A)},cN:G(1A){u I=B.S;I.cO(I.3X,"gh",1A,1h)},iM:G(74){u I=B.S;I.cN(G(){74=I.1E(74);if(74){74.ui()}})},5G:G(iL,cM){u I=B.S;u 1i=I.1E(iL);if(I.4U.6X){1i.4p("iq",cM)}N{1i.4p("3M",cM)}},iK:G(cL){u I=B.S;R(u i=1;i<M.K;i++){u 1i=I.1E(M[i]);if(!I.9d(1i,cL)){I.9e(1i,cL)}}},9d:G(iJ,73){u I=B.S;u 1i=I.1E(iJ);u 2F=1i.3M;if(2F.K===0){I.5G(1i,73);F 1h}if(2F==73){F 1m}u cK=1i.3M.2R(" ");R(u i=0;i<cK.K;i++){if(cK[i]==73){F 1m}}I.5G(1i,2F+" "+73);F 1h},9e:G(iI,cJ){u I=B.S;u 1i=I.1E(iI);u 2F=1i.3M;if(2F.K===0){F 1m}if(2F==cJ){I.5G(1i,"");F 1h}u 72=1i.3M.2R(" ");R(u i=0;i<72.K;i++){if(72[i]==cJ){72.4y(i,1);I.5G(1i,72.2b(" "));F 1h}}F 1m},iH:G(iG,iF,iE){u 1i=B.S.1E(iG);u X=B.S.9e(1i,iF);if(X){B.S.9d(1i,iE)}F X},iD:G(iC,uh){u 1i=B.S.1E(iC);u cI=1i.3M.2R(" ");R(u i=1;i<M.K;i++){u cH=1m;R(u j=0;j<cI.K;j++){if(cI[j]==M[i]){cH=1h;2K}}if(!cH){F 1m}}F 1h},9c:G(s){F s.23(/&/g,"&ug;").23(/"/g,"&uf;").23(/</g,"&lt;").23(/>/g,"&gt;")},iB:G(2q){F B.S.cG(2q).2b("")},cG:G(2q,1g){if(H(1g)=="L"||1g===O){1g=[]}u 70=[2q];u I=B.S;u cB=I.9c;u iA=I.4U;1M(70.K){2q=70.hP();if(H(2q)=="1n"){1g.1c(2q)}N{if(2q.3T==1){1g.1c("<"+2q.cD.8G());u 71=[];u cF=iA(2q);R(u i=0;i<cF.K;i++){u a=cF[i];71.1c([" ",a.1b,"=\\"",cB(a.3m),"\\""])}71.iz();R(i=0;i<71.K;i++){u cE=71[i];R(u j=0;j<cE.K;j++){1g.1c(cE[j])}}if(2q.ue()){1g.1c(">");70.1c("</"+2q.cD.8G()+">");u cC=2q.5h;R(i=cC.K-1;i>=0;i--){70.1c(cC[i])}}N{1g.1c("/>")}}N{if(2q.3T==3){1g.1c(cB(2q.iv))}}}}F 1g},97:G(ix,cA){u m=B.J;u iy=m.1R(O,M,1);B.15.9a(m.47(O,m.2r(B.S.1E,iy)),G(cA){cA.1T.3u=ix})},iw:G(1j,iu){u W=[];(G(1j){u cn=1j.5h;if(cn){R(u i=0;i<cn.K;i++){M.2U.cz(D,cn[i])}}u cy=1j.iv;if(H(cy)=="1n"){W.1c(cy)}})(B.S.1E(1j));if(iu){F W}N{F W.2b("")}},2d:G(2m){u m=B.J;D.1Z=2v;D.3X=2m;D.9b=Y m.4a();u 6Z=D.1Z.2S("cj");u 2T;if(6Z&&6Z.6Y&&6Z.6Y.K>0){u it=m.47;2T=G(1j){F it(2T.ir,1j.6Y)};2T.cx={};B.15.9a(6Z.6Y,G(a){2T.cx[a.1b]=a.3m});2T.ir=G(a){F(2T.cx[a.1b]!=a.3m)};2T.6X=1m;2T.99={"iq":"3M","ip":"ud","uc":"ub","R":"u9"}}N{2T=G(1j){F 1j.6Y};2T.6X=1h;2T.99={}}D.4U=2T;u 1C=D.cw;D.io=1C("ul");D.il=1C("ol");D.ik=1C("li");D.ij=1C("td");D.cm=1C("tr");D.ii=1C("u8");D.ih=1C("u7");D.ig=1C("u6");D.ie=1C("u5");D.ic=1C("th");D.cv=1C("ck");D.8d=1C("cj");D.A=1C("a");D.6m=1C("4u");D.ib=1C("u4");D.ia=1C("2e");D.i9=1C("tt");D.i8=1C("4O");D.i7=1C("h1");D.i6=1C("h2");D.i5=1C("h3");D.i4=1C("br");D.i3=1C("hr");D.i2=1C("u3");D.i1=1C("u2");D.cu=1C("u1");D.P=1C("p");D.ct=1C("u0");D.i0=1C("hJ");D.hZ=1C("tZ");D.hY=1C("tY");D.hX=1C("tX");D.hW=1C("tW");D.hV=1C("tV");D.hU=m.2z(D.97,"98");D.hT=m.2z(D.97,"8c");D.hS=D.cs;D.$=D.1E;D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)}});B.S.2d(((H(2O)=="L")?D:2O));if(!B.3d){95=B.S.95;94=B.S.94}B.J.2Y(D,B.S);if(H(1q)!="L"){1q.2X("B.1I");1q.2M("B.1H");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.1H",[]);1x.26("B.J",[])}1f{if(H(B.J)=="L"||H(B.1H)=="L"){14""}}1e(e){14"B.1I 3F on B.J 3W B.1H!"}if(H(B.1I)=="L"){B.1I={}}B.1I.1r="B.1I";B.1I.1Y="1.3.1";B.1I.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1I.1l=G(){F D.1K()};B.1I.bY=G(6W){u m=B.1I;6W=!(!6W);if(m.3l&&m.3l.8Q!=6W){m.3l.hA();m.3l=O}if(!m.3l||m.3l.8P){m.3l=Y m.1I(6W,B.1H.2L)}F m.3l};B.1I.1I=G(4R,6V){if(H(6V)=="L"||6V===O){6V=B.1H.2L}D.2L=6V;u tU=B.J.2l;u c3=B.J.8Z;u 1O=B.J.1O;u hM=B.J.4L;u 2m=2O;u 6U="tT";if(H(B.S)!="L"){2m=B.S.cr()}if(!4R){u 5F=2m.tS.tR.2R("?")[0].23(/[:\\/.><&]/g,"hR");u 1b=6U+"hR"+5F;u 5D=2m.cp("",1b,"tQ,tP,3V=hQ");if(!5D){cq("tO tN to cp tM 2O tL to hP-up tK.");F L}5D.2v.fl("<!tJ co tI \\"-//tH//tG co 4.0 tF//tE\\" "+"\\"fq://fp.tD.fo/cm/tC/tB.tA\\">"+"<hO><5E><8Y>[B.1I]</8Y></5E>"+"<5s></5s></hO>");5D.2v.hG();5D.2v.8Y+=" "+2m.2v.8Y;2m=5D}u 1N=2m.2v;D.1N=1N;u 21=1N.hN(6U);u c4=!!21;if(21&&H(21.5B)!="L"){21.5B.2L=D.2L;21.5B.6K();F 21.5B}if(c4){u cl;1M((cl=21.6n)){21.6S(cl)}}N{21=1N.2S("4u");21.id=6U}21.5B=D;u 8T=1N.2S("ck");u 8S=1N.2S("ck");u 6O=1N.2S("2e");u 6N=1N.2S("2e");u 6M=1N.2S("2e");u 6L=1N.2S("2e");u 3L=1N.2S("4u");u 42=1N.2S("4u");u 8U=6U+"tz";D.8N=hM(D.8N);u 4T=[];u 6R=O;u cf=G(1t){u 6T=1t.3N;if(H(6T)=="2y"){6T=B.1H.5C[6T]}F 6T};u cd=G(1t){F 1t.3z.2b(" ")};u ca=1O(G(1t){u 8W=cf(1t);u 7X=cd(1t);u c=D.8N[8W];u p=1N.2S("cj");p.3M="B-49 B-5C-"+8W;p.1T.3x="ty: 2N; 4F-8X: -hL-4O-3y; 4F-8X: -o-4O-3y; 4F-8X: 4O-3y; 4F-8X: 4O-tx; hK-3y: 2K-hK; 3y-hJ: tw; 3U: "+c;p.2c(1N.4S(8W+": "+7X));42.2c(p);42.2c(1N.2S("br"));if(3L.ci>3L.hI){3L.4C=0}N{3L.4C=3L.hI}},D);u hD=G(1t){4T[4T.K]=1t;ca(1t)};u hF=G(){u cg,ce;1f{cg=Y 8V(8T.3m);ce=Y 8V(8S.3m)}1e(e){ch("2x in 47 tv: "+e.43);F O}F G(1t){F(cg.hH(cf(1t))&&ce.hH(cd(1t)))}};u cc=G(){1M(42.6n){42.6S(42.6n)}};u hB=G(){4T=[];cc()};u bZ=1O(G(){if(D.8P){F}D.8P=1h;if(B.1I.3l==D){B.1I.3l=O}D.2L.c9(8U);21.5B=O;if(4R){21.3t.6S(21)}N{D.2m.hG()}},D);u c7=G(){cc();R(u i=0;i<4T.K;i++){u 1t=4T[i];if(6R===O||6R(1t)){ca(1t)}}};D.6K=G(){6R=hF();c7();D.2L.c9(8U);D.2L.hE(8U,6R,hD)};u c0=1O(G(){4T=D.2L.c8();c7()},D);u c2=1O(G(6Q){6Q=6Q||2O.6D;2h=6Q.6w||6Q.8t;if(2h==13){D.6K()}},D);u 31="3u: 8c; z-c6: c5; 2I: 2N; 6f: 2N; 6P: tu; 5A: 3k%; he-3U: 4F; c1: "+D.8O;if(4R){31+="; 3V: ts; 3E-3D: fO 8a 8y"}N{31+="; 3V: 3k%;"}21.1T.3x=31;if(!c4){1N.5s.2c(21)}31={"3x":"5A: 33%; 3u: 8Q; c1: "+D.8O};c3(8T,{"3m":"8L|8M|8K|8J|8I","hC":c2,"1T":31});21.2c(8T);c3(8S,{"3m":".*","hC":c2,"1T":31});21.2c(8S);31="5A: 8%; 3u:8Q; c1: "+D.8O;6O.2c(1N.4S("tq"));6O.8R=1O("6K",D);6O.1T.3x=31;21.2c(6O);6N.2c(1N.4S("tp"));6N.8R=c0;6N.1T.3x=31;21.2c(6N);6M.2c(1N.4S("tn"));6M.8R=hB;6M.1T.3x=31;21.2c(6M);6L.2c(1N.4S("tm"));6L.8R=bZ;6L.1T.3x=31;21.2c(6L);3L.1T.3x="fS: tk; 5A: 3k%";42.1T.3x="5A: 3k%; 3V: "+(4R?"tj":"3k%");3L.2c(42);21.2c(3L);D.6K();c0();if(4R){D.2m=L}N{D.2m=2m}D.8Q=4R;D.hA=bZ;D.8P=1m;F D};B.1I.1I.1U={"8O":"ti tg,tf-te","8N":{"8M":"1v","8L":"gU","8K":"1F","8J":"8y","8I":"bx"}};B.1I.1W=["1I"];B.1I.1z=["bY"];B.1I.2d=G(){D.2k={":3e":D.1z,":1p":B.J.2o(D.1z,D.1W)};B.J.3f(D);B.1I.3l=O};B.1I.2d();B.J.2Y(D,B.1I);if(H(1q)!="L"){1q.2X("B.V");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.J",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.V 3F on B.J"}if(H(B.V)=="L"){B.V={}}B.V.1r="B.V";B.V.1Y="1.3.1";B.V.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.V.1l=G(){F D.1K()};B.V.V=G(1v,hz,1F,6J){if(H(6J)=="L"||6J===O){6J=1}D.1B={r:1v,g:hz,b:1F,a:6J}};B.V.V.1U={bX:B.V.V,tc:G(hy){u 1B=D.1B;u m=B.V;F m.V.3Y(1B.r,1B.g,1B.b,hy)},tb:G(1o){u 1G=D.41();1G.h=1o;u m=B.V;F m.V.4H(1G)},ta:G(hx){u 1G=D.41();1G.s=hx;u m=B.V;F m.V.4H(1G)},t9:G(hw){u 1G=D.41();1G.l=hw;u m=B.V;F m.V.4H(1G)},t8:G(hv){u 1G=D.41();1G.l=28.29(1G.l-hv,0);u m=B.V;F m.V.4H(1G)},t7:G(hu){u 1G=D.41();1G.l=28.2a(1G.l+hu,1);u m=B.V;F m.V.4H(1G)},fJ:G(ht,5z){if(H(5z)=="L"||5z===O){5z=0.5}u sf=1-5z;u s=D.1B;u d=ht.1B;u df=5z;F B.V.V.3Y((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df))},h4:G(hs){u a=D.6r();u b=hs.6r();F B.J.2f([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a])},hq:G(){F D.41().b>0.5},t6:G(){F(!D.hq())},t5:G(){u c=D.41();u 2Z=B.V.6F;u W=D.ho;if(!W){u 5y=(2Z(c.h,bF).6I(0)+","+2Z(c.s,3k).hp(4)+"%"+","+2Z(c.l,3k).hp(4)+"%");u a=c.a;if(a>=1){a=1;W="1G("+5y+")"}N{if(a<=0){a=0}W="t4("+5y+","+a+")"}D.ho=W}F W},hl:G(){u c=D.1B;u 2Z=B.V.6F;u W=D.hn;if(!W){u 5y=(2Z(c.r,3h).6I(0)+","+2Z(c.g,3h).6I(0)+","+2Z(c.b,3h).6I(0));if(c.a!=1){W="t3("+5y+","+c.a+")"}N{W="1B("+5y+")"}D.hn=W}F W},6r:G(){F B.J.4L(D.1B)},t2:G(){u m=B.V;u c=D.1B;u 2Z=B.V.6F;u W=D.hm;if(!W){W=("#"+m.6E(2Z(c.r,3h))+m.6E(2Z(c.g,3h))+m.6E(2Z(c.b,3h)));D.hm=W}F W},t1:G(){u 2Q=D.2Q;u c=D.1B;if(H(2Q)=="L"||2Q===O){2Q=B.V.bA(D.1B);D.2Q=2Q}F B.J.4L(2Q)},41:G(){u 1G=D.1G;u c=D.1B;if(H(1G)=="L"||1G===O){1G=B.V.bC(D.1B);D.1G=1G}F B.J.4L(1G)},1l:G(){F D.hl()},U:G(){u c=D.1B;u hk=[c.r,c.g,c.b,c.a];F D.bX.1r+"("+hk.2b(", ")+")"}};B.J.2l(B.V.V,{3Y:G(1v,bW,1F,8H){u hj=B.V.V;if(M.K==1){u 1B=1v;1v=1B.r;bW=1B.g;1F=1B.b;if(H(1B.a)=="L"){8H=L}N{8H=1B.a}}F Y hj(1v,bW,1F,8H)},4H:G(1o,t0,sZ,sY){u m=B.V;F m.V.3Y(m.bB.1w(m,M))},sX:G(1o,sW,sV,sU){u m=B.V;F m.V.3Y(m.bz.1w(m,M))},hi:G(1b){u 8F=B.V.V;if(1b.3Z(0)=="\\""){1b=1b.3H(1,1b.K-2)}u bV=8F.by[1b.8G()];if(H(bV)=="1n"){F 8F.bT(bV)}N{if(1b=="aP"){F 8F.sT()}}F O},8f:G(4Q){u I=B.V.V;u bU=4Q.3H(0,3);if(bU=="1B"){F I.h9(4Q)}N{if(bU=="1G"){F I.h8(4Q)}N{if(4Q.3Z(0)=="#"){F I.bT(4Q)}}}F I.hi(4Q)},bT:G(4P){if(4P.3Z(0)=="#"){4P=4P.2W(1)}u 8E=[];u i,5x;if(4P.K==3){R(i=0;i<3;i++){5x=4P.3H(i,1);8E.1c(3w(5x+5x,16)/3h)}}N{R(i=0;i<6;i+=2){5x=4P.3H(i,2);8E.1c(3w(5x,16)/3h)}}u bS=B.V.V;F bS.3Y.1w(bS,8E)},bG:G(4O,hf,hg,4N){if(4N.2A(4O)===0){4N=4N.2W(4N.2A("(",3)+1,4N.K-1)}u bR=4N.2R(/\\s*,\\s*/);u bP=[];R(u i=0;i<bR.K;i++){u c=bR[i];u 2i;u bQ=c.2W(c.K-3);if(c.3Z(c.K-1)=="%"){2i=0.bE*4M(c.2W(0,c.K-1))}N{if(bQ=="sS"){2i=4M(c)/bF}N{if(bQ=="sR"){2i=4M(c)/(28.sQ*2)}N{2i=hg[i]*4M(c)}}}bP.1c(2i)}F D[hf].1w(D,bP)},bN:G(Q,sP,sO){u d=B.S;u 2F=B.V.V;R(Q=d.1E(Q);Q;Q=Q.3t){u bO=d.4q.1w(d,M);if(!bO){2V}u 8D=2F.8f(bO);if(!8D){2K}if(8D.6r().a>0){F 8D}}F O},ba:G(Q){u 2F=B.V.V;F 2F.bN(Q,"aZ","he-3U")||2F.sN()},sM:G(Q){u 2F=B.V.V;F 2F.bN(Q,"3U","3U")||2F.sL()},sK:G(){F B.J.4L(B.V.V.by)}});B.J.2l(B.V,{6F:G(v,8C){v*=8C;if(v<0){F 0}N{if(v>8C){F 8C}N{F v}}},hc:G(n1,n2,1o){if(1o>6){1o-=6}N{if(1o<0){1o+=6}}u 2i;if(1o<1){2i=n1+(n2-n1)*1o}N{if(1o<3){2i=n2}N{if(1o<4){2i=n1+(n2-n1)*(4-1o)}N{2i=n1}}}F 2i},bz:G(1o,5w,3i,bM){if(M.K==1){u 2Q=1o;1o=2Q.h;5w=2Q.s;3i=2Q.v;bM=2Q.a}u 1v;u 3K;u 1F;if(5w===0){1v=0;3K=0;1F=0}N{u i=28.8B(1o*6);u f=(1o*6)-i;u p=3i*(1-5w);u q=3i*(1-(5w*f));u t=3i*(1-(5w*(1-f)));hd(i){3j 1:1v=q;3K=3i;1F=p;2K;3j 2:1v=p;3K=3i;1F=t;2K;3j 3:1v=p;3K=q;1F=3i;2K;3j 4:1v=t;3K=p;1F=3i;2K;3j 5:1v=3i;3K=p;1F=q;2K;3j 6:3j 0:1v=3i;3K=t;1F=p;2K}}F{r:1v,g:3K,b:1F,a:bM}},bB:G(1o,5v,3v,bL){if(M.K==1){u 1G=1o;1o=1G.h;5v=1G.s;3v=1G.l;bL=1G.a}u 1v;u 8A;u 1F;if(5v===0){1v=3v;8A=3v;1F=3v}N{u m2;if(3v<=0.5){m2=3v*(1+5v)}N{m2=3v+5v-(3v*5v)}u m1=(2*3v)-m2;u f=B.V.hc;u h6=1o*6;1v=f(m1,m2,h6+2);8A=f(m1,m2,h6);1F=f(m1,m2,h6-2)}F{r:1v,g:8A,b:1F,a:bL}},bA:G(1v,4K,1F,bK){if(M.K==1){u 1B=1v;1v=1B.r;4K=1B.g;1F=1B.b;bK=1B.a}u 29=28.29(28.29(1v,4K),1F);u 2a=28.2a(28.2a(1v,4K),1F);u 1o;u 8z;u hb=29;if(2a==29){1o=0;8z=0}N{u 6H=(29-2a);8z=6H/29;if(1v==29){1o=(4K-1F)/6H}N{if(4K==29){1o=2+((1F-1v)/6H)}N{1o=4+((1v-4K)/6H)}}1o/=6;if(1o<0){1o+=1}if(1o>1){1o-=1}}F{h:1o,s:8z,v:hb,a:bK}},bC:G(1v,4J,1F,bI){if(M.K==1){u 1B=1v;1v=1B.r;4J=1B.g;1F=1B.b;bI=1B.a}u 29=28.29(1v,28.29(4J,1F));u 2a=28.2a(1v,28.2a(4J,1F));u 1o;u 6G;u bJ=(29+2a)/2;u 4I=29-2a;if(4I===0){1o=0;6G=0}N{if(bJ<=0.5){6G=4I/(29+2a)}N{6G=4I/(2-29-2a)}if(1v==29){1o=(4J-1F)/4I}N{if(4J==29){1o=2+((1F-1v)/4I)}N{1o=4+((1v-4J)/4I)}}1o/=6;if(1o<0){1o+=1}if(1o>1){1o-=1}}F{h:1o,s:6G,l:bJ,a:bI}},6E:G(1P){1P=28.ha(1P);u bH=1P.1l(16);if(1P<16){F"0"+bH}F bH},2d:G(){u m=B.J;D.V.h9=m.1O(D.V.bG,D.V,"1B","3Y",[1/3h,1/3h,1/3h,1]);D.V.h8=m.1O(D.V.bG,D.V,"1G","4H",[1/bF,0.bE,0.bE,1]);u 4G=1/3;u bD={8y:[0,0,0],1F:[0,0,1],gY:[0.6,0.4,0.2],gX:[0,1,1],sJ:[4G,4G,4G],gR:[0.5,0.5,0.5],bx:[0,1,0],sI:[2*4G,2*4G,2*4G],gN:[1,0,1],gL:[1,0.5,0],gK:[0.5,0,0.5],1v:[1,0,0],aP:[0,0,0,0],4F:[1,1,1],gI:[1,1,0]};u h7=G(1b,r,g,b,a){u W=D.3Y(r,g,b,a);D[1b]=G(){F W};F W};R(u k in bD){u 1b=k+"V";u h5=m.2o([h7,D.V,1b],bD[k]);D.V[1b]=m.1O.1w(O,h5)}u h0=G(){R(u i=0;i<M.K;i++){if(!(M[i]2C V)){F 1m}}F 1h};u gZ=G(a,b){F a.h4(b)};m.3f(D);m.5u(D.V.1r,h0,gZ);D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)}}});B.V.1z=["V"];B.V.1W=["6F","bC","bB","bA","bz","6E"];B.V.2d();B.J.2Y(D,B.V);B.V.V.by={sH:"#sG",sF:"#sE",sD:"#gW",sC:"#sB",sA:"#sz",sy:"#sx",sw:"#sv",8y:"#su",st:"#sr",1F:"#sq",sp:"#so",gY:"#sn",sm:"#sl",sk:"#sj",si:"#sh",sg:"#se",sd:"#sc",sb:"#sa",s9:"#s8",s7:"#s6",gX:"#gW",s5:"#s4",s3:"#s2",s1:"#s0",rZ:"#gV",rY:"#rX",rW:"#gV",rV:"#rU",rT:"#rS",rR:"#rQ",rP:"#rO",rN:"#rM",gU:"#rL",rK:"#rJ",rI:"#rH",rG:"#rF",rE:"#gT",rD:"#gT",rC:"#rB",rA:"#rz",ry:"#rx",rw:"#rv",ru:"#gS",rt:"#gS",rs:"#rr",rq:"#rp",ro:"#rn",rm:"#rl",rk:"#gM",rj:"#ri",rh:"#rg",rf:"#rd",rc:"#rb",gR:"#gQ",bx:"#ra",r9:"#r8",r7:"#gQ",r6:"#r5",r4:"#r3",r2:"#r1",r0:"#qZ",qY:"#qX",qW:"#qV",qU:"#qT",qS:"#qR",qQ:"#qP",qO:"#qN",qM:"#qL",qK:"#qJ",qI:"#qH",qG:"#qF",qE:"#gP",qD:"#qC",qB:"#gP",qA:"#qz",qy:"#qx",qw:"#qv",qu:"#qt",qr:"#gO",qq:"#gO",qp:"#qo",qn:"#qm",ql:"#qk",qj:"#qi",qh:"#qg",gN:"#gM",qf:"#qe",qd:"#qc",qb:"#qa",q9:"#q8",q7:"#q6",q5:"#q4",q3:"#q2",q1:"#q0",pZ:"#pY",pX:"#pW",pV:"#pU",pT:"#pS",pR:"#pQ",pP:"#pO",pN:"#pM",pL:"#pK",pJ:"#pI",pH:"#pG",pF:"#pE",gL:"#pD",pC:"#pB",pA:"#pz",py:"#pw",pv:"#pu",pt:"#ps",pr:"#pq",pp:"#po",pn:"#pm",pl:"#pj",pi:"#ph",pg:"#pf",pe:"#pd",gK:"#pc",1v:"#pb",pa:"#p9",p8:"#p7",p6:"#p5",p4:"#p3",p2:"#p1",p0:"#oZ",oY:"#oX",oW:"#oV",oU:"#oT",oS:"#oR",oQ:"#oP",oO:"#gJ",oN:"#gJ",oM:"#oL",oK:"#oJ",oI:"#oH",oG:"#oF",oE:"#oD",oC:"#oB",oA:"#oz",oy:"#ox",ow:"#ov",ou:"#ot",4F:"#os",oq:"#op",gI:"#oo",om:"#ok"};if(H(1q)!="L"){1q.2X("B.1u");1q.2M("B.J");1q.2M("B.S")}if(H(1x)!="L"){1x.26("B.J",[]);1x.26("B.S",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.1u 3F on B.J!"}1f{if(H(B.S)=="L"){14""}}1e(e){14"B.1u 3F on B.S!"}if(H(B.1u)=="L"){B.1u={}}B.1u.1r="B.1u";B.1u.1Y="1.3.1";B.1u.4x=[];B.1u.bq=G(1d,e){D.1L=e||2O.6D;D.gH=1d};B.J.2l(B.1u.bq.1U,{1K:G(){u U=B.J.U;u 1y="{6D(): "+U(D.6D())+", 1d(): "+U(D.1d())+", 1J(): "+U(D.1J())+", 8x(): "+U(D.8x())+", 4E(): "+"{8w: "+U(D.4E().8w)+", 8v: "+U(D.4E().8v)+", 8u: "+U(D.4E().8u)+", 2P: "+U(D.4E().2P)+", bw: "+U(D.4E().bw)+"}";if(D.1J()&&D.1J().2A("2h")===0){1y+=", 2h(): {3J: "+U(D.2h().3J)+", 1n: "+U(D.2h().1n)+"}"}if(D.1J()&&(D.1J().2A("3I")===0||D.1J().2A("gE")!=-1||D.1J()=="gD")){1y+=", 3I(): {4D: "+U(D.3I().4D)+", 6A: "+U(D.3I().6A);if(D.1J()!="gC"){1y+=", 2e: {2I: "+U(D.3I().2e.2I)+", 6v: "+U(D.3I().2e.6v)+", 3g: "+U(D.3I().2e.3g)+"}}"}N{1y+="}"}}if(D.1J()=="gG"||D.1J()=="gF"){1y+=", 6C(): "+U(D.6C())}1y+="}";F 1y},1l:G(){F D.1K()},1d:G(){F D.gH},6D:G(){F D.1L},1J:G(){F D.1L.1J||L},8x:G(){F D.1L.8x||D.1L.oj},6C:G(){if(D.1J()=="gG"){F(D.1L.6C||D.1L.aW)}N{if(D.1J()=="gF"){F(D.1L.6C||D.1L.oi)}}F L},4E:G(){u m={};m.8w=D.1L.oh;m.8v=D.1L.og;m.8u=D.1L.oe||1m;m.2P=D.1L.od;m.bw=m.8w||m.8v||m.2P||m.8u;F m},2h:G(){u k={};if(D.1J()&&D.1J().2A("2h")===0){if(D.1J()=="oc"||D.1J()=="ob"){k.3J=D.1L.8t;k.1n=(B.1u.5r[k.3J]||"oa");F k}N{if(D.1J()=="o9"){k.3J=0;k.1n="";if(H(D.1L.6B)!="L"&&D.1L.6B!==0&&!B.1u.bv[D.1L.6B]){k.3J=D.1L.6B;k.1n=bu.bt(k.3J)}N{if(D.1L.8t&&H(D.1L.6B)=="L"){k.3J=D.1L.8t;k.1n=bu.bt(k.3J)}}F k}}}F L},3I:G(){u m={};u e=D.1L;if(D.1J()&&(D.1J().2A("3I")===0||D.1J().2A("gE")!=-1||D.1J()=="gD")){m.6A=Y B.S.5t(0,0);if(e.6z||e.6x){m.6A.x=(!e.6z||e.6z<0)?0:e.6z;m.6A.y=(!e.6x||e.6x<0)?0:e.6x}m.4D=Y B.S.5t(0,0);if(e.8s||e.8r){m.4D.x=(!e.8s||e.8s<0)?0:e.8s;m.4D.y=(!e.8r||e.8r<0)?0:e.8r}N{u de=B.S.1Z.7Z;u b=B.S.1Z.5s;m.4D.x=e.6z+(de.6y||b.6y)-(de.8q||b.8q);m.4D.y=e.6x+(de.4C||b.4C)-(de.8p||b.8p)}if(D.1J()!="gC"){m.2e={};m.2e.2I=1m;m.2e.3g=1m;m.2e.6v=1m;if(e.6w){m.2e.2I=(e.6w==1);m.2e.6v=(e.6w==2);m.2e.3g=(e.6w==3)}N{m.2e.2I=!!(e.2e&1);m.2e.3g=!!(e.2e&2);m.2e.6v=!!(e.2e&4)}}F m}F L},2J:G(){D.8o();D.8n()},8o:G(){if(D.1L.8o){D.1L.8o()}N{D.1L.o8=1h}},8n:G(){if(D.1L.8n){D.1L.8n()}N{D.1L.o7=1m}}});B.1u.bv={3:"gz",o6:"gA",o5:"gy",o4:"gx",o3:"gw",o2:"gv",o1:"gu",o0:"gs",nZ:"gr",nY:"gq",nX:"gp",nW:"go"};R(i=gB;i<=nV;i++){B.1u.bv[i]="gk"+(i-gB+1)}B.1u.5r={8:"nU",9:"nT",12:"gA",13:"gz",16:"nS",17:"nR",18:"nQ",19:"nP",20:"nO",27:"nN",32:"nM",33:"gy",34:"gx",35:"gw",36:"gv",37:"gu",38:"gs",39:"gr",40:"gq",44:"nL",45:"gp",46:"go",59:"gn",91:"nK",92:"nJ",93:"nI",nH:"nG",nF:"nE",nD:"nC-gm",nB:"nA",nz:"ny",nx:"nw",nv:"nu",nt:"gn",ns:"nr",nq:"np",nn:"nm-gm",nl:"nk",nj:"ni",nh:"ng",nf:"nd",nc:"nb",na:"n9",n8:"n7"};R(u i=48;i<=57;i++){B.1u.5r[i]="gl"+(i-48)}R(i=65;i<=90;i++){B.1u.5r[i]="gl"+bu.bt(i)}R(i=96;i<=n6;i++){B.1u.5r[i]="n5"+(i-96)}R(i=gj;i<=n4;i++){B.1u.5r[i]="gk"+(i-gj+1)}B.J.2l(B.1u,{1K:G(){F"["+D.1r+" "+D.1Y+"]"},1l:G(){F D.1K()},g7:G(){u I=B.1u;u bs=I.4x;R(u i=0;i<bs.K;i++){I.6t(bs[i])}gi I.4x;1f{2O.gh=L}1e(e){}1f{2O.g8=L}1e(e){}},gb:G(1d,1A,1i,gg){u E=B.1u.bq;if(!gg){F B.J.1O(1A,1i)}1i=1i||1d;if(H(1A)=="1n"){F G(gf){1i[1A].1w(1i,[Y E(1d,gf)])}}N{F G(gd){1A.1w(1i,[Y E(1d,gd)])}}},6s:G(1d,2D,5q,4B){1d=B.S.1E(1d);u I=B.1u;if(H(2D)!="1n"){14 Y 2x("\'2D\' 5p be a 1n")}u 1i=O;u 1A=O;if(H(4B)!="L"){1i=5q;1A=4B;if(H(4B)=="1n"){if(H(5q[4B])!="G"){14 Y 2x("\'bp\' 5p be a G on \'gc\'")}}N{if(H(4B)!="G"){14 Y 2x("\'bp\' 5p be a G or 1n")}}}N{if(H(5q)!="G"){14 Y 2x("\'gc\' 5p be a G if \'bp\' is 2E n3")}N{1A=5q}}if(H(1i)=="L"||1i===O){1i=1d}u bm=!!(1d.bo||1d.bn);u 8m=I.gb(1d,1A,1i,bm);if(1d.bo){1d.bo(2D.3H(2),8m,1m)}N{if(1d.bn){1d.bn(2D,8m)}}u bk=[1d,2D,8m,bm,5q,4B];I.4x.1c(bk);F bk},6t:G(6u){if(!6u[3]){F}u 1d=6u[0];u 2D=6u[1];u bj=6u[2];if(1d.ga){1d.ga(2D.3H(2),bj,1m)}N{if(1d.g9){1d.g9(2D,bj)}N{14 Y 2x("\'1d\' 5p be a S n0")}}},8j:G(bh){u I=B.1u;u 5o=I.4x;u m=B.J;if(M.K>1){u 1d=B.S.1E(M[0]);u 2D=M[1];u 1i=M[2];u 1A=M[3];R(u i=5o.K-1;i>=0;i--){u o=5o[i];if(o[0]===1d&&o[1]===2D&&o[4]===1i&&o[5]===1A){I.6t(o);5o.4y(i,1);F 1h}}}N{u 5n=m.bi(5o,bh);if(5n>=0){I.6t(bh);5o.4y(5n,1);F 1h}}F 1m},8i:G(1d,2D){1d=B.S.1E(1d);u m=B.J;u 8l=m.bg(m.1R(O,M,1));u I=B.1u;u bd=I.6t;u 4z=I.4x;if(8l.K===0){R(u i=4z.K-1;i>=0;i--){u 4A=4z[i];if(4A[0]===1d){bd(4A);4z.4y(i,1)}}}N{u bf={};R(u i=0;i<8l.K;i++){bf[8l[i]]=1h}R(u i=4z.K-1;i>=0;i--){u 4A=4z[i];if(4A[0]===1d&&4A[1]in bf){bd(4A);4z.4y(i,1)}}}},8h:G(1d,2D){u bc=B.1u.4x;1d=B.S.1E(1d);u 3G=B.J.1R(O,M,2);u 5m=[];R(u i=0;i<bc.K;i++){u 8k=bc[i];if(8k[0]===1d&&8k[1]===2D){1f{8k[2].1w(1d,3G)}1e(e){5m.1c(e)}}}if(5m.K==1){14 5m[0]}N{if(5m.K>1){u e=Y 2x("mZ bb mY in mX \'2D\', mW bb mV");e.bb=5m;14 e}}}});B.1u.1W=[];B.1u.1z=["6s","8j","8h","8i"];B.1u.2d=G(2m){u m=B.J;D.1Z=2v;D.3X=2m;1f{D.6s(2O,"g8",D.g7)}1e(e){}D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};B.1u.2d(D);if(!B.3d){6s=B.1u.6s;8j=B.1u.8j;8i=B.1u.8i;8h=B.1u.8h}B.J.2Y(D,B.1u);if(H(1q)!="L"){1q.2X("B.1X");1q.2M("B.J");1q.2M("B.S");1q.2M("B.V")}if(H(1x)!="L"){1x.26("B.J",[]);1x.26("B.S",[]);1x.26("B.V",[])}1f{if(H(B.J)=="L"||H(B.S)=="L"||H(B.V)=="L"){14""}}1e(e){14"B.1X 3F on B.J, B.S 3W B.V!"}if(H(B.1X)=="L"){B.1X={}}B.1X.1r="B.1X";B.1X.1Y="1.3.1";B.1X.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1X.1l=G(){F D.1K()};B.1X.aI=G(e,g6){e=B.S.1E(e);D.fN(g6);if(D.1S.fL){e=D.g5(e)}u 4w=D.1S.3U;u C=B.V.V;if(D.1S.3U=="aW"){4w=C.ba(e)}N{if(!(4w 2C C)){4w=C.8f(4w)}}D.82=(4w.6r().a<=0);u 5l=D.1S.aV;if(D.1S.aV=="fM"){5l=C.ba(e.8g)}N{if(!(5l 2C C)){5l=C.8f(5l)}}D.g3(e,4w,5l)};B.1X.aI.1U={g5:G(e){u mU=e.3t;u 1N=B.S.b9();if(H(1N.5k)=="L"||1N.5k===O){F e}u 4v=1N.5k.g4(e,O);if(H(4v)=="L"||4v===O){F e}u b8=B.S.6m({"1T":{3u:"8c",mT:4v.6q("6p-3D"),85:4v.6q("6p-3g"),mS:4v.6q("6p-6f"),86:4v.6q("6p-2I"),6p:"2N"}});b8.6o=e.6o;e.6o="";e.2c(b8);F e},g3:G(e,b7,8e){if(D.1S.3E){D.g2(e,8e)}if(D.fy()){D.fX(e,b7,8e)}if(D.fx()){D.fV(e,b7,8e)}},g2:G(el,g1){u b6="6l 8a "+D.aQ(g1);u g0="3E-2I: "+b6;u fZ="3E-3g: "+b6;u fY="1T=\'"+g0+";"+fZ+"\'";el.6o="<4u "+fY+">"+el.6o+"</4u>"},fX:G(el,fW,b5){u b4=D.b1(b5);R(u i=0;i<D.1S.89;i++){b4.2c(D.b0(fW,b5,i,"3D"))}el.1T.mR=0;el.mQ(b4,el.6n)},fV:G(el,fU,b3){u b2=D.b1(b3);R(u i=(D.1S.89-1);i>=0;i--){b2.2c(D.b0(fU,b3,i,"6f"))}el.1T.mP=0;el.2c(b2)},b1:G(fT){u 2q=B.S;F 2q.6m({1T:{aZ:fT.1l()}})},b0:G(aY,fQ,n,aX){u 6k=B.S.8d();u 2p=6k.1T;2p.aZ=aY.1l();2p.3u="8c";2p.3V="6l";2p.fS="fR";2p.mO="6l";u 8b=D.aQ(aY,fQ);if(D.1S.3E&&n===0){2p.mN="8a";2p.mM="6l";2p.84="2N";2p.83="2N";2p.mL="2N";2p.3V="2N";2p.fP=8b.1l()}N{if(8b){2p.fP=8b.1l();2p.mK="8a";2p.mJ="2N 6l"}}if(!D.1S.4r&&(n==(D.1S.89-1))){2p.3V="fO"}D.fI(6k,n,aX);D.fG(6k,n,aX);F 6k},fN:G(fK){D.1S={6g:"1p",3U:"aW",aV:"fM",5j:1h,3E:1m,4r:1m,fL:1m};B.J.2l(D.1S,fK);D.1S.89=(D.1S.4r?2:4)},aL:G(){u 88=D.1S.6g;if(D.6h(88,"1p","3D")){F""}u aU=(88.2A("tl")!=-1);u aT=(88.2A("tr")!=-1);if(aU&&aT){F""}if(aU){F"2I"}if(aT){F"3g"}F""},aK:G(){u 87=D.1S.6g;if(D.6h(87,"1p","6f")){F""}u aS=(87.2A("bl")!=-1);u aR=(87.2A("br")!=-1);if(aS&&aR){F""}if(aS){F"2I"}if(aR){F"3g"}F""},aQ:G(aN,aO){if(aN=="aP"){F aO}N{if(D.1S.3E){F D.1S.3E}N{if(D.1S.5j){F aO.fJ(aN)}}}F""},fI:G(el,n,fH){u 6j=D.fE(n)+"px";u aM=(fH=="3D"?D.aL():D.aK());u 4t=el.1T;if(aM=="2I"){4t.86=6j;4t.85="2N"}N{if(aM=="3g"){4t.85=6j;4t.86="2N"}N{4t.86=6j;4t.85=6j}}},fG:G(el,n,fF){u 6i=D.fz(n)+"px";u aJ=(fF=="3D"?D.aL():D.aK());u 4s=el.1T;if(aJ=="2I"){4s.84=6i;4s.83="2N"}N{if(aJ=="3g"){4s.83=6i;4s.84="2N"}N{4s.84=6i;4s.83=6i}}},fE:G(n){if(D.82){F 0}u o=D.1S;if(o.4r&&o.5j){u fD=[1,0];F fD[n]}N{if(o.4r){u fC=[2,1];F fC[n]}N{if(o.5j){u fB=[3,2,1,0];F fB[n]}N{u fA=[5,3,2,1];F fA[n]}}}},fz:G(n){u o=D.1S;u 5i;if(o.4r&&(o.5j||D.82)){F 1}N{if(o.4r){5i=[1,0]}N{if(o.5j){5i=[2,1,1,1]}N{if(o.3E){5i=[0,2,0,0]}N{if(D.82){5i=[5,3,2,1]}N{F 0}}}}}F 5i[n]},6h:G(1y){R(u i=1;i<M.K;i++){if(1y.2A(M[i])!=-1){F 1h}}F 1m},fy:G(){F D.6h(D.1S.6g,"1p","3D","tl","tr")},fx:G(){F D.6h(D.1S.6g,"1p","6f","bl","br")},mI:G(el){F(el.5h.K==1&&el.5h[0].3T==3)}};B.1X.aF=G(e,fw){Y B.1X.aI(e,fw)};B.1X.fs=G(fv,fu,ft){u aG=B.S.aH(fv,fu);R(u i=0;i<aG.K;i++){B.1X.aF(aG[i],ft)}};B.1X.V=B.V.V;B.1X.mH=B.S.4q;B.1X.2d=G(){u m=B.J;m.3f(D);D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)}};B.1X.1z=["aF","fs"];B.1X.1W=[];B.1X.2d();B.J.2Y(D,B.1X);if(H(B)=="L"){B={}}if(H(B.B)=="L"){B.B={}}B.B.1r="B.B";B.B.1Y="1.3.1";B.B.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.B.1l=G(){F D.1K()};B.B.aA=["J","15","1H","1D","1s","1k","S","1I","V","1u","1X"];if(H(1x)!="L"||H(1q)!="L"){if(H(1q)!="L"){1q.2X("B.B");1q.2M("B.*")}if(H(1x)!="L"){1x.26("B.J",[]);1x.26("B.15",[]);1x.26("B.1H",[]);1x.26("B.1D",[]);1x.26("B.1s",[]);1x.26("B.1k",[]);1x.26("B.S",[]);1x.26("B.1I",[]);1x.26("B.V",[]);1x.26("B.1u",[]);1x.26("B.1X",[])}(G(){u 6e=B.J.1R;u I=B.B;u aE=I.aA;u aD=[];u aC=[];u 81={};u i,k,m,1p;R(i=0;i<aE.K;i++){m=B[aE[i]];6e(aD,m.1z);6e(aC,m.1W);R(k in m.2k){81[k]=6e(81[k],m.2k[k])}1p=m.2k[":1p"];if(!1p){1p=6e(O,m.1z,m.1W)}u j;R(j=0;j<1p.K;j++){k=1p[j];I[k]=m[k]}}I.1z=aD;I.1W=aC;I.2k=81}())}N{if(H(B.3d)=="L"){B.3d=1h}(G(){u 80=2v.fr("7W");u ay="fq://fp.mG.fo/mF/mE/mD.is.aB.mC";u 2w=O;u ax=O;u az={};u i;R(i=0;i<80.K;i++){u 1d=80[i].fm("1d");if(!1d){2V}az[1d]=1h;if(1d.3C(/B.js$/)){2w=1d.2W(0,1d.mB("B.js"));ax=80[i]}}if(2w===O){F}u 6d=B.B.aA;R(u i=0;i<6d.K;i++){if(B[6d[i]]){2V}u 7Y=2w+6d[i]+".js";if(7Y in az){2V}if(2v.7Z&&2v.7Z.mA==ay){u s=2v.mz(ay,"7W");s.4p("id","my"+2w+6d[i]);s.4p("1d",7Y);s.4p("1J","mx/x-fk");ax.3t.2c(s)}N{2v.fl("<7W 1d=\\""+7Y+"\\" 1J=\\"7X/fk\\"></7W>")}}})()}',62,1976,'||||||||||||||||||||||||||||||var|||||||MochiKit||this||return|function|typeof|self|Base|length|undefined|arguments|else|null||elem|for|DOM||repr|Color|rval|res|new||||||throw|Iter|||||next|name|push|src|catch|try|lst|true|obj|node|Async|toString|false|string|hue|all|dojo|NAME|Format|msg|Signal|red|apply|JSAN|str|EXPORT|func|rgb|_425|DateTime|getElement|blue|hsl|Logging|LoggingPane|type|__repr__|_event|while|doc|bind|num|iter|extend|options|style|prototype|seq|EXPORT_OK|Visual|VERSION|_document||_434||replace|forwardCall|StopIteration|use||Math|max|min|join|appendChild|__new__|button|compare|date|key|val|_329|EXPORT_TAGS|update|win|pair|concat|_596|dom|map|req|Deferred|sync|document|base|Error|number|partial|indexOf||instanceof|sig|not|cls|list|fired|left|stop|break|logger|require|0px|window|shift|hsv|split|createElement|_423|callee|continue|substring|provide|_exportSymbols|ccc||_464|||||||||step|pred|_51|__compat__|common|nameFunctions|right|255|_517|case|100|_loggingPane|value|object|callback|TypeError|_251|_246|_113|parentNode|display|_522|parseInt|cssText|wrap|info|isArrayLike|end|match|top|border|depends|args|substr|mouse|code|_519|_443|className|level|err|frac|Date|_135|_85|nodeType|color|height|and|_window|fromRGB|charAt||asHSL|_444|message||||filter||LogMessage|AdapterRegistry|_366|imap|NotFound|locked|counter|_262|_messages|operator|cmp|_165|_161|pairs|arr|_52|setAttribute|computedStyle|compact|_614|_610|div|_576|_572|_observers|splice|_565|_566|_555|scrollTop|page|modifier|white|_541|fromHSL|_539|_535|_528|clone|parseFloat|_505|pre|_499|_497|_427|createTextNode|_446|attributeArray|_388|_379|updateNodeAttributes|_341|_326||box|errback|results|paused|chain|_285||ofs||NamedError|_175|_147|_122|_83|_54|_17|childNodes|_619|blend|defaultView|_574|_569|idx|_562|must|_554|_specialKeys|body|Coordinates|registerComparator|_521|_516|hex|mid|_478|width|loggingPane|LogLevel|nwin|head|url|setElementClass|callStack|path|dest|_359|boolean|register|Dimensions|DeferredLock|_313|addCallback|_310|waiting|onreadystatechange|_290|LOCALE|year|printfire|_214|log|_213|_211|pos|_155|_153||typeMatcher|listMinMax|_114|_40|itr|typ|_19|_634|_625|bottom|corners|_hasString|_612|_608|_595|1px|DIV|firstChild|innerHTML|padding|getPropertyValue|asRGB|connect|_disconnect|_559|middle|which|clientY|scrollLeft|clientX|client|charCode|relatedTarget|event|toColorPart|clampColorComponent|_537|_534|toFixed|_468|buildAndApplyFilter|_442|_441|_440|_439|position|_463|_447|removeChild|_449|uid|_428|_426|compliant|attributes|_422|_409|_412|_400|_395|_390|_389|_377|_375|_363|attr|ctx|repeat|_340|_339|isNotEmpty|_335|_333|opera|DeferredList|ret|_309|silentlyCancelled|canceller|_nextId|Array|_293|XMLHttpRequest|chained|_281|tail|_252|_225|msec|day|month|iso|Logger|_208|listeners|_200|_198|_194|_196|reduce|range|_169|_162|truth|registerRepr|_121|_70|_58|_56|_47|_45|_41|_13|_1|script|text|uri|documentElement|_630|_629|isTransparent|borderRightWidth|borderLeftWidth|marginRight|marginLeft|_602|_599|numSlices|solid|_597|block|SPAN|_579|fromString|offsetParent|signal|disconnectAll|disconnect|_570|_563|_557|preventDefault|stopPropagation|clientTop|clientLeft|pageY|pageX|keyCode|meta|ctrl|alt|target|black|_532|_524|floor|_513|_512|_500|_495|toLowerCase|_487|DEBUG|INFO|WARNING|FATAL|ERROR|colorTable|logFont|closed|inline|onclick|_438|_437|_445|RegExp|_452|space|title|updatetree|||||withDocument|withWindow||setDisplayForElement|none|renames|forEach|domConverters|escapeHTML|addElementClass|removeElementClass|once|_378|_380|_376|appendChildNodes|coerceToDOM|_355|opt|clientWidth|opacity|GenericError|fail|resultList|_307|_301|_fire|can|addCallbacks|_resback|percent|decimal|separator|twoDigitFloat|_274|_273|_264|_257|_250|_249|_254|_248|_243|_242|fmt|_240|_245|getTime|sec|hour|_209|slice|_206|iterateNextIter|registerIteratorFactory|arrayLikeIter|iteratorRegistry|takewhile|ifilterfalse|ifilter|_181|_176|_168|_166|_159|_tee|deque|arg|fun|jsonRegistry|reprString|reprRegistry|comparatorRegistry|urlEncode|_110|_108|cur|_95|_87|_71|im_preargs||_53|_57|_46|present|like|array|Argument|_15|_12|_632|_631|_633|SUBMODULES|only|_628|_627|_626|roundElement|_624|getElementsByTagAndClassName|_RoundCorners|_613|_whichSideBottom|_whichSideTop|_609|_605|_606|transparent|_borderColor|_604|_603|_601|_600|bgColor|fromElement|_594|_592|backgroundColor|_createCornerSlice|_createCorner|_590|_589|_587|_586|_581|_578|_577|currentDocument|fromBackground|errors|_568|_564||sigs|flattenArguments|_561|findIdentical|_560|_558||_556|attachEvent|addEventListener|funcOrStr|Event||_548|fromCharCode|String|_specialMacKeys|any|green|_namedColors|hsvToRGB|rgbToHSV|hslToRGB|rgbToHSL|_542|01|360|_fromColorString|_540|_536|_538|_529|_523|_518|fromComputedStyle|_511|_507|_508|_506|_501|fromHexString|_498|_496|_486|__class__|createLoggingPane|_459|_461|font|_462|_430|_435|1000|index|_460|getMessages|removeListener|_451||_457|_450|infore|_448|_456|logDebug|offsetHeight|span|input|_436|TR||HTML|open|alert|currentWindow|swapDOM|SELECT|FORM|INPUT|createDOMFunc|ignoreAttr|_421|call|_417|_410|_415|nodeName|_414|_413|emitHTML|good|_406|_399|_397|_393|_392|addLoadEvent|addToCallStack|_387|_386|_381|_382|_383|_373|_372|_369|createDOM|_365|Function|_360|_362|_358|_344|nodeWalk|formContents|_337|_338|_334|_332|offsetTop|offsetLeft|visibility|parentElement|||XMLHttpRequestError|BrowserComplianceError|CancelledError|AlreadyCalledError|evalJSONRequest|sendXMLHttpRequest|wait|doSimpleXMLHttpRequest|getXMLHttpRequest|succeed|_312|finishedCount|_308|_cbDeferred|_303|_297|queryString|_nothing|_289|XMLHTTP|ActiveXObject|eval|_284|_check|error|_279|default|rstrip|lstrip|formatLocale|roundToFixed|truncToFixed|_276|pow|_272|_271|_270|sign|_265|_263|tmp|_238|_232|toISODate|toISOTime|getFullYear|getDate|getMonth|_230|_padTwo|_228|useNativeConsole|_212|compareLogMessage|isLogMessage|unshift|_207||maxSize|_202|_199|logLevelAtLeast|console|hasIterateNext|iterateNext|arrayLike|groupby||exhaust|tee|dropwhile|applymap||islice|izip|cycle|count||_189|_188|_183|_185|_184|_186|_187|_182|identity|fetch|_180|_177|listMin|reprNumber|reprArrayLike|compareArrayLike|compareDateLike|isDateLike|findValue|_128|__export__|keyComparator|_124|_118|_93|_94|_90|_88|_84|_77|_68|_67|_66|_65|_60|im_func|_55|im_self|_48|_44|_42|_39|_36|_33|_27|_26|_25|_22|_24|_20|javascript|write|getAttribute||org|www|http|getElementsByTagName|roundClass|_623|_622|_621|_620|_isBottomRounded|_isTopRounded|_borderSize|_618|_617|_616|_615|_marginSize|_611|_setBorder|_607|_setMargin|blendedColor|_598|__unstable__wrapElement|fromParent|_setOptions|2px|borderColor|_593|hidden|overflow|_591|_588|_roundBottomCorners|_585|_roundTopCorners|_584|_583|_582|_580|_renderBorder|_roundCornersImpl|getComputedStyle|_doWrap|_571|_unloadCache|onunload|detachEvent|removeEventListener|_listener|objOrFunc|_552||_551|_549|onload|delete|112|KEY_F|KEY_|MINUS|KEY_SEMICOLON|KEY_DELETE|KEY_INSERT|KEY_ARROW_DOWN|KEY_ARROW_RIGHT|KEY_ARROW_UP||KEY_ARROW_LEFT|KEY_HOME|KEY_END|KEY_PAGE_DOWN|KEY_PAGE_UP|KEY_ENTER|KEY_NUM_PAD_CLEAR|63236|mousemove|contextmenu|click|mouseout|mouseover|_src|yellow|708090|purple|orange|ff00ff|magenta|778899|d3d3d3|808080|gray|696969|2f4f4f|darkred|a9a9a9|00ffff|cyan|brown|_547|_546||||compareRGB|_545||_543|fromHSLString|fromRGBString|round|_533|_hslValue|switch|background|_503|_504||fromName|_488|col|toRGBString|_hexString|_rgbString|_hslString|toPrecision|isLight||_481|_477|_476|_475|_474|_473|_469|_466|closePane|_458|onkeypress|_454|addListener|_455|close|test|scrollHeight|option|word|moz|_431|getElementById|html|pop|200|_|removeElement|showElement|hideElement|CANVAS|STRONG|FIELDSET|LEGEND|OPTGROUP|OPTION|TEXTAREA|LABEL|HR|BR|H3|H2|H1|PRE|TT|BUTTON|IMG|TH||TABLE||TFOOT|THEAD|TBODY|TD|LI|OL|||UL|checked|class|ignoreAttrFilter||_424|_419|nodeValue|scrapeText|_416|_418|sort|_411|toHTML|_404|hasElementClass|_403|_402|_401|swapElementClass|_398|_394|toggleElementClass|_391|focusOnLoad|_newCallStack|currentStyle|_371|replaceChildNodes|_364|_361|getNodeAttribute|_357|setNodeAttribute|_354|_352|_350|_353|toDOM|_346|_345|registerDOMConverter|selectedIndex|setElementPosition|setElementDimensions|tagName|absolute|getBoxObjectFor|getBoundingClientRect|elementPosition|_325|_324|_322|_323|offsetWidth|elementDimensions|clientHeight|innerWidth|getViewportDimensions|setOpacity|status|_317|deferred|_316|_newNamedError|maybeDeferred||gatherResults|callLater|loadJSONDoc|_311|consumeErrors|fireOnOneErrback|fireOnOneCallback|addErrback|_305|_304|_306|unlocked|release|_300|_299|_298|_296|_xhr_onreadystatechange|_xhr_canceller|304|responseText|Msxml2|addBoth|_pause|_continue|result|the|are|they|instances|_unpause|cancel|_280|_278|en_US|strip|percentFormat|twoDigitAverage|numberFormatter|_277|_275|isNaN|_259|_258|_260|_255|_253|_numberFormatter|_241|_239|_237|_236|_235|_234|_233|_231|toAmericanDate|toPaddedAmericanDate|americanDate|toISOTimestamp|isoTimestamp|isoDate|foot|sep||60000|_221|_isoRegexp|dispatchEvent|createEvent|warning|logWarning|fatal|logFatal|debug|logError|baseLog|_210|getMessageText|logToConsole|dispatchListeners|_204|_203|ident|_201|postError|alertListener|_197|_192|groupby_as_array|iextend|some|reversed|sorted|every|sum|_190|eat|_174|_173|_172|_171|_167|_163|_158|_157|_151|_144|_141||_139|_136|_134||_133|_132|zip|merge|isUndefined|isCallable|listMax|_131|_130|encodeURIComponent||_127|method|parseQueryString|evalJSON|registerJSON|serializeJSON|objMin|objMax|reverseKeyComparator|arrayEqual|objEqual|bindMethods|xfilter|xmap|isEmpty|isNull|isUndefinedOrNull|itemgetter|items|keys|setdefault|_126|_120|decodeURIComponent|_119|len|_109|_107|_104|_105|_101|_102|_98|||_100|_97|_96|_91|json|__json__|_82|_81|_80|_79|_76||_75|_74|_73|_69|_primitives|_64|_63||_62|_61|_59|_wrapDumbFunction|_49|_50|_31|_30|_21|_7|application|MochiKit_|createElementNS|namespaceURI|lastIndexOf|xul|there|gatekeeper|keymaster|mozilla|getElementsComputedStyle|_hasSingleTextChild|borderWidth|borderStyle|borderBottomWidth|borderTopWidth|borderTopStyle|fontSize|paddingBottom|insertBefore|paddingTop|marginBottom|marginTop|_575|property|see|handling|thrown|Multiple|element|||given|123|KEY_NUM_PAD_|105|KEY_APOSTROPHE|222|KEY_RIGHT_SQUARE_BRACKET|221|KEY_REVERSE_SOLIDUS|220|KEY_LEFT_SQUARE_BRACKET||219|KEY_GRAVE_ACCENT|192|KEY_SOLIDUS|191|KEY_FULL_STOP|190|KEY_HYPHEN|189||KEY_COMMA|188|KEY_EQUALS_SIGN|187|186|KEY_SCROLL_LOCK|145|KEY_NUM_LOCK|144|KEY_NUM_PAD_SOLIDUS|111|KEY_NUM_PAD_FULL_STOP|110|KEY_NUM_PAD_HYPHEN|109|KEY_NUM_PAD_PLUS_SIGN|107|KEY_NUM_PAD_ASTERISK|106|KEY_SELECT|KEY_WINDOWS_RIGHT|KEY_WINDOWS_LEFT|KEY_PRINT_SCREEN|KEY_SPACEBAR|KEY_ESCAPE|KEY_CAPS_LOCK|KEY_PAUSE|KEY_ALT|KEY_CTRL|KEY_SHIFT|KEY_TAB|KEY_BACKSPACE|63242|63272|63302|63233|63235|63232|63234|63273|63275|63277|63276|63289|returnValue|cancelBubble|keypress|KEY_UNKNOWN|keyup|keydown|shiftKey|metaKey||ctrlKey|altKey|toElement|srcElement|9acd32||yellowgreen||ffff00|f5f5f5|whitesmoke||ffffff|f5deb3|wheat|ee82ee|violet|40e0d0|turquoise|ff6347|tomato|d8bfd8|thistle|008080|teal|d2b48c|tan|4682b4|steelblue|00ff7f|springgreen|fffafa|snow|slategrey|slategray|6a5acd|slateblue|87ceeb|skyblue|c0c0c0|silver|a0522d|sienna|fff5ee|seashell|2e8b57|seagreen|f4a460|sandybrown|fa8072|salmon|8b4513|saddlebrown|4169e1|royalblue|bc8f8f|rosybrown|ff0000|800080|b0e0e6|powderblue|dda0dd|plum|ffc0cb|pink|cd853f||peru|ffdab9|peachpuff|ffefd5|papayawhip|db7093|palevioletred|afeeee|paleturquoise|98fb98|palegreen|eee8aa||palegoldenrod|da70d6|orchid|ff4500|orangered|ffa500|6b8e23|olivedrab|808000|olive|fdf5e6|oldlace|000080|navy|ffdead|navajowhite|ffe4b5|moccasin|ffe4e1|mistyrose|f5fffa|mintcream|191970|midnightblue|c71585|mediumvioletred|48d1cc|mediumturquoise|00fa9a|mediumspringgreen|7b68ee|mediumslateblue|3cb371|mediumseagreen|9370db|mediumpurple|ba55d3|mediumorchid|0000cd|mediumblue|66cdaa|mediumaquamarine|800000|maroon|faf0e6|linen|32cd32|limegreen|00ff00|lime|ffffe0|lightyellow|b0c4de|lightsteelblue|lightslategrey|lightslategray||87cefa|lightskyblue|20b2aa|lightseagreen|ffa07a|lightsalmon|ffb6c1|lightpink|lightgrey|90ee90|lightgreen|lightgray|fafad2|lightgoldenrodyellow|e0ffff|lightcyan|f08080|lightcoral|add8e6|lightblue|fffacd|lemonchiffon|7cfc00|lawngreen|fff0f5|lavenderblush|e6e6fa|lavender|f0e68c|khaki|fffff0|ivory|4b0082|indigo|cd5c5c|indianred|ff69b4|hotpink|f0fff0|honeydew|grey|adff2f|greenyellow|008000|daa520|goldenrod|ffd700||gold|f8f8ff|ghostwhite|dcdcdc|gainsboro|fuchsia|228b22|forestgreen|fffaf0|floralwhite|b22222|firebrick|1e90ff|dodgerblue|dimgrey|dimgray|00bfff|deepskyblue|ff1493|deeppink|9400d3|darkviolet|00ced1|darkturquoise|darkslategrey|darkslategray|483d8b|darkslateblue|8fbc8f|darkseagreen|e9967a|darksalmon|8b0000|9932cc|darkorchid|ff8c00|darkorange|556b2f|darkolivegreen|8b008b|darkmagenta|bdb76b|darkkhaki|darkgrey|006400|darkgreen|darkgray|b8860b|darkgoldenrod|008b8b|darkcyan|00008b|darkblue|dc143c|crimson|fff8dc|cornsilk|6495ed|cornflowerblue|ff7f50|coral|d2691e||chocolate|7fff00|chartreuse|5f9ea0|cadetblue|deb887|burlywood|a52a2a|8a2be2|blueviolet|0000ff|ffebcd||blanchedalmond|000000|ffe4c4|bisque|f5f5dc|beige|f0ffff|azure|7fffd4|aquamarine|aqua|faebd7|antiquewhite|f0f8ff|aliceblue|lightGray|darkGray|namedColors|blackColor|fromText|whiteColor|_510|_509|PI|rad|deg|transparentColor|_494|_493|_492|fromHSV|_491|_490|_489|asHSV|toHexString|rgba|hsla|toHSLString|isDark|lighterColorWithLevel|darkerColorWithLevel|colorWithLightness|colorWithSaturation|colorWithHue|colorWithAlpha||serif|sans|Verdana||8pt|8em|auto||Close|Clear||Load|Filter||10em||fixed|regex|emergency|line|margin|_Listener|dtd|loose|html4|w3|EN|Transitional|DTD|W3C|PUBLIC|DOCTYPE|blocking|due|debugging|able|Not|resizable|dependent|href|location|_MochiKit_LoggingPane|_429|canvas|strong|fieldset|legend|optgroup|select|form|textarea|label|img|table|tfoot|thead|tbody|htmlFor||useMap|usemap|defaultChecked|hasChildNodes|quot|amp|_405|focus|replaceChild|checkbox||radio|_win|BODY||safari|version|userAgent|navigator|innerHeight|alpha|khtml|Tried|acquire|clearTimeout|setTimeout|GET|ignore|send|abort|failed|Request|readyState|support|does|Browser|Microsoft|_288|_287|used|Deferreds|Chained|success|unfired|fr_FR|de_DE|00|abs|search|pattern|Invalid|getTimezoneOffset|getSeconds|getMinutes|getHours|UTC|3600000|initEvent|Events|debuggingBookmarklet|MESSAGES|LAST|_205|clear|ninfo|nlevel|timestamp|reverse|takes|initial|with|sequence|empty|iterable|numbers|dateLike|escape|find|forward|unregister|unescape|Object|compared|item|contains|logor|logand|cle|clt|cge|cgt|cne|ceq|zrshift|rshift|lshift|xor|mul|mod|sub|add|neg|lognot|_9|_2'.split('|'),0,{})
+
+
+/*
+ * jQuery 1.2.1 - New Wave Javascript
+ *
+ * Copyright (c) 2007 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $
+ * $Rev: 3353 $
+ */
+
+var decompressedJQuery = function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(G(){9(1m E!="W")H w=E;H E=18.15=G(a,b){I 6 7u E?6.5N(a,b):1u E(a,b)};9(1m $!="W")H D=$;18.$=E;H u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3A={5N:G(c,a){c=c||U;9(1m c=="1M"){H m=u.2S(c);9(m&&(m[1]||!a)){9(m[1])c=E.4D([m[1]],a);J{H b=U.3S(m[3]);9(b)9(b.22!=m[3])I E().1Y(c);J{6[0]=b;6.K=1;I 6}J c=[]}}J I 1u E(a).1Y(c)}J 9(E.1n(c))I 1u E(U)[E.1b.2d?"2d":"39"](c);I 6.6v(c.1c==1B&&c||(c.4c||c.K&&c!=18&&!c.1y&&c[0]!=W&&c[0].1y)&&E.2h(c)||[c])},4c:"1.2.1",7Y:G(){I 6.K},K:0,21:G(a){I a==W?E.2h(6):6[a]},2o:G(a){H b=E(a);b.4Y=6;I b},6v:G(a){6.K=0;1B.3A.1a.16(6,a);I 6},N:G(a,b){I E.N(6,a,b)},4I:G(a){H b=-1;6.N(G(i){9(6==a)b=i});I b},1x:G(f,d,e){H c=f;9(f.1c==3X)9(d==W)I 6.K&&E[e||"1x"](6[0],f)||W;J{c={};c[f]=d}I 6.N(G(a){L(H b 1i c)E.1x(e?6.R:6,b,E.1e(6,c[b],e,a,b))})},17:G(b,a){I 6.1x(b,a,"3C")},2g:G(e){9(1m e!="5i"&&e!=S)I 6.4n().3g(U.6F(e));H t="";E.N(e||6,G(){E.N(6.3j,G(){9(6.1y!=8)t+=6.1y!=1?6.6x:E.1b.2g([6])})});I t},5m:G(b){9(6[0])E(b,6[0].3H).6u().3d(6[0]).1X(G(){H a=6;1W(a.1w)a=a.1w;I a}).3g(6);I 6},8m:G(a){I 6.N(G(){E(6).6q().5m(a)})},8d:G(a){I 6.N(G(){E(6).5m(a)})},3g:G(){I 6.3z(1q,Q,1,G(a){6.58(a)})},6j:G(){I 6.3z(1q,Q,-1,G(a){6.3d(a,6.1w)})},6g:G(){I 6.3z(1q,P,1,G(a){6.12.3d(a,6)})},50:G(){I 6.3z(1q,P,-1,G(a){6.12.3d(a,6.2q)})},2D:G(){I 6.4Y||E([])},1Y:G(t){H b=E.1X(6,G(a){I E.1Y(t,a)});I 6.2o(/[^+>] [^+>]/.14(t)||t.1g("..")>-1?E.4V(b):b)},6u:G(e){H f=6.1X(G(){I 6.67?E(6.67)[0]:6.4R(Q)});H d=f.1Y("*").4O().N(G(){9(6[F]!=W)6[F]=S});9(e===Q)6.1Y("*").4O().N(G(i){H c=E.M(6,"2P");L(H a 1i c)L(H b 1i c[a])E.1j.1f(d[i],a,c[a][b],c[a][b].M)});I f},1E:G(t){I 6.2o(E.1n(t)&&E.2W(6,G(b,a){I t.16(b,[a])})||E.3m(t,6))},5V:G(t){I 6.2o(t.1c==3X&&E.3m(t,6,Q)||E.2W(6,G(a){I(t.1c==1B||t.4c)?E.2A(a,t)<0:a!=t}))},1f:G(t){I 6.2o(E.1R(6.21(),t.1c==3X?E(t).21():t.K!=W&&(!t.11||E.11(t,"2Y"))?t:[t]))},3t:G(a){I a?E.3m(a,6).K>0:P},7c:G(a){I 6.3t("."+a)},3i:G(b){9(b==W){9(6.K){H c=6[0];9(E.11(c,"24")){H e=c.4Z,a=[],Y=c.Y,2G=c.O=="24-2G";9(e<0)I S;L(H i=2G?e:0,33=2G?e+1:Y.K;i<33;i++){H d=Y[i];9(d.26){H b=E.V.1h&&!d.9V["1Q"].9L?d.2g:d.1Q;9(2G)I b;a.1a(b)}}I a}J I 6[0].1Q.1p(/\\r/g,"")}}J I 6.N(G(){9(b.1c==1B&&/4k|5j/.14(6.O))6.2Q=(E.2A(6.1Q,b)>=0||E.2A(6.2H,b)>=0);J 9(E.11(6,"24")){H a=b.1c==1B?b:[b];E("9h",6).N(G(){6.26=(E.2A(6.1Q,a)>=0||E.2A(6.2g,a)>=0)});9(!a.K)6.4Z=-1}J 6.1Q=b})},4o:G(a){I a==W?(6.K?6[0].3O:S):6.4n().3g(a)},6H:G(a){I 6.50(a).28()},6E:G(i){I 6.2J(i,i+1)},2J:G(){I 6.2o(1B.3A.2J.16(6,1q))},1X:G(b){I 6.2o(E.1X(6,G(a,i){I b.2O(a,i,a)}))},4O:G(){I 6.1f(6.4Y)},3z:G(f,d,g,e){H c=6.K>1,a;I 6.N(G(){9(!a){a=E.4D(f,6.3H);9(g<0)a.8U()}H b=6;9(d&&E.11(6,"1I")&&E.11(a[0],"4m"))b=6.4l("1K")[0]||6.58(U.5B("1K"));E.N(a,G(){H a=c?6.4R(Q):6;9(!5A(0,a))e.2O(b,a)})})}};G 5A(i,b){H a=E.11(b,"1J");9(a){9(b.3k)E.3G({1d:b.3k,3e:P,1V:"1J"});J E.5f(b.2g||b.6s||b.3O||"");9(b.12)b.12.3b(b)}J 9(b.1y==1)E("1J",b).N(5A);I a}E.1k=E.1b.1k=G(){H c=1q[0]||{},a=1,2c=1q.K,5e=P;9(c.1c==8o){5e=c;c=1q[1]||{}}9(2c==1){c=6;a=0}H b;L(;a<2c;a++)9((b=1q[a])!=S)L(H i 1i b){9(c==b[i])6r;9(5e&&1m b[i]==\'5i\'&&c[i])E.1k(c[i],b[i]);J 9(b[i]!=W)c[i]=b[i]}I c};H F="15"+(1u 3D()).3B(),6p=0,5c={};E.1k({8a:G(a){18.$=D;9(a)18.15=w;I E},1n:G(a){I!!a&&1m a!="1M"&&!a.11&&a.1c!=1B&&/G/i.14(a+"")},4a:G(a){I a.2V&&!a.1G||a.37&&a.3H&&!a.3H.1G},5f:G(a){a=E.36(a);9(a){9(18.6l)18.6l(a);J 9(E.V.1N)18.56(a,0);J 3w.2O(18,a)}},11:G(b,a){I b.11&&b.11.27()==a.27()},1L:{},M:G(c,d,b){c=c==18?5c:c;H a=c[F];9(!a)a=c[F]=++6p;9(d&&!E.1L[a])E.1L[a]={};9(b!=W)E.1L[a][d]=b;I d?E.1L[a][d]:a},30:G(c,b){c=c==18?5c:c;H a=c[F];9(b){9(E.1L[a]){2E E.1L[a][b];b="";L(b 1i E.1L[a])1T;9(!b)E.30(c)}}J{2a{2E c[F]}29(e){9(c.53)c.53(F)}2E E.1L[a]}},N:G(a,b,c){9(c){9(a.K==W)L(H i 1i a)b.16(a[i],c);J L(H i=0,48=a.K;i<48;i++)9(b.16(a[i],c)===P)1T}J{9(a.K==W)L(H i 1i a)b.2O(a[i],i,a[i]);J L(H i=0,48=a.K,3i=a[0];i<48&&b.2O(3i,i,3i)!==P;3i=a[++i]){}}I a},1e:G(c,b,d,e,a){9(E.1n(b))b=b.2O(c,[e]);H f=/z-?4I|7T-?7Q|1r|69|7P-?1H/i;I b&&b.1c==4W&&d=="3C"&&!f.14(a)?b+"2T":b},1o:{1f:G(b,c){E.N((c||"").2l(/\\s+/),G(i,a){9(!E.1o.3K(b.1o,a))b.1o+=(b.1o?" ":"")+a})},28:G(b,c){b.1o=c!=W?E.2W(b.1o.2l(/\\s+/),G(a){I!E.1o.3K(c,a)}).66(" "):""},3K:G(t,c){I E.2A(c,(t.1o||t).3s().2l(/\\s+/))>-1}},2k:G(e,o,f){L(H i 1i o){e.R["3r"+i]=e.R[i];e.R[i]=o[i]}f.16(e,[]);L(H i 1i o)e.R[i]=e.R["3r"+i]},17:G(e,p){9(p=="1H"||p=="2N"){H b={},42,41,d=["7J","7I","7G","7F"];E.N(d,G(){b["7C"+6]=0;b["7B"+6+"5Z"]=0});E.2k(e,b,G(){9(E(e).3t(\':3R\')){42=e.7A;41=e.7w}J{e=E(e.4R(Q)).1Y(":4k").5W("2Q").2D().17({4C:"1P",2X:"4F",19:"2Z",7o:"0",1S:"0"}).5R(e.12)[0];H a=E.17(e.12,"2X")||"3V";9(a=="3V")e.12.R.2X="7g";42=e.7e;41=e.7b;9(a=="3V")e.12.R.2X="3V";e.12.3b(e)}});I p=="1H"?42:41}I E.3C(e,p)},3C:G(h,j,i){H g,2w=[],2k=[];G 3n(a){9(!E.V.1N)I P;H b=U.3o.3Z(a,S);I!b||b.4y("3n")==""}9(j=="1r"&&E.V.1h){g=E.1x(h.R,"1r");I g==""?"1":g}9(j.1t(/4u/i))j=y;9(!i&&h.R[j])g=h.R[j];J 9(U.3o&&U.3o.3Z){9(j.1t(/4u/i))j="4u";j=j.1p(/([A-Z])/g,"-$1").2p();H d=U.3o.3Z(h,S);9(d&&!3n(h))g=d.4y(j);J{L(H a=h;a&&3n(a);a=a.12)2w.4w(a);L(a=0;a<2w.K;a++)9(3n(2w[a])){2k[a]=2w[a].R.19;2w[a].R.19="2Z"}g=j=="19"&&2k[2w.K-1]!=S?"2s":U.3o.3Z(h,S).4y(j)||"";L(a=0;a<2k.K;a++)9(2k[a]!=S)2w[a].R.19=2k[a]}9(j=="1r"&&g=="")g="1"}J 9(h.3Q){H f=j.1p(/\\-(\\w)/g,G(m,c){I c.27()});g=h.3Q[j]||h.3Q[f];9(!/^\\d+(2T)?$/i.14(g)&&/^\\d/.14(g)){H k=h.R.1S;H e=h.4v.1S;h.4v.1S=h.3Q.1S;h.R.1S=g||0;g=h.R.71+"2T";h.R.1S=k;h.4v.1S=e}}I g},4D:G(a,e){H r=[];e=e||U;E.N(a,G(i,d){9(!d)I;9(d.1c==4W)d=d.3s();9(1m d=="1M"){d=d.1p(/(<(\\w+)[^>]*?)\\/>/g,G(m,a,b){I b.1t(/^(70|6Z|6Y|9Q|4t|9N|9K|3a|9G|9E)$/i)?m:a+"></"+b+">"});H s=E.36(d).2p(),1s=e.5B("1s"),2x=[];H c=!s.1g("<9y")&&[1,"<24>","</24>"]||!s.1g("<9w")&&[1,"<6T>","</6T>"]||s.1t(/^<(9u|1K|9t|9r|9p)/)&&[1,"<1I>","</1I>"]||!s.1g("<4m")&&[2,"<1I><1K>","</1K></1I>"]||(!s.1g("<9m")||!s.1g("<9k"))&&[3,"<1I><1K><4m>","</4m></1K></1I>"]||!s.1g("<6Y")&&[2,"<1I><1K></1K><6L>","</6L></1I>"]||E.V.1h&&[1,"1s<1s>","</1s>"]||[0,"",""];1s.3O=c[1]+d+c[2];1W(c[0]--)1s=1s.5p;9(E.V.1h){9(!s.1g("<1I")&&s.1g("<1K")<0)2x=1s.1w&&1s.1w.3j;J 9(c[1]=="<1I>"&&s.1g("<1K")<0)2x=1s.3j;L(H n=2x.K-1;n>=0;--n)9(E.11(2x[n],"1K")&&!2x[n].3j.K)2x[n].12.3b(2x[n]);9(/^\\s/.14(d))1s.3d(e.6F(d.1t(/^\\s*/)[0]),1s.1w)}d=E.2h(1s.3j)}9(0===d.K&&(!E.11(d,"2Y")&&!E.11(d,"24")))I;9(d[0]==W||E.11(d,"2Y")||d.Y)r.1a(d);J r=E.1R(r,d)});I r},1x:G(c,d,a){H e=E.4a(c)?{}:E.5o;9(d=="26"&&E.V.1N)c.12.4Z;9(e[d]){9(a!=W)c[e[d]]=a;I c[e[d]]}J 9(E.V.1h&&d=="R")I E.1x(c.R,"9e",a);J 9(a==W&&E.V.1h&&E.11(c,"2Y")&&(d=="9d"||d=="9a"))I c.97(d).6x;J 9(c.37){9(a!=W){9(d=="O"&&E.11(c,"4t")&&c.12)6G"O 94 93\'t 92 91";c.90(d,a)}9(E.V.1h&&/6C|3k/.14(d)&&!E.4a(c))I c.4p(d,2);I c.4p(d)}J{9(d=="1r"&&E.V.1h){9(a!=W){c.69=1;c.1E=(c.1E||"").1p(/6O\\([^)]*\\)/,"")+(3I(a).3s()=="8S"?"":"6O(1r="+a*6A+")")}I c.1E?(3I(c.1E.1t(/1r=([^)]*)/)[1])/6A).3s():""}d=d.1p(/-([a-z])/8Q,G(z,b){I b.27()});9(a!=W)c[d]=a;I c[d]}},36:G(t){I(t||"").1p(/^\\s+|\\s+$/g,"")},2h:G(a){H r=[];9(1m a!="8P")L(H i=0,2c=a.K;i<2c;i++)r.1a(a[i]);J r=a.2J(0);I r},2A:G(b,a){L(H i=0,2c=a.K;i<2c;i++)9(a[i]==b)I i;I-1},1R:G(a,b){9(E.V.1h){L(H i=0;b[i];i++)9(b[i].1y!=8)a.1a(b[i])}J L(H i=0;b[i];i++)a.1a(b[i]);I a},4V:G(b){H r=[],2f={};2a{L(H i=0,6y=b.K;i<6y;i++){H a=E.M(b[i]);9(!2f[a]){2f[a]=Q;r.1a(b[i])}}}29(e){r=b}I r},2W:G(b,a,c){9(1m a=="1M")a=3w("P||G(a,i){I "+a+"}");H d=[];L(H i=0,4g=b.K;i<4g;i++)9(!c&&a(b[i],i)||c&&!a(b[i],i))d.1a(b[i]);I d},1X:G(c,b){9(1m b=="1M")b=3w("P||G(a){I "+b+"}");H d=[];L(H i=0,4g=c.K;i<4g;i++){H a=b(c[i],i);9(a!==S&&a!=W){9(a.1c!=1B)a=[a];d=d.8M(a)}}I d}});H v=8K.8I.2p();E.V={4s:(v.1t(/.+(?:8F|8E|8C|8B)[\\/: ]([\\d.]+)/)||[])[1],1N:/6w/.14(v),34:/34/.14(v),1h:/1h/.14(v)&&!/34/.14(v),35:/35/.14(v)&&!/(8z|6w)/.14(v)};H y=E.V.1h?"4h":"5h";E.1k({5g:!E.V.1h||U.8y=="8x",4h:E.V.1h?"4h":"5h",5o:{"L":"8w","8v":"1o","4u":y,5h:y,4h:y,3O:"3O",1o:"1o",1Q:"1Q",3c:"3c",2Q:"2Q",8u:"8t",26:"26",8s:"8r"}});E.N({1D:"a.12",8q:"15.4e(a,\'12\')",8p:"15.2I(a,2,\'2q\')",8n:"15.2I(a,2,\'4d\')",8l:"15.4e(a,\'2q\')",8k:"15.4e(a,\'4d\')",8j:"15.5d(a.12.1w,a)",8i:"15.5d(a.1w)",6q:"15.11(a,\'8h\')?a.8f||a.8e.U:15.2h(a.3j)"},G(i,n){E.1b[i]=G(a){H b=E.1X(6,n);9(a&&1m a=="1M")b=E.3m(a,b);I 6.2o(E.4V(b))}});E.N({5R:"3g",8c:"6j",3d:"6g",8b:"50",89:"6H"},G(i,n){E.1b[i]=G(){H a=1q;I 6.N(G(){L(H j=0,2c=a.K;j<2c;j++)E(a[j])[n](6)})}});E.N({5W:G(a){E.1x(6,a,"");6.53(a)},88:G(c){E.1o.1f(6,c)},87:G(c){E.1o.28(6,c)},86:G(c){E.1o[E.1o.3K(6,c)?"28":"1f"](6,c)},28:G(a){9(!a||E.1E(a,[6]).r.K){E.30(6);6.12.3b(6)}},4n:G(){E("*",6).N(G(){E.30(6)});1W(6.1w)6.3b(6.1w)}},G(i,n){E.1b[i]=G(){I 6.N(n,1q)}});E.N(["85","5Z"],G(i,a){H n=a.2p();E.1b[n]=G(h){I 6[0]==18?E.V.1N&&3y["84"+a]||E.5g&&38.33(U.2V["5a"+a],U.1G["5a"+a])||U.1G["5a"+a]:6[0]==U?38.33(U.1G["6n"+a],U.1G["6m"+a]):h==W?(6.K?E.17(6[0],n):S):6.17(n,h.1c==3X?h:h+"2T")}});H C=E.V.1N&&3x(E.V.4s)<83?"(?:[\\\\w*57-]|\\\\\\\\.)":"(?:[\\\\w\\82-\\81*57-]|\\\\\\\\.)",6k=1u 47("^>\\\\s*("+C+"+)"),6i=1u 47("^("+C+"+)(#)("+C+"+)"),6h=1u 47("^([#.]?)("+C+"*)");E.1k({55:{"":"m[2]==\'*\'||15.11(a,m[2])","#":"a.4p(\'22\')==m[2]",":":{80:"i<m[3]-0",7Z:"i>m[3]-0",2I:"m[3]-0==i",6E:"m[3]-0==i",3v:"i==0",3u:"i==r.K-1",6f:"i%2==0",6e:"i%2","3v-46":"a.12.4l(\'*\')[0]==a","3u-46":"15.2I(a.12.5p,1,\'4d\')==a","7X-46":"!15.2I(a.12.5p,2,\'4d\')",1D:"a.1w",4n:"!a.1w",7W:"(a.6s||a.7V||15(a).2g()||\'\').1g(m[3])>=0",3R:\'"1P"!=a.O&&15.17(a,"19")!="2s"&&15.17(a,"4C")!="1P"\',1P:\'"1P"==a.O||15.17(a,"19")=="2s"||15.17(a,"4C")=="1P"\',7U:"!a.3c",3c:"a.3c",2Q:"a.2Q",26:"a.26||15.1x(a,\'26\')",2g:"\'2g\'==a.O",4k:"\'4k\'==a.O",5j:"\'5j\'==a.O",54:"\'54\'==a.O",52:"\'52\'==a.O",51:"\'51\'==a.O",6d:"\'6d\'==a.O",6c:"\'6c\'==a.O",2r:\'"2r"==a.O||15.11(a,"2r")\',4t:"/4t|24|6b|2r/i.14(a.11)",3K:"15.1Y(m[3],a).K",7S:"/h\\\\d/i.14(a.11)",7R:"15.2W(15.32,G(1b){I a==1b.T;}).K"}},6a:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1u 47("^([:.#]*)("+C+"+)")],3m:G(a,c,b){H d,2b=[];1W(a&&a!=d){d=a;H f=E.1E(a,c,b);a=f.t.1p(/^\\s*,\\s*/,"");2b=b?c=f.r:E.1R(2b,f.r)}I 2b},1Y:G(t,o){9(1m t!="1M")I[t];9(o&&!o.1y)o=S;o=o||U;H d=[o],2f=[],3u;1W(t&&3u!=t){H r=[];3u=t;t=E.36(t);H l=P;H g=6k;H m=g.2S(t);9(m){H p=m[1].27();L(H i=0;d[i];i++)L(H c=d[i].1w;c;c=c.2q)9(c.1y==1&&(p=="*"||c.11.27()==p.27()))r.1a(c);d=r;t=t.1p(g,"");9(t.1g(" ")==0)6r;l=Q}J{g=/^([>+~])\\s*(\\w*)/i;9((m=g.2S(t))!=S){r=[];H p=m[2],1R={};m=m[1];L(H j=0,31=d.K;j<31;j++){H n=m=="~"||m=="+"?d[j].2q:d[j].1w;L(;n;n=n.2q)9(n.1y==1){H h=E.M(n);9(m=="~"&&1R[h])1T;9(!p||n.11.27()==p.27()){9(m=="~")1R[h]=Q;r.1a(n)}9(m=="+")1T}}d=r;t=E.36(t.1p(g,""));l=Q}}9(t&&!l){9(!t.1g(",")){9(o==d[0])d.44();2f=E.1R(2f,d);r=d=[o];t=" "+t.68(1,t.K)}J{H k=6i;H m=k.2S(t);9(m){m=[0,m[2],m[3],m[1]]}J{k=6h;m=k.2S(t)}m[2]=m[2].1p(/\\\\/g,"");H f=d[d.K-1];9(m[1]=="#"&&f&&f.3S&&!E.4a(f)){H q=f.3S(m[2]);9((E.V.1h||E.V.34)&&q&&1m q.22=="1M"&&q.22!=m[2])q=E(\'[@22="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.11(q,m[3]))?[q]:[]}J{L(H i=0;d[i];i++){H a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];9(a=="*"&&d[i].11.2p()=="5i")a="3a";r=E.1R(r,d[i].4l(a))}9(m[1]==".")r=E.4X(r,m[2]);9(m[1]=="#"){H e=[];L(H i=0;r[i];i++)9(r[i].4p("22")==m[2]){e=[r[i]];1T}r=e}d=r}t=t.1p(k,"")}}9(t){H b=E.1E(t,r);d=r=b.r;t=E.36(b.t)}}9(t)d=[];9(d&&o==d[0])d.44();2f=E.1R(2f,d);I 2f},4X:G(r,m,a){m=" "+m+" ";H c=[];L(H i=0;r[i];i++){H b=(" "+r[i].1o+" ").1g(m)>=0;9(!a&&b||a&&!b)c.1a(r[i])}I c},1E:G(t,r,h){H d;1W(t&&t!=d){d=t;H p=E.6a,m;L(H i=0;p[i];i++){m=p[i].2S(t);9(m){t=t.7O(m[0].K);m[2]=m[2].1p(/\\\\/g,"");1T}}9(!m)1T;9(m[1]==":"&&m[2]=="5V")r=E.1E(m[3],r,Q).r;J 9(m[1]==".")r=E.4X(r,m[2],h);J 9(m[1]=="["){H g=[],O=m[3];L(H i=0,31=r.K;i<31;i++){H a=r[i],z=a[E.5o[m[2]]||m[2]];9(z==S||/6C|3k|26/.14(m[2]))z=E.1x(a,m[2])||\'\';9((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1g(m[5])||O=="$="&&z.68(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1g(m[5])>=0)^h)g.1a(a)}r=g}J 9(m[1]==":"&&m[2]=="2I-46"){H e={},g=[],14=/(\\d*)n\\+?(\\d*)/.2S(m[3]=="6f"&&"2n"||m[3]=="6e"&&"2n+1"||!/\\D/.14(m[3])&&"n+"+m[3]||m[3]),3v=(14[1]||1)-0,d=14[2]-0;L(H i=0,31=r.K;i<31;i++){H j=r[i],12=j.12,22=E.M(12);9(!e[22]){H c=1;L(H n=12.1w;n;n=n.2q)9(n.1y==1)n.4U=c++;e[22]=Q}H b=P;9(3v==1){9(d==0||j.4U==d)b=Q}J 9((j.4U+d)%3v==0)b=Q;9(b^h)g.1a(j)}r=g}J{H f=E.55[m[1]];9(1m f!="1M")f=E.55[m[1]][m[2]];f=3w("P||G(a,i){I "+f+"}");r=E.2W(r,f,h)}}I{r:r,t:t}},4e:G(b,c){H d=[];H a=b[c];1W(a&&a!=U){9(a.1y==1)d.1a(a);a=a[c]}I d},2I:G(a,e,c,b){e=e||1;H d=0;L(;a;a=a[c])9(a.1y==1&&++d==e)1T;I a},5d:G(n,a){H r=[];L(;n;n=n.2q){9(n.1y==1&&(!a||n!=a))r.1a(n)}I r}});E.1j={1f:G(g,e,c,h){9(E.V.1h&&g.4j!=W)g=18;9(!c.2u)c.2u=6.2u++;9(h!=W){H d=c;c=G(){I d.16(6,1q)};c.M=h;c.2u=d.2u}H i=e.2l(".");e=i[0];c.O=i[1];H b=E.M(g,"2P")||E.M(g,"2P",{});H f=E.M(g,"2t",G(){H a;9(1m E=="W"||E.1j.4T)I a;a=E.1j.2t.16(g,1q);I a});H j=b[e];9(!j){j=b[e]={};9(g.4S)g.4S(e,f,P);J g.7N("43"+e,f)}j[c.2u]=c;6.1Z[e]=Q},2u:1,1Z:{},28:G(d,c,b){H e=E.M(d,"2P"),2L,4I;9(1m c=="1M"){H a=c.2l(".");c=a[0]}9(e){9(c&&c.O){b=c.4Q;c=c.O}9(!c){L(c 1i e)6.28(d,c)}J 9(e[c]){9(b)2E e[c][b.2u];J L(b 1i e[c])9(!a[1]||e[c][b].O==a[1])2E e[c][b];L(2L 1i e[c])1T;9(!2L){9(d.4P)d.4P(c,E.M(d,"2t"),P);J d.7M("43"+c,E.M(d,"2t"));2L=S;2E e[c]}}L(2L 1i e)1T;9(!2L){E.30(d,"2P");E.30(d,"2t")}}},1F:G(d,b,e,c,f){b=E.2h(b||[]);9(!e){9(6.1Z[d])E("*").1f([18,U]).1F(d,b)}J{H a,2L,1b=E.1n(e[d]||S),4N=!b[0]||!b[0].2M;9(4N)b.4w(6.4M({O:d,2m:e}));b[0].O=d;9(E.1n(E.M(e,"2t")))a=E.M(e,"2t").16(e,b);9(!1b&&e["43"+d]&&e["43"+d].16(e,b)===P)a=P;9(4N)b.44();9(f&&f.16(e,b)===P)a=P;9(1b&&c!==P&&a!==P&&!(E.11(e,\'a\')&&d=="4L")){6.4T=Q;e[d]()}6.4T=P}I a},2t:G(d){H a;d=E.1j.4M(d||18.1j||{});H b=d.O.2l(".");d.O=b[0];H c=E.M(6,"2P")&&E.M(6,"2P")[d.O],3q=1B.3A.2J.2O(1q,1);3q.4w(d);L(H j 1i c){3q[0].4Q=c[j];3q[0].M=c[j].M;9(!b[1]||c[j].O==b[1]){H e=c[j].16(6,3q);9(a!==P)a=e;9(e===P){d.2M();d.3p()}}}9(E.V.1h)d.2m=d.2M=d.3p=d.4Q=d.M=S;I a},4M:G(c){H a=c;c=E.1k({},a);c.2M=G(){9(a.2M)a.2M();a.7L=P};c.3p=G(){9(a.3p)a.3p();a.7K=Q};9(!c.2m&&c.65)c.2m=c.65;9(E.V.1N&&c.2m.1y==3)c.2m=a.2m.12;9(!c.4K&&c.4J)c.4K=c.4J==c.2m?c.7H:c.4J;9(c.64==S&&c.63!=S){H e=U.2V,b=U.1G;c.64=c.63+(e&&e.2R||b.2R||0);c.7E=c.7D+(e&&e.2B||b.2B||0)}9(!c.3Y&&(c.61||c.60))c.3Y=c.61||c.60;9(!c.5F&&c.5D)c.5F=c.5D;9(!c.3Y&&c.2r)c.3Y=(c.2r&1?1:(c.2r&2?3:(c.2r&4?2:0)));I c}};E.1b.1k({3W:G(c,a,b){I c=="5Y"?6.2G(c,a,b):6.N(G(){E.1j.1f(6,c,b||a,b&&a)})},2G:G(d,b,c){I 6.N(G(){E.1j.1f(6,d,G(a){E(6).5X(a);I(c||b).16(6,1q)},c&&b)})},5X:G(a,b){I 6.N(G(){E.1j.28(6,a,b)})},1F:G(c,a,b){I 6.N(G(){E.1j.1F(c,a,6,Q,b)})},7x:G(c,a,b){9(6[0])I E.1j.1F(c,a,6[0],P,b)},25:G(){H a=1q;I 6.4L(G(e){6.4H=0==6.4H?1:0;e.2M();I a[6.4H].16(6,[e])||P})},7v:G(f,g){G 4G(e){H p=e.4K;1W(p&&p!=6)2a{p=p.12}29(e){p=6};9(p==6)I P;I(e.O=="4x"?f:g).16(6,[e])}I 6.4x(4G).5U(4G)},2d:G(f){5T();9(E.3T)f.16(U,[E]);J E.3l.1a(G(){I f.16(6,[E])});I 6}});E.1k({3T:P,3l:[],2d:G(){9(!E.3T){E.3T=Q;9(E.3l){E.N(E.3l,G(){6.16(U)});E.3l=S}9(E.V.35||E.V.34)U.4P("5S",E.2d,P);9(!18.7t.K)E(18).39(G(){E("#4E").28()})}}});E.N(("7s,7r,39,7q,6n,5Y,4L,7p,"+"7n,7m,7l,4x,5U,7k,24,"+"51,7j,7i,7h,3U").2l(","),G(i,o){E.1b[o]=G(f){I f?6.3W(o,f):6.1F(o)}});H x=P;G 5T(){9(x)I;x=Q;9(E.V.35||E.V.34)U.4S("5S",E.2d,P);J 9(E.V.1h){U.7f("<7d"+"7y 22=4E 7z=Q "+"3k=//:><\\/1J>");H a=U.3S("4E");9(a)a.62=G(){9(6.2C!="1l")I;E.2d()};a=S}J 9(E.V.1N)E.4B=4j(G(){9(U.2C=="5Q"||U.2C=="1l"){4A(E.4B);E.4B=S;E.2d()}},10);E.1j.1f(18,"39",E.2d)}E.1b.1k({39:G(g,d,c){9(E.1n(g))I 6.3W("39",g);H e=g.1g(" ");9(e>=0){H i=g.2J(e,g.K);g=g.2J(0,e)}c=c||G(){};H f="4z";9(d)9(E.1n(d)){c=d;d=S}J{d=E.3a(d);f="5P"}H h=6;E.3G({1d:g,O:f,M:d,1l:G(a,b){9(b=="1C"||b=="5O")h.4o(i?E("<1s/>").3g(a.40.1p(/<1J(.|\\s)*?\\/1J>/g,"")).1Y(i):a.40);56(G(){h.N(c,[a.40,b,a])},13)}});I 6},7a:G(){I E.3a(6.5M())},5M:G(){I 6.1X(G(){I E.11(6,"2Y")?E.2h(6.79):6}).1E(G(){I 6.2H&&!6.3c&&(6.2Q||/24|6b/i.14(6.11)||/2g|1P|52/i.14(6.O))}).1X(G(i,c){H b=E(6).3i();I b==S?S:b.1c==1B?E.1X(b,G(a,i){I{2H:c.2H,1Q:a}}):{2H:c.2H,1Q:b}}).21()}});E.N("5L,5K,6t,5J,5I,5H".2l(","),G(i,o){E.1b[o]=G(f){I 6.3W(o,f)}});H B=(1u 3D).3B();E.1k({21:G(d,b,a,c){9(E.1n(b)){a=b;b=S}I E.3G({O:"4z",1d:d,M:b,1C:a,1V:c})},78:G(b,a){I E.21(b,S,a,"1J")},77:G(c,b,a){I E.21(c,b,a,"45")},76:G(d,b,a,c){9(E.1n(b)){a=b;b={}}I E.3G({O:"5P",1d:d,M:b,1C:a,1V:c})},75:G(a){E.1k(E.59,a)},59:{1Z:Q,O:"4z",2z:0,5G:"74/x-73-2Y-72",6o:Q,3e:Q,M:S},49:{},3G:G(s){H f,2y=/=(\\?|%3F)/g,1v,M;s=E.1k(Q,s,E.1k(Q,{},E.59,s));9(s.M&&s.6o&&1m s.M!="1M")s.M=E.3a(s.M);9(s.1V=="4b"){9(s.O.2p()=="21"){9(!s.1d.1t(2y))s.1d+=(s.1d.1t(/\\?/)?"&":"?")+(s.4b||"5E")+"=?"}J 9(!s.M||!s.M.1t(2y))s.M=(s.M?s.M+"&":"")+(s.4b||"5E")+"=?";s.1V="45"}9(s.1V=="45"&&(s.M&&s.M.1t(2y)||s.1d.1t(2y))){f="4b"+B++;9(s.M)s.M=s.M.1p(2y,"="+f);s.1d=s.1d.1p(2y,"="+f);s.1V="1J";18[f]=G(a){M=a;1C();1l();18[f]=W;2a{2E 18[f]}29(e){}}}9(s.1V=="1J"&&s.1L==S)s.1L=P;9(s.1L===P&&s.O.2p()=="21")s.1d+=(s.1d.1t(/\\?/)?"&":"?")+"57="+(1u 3D()).3B();9(s.M&&s.O.2p()=="21"){s.1d+=(s.1d.1t(/\\?/)?"&":"?")+s.M;s.M=S}9(s.1Z&&!E.5b++)E.1j.1F("5L");9(!s.1d.1g("8g")&&s.1V=="1J"){H h=U.4l("9U")[0];H g=U.5B("1J");g.3k=s.1d;9(!f&&(s.1C||s.1l)){H j=P;g.9R=g.62=G(){9(!j&&(!6.2C||6.2C=="5Q"||6.2C=="1l")){j=Q;1C();1l();h.3b(g)}}}h.58(g);I}H k=P;H i=18.6X?1u 6X("9P.9O"):1u 6W();i.9M(s.O,s.1d,s.3e);9(s.M)i.5C("9J-9I",s.5G);9(s.5y)i.5C("9H-5x-9F",E.49[s.1d]||"9D, 9C 9B 9A 5v:5v:5v 9z");i.5C("X-9x-9v","6W");9(s.6U)s.6U(i);9(s.1Z)E.1j.1F("5H",[i,s]);H c=G(a){9(!k&&i&&(i.2C==4||a=="2z")){k=Q;9(d){4A(d);d=S}1v=a=="2z"&&"2z"||!E.6S(i)&&"3U"||s.5y&&E.6R(i,s.1d)&&"5O"||"1C";9(1v=="1C"){2a{M=E.6Q(i,s.1V)}29(e){1v="5k"}}9(1v=="1C"){H b;2a{b=i.5s("6P-5x")}29(e){}9(s.5y&&b)E.49[s.1d]=b;9(!f)1C()}J E.5r(s,i,1v);1l();9(s.3e)i=S}};9(s.3e){H d=4j(c,13);9(s.2z>0)56(G(){9(i){i.9q();9(!k)c("2z")}},s.2z)}2a{i.9o(s.M)}29(e){E.5r(s,i,S,e)}9(!s.3e)c();I i;G 1C(){9(s.1C)s.1C(M,1v);9(s.1Z)E.1j.1F("5I",[i,s])}G 1l(){9(s.1l)s.1l(i,1v);9(s.1Z)E.1j.1F("6t",[i,s]);9(s.1Z&&!--E.5b)E.1j.1F("5K")}},5r:G(s,a,b,e){9(s.3U)s.3U(a,b,e);9(s.1Z)E.1j.1F("5J",[a,s,e])},5b:0,6S:G(r){2a{I!r.1v&&9n.9l=="54:"||(r.1v>=6N&&r.1v<9j)||r.1v==6M||E.V.1N&&r.1v==W}29(e){}I P},6R:G(a,c){2a{H b=a.5s("6P-5x");I a.1v==6M||b==E.49[c]||E.V.1N&&a.1v==W}29(e){}I P},6Q:G(r,b){H c=r.5s("9i-O");H d=b=="6K"||!b&&c&&c.1g("6K")>=0;H a=d?r.9g:r.40;9(d&&a.2V.37=="5k")6G"5k";9(b=="1J")E.5f(a);9(b=="45")a=3w("("+a+")");I a},3a:G(a){H s=[];9(a.1c==1B||a.4c)E.N(a,G(){s.1a(3f(6.2H)+"="+3f(6.1Q))});J L(H j 1i a)9(a[j]&&a[j].1c==1B)E.N(a[j],G(){s.1a(3f(j)+"="+3f(6))});J s.1a(3f(j)+"="+3f(a[j]));I s.66("&").1p(/%20/g,"+")}});E.1b.1k({1A:G(b,a){I b?6.1U({1H:"1A",2N:"1A",1r:"1A"},b,a):6.1E(":1P").N(G(){6.R.19=6.3h?6.3h:"";9(E.17(6,"19")=="2s")6.R.19="2Z"}).2D()},1z:G(b,a){I b?6.1U({1H:"1z",2N:"1z",1r:"1z"},b,a):6.1E(":3R").N(G(){6.3h=6.3h||E.17(6,"19");9(6.3h=="2s")6.3h="2Z";6.R.19="2s"}).2D()},6J:E.1b.25,25:G(a,b){I E.1n(a)&&E.1n(b)?6.6J(a,b):a?6.1U({1H:"25",2N:"25",1r:"25"},a,b):6.N(G(){E(6)[E(6).3t(":1P")?"1A":"1z"]()})},9c:G(b,a){I 6.1U({1H:"1A"},b,a)},9b:G(b,a){I 6.1U({1H:"1z"},b,a)},99:G(b,a){I 6.1U({1H:"25"},b,a)},98:G(b,a){I 6.1U({1r:"1A"},b,a)},96:G(b,a){I 6.1U({1r:"1z"},b,a)},95:G(c,a,b){I 6.1U({1r:a},c,b)},1U:G(k,i,h,g){H j=E.6D(i,h,g);I 6[j.3L===P?"N":"3L"](G(){j=E.1k({},j);H f=E(6).3t(":1P"),3y=6;L(H p 1i k){9(k[p]=="1z"&&f||k[p]=="1A"&&!f)I E.1n(j.1l)&&j.1l.16(6);9(p=="1H"||p=="2N"){j.19=E.17(6,"19");j.2U=6.R.2U}}9(j.2U!=S)6.R.2U="1P";j.3M=E.1k({},k);E.N(k,G(c,a){H e=1u E.2j(3y,j,c);9(/25|1A|1z/.14(a))e[a=="25"?f?"1A":"1z":a](k);J{H b=a.3s().1t(/^([+-]=)?([\\d+-.]+)(.*)$/),1O=e.2b(Q)||0;9(b){H d=3I(b[2]),2i=b[3]||"2T";9(2i!="2T"){3y.R[c]=(d||1)+2i;1O=((d||1)/e.2b(Q))*1O;3y.R[c]=1O+2i}9(b[1])d=((b[1]=="-="?-1:1)*d)+1O;e.3N(1O,d,2i)}J e.3N(1O,a,"")}});I Q})},3L:G(a,b){9(E.1n(a)){b=a;a="2j"}9(!a||(1m a=="1M"&&!b))I A(6[0],a);I 6.N(G(){9(b.1c==1B)A(6,a,b);J{A(6,a).1a(b);9(A(6,a).K==1)b.16(6)}})},9f:G(){H a=E.32;I 6.N(G(){L(H i=0;i<a.K;i++)9(a[i].T==6)a.6I(i--,1)}).5n()}});H A=G(b,c,a){9(!b)I;H q=E.M(b,c+"3L");9(!q||a)q=E.M(b,c+"3L",a?E.2h(a):[]);I q};E.1b.5n=G(a){a=a||"2j";I 6.N(G(){H q=A(6,a);q.44();9(q.K)q[0].16(6)})};E.1k({6D:G(b,a,c){H d=b&&b.1c==8Z?b:{1l:c||!c&&a||E.1n(b)&&b,2e:b,3J:c&&a||a&&a.1c!=8Y&&a};d.2e=(d.2e&&d.2e.1c==4W?d.2e:{8X:8W,8V:6N}[d.2e])||8T;d.3r=d.1l;d.1l=G(){E(6).5n();9(E.1n(d.3r))d.3r.16(6)};I d},3J:{6B:G(p,n,b,a){I b+a*p},5q:G(p,n,b,a){I((-38.9s(p*38.8R)/2)+0.5)*a+b}},32:[],2j:G(b,c,a){6.Y=c;6.T=b;6.1e=a;9(!c.3P)c.3P={}}});E.2j.3A={4r:G(){9(6.Y.2F)6.Y.2F.16(6.T,[6.2v,6]);(E.2j.2F[6.1e]||E.2j.2F.6z)(6);9(6.1e=="1H"||6.1e=="2N")6.T.R.19="2Z"},2b:G(a){9(6.T[6.1e]!=S&&6.T.R[6.1e]==S)I 6.T[6.1e];H r=3I(E.3C(6.T,6.1e,a));I r&&r>-8O?r:3I(E.17(6.T,6.1e))||0},3N:G(c,b,e){6.5u=(1u 3D()).3B();6.1O=c;6.2D=b;6.2i=e||6.2i||"2T";6.2v=6.1O;6.4q=6.4i=0;6.4r();H f=6;G t(){I f.2F()}t.T=6.T;E.32.1a(t);9(E.32.K==1){H d=4j(G(){H a=E.32;L(H i=0;i<a.K;i++)9(!a[i]())a.6I(i--,1);9(!a.K)4A(d)},13)}},1A:G(){6.Y.3P[6.1e]=E.1x(6.T.R,6.1e);6.Y.1A=Q;6.3N(0,6.2b());9(6.1e=="2N"||6.1e=="1H")6.T.R[6.1e]="8N";E(6.T).1A()},1z:G(){6.Y.3P[6.1e]=E.1x(6.T.R,6.1e);6.Y.1z=Q;6.3N(6.2b(),0)},2F:G(){H t=(1u 3D()).3B();9(t>6.Y.2e+6.5u){6.2v=6.2D;6.4q=6.4i=1;6.4r();6.Y.3M[6.1e]=Q;H a=Q;L(H i 1i 6.Y.3M)9(6.Y.3M[i]!==Q)a=P;9(a){9(6.Y.19!=S){6.T.R.2U=6.Y.2U;6.T.R.19=6.Y.19;9(E.17(6.T,"19")=="2s")6.T.R.19="2Z"}9(6.Y.1z)6.T.R.19="2s";9(6.Y.1z||6.Y.1A)L(H p 1i 6.Y.3M)E.1x(6.T.R,p,6.Y.3P[p])}9(a&&E.1n(6.Y.1l))6.Y.1l.16(6.T);I P}J{H n=t-6.5u;6.4i=n/6.Y.2e;6.4q=E.3J[6.Y.3J||(E.3J.5q?"5q":"6B")](6.4i,n,0,1,6.Y.2e);6.2v=6.1O+((6.2D-6.1O)*6.4q);6.4r()}I Q}};E.2j.2F={2R:G(a){a.T.2R=a.2v},2B:G(a){a.T.2B=a.2v},1r:G(a){E.1x(a.T.R,"1r",a.2v)},6z:G(a){a.T.R[a.1e]=a.2v+a.2i}};E.1b.6m=G(){H c=0,3E=0,T=6[0],5t;9(T)8L(E.V){H b=E.17(T,"2X")=="4F",1D=T.12,23=T.23,2K=T.3H,4f=1N&&3x(4s)<8J;9(T.6V){5w=T.6V();1f(5w.1S+38.33(2K.2V.2R,2K.1G.2R),5w.3E+38.33(2K.2V.2B,2K.1G.2B));9(1h){H d=E("4o").17("8H");d=(d=="8G"||E.5g&&3x(4s)>=7)&&2||d;1f(-d,-d)}}J{1f(T.5l,T.5z);1W(23){1f(23.5l,23.5z);9(35&&/^t[d|h]$/i.14(1D.37)||!4f)d(23);9(4f&&!b&&E.17(23,"2X")=="4F")b=Q;23=23.23}1W(1D.37&&!/^1G|4o$/i.14(1D.37)){9(!/^8D|1I-9S.*$/i.14(E.17(1D,"19")))1f(-1D.2R,-1D.2B);9(35&&E.17(1D,"2U")!="3R")d(1D);1D=1D.12}9(4f&&b)1f(-2K.1G.5l,-2K.1G.5z)}5t={3E:3E,1S:c}}I 5t;G d(a){1f(E.17(a,"9T"),E.17(a,"8A"))}G 1f(l,t){c+=3x(l)||0;3E+=3x(t)||0}}})();',62,616,'||||||this|||if|||||||||||||||||||||||||||||||||function|var|return|else|length|for|data|each|type|false|true|style|null|elem|document|browser|undefined||options|||nodeName|parentNode||test|jQuery|apply|css|window|display|push|fn|constructor|url|prop|add|indexOf|msie|in|event|extend|complete|typeof|isFunction|className|replace|arguments|opacity|div|match|new|status|firstChild|attr|nodeType|hide|show|Array|success|parent|filter|trigger|body|height|table|script|tbody|cache|string|safari|start|hidden|value|merge|left|break|animate|dataType|while|map|find|global||get|id|offsetParent|select|toggle|selected|toUpperCase|remove|catch|try|cur|al|ready|duration|done|text|makeArray|unit|fx|swap|split|target||pushStack|toLowerCase|nextSibling|button|none|handle|guid|now|stack|tb|jsre|timeout|inArray|scrollTop|readyState|end|delete|step|one|name|nth|slice|doc|ret|preventDefault|width|call|events|checked|scrollLeft|exec|px|overflow|documentElement|grep|position|form|block|removeData|rl|timers|max|opera|mozilla|trim|tagName|Math|load|param|removeChild|disabled|insertBefore|async|encodeURIComponent|append|oldblock|val|childNodes|src|readyList|multiFilter|color|defaultView|stopPropagation|args|old|toString|is|last|first|eval|parseInt|self|domManip|prototype|getTime|curCSS|Date|top||ajax|ownerDocument|parseFloat|easing|has|queue|curAnim|custom|innerHTML|orig|currentStyle|visible|getElementById|isReady|error|static|bind|String|which|getComputedStyle|responseText|oWidth|oHeight|on|shift|json|child|RegExp|ol|lastModified|isXMLDoc|jsonp|jquery|previousSibling|dir|safari2|el|styleFloat|state|setInterval|radio|getElementsByTagName|tr|empty|html|getAttribute|pos|update|version|input|float|runtimeStyle|unshift|mouseover|getPropertyValue|GET|clearInterval|safariTimer|visibility|clean|__ie_init|absolute|handleHover|lastToggle|index|fromElement|relatedTarget|click|fix|evt|andSelf|removeEventListener|handler|cloneNode|addEventListener|triggered|nodeIndex|unique|Number|classFilter|prevObject|selectedIndex|after|submit|password|removeAttribute|file|expr|setTimeout|_|appendChild|ajaxSettings|client|active|win|sibling|deep|globalEval|boxModel|cssFloat|object|checkbox|parsererror|offsetLeft|wrapAll|dequeue|props|lastChild|swing|handleError|getResponseHeader|results|startTime|00|box|Modified|ifModified|offsetTop|evalScript|createElement|setRequestHeader|ctrlKey|callback|metaKey|contentType|ajaxSend|ajaxSuccess|ajaxError|ajaxStop|ajaxStart|serializeArray|init|notmodified|POST|loaded|appendTo|DOMContentLoaded|bindReady|mouseout|not|removeAttr|unbind|unload|Width|keyCode|charCode|onreadystatechange|clientX|pageX|srcElement|join|outerHTML|substr|zoom|parse|textarea|reset|image|odd|even|before|quickClass|quickID|prepend|quickChild|execScript|offset|scroll|processData|uuid|contents|continue|textContent|ajaxComplete|clone|setArray|webkit|nodeValue|fl|_default|100|linear|href|speed|eq|createTextNode|throw|replaceWith|splice|_toggle|xml|colgroup|304|200|alpha|Last|httpData|httpNotModified|httpSuccess|fieldset|beforeSend|getBoundingClientRect|XMLHttpRequest|ActiveXObject|col|br|abbr|pixelLeft|urlencoded|www|application|ajaxSetup|post|getJSON|getScript|elements|serialize|clientWidth|hasClass|scr|clientHeight|write|relative|keyup|keypress|keydown|change|mousemove|mouseup|mousedown|right|dblclick|resize|focus|blur|frames|instanceof|hover|offsetWidth|triggerHandler|ipt|defer|offsetHeight|border|padding|clientY|pageY|Left|Right|toElement|Bottom|Top|cancelBubble|returnValue|detachEvent|attachEvent|substring|line|weight|animated|header|font|enabled|innerText|contains|only|size|gt|lt|uFFFF|u0128|417|inner|Height|toggleClass|removeClass|addClass|replaceAll|noConflict|insertAfter|prependTo|wrap|contentWindow|contentDocument|http|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|Boolean|next|parents|maxLength|maxlength|readOnly|readonly|class|htmlFor|CSS1Compat|compatMode|compatible|borderTopWidth|ie|ra|inline|it|rv|medium|borderWidth|userAgent|522|navigator|with|concat|1px|10000|array|ig|PI|NaN|400|reverse|fast|600|slow|Function|Object|setAttribute|changed|be|can|property|fadeTo|fadeOut|getAttributeNode|fadeIn|slideToggle|method|slideUp|slideDown|action|cssText|stop|responseXML|option|content|300|th|protocol|td|location|send|cap|abort|colg|cos|tfoot|thead|With|leg|Requested|opt|GMT|1970|Jan|01|Thu|area|Since|hr|If|Type|Content|meta|specified|open|link|XMLHTTP|Microsoft|img|onload|row|borderLeftWidth|head|attributes'.split('|'),0,{});
+
+/*
+    Copyright (c) 2004-2007, The Dojo Foundation
+    All Rights Reserved.
+
+    Licensed under the Academic Free License version 2.1 or above OR the
+    modified BSD license. For more information on Dojo licensing, see:
+
+        http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+    This is a compiled version of Dojo, built for deployment and not for
+    development. To get an editable version, please visit:
+
+        http://dojotoolkit.org
+
+    for documentation and information on getting the source.
+*/
+
+var decompressedDojo = function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('if(V z=="1k"){(B(){if(V D["1o"]=="1k"){D.1o={}}if((!D["1z"])||(!1z["ca"])){D.1z={}}A cn=["rA","rz","1K","ry","rx","9f","rw","rv","ru","rt","rs","rr","rq","ro","rn","rm"];A i=0,24;1s(24=cn[i++]){if(!1z[24]){1z[24]=B(){}}}if(V D["z"]=="1k"){D.z={}}z.1W=D;A d3={im:U,rl:U,rk:"",rj:"",ri:"",rh:K,rg:U};R(A 8z in d3){if(V 1o[8z]=="1k"){1o[8z]=d3[8z]}}A jK=["rf","rd","rc","rb"];A t;1s(t=jK.3a()){z["is"+t]=U}})();z.8h=1o.8h;z.cY={jJ:0,jI:9,jH:0,jG:"",jF:2V("$ra: r9 $".1f(/[0-9]+/)[0]),2i:B(){4G(z.cY){C jJ+"."+jI+"."+jH+jG+" ("+jF+")"}}};z.d1=B(jE,jD,1V){A 2h=1V||z.1W;R(A i=0,p;2h&&(p=jE[i]);i++){2h=(p in 2h?2h[p]:(jD?2h[p]={}:1k))}C 2h};z.88=B(jC,jA,jB){A d2=jC.1A("."),p=d2.8q(),M=z.d1(d2,K,jB);C(M&&p?(M[p]=jA):1k)};z.6q=B(jz,jy,jx){C z.d1(jz.1A("."),jy,jx)};z.r8=B(jw,M){C!!z.6q(jw,U,M)};z["3u"]=B(d0){C z.1W.3u?z.1W.3u(d0):3u(d0)};z.ia=B(jv,cZ,cX){A 8y="r7: "+jv;if(cZ){8y+=" "+cZ}if(cX){8y+=" -- r6 be r5 in cY: "+cX}1z.1K(8y)};z.r4=B(ju,cW){A cV="r3: "+ju+" -- r2 r1 4F r0 qZ qY.";if(cW){cV+=" "+cW}1z.1K(cV)};(B(){A cR={53:{},6p:0,1h:{},8k:{z:{1p:"z",1Z:"."},cU:{1p:"cU",1Z:"../qX/cU"},cT:{1p:"cT",1Z:"cT"}},cN:B(cS){A mp=D.8k;C jp(mp[cS]&&mp[cS].1Z)},jk:B(8x){A mp=D.8k;if(D.cN(8x)){C mp[8x].1Z}C 8x},8v:[],6t:U,56:[],8t:[],8u:U};R(A cQ in cR){z[cQ]=cR[cQ]}})();z.jg=B(8w,cP,cb){A 1g=(((8w.2s(0)=="/"||8w.1f(/^\\w+:/)))?"":D.51)+8w;if(1o.jt&&z.c8){1g+="?"+67(1o.jt).2f(/\\W+/g,"")}1u{C!cP?D.cO(1g,cb):D.jq(1g,cP,cb)}1y(e){1z.1K(e);C U}};z.cO=B(1g,cb){if(D.8v[1g]){C K}A 6u=D.iR(1g,K);if(!6u){C U}D.8v[1g]=K;D.8v.Y(1g);if(cb){6u="("+6u+")"}A jr=z["3u"](6u+"\\r\\n//@ qW="+1g);if(cb){cb(jr)}C K};z.jq=B(1g,jo,cb){A ok=U;1u{ok=D.cO(1g,cb)}1y(e){1z.1K("qV je ",1g," 4G 9f: ",e)}C jp(ok&&D.53[jo])};z.6m=B(){D.8u=K;D.6t=K;A 57=D.56;D.56=[];R(A x=0;x<57.G;x++){57[x]()}D.8u=U;if(z.6t&&z.6p==0&&D.56.G>0){z.8s()}};z.ck=B(){A 57=D.8t;1s(57.G){(57.8q())()}};z.qU=B(M,jn){A d=z;if(P.G==1){d.56.Y(M)}I{if(P.G>1){d.56.Y(B(){M[jn]()})}}if(d.6t&&d.6p==0&&!d.8u){d.8s()}};z.dW=B(M,jm){A d=z;if(P.G==1){d.8t.Y(M)}I{if(P.G>1){d.8t.Y(B(){M[jm]()})}}};z.iM=B(){if(D.6t){C}if(D.6p>0){1z.1K("qT qS in qR!");C}z.8s()};z.8s=B(){if(V 5c=="8b"||(1o["qQ"]&&z.2M)){5c("z.6m();",0)}I{z.6m()}};z.cF=B(jl){A 4v=jl.1A(".");R(A i=4v.G;i>0;i--){A 8r=4v.2w(0,i).22(".");if((i==1)&&!D.cN(8r)){4v[0]="../"+4v[0]}I{A cM=D.jk(8r);if(cM!=8r){4v.3S(0,i,cM);3f}}}C 4v};z.jj=U;z.8m=B(2T,qP,55){55=D.jj||55;A 54=D.53[2T];if(54){C 54}A cL=2T.1A(".");A 3L=D.cF(2T);A jh=((3L[0].2s(0)!="/")&&!3L[0].1f(/^\\w+:/));A ji=3L[3L.G-1];A 3m;if(ji=="*"){2T=cL.2w(0,-1).22(".");3L.8q();3m=3L.22("/")+"/"+(1o["qO"]||"qN")+".js";if(jh&&3m.2s(0)=="/"){3m=3m.2w(1)}}I{3m=3L.22("/")+".js";2T=cL.22(".")}A jf=(!55)?2T:L;A ok=D.jg(3m,jf);if((!ok)&&(!55)){2m S 1O("qM 3O 4E \'"+2T+"\'; 72 qL \'"+3m+"\'")}if((!55)&&(!D["qK"])){54=D.53[2T];if(!54){2m S 1O("qJ \'"+2T+"\' is 3O qI a8 je \'"+3m+"\'")}}C 54};z.8c=z.8m;z.1Q=B(cK){A cJ=cK+"";A 8p=cJ;A 6s=cK.1A(/\\./);if(6s[6s.G-1]=="*"){6s.8q();8p=6s.22(".")}A 8o=z.6q(8p,K);D.53[cJ]=8o;D.53[8p]=8o;C 8o};z.qH=B(8n){A jd=8n["qG"]||[];A cI=jd.3U(8n[z.j4]||8n["aY"]||[]);R(A x=0;x<cI.G;x++){A 8l=cI[x];if(8l.1P==4e){z.8m.14(z,8l)}I{z.8m(8l)}}};z.jb=B(jc,qF){if(jc===K){A cH=[];R(A i=1;i<P.G;i++){cH.Y(P[i])}z.8c.14(z,cH)}};z.qE=z.jb;z.io=B(cG,ja){D.8k[cG]={1p:cG,1Z:ja}};z.qD=B(qC,qB,qA,qz){z.8c("z.j9");z.j9.qy.14(z.qx,P)};(B(){A j7=S 9G("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?$");A j6=S 9G("^((([^:]+:)?([^@]+))@)?([^:]*)(:([0-9]+))?$");z.4r=B(){A n=L;A 1V=P;A 1g=1V[0];R(A i=1;i<1V.G;i++){if(!1V[i]){6c}A 1t=S z.4r(1V[i]+"");A 4u=S z.4r(1g+"");if((1t.28=="")&&(!1t.4t)&&(!1t.3l)&&(!1t.1r)){if(1t.52!=n){4u.52=1t.52}1t=4u}I{if(!1t.4t){1t.4t=4u.4t;if(!1t.3l){1t.3l=4u.3l;if(1t.28.2s(0)!="/"){A j8=4u.28.21(0,4u.28.31("/")+1)+1t.28;A 1X=j8.1A("/");R(A j=0;j<1X.G;j++){if(1X[j]=="."){if(j==1X.G-1){1X[j]=""}I{1X.3S(j,1);j--}}I{if(j>0&&!(j==1&&1X[0]=="")&&1X[j]==".."&&1X[j-1]!=".."){if(j==(1X.G-1)){1X.3S(j,1);1X[j-1]=""}I{1X.3S(j-1,2);j-=2}}}}1t.28=1X.22("/")}}}}1g="";if(1t.4t){1g+=1t.4t+":"}if(1t.3l){1g+="//"+1t.3l}1g+=1t.28;if(1t.1r){1g+="?"+1t.1r}if(1t.52){1g+="#"+1t.52}}D.1g=1g.2i();A r=D.1g.1f(j7);D.4t=r[2]||(r[1]?"":n);D.3l=r[4]||(r[3]?"":n);D.28=r[5];D.1r=r[7]||(r[6]?"":n);D.52=r[9]||(r[8]?"":n);if(D.3l!=n){r=D.3l.1f(j6);D.8X=r[3]||n;D.8W=r[4]||n;D.qw=r[5];D.qv=r[7]||n}};z.4r.1C.2i=B(){C D.1g}})();z.qu=B(j5,2E){A 2B=z.cF(j5).22("/");if(!2B){C L}if(2B.31("/")!=2B.G-1){2B+="/"}A cE=2B.T(":");if(2B.2s(0)!="/"&&(cE==-1||cE>2B.T("/"))){2B=z.51+2B}C S z.4r(2B,2E)};if(V 26!="1k"){z.c8=K;z.j4="qt";(B(){A d=z;if(1q&&1q.4I){A 8j=1q.4I("ak");A j3=/z(\\.qs)?\\.js([\\?\\.]|$)/i;R(A i=0;i<8j.G;i++){A 4X=8j[i].5t("4X");if(!4X){6c}A m=4X.1f(j3);if(m){if(!1o["51"]){1o["51"]=4X.21(0,m.hK)}A cD=8j[i].5t("1o");if(cD){A cC=3u("({ "+cD+" })");R(A x in cC){1o[x]=cC[x]}}3f}}}d.51=1o["51"];A n=cq;A 8i=n.iL;A 4Z=n.qr;A 6r=2k(4Z);d.2M=(8i.T("qq")>=0)?6r:0;d.6B=(4Z.T("qo")>=0)||(4Z.T("j2")>=0)?6r:0;d.3o=(4Z.T("j2")>=0)?6r:0;A j1=8i.T("qn");d.gu=d.7B=((j1>=0)&&(!d.6B))?6r:0;d.j0=0;d.1l=0;d.iV=0;1u{if(d.7B){d.j0=2k(8i.1A("qm/")[1].1A(" ")[0])}if((1q.gx)&&(!d.2M)){d.1l=2k(4Z.1A("qk ")[1].1A(";")[0])}}1y(e){}if(z.1l&&(26.8f.cu==="9q:")){1o.iT=K}d.iX=B(){A 2A;A qj;A cB=d.6q("cz.cy");if(cB){C cB}if(V iZ!="1k"){2A=S iZ()}I{if(d.1l){1u{2A=S 9j("qi.qh")}1y(e){}}I{if(cq.qg["8Z/x-iY"]){2A=1q.a9("8b");2A.cA("Z","8Z/x-iY");2A.cA("3n",0);2A.cA("58",0);2A.1c.gq="7C";1q.5K.4c(2A)}}}if(!2A){C L}z.88("cz.cy.qf",2A);C z.6q("cz.cy")};A iW=d.iX();if(iW){d.iV=K}A cm=1q["aX"];d.qe=(cm=="aW")||(cm=="gr")||(d.1l<6);d.8h=1o.8h||(d.1l?n.qd:n.qc).1M();d.qb=1z.1K;d.cx=["iU.8g","em.8g","iU.8g.4.0"];d.9b=B(){A 4s=L;A cv=L;if(!z.1l||!1o.iT){1u{4s=S qa()}1y(e){}}if(!4s){R(A i=0;i<3;++i){A cw=z.cx[i];1u{4s=S 9j(cw)}1y(e){cv=e}if(4s){z.cx=[cw];3f}}}if(!4s){2m S 1O("8g 3O q9: "+cv)}C 4s};d.8Y=B(iS){A 4Y=iS.3N||0;C((4Y>=q8)&&(4Y<q7))||(4Y==q6)||(4Y==q5)||(!4Y&&(8f.cu=="9q:"||8f.cu=="q4:"))};A cs=1q.4I("q3");A iQ=(cs&&cs.G>0);d.iR=B(1g,iP){A 3K=D.9b();if(!iQ&&z.4r){1g=(S z.4r(26.8f,1g)).2i()}3K.dL("dD",1g,U);1u{3K.dI(L);if(!d.8Y(3K)){A 1G=1O("q2 4F 4E "+1g+" 3N:"+3K.3N);1G.3N=3K.3N;1G.2G=3K.2G;2m 1G}}1y(e){if(iP){C L}2m e}C 3K.2G}})();z.iO=U;z.6o=B(e){z.iO=K;A cr=(e&&e.Z)?e.Z.1M():"4E";if(P.2O.iN||(cr!="q1"&&cr!="4E")){C}P.2O.iN=K;if(V z["8e"]!="1k"){dX(z.8e);63 z.8e}if(z.6p==0){z.iM()}};if(1q.66){if(z.2M||(z.7B&&(1o["q0"]===K))){1q.66("pZ",z.6o,L)}26.66("4E",z.6o,L)}if(/(pY|pX)/i.6Z(cq.iL)){z.8e=dN(B(){if(/6m|iJ/.6Z(1q.6F)){z.6o()}},10)}(B(){A 3g=26;A 8d=B(cp,fp){A iK=3g[cp]||B(){};3g[cp]=B(){fp.14(3g,P);iK.14(3g,P)}};if(z.1l){1q.fJ("<iI"+"iH pW 4X=\\"//:\\" "+"pV=\\"if(D.6F==\'iJ\'){z.6o();}\\">"+"</iI"+"iH>");A co=K;8d("iG",B(){3g.5c(B(){co=U},0)});8d("pU",B(){if(co){z.ck()}});1u{1q.pT.2P("v","pS:pR-pQ-pP:pO");1q.pN().pM("v\\\\:*","pL:2E(#aY#pK)")}1y(e){}}I{8d("iG",B(){z.ck()})}})();z.pJ=B(){};z.1e=26["1q"]||L;z.3E=B(){C z.1e.3E||z.1e.4I("3E")[0]};z.ch=B(iF,iE){z.1W=iF;z.1e=iE};z.cf=B(4q,6n,iD){if((6n)&&((V 4q=="3c")||(4q 1N 67))){4q=6n[4q]}C(6n?4q.14(6n,iD||[]):4q())};z.pI=B(cj,iC,iB,iA){A cg;A iz=z.1W;A iy=z.1e;1u{z.ch(cj,cj.1q);cg=z.cf(iC,iB,iA)}ir{z.ch(iz,iy)}C cg};z.pH=B(ix,iw,iv,iu){A ce;A ip=z.1e;1u{z.1e=ix;ce=z.cf(iw,iv,iu)}ir{z.1e=ip}C ce};if(1o["cd"]){R(A cc in 1o["cd"]){z.io(cc,1o["cd"][cc])}}}if(1o.im){if(!1z.ca){z.8c("z.pG.ca")}}}if(!z.1h["z.X.c9"]){z.1h["z.X.c9"]=K;z.1Q("z.X.c9");z.1R=B(it){C(V it=="3c"||it 1N 67)};z.2l=B(it){C(it&&it 1N 4e||V it=="6a"||((V z["1H"]!="1k")&&(it 1N z.1H)))};if(z.c8&&z.3o){z.1Y=B(it){if((V(it)=="B")&&(it=="[8b 1H]")){C U}C(V it=="B"||it 1N bI)}}I{z.1Y=B(it){C(V it=="B"||it 1N bI)}}z.ib=B(it){if(V it=="1k"){C U}C(it===L||V it=="8b"||z.2l(it)||z.1Y(it))};z.pF=B(it){A d=z;if((!it)||(V it=="1k")){C U}if(d.1R(it)){C U}if(d.1Y(it)){C U}if(d.2l(it)){C K}if((it.5w)&&(it.5w.1M()=="3R")){C U}if(pE(it.G)){C K}C U};z.pD=B(it){if(!it){C U}C!z.1Y(it)&&/\\{\\s*\\[il 5h\\]\\s*\\}/.6Z(67(it))};z.c7=B(M,4W){A 8a={};R(A x in 4W){if((V 8a[x]=="1k")||(8a[x]!=4W[x])){M[x]=4W[x]}}if(z.1l){A p=4W.2i;if((V(p)=="B")&&(p!=M.2i)&&(p!=8a.2i)&&(p!="\\pC 2i() {\\n    [il 5h]\\n}\\n")){M.2i=4W.2i}}C M};z.1x=B(M,pB){R(A i=1,l=P.G;i<l;i++){z.c7(M,P[i])}C M};z.4M=B(c6,pA){R(A i=1,l=P.G;i<l;i++){z.c7(c6.1C,P[i])}C c6};z.ig=B(c5,89){A ij=z.4d(P,2);A ik=z.1R(89);C B(){A ih=z.4d(P);A f=(ik?(c5||z.1W)[89]:89);C(f)&&(f.14(c5||D,ij.3U(ih)))}};z.2p=B(2z,3k){if(P.G>2){C z.ig.14(z,P)}if(!3k){3k=2z;2z=L}if(z.1R(3k)){2z=2z||z.1W;if(!2z[3k]){2m(["z.2p: ie[\\"",3k,"\\"] is L (ie=\\"",2z,"\\")"].22(""))}C B(){C 2z[3k].14(2z,P||[])}}I{C(!2z?3k:B(){C 3k.14(2z,P||[])})}};z.6j=B(M,c3){B c4(){};c4.1C=M;A c2=S c4();if(c3){z.1x(c2,c3)}C c2};z.7X=B(pz){A Q=[L];C z.2p.14(z,Q.3U(z.4d(P)))};z.4d=B(M,ic){A Q=[];R(A x=ic||0;x<M.G;x++){Q.Y(M[x])}C Q};z.c1=B(o){if(!o){C o}if(z.2l(o)){A r=[];R(A i=0;i<o.G;++i){r.Y(z.c1(o[i]))}C r}I{if(z.ib(o)){if(o.2t&&o.a7){C o.a7(K)}I{A r=S o.1P();R(A i in o){if(!(i in r)||r[i]!=o[i]){r[i]=z.c1(o[i])}}C r}}}C o};z.7g=B(2H){C 2H.2f(/^\\s\\s*/,"").2f(/\\s\\s*$/,"")}}if(!z.1h["z.X.2r"]){z.1h["z.X.2r"]=K;z.1Q("z.X.2r");z.2r=B(6l,4p,3j){if(z.1Y(3j)||(P.G>3)){z.ia("z.2r: R 9P \'"+6l+"\' py pw B as \'1P\' pv pu of as a pt i3.","","1.0");A c=3j;3j=P[3]||{};3j.1P=c}A dd=P.2O,4V=L;if(z.2l(4p)){4V=4p;4p=4V.3a()}if(4V){R(A i=0,m;i<4V.G;i++){m=4V[i];if(!m){2m("ps #"+i+" 4F pr of "+6l+" is L. pq\'s pp a po pl is 3O 6m.")}4p=dd.6j(4p,m)}}A i9=(3j||0).1P,6k=dd.6j(4p),fn;R(A i in 3j){if(z.1Y(fn=3j[i])&&(!0[i])){fn.i4=i}}z.4M(6k,{4o:6l,bY:i9,bZ:L},3j||0);6k.1C.1P=6k;C z.88(6l,6k)};z.1x(z.2r,{6j:B(c0,i8){A bp=(c0||0).1C,mp=(i8||0).1C;A 2S=z.2r.i7();z.1x(2S,{84:bp,1x:mp});if(c0){2S.1C=z.6j(bp)}z.4M(2S,z.2r.i6,mp||0,{bY:L});2S.1C.1P=2S;2S.1C.4o=(bp||0).4o+"pk"+(mp||0).4o;z.88(2S.1C.4o,2S);C 2S},i7:B(){C B(){D.i5(P)}},i6:{i5:B(86){A c=86.2O,s=c.84,ct=s&&s.1P,m=c.1x,87=m&&m.1P,a=86,ii,fn;if(a[0]){if((fn=a[0]["bZ"])){a=fn.14(D,a)||a}}if(fn=c.1C.bZ){a=fn.14(D,a)||a}if(ct&&ct.14){ct.14(D,a)}if(87&&87.14){87.14(D,a)}if(ii=c.1C.bY){ii.14(D,86)}},bX:B(85){A c=D.1P,p,m;1s(c){p=c.84;m=c.1x;if(m==85||(m 1N 85.1P)){C p}if(m&&(m=m.bX(85))){C m}c=p&&p.1P}},6h:B(83,82,bW,6i){A p=bW,c,m,f;do{c=p.1P;m=c.1x;if(m&&(m=D.6h(83,82,m,6i))){C m}if((f=p[83])&&(6i==(f==82))){C p}p=c.84}1s(p);C!6i&&(p=D.bX(bW))&&D.6h(83,82,p,6i)},bU:B(2R,4U,bV){A a=P;if(!z.1R(a[0])){bV=4U;4U=2R;2R=4U.2O.i4}A c=4U.2O,p=D.1P.1C,a=bV||4U,fn,mp;if(D[2R]!=c||p[2R]==c){mp=D.6h(2R,c,p,K);if(!mp){2m(D.4o+": 1p i3 (\\""+2R+"\\") 4F bU pj 1f 2O (2r.js)")}p=D.6h(2R,c,mp,U)}fn=p&&p[2R];if(!fn){1z.1K(mp.4o+": no bU \\""+2R+"\\" ph pg (2r.js)");C}C fn.14(D,a)}}})}if(!z.1h["z.X.2c"]){z.1h["z.X.2c"]=K;z.1Q("z.X.2c");z.3i={i2:B(){C B(){A ap=4e.1C,c=P.2O,ls=c.2b,t=c.5V;A r=t&&t.14(D,P);R(A i in ls){if(!(i in ap)){ls[i].14(D,P)}}C r}},2P:B(6g,bT,i1){6g=6g||z.1W;A f=6g[bT];if(!f||!f.2b){A d=z.3i.i2();d.5V=f;d.2b=[];f=6g[bT]=d}C f.2b.Y(i1)},3J:B(i0,hZ,bS){A f=(i0||z.1W)[hZ];if(f&&f.2b&&bS--){63 f.2b[bS]}}};z.2c=B(M,pd,pc,pa,p9){A a=P,F=[],i=0;F.Y(z.1R(a[0])?L:a[i++],a[i++]);A a1=a[i+1];F.Y(z.1R(a1)||z.1Y(a1)?a[i++]:L,a[i++]);R(A l=a.G;i<l;i++){F.Y(a[i])}C z.by.14(D,F)};z.by=B(M,bR,hY,hX){A l=z.3i,h=l.2P(M,bR,z.2p(hY,hX));C[M,bR,h,l]};z.p8=B(6f){if(6f&&6f[0]!==1k){z.bv.14(D,6f);63 6f[0]}};z.bv=B(M,hV,hU,hW){hW.3J(M,hV,hU)};z.80={};z.p7=B(bQ,hT,hS){C[bQ,z.3i.2P(z.80,bQ,z.2p(hT,hS))]};z.p6=B(81){if(81){z.3i.3J(z.80,81[0],81[1])}};z.hQ=B(hR,F){A f=z.80[hR];(f)&&(f.14(D,F||[]))};z.p5=B(hP,M,bP){A pf=B(){z.hQ(hP,P)};C(bP)?z.2c(M,bP,pf):z.2c(M,pf)}}if(!z.1h["z.X.30"]){z.1h["z.X.30"]=K;z.1Q("z.X.30");z.30=B(hO){D.bM=[];D.id=D.hN();D.2y=-1;D.3M=0;D.4R=[L,L];D.bO=hO;D.7Z=U};z.4M(z.30,{hN:(B(){A n=1;C B(){C n++}})(),4C:B(){if(D.2y==-1){if(D.bO){D.bO(D)}I{D.7Z=K}if(D.2y==-1){A 1G=S 1O("30 p4");1G.dY="4C";D.5i(1G)}}I{if((D.2y==0)&&(D.4R[0]1N z.30)){D.4R[0].4C()}}},7V:B(1v){D.2y=((1v 1N 1O)?1:0);D.4R[D.2y]=1v;D.7U()},bN:B(){if(D.2y!=-1){if(!D.7Z){2m S 1O("p3 p2!")}D.7Z=U;C}},dM:B(1v){D.bN();D.7V(1v)},5i:B(1v){D.bN();if(!(1v 1N 1O)){1v=S 1O(1v)}D.7V(1v)},9e:B(cb,4T){A 6e=z.2p(cb,4T);if(P.G>2){6e=z.7X(6e,P,2)}C D.5k(6e,6e)},ef:B(cb,4T){A 7Y=z.2p(cb,4T);if(P.G>2){7Y=z.7X(7Y,P,2)}C D.5k(7Y,L)},ed:B(cb,4T){A 7W=z.2p(cb,4T);if(P.G>2){7W=z.7X(7W,P,2)}C D.5k(L,7W)},5k:B(cb,eb){D.bM.Y([cb,eb]);if(D.2y>=0){D.7U()}C D},7U:B(){A bL=D.bM;A 4n=D.2y;A 1v=D.4R[4n];A 4S=D;A cb=L;1s((bL.G>0)&&(D.3M==0)){A f=bL.3a()[4n];if(!f){6c}1u{1v=f(1v);4n=((1v 1N 1O)?1:0);if(1v 1N z.30){cb=B(1v){4S.7V(1v);4S.3M--;if((4S.3M==0)&&(4S.2y>=0)){4S.7U()}};D.3M++}}1y(1G){1z.1K(1G);4n=1;1v=1G}}D.2y=4n;D.4R[4n]=1v;if((cb)&&(D.3M)){1v.9e(cb)}}})}if(!z.1h["z.X.2e"]){z.1h["z.X.2e"]=K;z.1Q("z.X.2e");z.5m=B(2e){1u{C 3u("("+2e+")")}1y(e){1z.1K(e);C 2e}};z.bK=B(2H){C("\\""+2H.2f(/(["\\\\])/g,"\\\\$1")+"\\"").2f(/[\\f]/g,"\\\\f").2f(/[\\b]/g,"\\\\b").2f(/[\\n]/g,"\\\\n").2f(/[\\t]/g,"\\\\t").2f(/[\\r]/g,"\\\\r")};z.hM="\\t";z.eq=B(it,4l,4P){4P=4P||"";A 4k=(4l?4P+z.hM:"");A 6b=(4l?"\\n":"");A 4Q=V(it);if(4Q=="1k"){C"1k"}I{if((4Q=="4J")||(4Q=="p1")){C it+""}I{if(it===L){C"L"}}}if(4Q=="3c"){C z.bK(it)}A 6d=P.2O;A 4m;if(V it.hL=="B"){4m=it.hL();if(it!==4m){C 6d(4m,4l,4k)}}if(V it.2e=="B"){4m=it.2e();if(it!==4m){C 6d(4m,4l,4k)}}if(z.2l(it)){A 1v=[];R(A i=0;i<it.G;i++){A 1U=6d(it[i],4l,4k);if(V(1U)!="3c"){1U="1k"}1v.Y(6b+4k+1U)}C"["+1v.22(", ")+6b+4P+"]"}if(4Q=="B"){C L}A bJ=[];R(A 1i in it){A 7T;if(V(1i)=="4J"){7T="\\""+1i+"\\""}I{if(V(1i)=="3c"){7T=z.bK(1i)}I{6c}}1U=6d(it[1i],4l,4k);if(V(1U)!="3c"){6c}bJ.Y(6b+4k+7T+": "+1U)}C"{"+bJ.22(", ")+6b+4P+"}"}}if(!z.1h["z.X.6a"]){z.1h["z.X.6a"]=K;z.1Q("z.X.6a");(B(){A 69=B(Q,M,cb){C[(z.1R(Q)?Q.1A(""):Q),(M||z.1W),(z.1R(cb)?(S bI("1m","hK","6a",cb)):cb)]};z.1x(z,{T:B(bH,hH,hI,hJ){A i=0,2q=1,1d=bH.G;if(hJ){i=1d-1;2q=1d=-1}R(i=hI||i;i!=1d;i+=2q){if(bH[i]==hH){C i}}C-1},31:B(hG,hF,hE){C z.T(hG,hF,hE,K)},1n:B(Q,hD,M){if(!Q||!Q.G){C}A 1I=69(Q,M,hD);Q=1I[0];R(A i=0,l=1I[0].G;i<l;i++){1I[2].2d(1I[1],Q[i],i,Q)}},bE:B(bF,Q,hC,M){A 1I=69(Q,M,hC);Q=1I[0];R(A i=0,l=Q.G;i<l;i++){A bG=!!1I[2].2d(1I[1],Q[i],i,Q);if(bF^bG){C bG}}C bF},ah:B(Q,hB,hA){C D.bE(K,Q,hB,hA)},ag:B(Q,hz,hy){C D.bE(U,Q,hz,hy)},23:B(Q,7t,M){A 1I=69(Q,M,7t);Q=1I[0];A bD=((P[3])?(S P[3]()):[]);R(A i=0;i<Q.G;++i){bD.Y(1I[2].2d(1I[1],Q[i],i,Q))}C bD},3T:B(Q,hx,M){A 1I=69(Q,M,hx);Q=1I[0];A bC=[];R(A i=0;i<Q.G;i++){if(1I[2].2d(1I[1],Q[i],i,Q)){bC.Y(Q[i])}}C bC}})})()}if(!z.1h["z.X.1J"]){z.1h["z.X.1J"]=K;z.1Q("z.X.1J");z.1J=B(bB){if(bB){D.hw(bB)}};z.1J.hp={p0:[0,0,0],oZ:[60,60,60],oY:[2j,2j,2j],oX:[1T,1T,1T],oW:[2j,0,0],oV:[1T,0,0],oU:[2j,0,2j],oT:[1T,0,1T],oS:[0,2j,0],oR:[0,1T,0],oQ:[2j,2j,0],oP:[1T,1T,0],oO:[0,0,2j],oN:[0,0,1T],oM:[0,2j,2j],oL:[0,1T,1T]};z.4M(z.1J,{r:1T,g:1T,b:1T,a:1,bz:B(r,g,b,a){A t=D;t.r=r;t.g=g;t.b=b;t.a=a},hw:B(2Q){A d=z;if(d.1R(2Q)){d.hq(2Q,D)}I{if(d.2l(2Q)){d.7P(2Q,D)}I{D.bz(2Q.r,2Q.g,2Q.b,2Q.a);if(!(2Q 1N d.1J)){D.7Q()}}}C D},7Q:B(){C D},oK:B(){A t=D;C[t.r,t.g,t.b]},oJ:B(){A t=D;C[t.r,t.g,t.b,t.a]},oI:B(){A Q=z.23(["r","g","b"],B(x){A s=D[x].2i(16);C s.G<2?"0"+s:s},D);C"#"+Q.22("")},8F:B(hv){A t=D,7S=t.r+", "+t.g+", "+t.b;C(hv?"hs("+7S+", "+t.a:"7S("+7S)+")"},2i:B(){C D.8F(K)}});z.d8=B(bA,1d,hu,M){A d=z,t=M||S z.1J();d.1n(["r","g","b","a"],B(x){t[x]=bA[x]+(1d[x]-bA[x])*hu;if(x!="a"){t[x]=2Y.oH(t[x])}});C t.7Q()};z.ho=B(ht,M){A m=ht.1M().1f(/^hs?\\(([\\s\\.,0-9]+)\\)/);C m&&z.7P(m[1].1A(/\\s*,\\s*/),M)};z.hn=B(4j,M){A d=z,t=M||S d.1J(),7R=(4j.G==4)?4:8,hr=(1<<7R)-1;4j=2V("oG"+4j.3b(1));if(2L(4j)){C L}d.1n(["b","g","r"],B(x){A c=4j&hr;4j>>=7R;t[x]=7R==4?17*c:c});t.a=1;C t};z.7P=B(a,M){A t=M||S z.1J();t.bz(2V(a[0]),2V(a[1]),2V(a[2]),2V(a[3]));if(2L(t.a)){t.a=1}C t.7Q()};z.hq=B(2H,M){A a=z.1J.hp[2H];C a&&z.7P(a,M)||z.ho(2H,M)||z.hn(2H,M)}}if(!z.1h["z.X"]){z.1h["z.X"]=K;z.1Q("z.X")}if(!z.1h["z.X.5Z"]){z.1h["z.X.5Z"]=K;z.1Q("z.X.5Z");(B(){A 1j=z.b2={2P:B(E,68,fp){if(!E){C}68=1j.4O(68);fp=1j.7G(68,fp);E.66(68,fp,U);C fp},3J:B(E,hm,hl){(E)&&(E.oF(1j.4O(hm),hl,U))},4O:B(1p){C(1p.2w(0,2)=="on"?1p.2w(2):1p)},7G:B(1p,fp){C(1p!="4b"?fp:B(e){C fp.2d(D,1j.4i(e,D))})},4i:B(H,oE){4w(H.Z){2X"4b":1j.7K(H);3f}C H},7K:B(H){H.oD=(H.3h?67.oC(H.3h):"")}};z.oB=B(H,hk){C 1j.4i(H,hk)};z.gY=B(H){H.7J();H.7I()};A 7O=z.3i;z.by=B(M,bx,hh,hg,hi){A hj=M&&(M.2t||M.oA||M.66);A bw=!hj?0:(!hi?1:2),l=[z.3i,1j,7O][bw];A h=l.2P(M,bx,z.2p(hh,hg));C[M,bx,h,bw]};z.bv=B(M,he,hd,hf){([z.3i,1j,7O][hf]).3J(M,he,hd)};z.5W={oz:8,gV:9,oy:12,ox:13,ow:16,ov:17,ou:18,gG:19,ot:20,os:27,or:32,b5:33,b4:34,gE:35,gF:36,b7:37,b9:38,b6:39,b8:40,gD:45,8S:46,oq:47,oo:91,om:92,ol:93,oj:96,oi:97,oh:98,og:99,oe:6D,od:oc,ob:oa,o9:o8,o7:o6,o5:o4,o3:bi,o2:o1,o0:nZ,nY:nX,nW:nV,nU:bk,gS:nT,gR:nS,gQ:nR,gP:nQ,gO:nP,gN:nO,gM:nN,gL:nM,gK:nL,gJ:nK,gI:nJ,gH:nI,nH:nG,nF:nE,nD:nC,gB:nB,gC:nA};if(z.1l){bf=B(e,5h){1u{C(e.3I=5h)}1y(e){C 0}};A 61=z.3i;if(!1o.nz){7O=61=z.gy={b3:[],2P:B(64,bu,hc){64=64||z.1W;A f=64[bu];if(!f||!f.2b){A d=z.gz();d.5V=f&&(7M.Y(f)-1);d.2b=[];f=64[bu]=d}C f.2b.Y(7M.Y(hc)-1)},3J:B(hb,ha,7N){A f=(hb||z.1W)[ha],l=f&&f.2b;if(f&&l&&7N--){63 7M[l[7N]];63 l[7N]}}};A 7M=61.b3}z.1x(1j,{2P:B(E,62,fp){if(!E){C}62=1j.4O(62);if(62=="h3"){A kd=E.bs;if(!kd||!kd.2b||!kd.h9){1j.2P(E,"bs",1j.h4);E.bs.h9=K}}C 61.2P(E,62,1j.7G(fp))},3J:B(E,h8,h7){61.3J(E,1j.4O(h8),h7)},4O:B(7L){C(7L.2w(0,2)!="on"?"on"+7L:7L)},ny:B(){},4i:B(H,4N){if(!H){A w=(4N)&&((4N.aD||4N.1q||4N).nx)||26;H=w.5Z}if(!H){C(H)}H.5V=H.br;H.bh=(4N||H.br);H.nw=H.nv;H.nu=H.nr;A bq=H.br,1e=(bq&&bq.aD)||1q;A bn=((z.1l<6)||(1e["aX"]=="aW"))?1e.3E:1e.5K;A bm=z.aB();H.nq=H.np+z.aH(bn.5I||0)-bm.x;H.nn=H.nm+(bn.5G||0)-bm.y;if(H.Z=="fk"){H.h6=H.nl}if(H.Z=="fj"){H.h6=H.nk}H.7I=1j.bc;H.7J=1j.ba;C 1j.h5(H)},h5:B(H){4w(H.Z){2X"4b":A c=("3h"in H?H.3h:H.3I);if(c==10){c=0;H.3I=13}I{if(c==13||c==27){c=0}I{if(c==3){c=99}}}H.3h=c;1j.7K(H);3f}C H},gZ:{bi:42,bk:47,h2:59,nj:43,ni:44,nh:45,ng:46,nf:47,60:96,h1:91,nb:92,na:93,h0:39},h4:B(H){A kp=H.bh.h3;if(!kp||!kp.2b){C}A k=H.3I;A bj=(k!=13)&&(k!=32)&&(k!=27)&&(k<48||k>90)&&(k<96||k>bk)&&(k<h2||k>60)&&(k<h1||k>h0);if(bj||H.5Y){A c=(bj?0:k);if(H.5Y){if(k==3||k==13){C}I{if(c>95&&c<bi){c-=48}I{if((!H.5X)&&(c>=65&&c<=90)){c+=32}I{c=1j.gZ[c]||c}}}}A 2x=1j.7H(H,{Z:"4b",2x:K,3h:c});kp.2d(H.bh,2x);H.bg=2x.bg;H.bd=2x.bd;bf(H,2x.3I)}},bc:B(){D.bg=K},ba:B(){D.n9=D.3I;if(D.5Y){bf(D,0)}D.bd=U}});z.gY=B(H){H=H||26.5Z;1j.bc.2d(H);1j.ba.2d(H)}}1j.7H=B(H,gX){A 2x=z.1x({},H,gX);1j.7K(2x);2x.7J=B(){H.7J()};2x.7I=B(){H.7I()};C 2x};if(z.2M){z.1x(1j,{4i:B(H,n8){4w(H.Z){2X"4b":A c=H.n7;if(c==3){c=99}c=((c<41)&&(!H.5X)?0:c);if((H.5Y)&&(!H.5X)&&(c>=65)&&(c<=90)){c+=32}C 1j.7H(H,{3h:c})}C H}})}if(z.3o){z.1x(1j,{4i:B(H,n6){4w(H.Z){2X"4b":A c=H.3h,s=H.5X,k=H.3I;k=k||gA[H.gW]||0;if(H.gW=="n5"){c=0}I{if((H.5Y)&&(c>0)&&(c<27)){c+=96}I{if(c==z.5W.gU){c=z.5W.gV;s=K}I{c=(c>=32&&c<gT?c:0)}}}C 1j.7H(H,{3h:c,5X:s,3I:k})}C H}});z.1x(z.5W,{gU:25,b9:gT,b8:n4,b7:n3,b6:n2,gS:n1,gR:n0,gQ:mZ,gP:mY,gO:mX,gN:mW,gM:mV,gL:mU,gK:mT,gJ:mS,gI:mR,gH:mQ,gG:mP,8S:mO,gF:mN,gE:mM,b5:mL,b4:mK,gD:mJ,mI:mH,gC:mG,gB:mF});A dk=z.5W,gA={"mE":dk.b9,"mD":dk.b8,"mC":dk.b7,"mB":dk.b6,"mA":dk.b5,"mz":dk.b4}}})();if(z.1l){z.gz=B(){C B(){A ap=4e.1C,h=z.gy.b3,c=P.2O,ls=c.2b,t=h[c.5V];A r=t&&t.14(D,P);R(A i in ls){if(!(i in ap)){h[ls[i]].14(D,P)}}C r}};z.b2.7G=B(fp){A f=z.b2.4i;C B(e){C fp.2d(D,f(e,D))}}}}if(!z.1h["z.X.b1"]){z.1h["z.X.b1"]=K;z.1Q("z.X.b1");1u{1q.my("mx",U,K)}1y(e){}if(z.1l||z.2M){z.1D=B(id,1e){if(z.1R(id)){A b0=(1e||z.1e);A 11=b0.gv(id);if((11)&&(11.gw.id.1Z==id)){C 11}I{A 5U=b0.gx[id];if(!5U){C}if(!5U.G){C 5U}A i=0;1s(11=5U[i++]){if(11.gw.id.1Z==id){C 11}}}}I{C id}}}I{z.1D=B(id,1e){if(z.1R(id)){C(1e||z.1e).gv(id)}I{C id}}}(B(){A 5T=L;z.mw=B(E){E=z.1D(E);1u{if(!5T){5T=1q.a9("mv")}5T.4c(E.1L?E.1L.fs(E):E);5T.9L=""}1y(e){}};z.mu=B(E,7F){1u{E=z.1D(E);7F=z.1D(7F);1s(E){if(E===7F){C K}E=E.1L}}1y(e){}C U};z.mt=B(E,5S){E=z.1D(E);if(z.gu){E.1c.ms=(5S)?"dg":"7C"}I{if(z.6B){E.1c.mr=(5S)?"8K":"7C"}I{if(z.1l){E.gs=(5S)?"":"on";z.1r("*",E).1n(B(gt){gt.gs=(5S)?"":"on"})}}}};A 5R=B(E,4h){4h.1L.mq(E,4h);C K};A aZ=B(E,4h){A pn=4h.1L;if(4h==pn.fm){pn.4c(E)}I{C 5R(E,4h.71)}C K};z.5E=B(E,2a,3H){if((!E)||(!2a)||(V 3H=="1k")){C U}E=z.1D(E);2a=z.1D(2a);if(V 3H=="4J"){A cn=2a.3W;if(((3H==0)&&(cn.G==0))||(cn.G==3H)){2a.4c(E);C K}if(3H==0){C 5R(E,2a.5A)}C aZ(E,cn[3H-1])}4w(3H.1M()){2X"mo":C 5R(E,2a);2X"a8":C aZ(E,2a);2X"9M":if(2a.5A){C 5R(E,2a.5A)}I{2a.4c(E);C K}3f;aY:2a.4c(E);C K}};z.aP="5g-3G";if(z.1l){A aV=1q.aX;z.aP=(aV=="aW")||(aV=="gr")||(z.1l<6)?"g5-3G":"5g-3G"}A 1E,dv=1q.mn;if(z.3o){1E=B(E){A s=dv.3F(E,L);if(!s&&E.1c){E.1c.gq="";s=dv.3F(E,L)}C s||{}}}I{if(z.1l){1E=B(E){C E.gn}}I{1E=B(E){C dv.3F(E,L)}}}z.3F=1E;if(!z.1l){z.4g=B(mm,gp){C 2k(gp)||0}}I{z.4g=B(go,2N){if(!2N){C 0}if(2N=="ml"){C 4}if(2N.2w&&(2N.2w(-2)=="px")){C 2k(2N)}4G(go){A gm=1c.2g;A gl=aU.2g;aU.2g=gn.2g;1u{1c.2g=2N;2N=1c.mk}1y(e){2N=0}1c.2g=gm;aU.2g=gl}C 2N}}z.ge=(z.1l?B(E){1u{C(E.mj.mi.2W/6D)}1y(e){C 1}}:B(E){C z.3F(E).2W});z.gf=(z.1l?B(E,7D){if(7D==1){E.1c.7E=E.1c.7E.2f(/gk:[^;]*;/i,"");if(E.gj.1M()=="gi"){z.1r("> gh",E).1n(B(i){i.1c.7E=i.1c.7E.2f(/gk:[^;]*;/i,"")})}}I{A o="mh(mg="+(7D*6D)+")";E.1c.3T=o}if(E.gj.1M()=="gi"){z.1r("> gh",E).1n(B(i){i.1c.3T=o})}C 7D}:B(E,gg){C E.1c.2W=gg});A 5Q={3n:K,58:K,2g:K,5J:K};A gd=B(E,Z,5P){Z=Z.1M();if(5Q[Z]===K){C z.4g(E,5P)}I{if(5Q[Z]===U){C 5P}I{if((Z.T("mf")>=0)||(Z.T("md")>=0)||(Z.T("3n")>=0)||(Z.T("58")>=0)||(Z.T("5q")>=0)||(Z.T("mc")>=0)||(Z.T("ma")>=0)){5Q[Z]=K;C z.4g(E,5P)}I{5Q[Z]=U;C 5P}}}};z.1c=B(E,5O,aT){A n=z.1D(E),F=P.G,op=(5O=="2W");if(F==3){C op?z.gf(n,aT):n.1c[5O]=aT}if(F==2&&op){C z.ge(n)}A s=z.3F(n);C(F==1)?s:gd(n,5O,s[5O])};z.7A=B(n,gc){A s=gc||1E(n),px=z.4g,l=px(n,s.m9),t=px(n,s.m8);C{l:l,t:t,w:l+px(n,s.m7),h:t+px(n,s.m6)}};z.5N=B(n,gb){A ne="7C",px=z.4g,s=gb||1E(n),bl=(s.m5!=ne?px(n,s.m4):0),bt=(s.m3!=ne?px(n,s.m2):0);C{l:bl,t:bt,w:bl+(s.m1!=ne?px(n,s.m0):0),h:bt+(s.lZ!=ne?px(n,s.lY):0)}};z.aN=B(n,ga){A s=ga||1E(n),p=z.7A(n,s),b=z.5N(n,s);C{l:p.l+b.l,t:p.t+b.t,w:p.w+b.w,h:p.h+b.h}};z.aM=B(n,g9){A s=g9||1E(n),px=z.4g,l=px(n,s.lX),t=px(n,s.lW),r=px(n,s.lV),b=px(n,s.lU);if(z.3o&&(s.ax!="fU")){r=l}C{l:l,t:t,w:l+r,h:t+b}};z.au=B(E,g8){A s=g8||1E(E),me=z.aM(E,s);A l=E.fT-me.l,t=E.fS-me.t;if(z.7B){A aS=2k(s.2g),aR=2k(s.5J);if(!2L(aS)&&!2L(aR)){l=aS,t=aR}I{A p=E.1L;if(p&&p.1c){A aQ=1E(p);if(aQ.lT!="lS"){A be=z.5N(p,aQ);l+=be.l,t+=be.t}}}}I{if(z.2M){A p=E.1L;if(p){A be=z.5N(p);l-=be.l,t-=be.t}}}C{l:l,t:t,w:E.6v+me.w,h:E.8D+me.h}};z.aK=B(E,g7){A s=g7||1E(E),pe=z.7A(E,s),be=z.5N(E,s),w=E.aF,h;if(!w){w=E.6v,h=E.8D}I{h=E.lR,be.w=be.h=0}if(z.2M){pe.l+=be.l;pe.t+=be.t}C{l:pe.l,t:pe.t,w:w-pe.w-be.w,h:h-pe.h-be.h}};z.lQ=B(E,g6){A s=g6||1E(E),pe=z.7A(E,s),cb=z.aK(E,s);C{l:cb.l-pe.l,t:cb.t-pe.t,w:cb.w+pe.w,h:cb.h+pe.h}};z.aL=B(E,l,t,w,h,u){u=u||"px";4G(E.1c){if(!2L(l)){2g=l+u}if(!2L(t)){5J=t+u}if(w>=0){3n=w+u}if(h>=0){58=h+u}}};z.aO=B(E){A n=E.5w;C(z.aP=="g5-3G")||(n=="lP")||(n=="lO")};z.fX=B(E,7z,7y,g4){A bb=z.aO(E);if(bb){A pb=z.aN(E,g4);if(7z>=0){7z+=pb.w}if(7y>=0){7y+=pb.h}}z.aL(E,g3,g3,7z,7y)};z.fY=B(E,g1,g0,5M,5L,g2){A s=g2||z.3F(E);A bb=z.aO(E),pb=bb?fZ:z.aN(E,s),mb=z.aM(E,s);if(5M>=0){5M=2Y.5q(5M-pb.w-mb.w,0)}if(5L>=0){5L=2Y.5q(5L-pb.h-mb.h,0)}z.aL(E,g1,g0,5M,5L)};A fZ={l:0,t:0,w:0,h:0};z.lN=B(E,3G){A n=z.1D(E),s=1E(n),b=3G;C!b?z.au(n,s):z.fY(n,b.l,b.t,b.w,b.h,s)};z.lM=B(E,3G){A n=z.1D(E),s=1E(n),b=3G;C!b?z.aK(n,s):z.fX(n,b.w,b.h,s)};A 5H=B(E,1a){if(!(E=(E||0).1L)){C 0}A 1U,aJ=0,2h=z.3E();1s(E&&E.1c){if(1E(E).ax=="lL"){C 0}1U=E[1a];if(1U){aJ+=1U-0;if(E==2h){3f}}E=E.1L}C aJ};z.fQ=B(){A 2h=z.3E();A 3g=z.1W;A de=z.1e.5K;C{y:(3g.lK||de.5G||2h.5G||0),x:(3g.lJ||z.aH(de.5I)||2h.5I||0)}};z.aG=B(){C V z.aI=="1k"?(z.aI=z.3F(z.3E()).lI=="lH"):z.aI};z.aB=B(){A de=z.1e.5K;if(z.1l>=7){C{x:de.aC().2g,y:de.aC().5J}}I{C{x:z.aG()||26.am==26?de.fW:de.6v-de.aF-de.fW,y:de.lG}}};z.aH=B(aE){if(z.1l&&!z.aG()){A de=z.1e.5K;C aE+de.aF-de.lF}C aE};z.fP=B(E,aw){A ay=E.aD;A J={x:0,y:0};A 7w=U;A db=z.3E();if(z.1l){A aA=E.aC();A az=z.aB();J.x=aA.2g-az.x;J.y=aA.5J-az.y}I{if(ay["fV"]){A bo=ay.fV(E);J.x=bo.x-5H(E,"5I");J.y=bo.y-5H(E,"5G")}I{if(E["fR"]){7w=K;A 7x;if(z.3o&&(1E(E).ax=="fU")&&(E.1L==db)){7x=db}I{7x=db.1L}if(E.1L!=db){A nd=E;if(z.2M){nd=db}J.x-=5H(nd,"5I");J.y-=5H(nd,"5G")}A 4f=E;do{A n=4f["fT"];if(!z.2M||n>0){J.x+=2L(n)?0:n}A m=4f["fS"];J.y+=2L(m)?0:m;4f=4f.fR}1s((4f!=7x)&&4f)}I{if(E["x"]&&E["y"]){J.x+=2L(E.x)?0:E.x;J.y+=2L(E.y)?0:E.y}}}}if(7w||aw){A av=z.fQ();A m=7w?(!aw?-1:0):1;J.y+=m*av.y;J.x+=m*av.x}C J};z.af=B(E,fO){A n=z.1D(E),s=1E(n),mb=z.au(n,s);A at=z.fP(n,fO);mb.x=at.x;mb.y=at.y;C mb}})();z.fL=B(E,fN){C((" "+E.3A+" ").T(" "+fN+" ")>=0)};z.7s=B(E,ar){A 7v=E.3A;if((" "+7v+" ").T(" "+ar+" ")<0){E.3A=7v+(7v?" ":"")+ar}};z.7r=B(E,fM){A t=z.7g((" "+E.3A+" ").2f(" "+fM+" "," "));if(E.3A!=t){E.3A=t}};z.lE=B(E,aq,7u){if(V 7u=="1k"){7u=!z.fL(E,aq)}z[7u?"7s":"7r"](E,aq)}}if(!z.1h["z.X.1H"]){z.1h["z.X.1H"]=K;z.1Q("z.X.1H");(B(){A d=z;z.1H=B(){A F=P;if((F.G==1)&&(V F[0]=="4J")){D.G=eK(F[0])}I{if(F.G){d.1n(F,B(i){D.Y(i)},D)}}};z.1H.1C=S 4e;if(d.1l){A fK=B(al){C("A a2 = am."+al+"; "+"A ap = 4e.1C; "+"A ao = a2.1C; "+"R(A x in ao){ ap[x] = ao[x]; } "+"am."+al+" = 4e; ")};A fI=fK("z.1H");A aj=26.lD();aj.1q.fJ("<ak>"+fI+"</ak>");aj.lC(1,1,1,1)}z.4M(z.1H,{T:B(fH,fG){C d.T(D,fH,fG)},31:B(lB,lA){A aa=d.4d(P);aa.ae(D);C d.31.14(d,aa)},ah:B(fF,fE){C d.ah(D,fF,fE)},ag:B(fD,fC){C d.ag(D,fD,fC)},1n:B(fB,fA){d.1n(D,fB,fA);C D},23:B(7t,M){C d.23(D,7t,M,d.1H)},af:B(){C d.23(D,d.af)},1c:B(lz,ly){A aa=d.4d(P);aa.ae(D[0]);A s=d.1c.14(d,aa);C(P.G>1)?D:s},lx:B(lw,lv){A aa=d.4d(P);aa.ae(L);A s=D.23(B(i){aa[0]=i;C d.1c.14(d,aa)});C(P.G>1)?D:s},7s:B(fz){C D.1n(B(i){z.7s(i,fz)})},7r:B(fy){C D.1n(B(i){z.7r(i,fy)})},5E:B(fw,7q){A 1m=d.1r(fw)[0];7q=7q||"72";R(A x=0;x<D.G;x++){d.5E(D[x],1m,7q)}C D},2c:B(fv,fu,ft){D.1n(B(1m){d.2c(1m,fv,fu,ft)});C D},lu:B(ad){A ac=(ad)?d.9t(D,ad):D;ac.1n(B(1m){if(1m["1L"]){1m.1L.fs(1m)}});C ac},lt:B(fr,fq){A 1m=D[0];C d.1r(fr).1n(B(ai){d.5E(ai,1m,(fq||"72"))})},1r:B(7p){7p=7p||"";A J=S d.1H();D.1n(B(1m){d.1r(7p,1m).1n(B(ab){if(V ab!="1k"){J.Y(ab)}})});C J},3T:B(fo){A 5F=D;A 1V=P;A r=S d.1H();A rp=B(t){if(V t!="1k"){r.Y(t)}};if(d.1R(fo)){5F=d.9t(D,1V[0]);if(1V.G==1){C 5F}d.1n(d.3T(5F,1V[1],1V[2]),rp);C r}d.1n(d.3T(5F,1V[0],1V[1]),rp);C r},lr:B(7o,7n){A 1S=d.1e.a9("lq");if(d.1R(7o)){1S.9L=7o}I{1S.4c(7o)}A ct=((7n=="9M")||(7n=="a8"))?"fm":"5A";D.1n(B(1m){A 24=1S.a7(K);1s(24[ct]){d.5E(24[ct],1m,7n)}});C D},7m:B(fl,F){A a5=[];F=F||{};D.1n(B(1m){A a6={E:1m};d.1x(a6,F);a5.Y(d[fl](a6))});C d.fx.lp(a5)},8I:B(F){C D.7m("8I",F)},8H:B(F){C D.7m("8H",F)},6y:B(F){C D.7m("6y",F)}});z.1n(["fk","lo","fj","fi","ln","lm","ll","fi","lk","lj","4b"],B(H){A a4="on"+H;z.1H.1C[a4]=B(a,b){C D.2c(a4,a,b)}})})()}if(!z.1h["z.X.1r"]){z.1h["z.X.1r"]=K;z.1Q("z.X.1r");(B(){A d=z;A 2I=B(q){C[q.T("#"),q.T("."),q.T("["),q.T(":")]};A a0=B(a3,fh){A ql=a3.G;A i=2I(a3);A 1d=ql;R(A x=fh;x<i.G;x++){if(i[x]>=0){if(i[x]<1d){1d=i[x]}}}C(1d<0)?ql:1d};A 6X=B(7l){A i=2I(7l);if(i[0]!=-1){C 7l.21(i[0]+1,a0(7l,1))}I{C""}};A 5r=B(7k){A 5D;A i=2I(7k);if((i[0]==0)||(i[1]==0)){5D=0}I{5D=a0(7k,0)}C((5D>0)?7k.3b(0,5D).1M():"*")};A fg=B(Q){A J=-1;R(A x=0;x<Q.G;x++){A 1S=Q[x];if(1S>=0){if((1S>J)||(J==-1)){J=1S}}}C J};A 9H=B(7i){A i=2I(7i);if(-1==i[1]){C""}A di=i[1]+1;A 7j=fg(i.2w(2));if(di<7j){C 7i.21(di,7j)}I{if(-1==7j){C 7i.3b(di)}I{C""}}};A f3=[{1i:"|=",1f:B(15,fe){C"[5z(3U(\' \',@"+15+",\' \'), \' "+fe+"-\')]"}},{1i:"~=",1f:B(15,fd){C"[5z(3U(\' \',@"+15+",\' \'), \' "+fd+" \')]"}},{1i:"^=",1f:B(15,fb){C"[li-4G(@"+15+", \'"+fb+"\')]"}},{1i:"*=",1f:B(15,fa){C"[5z(@"+15+", \'"+fa+"\')]"}},{1i:"$=",1f:B(15,9Z){C"[21(@"+15+", 3c-G(@"+15+")-"+(9Z.G-1)+")=\'"+9Z+"\']"}},{1i:"!=",1f:B(15,f9){C"[3O(@"+15+"=\'"+f9+"\')]"}},{1i:"=",1f:B(15,f8){C"[@"+15+"=\'"+f8+"\']"}}];A 9C=B(9Y,3Z,f7,f6){A 49;A i=2I(3Z);if(i[2]>=0){A 4L=3Z.T("]",i[2]);A 29=3Z.21(i[2]+1,4L);1s(29&&29.G){if(29.2s(0)=="@"){29=29.2w(1)}49=L;R(A x=0;x<9Y.G;x++){A 1S=9Y[x];A 7h=29.T(1S.1i);if(7h>=0){A 15=29.21(0,7h);A 4a=29.21(7h+1S.1i.G);if((4a.2s(0)=="\\"")||(4a.2s(0)=="\'")){4a=4a.21(1,4a.G-1)}49=1S.1f(d.7g(15),d.7g(4a));3f}}if((!49)&&(29.G)){49=f7(29)}if(49){f6(49)}29=L;A 7f=3Z.T("[",4L);if(0<=7f){4L=3Z.T("]",7f);if(0<=4L){29=3Z.21(7f+1,4L)}}}}};A f0=B(f5){A 4K=".";A 7e=f5.1A(" ");1s(7e.G){A 2K=7e.3a();A 7d;if(2K==">"){7d="/";2K=7e.3a()}I{7d="//"}A f4=5r(2K);4K+=7d+f4;A id=6X(2K);if(id.G){4K+="[@id=\'"+id+"\'][1]"}A cn=9H(2K);if(cn.G){A 9X=" ";if(cn.2s(cn.G-1)=="*"){9X="";cn=cn.3b(0,cn.G-1)}4K+="[5z(3U(\' \',@9P,\' \'), \' "+cn+9X+"\')]"}9C(f3,2K,B(f2){C"[@"+f2+"]"},B(f1){4K+=f1})}C 4K};A 7a={};A eC=B(28){if(7a[28]){C 7a[28]}A 1e=d.1e;A 9W=f0(28);A 4H=B(9V){A J=[];A 7b;1u{7b=1e.9x(9W,9V,L,lh.lg,L)}1y(e){1z.1K("lf in le:",9W,"lc:",9V);1z.1K(e)}A 7c=7b.eZ();1s(7c){J.Y(7c);7c=7b.eZ()}C J};C 7a[28]=4H};A 5x={};A 9B={};A 3y=B(79,78){if(!79){C 78}if(!78){C 79}C B(){C 79.14(26,P)&&78.14(26,P)}};A 75=B(9U,3Y,5B,2J){A 2v=2J+1;A 76=(3Y.G==2v);A 2K=3Y[2J];if(2K==">"){A 77=9U.3W;if(!77.G){C}2v++;76=(3Y.G==2v);A 4H=6O(3Y[2J+1]);R(A x=0,11;x<77.G,11=77[x];x++){if(4H(11)){if(76){5B.Y(11)}I{75(11,3Y,5B,2v)}}}}A 5C=6U(2K)(9U);if(76){1s(5C.G){5B.Y(5C.3a())}}I{1s(5C.G){75(5C.3a(),3Y,5B,2v)}}};A eE=B(9T,eY){A J=[];A x=9T.G-1,11;1s(11=9T[x--]){75(11,eY,J,0)}C J};A 6O=B(3D){if(5x[3D]){C 5x[3D]}A ff=L;A 9S=5r(3D);if(9S!="*"){ff=3y(ff,B(N){C((N.2t==1)&&(9S==N.5w.1M()))})}A 9R=6X(3D);if(9R.G){ff=3y(ff,B(N){C((N.2t==1)&&(N.id==9R))})}if(2Y.5q.14(D,2I(3D).2w(1))>=0){ff=3y(ff,9z(3D))}C 5x[3D]=ff};A 5y=B(E){A pn=E.1L;A 9Q=pn.3W;A 2v=-1;A 3C=pn.5A;if(!3C){C 2v}A ci=E["eW"];A cl=pn["eX"];if(((V cl=="4J")&&(cl!=9Q.G))||(V ci!="4J")){pn["eX"]=9Q.G;A 2J=1;do{if(3C===E){2v=2J}if(3C.2t==1){3C["eW"]=2J;2J++}3C=3C.71}1s(3C)}I{2v=ci}C 2v};A lb=0;A 3X=B(N,15){A 74="";if(15=="9P"){C N.3A||74}if(15=="R"){C N.la||74}C N.5t(15,2)||74};A eH=[{1i:"|=",1f:B(15,9O){A eV=" "+9O+"-";C B(N){A ea=" "+(N.5t(15,2)||"");C((ea==9O)||(ea.T(eV)==0))}}},{1i:"^=",1f:B(15,eU){C B(N){C(3X(N,15).T(eU)==0)}}},{1i:"*=",1f:B(15,eT){C B(N){C(3X(N,15).T(eT)>=0)}}},{1i:"~=",1f:B(15,eS){A 9N=" "+eS+" ";C B(N){A ea=" "+3X(N,15)+" ";C(ea.T(9N)>=0)}}},{1i:"$=",1f:B(15,73){A 9N=" "+73;C B(N){A ea=" "+3X(N,15);C(ea.31(73)==(ea.G-73.G))}}},{1i:"!=",1f:B(15,eR){C B(N){C(3X(N,15)!=eR)}}},{1i:"=",1f:B(15,eQ){C B(N){C(3X(N,15)==eQ)}}}];A 9E=[{1i:"9M-9K",1f:B(1p,l9){C B(N){if(N.2t!=1){C U}A fc=N.eP;1s(fc&&(fc.2t!=1)){fc=fc.eP}C(!fc)}}},{1i:"72-9K",1f:B(1p,l8){C B(N){if(N.2t!=1){C U}A nc=N.71;1s(nc&&(nc.2t!=1)){nc=nc.71}C(!nc)}}},{1i:"l7",1f:B(1p,l6){C B(N){A cn=N.3W;A eO=N.3W.G;R(A x=eO-1;x>=0;x--){A nt=cn[x].2t;if((nt==1)||(nt==3)){C U}}C K}}},{1i:"5z",1f:B(1p,eN){C B(N){C(N.9L.T(eN)>=0)}}},{1i:"3O",1f:B(1p,eM){A eL=6O(eM);C B(N){C(!eL(N))}}},{1i:"l5-9K",1f:B(1p,2u){A pi=eK;if(2u=="l4"){C B(N){C(((5y(N))%2)==1)}}I{if((2u=="2n")||(2u=="l3")){C B(N){C((5y(N)%2)==0)}}I{if(2u.T("l2+")==0){A 70=pi(2u.3b(3));C B(N){C(N.1L.3W[70-1]===N)}}I{if((2u.T("n+")>0)&&(2u.G>3)){A 9J=2u.1A("n+",2);A eJ=pi(9J[0]);A 2J=pi(9J[1]);C B(N){C((5y(N)%eJ)==2J)}}I{if(2u.T("n")==-1){A 70=pi(2u);C B(N){C(5y(N)==70)}}}}}}}}];A 9z=B(3e){A 9I=(9B[3e]||5x[3e]);if(9I){C 9I}A ff=L;A i=2I(3e);if(i[0]>=0){A 24=5r(3e);if(24!="*"){ff=3y(ff,B(N){C(N.5w.1M()==24)})}}A 5u;A 3B=9H(3e);if(3B.G){A 9F=3B.2s(3B.G-1)=="*";if(9F){3B=3B.3b(0,3B.G-1)}A re=S 9G("(?:^|\\\\s)"+3B+(9F?".*":"")+"(?:\\\\s|$)");ff=3y(ff,B(N){C re.6Z(N.3A)})}if(i[3]>=0){A 3z=3e.3b(i[3]+1);A 9D="";A 5v=3z.T("(");A 6Y=3z.31(")");if((0<=5v)&&(0<=6Y)&&(6Y>5v)){9D=3z.21(5v+1,6Y);3z=3z.3b(0,5v)}5u=L;R(A x=0;x<9E.G;x++){A 1S=9E[x];if(1S.1i==3z){5u=1S.1f(3z,9D);3f}}if(5u){ff=3y(ff,5u)}}A eG=(d.1l)?B(5s){A eI=5s.1M();C B(N){C N[5s]||N[eI]}}:B(5s){C B(N){C(N&&N.5t&&N.l1(5s))}};9C(eH,3e,eG,B(eF){ff=3y(ff,eF)});if(!ff){ff=B(){C K}}C 9B[3e]=ff};A 6W={};A 6U=B(3d,1B){A 9A=6W[3d];if(9A){C 9A}A i=2I(3d);A id=6X(3d);if(i[0]==0){C 6W[3d]=B(1B){C[d.1D(id)]}}A 9y=9z(3d);A 5p;if(i[0]>=0){5p=B(1B){A 11=d.1D(id);if(9y(11)){C[11]}}}I{A 3V;A 24=5r(3d);if(2Y.5q.14(D,2I(3d))==-1){5p=B(1B){A J=[];A 11,x=0,3V=1B.4I(24);1s(11=3V[x++]){J.Y(11)}C J}}I{5p=B(1B){A J=[];A 11,x=0,3V=1B.4I(24);1s(11=3V[x++]){if(9y(11)){J.Y(11)}}C J}}}C 6W[3d]=5p};A l0={};A 5o={">":B(1B){A J=[];A 11,x=0,3V=1B.3W;1s(11=3V[x++]){if(11.2t==1){J.Y(11)}}C J}};A 9w=B(6V){if(0>6V.T(" ")){C 6U(6V)}A eD=B(1B){A 6S=6V.1A(" ");A 6T;if(6S[0]==">"){6T=[1B]}I{6T=6U(6S.3a())(1B)}C eE(6T,6S)};C eD};A 9v=((1q["9x"]&&!d.3o)?B(3x){A 6R=3x.1A(" ");if((1q["9x"])&&(3x.T(":")==-1)&&((K))){if(((6R.G>2)&&(3x.T(">")==-1))||(6R.G>3)||(3x.T("[")>=0)||((1==6R.G)&&(0<=3x.T(".")))){C eC(3x)}}C 9w(3x)}:9w);A ey=B(3w){if(5o[3w]){C 5o[3w]}if(0>3w.T(",")){C 5o[3w]=9v(3w)}I{A eB=3w.1A(/\\s*,\\s*/);A 4H=B(1B){A eA=0;A J=[];A 6Q;1s(6Q=eB[eA++]){J=J.3U(9v(6Q,6Q.T(" "))(1B))}C J};C 5o[3w]=4H}};A 5n=0;A ez=B(Q){A J=S d.1H();if(!Q){C J}if(Q[0]){J.Y(Q[0])}if(Q.G<2){C J}5n++;Q[0]["9u"]=5n;R(A x=1,11;11=Q[x];x++){if(Q[x]["9u"]!=5n){J.Y(11)}11["9u"]=5n}C J};d.1r=B(6P,1B){if(V 6P!="3c"){C S d.1H(6P)}if(V 1B=="3c"){1B=d.1D(1B)}C ez(ey(6P)(1B||d.1e))};d.9t=B(ex,9s){A 9r=S d.1H();A ff=(9s)?6O(9s):B(){C K};R(A x=0,11;11=ex[x];x++){if(ff(11)){9r.Y(11)}}C 9r}})()}if(!z.1h["z.X.1b"]){z.1h["z.X.1b"]=K;z.1Q("z.X.1b");z.6K=B(ew){A J={};A iq="kZ[Z!=9q][Z!=kY][Z!=et][Z!=kX][Z!=kW], kV, kU";z.1r(iq,ew).3T(B(E){C(!E.kT)}).1n(B(1m){A 3v=1m.1p;A Z=(1m.Z||"").1M();if((Z=="kS")||(Z=="kR")){if(1m.kQ){J[3v]=1m.1Z}}I{if(1m.kP){A ev=J[3v]=[];z.1r("kO[kN]",1m).1n(B(eu){ev.Y(eu.1Z)})}I{J[3v]=1m.1Z;if(Z=="et"){J[3v+".x"]=J[3v+".y"]=J[3v].x=J[3v].y=0}}}});C J};z.9h=B(23){A ec=kM;A J="";A es={};R(A x in 23){if(23[x]!=es[x]){if(z.2l(23[x])){R(A y=0;y<23[x].G;y++){J+=ec(x)+"="+ec(23[x][y])+"&"}}I{J+=ec(x)+"="+ec(23[x])+"&"}}}if((J.G)&&(J.2s(J.G-1)=="&")){J=J.3b(0,J.G-1)}C J};z.kL=B(er){C z.9h(z.6K(er))};z.kK=B(ep){C z.eq(z.6K(ep))};z.kJ=B(2H){A J={};A qp=2H.1A("&");A dc=kI;z.1n(qp,B(1m){if(1m.G){A 9p=1m.1A("=");A 1p=dc(9p.3a());A 1U=dc(9p.22("="));if(z.1R(J[1p])){J[1p]=[J[1p]]}if(z.2l(J[1p])){J[1p].Y(1U)}I{J[1p]=1U}}});C J};z.e1=U;z.e6={"9g":B(1b){C 1b.2G},"2e":B(1b){if(!1o.eo){1z.1K("kH kG kF a kE of 9g/2e-6M-9m"+" 4F kD kC kB kA 4G en kz"+" (ky 1o.eo=K 4F kx kw D kv)")}C z.5m(1b.2G)},"2e-6M-ku":B(1b){A 6N=1b.2G;A 9o=6N.T("/*");A 9n=6N.31("*/");if((9o==-1)||(9n==-1)){C z.5m(1b.2G)}C z.5m(6N.21(9o+2,9n))},"2e-6M-9m":B(1b){A 6L=1b.2G;A 9l=6L.T("/*");A 9k=6L.31("*/");if((9l==-1)||(9k==-1)){1z.1K("kt en ks\'t 6M 9m!");C""}C z.5m(6L.21(9l+2,9k))},"kr":B(1b){C z.3u(1b.2G)},"kq":B(1b){if(z.1l&&!1b.el){z.1n(["ko","em","kn","km"],B(i){1u{A 1e=S 9j(kl[i]+".kk");1e.kj=U;1e.ki(1b.2G);C 1e}1y(e){}})}I{C 1b.el}}};(B(){z.e5=B(F,ej,ei,eh){A 2F={};2F.F=F;A 6J=L;if(F.3R){A 3R=z.1D(F.3R);A 9i=3R.kh("kg");2F.2E=F.2E||(9i?9i.1Z:L);6J=z.6K(3R)}I{2F.2E=F.2E}A 5l=[{}];if(6J){5l.Y(6J)}if(F.5g){5l.Y(F.5g)}if(F.ek){5l.Y({"z.ek":S 5d().8O()})}2F.1r=z.9h(z.1x.14(L,5l));2F.9d=F.9d||"9g";A d=S z.30(ej);d.5k(ei,B(eg){C eh(eg,d)});A ld=F.4E;if(ld&&z.1Y(ld)){d.ef(B(ee){C ld.2d(F,ee,2F)})}A 1G=F.9f;if(1G&&z.1Y(1G)){d.ed(B(e9){C 1G.2d(F,e9,2F)})}A 6I=F.kf;if(6I&&z.1Y(6I)){d.9e(B(e8){C 6I.2d(F,e8,2F)})}d.1F=2F;C d};A e4=B(O){O.e0=K;A 1b=O.1F.1b;if(V 1b.e7=="B"){1b.e7()}};A e3=B(O){C z.e6[O.1F.9d](O.1F.1b)};A e2=B(9c,O){1z.1K(9c);C 9c};A 3Q=B(F){A O=z.e5(F,e4,e3,e2);O.1F.1b=z.9b(O.1F.F);C O};A 5j=L;A 3t=[];A 94=B(){A dZ=(S 5d()).dU();if(!z.e1){z.1n(3t,B(4D,6H){if(!4D){C}A O=4D.O;1u{if(!O||O.e0||!4D.dT(O)){3t.3S(6H,1);C}if(4D.dR(O)){3t.3S(6H,1);4D.dP(O)}I{if(O.9a){if(O.9a+(O.1F.F.6G||0)<dZ){3t.3S(6H,1);A 1G=S 1O("6G ke");1G.dY="6G";O.5i(1G);O.4C()}}}}1y(e){1z.1K(e);O.5i(S 1O("kc!"))}})}if(!3t.G){dX(5j);5j=L;C}};z.dV=B(){1u{z.1n(3t,B(i){i.O.4C()})}1y(e){}};if(z.1l){z.dW(z.dV)}z.dH=B(O,dS,dQ,dO){if(O.1F.F.6G){O.9a=(S 5d()).dU()}3t.Y({O:O,dT:dS,dR:dQ,dP:dO});if(!5j){5j=dN(94,50)}94()};A dJ="8Z/x-kb-3R-ka";A dG=B(O){C O.1F.1b.6F};A dF=B(O){C 4==O.1F.1b.6F};A dE=B(O){if(z.8Y(O.1F.1b)){O.dM(O)}I{O.5i(S 1O("k9 k8 k7 5h:"+O.1F.1b.3N))}};A 3P=B(Z,O){A 3s=O.1F;A F=3s.F;3s.1b.dL(Z,3s.2E,(F.k6!==K),(F.8X?F.8X:1k),(F.8W?F.8W:1k));if(F.6E){R(A 5f in F.6E){if(5f.1M()==="5g-Z"&&!F.8V){F.8V=F.6E[5f]}I{3s.1b.dK(5f,F.6E[5f])}}}3s.1b.dK("k5-k4",(F.8V||dJ));1u{3s.1b.dI(3s.1r)}1y(e){O.4C()}z.dH(O,dG,dF,dE);C O};z.8T=B(4B){if(4B.1r.G){4B.2E+=(4B.2E.T("?")==-1?"?":"&")+4B.1r;4B.1r=L}};z.k3=B(F){A O=3Q(F);z.8T(O.1F);C 3P("dD",O)};z.k2=B(F){C 3P("dC",3Q(F))};z.k1=B(F){A O=3Q(F);O.1F.1r=F.k0;C 3P("dC",O)};z.jZ=B(F){C 3P("dA",3Q(F))};z.jY=B(F){A O=3Q(F);A dB=O.1F;if(F["8U"]){dB.1r=F.8U;F.8U=L}C 3P("dA",O)};z.jX=B(F){A O=3Q(F);z.8T(O.1F);C 3P("8S",O)};z.dz=B(jW){2m S 1O("z.dz 3O jV jU")}})()}if(!z.1h["z.X.fx"]){z.1h["z.X.fx"]=K;z.1Q("z.X.fx");z.dx=B(dy,1d){D.1w=dy;D.1d=1d;D.4x=B(n){C((D.1d-D.1w)*n)+D.1w}};z.2r("z.d6",L,{1P:B(F){z.1x(D,F);if(z.2l(D.2C)){D.2C=S z.dx(D.2C[0],D.2C[1])}},2C:L,8Q:jT,5a:L,4z:0,dj:10,du:L,6x:L,dt:L,8B:L,dh:L,ds:L,dr:L,dm:L,2D:U,2Z:U,4A:L,8N:L,3r:L,2o:0,4y:0,3q:B(H,F){if(D[H]){D[H].14(D,F||[])}C D},5b:B(dw,8R){if(8R){5e(D.3r);D.2D=D.2Z=U;D.2o=0}I{if(D.2D&&!D.2Z){C D}}D.3q("6x");A d=dw||D.du;if(d>0){5c(z.2p(D,B(){D.5b(L,8R)}),d);C D}D.4A=S 5d().8O();if(D.2Z){D.4A-=D.8Q*D.2o}D.8N=D.4A+D.8Q;D.2D=K;D.2Z=U;A 8P=D.2C.4x(D.2o);if(!D.2o){if(!D.4y){D.4y=D.4z}D.3q("dt",[8P])}D.3q("ds",[8P]);D.8M();C D},jS:B(){5e(D.3r);if(!D.2D){C D}D.2Z=K;D.3q("dr",[D.2C.4x(D.2o)]);C D},jR:B(dq,dp){5e(D.3r);D.2D=D.2Z=K;D.2o=dq*6D;if(dp){D.5b()}C D},jQ:B(dn){if(!D.3r){C}5e(D.3r);if(dn){D.2o=1}D.3q("dm",[D.2C.4x(D.2o)]);D.2D=D.2Z=U;C D},3N:B(){if(D.2D){C D.2Z?"3M":"jP"}C"jO"},8M:B(){5e(D.3r);if(D.2D){A dl=S 5d().8O();A 2q=(dl-D.4A)/(D.8N-D.4A);if(2q>=1){2q=1}D.2o=2q;if(D.5a){2q=D.5a(2q)}D.3q("8B",[D.2C.4x(2q)]);if(2q<1){D.3r=5c(z.2p(D,"8M"),D.dj)}I{D.2D=U;if(D.4z>0){D.4z--;D.5b(L,K)}I{if(D.4z==-1){D.5b(L,K)}I{if(D.4y){D.4z=D.4y;D.4y=0}}}D.2o=0;D.3q("dh")}}C D}});(B(){A df=B(E){if(z.1l){A ns=E.1c;if(!ns.8L.G&&z.1c(E,"8L")=="dg"){ns.8L="1"}if(!ns.3n.G&&z.1c(E,"3n")=="8K"){ns.3n="8K"}}};z.6C=B(F){if(V F.1d=="1k"){2m S 1O("z.6C jN an 1d 1Z")}F.E=z.1D(F.E);A 3p=z.1x({6w:{}},F);A 8J=(3p.6w.2W={});8J.1w=(V 3p.1w=="1k")?B(){C 2V(z.1c(3p.E,"2W"))}:3p.1w;8J.1d=3p.1d;A 2U=z.6y(3p);z.2c(2U,"6x",L,B(){df(3p.E)});C 2U};z.8I=B(F){C z.6C(z.1x({1d:1},F))};z.8H=B(F){C z.6C(z.1x({1d:0},F))};if(z.6B&&!z.3o){z.8E=B(n){C 2k("0.5")+((2Y.da((n+2k("1.5"))*2Y.d9))/2)}}I{z.8E=B(n){C 0.5+((2Y.da((n+1.5)*2Y.d9))/2)}}A d4=B(6A){D.8G=6A;R(A p in 6A){A 1a=6A[p];if(1a.1w 1N z.1J){1a.d7=S z.1J()}}D.4x=B(r){A J={};R(A p in D.8G){A 1a=D.8G[p];A 6z=L;if(1a.1w 1N z.1J){6z=z.d8(1a.1w,1a.1d,r,1a.d7).8F()}I{if(!z.2l(1a.1w)){6z=((1a.1d-1a.1w)*r)+1a.1w+(p!="2W"?1a.jM||"px":"")}}J[p]=6z}C J}};z.6y=B(F){F.E=z.1D(F.E);if(!F.5a){F.5a=z.8E}A 2U=S z.d6(F);z.2c(2U,"6x",2U,B(){A pm={};R(A p in D.6w){A 1a=pm[p]=z.1x({},D.6w[p]);if(z.1Y(1a.1w)){1a.1w=1a.1w()}if(z.1Y(1a.1d)){1a.1d=1a.1d()}A d5=(p.1M().T("jL")>=0);B 8C(E,p){4w(p){2X"58":C E.8D;2X"3n":C E.6v}A v=z.1c(E,p);C(p=="2W")?2V(v):2k(v)};if(V 1a.1d=="1k"){1a.1d=8C(D.E,p)}I{if(V 1a.1w=="1k"){1a.1w=8C(D.E,p)}}if(d5){1a.1w=S z.1J(1a.1w);1a.1d=S z.1J(1a.1d)}I{1a.1w=(p=="2W")?2V(1a.1w):2k(1a.1w)}}D.2C=S d4(pm)});z.2c(2U,"8B",2U,B(8A){R(A s in 8A){z.1c(D.E,s,8A[s])}});C 2U}})()}',62,1711,'|||||||||||||||||||||||||||||||||||dojo|var|function|return|this|node|args|length|evt|else|ret|true|null|obj|elem|dfd|arguments|arr|for|new|indexOf|false|typeof||_base|push|type||te|||apply|attr|||||prop|xhr|style|end|doc|match|uri|_hasResource|key|del|undefined|isIE|item|forEach|djConfig|name|document|query|while|_66|try|res|start|mixin|catch|console|split|root|prototype|byId|gcs|ioArgs|err|NodeList|_p|Color|debug|parentNode|toLowerCase|instanceof|Error|constructor|provide|isString|ta|255|val|_a|global|_69|isFunction|value||substring|join|map|tn||window||path|_343|_220|_listeners|connect|call|json|replace|left|_b|toString|128|parseFloat|isArray|throw||_percent|hitch|step|declare|charAt|nodeType|_3c3|nidx|slice|faux|fired|_c4|_7e|loc|curve|_active|url|_44c|responseText|str|_312|idx|tqp|isNaN|isOpera|_22d|callee|add|_18b|_f8|_e2|_41|anim|Number|opacity|case|Math|_paused|Deferred|lastIndexOf|||||||||shift|substr|string|_3e7|_3ce|break|_w|charCode|_listener|_d5|_c5|authority|_49|width|isSafari|_49e|fire|_timer|_47b|_465|eval|_in|_40c|_409|_362|_3d9|className|_3d5|_386|_37a|body|getComputedStyle|box|_221|keyCode|remove|_8d|_46|paused|status|not|_478|_461|form|splice|filter|concat|tret|childNodes|_38b|_367|_33d||||||||||_340|_348|keypress|appendChild|_toArray|Array|_2b0|_toPixelValue|ref|_fixEvent|_19f|_14c|_14a|_150|_141|declaredClass|_d4|_99|_Url|_83|scheme|_67|_3d|switch|getValue|_startRepeatCount|repeat|_startTime|_47e|cancel|tif|load|to|with|tf|getElementsByTagName|number|_34c|_342|extend|_1e3|_normalizeEventName|_14b|_14e|results|self|cbfn|_f9|_d8|_b2|src|_88|dav||baseUrl|fragment|_loadedModules|_44|_43|_loaders|mll|height||easing|play|setTimeout|Date|clearTimeout|hdr|content|code|errback|_464|addCallbacks|_450|fromJson|_413|_3fc|_3ee|max|_31e|cond|getAttribute|_3d4|obi|tagName|_360|_381|contains|firstChild|_368|_372|_320|place|_2fa|scrollTop|_299|scrollLeft|top|documentElement|_288|_287|_getBorderExtents|_23f|_23d|_239|_218|_216|_211|eles|target|keys|shiftKey|ctrlKey|event|192|iel|_1db|delete|_1cf||addEventListener|String|_1af|_157|array|_14d|continue|_14f|_137|_11f|_106|_findMethod|has|_delegate|_dc|_d3|loaded|_9a|_loadInit|_inFlightCount|getObject|tv|_4f|_postLoad|_2d|offsetWidth|properties|beforeBegin|animateProperty|_4ad|_4a6|isKhtml|_fade|100|headers|readyState|timeout|_469|_457|_44d|formToObject|_441|comment|_43d|_36f|_419|tp|_40a|_406|_407|_373|_403|_3e6|_31b|cbi|test|_3c7|nextSibling|last|_3a1|_38e|_365|_36b|ecn|_364|_363|_356|_35e|_35f|_34f|_34d|_349|trim|tci|_328|_32b|_31f|_31c|_anim|_300|_2ff|_2f5|_2e7|removeClass|addClass|func|_2c4|cls|_2a9|_2ae|_280|_27f|_getPadExtents|isMoz|none|_233|cssText|_214|_fixCallback|_synthesizeEvent|stopPropagation|preventDefault|_setKeyChar|_1e1|ieh|_1d7|_1be|colorFromArray|sanitize|bits|rgb|_156|_fire|_resback|_13d|partial|_13a|silentlyCancelled|_topics|_127|_f1|_f0|superclass|_ec|_e3|mct|setObject|_bf|_b3|object|require|_92|_khtmlTimer|location|XMLHTTP|locale|dua|_71|_modulePrefixes|_55|_loadModule|_51|_50|_4e|pop|_3f|_callLoaded|_unloaders|_loadNotifying|_loadedUrls|_27|_24|_1d|_5|_4b7|onAnimate|getStyle|offsetHeight|_defaultEasing|toCss|_properties|fadeOut|fadeIn|_49f|auto|zoom|_cycle|_endTime|valueOf|_494|duration|_492|DELETE|_ioAddQueryToUrl|putData|contentType|password|user|_isDocumentOk|application|||||_466||||||startTime|_xhrObj|_45f|handleAs|addBoth|error|text|objectToQuery|_44f|ActiveXObject|_443|_442|filtered|_43f|_43e|_437|file|tnl|_41c|_filterQueryResult|_zipIdx|_408|_402|evaluate|_3ed|_380|fHit|_361|_33b|_3da|_3ab|_3d6|RegExp|_327|_3cf|_3c9|child|innerHTML|first|tval|_391|class|pnc|_37e|_37c|_375|_366|_35c|_35a|_353|_33c|_336|_314|||_315|_oe|_307|_309|cloneNode|after|createElement||_2f8|_2ef|_2ee|unshift|coords|some|every||_2cb|script|_2c9|parent||a2p||_2c3|_2bd||abs|_getMarginBox|_2b3|_2a6|position|_2a7|_2ac|_2ab|_getIeDocumentElementOffset|getBoundingClientRect|ownerDocument|_2a3|clientWidth|_isBodyLtr|_fixIeBiDiScrollLeft|_bodyLtr|_29d|_getContentBox|_setBox|_getMarginExtents|_getPadBorderExtents|_usesBorderBox|boxModel|pcs|st|sl|_240|runtimeStyle|_dcm|BackCompat|compatMode|default|_21b|_d|html|_event_listener|handlers|PAGE_DOWN|PAGE_UP|RIGHT_ARROW|LEFT_ARROW|DOWN_ARROW|UP_ARROW|_preventDefault||_stopPropagation|returnValue||_trySetKeyCode|cancelBubble|currentTarget|106|_1ee|111||_1e8|_1e7|||se|srcElement|onkeydown||_1d0|_disconnect|lid|_1c0|_connect|_set|_195|_185|_183|_17d|_everyOrSome|_16b|_172|_15b|Function|_154|_escapeString|_140|chain|_check|canceller|_12d|_124|_11a|_10d|_107|inherited|_fa|_f2|_findMixin|_constructor|preamble|_de|clone|tmp|_c7|TMP|_be|_ba|_mixin|isBrowser|lang|firebug||param|modulePaths|_a7|_fireCallback|_a0|setContext||_9c|unloaded||||_96|_93|navigator|_90|_89||protocol|_84|_86|_XMLHTTP_PROGIDS|gears|google|setAttribute|_80|_77|cfg|_6f|_getModuleSymbols|_5a|_58|_53|_4d|_4c|_45|_40|_moduleHasPrefix|_loadUri|_28|_26|_21|_22|tests|doh|_20|_1f|_1c|version|_1b|_19|_getProp|_11|_4|_4a5|_4b3|_Animation|tempColor|blendColors|PI|sin|||||_49a|normal|onEnd||rate||curr|onStop|_497||_496|pct|onPause|onPlay|onBegin|delay||_491|_Line|_48b|wrapForm|PUT|_487|POST|GET|_476|_474|_472|_ioWatch|send|_471|setRequestHeader|open|callback|setInterval|_470|resHandle|_46f|ioCheck|_46e|validCheck|getTime|_ioCancelAll|addOnUnload|clearInterval|dojoType|now|canceled|_blockAsync|_45e|_45c|_459|_ioSetArgs|_contentHandlers|abort|_458|_456||||addErrback|_454|addCallback|_452|_44b|_44a|_449|preventCache|responseXML|Microsoft|JSON|usePlainJson|_431|toJson|_430|_42d|image|opt|ria|_421|_41b|_40b|_zip|_410|_40d|_357|sqf|_374|_3e5|_3df|_38f|clc|pred|parseInt|ntf|_3bf|_3bc|cnl|previousSibling|_3a9|_3a6|_39c|_399|_396|_392|__cachedIndex|__cachedLength|_376|iterateNext|_34a|_355|_354|_32c|_350|_34b|_33f|_33e|_33a|_338|_334|_332||_330|_32e||_322|_316|mousemove|mouseout|mouseover|_305|lastChild||_2f9||_2f2|_2f1|removeChild|_2ec|_2eb|_2ea|_2e6||_2e4|_2e2|_2d6|_2d5|_2d4|_2d3|_2d2|_2d1|_2cd|_2cc|scs|write|_2c8|hasClass|_2c0|_2bb|_2b5|_abs|_docScroll|offsetParent|offsetTop|offsetLeft|absolute|getBoxObjectFor|clientLeft|_setContentSize|_setMarginBox|_28d|_286|_285|_289|NaN|_281|border|_272|_26b|_260|_258|_253|_24c|_246|_23a|_getOpacity|_setOpacity|_238|td|tr|nodeName|FILTER|_22f|_22e|currentStyle|_22c|_22b|display|QuirksMode|unselectable|_217|isMozilla|getElementById|attributes|all|_ie_listener|_getIeDispatcher|_1fd|NUM_LOCK|SCROLL_LOCK|INSERT|END|HOME|PAUSE|F12|F11|F10|F9|F8|F7|F6|F5|F4|F3|F2|F1|63232|SHIFT_TAB|TAB|keyIdentifier|_1f3|stopEvent|_punctMap|222|219|186|onkeypress|_stealthKeyDown|_fixKeys|relatedTarget|_1e0|_1df|_stealthKeydown|_1d6|_1d5|_1d1|_1ca|_1c9|_1cb|_1c2|_1c1|_1c3|_1c4|_1bc|_1b3|_1b2|colorFromHex|colorFromRgb|named|colorFromString|mask|rgba|_19c|_197|_192|setColor|_180|_178|_177|_175|_174|_16d|_166|_164|_163|_162|_15c|_15d|_15e|index|__json__|toJsonIndentStr|_nextId|_12f|_12b|publish|_128|_126|_125|_122|_121|_123|_11c|_11b|_10c|_10b|_108|getDispatcher|argument|nom|_construct|_core|_makeCtor|_df|_db|deprecated|isObject|_cc||scope||_hitchArgs|_c2||pre|_c1|native|isDebug||registerModulePath|_a8||finally|||_a6|_a5|_a4|_a3|_a2|_a1|_9f|_9e|_9d|_9b|_98|_97|onbeforeunload|ipt|scr|complete|_95|userAgent|_modulesLoaded|initialized|_initFired|_8c|_8a|_getText|_87|ieForceActiveXXhr|Msxml2|isGears|_81|_gearsObject|googlegears|GearsFactory|isFF|_7d|Safari|_72|_name|_6c|ire|ore|_68|i18n|_5b|requireIf|_56|_52|loading|_4a|_loadPath|_47|_48|_global_omit_module_check|_getModulePrefix|_3c|_3a|_37|_30|Boolean|_loadUriAndCheck|_2e||cacheBust|_1e|_1a|_17|_16|_15|_14|_f|_10|_e|_9|_8|revision|flag|patch|minor|major|_6|color|units|needs|stopped|playing|stop|gotoPercent|pause|1000|implemented|yet|_48a|xhrDelete|rawXhrPut|xhrPut|postData|rawXhrPost|xhrPost|xhrGet|Type|Content|sync|response|http|bad|urlencoded|www|_watchInFlightError||exceeded|handle|action|getAttributeNode|loadXML|async|XMLDOM|prefixes|MSXML3|MSXML|MSXML2||xml|javascript|wasn|your|optional|message|off|turn|use|endpoints|issues|security|potential|avoid|mimetype|using|consider|please|decodeURIComponent|queryToObject|formToJson|formToQuery|encodeURIComponent|selected|option|multiple|checked|checkbox|radio|disabled|textarea|select|button|reset|submit|input|_3fb|hasAttribute|0n|even|odd|nth|_3b5|empty|_3b1|_3ad|htmlFor|_38a|under||exprssion|failure|ANY_TYPE|XPathResult|starts|keyup|keydown|mouseup|mousedown|blur|click|combine|span|addContent||adopt|orphan|_2de|_2dd|styles|_2da|_2d9|_2cf|_2ce|show|createPopup|toggleClass|scrollWidth|clientTop|ltr|direction|pageXOffset|pageYOffset|fixed|contentBox|marginBox|BUTTON|TABLE|_getBorderBox|clientHeight|visible|overflow|marginBottom|marginRight|marginTop|marginLeft|borderBottomWidth|borderBottomStyle|borderRightWidth|borderRightStyle|borderTopWidth|borderTopStyle|borderLeftWidth|borderLeftStyle|paddingBottom|paddingRight|paddingTop|paddingLeft|offset||min|padding||margin|Opacity|Alpha|alpha|filters|pixelLeft|medium|_22a|defaultView|before||insertBefore|KhtmlUserSelect|MozUserSelect|setSelectable|isDescendant|div|_destroyElement|BackgroundImageCache|execCommand|PageDown|PageUp|Right|Left|Down|Up|63289|63249|63248|PRINT_SCREEN|63302|63277|63276|63275|63273|63272|63250|63247|63246|63245|63244|63243|63242|63241|63240|63239|63238|63237|63236|63235|63234|63233|Enter|_1f9|which|_1f6|bubbledKeyCode|221|220||||191|190|189|188|187|toElement|fromElement|clientY|pageY||clientX|pageX|offsetY|||layerY|offsetX|layerX|parentWindow|_nop|_allow_leaks|145|144|126|F15|125|F14|124|F13|123|122|121|120|119|118|117|116|115|114|113|112|NUMPAD_DIVIDE|110|NUMPAD_PERIOD|109|NUMPAD_MINUS|108|NUMPAD_ENTER|107|NUMPAD_PLUS|NUMPAD_MULTIPLY|105|NUMPAD_9|104|NUMPAD_8|103|NUMPAD_7|102|NUMPAD_6|101|NUMPAD_5|NUMPAD_4||NUMPAD_3|NUMPAD_2|NUMPAD_1|NUMPAD_0||SELECT|RIGHT_WINDOW||LEFT_WINDOW||HELP|SPACE|ESCAPE|CAPS_LOCK|ALT|CTRL|SHIFT|ENTER|CLEAR|BACKSPACE|attachEvent|fixEvent|fromCharCode|keyChar|_1b9|removeEventListener|0x|round|toHex|toRgba|toRgb|aqua|teal|blue|navy|yellow|olive|lime|green|fuchsia|purple|red|maroon|white|gray|silver|black|boolean|called|already|Cancelled|connectPublisher|unsubscribe|subscribe|disconnect|_113|_112||_111|_110|||found|was||must|_|module|||required|likely|It|declaration|Mixin|separate|instead|property|initializer||pass|_c9|_bb|_b7|nfunction|isAlien|isFinite|isArrayLike|_firebug|withDoc|withGlobal|_writeIncludes|VML|behavior|addRule|createStyleSheet|vml|com|microsoft|schemas|urn|namespaces|onunload|onreadystatechange|defer|khtml|WebKit|DOMContentLoaded|enableMozDomContentLoaded|domcontentloaded|Unable|base|chrome|1223|304|300|200|available|XMLHttpRequest|_println|language|userLanguage|isQuirks|factory|mimeTypes|Factory|Gears|_7f|MSIE||Firefox|Gecko|Konqueror||Opera|appVersion|xd|browser|moduleUrl|port|host|hostenv|_requireLocalization|_5f|_5e|_5d|_5c|requireLocalization|requireAfterIf|_57|common|platformRequire|defined|symbol|_isXDomain|tried|Could|__package__|packageFileName|_42|useXDomain|flight|still|files|addOnLoad|failed|sourceURL|util|notice|without|change|subject|APIs|EXPERIMENTAL|experimental|removed|will|DEPRECATED|exists|10315|Rev|Mobile|Spidermonkey|Rhino||Browser|delayMozLoadingFix|preventBackButtonFix|libraryScriptUri|baseRelativePath|baseScriptUri|allowQueryConfig|warn|trace|timeEnd||time|profileEnd|profile|log|info|groupEnd|group|dirxml|dir|count|assert'.split('|'),0,{});
+
+
+/*
+
+Prototype 1.5 rc0
+ - Adapted from Ruby on Rails - http://dev.rubyonrails.org/browser/spinoffs/prototype/src
+ - By Lunarmedia, 06 August, 2006
+ - Available at (and packed with) JavascriptCompressor.com
+
+Please note this version is missing the selector.js component of the full Prototype library. 
+You can get the compressed version of selector at JavascriptCompressor.com
+
+*/
+
+var decompressedPrototype = function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('d T={4l:\'1.5.8P\',3E:\'(?:<3G.*?>)((\\n|\\r|.)*?)(?:<\\/3G>)\',2v:7(){},K:7(x){c x}};d 1b={17:7(){c 7(){6.1I.2n(6,N)}}};d 1e=z q();q.u=7(5d,O){G(d 1G 2M O){5d[1G]=O[1G]}c 5d};q.1U=7(U){1j{f(U==1v)c\'1v\';f(U==1L)c\'1L\';c U.1U?U.1U():U.2C()}1s(e){f(e 8R 9l)c\'...\';25 e}};7j.v.1d=7(){d 43=6,23=$A(N),U=23.8S();c 7(){c 43.2n(U,23.3s($A(N)))}};7j.v.8U=7(U){d 43=6;c 7(C){c 43.8V(U,C||1W.C)}};q.u(8Q.v,{8W:7(){d 4Z=6.2C(16);f(6<16)c\'0\'+4Z;c 4Z},5j:7(){c 6+1},8Y:7(o){$R(0,6,11).V(o);c 6}});d 6s={6j:7(){d 48;G(d i=0;i<N.t;i++){d 6L=N[i];1j{48=6L();1y}1s(e){}}c 48}};d 6Q=1b.17();6Q.v={1I:7(1a,1J){6.1a=1a;6.1J=1J;6.41=Y;6.2A()},2A:7(){5Z(6.2D.1d(6),6.1J*4z)},2D:7(){f(!6.41){1j{6.41=11;6.1a()}8Z{6.41=Y}}}};q.u(4b.v,{2T:7(1A,1z){d L=\'\',O=6,I;1z=N.90.52(1z);1H(O.t>0){f(I=O.I(1A)){L+=O.47(0,I.w);L+=(1z(I)||\'\').2C();O=O.47(I.w+I[0].t)}1D{L+=O,O=\'\'}}c L},92:7(1A,1z,3i){1z=6.2T.52(1z);3i=3i===1v?1:3i;c 6.2T(1A,7(I){f(--3i<0)c I[0];c 1z(I)})},93:7(1A,o){6.2T(1A,o);c 6},94:7(t,2S){t=t||30;2S=2S===1v?\'...\':2S;c 6.t>t?6.47(0,t-2S.t)+2S:6},9F:7(){c 6.2y(/^\\s+/,\'\').2y(/\\s+$/,\'\')},71:7(){c 6.2y(/<\\/?[^>]+>/7Y,\'\')},2Q:7(){c 6.2y(z 3O(T.3E,\'5P\'),\'\')},70:7(){d 6Y=z 3O(T.3E,\'5P\');d 5p=z 3O(T.3E,\'98\');c(6.I(6Y)||[]).1C(7(5o){c(5o.I(5p)||[\'\',\'\'])[1]})},3q:7(){c 6.70().1C(7(3G){c 4q(3G)})},9E:7(){d 1q=J.4Y(\'1q\');d 1Y=J.9D(6);1q.75(1Y);c 1q.3h},9c:7(){d 1q=J.4Y(\'1q\');1q.3h=6.71();c 1q.2z[0]?1q.2z[0].6q:\'\'},78:7(){d 7i=6.I(/^\\??(.*)$/)[1].3j(\'&\');c 7i.36({},7(5b,72){d 1i=72.3j(\'=\');5b[1i[0]]=1i[1];c 5b})},1Z:7(){c 6.3j(\'\')},3P:7(){d 2l=6.3j(\'-\');f(2l.t==1)c 2l[0];d 54=6.5g(\'-\')==0?2l[0].7e(0).3Y()+2l[0].7g(1):2l[0];G(d i=1,73=2l.t;i<73;i++){d s=2l[i];54+=s.7e(0).3Y()+s.7g(1)}c 54},1U:7(){c"\'"+6.2y(/\\\\/g,\'\\\\\\\\\').2y(/\'/g,\'\\\\\\\'\')+"\'"}});4b.v.2T.52=7(1z){f(2i 1z==\'7\')c 1z;d 2U=z 3n(1z);c 7(I){c 2U.7a(I)}};4b.v.9h=4b.v.78;d 3n=1b.17();3n.79=/(^|.|\\r|\\n)(#\\{(.*?)\\})/;3n.v={1I:7(2U,1A){6.2U=2U.2C();6.1A=1A||3n.79},7a:7(U){c 6.2U.2T(6.1A,7(I){d 53=I[1];f(53==\'\\\\\')c I[2];c 53+(U[I[3]]||\'\').2C()})}};d $1y=z q();d $49=z q();d 1p={V:7(o){d w=0;1j{6.2m(7(h){1j{o(h,w++)}1s(e){f(e!=$49)25 e}})}1s(e){f(e!=$1y)25 e}},9n:7(o){d L=11;6.V(7(h,w){L=L&&!!(o||T.K)(h,w);f(!L)25 $1y});c L},9o:7(o){d L=11;6.V(7(h,w){f(L=!!(o||T.K)(h,w))25 $1y});c L},3e:7(o){d P=[];6.V(7(h,w){P.W(o(h,w))});c P},7n:7(o){d L;6.V(7(h,w){f(o(h,w)){L=h;25 $1y}});c L},7o:7(o){d P=[];6.V(7(h,w){f(o(h,w))P.W(h)});c P},9p:7(1A,o){d P=[];6.V(7(h,w){d 7c=h.2C();f(7c.I(1A))P.W((o||T.K)(h,w))});c P},1M:7(U){d 51=Y;6.V(7(h){f(h==U){51=11;25 $1y}});c 51},36:7(45,o){6.V(7(h,w){45=o(45,h,w)});c 45},9q:7(1F){d 23=$A(N).47(1);c 6.3e(7(h){c h[1F].2n(h,23)})},9s:7(o){d L;6.V(7(h,w){h=(o||T.K)(h,w);f(L==1v||h>=L)L=h});c L},9u:7(o){d L;6.V(7(h,w){h=(o||T.K)(h,w);f(L==1v||h<L)L=h});c L},9v:7(o){d 50=[],58=[];6.V(7(h,w){((o||T.K)(h,w)?50:58).W(h)});c[50,58]},3r:7(1G){d P=[];6.V(7(h,w){P.W(h[1G])});c P},9x:7(o){d P=[];6.V(7(h,w){f(!o(h,w))P.W(h)});c P},9y:7(o){c 6.3e(7(h,w){c{h:h,59:o(h,w)}}).9z(7(18,3U){d a=18.59,b=3U.59;c a<b?-1:a>b?1:0}).3r(\'h\')},1Z:7(){c 6.3e(T.K)},9B:7(){d o=T.K,23=$A(N);f(2i 23.5e()==\'7\')o=23.9C();d 7l=[6].3s(23).1C($A);c 6.1C(7(h,w){c o(7l.3r(w))})},1U:7(){c\'#<1p:\'+6.1Z().1U()+\'>\'}};q.u(1p,{1C:1p.3e,5v:1p.7n,1k:1p.7o,8M:1p.1M,7p:1p.1Z});d $A=1E.7q=7(2R){f(!2R)c[];f(2R.1Z){c 2R.1Z()}1D{d P=[];G(d i=0;i<2R.t;i++)P.W(2R[i]);c P}};q.u(1E.v,1p);f(!1E.v.4d)1E.v.4d=1E.v.4m;q.u(1E.v,{2m:7(o){G(d i=0;i<6.t;i++)o(6[i])},5i:7(){6.t=0;c 6},7r:7(){c 6[0]},5e:7(){c 6[6.t-1]},7s:7(){c 6.1k(7(h){c h!=1v||h!=1L})},6J:7(){c 6.36([],7(6H,h){c 6H.3s(h&&h.5D==1E?h.6J():[h])})},5s:7(){d 4N=$A(N);c 6.1k(7(h){c!4N.1M(h)})},5g:7(U){G(d i=0;i<6.t;i++)f(6[i]==U)c i;c-1},4m:7(5h){c(5h!==Y?6:6.1Z()).4d()},1U:7(){c\'[\'+6.1C(q.1U).1N(\', \')+\']\'}});d 4h={2m:7(o){G(d 1O 2M 6){d h=6[1O];f(2i h==\'7\')49;d 1i=[1O,h];1i.1O=1O;1i.h=h;o(1i)}},7t:7(){c 6.3r(\'1O\')},4N:7(){c 6.3r(\'h\')},7u:7(2N){c $H(2N).36($H(6),7(4Q,1i){4Q[1i.1O]=1i.h;c 4Q})},7w:7(){c 6.1C(7(1i){c 1i.1C(4n).1N(\'=\')}).1N(\'&\')},1U:7(){c\'#<4h:{\'+6.1C(7(1i){c 1i.1C(q.1U).1N(\': \')}).1N(\', \')+\'}>\'}};7 $H(U){d 2N=q.u({},U||{});q.u(2N,1p);q.u(2N,4h);c 2N};3L=1b.17();q.u(3L.v,1p);q.u(3L.v,{1I:7(22,2x,2H){6.22=22;6.2x=2x;6.2H=2H},2m:7(o){d h=6.22;2q{o(h);h=h.5j()}1H(6.1M(h))},1M:7(h){f(h<6.22)c Y;f(6.2H)c h<6.2x;c h<=6.2x}});d $R=7(22,2x,2H){c z 3L(22,2x,2H)};d M={4w:7(){c 6s.6j(7(){c z 5C()},7(){c z 5n(\'7y.6d\')},7(){c z 5n(\'7z.6d\')})||Y},4s:0};M.2W={3b:[],2m:7(o){6.3b.2m(o)},69:7(4F){f(!6.1M(4F))6.3b.W(4F)},7A:7(5t){6.3b=6.3b.5s(5t)},3y:7(1a,26,E,2Z){6.V(7(3o){f(3o[1a]&&2i 3o[1a]==\'7\'){1j{3o[1a].2n(3o,[26,E,2Z])}1s(e){}}})}};q.u(M.2W,1p);M.2W.69({5G:7(){M.4s++},1B:7(){M.4s--}});M.44=7(){};M.44.v={4a:7(m){6.m={1F:\'4j\',4p:11,5H:\'5E/x-86-Q-7C\',28:\'\'};q.u(6.m,m||{})},3l:7(){c 6.E.32==1v||6.E.32==0||(6.E.32>=84&&6.E.32<7E)},7G:7(){c!6.3l()}};M.3t=1b.17();M.3t.5L=[\'7H\',\'80\',\'7I\',\'7J\',\'4t\'];M.3t.v=q.u(z M.44(),{1I:7(1l,m){6.E=M.4w();6.4a(m);6.26(1l)},26:7(1l){d 28=6.m.28||\'\';f(28.t>0)28+=\'&7K=\';1j{6.1l=1l;f(6.m.1F==\'7L\'&&28.t>0)6.1l+=(6.1l.I(/\\?/)?\'&\':\'?\')+28;M.2W.3y(\'5G\',6,6.E);6.E.7N(6.m.1F,6.1l,6.m.4p);f(6.m.4p){6.E.5T=6.5J.1d(6);2Y((7(){6.4r(1)}).1d(6),10)}6.5A();d 1c=6.m.5V?6.m.5V:28;6.E.7O(6.m.1F==\'4j\'?1c:1L)}1s(e){6.3p(e)}},5A:7(){d 1P=[\'X-7P-7Q\',\'5C\',\'X-T-4l\',T.4l,\'7R\',\'1Y/7m, 1Y/2e, 5E/5F, 1Y/5F, */*\'];f(6.m.1F==\'4j\'){1P.W(\'5Q-2g\',6.m.5H);f(6.E.7S)1P.W(\'7T\',\'7U\')}f(6.m.1P)1P.W.2n(1P,6.m.1P);G(d i=0;i<1P.t;i+=2)6.E.7V(1P[i],1P[i+1])},5J:7(){d 2F=6.E.2F;f(2F!=1)6.4r(6.E.2F)},4A:7(B){1j{c 6.E.7W(B)}1s(e){}},5M:7(){1j{c 4q(\'(\'+6.4A(\'X-7X\')+\')\')}1s(e){}},5R:7(){1j{c 4q(6.E.3F)}1s(e){6.3p(e)}},4r:7(2F){d C=M.3t.5L[2F];d E=6.E,2Z=6.5M();f(C==\'4t\'){1j{(6.m[\'2I\'+6.E.32]||6.m[\'2I\'+(6.3l()?\'81\':\'82\')]||T.2v)(E,2Z)}1s(e){6.3p(e)}f((6.4A(\'5Q-2g\')||\'\').I(/^1Y\\/7m/i))6.5R()}1j{(6.m[\'2I\'+C]||T.2v)(E,2Z);M.2W.3y(\'2I\'+C,6,E,2Z)}1s(e){6.3p(e)}f(C==\'4t\')6.E.5T=T.2v},3p:7(57){(6.m.5W||T.2v)(6,57);M.2W.3y(\'5W\',6,57)}});M.4C=1b.17();q.u(q.u(M.4C.v,M.3t.v),{1I:7(1w,1l,m){6.4x={3m:1w.3m?$(1w.3m):$(1w),3z:1w.3z?$(1w.3z):(1w.3m?1L:$(1w))};6.E=M.4w();6.4a(m);d 1B=6.m.1B||T.2v;6.m.1B=(7(E,U){6.5Y();1B(E,U)}).1d(6);6.26(1l)},5Y:7(){d 3A=6.3l()?6.4x.3m:6.4x.3z;d 3k=6.E.3F;f(!6.m.3q)3k=3k.2Q();f(3A){f(6.m.60){z 6.m.60(3A,3k)}1D{k.6h(3A,3k)}}f(6.3l()){f(6.1B)2Y(6.1B.1d(6),10)}}});M.61=1b.17();M.61.v=q.u(z M.44(),{1I:7(1w,1l,m){6.4a(m);6.1B=6.m.1B;6.1J=(6.m.1J||2);6.2s=(6.m.2s||1);6.4B={};6.1w=1w;6.1l=1l;6.22()},22:7(){6.m.1B=6.63.1d(6);6.2D()},7b:7(){6.4B.1B=1v;89(6.65);(6.1B||T.2v).2n(6,N)},63:7(26){f(6.m.2s){6.2s=(26.3F==6.64?6.2s*6.m.2s:1);6.64=26.3F}6.65=2Y(6.2D.1d(6),6.2s*6.1J*4z)},2D:7(){6.4B=z M.4C(6.1w,6.1l,6.m)}});7 $(){d P=[],4;G(d i=0;i<N.t;i++){4=N[i];f(2i 4==\'8c\')4=J.8d(4);P.W(k.u(4))}c P.t<2?P[0]:P};J.8f=7(1f,6a){d 6b=($(6a)||J.1c).4D(\'*\');c $A(6b).36([],7(12,4E){f(4E.1f.I(z 3O("(^|\\\\s)"+1f+"(\\\\s|$)")))12.W(k.u(4E));c 12})};f(!1W.k)d k=z q();k.u=7(4){f(!4)c;f(4X)c 4;f(!4.6e&&4.1h&&4!=1W){d 2a=k.3d,2r=k.u.2r;G(d 1G 2M 2a){d h=2a[1G];f(2i h==\'7\')4[1G]=2r.4W(h)}}4.6e=11;c 4};k.u.2r={4W:7(h){c 6[h]=6[h]||7(){c h.2n(1L,[6].3s($A(N)))}}};k.3d={4U:7(4){c $(4).l.2B!=\'3Q\'},6N:7(){G(d i=0;i<N.t;i++){d 4=$(N[i]);k[k.4U(4)?\'6f\':\'6w\'](4)}},6f:7(){G(d i=0;i<N.t;i++){d 4=$(N[i]);4.l.2B=\'3Q\'}},6w:7(){G(d i=0;i<N.t;i++){d 4=$(N[i]);4.l.2B=\'\'}},42:7(4){4=$(4);4.1X.8h(4)},6h:7(4,2e){$(4).3h=2e.2Q();2Y(7(){2e.3q()},10)},2y:7(4,2e){4=$(4);f(4.6k){4.6k=2e.2Q()}1D{d 1K=4.6R.6S();1K.56(4);4.1X.8i(1K.6T(2e.2Q()),4)}2Y(7(){2e.3q()},10)},8k:7(4){4=$(4);c 4.2k},3K:7(4){c z k.3S(4)},8l:7(4,1f){f(!(4=$(4)))c;c k.3K(4).1M(1f)},8m:7(4,1f){f(!(4=$(4)))c;c k.3K(4).7k(1f)},8n:7(4,1f){f(!(4=$(4)))c;c k.3K(4).42(1f)},8p:7(4){4=$(4);G(d i=0;i<4.2z.t;i++){d 3M=4.2z[i];f(3M.8q==3&&!/\\S/.4v(3M.6q))k.42(3M)}},8r:7(4){c $(4).3h.I(/^\\s*$/)},8s:7(4,3I){4=$(4),3I=$(3I);1H(4=4.1X)f(4==3I)c 11;c Y},6t:7(4){4=$(4);d x=4.x?4.x:4.2f,y=4.y?4.y:4.29;1W.6t(x,y)},1R:7(4,l){4=$(4);d h=4.l[l.3P()];f(!h){f(J.4J&&J.4J.6v){d 4L=J.4J.6v(4,1L);h=4L?4L.8v(l):1L}1D f(4.6x){h=4.6x[l.3P()]}}f(1W.6E&&[\'18\',\'1n\',\'3U\',\'6G\'].1M(l))f(k.1R(4,\'14\')==\'4G\')h=\'6y\';c h==\'6y\'?1L:h},8x:7(4,l){4=$(4);G(d B 2M l)4.l[B.3P()]=l[B]},8y:7(4){4=$(4);f(k.1R(4,\'2B\')!=\'3Q\')c{21:4.2p,24:4.2k};d 20=4.l;d 6B=20.4O;d 6A=20.14;20.4O=\'31\';20.14=\'2o\';20.2B=\'\';d 6C=4.6m;d 6D=4.6p;20.2B=\'3Q\';20.14=6A;20.4O=6B;c{21:6C,24:6D}},8z:7(4){4=$(4);d 4R=k.1R(4,\'14\');f(4R==\'4G\'||!4R){4.4T=11;4.l.14=\'3T\';f(1W.6E){4.l.1n=0;4.l.18=0}}},8A:7(4){4=$(4);f(4.4T){4.4T=1v;4.l.14=4.l.1n=4.l.18=4.l.6G=4.l.3U=\'\'}},8B:7(4){4=$(4);f(4.3c)c;4.3c=4.l.3V;f((k.1R(4,\'3V\')||\'4U\')!=\'31\')4.l.3V=\'31\'},8D:7(4){4=$(4);f(4.3c)c;4.l.3V=4.3c;4.3c=1v}};q.u(k,k.3d);d 4X=Y;f(!3W&&/3x|3w|3u/.4v(33.62)){d 3W={}};k.6K=7(2a){q.u(k.3d,2a||{});f(2i 3W!=\'1v\'){d 2a=k.3d,2r=k.u.2r;G(d 1G 2M 2a){d h=2a[1G];f(2i h==\'7\')3W.v[1G]=2r.4W(h)}4X=11}};k.6K();d 6M=z q();6M.2B=k.6N;1e.1g=7(3f){6.3f=3f};1e.1g.v={1I:7(4,2t){6.4=$(4);6.2t=2t.2Q();f(6.3f&&6.4.6O){1j{6.4.6O(6.3f,6.2t)}1s(e){d 1h=6.4.1h.2w();f(1h==\'4V\'||1h==\'8N\'){6.2X(6.6U())}1D{25 e}}}1D{6.1K=6.4.6R.6S();f(6.2V)6.2V();6.2X([6.1K.6T(6.2t)])}2Y(7(){2t.3q()},10)},6U:7(){d 1q=J.4Y(\'1q\');1q.3h=\'<6V><4V>\'+6.2t+\'</4V></6V>\';c $A(1q.2z[0].2z[0].2z)}};d 1g=z q();1g.6W=1b.17();1g.6W.v=q.u(z 1e.1g(\'96\'),{2V:7(){6.1K.97(6.4)},2X:7(2h){2h.V((7(2j){6.4.1X.55(2j,6.4)}).1d(6))}});1g.5m=1b.17();1g.5m.v=q.u(z 1e.1g(\'99\'),{2V:7(){6.1K.56(6.4);6.1K.74(11)},2X:7(2h){2h.4m(Y).V((7(2j){6.4.55(2j,6.4.9a)}).1d(6))}});1g.7h=1b.17();1g.7h.v=q.u(z 1e.1g(\'9d\'),{2V:7(){6.1K.56(6.4);6.1K.74(6.4)},2X:7(2h){2h.V((7(2j){6.4.75(2j)}).1d(6))}});1g.76=1b.17();1g.76.v=q.u(z 1e.1g(\'9i\'),{2V:7(){6.1K.9m(6.4)},2X:7(2h){2h.V((7(2j){6.4.1X.55(2j,6.4.9t)}).1d(6))}});k.3S=1b.17();k.3S.v={1I:7(4){6.4=$(4)},2m:7(o){6.4.1f.3j(/\\s+/).1k(7(B){c B.t>0}).2m(o)},5c:7(1f){6.4.1f=1f},7k:7(5a){f(6.1M(5a))c;6.5c(6.1Z().3s(5a).1N(\' \'))},42:7(4c){f(!6.1M(4c))c;6.5c(6.1k(7(1f){c 1f!=4c}).1N(\' \'))},2C:7(){c 6.1Z().1N(\' \')}};q.u(k.3S.v,1p);d 5I={5i:7(){G(d i=0;i<N.t;i++)$(N[i]).h=\'\'},4f:7(4){$(4).4f()},7v:7(){G(d i=0;i<N.t;i++)f($(N[i]).h==\'\')c Y;c 11},1k:7(4){$(4).1k()},5y:7(4){4=$(4);4.4f();f(4.1k)4.1k()}};d D={3a:7(Q){d 12=D.2L($(Q));d 4I=z 1E();G(d i=0;i<12.t;i++){d 4g=D.k.3a(12[i]);f(4g)4I.W(4g)}c 4I.1N(\'&\')},2L:7(Q){Q=$(Q);d 12=z 1E();G(d 1h 2M D.k.2E){d 4H=Q.4D(1h);G(d j=0;j<4H.t;j++)12.W(4H[j])}c 12},7x:7(Q,3N,B){Q=$(Q);d 3H=Q.4D(\'2u\');f(!3N&&!B)c 3H;d 4y=z 1E();G(d i=0;i<3H.t;i++){d 2u=3H[i];f((3N&&2u.2g!=3N)||(B&&2u.B!=B))49;4y.W(2u)}c 4y},7B:7(Q){d 12=D.2L(Q);G(d i=0;i<12.t;i++){d 4=12[i];4.7D();4.4o=\'11\'}},7F:7(Q){d 12=D.2L(Q);G(d i=0;i<12.t;i++){d 4=12[i];4.4o=\'\'}},5z:7(Q){c D.2L(Q).5v(7(4){c 4.2g!=\'31\'&&!4.4o&&[\'2u\',\'1k\',\'3J\'].1M(4.1h.2w())})},7M:7(Q){5I.5y(D.5z(Q))},5w:7(Q){$(Q).5w()}};D.k={3a:7(4){4=$(4);d 1F=4.1h.2w();d 1S=D.k.2E[1F](4);f(1S){d 1O=4n(1S[0]);f(1O.t==0)c;f(1S[1].5D!=1E)1S[1]=[1S[1]];c 1S[1].1C(7(h){c 1O+\'=\'+4n(h)}).1N(\'&\')}},1x:7(4){4=$(4);d 1F=4.1h.2w();d 1S=D.k.2E[1F](4);f(1S)c 1S[1]}};D.k.2E={2u:7(4){6c(4.2g.2w()){1r\'7Z\':1r\'31\':1r\'6l\':1r\'1Y\':c D.k.2E.3J(4);1r\'6g\':1r\'6i\':c D.k.2E.5O(4)}c Y},5O:7(4){f(4.83)c[4.B,4.h]},3J:7(4){c[4.B,4.h]},1k:7(4){c D.k.2E[4.2g==\'1k-6n\'?\'5S\':\'5X\'](4)},5S:7(4){d h=\'\',2b,w=4.85;f(w>=0){2b=4.m[w];h=2b.h||2b.1Y}c[4.B,h]},5X:7(4){d h=[];G(d i=0;i<4.t;i++){d 2b=4.m[i];f(2b.87)h.W(2b.h||2b.1Y)}c[4.B,h]}};d $F=D.k.1x;1e.3D=7(){};1e.3D.v={1I:7(4,1J,1a){6.1J=1J;6.4=$(4);6.1a=1a;6.2K=6.1x();6.2A()},2A:7(){5Z(6.2D.1d(6),6.1J*4z)},2D:7(){d h=6.1x();f(6.2K!=h){6.1a(6.4,h);6.2K=h}}};D.k.3C=1b.17();D.k.3C.v=q.u(z 1e.3D(),{1x:7(){c D.k.1x(6.4)}});D.3C=1b.17();D.3C.v=q.u(z 1e.3D(),{1x:7(){c D.3a(6.4)}});1e.2c=7(){};1e.2c.v={1I:7(4,1a){6.4=$(4);6.1a=1a;6.2K=6.1x();f(6.4.1h.2w()==\'Q\')6.67();1D 6.2A(6.4)},4K:7(){d h=6.1x();f(6.2K!=h){6.1a(6.4,h);6.2K=h}},67:7(){d 12=D.2L(6.4);G(d i=0;i<12.t;i++)6.2A(12[i])},2A:7(4){f(4.2g){6c(4.2g.2w()){1r\'6g\':1r\'6i\':1o.3B(4,\'8j\',6.4K.1d(6));1y;1r\'6l\':1r\'1Y\':1r\'3J\':1r\'1k-6n\':1r\'1k-8t\':1o.3B(4,\'8u\',6.4K.1d(6));1y}}}};D.k.2c=1b.17();D.k.2c.v=q.u(z 1e.2c(),{1x:7(){c D.k.1x(6.4)}});D.2c=1b.17();D.2c.v=q.u(z 1e.2c(),{1x:7(){c D.3a(6.4)}});f(!1W.1o){d 1o=z q()}q.u(1o,{8C:8,8F:9,8H:13,8I:27,8J:37,8L:38,8O:39,8T:40,8X:46,4:7(C){c C.Z||C.91},95:7(C){c(((C.6X)&&(C.6X==1))||((C.6Z)&&(C.6Z==1)))},9b:7(C){c C.9e||(C.9f+(J.3R.2G||J.1c.2G))},9g:7(C){c C.9j||(C.9k+(J.3R.2O||J.1c.2O))},7b:7(C){f(C.7d){C.7d();C.9r()}1D{C.48=Y;C.9w=11}},9A:7(C,1h){d 4=1o.4(C);1H(4.1X&&(!4.1h||(4.1h.3Y()!=1h.3Y())))4=4.1X;c 4},1T:Y,5u:7(4,B,1V,1u){f(!6.1T)6.1T=[];f(4.5f){6.1T.W([4,B,1V,1u]);4.5f(B,1V,1u)}1D f(4.4i){6.1T.W([4,B,1V,1u]);4.4i(\'2I\'+B,1V)}},66:7(){f(!1o.1T)c;G(d i=0;i<1o.1T.t;i++){1o.5N.2n(6,1o.1T[i]);1o.1T[i][0]=1L}1o.1T=Y},3B:7(4,B,1V,1u){d 4=$(4);1u=1u||Y;f(B==\'5U\'&&(33.4u.I(/3x|3w|3u/)||4.4i))B=\'5K\';6.5u(4,B,1V,1u)},5N:7(4,B,1V,1u){d 4=$(4);1u=1u||Y;f(B==\'5U\'&&(33.4u.I(/3x|3w|3u/)||4.4k))B=\'5K\';f(4.5x){4.5x(B,1V,1u)}1D f(4.4k){1j{4.4k(\'2I\'+B,1V)}1s(e){}}}});f(33.4u.I(/\\88\\b/))1o.3B(1W,\'8a\',1o.66,Y);d 2d={6o:Y,4P:7(){6.6z=1W.8e||J.3R.2G||J.1c.2G||0;6.6F=1W.8g||J.3R.2O||J.1c.2O||0},6u:7(4){d 19=0,15=0;2q{19+=4.2O||0;15+=4.2G||0;4=4.1X}1H(4);c[15,19]},35:7(4){d 19=0,15=0;2q{19+=4.29||0;15+=4.2f||0;4=4.1Q}1H(4);c[15,19]},68:7(4){d 19=0,15=0;2q{19+=4.29||0;15+=4.2f||0;4=4.1Q;f(4){p=k.1R(4,\'14\');f(p==\'3T\'||p==\'2o\')1y}}1H(4);c[15,19]},1Q:7(4){f(4.1Q)c 4.1Q;f(4==J.1c)c 4;1H((4=4.1X)&&4!=J.1c)f(k.1R(4,\'14\')!=\'4G\')c 4;c J.1c},8o:7(4,x,y){f(6.6o)c 6.6r(4,x,y);6.3g=x;6.34=y;6.1t=6.35(4);c(y>=6.1t[1]&&y<6.1t[1]+4.2k&&x>=6.1t[0]&&x<6.1t[0]+4.2p)},6r:7(4,x,y){d 4S=6.6u(4);6.3g=x+4S[0]-6.6z;6.34=y+4S[1]-6.6F;6.1t=6.35(4);c(6.34>=6.1t[1]&&6.34<6.1t[1]+4.2k&&6.3g>=6.1t[0]&&6.3g<6.1t[0]+4.2p)},8E:7(3Z,4){f(!3Z)c 0;f(3Z==\'8G\')c((6.1t[1]+4.2k)-6.34)/4.2k;f(3Z==\'8K\')c((6.1t[0]+4.2p)-6.3g)/4.2p},77:7(O,Z){O=$(O);Z=$(Z);Z.l.14=\'2o\';d 2P=6.35(O);Z.l.1n=2P[1]+\'1m\';Z.l.18=2P[0]+\'1m\';Z.l.21=O.2p+\'1m\';Z.l.24=O.2k+\'1m\'},4e:7(4M){d 19=0,15=0;d 4=4M;2q{19+=4.29||0;15+=4.2f||0;f(4.1Q==J.1c)f(k.1R(4,\'14\')==\'2o\')1y}1H(4=4.1Q);4=4M;2q{19-=4.2O||0;15-=4.2G||0}1H(4=4.1X);c[15,19]},77:7(O,Z){d m=q.u({5l:11,5r:11,5B:11,5q:11,29:0,2f:0},N[2]||{});O=$(O);d p=2d.4e(O);Z=$(Z);d 2J=[0,0];d 3v=1L;f(k.1R(Z,\'14\')==\'2o\'){3v=2d.1Q(Z);2J=2d.4e(3v)}f(3v==J.1c){2J[0]-=J.1c.2f;2J[1]-=J.1c.29}f(m.5l)Z.l.18=(p[0]-2J[0]+m.2f)+\'1m\';f(m.5r)Z.l.1n=(p[1]-2J[1]+m.29)+\'1m\';f(m.5B)Z.l.21=O.2p+\'1m\';f(m.5q)Z.l.24=O.2k+\'1m\'},8b:7(4){4=$(4);f(4.l.14==\'2o\')c;2d.4P();d 2P=2d.68(4);d 1n=2P[1];d 18=2P[0];d 21=4.6m;d 24=4.6p;4.6P=18-3X(4.l.18||0);4.6I=1n-3X(4.l.1n||0);4.5k=4.l.21;4.7f=4.l.24;4.l.14=\'2o\';4.l.1n=1n+\'1m\';4.l.18=18+\'1m\';4.l.21=21+\'1m\';4.l.24=24+\'1m\'},8w:7(4){4=$(4);f(4.l.14==\'3T\')c;2d.4P();4.l.14=\'3T\';d 1n=3X(4.l.1n||0)-(4.6I||0);d 18=3X(4.l.18||0)-(4.6P||0);4.l.1n=1n+\'1m\';4.l.18=18+\'1m\';4.l.24=4.7f;4.l.21=4.5k}};f(/3x|3w|3u/.4v(33.62)){2d.35=7(4){d 19=0,15=0;2q{19+=4.29||0;15+=4.2f||0;f(4.1Q==J.1c)f(k.1R(4,\'14\')==\'2o\')1y;4=4.1Q}1H(4);c[15,19]}};',62,600,'||||element||this|function|||||return|var||if||value|||Element|style|options||iterator||Object|||length|extend|prototype|index|||new||name|event|Form|transport||for||match|document||result|Ajax|arguments|source|results|form|||Prototype|object|each|push||false|target||true|elements||position|valueL||create|left|valueT|callback|Class|body|bind|Abstract|className|Insertion|tagName|pair|try|select|url|px|top|Event|Enumerable|div|case|catch|offset|useCapture|undefined|container|getValue|break|replacement|pattern|onComplete|map|else|Array|method|property|while|initialize|frequency|range|null|include|join|key|requestHeaders|offsetParent|getStyle|parameter|observers|inspect|observer|window|parentNode|text|toArray|els|width|start|args|height|throw|request||parameters|offsetTop|methods|opt|EventObserver|Position|html|offsetLeft|type|fragments|typeof|fragment|offsetHeight|oStringList|_each|apply|absolute|offsetWidth|do|cache|decay|content|input|emptyFunction|toLowerCase|end|replace|childNodes|registerCallback|display|toString|onTimerEvent|Serializers|readyState|scrollLeft|exclusive|on|delta|lastValue|getElements|in|hash|scrollTop|offsets|stripScripts|iterable|truncation|gsub|template|initializeRange|Responders|insertContent|setTimeout|json||hidden|status|navigator|ycomp|cumulativeOffset|inject||||serialize|responders|_overflow|Methods|collect|adjacency|xcomp|innerHTML|count|split|response|responseIsSuccess|success|Template|responder|dispatchException|evalScripts|pluck|concat|Request|KHTML|parent|Safari|Konqueror|dispatch|failure|receiver|observe|Observer|TimedObserver|ScriptFragment|responseText|script|inputs|ancestor|textarea|classNames|ObjectRange|node|typeName|RegExp|camelize|none|documentElement|ClassNames|relative|right|overflow|HTMLElement|parseFloat|toUpperCase|mode||currentlyExecuting|remove|__method|Base|memo||slice|returnValue|continue|setOptions|String|classNameToRemove|_reverse|page|focus|queryComponent|Hash|attachEvent|post|detachEvent|Version|reverse|encodeURIComponent|disabled|asynchronous|eval|respondToReadyState|activeRequestCount|Complete|appVersion|test|getTransport|containers|matchingInputs|1000|header|updater|Updater|getElementsByTagName|child|responderToAdd|static|tagElements|queryComponents|defaultView|onElementEvent|css|forElement|values|visibility|prepare|mergedHash|pos|offsetcache|_madePositioned|visible|tbody|findOrStore|_nativeExtensions|createElement|digits|trues|found|prepareReplacement|before|camelizedString|insertBefore|selectNodeContents|exception|falses|criteria|classNameToAdd|params|set|destination|last|addEventListener|indexOf|inline|clear|succ|_originalWidth|setLeft|Top|ActiveXObject|scriptTag|matchOne|setHeight|setTop|without|responderToRemove|_observeAndCache|find|reset|removeEventListener|activate|findFirstElement|setRequestHeaders|setWidth|XMLHttpRequest|constructor|application|xml|onCreate|contentType|Field|onStateChange|keydown|Events|evalJSON|stopObserving|inputSelector|img|Content|evalResponse|selectOne|onreadystatechange|keypress|postBody|onException|selectMany|updateContent|setInterval|insertion|PeriodicalUpdater|userAgent|updateComplete|lastText|timer|unloadCache|registerFormCallbacks|positionedOffset|register|parentElement|children|switch|XMLHTTP|_extended|hide|checkbox|update|radio|these|outerHTML|password|clientWidth|one|includeScrollOffsets|clientHeight|nodeValue|withinIncludingScrolloffsets|Try|scrollTo|realOffset|getComputedStyle|show|currentStyle|auto|deltaX|originalPosition|originalVisibility|originalWidth|originalHeight|opera|deltaY|bottom|array|_originalTop|flatten|addMethods|lambda|Toggle|toggle|insertAdjacentHTML|_originalLeft|PeriodicalExecuter|ownerDocument|createRange|createContextualFragment|contentFromAnonymousTable|table|Before|which|matchAll|button|extractScripts|stripTags|pairString|len|collapse|appendChild|After|clone|toQueryParams|Pattern|evaluate|stop|stringValue|preventDefault|charAt|_originalHeight|substring|Bottom|pairs|Function|add|collections|javascript|detect|findAll|entries|from|first|compact|keys|merge|present|toQueryString|getInputs|Msxml2|Microsoft|unregister|disable|urlencoded|blur|300|enable|responseIsFailure|Uninitialized|Loaded|Interactive|_|get|focusFirstElement|open|send|Requested|With|Accept|overrideMimeType|Connection|close|setRequestHeader|getResponseHeader|JSON|gi|submit|Loading|Success|Failure|checked|200|selectedIndex|www|selected|bMSIE|clearTimeout|unload|absolutize|string|getElementById|pageXOffset|getElementsByClassName|pageYOffset|removeChild|replaceChild|click|getHeight|hasClassName|addClassName|removeClassName|within|cleanWhitespace|nodeType|empty|childOf|multiple|change|getPropertyValue|relativize|setStyle|getDimensions|makePositioned|undoPositioned|makeClipping|KEY_BACKSPACE|undoClipping|overlap|KEY_TAB|vertical|KEY_RETURN|KEY_ESC|KEY_LEFT|horizontal|KEY_UP|member|tr|KEY_RIGHT|0_RC_0|Number|instanceof|shift|KEY_DOWN|bindAsEventListener|call|toColorPart|KEY_DELETE|times|finally|callee|srcElement|sub|scan|truncate|isLeftClick|beforeBegin|setStartBefore|im|afterBegin|firstChild|pointerX|unescapeHTML|beforeEnd|pageX|clientX|pointerY|parseQuery|afterEnd|pageY|clientY|RangeError|setStartAfter|all|any|grep|invoke|stopPropagation|max|nextSibling|min|partition|cancelBubble|reject|sortBy|sort|findElement|zip|pop|createTextNode|escapeHTML|strip'.split('|'),0,{})
+
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/sunspider-string-validate-input.html b/tests/sunspider-string-validate-input.html
new file mode 100644
index 0000000..1ef56ce
--- /dev/null
+++ b/tests/sunspider-string-validate-input.html
@@ -0,0 +1,109 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+var letters = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
+var numbers = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26);
+var colors  = new Array("FF","CC","99","66","33","00");
+
+var endResult;
+
+function testEmail()
+{
+   endResult = "";
+   var r;
+
+   // make up email address
+   for (var k=0;k<2000;k++)
+   {
+      var name = makeName(6);
+      var email = (k%2)?name+"@mac.com":name+"(at)mac.com";
+
+      // validate the email address
+      var pattern = /^[a-zA-Z0-9\-\._]+@[a-zA-Z0-9\-_]+(\.?[a-zA-Z0-9\-_]*)\.[a-zA-Z]{2,3}$/;
+
+      if(pattern.test(email))
+      {
+         r = email + " appears to be a valid email address.";
+         addResult(r);
+      }
+      else
+      {
+         r = email + " does NOT appear to be a valid email address.";
+         addResult(r);
+      }
+   }
+}
+
+function testZip()
+{
+   endResult = "";
+   var r;
+
+   // make up ZIP codes
+   for (var s=0;s<2000;s++)
+   {
+      var zipGood = true;
+      var zip = makeNumber(4);
+      (s%2)?zip=zip+"xyz":zip=zip.concat("7");
+
+      // validate the zip code
+      for (var i = 0; i < zip.length; i++) {
+          var ch = zip.charAt(i);
+          if (ch < "0" || ch > "9") {
+              zipGood = false;
+              r = zip + " contains letters.";
+              addResult(r);
+          }
+      }
+      if (zipGood && zip.length>5)
+      {
+         zipGood = false;
+         r = zip + " is longer than five characters.";
+         addResult(r);
+      }
+      if (zipGood)
+      {
+         r = zip + " appears to be a valid ZIP code.";
+         addResult(r);
+      }
+   }
+}
+
+function makeName(n)
+{
+   var tmp = "";
+   for (var i=0;i<n;i++)
+   {
+      var l = Math.floor(26*Math.random());
+      tmp += letters[l];
+   }
+   return tmp;
+}
+
+function makeNumber(n)
+{
+   var tmp = "";
+   for (var i=0;i<n;i++)
+   {
+      var l = Math.floor(9*Math.random());
+      tmp = tmp.concat(l);
+   }
+   return tmp;
+}
+
+function addResult(r)
+{
+   endResult += "\n" + r;
+}
+
+window.onload = function(){ startTest("sunspider-string-validate-input", '');
+
+test("Validate Email Input", testEmail);
+test("Validate Zipcode Input", testEmail);
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/v8-crypto.html b/tests/v8-crypto.html
new file mode 100644
index 0000000..1a00cb1
--- /dev/null
+++ b/tests/v8-crypto.html
@@ -0,0 +1,1705 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+/*
+ * Copyright (c) 2003-2005  Tom Wu
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
+ * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * In addition, the following condition applies:
+ *
+ * All redistributions must retain an intact copy of this copyright notice
+ * and disclaimer.
+ */
+
+
+// The code has been adapted for use as a benchmark by Google.
+
+// Basic JavaScript BN library - subset useful for RSA encryption.
+
+// Bits per digit
+var dbits;
+var BI_DB;
+var BI_DM;
+var BI_DV;
+
+var BI_FP;
+var BI_FV;
+var BI_F1;
+var BI_F2;
+
+// JavaScript engine analysis
+var canary = 0xdeadbeefcafe;
+var j_lm = ((canary&0xffffff)==0xefcafe);
+
+// (public) Constructor
+function BigInteger(a,b,c) {
+  this.array = new Array();
+  if(a != null)
+    if("number" == typeof a) this.fromNumber(a,b,c);
+    else if(b == null && "string" != typeof a) this.fromString(a,256);
+    else this.fromString(a,b);
+}
+
+// return new, unset BigInteger
+function nbi() { return new BigInteger(null); }
+
+// am: Compute w_j += (x*this_i), propagate carries,
+// c is initial carry, returns final carry.
+// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
+// We need to select the fastest one that works in this environment.
+
+// am1: use a single mult and divide to get the high bits,
+// max digit bits should be 26 because
+// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
+function am1(i,x,w,j,c,n) {
+  var this_array = this.array;
+  var w_array    = w.array;
+  while(--n >= 0) {
+    var v = x*this_array[i++]+w_array[j]+c;
+    c = Math.floor(v/0x4000000);
+    w_array[j++] = v&0x3ffffff;
+  }
+  return c;
+}
+
+// am2 avoids a big mult-and-extract completely.
+// Max digit bits should be <= 30 because we do bitwise ops
+// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
+function am2(i,x,w,j,c,n) {
+  var this_array = this.array;
+  var w_array    = w.array;
+  var xl = x&0x7fff, xh = x>>15;
+  while(--n >= 0) {
+    var l = this_array[i]&0x7fff;
+    var h = this_array[i++]>>15;
+    var m = xh*l+h*xl;
+    l = xl*l+((m&0x7fff)<<15)+w_array[j]+(c&0x3fffffff);
+    c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
+    w_array[j++] = l&0x3fffffff;
+  }
+  return c;
+}
+
+// Alternately, set max digit bits to 28 since some
+// browsers slow down when dealing with 32-bit numbers.
+function am3(i,x,w,j,c,n) {
+  var this_array = this.array;
+  var w_array    = w.array;
+
+  var xl = x&0x3fff, xh = x>>14;
+  while(--n >= 0) {
+    var l = this_array[i]&0x3fff;
+    var h = this_array[i++]>>14;
+    var m = xh*l+h*xl;
+    l = xl*l+((m&0x3fff)<<14)+w_array[j]+c;
+    c = (l>>28)+(m>>14)+xh*h;
+    w_array[j++] = l&0xfffffff;
+  }
+  return c;
+}
+
+// This is tailored to VMs with 2-bit tagging. It makes sure
+// that all the computations stay within the 29 bits available.
+function am4(i,x,w,j,c,n) {
+  var this_array = this.array;
+  var w_array    = w.array;
+
+  var xl = x&0x1fff, xh = x>>13;
+  while(--n >= 0) {
+    var l = this_array[i]&0x1fff;
+    var h = this_array[i++]>>13;
+    var m = xh*l+h*xl;
+    l = xl*l+((m&0x1fff)<<13)+w_array[j]+c;
+    c = (l>>26)+(m>>13)+xh*h;
+    w_array[j++] = l&0x3ffffff;
+  }
+  return c;
+}
+
+// am3/28 is best for SM, Rhino, but am4/26 is best for v8.
+// Kestrel (Opera 9.5) gets its best result with am4/26.
+// IE7 does 9% better with am3/28 than with am4/26.
+// Firefox (SM) gets 10% faster with am3/28 than with am4/26.
+
+setupEngine = function(fn, bits) {
+  BigInteger.prototype.am = fn;
+  dbits = bits;
+
+  BI_DB = dbits;
+  BI_DM = ((1<<dbits)-1);
+  BI_DV = (1<<dbits);
+
+  BI_FP = 52;
+  BI_FV = Math.pow(2,BI_FP);
+  BI_F1 = BI_FP-dbits;
+  BI_F2 = 2*dbits-BI_FP;
+}
+
+
+// Digit conversions
+var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
+var BI_RC = new Array();
+var rr,vv;
+rr = "0".charCodeAt(0);
+for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
+rr = "a".charCodeAt(0);
+for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
+rr = "A".charCodeAt(0);
+for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
+
+function int2char(n) { return BI_RM.charAt(n); }
+function intAt(s,i) {
+  var c = BI_RC[s.charCodeAt(i)];
+  return (c==null)?-1:c;
+}
+
+// (protected) copy this to r
+function bnpCopyTo(r) {
+  var this_array = this.array;
+  var r_array    = r.array;
+
+  for(var i = this.t-1; i >= 0; --i) r_array[i] = this_array[i];
+  r.t = this.t;
+  r.s = this.s;
+}
+
+// (protected) set from integer value x, -DV <= x < DV
+function bnpFromInt(x) {
+  var this_array = this.array;
+  this.t = 1;
+  this.s = (x<0)?-1:0;
+  if(x > 0) this_array[0] = x;
+  else if(x < -1) this_array[0] = x+DV;
+  else this.t = 0;
+}
+
+// return bigint initialized to value
+function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
+
+// (protected) set from string and radix
+function bnpFromString(s,b) {
+  var this_array = this.array;
+  var k;
+  if(b == 16) k = 4;
+  else if(b == 8) k = 3;
+  else if(b == 256) k = 8; // byte array
+  else if(b == 2) k = 1;
+  else if(b == 32) k = 5;
+  else if(b == 4) k = 2;
+  else { this.fromRadix(s,b); return; }
+  this.t = 0;
+  this.s = 0;
+  var i = s.length, mi = false, sh = 0;
+  while(--i >= 0) {
+    var x = (k==8)?s[i]&0xff:intAt(s,i);
+    if(x < 0) {
+      if(s.charAt(i) == "-") mi = true;
+      continue;
+    }
+    mi = false;
+    if(sh == 0)
+      this_array[this.t++] = x;
+    else if(sh+k > BI_DB) {
+      this_array[this.t-1] |= (x&((1<<(BI_DB-sh))-1))<<sh;
+      this_array[this.t++] = (x>>(BI_DB-sh));
+    }
+    else
+      this_array[this.t-1] |= x<<sh;
+    sh += k;
+    if(sh >= BI_DB) sh -= BI_DB;
+  }
+  if(k == 8 && (s[0]&0x80) != 0) {
+    this.s = -1;
+    if(sh > 0) this_array[this.t-1] |= ((1<<(BI_DB-sh))-1)<<sh;
+  }
+  this.clamp();
+  if(mi) BigInteger.ZERO.subTo(this,this);
+}
+
+// (protected) clamp off excess high words
+function bnpClamp() {
+  var this_array = this.array;
+  var c = this.s&BI_DM;
+  while(this.t > 0 && this_array[this.t-1] == c) --this.t;
+}
+
+// (public) return string representation in given radix
+function bnToString(b) {
+  var this_array = this.array;
+  if(this.s < 0) return "-"+this.negate().toString(b);
+  var k;
+  if(b == 16) k = 4;
+  else if(b == 8) k = 3;
+  else if(b == 2) k = 1;
+  else if(b == 32) k = 5;
+  else if(b == 4) k = 2;
+  else return this.toRadix(b);
+  var km = (1<<k)-1, d, m = false, r = "", i = this.t;
+  var p = BI_DB-(i*BI_DB)%k;
+  if(i-- > 0) {
+    if(p < BI_DB && (d = this_array[i]>>p) > 0) { m = true; r = int2char(d); }
+    while(i >= 0) {
+      if(p < k) {
+        d = (this_array[i]&((1<<p)-1))<<(k-p);
+        d |= this_array[--i]>>(p+=BI_DB-k);
+      }
+      else {
+        d = (this_array[i]>>(p-=k))&km;
+        if(p <= 0) { p += BI_DB; --i; }
+      }
+      if(d > 0) m = true;
+      if(m) r += int2char(d);
+    }
+  }
+  return m?r:"0";
+}
+
+// (public) -this
+function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
+
+// (public) |this|
+function bnAbs() { return (this.s<0)?this.negate():this; }
+
+// (public) return + if this > a, - if this < a, 0 if equal
+function bnCompareTo(a) {
+  var this_array = this.array;
+  var a_array = a.array;
+
+  var r = this.s-a.s;
+  if(r != 0) return r;
+  var i = this.t;
+  r = i-a.t;
+  if(r != 0) return r;
+  while(--i >= 0) if((r=this_array[i]-a_array[i]) != 0) return r;
+  return 0;
+}
+
+// returns bit length of the integer x
+function nbits(x) {
+  var r = 1, t;
+  if((t=x>>>16) != 0) { x = t; r += 16; }
+  if((t=x>>8) != 0) { x = t; r += 8; }
+  if((t=x>>4) != 0) { x = t; r += 4; }
+  if((t=x>>2) != 0) { x = t; r += 2; }
+  if((t=x>>1) != 0) { x = t; r += 1; }
+  return r;
+}
+
+// (public) return the number of bits in "this"
+function bnBitLength() {
+  var this_array = this.array;
+  if(this.t <= 0) return 0;
+  return BI_DB*(this.t-1)+nbits(this_array[this.t-1]^(this.s&BI_DM));
+}
+
+// (protected) r = this << n*DB
+function bnpDLShiftTo(n,r) {
+  var this_array = this.array;
+  var r_array = r.array;
+  var i;
+  for(i = this.t-1; i >= 0; --i) r_array[i+n] = this_array[i];
+  for(i = n-1; i >= 0; --i) r_array[i] = 0;
+  r.t = this.t+n;
+  r.s = this.s;
+}
+
+// (protected) r = this >> n*DB
+function bnpDRShiftTo(n,r) {
+  var this_array = this.array;
+  var r_array = r.array;
+  for(var i = n; i < this.t; ++i) r_array[i-n] = this_array[i];
+  r.t = Math.max(this.t-n,0);
+  r.s = this.s;
+}
+
+// (protected) r = this << n
+function bnpLShiftTo(n,r) {
+  var this_array = this.array;
+  var r_array = r.array;
+  var bs = n%BI_DB;
+  var cbs = BI_DB-bs;
+  var bm = (1<<cbs)-1;
+  var ds = Math.floor(n/BI_DB), c = (this.s<<bs)&BI_DM, i;
+  for(i = this.t-1; i >= 0; --i) {
+    r_array[i+ds+1] = (this_array[i]>>cbs)|c;
+    c = (this_array[i]&bm)<<bs;
+  }
+  for(i = ds-1; i >= 0; --i) r_array[i] = 0;
+  r_array[ds] = c;
+  r.t = this.t+ds+1;
+  r.s = this.s;
+  r.clamp();
+}
+
+// (protected) r = this >> n
+function bnpRShiftTo(n,r) {
+  var this_array = this.array;
+  var r_array = r.array;
+  r.s = this.s;
+  var ds = Math.floor(n/BI_DB);
+  if(ds >= this.t) { r.t = 0; return; }
+  var bs = n%BI_DB;
+  var cbs = BI_DB-bs;
+  var bm = (1<<bs)-1;
+  r_array[0] = this_array[ds]>>bs;
+  for(var i = ds+1; i < this.t; ++i) {
+    r_array[i-ds-1] |= (this_array[i]&bm)<<cbs;
+    r_array[i-ds] = this_array[i]>>bs;
+  }
+  if(bs > 0) r_array[this.t-ds-1] |= (this.s&bm)<<cbs;
+  r.t = this.t-ds;
+  r.clamp();
+}
+
+// (protected) r = this - a
+function bnpSubTo(a,r) {
+  var this_array = this.array;
+  var r_array = r.array;
+  var a_array = a.array;
+  var i = 0, c = 0, m = Math.min(a.t,this.t);
+  while(i < m) {
+    c += this_array[i]-a_array[i];
+    r_array[i++] = c&BI_DM;
+    c >>= BI_DB;
+  }
+  if(a.t < this.t) {
+    c -= a.s;
+    while(i < this.t) {
+      c += this_array[i];
+      r_array[i++] = c&BI_DM;
+      c >>= BI_DB;
+    }
+    c += this.s;
+  }
+  else {
+    c += this.s;
+    while(i < a.t) {
+      c -= a_array[i];
+      r_array[i++] = c&BI_DM;
+      c >>= BI_DB;
+    }
+    c -= a.s;
+  }
+  r.s = (c<0)?-1:0;
+  if(c < -1) r_array[i++] = BI_DV+c;
+  else if(c > 0) r_array[i++] = c;
+  r.t = i;
+  r.clamp();
+}
+
+// (protected) r = this * a, r != this,a (HAC 14.12)
+// "this" should be the larger one if appropriate.
+function bnpMultiplyTo(a,r) {
+  var this_array = this.array;
+  var r_array = r.array;
+  var x = this.abs(), y = a.abs();
+  var y_array = y.array;
+
+  var i = x.t;
+  r.t = i+y.t;
+  while(--i >= 0) r_array[i] = 0;
+  for(i = 0; i < y.t; ++i) r_array[i+x.t] = x.am(0,y_array[i],r,i,0,x.t);
+  r.s = 0;
+  r.clamp();
+  if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
+}
+
+// (protected) r = this^2, r != this (HAC 14.16)
+function bnpSquareTo(r) {
+  var x = this.abs();
+  var x_array = x.array;
+  var r_array = r.array;
+
+  var i = r.t = 2*x.t;
+  while(--i >= 0) r_array[i] = 0;
+  for(i = 0; i < x.t-1; ++i) {
+    var c = x.am(i,x_array[i],r,2*i,0,1);
+    if((r_array[i+x.t]+=x.am(i+1,2*x_array[i],r,2*i+1,c,x.t-i-1)) >= BI_DV) {
+      r_array[i+x.t] -= BI_DV;
+      r_array[i+x.t+1] = 1;
+    }
+  }
+  if(r.t > 0) r_array[r.t-1] += x.am(i,x_array[i],r,2*i,0,1);
+  r.s = 0;
+  r.clamp();
+}
+
+// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
+// r != q, this != m.  q or r may be null.
+function bnpDivRemTo(m,q,r) {
+  var pm = m.abs();
+  if(pm.t <= 0) return;
+  var pt = this.abs();
+  if(pt.t < pm.t) {
+    if(q != null) q.fromInt(0);
+    if(r != null) this.copyTo(r);
+    return;
+  }
+  if(r == null) r = nbi();
+  var y = nbi(), ts = this.s, ms = m.s;
+  var pm_array = pm.array;
+  var nsh = BI_DB-nbits(pm_array[pm.t-1]);	// normalize modulus
+  if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
+  else { pm.copyTo(y); pt.copyTo(r); }
+  var ys = y.t;
+
+  var y_array = y.array;
+  var y0 = y_array[ys-1];
+  if(y0 == 0) return;
+  var yt = y0*(1<<BI_F1)+((ys>1)?y_array[ys-2]>>BI_F2:0);
+  var d1 = BI_FV/yt, d2 = (1<<BI_F1)/yt, e = 1<<BI_F2;
+  var i = r.t, j = i-ys, t = (q==null)?nbi():q;
+  y.dlShiftTo(j,t);
+
+  var r_array = r.array;
+  if(r.compareTo(t) >= 0) {
+    r_array[r.t++] = 1;
+    r.subTo(t,r);
+  }
+  BigInteger.ONE.dlShiftTo(ys,t);
+  t.subTo(y,y);	// "negative" y so we can replace sub with am later
+  while(y.t < ys) y_array[y.t++] = 0;
+  while(--j >= 0) {
+    // Estimate quotient digit
+    var qd = (r_array[--i]==y0)?BI_DM:Math.floor(r_array[i]*d1+(r_array[i-1]+e)*d2);
+    if((r_array[i]+=y.am(0,qd,r,j,0,ys)) < qd) {	// Try it out
+      y.dlShiftTo(j,t);
+      r.subTo(t,r);
+      while(r_array[i] < --qd) r.subTo(t,r);
+    }
+  }
+  if(q != null) {
+    r.drShiftTo(ys,q);
+    if(ts != ms) BigInteger.ZERO.subTo(q,q);
+  }
+  r.t = ys;
+  r.clamp();
+  if(nsh > 0) r.rShiftTo(nsh,r);	// Denormalize remainder
+  if(ts < 0) BigInteger.ZERO.subTo(r,r);
+}
+
+// (public) this mod a
+function bnMod(a) {
+  var r = nbi();
+  this.abs().divRemTo(a,null,r);
+  if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
+  return r;
+}
+
+// Modular reduction using "classic" algorithm
+function Classic(m) { this.m = m; }
+function cConvert(x) {
+  if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
+  else return x;
+}
+function cRevert(x) { return x; }
+function cReduce(x) { x.divRemTo(this.m,null,x); }
+function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
+function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
+
+Classic.prototype.convert = cConvert;
+Classic.prototype.revert = cRevert;
+Classic.prototype.reduce = cReduce;
+Classic.prototype.mulTo = cMulTo;
+Classic.prototype.sqrTo = cSqrTo;
+
+// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
+// justification:
+//         xy == 1 (mod m)
+//         xy =  1+km
+//   xy(2-xy) = (1+km)(1-km)
+// x[y(2-xy)] = 1-k^2m^2
+// x[y(2-xy)] == 1 (mod m^2)
+// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
+// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
+// JS multiply "overflows" differently from C/C++, so care is needed here.
+function bnpInvDigit() {
+  var this_array = this.array;
+  if(this.t < 1) return 0;
+  var x = this_array[0];
+  if((x&1) == 0) return 0;
+  var y = x&3;		// y == 1/x mod 2^2
+  y = (y*(2-(x&0xf)*y))&0xf;	// y == 1/x mod 2^4
+  y = (y*(2-(x&0xff)*y))&0xff;	// y == 1/x mod 2^8
+  y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff;	// y == 1/x mod 2^16
+  // last step - calculate inverse mod DV directly;
+  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
+  y = (y*(2-x*y%BI_DV))%BI_DV;		// y == 1/x mod 2^dbits
+  // we really want the negative inverse, and -DV < y < DV
+  return (y>0)?BI_DV-y:-y;
+}
+
+// Montgomery reduction
+function Montgomery(m) {
+  this.m = m;
+  this.mp = m.invDigit();
+  this.mpl = this.mp&0x7fff;
+  this.mph = this.mp>>15;
+  this.um = (1<<(BI_DB-15))-1;
+  this.mt2 = 2*m.t;
+}
+
+// xR mod m
+function montConvert(x) {
+  var r = nbi();
+  x.abs().dlShiftTo(this.m.t,r);
+  r.divRemTo(this.m,null,r);
+  if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
+  return r;
+}
+
+// x/R mod m
+function montRevert(x) {
+  var r = nbi();
+  x.copyTo(r);
+  this.reduce(r);
+  return r;
+}
+
+// x = x/R mod m (HAC 14.32)
+function montReduce(x) {
+  var x_array = x.array;
+  while(x.t <= this.mt2)	// pad x so am has enough room later
+    x_array[x.t++] = 0;
+  for(var i = 0; i < this.m.t; ++i) {
+    // faster way of calculating u0 = x[i]*mp mod DV
+    var j = x_array[i]&0x7fff;
+    var u0 = (j*this.mpl+(((j*this.mph+(x_array[i]>>15)*this.mpl)&this.um)<<15))&BI_DM;
+    // use am to combine the multiply-shift-add into one call
+    j = i+this.m.t;
+    x_array[j] += this.m.am(0,u0,x,i,0,this.m.t);
+    // propagate carry
+    while(x_array[j] >= BI_DV) { x_array[j] -= BI_DV; x_array[++j]++; }
+  }
+  x.clamp();
+  x.drShiftTo(this.m.t,x);
+  if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
+}
+
+// r = "x^2/R mod m"; x != r
+function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
+
+// r = "xy/R mod m"; x,y != r
+function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
+
+Montgomery.prototype.convert = montConvert;
+Montgomery.prototype.revert = montRevert;
+Montgomery.prototype.reduce = montReduce;
+Montgomery.prototype.mulTo = montMulTo;
+Montgomery.prototype.sqrTo = montSqrTo;
+
+// (protected) true iff this is even
+function bnpIsEven() {
+  var this_array = this.array;
+  return ((this.t>0)?(this_array[0]&1):this.s) == 0;
+}
+
+// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
+function bnpExp(e,z) {
+  if(e > 0xffffffff || e < 1) return BigInteger.ONE;
+  var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
+  g.copyTo(r);
+  while(--i >= 0) {
+    z.sqrTo(r,r2);
+    if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
+    else { var t = r; r = r2; r2 = t; }
+  }
+  return z.revert(r);
+}
+
+// (public) this^e % m, 0 <= e < 2^32
+function bnModPowInt(e,m) {
+  var z;
+  if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
+  return this.exp(e,z);
+}
+
+// protected
+BigInteger.prototype.copyTo = bnpCopyTo;
+BigInteger.prototype.fromInt = bnpFromInt;
+BigInteger.prototype.fromString = bnpFromString;
+BigInteger.prototype.clamp = bnpClamp;
+BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
+BigInteger.prototype.drShiftTo = bnpDRShiftTo;
+BigInteger.prototype.lShiftTo = bnpLShiftTo;
+BigInteger.prototype.rShiftTo = bnpRShiftTo;
+BigInteger.prototype.subTo = bnpSubTo;
+BigInteger.prototype.multiplyTo = bnpMultiplyTo;
+BigInteger.prototype.squareTo = bnpSquareTo;
+BigInteger.prototype.divRemTo = bnpDivRemTo;
+BigInteger.prototype.invDigit = bnpInvDigit;
+BigInteger.prototype.isEven = bnpIsEven;
+BigInteger.prototype.exp = bnpExp;
+
+// public
+BigInteger.prototype.toString = bnToString;
+BigInteger.prototype.negate = bnNegate;
+BigInteger.prototype.abs = bnAbs;
+BigInteger.prototype.compareTo = bnCompareTo;
+BigInteger.prototype.bitLength = bnBitLength;
+BigInteger.prototype.mod = bnMod;
+BigInteger.prototype.modPowInt = bnModPowInt;
+
+// "constants"
+BigInteger.ZERO = nbv(0);
+BigInteger.ONE = nbv(1);
+// Copyright (c) 2005  Tom Wu
+// All Rights Reserved.
+// See "LICENSE" for details.
+
+// Extended JavaScript BN functions, required for RSA private ops.
+
+// (public)
+function bnClone() { var r = nbi(); this.copyTo(r); return r; }
+
+// (public) return value as integer
+function bnIntValue() {
+  var this_array = this.array;
+  if(this.s < 0) {
+    if(this.t == 1) return this_array[0]-BI_DV;
+    else if(this.t == 0) return -1;
+  }
+  else if(this.t == 1) return this_array[0];
+  else if(this.t == 0) return 0;
+  // assumes 16 < DB < 32
+  return ((this_array[1]&((1<<(32-BI_DB))-1))<<BI_DB)|this_array[0];
+}
+
+// (public) return value as byte
+function bnByteValue() {
+  var this_array = this.array;
+  return (this.t==0)?this.s:(this_array[0]<<24)>>24;
+}
+
+// (public) return value as short (assumes DB>=16)
+function bnShortValue() {
+  var this_array = this.array;
+  return (this.t==0)?this.s:(this_array[0]<<16)>>16;
+}
+
+// (protected) return x s.t. r^x < DV
+function bnpChunkSize(r) { return Math.floor(Math.LN2*BI_DB/Math.log(r)); }
+
+// (public) 0 if this == 0, 1 if this > 0
+function bnSigNum() {
+  var this_array = this.array;
+  if(this.s < 0) return -1;
+  else if(this.t <= 0 || (this.t == 1 && this_array[0] <= 0)) return 0;
+  else return 1;
+}
+
+// (protected) convert to radix string
+function bnpToRadix(b) {
+  if(b == null) b = 10;
+  if(this.signum() == 0 || b < 2 || b > 36) return "0";
+  var cs = this.chunkSize(b);
+  var a = Math.pow(b,cs);
+  var d = nbv(a), y = nbi(), z = nbi(), r = "";
+  this.divRemTo(d,y,z);
+  while(y.signum() > 0) {
+    r = (a+z.intValue()).toString(b).substr(1) + r;
+    y.divRemTo(d,y,z);
+  }
+  return z.intValue().toString(b) + r;
+}
+
+// (protected) convert from radix string
+function bnpFromRadix(s,b) {
+  this.fromInt(0);
+  if(b == null) b = 10;
+  var cs = this.chunkSize(b);
+  var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
+  for(var i = 0; i < s.length; ++i) {
+    var x = intAt(s,i);
+    if(x < 0) {
+      if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
+      continue;
+    }
+    w = b*w+x;
+    if(++j >= cs) {
+      this.dMultiply(d);
+      this.dAddOffset(w,0);
+      j = 0;
+      w = 0;
+    }
+  }
+  if(j > 0) {
+    this.dMultiply(Math.pow(b,j));
+    this.dAddOffset(w,0);
+  }
+  if(mi) BigInteger.ZERO.subTo(this,this);
+}
+
+// (protected) alternate constructor
+function bnpFromNumber(a,b,c) {
+  if("number" == typeof b) {
+    // new BigInteger(int,int,RNG)
+    if(a < 2) this.fromInt(1);
+    else {
+      this.fromNumber(a,c);
+      if(!this.testBit(a-1))	// force MSB set
+        this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
+      if(this.isEven()) this.dAddOffset(1,0); // force odd
+      while(!this.isProbablePrime(b)) {
+        this.dAddOffset(2,0);
+        if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
+      }
+    }
+  }
+  else {
+    // new BigInteger(int,RNG)
+    var x = new Array(), t = a&7;
+    x.length = (a>>3)+1;
+    b.nextBytes(x);
+    if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;
+    this.fromString(x,256);
+  }
+}
+
+// (public) convert to bigendian byte array
+function bnToByteArray() {
+  var this_array = this.array;
+  var i = this.t, r = new Array();
+  r[0] = this.s;
+  var p = BI_DB-(i*BI_DB)%8, d, k = 0;
+  if(i-- > 0) {
+    if(p < BI_DB && (d = this_array[i]>>p) != (this.s&BI_DM)>>p)
+      r[k++] = d|(this.s<<(BI_DB-p));
+    while(i >= 0) {
+      if(p < 8) {
+        d = (this_array[i]&((1<<p)-1))<<(8-p);
+        d |= this_array[--i]>>(p+=BI_DB-8);
+      }
+      else {
+        d = (this_array[i]>>(p-=8))&0xff;
+        if(p <= 0) { p += BI_DB; --i; }
+      }
+      if((d&0x80) != 0) d |= -256;
+      if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
+      if(k > 0 || d != this.s) r[k++] = d;
+    }
+  }
+  return r;
+}
+
+function bnEquals(a) { return(this.compareTo(a)==0); }
+function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
+function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
+
+// (protected) r = this op a (bitwise)
+function bnpBitwiseTo(a,op,r) {
+  var this_array = this.array;
+  var a_array    = a.array;
+  var r_array    = r.array;
+  var i, f, m = Math.min(a.t,this.t);
+  for(i = 0; i < m; ++i) r_array[i] = op(this_array[i],a_array[i]);
+  if(a.t < this.t) {
+    f = a.s&BI_DM;
+    for(i = m; i < this.t; ++i) r_array[i] = op(this_array[i],f);
+    r.t = this.t;
+  }
+  else {
+    f = this.s&BI_DM;
+    for(i = m; i < a.t; ++i) r_array[i] = op(f,a_array[i]);
+    r.t = a.t;
+  }
+  r.s = op(this.s,a.s);
+  r.clamp();
+}
+
+// (public) this & a
+function op_and(x,y) { return x&y; }
+function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
+
+// (public) this | a
+function op_or(x,y) { return x|y; }
+function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
+
+// (public) this ^ a
+function op_xor(x,y) { return x^y; }
+function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
+
+// (public) this & ~a
+function op_andnot(x,y) { return x&~y; }
+function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
+
+// (public) ~this
+function bnNot() {
+  var this_array = this.array;
+  var r = nbi();
+  var r_array = r.array;
+
+  for(var i = 0; i < this.t; ++i) r_array[i] = BI_DM&~this_array[i];
+  r.t = this.t;
+  r.s = ~this.s;
+  return r;
+}
+
+// (public) this << n
+function bnShiftLeft(n) {
+  var r = nbi();
+  if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
+  return r;
+}
+
+// (public) this >> n
+function bnShiftRight(n) {
+  var r = nbi();
+  if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
+  return r;
+}
+
+// return index of lowest 1-bit in x, x < 2^31
+function lbit(x) {
+  if(x == 0) return -1;
+  var r = 0;
+  if((x&0xffff) == 0) { x >>= 16; r += 16; }
+  if((x&0xff) == 0) { x >>= 8; r += 8; }
+  if((x&0xf) == 0) { x >>= 4; r += 4; }
+  if((x&3) == 0) { x >>= 2; r += 2; }
+  if((x&1) == 0) ++r;
+  return r;
+}
+
+// (public) returns index of lowest 1-bit (or -1 if none)
+function bnGetLowestSetBit() {
+  var this_array = this.array;
+  for(var i = 0; i < this.t; ++i)
+    if(this_array[i] != 0) return i*BI_DB+lbit(this_array[i]);
+  if(this.s < 0) return this.t*BI_DB;
+  return -1;
+}
+
+// return number of 1 bits in x
+function cbit(x) {
+  var r = 0;
+  while(x != 0) { x &= x-1; ++r; }
+  return r;
+}
+
+// (public) return number of set bits
+function bnBitCount() {
+  var r = 0, x = this.s&BI_DM;
+  for(var i = 0; i < this.t; ++i) r += cbit(this_array[i]^x);
+  return r;
+}
+
+// (public) true iff nth bit is set
+function bnTestBit(n) {
+  var this_array = this.array;
+  var j = Math.floor(n/BI_DB);
+  if(j >= this.t) return(this.s!=0);
+  return((this_array[j]&(1<<(n%BI_DB)))!=0);
+}
+
+// (protected) this op (1<<n)
+function bnpChangeBit(n,op) {
+  var r = BigInteger.ONE.shiftLeft(n);
+  this.bitwiseTo(r,op,r);
+  return r;
+}
+
+// (public) this | (1<<n)
+function bnSetBit(n) { return this.changeBit(n,op_or); }
+
+// (public) this & ~(1<<n)
+function bnClearBit(n) { return this.changeBit(n,op_andnot); }
+
+// (public) this ^ (1<<n)
+function bnFlipBit(n) { return this.changeBit(n,op_xor); }
+
+// (protected) r = this + a
+function bnpAddTo(a,r) {
+  var this_array = this.array;
+  var a_array = a.array;
+  var r_array = r.array;
+  var i = 0, c = 0, m = Math.min(a.t,this.t);
+  while(i < m) {
+    c += this_array[i]+a_array[i];
+    r_array[i++] = c&BI_DM;
+    c >>= BI_DB;
+  }
+  if(a.t < this.t) {
+    c += a.s;
+    while(i < this.t) {
+      c += this_array[i];
+      r_array[i++] = c&BI_DM;
+      c >>= BI_DB;
+    }
+    c += this.s;
+  }
+  else {
+    c += this.s;
+    while(i < a.t) {
+      c += a_array[i];
+      r_array[i++] = c&BI_DM;
+      c >>= BI_DB;
+    }
+    c += a.s;
+  }
+  r.s = (c<0)?-1:0;
+  if(c > 0) r_array[i++] = c;
+  else if(c < -1) r_array[i++] = BI_DV+c;
+  r.t = i;
+  r.clamp();
+}
+
+// (public) this + a
+function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
+
+// (public) this - a
+function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
+
+// (public) this * a
+function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
+
+// (public) this / a
+function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
+
+// (public) this % a
+function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
+
+// (public) [this/a,this%a]
+function bnDivideAndRemainder(a) {
+  var q = nbi(), r = nbi();
+  this.divRemTo(a,q,r);
+  return new Array(q,r);
+}
+
+// (protected) this *= n, this >= 0, 1 < n < DV
+function bnpDMultiply(n) {
+  var this_array = this.array;
+  this_array[this.t] = this.am(0,n-1,this,0,0,this.t);
+  ++this.t;
+  this.clamp();
+}
+
+// (protected) this += n << w words, this >= 0
+function bnpDAddOffset(n,w) {
+  var this_array = this.array;
+  while(this.t <= w) this_array[this.t++] = 0;
+  this_array[w] += n;
+  while(this_array[w] >= BI_DV) {
+    this_array[w] -= BI_DV;
+    if(++w >= this.t) this_array[this.t++] = 0;
+    ++this_array[w];
+  }
+}
+
+// A "null" reducer
+function NullExp() {}
+function nNop(x) { return x; }
+function nMulTo(x,y,r) { x.multiplyTo(y,r); }
+function nSqrTo(x,r) { x.squareTo(r); }
+
+NullExp.prototype.convert = nNop;
+NullExp.prototype.revert = nNop;
+NullExp.prototype.mulTo = nMulTo;
+NullExp.prototype.sqrTo = nSqrTo;
+
+// (public) this^e
+function bnPow(e) { return this.exp(e,new NullExp()); }
+
+// (protected) r = lower n words of "this * a", a.t <= n
+// "this" should be the larger one if appropriate.
+function bnpMultiplyLowerTo(a,n,r) {
+  var r_array = r.array;
+  var a_array = a.array;
+  var i = Math.min(this.t+a.t,n);
+  r.s = 0; // assumes a,this >= 0
+  r.t = i;
+  while(i > 0) r_array[--i] = 0;
+  var j;
+  for(j = r.t-this.t; i < j; ++i) r_array[i+this.t] = this.am(0,a_array[i],r,i,0,this.t);
+  for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a_array[i],r,i,0,n-i);
+  r.clamp();
+}
+
+// (protected) r = "this * a" without lower n words, n > 0
+// "this" should be the larger one if appropriate.
+function bnpMultiplyUpperTo(a,n,r) {
+  var r_array = r.array;
+  var a_array = a.array;
+  --n;
+  var i = r.t = this.t+a.t-n;
+  r.s = 0; // assumes a,this >= 0
+  while(--i >= 0) r_array[i] = 0;
+  for(i = Math.max(n-this.t,0); i < a.t; ++i)
+    r_array[this.t+i-n] = this.am(n-i,a_array[i],r,0,0,this.t+i-n);
+  r.clamp();
+  r.drShiftTo(1,r);
+}
+
+// Barrett modular reduction
+function Barrett(m) {
+  // setup Barrett
+  this.r2 = nbi();
+  this.q3 = nbi();
+  BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
+  this.mu = this.r2.divide(m);
+  this.m = m;
+}
+
+function barrettConvert(x) {
+  if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
+  else if(x.compareTo(this.m) < 0) return x;
+  else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
+}
+
+function barrettRevert(x) { return x; }
+
+// x = x mod m (HAC 14.42)
+function barrettReduce(x) {
+  x.drShiftTo(this.m.t-1,this.r2);
+  if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
+  this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
+  this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
+  while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
+  x.subTo(this.r2,x);
+  while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
+}
+
+// r = x^2 mod m; x != r
+function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
+
+// r = x*y mod m; x,y != r
+function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
+
+Barrett.prototype.convert = barrettConvert;
+Barrett.prototype.revert = barrettRevert;
+Barrett.prototype.reduce = barrettReduce;
+Barrett.prototype.mulTo = barrettMulTo;
+Barrett.prototype.sqrTo = barrettSqrTo;
+
+// (public) this^e % m (HAC 14.85)
+function bnModPow(e,m) {
+  var e_array = e.array;
+  var i = e.bitLength(), k, r = nbv(1), z;
+  if(i <= 0) return r;
+  else if(i < 18) k = 1;
+  else if(i < 48) k = 3;
+  else if(i < 144) k = 4;
+  else if(i < 768) k = 5;
+  else k = 6;
+  if(i < 8)
+    z = new Classic(m);
+  else if(m.isEven())
+    z = new Barrett(m);
+  else
+    z = new Montgomery(m);
+
+  // precomputation
+  var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;
+  g[1] = z.convert(this);
+  if(k > 1) {
+    var g2 = nbi();
+    z.sqrTo(g[1],g2);
+    while(n <= km) {
+      g[n] = nbi();
+      z.mulTo(g2,g[n-2],g[n]);
+      n += 2;
+    }
+  }
+
+  var j = e.t-1, w, is1 = true, r2 = nbi(), t;
+  i = nbits(e_array[j])-1;
+  while(j >= 0) {
+    if(i >= k1) w = (e_array[j]>>(i-k1))&km;
+    else {
+      w = (e_array[j]&((1<<(i+1))-1))<<(k1-i);
+      if(j > 0) w |= e_array[j-1]>>(BI_DB+i-k1);
+    }
+
+    n = k;
+    while((w&1) == 0) { w >>= 1; --n; }
+    if((i -= n) < 0) { i += BI_DB; --j; }
+    if(is1) {	// ret == 1, don't bother squaring or multiplying it
+      g[w].copyTo(r);
+      is1 = false;
+    }
+    else {
+      while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
+      if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
+      z.mulTo(r2,g[w],r);
+    }
+
+    while(j >= 0 && (e_array[j]&(1<<i)) == 0) {
+      z.sqrTo(r,r2); t = r; r = r2; r2 = t;
+      if(--i < 0) { i = BI_DB-1; --j; }
+    }
+  }
+  return z.revert(r);
+}
+
+// (public) gcd(this,a) (HAC 14.54)
+function bnGCD(a) {
+  var x = (this.s<0)?this.negate():this.clone();
+  var y = (a.s<0)?a.negate():a.clone();
+  if(x.compareTo(y) < 0) { var t = x; x = y; y = t; }
+  var i = x.getLowestSetBit(), g = y.getLowestSetBit();
+  if(g < 0) return x;
+  if(i < g) g = i;
+  if(g > 0) {
+    x.rShiftTo(g,x);
+    y.rShiftTo(g,y);
+  }
+  while(x.signum() > 0) {
+    if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
+    if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
+    if(x.compareTo(y) >= 0) {
+      x.subTo(y,x);
+      x.rShiftTo(1,x);
+    }
+    else {
+      y.subTo(x,y);
+      y.rShiftTo(1,y);
+    }
+  }
+  if(g > 0) y.lShiftTo(g,y);
+  return y;
+}
+
+// (protected) this % n, n < 2^26
+function bnpModInt(n) {
+  var this_array = this.array;
+  if(n <= 0) return 0;
+  var d = BI_DV%n, r = (this.s<0)?n-1:0;
+  if(this.t > 0)
+    if(d == 0) r = this_array[0]%n;
+    else for(var i = this.t-1; i >= 0; --i) r = (d*r+this_array[i])%n;
+  return r;
+}
+
+// (public) 1/this % m (HAC 14.61)
+function bnModInverse(m) {
+  var ac = m.isEven();
+  if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
+  var u = m.clone(), v = this.clone();
+  var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
+  while(u.signum() != 0) {
+    while(u.isEven()) {
+      u.rShiftTo(1,u);
+      if(ac) {
+        if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
+        a.rShiftTo(1,a);
+      }
+      else if(!b.isEven()) b.subTo(m,b);
+      b.rShiftTo(1,b);
+    }
+    while(v.isEven()) {
+      v.rShiftTo(1,v);
+      if(ac) {
+        if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
+        c.rShiftTo(1,c);
+      }
+      else if(!d.isEven()) d.subTo(m,d);
+      d.rShiftTo(1,d);
+    }
+    if(u.compareTo(v) >= 0) {
+      u.subTo(v,u);
+      if(ac) a.subTo(c,a);
+      b.subTo(d,b);
+    }
+    else {
+      v.subTo(u,v);
+      if(ac) c.subTo(a,c);
+      d.subTo(b,d);
+    }
+  }
+  if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
+  if(d.compareTo(m) >= 0) return d.subtract(m);
+  if(d.signum() < 0) d.addTo(m,d); else return d;
+  if(d.signum() < 0) return d.add(m); else return d;
+}
+
+var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];
+var lplim = (1<<26)/lowprimes[lowprimes.length-1];
+
+// (public) test primality with certainty >= 1-.5^t
+function bnIsProbablePrime(t) {
+  var i, x = this.abs();
+  var x_array = x.array;
+  if(x.t == 1 && x_array[0] <= lowprimes[lowprimes.length-1]) {
+    for(i = 0; i < lowprimes.length; ++i)
+      if(x_array[0] == lowprimes[i]) return true;
+    return false;
+  }
+  if(x.isEven()) return false;
+  i = 1;
+  while(i < lowprimes.length) {
+    var m = lowprimes[i], j = i+1;
+    while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
+    m = x.modInt(m);
+    while(i < j) if(m%lowprimes[i++] == 0) return false;
+  }
+  return x.millerRabin(t);
+}
+
+// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
+function bnpMillerRabin(t) {
+  var n1 = this.subtract(BigInteger.ONE);
+  var k = n1.getLowestSetBit();
+  if(k <= 0) return false;
+  var r = n1.shiftRight(k);
+  t = (t+1)>>1;
+  if(t > lowprimes.length) t = lowprimes.length;
+  var a = nbi();
+  for(var i = 0; i < t; ++i) {
+    a.fromInt(lowprimes[i]);
+    var y = a.modPow(r,this);
+    if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
+      var j = 1;
+      while(j++ < k && y.compareTo(n1) != 0) {
+        y = y.modPowInt(2,this);
+        if(y.compareTo(BigInteger.ONE) == 0) return false;
+      }
+      if(y.compareTo(n1) != 0) return false;
+    }
+  }
+  return true;
+}
+
+// protected
+BigInteger.prototype.chunkSize = bnpChunkSize;
+BigInteger.prototype.toRadix = bnpToRadix;
+BigInteger.prototype.fromRadix = bnpFromRadix;
+BigInteger.prototype.fromNumber = bnpFromNumber;
+BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
+BigInteger.prototype.changeBit = bnpChangeBit;
+BigInteger.prototype.addTo = bnpAddTo;
+BigInteger.prototype.dMultiply = bnpDMultiply;
+BigInteger.prototype.dAddOffset = bnpDAddOffset;
+BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
+BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
+BigInteger.prototype.modInt = bnpModInt;
+BigInteger.prototype.millerRabin = bnpMillerRabin;
+
+// public
+BigInteger.prototype.clone = bnClone;
+BigInteger.prototype.intValue = bnIntValue;
+BigInteger.prototype.byteValue = bnByteValue;
+BigInteger.prototype.shortValue = bnShortValue;
+BigInteger.prototype.signum = bnSigNum;
+BigInteger.prototype.toByteArray = bnToByteArray;
+BigInteger.prototype.equals = bnEquals;
+BigInteger.prototype.min = bnMin;
+BigInteger.prototype.max = bnMax;
+BigInteger.prototype.and = bnAnd;
+BigInteger.prototype.or = bnOr;
+BigInteger.prototype.xor = bnXor;
+BigInteger.prototype.andNot = bnAndNot;
+BigInteger.prototype.not = bnNot;
+BigInteger.prototype.shiftLeft = bnShiftLeft;
+BigInteger.prototype.shiftRight = bnShiftRight;
+BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
+BigInteger.prototype.bitCount = bnBitCount;
+BigInteger.prototype.testBit = bnTestBit;
+BigInteger.prototype.setBit = bnSetBit;
+BigInteger.prototype.clearBit = bnClearBit;
+BigInteger.prototype.flipBit = bnFlipBit;
+BigInteger.prototype.add = bnAdd;
+BigInteger.prototype.subtract = bnSubtract;
+BigInteger.prototype.multiply = bnMultiply;
+BigInteger.prototype.divide = bnDivide;
+BigInteger.prototype.remainder = bnRemainder;
+BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
+BigInteger.prototype.modPow = bnModPow;
+BigInteger.prototype.modInverse = bnModInverse;
+BigInteger.prototype.pow = bnPow;
+BigInteger.prototype.gcd = bnGCD;
+BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
+
+// BigInteger interfaces not implemented in jsbn:
+
+// BigInteger(int signum, byte[] magnitude)
+// double doubleValue()
+// float floatValue()
+// int hashCode()
+// long longValue()
+// static BigInteger valueOf(long val)
+// prng4.js - uses Arcfour as a PRNG
+
+function Arcfour() {
+  this.i = 0;
+  this.j = 0;
+  this.S = new Array();
+}
+
+// Initialize arcfour context from key, an array of ints, each from [0..255]
+function ARC4init(key) {
+  var i, j, t;
+  for(i = 0; i < 256; ++i)
+    this.S[i] = i;
+  j = 0;
+  for(i = 0; i < 256; ++i) {
+    j = (j + this.S[i] + key[i % key.length]) & 255;
+    t = this.S[i];
+    this.S[i] = this.S[j];
+    this.S[j] = t;
+  }
+  this.i = 0;
+  this.j = 0;
+}
+
+function ARC4next() {
+  var t;
+  this.i = (this.i + 1) & 255;
+  this.j = (this.j + this.S[this.i]) & 255;
+  t = this.S[this.i];
+  this.S[this.i] = this.S[this.j];
+  this.S[this.j] = t;
+  return this.S[(t + this.S[this.i]) & 255];
+}
+
+Arcfour.prototype.init = ARC4init;
+Arcfour.prototype.next = ARC4next;
+
+// Plug in your RNG constructor here
+function prng_newstate() {
+  return new Arcfour();
+}
+
+// Pool size must be a multiple of 4 and greater than 32.
+// An array of bytes the size of the pool will be passed to init()
+var rng_psize = 256;
+// Random number generator - requires a PRNG backend, e.g. prng4.js
+
+// For best results, put code like
+// <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
+// in your main HTML document.
+
+var rng_state;
+var rng_pool;
+var rng_pptr;
+
+// Mix in a 32-bit integer into the pool
+function rng_seed_int(x) {
+  rng_pool[rng_pptr++] ^= x & 255;
+  rng_pool[rng_pptr++] ^= (x >> 8) & 255;
+  rng_pool[rng_pptr++] ^= (x >> 16) & 255;
+  rng_pool[rng_pptr++] ^= (x >> 24) & 255;
+  if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
+}
+
+// Mix in the current time (w/milliseconds) into the pool
+function rng_seed_time() {
+  // Use pre-computed date to avoid making the benchmark 
+  // results dependent on the current date.
+  rng_seed_int(1122926989487);
+}
+
+// Initialize the pool with junk if needed.
+if(rng_pool == null) {
+  rng_pool = new Array();
+  rng_pptr = 0;
+  var t;
+  while(rng_pptr < rng_psize) {  // extract some randomness from Math.random()
+    t = Math.floor(65536 * Math.random());
+    rng_pool[rng_pptr++] = t >>> 8;
+    rng_pool[rng_pptr++] = t & 255;
+  }
+  rng_pptr = 0;
+  rng_seed_time();
+  //rng_seed_int(window.screenX);
+  //rng_seed_int(window.screenY);
+}
+
+function rng_get_byte() {
+  if(rng_state == null) {
+    rng_seed_time();
+    rng_state = prng_newstate();
+    rng_state.init(rng_pool);
+    for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
+      rng_pool[rng_pptr] = 0;
+    rng_pptr = 0;
+    //rng_pool = null;
+  }
+  // TODO: allow reseeding after first request
+  return rng_state.next();
+}
+
+function rng_get_bytes(ba) {
+  var i;
+  for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
+}
+
+function SecureRandom() {}
+
+SecureRandom.prototype.nextBytes = rng_get_bytes;
+// Depends on jsbn.js and rng.js
+
+// convert a (hex) string to a bignum object
+function parseBigInt(str,r) {
+  return new BigInteger(str,r);
+}
+
+function linebrk(s,n) {
+  var ret = "";
+  var i = 0;
+  while(i + n < s.length) {
+    ret += s.substring(i,i+n) + "\n";
+    i += n;
+  }
+  return ret + s.substring(i,s.length);
+}
+
+function byte2Hex(b) {
+  if(b < 0x10)
+    return "0" + b.toString(16);
+  else
+    return b.toString(16);
+}
+
+// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint
+function pkcs1pad2(s,n) {
+  if(n < s.length + 11) {
+    alert("Message too long for RSA");
+    return null;
+  }
+  var ba = new Array();
+  var i = s.length - 1;
+  while(i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--);
+  ba[--n] = 0;
+  var rng = new SecureRandom();
+  var x = new Array();
+  while(n > 2) { // random non-zero pad
+    x[0] = 0;
+    while(x[0] == 0) rng.nextBytes(x);
+    ba[--n] = x[0];
+  }
+  ba[--n] = 2;
+  ba[--n] = 0;
+  return new BigInteger(ba);
+}
+
+// "empty" RSA key constructor
+function RSAKey() {
+  this.n = null;
+  this.e = 0;
+  this.d = null;
+  this.p = null;
+  this.q = null;
+  this.dmp1 = null;
+  this.dmq1 = null;
+  this.coeff = null;
+}
+
+// Set the public key fields N and e from hex strings
+function RSASetPublic(N,E) {
+  if(N != null && E != null && N.length > 0 && E.length > 0) {
+    this.n = parseBigInt(N,16);
+    this.e = parseInt(E,16);
+  }
+  else
+    alert("Invalid RSA public key");
+}
+
+// Perform raw public operation on "x": return x^e (mod n)
+function RSADoPublic(x) {
+  return x.modPowInt(this.e, this.n);
+}
+
+// Return the PKCS#1 RSA encryption of "text" as an even-length hex string
+function RSAEncrypt(text) {
+  var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3);
+  if(m == null) return null;
+  var c = this.doPublic(m);
+  if(c == null) return null;
+  var h = c.toString(16);
+  if((h.length & 1) == 0) return h; else return "0" + h;
+}
+
+// Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string
+//function RSAEncryptB64(text) {
+//  var h = this.encrypt(text);
+//  if(h) return hex2b64(h); else return null;
+//}
+
+// protected
+RSAKey.prototype.doPublic = RSADoPublic;
+
+// public
+RSAKey.prototype.setPublic = RSASetPublic;
+RSAKey.prototype.encrypt = RSAEncrypt;
+//RSAKey.prototype.encrypt_b64 = RSAEncryptB64;
+// Depends on rsa.js and jsbn2.js
+
+// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext
+function pkcs1unpad2(d,n) {
+  var b = d.toByteArray();
+  var i = 0;
+  while(i < b.length && b[i] == 0) ++i;
+  if(b.length-i != n-1 || b[i] != 2)
+    return null;
+  ++i;
+  while(b[i] != 0)
+    if(++i >= b.length) return null;
+  var ret = "";
+  while(++i < b.length)
+    ret += String.fromCharCode(b[i]);
+  return ret;
+}
+
+// Set the private key fields N, e, and d from hex strings
+function RSASetPrivate(N,E,D) {
+  if(N != null && E != null && N.length > 0 && E.length > 0) {
+    this.n = parseBigInt(N,16);
+    this.e = parseInt(E,16);
+    this.d = parseBigInt(D,16);
+  }
+  else
+    alert("Invalid RSA private key");
+}
+
+// Set the private key fields N, e, d and CRT params from hex strings
+function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) {
+  if(N != null && E != null && N.length > 0 && E.length > 0) {
+    this.n = parseBigInt(N,16);
+    this.e = parseInt(E,16);
+    this.d = parseBigInt(D,16);
+    this.p = parseBigInt(P,16);
+    this.q = parseBigInt(Q,16);
+    this.dmp1 = parseBigInt(DP,16);
+    this.dmq1 = parseBigInt(DQ,16);
+    this.coeff = parseBigInt(C,16);
+  }
+  else
+    alert("Invalid RSA private key");
+}
+
+// Generate a new random private key B bits long, using public expt E
+function RSAGenerate(B,E) {
+  var rng = new SecureRandom();
+  var qs = B>>1;
+  this.e = parseInt(E,16);
+  var ee = new BigInteger(E,16);
+  for(;;) {
+    for(;;) {
+      this.p = new BigInteger(B-qs,1,rng);
+      if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break;
+    }
+    for(;;) {
+      this.q = new BigInteger(qs,1,rng);
+      if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break;
+    }
+    if(this.p.compareTo(this.q) <= 0) {
+      var t = this.p;
+      this.p = this.q;
+      this.q = t;
+    }
+    var p1 = this.p.subtract(BigInteger.ONE);
+    var q1 = this.q.subtract(BigInteger.ONE);
+    var phi = p1.multiply(q1);
+    if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {
+      this.n = this.p.multiply(this.q);
+      this.d = ee.modInverse(phi);
+      this.dmp1 = this.d.mod(p1);
+      this.dmq1 = this.d.mod(q1);
+      this.coeff = this.q.modInverse(this.p);
+      break;
+    }
+  }
+}
+
+// Perform raw private operation on "x": return x^d (mod n)
+function RSADoPrivate(x) {
+  if(this.p == null || this.q == null)
+    return x.modPow(this.d, this.n);
+
+  // TODO: re-calculate any missing CRT params
+  var xp = x.mod(this.p).modPow(this.dmp1, this.p);
+  var xq = x.mod(this.q).modPow(this.dmq1, this.q);
+
+  while(xp.compareTo(xq) < 0)
+    xp = xp.add(this.p);
+  return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);
+}
+
+// Return the PKCS#1 RSA decryption of "ctext".
+// "ctext" is an even-length hex string and the output is a plain string.
+function RSADecrypt(ctext) {
+  var c = parseBigInt(ctext, 16);
+  var m = this.doPrivate(c);
+  if(m == null) return null;
+  return pkcs1unpad2(m, (this.n.bitLength()+7)>>3);
+}
+
+// Return the PKCS#1 RSA decryption of "ctext".
+// "ctext" is a Base64-encoded string and the output is a plain string.
+//function RSAB64Decrypt(ctext) {
+//  var h = b64tohex(ctext);
+//  if(h) return this.decrypt(h); else return null;
+//}
+
+// protected
+RSAKey.prototype.doPrivate = RSADoPrivate;
+
+// public
+RSAKey.prototype.setPrivate = RSASetPrivate;
+RSAKey.prototype.setPrivateEx = RSASetPrivateEx;
+RSAKey.prototype.generate = RSAGenerate;
+RSAKey.prototype.decrypt = RSADecrypt;
+//RSAKey.prototype.b64_decrypt = RSAB64Decrypt;
+
+
+nValue="a5261939975948bb7a58dffe5ff54e65f0498f9175f5a09288810b8975871e99af3b5dd94057b0fc07535f5f97444504fa35169d461d0d30cf0192e307727c065168c788771c561a9400fb49175e9e6aa4e23fe11af69e9412dd23b0cb6684c4c2429bce139e848ab26d0829073351f4acd36074eafd036a5eb83359d2a698d3";
+eValue="10001";
+dValue="8e9912f6d3645894e8d38cb58c0db81ff516cf4c7e5a14c7f1eddb1459d2cded4d8d293fc97aee6aefb861859c8b6a3d1dfe710463e1f9ddc72048c09751971c4a580aa51eb523357a3cc48d31cfad1d4a165066ed92d4748fb6571211da5cb14bc11b6e2df7c1a559e6d5ac1cd5c94703a22891464fba23d0d965086277a161";
+pValue="d090ce58a92c75233a6486cb0a9209bf3583b64f540c76f5294bb97d285eed33aec220bde14b2417951178ac152ceab6da7090905b478195498b352048f15e7d";
+qValue="cab575dc652bb66df15a0359609d51d1db184750c00c6698b90ef3465c99655103edbf0d54c56aec0ce3c4d22592338092a126a0cc49f65a4a30d222b411e58f";
+dmp1Value="1a24bca8e273df2f0e47c199bbf678604e7df7215480c77c8db39f49b000ce2cf7500038acfff5433b7d582a01f1826e6f4d42e1c57f5e1fef7b12aabc59fd25";
+dmq1Value="3d06982efbbe47339e1f6d36b1216b8a741d410b0c662f54f7118b27b9a4ec9d914337eb39841d8666f3034408cf94f5b62f11c402fc994fe15a05493150d9fd";
+coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db1734c8143f98b602b981aaa9243ca28deb69b5b280ee8dcee0fd2625e53250";
+
+setupEngine(am3, 28);
+
+var TEXT = "The quick brown fox jumped over the extremely lazy frog! " +
+    "Now is the time for all good men to come to the party.";
+var encrypted;
+
+window.onload = function(){ startTest("v8-crypto", '');
+
+test("RSA Encrypt", function encrypt() {
+  var RSA = new RSAKey();
+  RSA.setPublic(nValue, eValue);
+  RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue);
+  encrypted = RSA.encrypt(TEXT);
+});
+
+test("RSA Decrypt", function decrypt() {
+  var RSA = new RSAKey();
+  RSA.setPublic(nValue, eValue);
+  RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue);
+  var decrypted = RSA.decrypt(encrypted);
+  if (decrypted != TEXT) {
+    throw new Error("Crypto operation failed");
+  }
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/v8-deltablue.html b/tests/v8-deltablue.html
new file mode 100644
index 0000000..03bf840
--- /dev/null
+++ b/tests/v8-deltablue.html
@@ -0,0 +1,887 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 1996 John Maloney and Mario Wolczko.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+// This implementation of the DeltaBlue benchmark is derived 
+// from the Smalltalk implementation by John Maloney and Mario 
+// Wolczko. Some parts have been translated directly, whereas 
+// others have been modified more aggresively to make it feel 
+// more like a JavaScript program.
+
+
+/**
+ * A JavaScript implementation of the DeltaBlue constrain-solving
+ * algorithm, as described in:
+ *
+ * "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver"
+ *   Bjorn N. Freeman-Benson and John Maloney
+ *   January 1990 Communications of the ACM,
+ *   also available as University of Washington TR 89-08-06.
+ *
+ * Beware: this benchmark is written in a grotesque style where
+ * the constraint model is built by side-effects from constructors.
+ * I've kept it this way to avoid deviating too much from the original
+ * implementation.
+ */
+
+
+/* --- O b j e c t   M o d e l --- */
+
+function inherits(orig, shuper) {
+  function Inheriter() { }
+  Inheriter.prototype = shuper.prototype;
+  orig.prototype = new Inheriter();
+  orig.superConstructor = shuper;
+}
+
+function OrderedCollection() {
+  this.elms = new Array();
+}
+
+OrderedCollection.prototype.add = function (elm) {
+  this.elms.push(elm);
+}
+
+OrderedCollection.prototype.at = function (index) {
+  return this.elms[index];
+}
+
+OrderedCollection.prototype.size = function () {
+  return this.elms.length;
+}
+
+OrderedCollection.prototype.removeFirst = function () {
+  return this.elms.pop();
+}
+
+OrderedCollection.prototype.remove = function (elm) {
+  var index = 0, skipped = 0;
+  for (var i = 0; i < this.elms.length; i++) {
+    var value = this.elms[i];
+    if (value != elm) {
+      this.elms[index] = value;
+      index++;
+    } else {
+      skipped++;
+    }
+  }
+  for (var i = 0; i < skipped; i++)
+    this.elms.pop();
+}
+
+/* --- *
+ * S t r e n g t h
+ * --- */
+
+/**
+ * Strengths are used to measure the relative importance of constraints.
+ * New strengths may be inserted in the strength hierarchy without
+ * disrupting current constraints.  Strengths cannot be created outside
+ * this class, so pointer comparison can be used for value comparison.
+ */
+function Strength(strengthValue, name) {
+  this.strengthValue = strengthValue;
+  this.name = name;
+}
+
+Strength.stronger = function (s1, s2) {
+  return s1.strengthValue < s2.strengthValue;
+}
+
+Strength.weaker = function (s1, s2) {
+  return s1.strengthValue > s2.strengthValue;
+}
+
+Strength.weakestOf = function (s1, s2) {
+  return this.weaker(s1, s2) ? s1 : s2;
+}
+
+Strength.strongest = function (s1, s2) {
+  return this.stronger(s1, s2) ? s1 : s2;
+}
+
+Strength.prototype.nextWeaker = function () {
+  switch (this.strengthValue) {
+    case 0: return Strength.WEAKEST;
+    case 1: return Strength.WEAK_DEFAULT;
+    case 2: return Strength.NORMAL;
+    case 3: return Strength.STRONG_DEFAULT;
+    case 4: return Strength.PREFERRED;
+    case 5: return Strength.REQUIRED;
+  }
+}
+
+// Strength constants.
+Strength.REQUIRED        = new Strength(0, "required");
+Strength.STONG_PREFERRED = new Strength(1, "strongPreferred");
+Strength.PREFERRED       = new Strength(2, "preferred");
+Strength.STRONG_DEFAULT  = new Strength(3, "strongDefault");
+Strength.NORMAL          = new Strength(4, "normal");
+Strength.WEAK_DEFAULT    = new Strength(5, "weakDefault");
+Strength.WEAKEST         = new Strength(6, "weakest");
+
+/* --- *
+ * C o n s t r a i n t
+ * --- */
+
+/**
+ * An abstract class representing a system-maintainable relationship
+ * (or "constraint") between a set of variables. A constraint supplies
+ * a strength instance variable; concrete subclasses provide a means
+ * of storing the constrained variables and other information required
+ * to represent a constraint.
+ */
+function Constraint(strength) {
+  this.strength = strength;
+}
+
+/**
+ * Activate this constraint and attempt to satisfy it.
+ */
+Constraint.prototype.addConstraint = function () {
+  this.addToGraph();
+  planner.incrementalAdd(this);
+}
+
+/**
+ * Attempt to find a way to enforce this constraint. If successful,
+ * record the solution, perhaps modifying the current dataflow
+ * graph. Answer the constraint that this constraint overrides, if
+ * there is one, or nil, if there isn't.
+ * Assume: I am not already satisfied.
+ */
+Constraint.prototype.satisfy = function (mark) {
+  this.chooseMethod(mark);
+  if (!this.isSatisfied()) {
+    if (this.strength == Strength.REQUIRED)
+      alert("Could not satisfy a required constraint!");
+    return null;
+  }
+  this.markInputs(mark);
+  var out = this.output();
+  var overridden = out.determinedBy;
+  if (overridden != null) overridden.markUnsatisfied();
+  out.determinedBy = this;
+  if (!planner.addPropagate(this, mark))
+    alert("Cycle encountered");
+  out.mark = mark;
+  return overridden;
+}
+
+Constraint.prototype.destroyConstraint = function () {
+  if (this.isSatisfied()) planner.incrementalRemove(this);
+  else this.removeFromGraph();
+}
+
+/**
+ * Normal constraints are not input constraints.  An input constraint
+ * is one that depends on external state, such as the mouse, the
+ * keybord, a clock, or some arbitraty piece of imperative code.
+ */
+Constraint.prototype.isInput = function () {
+  return false;
+}
+
+/* --- *
+ * U n a r y   C o n s t r a i n t
+ * --- */
+
+/**
+ * Abstract superclass for constraints having a single possible output
+ * variable.
+ */
+function UnaryConstraint(v, strength) {
+  UnaryConstraint.superConstructor.call(this, strength);
+  this.myOutput = v;
+  this.satisfied = false;
+  this.addConstraint();
+}
+
+inherits(UnaryConstraint,Constraint);
+
+/**
+ * Adds this constraint to the constraint graph
+ */
+UnaryConstraint.prototype.addToGraph = function () {
+  this.myOutput.addConstraint(this);
+  this.satisfied = false;
+}
+
+/**
+ * Decides if this constraint can be satisfied and records that
+ * decision.
+ */
+UnaryConstraint.prototype.chooseMethod = function (mark) {
+  this.satisfied = (this.myOutput.mark != mark)
+    && Strength.stronger(this.strength, this.myOutput.walkStrength);
+}
+
+/**
+ * Returns true if this constraint is satisfied in the current solution.
+ */
+UnaryConstraint.prototype.isSatisfied = function () {
+  return this.satisfied;
+}
+
+UnaryConstraint.prototype.markInputs = function (mark) {
+  // has no inputs
+}
+
+/**
+ * Returns the current output variable.
+ */
+UnaryConstraint.prototype.output = function () {
+  return this.myOutput;
+}
+
+/**
+ * Calculate the walkabout strength, the stay flag, and, if it is
+ * 'stay', the value for the current output of this constraint. Assume
+ * this constraint is satisfied.
+ */
+UnaryConstraint.prototype.recalculate = function () {
+  this.myOutput.walkStrength = this.strength;
+  this.myOutput.stay = !this.isInput();
+  if (this.myOutput.stay) this.execute(); // Stay optimization
+}
+
+/**
+ * Records that this constraint is unsatisfied
+ */
+UnaryConstraint.prototype.markUnsatisfied = function () {
+  this.satisfied = false;
+}
+
+UnaryConstraint.prototype.inputsKnown = function () {
+  return true;
+}
+
+UnaryConstraint.prototype.removeFromGraph = function () {
+  if (this.myOutput != null) this.myOutput.removeConstraint(this);
+  this.satisfied = false;
+}
+
+/* --- *
+ * S t a y   C o n s t r a i n t
+ * --- */
+
+/**
+ * Variables that should, with some level of preference, stay the same.
+ * Planners may exploit the fact that instances, if satisfied, will not
+ * change their output during plan execution.  This is called "stay
+ * optimization".
+ */
+function StayConstraint(v, str) {
+  StayConstraint.superConstructor.call(this, v, str);
+}
+
+inherits(StayConstraint,UnaryConstraint);
+
+StayConstraint.prototype.execute = function () {
+  // Stay constraints do nothing
+}
+
+/* --- *
+ * E d i t   C o n s t r a i n t
+ * --- */
+
+/**
+ * A unary input constraint used to mark a variable that the client
+ * wishes to change.
+ */
+function EditConstraint(v, str) {
+  EditConstraint.superConstructor.call(this, v, str);
+}
+
+inherits(EditConstraint,UnaryConstraint);
+
+/**
+ * Edits indicate that a variable is to be changed by imperative code.
+ */
+EditConstraint.prototype.isInput = function () {
+  return true;
+}
+
+EditConstraint.prototype.execute = function () {
+  // Edit constraints do nothing
+}
+
+/* --- *
+ * B i n a r y   C o n s t r a i n t
+ * --- */
+
+var Direction = new Object();
+Direction.NONE     = 0;
+Direction.FORWARD  = 1;
+Direction.BACKWARD = -1;
+
+/**
+ * Abstract superclass for constraints having two possible output
+ * variables.
+ */
+function BinaryConstraint(var1, var2, strength) {
+  BinaryConstraint.superConstructor.call(this, strength);
+  this.v1 = var1;
+  this.v2 = var2;
+  this.direction = Direction.NONE;
+  this.addConstraint();
+}
+
+inherits(BinaryConstraint,Constraint);
+
+/**
+ * Decides if this constratint can be satisfied and which way it
+ * should flow based on the relative strength of the variables related,
+ * and record that decision.
+ */
+BinaryConstraint.prototype.chooseMethod = function (mark) {
+  if (this.v1.mark == mark) {
+    this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength))
+      ? Direction.FORWARD
+      : Direction.NONE;
+  }
+  if (this.v2.mark == mark) {
+    this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v1.walkStrength))
+      ? Direction.BACKWARD
+      : Direction.NONE;
+  }
+  if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) {
+    this.direction = Strength.stronger(this.strength, this.v1.walkStrength)
+      ? Direction.BACKWARD
+      : Direction.NONE;
+  } else {
+    this.direction = Strength.stronger(this.strength, this.v2.walkStrength)
+      ? Direction.FORWARD
+      : Direction.BACKWARD
+  }
+}
+
+/**
+ * Add this constraint to the constraint graph
+ */
+BinaryConstraint.prototype.addToGraph = function () {
+  this.v1.addConstraint(this);
+  this.v2.addConstraint(this);
+  this.direction = Direction.NONE;
+}
+
+/**
+ * Answer true if this constraint is satisfied in the current solution.
+ */
+BinaryConstraint.prototype.isSatisfied = function () {
+  return this.direction != Direction.NONE;
+}
+
+/**
+ * Mark the input variable with the given mark.
+ */
+BinaryConstraint.prototype.markInputs = function (mark) {
+  this.input().mark = mark;
+}
+
+/**
+ * Returns the current input variable
+ */
+BinaryConstraint.prototype.input = function () {
+  return (this.direction == Direction.FORWARD) ? this.v1 : this.v2;
+}
+
+/**
+ * Returns the current output variable
+ */
+BinaryConstraint.prototype.output = function () {
+  return (this.direction == Direction.FORWARD) ? this.v2 : this.v1;
+}
+
+/**
+ * Calculate the walkabout strength, the stay flag, and, if it is
+ * 'stay', the value for the current output of this
+ * constraint. Assume this constraint is satisfied.
+ */
+BinaryConstraint.prototype.recalculate = function () {
+  var ihn = this.input(), out = this.output();
+  out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength);
+  out.stay = ihn.stay;
+  if (out.stay) this.execute();
+}
+
+/**
+ * Record the fact that this constraint is unsatisfied.
+ */
+BinaryConstraint.prototype.markUnsatisfied = function () {
+  this.direction = Direction.NONE;
+}
+
+BinaryConstraint.prototype.inputsKnown = function (mark) {
+  var i = this.input();
+  return i.mark == mark || i.stay || i.determinedBy == null;
+}
+
+BinaryConstraint.prototype.removeFromGraph = function () {
+  if (this.v1 != null) this.v1.removeConstraint(this);
+  if (this.v2 != null) this.v2.removeConstraint(this);
+  this.direction = Direction.NONE;
+}
+
+/* --- *
+ * S c a l e   C o n s t r a i n t
+ * --- */
+
+/**
+ * Relates two variables by the linear scaling relationship: "v2 =
+ * (v1 * scale) + offset". Either v1 or v2 may be changed to maintain
+ * this relationship but the scale factor and offset are considered
+ * read-only.
+ */
+function ScaleConstraint(src, scale, offset, dest, strength) {
+  this.direction = Direction.NONE;
+  this.scale = scale;
+  this.offset = offset;
+  ScaleConstraint.superConstructor.call(this, src, dest, strength);
+}
+
+inherits(ScaleConstraint,BinaryConstraint);
+
+/**
+ * Adds this constraint to the constraint graph.
+ */
+ScaleConstraint.prototype.addToGraph = function () {
+  ScaleConstraint.superConstructor.prototype.addToGraph.call(this);
+  this.scale.addConstraint(this);
+  this.offset.addConstraint(this);
+}
+
+ScaleConstraint.prototype.removeFromGraph = function () {
+  ScaleConstraint.superConstructor.prototype.removeFromGraph.call(this);
+  if (this.scale != null) this.scale.removeConstraint(this);
+  if (this.offset != null) this.offset.removeConstraint(this);
+}
+
+ScaleConstraint.prototype.markInputs = function (mark) {
+  ScaleConstraint.superConstructor.prototype.markInputs.call(this, mark);
+  this.scale.mark = this.offset.mark = mark;
+}
+
+/**
+ * Enforce this constraint. Assume that it is satisfied.
+ */
+ScaleConstraint.prototype.execute = function () {
+  if (this.direction == Direction.FORWARD) {
+    this.v2.value = this.v1.value * this.scale.value + this.offset.value;
+  } else {
+    this.v1.value = (this.v2.value - this.offset.value) / this.scale.value;
+  }
+}
+
+/**
+ * Calculate the walkabout strength, the stay flag, and, if it is
+ * 'stay', the value for the current output of this constraint. Assume
+ * this constraint is satisfied.
+ */
+ScaleConstraint.prototype.recalculate = function () {
+  var ihn = this.input(), out = this.output();
+  out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength);
+  out.stay = ihn.stay && this.scale.stay && this.offset.stay;
+  if (out.stay) this.execute();
+}
+
+/* --- *
+ * E q u a l i t  y   C o n s t r a i n t
+ * --- */
+
+/**
+ * Constrains two variables to have the same value.
+ */
+function EqualityConstraint(var1, var2, strength) {
+  EqualityConstraint.superConstructor.call(this, var1, var2, strength);
+}
+
+inherits(EqualityConstraint,BinaryConstraint);
+
+/**
+ * Enforce this constraint. Assume that it is satisfied.
+ */
+EqualityConstraint.prototype.execute = function () {
+  this.output().value = this.input().value;
+}
+
+/* --- *
+ * V a r i a b l e
+ * --- */
+
+/**
+ * A constrained variable. In addition to its value, it maintain the
+ * structure of the constraint graph, the current dataflow graph, and
+ * various parameters of interest to the DeltaBlue incremental
+ * constraint solver.
+ **/
+function Variable(name, initialValue) {
+  this.value = initialValue || 0;
+  this.constraints = new OrderedCollection();
+  this.determinedBy = null;
+  this.mark = 0;
+  this.walkStrength = Strength.WEAKEST;
+  this.stay = true;
+  this.name = name;
+}
+
+/**
+ * Add the given constraint to the set of all constraints that refer
+ * this variable.
+ */
+Variable.prototype.addConstraint = function (c) {
+  this.constraints.add(c);
+}
+
+/**
+ * Removes all traces of c from this variable.
+ */
+Variable.prototype.removeConstraint = function (c) {
+  this.constraints.remove(c);
+  if (this.determinedBy == c) this.determinedBy = null;
+}
+
+/* --- *
+ * P l a n n e r
+ * --- */
+
+/**
+ * The DeltaBlue planner
+ */
+function Planner() {
+  this.currentMark = 0;
+}
+
+/**
+ * Attempt to satisfy the given constraint and, if successful,
+ * incrementally update the dataflow graph.  Details: If satifying
+ * the constraint is successful, it may override a weaker constraint
+ * on its output. The algorithm attempts to resatisfy that
+ * constraint using some other method. This process is repeated
+ * until either a) it reaches a variable that was not previously
+ * determined by any constraint or b) it reaches a constraint that
+ * is too weak to be satisfied using any of its methods. The
+ * variables of constraints that have been processed are marked with
+ * a unique mark value so that we know where we've been. This allows
+ * the algorithm to avoid getting into an infinite loop even if the
+ * constraint graph has an inadvertent cycle.
+ */
+Planner.prototype.incrementalAdd = function (c) {
+  var mark = this.newMark();
+  var overridden = c.satisfy(mark);
+  while (overridden != null)
+    overridden = overridden.satisfy(mark);
+}
+
+/**
+ * Entry point for retracting a constraint. Remove the given
+ * constraint and incrementally update the dataflow graph.
+ * Details: Retracting the given constraint may allow some currently
+ * unsatisfiable downstream constraint to be satisfied. We therefore collect
+ * a list of unsatisfied downstream constraints and attempt to
+ * satisfy each one in turn. This list is traversed by constraint
+ * strength, strongest first, as a heuristic for avoiding
+ * unnecessarily adding and then overriding weak constraints.
+ * Assume: c is satisfied.
+ */
+Planner.prototype.incrementalRemove = function (c) {
+  var out = c.output();
+  c.markUnsatisfied();
+  c.removeFromGraph();
+  var unsatisfied = this.removePropagateFrom(out);
+  var strength = Strength.REQUIRED;
+  do {
+    for (var i = 0; i < unsatisfied.size(); i++) {
+      var u = unsatisfied.at(i);
+      if (u.strength == strength)
+        this.incrementalAdd(u);
+    }
+    strength = strength.nextWeaker();
+  } while (strength != Strength.WEAKEST);
+}
+
+/**
+ * Select a previously unused mark value.
+ */
+Planner.prototype.newMark = function () {
+  return ++this.currentMark;
+}
+
+/**
+ * Extract a plan for resatisfaction starting from the given source
+ * constraints, usually a set of input constraints. This method
+ * assumes that stay optimization is desired; the plan will contain
+ * only constraints whose output variables are not stay. Constraints
+ * that do no computation, such as stay and edit constraints, are
+ * not included in the plan.
+ * Details: The outputs of a constraint are marked when it is added
+ * to the plan under construction. A constraint may be appended to
+ * the plan when all its input variables are known. A variable is
+ * known if either a) the variable is marked (indicating that has
+ * been computed by a constraint appearing earlier in the plan), b)
+ * the variable is 'stay' (i.e. it is a constant at plan execution
+ * time), or c) the variable is not determined by any
+ * constraint. The last provision is for past states of history
+ * variables, which are not stay but which are also not computed by
+ * any constraint.
+ * Assume: sources are all satisfied.
+ */
+Planner.prototype.makePlan = function (sources) {
+  var mark = this.newMark();
+  var plan = new Plan();
+  var todo = sources;
+  while (todo.size() > 0) {
+    var c = todo.removeFirst();
+    if (c.output().mark != mark && c.inputsKnown(mark)) {
+      plan.addConstraint(c);
+      c.output().mark = mark;
+      this.addConstraintsConsumingTo(c.output(), todo);
+    }
+  }
+  return plan;
+}
+
+/**
+ * Extract a plan for resatisfying starting from the output of the
+ * given constraints, usually a set of input constraints.
+ */
+Planner.prototype.extractPlanFromConstraints = function (constraints) {
+  var sources = new OrderedCollection();
+  for (var i = 0; i < constraints.size(); i++) {
+    var c = constraints.at(i);
+    if (c.isInput() && c.isSatisfied())
+      // not in plan already and eligible for inclusion
+      sources.add(c);
+  }
+  return this.makePlan(sources);
+}
+
+/**
+ * Recompute the walkabout strengths and stay flags of all variables
+ * downstream of the given constraint and recompute the actual
+ * values of all variables whose stay flag is true. If a cycle is
+ * detected, remove the given constraint and answer
+ * false. Otherwise, answer true.
+ * Details: Cycles are detected when a marked variable is
+ * encountered downstream of the given constraint. The sender is
+ * assumed to have marked the inputs of the given constraint with
+ * the given mark. Thus, encountering a marked node downstream of
+ * the output constraint means that there is a path from the
+ * constraint's output to one of its inputs.
+ */
+Planner.prototype.addPropagate = function (c, mark) {
+  var todo = new OrderedCollection();
+  todo.add(c);
+  while (todo.size() > 0) {
+    var d = todo.removeFirst();
+    if (d.output().mark == mark) {
+      this.incrementalRemove(c);
+      return false;
+    }
+    d.recalculate();
+    this.addConstraintsConsumingTo(d.output(), todo);
+  }
+  return true;
+}
+
+
+/**
+ * Update the walkabout strengths and stay flags of all variables
+ * downstream of the given constraint. Answer a collection of
+ * unsatisfied constraints sorted in order of decreasing strength.
+ */
+Planner.prototype.removePropagateFrom = function (out) {
+  out.determinedBy = null;
+  out.walkStrength = Strength.WEAKEST;
+  out.stay = true;
+  var unsatisfied = new OrderedCollection();
+  var todo = new OrderedCollection();
+  todo.add(out);
+  while (todo.size() > 0) {
+    var v = todo.removeFirst();
+    for (var i = 0; i < v.constraints.size(); i++) {
+      var c = v.constraints.at(i);
+      if (!c.isSatisfied())
+        unsatisfied.add(c);
+    }
+    var determining = v.determinedBy;
+    for (var i = 0; i < v.constraints.size(); i++) {
+      var next = v.constraints.at(i);
+      if (next != determining && next.isSatisfied()) {
+        next.recalculate();
+        todo.add(next.output());
+      }
+    }
+  }
+  return unsatisfied;
+}
+
+Planner.prototype.addConstraintsConsumingTo = function (v, coll) {
+  var determining = v.determinedBy;
+  var cc = v.constraints;
+  for (var i = 0; i < cc.size(); i++) {
+    var c = cc.at(i);
+    if (c != determining && c.isSatisfied())
+      coll.add(c);
+  }
+}
+
+/* --- *
+ * P l a n
+ * --- */
+
+/**
+ * A Plan is an ordered list of constraints to be executed in sequence
+ * to resatisfy all currently satisfiable constraints in the face of
+ * one or more changing inputs.
+ */
+function Plan() {
+  this.v = new OrderedCollection();
+}
+
+Plan.prototype.addConstraint = function (c) {
+  this.v.add(c);
+}
+
+Plan.prototype.size = function () {
+  return this.v.size();
+}
+
+Plan.prototype.constraintAt = function (index) {
+  return this.v.at(index);
+}
+
+Plan.prototype.execute = function () {
+  for (var i = 0; i < this.size(); i++) {
+    var c = this.constraintAt(i);
+    c.execute();
+  }
+}
+
+/* --- *
+ * M a i n
+ * --- */
+
+/**
+ * This is the standard DeltaBlue benchmark. A long chain of equality
+ * constraints is constructed with a stay constraint on one end. An
+ * edit constraint is then added to the opposite end and the time is
+ * measured for adding and removing this constraint, and extracting
+ * and executing a constraint satisfaction plan. There are two cases.
+ * In case 1, the added constraint is stronger than the stay
+ * constraint and values must propagate down the entire length of the
+ * chain. In case 2, the added constraint is weaker than the stay
+ * constraint so it cannot be accomodated. The cost in this case is,
+ * of course, very low. Typical situations lie somewhere between these
+ * two extremes.
+ */
+function chainTest(n) {
+  planner = new Planner();
+  var prev = null, first = null, last = null;
+
+  // Build chain of n equality constraints
+  for (var i = 0; i <= n; i++) {
+    var name = "v" + i;
+    var v = new Variable(name);
+    if (prev != null)
+      new EqualityConstraint(prev, v, Strength.REQUIRED);
+    if (i == 0) first = v;
+    if (i == n) last = v;
+    prev = v;
+  }
+
+  new StayConstraint(last, Strength.STRONG_DEFAULT);
+  var edit = new EditConstraint(first, Strength.PREFERRED);
+  var edits = new OrderedCollection();
+  edits.add(edit);
+  var plan = planner.extractPlanFromConstraints(edits);
+  for (var i = 0; i < 100; i++) {
+    first.value = i;
+    plan.execute();
+    if (last.value != i)
+      alert("Chain test failed.");
+  }
+}
+
+/**
+ * This test constructs a two sets of variables related to each
+ * other by a simple linear transformation (scale and offset). The
+ * time is measured to change a variable on either side of the
+ * mapping and to change the scale and offset factors.
+ */
+function projectionTest(n) {
+  planner = new Planner();
+  var scale = new Variable("scale", 10);
+  var offset = new Variable("offset", 1000);
+  var src = null, dst = null;
+
+  var dests = new OrderedCollection();
+  for (var i = 0; i < n; i++) {
+    src = new Variable("src" + i, i);
+    dst = new Variable("dst" + i, i);
+    dests.add(dst);
+    new StayConstraint(src, Strength.NORMAL);
+    new ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED);
+  }
+
+  change(src, 17);
+  if (dst.value != 1170) alert("Projection 1 failed");
+  change(dst, 1050);
+  if (src.value != 5) alert("Projection 2 failed");
+  change(scale, 5);
+  for (var i = 0; i < n - 1; i++) {
+    if (dests.at(i).value != i * 5 + 1000)
+      alert("Projection 3 failed");
+  }
+  change(offset, 2000);
+  for (var i = 0; i < n - 1; i++) {
+    if (dests.at(i).value != i * 5 + 2000)
+      alert("Projection 4 failed");
+  }
+}
+
+function change(v, newValue) {
+  var edit = new EditConstraint(v, Strength.PREFERRED);
+  var edits = new OrderedCollection();
+  edits.add(edit);
+  var plan = planner.extractPlanFromConstraints(edits);
+  for (var i = 0; i < 10; i++) {
+    v.value = newValue;
+    plan.execute();
+  }
+  edit.destroyConstraint();
+}
+
+// Global variable holding the current planner.
+var planner = null;
+
+window.onload = function(){ startTest("v8-deltablue", '');
+
+test("Constraint Solving", function deltaBlue() {
+  chainTest(100);
+  projectionTest(100);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/v8-earley-boyer.html b/tests/v8-earley-boyer.html
new file mode 100644
index 0000000..2183447
--- /dev/null
+++ b/tests/v8-earley-boyer.html
@@ -0,0 +1,4693 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// This file is automatically generated by scheme2js, except for the
+// benchmark harness code at the beginning and end of the file.
+
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/************* GENERATED FILE - DO NOT EDIT *************/
+/*
+ * To use write/prints/... the default-output port has to be set first.
+ * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values
+ * should do the trick.
+ * In the following example the std-out and error-port are redirected to
+ * a DIV.
+function initRuntime() {
+    function escapeHTML(s) {
+	var tmp = s;
+	tmp = tmp.replace(/&/g, "&amp;");
+	tmp = tmp.replace(/</g, "&lt;");
+	tmp = tmp.replace(/>/g, "&gt;");
+	tmp = tmp.replace(/ /g, "&nbsp;");
+	tmp = tmp.replace(/\n/g, "<br />");
+	tmp = tmp.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp");
+	return tmp;
+	
+    }
+
+    document.write("<div id='stdout'></div>");
+    SC_DEFAULT_OUT = new sc_GenericOutputPort(
+	function(s) {
+	    var stdout = document.getElementById('stdout');
+	    stdout.innerHTML = stdout.innerHTML + escapeHTML(s);
+	});
+    SC_ERROR_OUT = SC_DEFAULT_OUT;
+}
+*/
+
+
+function sc_print_debug() {
+    sc_print.apply(null, arguments);
+}
+/*** META ((export *js*)) */
+var sc_JS_GLOBALS = this;
+
+var __sc_LINE=-1;
+var __sc_FILE="";
+
+/*** META ((export #t)) */
+function sc_alert() {
+   var len = arguments.length;
+   var s = "";
+   var i;
+
+   for( i = 0; i < len; i++ ) {
+       s += sc_toDisplayString(arguments[ i ]);
+   }
+
+   return alert( s );
+}
+
+/*** META ((export #t)) */
+function sc_typeof( x ) {
+   return typeof x;
+}
+
+/*** META ((export #t)) */
+function sc_error() {
+    var a = [sc_jsstring2symbol("*error*")];
+    for (var i = 0; i < arguments.length; i++) {
+	a[i+1] = arguments[i];
+    }
+    throw a;
+}
+
+/*** META ((export #t)
+           (peephole (prefix "throw ")))
+*/
+function sc_raise(obj) {
+    throw obj;
+}
+
+/*** META ((export with-handler-lambda)) */
+function sc_withHandlerLambda(handler, body) {
+    try {
+	return body();
+    } catch(e) {
+	if (!e._internalException)
+	    return handler(e);
+	else
+	    throw e;
+    }
+}
+
+var sc_properties = new Object();
+
+/*** META ((export #t)) */
+function sc_putpropBang(sym, key, val) {
+    var ht = sc_properties[sym];
+    if (!ht) {
+	ht = new Object();
+	sc_properties[sym] = ht;
+    }
+    ht[key] = val;
+}
+
+/*** META ((export #t)) */
+function sc_getprop(sym, key) {
+    var ht = sc_properties[sym];
+    if (ht) {
+	if (key in ht)
+	    return ht[key];
+	else
+	    return false;
+    } else
+	return false;
+}
+
+/*** META ((export #t)) */
+function sc_rempropBang(sym, key) {
+    var ht = sc_properties[sym];
+    if (ht)
+	delete ht[key];
+}
+
+/*** META ((export #t)) */
+function sc_any2String(o) {
+    return jsstring2string(sc_toDisplayString(o));
+}    
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "==="))
+           (type bool))
+*/
+function sc_isEqv(o1, o2) {
+    return (o1 === o2);
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "==="))
+           (type bool))
+*/
+function sc_isEq(o1, o2) {
+    return (o1 === o2);
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isNumber(n) {
+    return (typeof n === "number");
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isComplex(n) {
+    return sc_isNumber(n);
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isReal(n) {
+    return sc_isNumber(n);
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isRational(n) {
+    return sc_isReal(n);
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isInteger(n) {
+    return (parseInt(n) === n);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix ", false")))
+*/
+// we don't have exact numbers...
+function sc_isExact(n) {
+    return false;
+}
+
+/*** META ((export #t)
+           (peephole (postfix ", true"))
+	   (type bool))
+*/
+function sc_isInexact(n) {
+    return true;
+}
+
+/*** META ((export = =fx =fl)
+           (type bool)
+           (peephole (infix 2 2 "===")))
+*/
+function sc_equal(x) {
+    for (var i = 1; i < arguments.length; i++)
+	if (x !== arguments[i])
+	    return false;
+    return true;
+}
+
+/*** META ((export < <fx <fl)
+           (type bool)
+           (peephole (infix 2 2 "<")))
+*/
+function sc_less(x) {
+    for (var i = 1; i < arguments.length; i++) {
+	if (x >= arguments[i])
+	    return false;
+	x = arguments[i];
+    }
+    return true;
+}
+
+/*** META ((export > >fx >fl)
+           (type bool)
+           (peephole (infix 2 2 ">")))
+*/
+function sc_greater(x, y) {
+    for (var i = 1; i < arguments.length; i++) {
+	if (x <= arguments[i])
+	    return false;
+	x = arguments[i];
+    }
+    return true;
+}
+
+/*** META ((export <= <=fx <=fl)
+           (type bool)
+           (peephole (infix 2 2 "<=")))
+*/
+function sc_lessEqual(x, y) {
+    for (var i = 1; i < arguments.length; i++) {
+	if (x > arguments[i])
+	    return false;
+	x = arguments[i];
+    }
+    return true;
+}
+
+/*** META ((export >= >=fl >=fx)
+           (type bool)
+           (peephole (infix 2 2 ">=")))
+*/
+function sc_greaterEqual(x, y) {
+    for (var i = 1; i < arguments.length; i++) {
+	if (x < arguments[i])
+	    return false;
+	x = arguments[i];
+    }
+    return true;
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix "=== 0")))
+*/
+function sc_isZero(x) {
+    return (x === 0);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix "> 0")))
+*/
+function sc_isPositive(x) {
+    return (x > 0);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix "< 0")))
+*/
+function sc_isNegative(x) {
+    return (x < 0);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix "%2===1")))
+*/
+function sc_isOdd(x) {
+    return (x % 2 === 1);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix "%2===0")))
+*/
+function sc_isEven(x) {
+    return (x % 2 === 0);
+}
+
+/*** META ((export #t)) */
+var sc_max = Math.max;
+/*** META ((export #t)) */
+var sc_min = Math.min;
+
+/*** META ((export + +fx +fl)
+           (peephole (infix 0 #f "+" "0")))
+*/
+function sc_plus() {
+    var sum = 0;
+    for (var i = 0; i < arguments.length; i++)
+	sum += arguments[i];
+    return sum;
+}
+
+/*** META ((export * *fx *fl)
+           (peephole (infix 0 #f "*" "1")))
+*/
+function sc_multi() {
+    var product = 1;
+    for (var i = 0; i < arguments.length; i++)
+	product *= arguments[i];
+    return product;
+}
+
+/*** META ((export - -fx -fl)
+           (peephole (minus)))
+*/
+function sc_minus(x) {
+    if (arguments.length === 1)
+	return -x;
+    else {
+	var res = x;
+	for (var i = 1; i < arguments.length; i++)
+	    res -= arguments[i];
+	return res;
+    }
+}
+
+/*** META ((export / /fl)
+           (peephole (div)))
+*/
+function sc_div(x) {
+    if (arguments.length === 1)
+	return 1/x;
+    else {
+	var res = x;
+	for (var i = 1; i < arguments.length; i++)
+	    res /= arguments[i];
+	return res;
+    }
+}
+
+/*** META ((export #t)) */
+var sc_abs = Math.abs;
+
+/*** META ((export quotient /fx)
+           (peephole (hole 2 "parseInt(" x "/" y ")")))
+*/
+function sc_quotient(x, y) {
+    return parseInt(x / y);
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "%")))
+*/
+function sc_remainder(x, y) {
+    return x % y;
+}
+
+/*** META ((export #t)
+           (peephole (modulo)))
+*/
+function sc_modulo(x, y) {
+    var remainder = x % y;
+    // if they don't have the same sign
+    if ((remainder * y) < 0)
+	return remainder + y;
+    else
+	return remainder;
+}
+
+function sc_euclid_gcd(a, b) {
+    var temp;
+    if (a === 0) return b;
+    if (b === 0) return a;
+    if (a < 0) {a = -a;};
+    if (b < 0) {b = -b;};
+    if (b > a) {temp = a; a = b; b = temp;};
+    while (true) {
+	a %= b;
+	if(a === 0) {return b;};
+	b %= a;
+	if(b === 0) {return a;};
+    };
+    return b;
+}
+
+/*** META ((export #t)) */
+function sc_gcd() {
+    var gcd = 0;
+    for (var i = 0; i < arguments.length; i++)
+	gcd = sc_euclid_gcd(gcd, arguments[i]);
+    return gcd;
+}
+
+/*** META ((export #t)) */
+function sc_lcm() {
+    var lcm = 1;
+    for (var i = 0; i < arguments.length; i++) {
+	var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm));
+	lcm *= Math.abs(f);
+    }
+    return lcm;
+}
+
+// LIMITATION: numerator and denominator don't make sense in floating point world.
+//var SC_MAX_DECIMALS = 1000000
+//
+// function sc_numerator(x) {
+//     var rounded = Math.round(x * SC_MAX_DECIMALS);
+//     return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
+// }
+
+// function sc_denominator(x) {
+//     var rounded = Math.round(x * SC_MAX_DECIMALS);
+//     return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
+// }
+
+/*** META ((export #t)) */
+var sc_floor = Math.floor;
+/*** META ((export #t)) */
+var sc_ceiling = Math.ceil;
+/*** META ((export #t)) */
+var sc_truncate = parseInt;
+/*** META ((export #t)) */
+var sc_round = Math.round;
+
+// LIMITATION: sc_rationalize doesn't make sense in a floating point world.
+
+/*** META ((export #t)) */
+var sc_exp = Math.exp;
+/*** META ((export #t)) */
+var sc_log = Math.log;
+/*** META ((export #t)) */
+var sc_sin = Math.sin;
+/*** META ((export #t)) */
+var sc_cos = Math.cos;
+/*** META ((export #t)) */
+var sc_tan = Math.tan;
+/*** META ((export #t)) */
+var sc_asin = Math.asin;
+/*** META ((export #t)) */
+var sc_acos = Math.acos;
+/*** META ((export #t)) */
+var sc_atan = Math.atan;
+
+/*** META ((export #t)) */
+var sc_sqrt = Math.sqrt;
+/*** META ((export #t)) */
+var sc_expt = Math.pow;
+
+// LIMITATION: we don't have complex numbers.
+// LIMITATION: the following functions are hence not implemented.
+// LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle
+// LIMITATION: 2 argument atan
+
+/*** META ((export #t)
+           (peephole (id)))
+*/
+function sc_exact2inexact(x) {
+    return x;
+}
+
+/*** META ((export #t)
+           (peephole (id)))
+*/
+function sc_inexact2exact(x) {
+    return x;
+}
+
+function sc_number2jsstring(x, radix) {
+    if (radix)
+	return x.toString(radix);
+    else
+	return x.toString();
+}
+
+function sc_jsstring2number(s, radix) {
+    if (s === "") return false;
+
+    if (radix) {
+	var t = parseInt(s, radix);
+	if (!t && t !== 0) return false;
+	// verify that each char is in range. (parseInt ignores leading
+	// white and trailing chars)
+	var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1);
+	if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s))
+	    return t;
+	else return false;
+    } else {
+	var t = +s; // does not ignore trailing chars.
+	if (!t && t !== 0) return false;
+	// simply verify that first char is not whitespace.
+	var c = s.charAt(0);
+	// if +c is 0, but the char is not "0", then we have a whitespace.
+	if (+c === 0 && c !== "0") return false;
+	return t;
+    }
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (not)))
+*/
+function sc_not(b) {
+    return b === false;
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isBoolean(b) {
+    return (b === true) || (b === false);
+}
+
+function sc_Pair(car, cdr) {
+    this.car = car;
+    this.cdr = cdr;
+}
+
+sc_Pair.prototype.toString = function() {
+    return sc_toDisplayString(this);
+};
+sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {
+    var current = this;
+
+    var res = "(";
+
+    while(true) {
+	res += writeOrDisplay(current.car);
+	if (sc_isPair(current.cdr)) {
+	    res += " ";
+	    current = current.cdr;
+	} else if (current.cdr !== null) {
+	    res += " . " + writeOrDisplay(current.cdr);
+	    break;
+	} else // current.cdr == null
+	    break;
+    }
+	
+    res += ")";
+
+    return res;
+};
+sc_Pair.prototype.sc_toDisplayString = function() {
+    return this.sc_toWriteOrDisplayString(sc_toDisplayString);
+};
+sc_Pair.prototype.sc_toWriteString = function() {
+    return this.sc_toWriteOrDisplayString(sc_toWriteString);
+};
+// sc_Pair.prototype.sc_toWriteCircleString in IO.js
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix " instanceof sc_Pair")))
+*/
+function sc_isPair(p) {
+    return (p instanceof sc_Pair);
+}
+
+function sc_isPairEqual(p1, p2, comp) {
+    return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr));
+}
+
+/*** META ((export #t)
+           (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))
+*/
+function sc_cons(car, cdr) {
+    return new sc_Pair(car, cdr);
+}
+
+/*** META ((export cons*)) */
+function sc_consStar() {
+    var res = arguments[arguments.length - 1];
+    for (var i = arguments.length-2; i >= 0; i--)
+	res = new sc_Pair(arguments[i], res);
+    return res;
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".car")))
+*/
+function sc_car(p) {
+    return p.car;
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".cdr")))
+*/
+function sc_cdr(p) {
+    return p.cdr;
+}
+
+/*** META ((export #t)
+           (peephole (hole 2 p ".car = " val)))
+*/
+function sc_setCarBang(p, val) {
+    p.car = val;
+}
+
+/*** META ((export #t)
+           (peephole (hole 2 p ".cdr = " val)))
+*/
+function sc_setCdrBang(p, val) {
+    p.cdr = val;
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".car.car")))
+*/
+function sc_caar(p) { return p.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car")))
+*/
+function sc_cadr(p) { return p.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr")))
+*/
+function sc_cdar(p) { return p.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr")))
+*/
+function sc_cddr(p) { return p.cdr.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".car.car.car")))
+*/
+function sc_caaar(p) { return p.car.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr.car")))
+*/
+function sc_cadar(p) { return p.car.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car.car")))
+*/
+function sc_caadr(p) { return p.cdr.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr.car")))
+*/
+function sc_caddr(p) { return p.cdr.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.car.cdr")))
+*/
+function sc_cdaar(p) { return p.car.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car.cdr")))
+*/
+function sc_cdadr(p) { return p.cdr.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr.cdr")))
+*/
+function sc_cddar(p) { return p.car.cdr.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr.cdr")))
+*/
+function sc_cdddr(p) { return p.cdr.cdr.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".car.car.car.car")))
+*/
+function sc_caaaar(p) { return p.car.car.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr.car.car")))
+*/
+function sc_caadar(p) { return p.car.cdr.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car.car.car")))
+*/
+function sc_caaadr(p) { return p.cdr.car.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr.car.car")))
+*/
+function sc_caaddr(p) { return p.cdr.cdr.car.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.car.car.cdr")))
+*/
+function sc_cdaaar(p) { return p.car.car.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr.car.cdr")))
+*/
+function sc_cdadar(p) { return p.car.cdr.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car.car.cdr")))
+*/
+function sc_cdaadr(p) { return p.cdr.car.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr.car.cdr")))
+*/
+function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".car.car.cdr.car")))
+*/
+function sc_cadaar(p) { return p.car.car.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr.cdr.car")))
+*/
+function sc_caddar(p) { return p.car.cdr.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car.cdr.car")))
+*/
+function sc_cadadr(p) { return p.cdr.car.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr.cdr.car")))
+*/
+function sc_cadddr(p) { return p.cdr.cdr.cdr.car; }
+/*** META ((export #t)
+           (peephole (postfix ".car.car.cdr.cdr")))
+*/
+function sc_cddaar(p) { return p.car.car.cdr.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".car.cdr.cdr.cdr")))
+*/
+function sc_cdddar(p) { return p.car.cdr.cdr.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.car.cdr.cdr")))
+*/
+function sc_cddadr(p) { return p.cdr.car.cdr.cdr; }
+/*** META ((export #t)
+           (peephole (postfix ".cdr.cdr.cdr.cdr")))
+*/
+function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; }
+
+/*** META ((export #t)) */
+function sc_lastPair(l) {
+    if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected");
+    var res = l;
+    var cdr = l.cdr;
+    while (sc_isPair(cdr)) {
+	res = cdr;
+	cdr = res.cdr;
+    }
+    return res;
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix " === null")))
+*/
+function sc_isNull(o) {
+    return (o === null);
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isList(o) {
+    var rabbit;
+    var turtle;
+
+    var rabbit = o;
+    var turtle = o;
+    while (true) {
+	if (rabbit === null ||
+	    (rabbit instanceof sc_Pair && rabbit.cdr === null))
+	    return true;  // end of list
+	else if ((rabbit instanceof sc_Pair) &&
+		 (rabbit.cdr instanceof sc_Pair)) {
+	    rabbit = rabbit.cdr.cdr;
+	    turtle = turtle.cdr;
+	    if (rabbit === turtle) return false; // cycle
+	} else
+	    return false; // not pair
+    }
+}
+
+/*** META ((export #t)) */
+function sc_list() {
+    var res = null;
+    var a = arguments;
+    for (var i = a.length-1; i >= 0; i--)
+	res = new sc_Pair(a[i], res);
+    return res;
+}
+
+/*** META ((export #t)) */
+function sc_iota(num, init) {
+   var res = null;
+   if (!init) init = 0;
+   for (var i = num - 1; i >= 0; i--)
+      res = new sc_Pair(i + init, res);
+   return res;
+}
+
+/*** META ((export #t)) */
+function sc_makeList(nbEls, fill) {
+    var res = null;
+    for (var i = 0; i < nbEls; i++)
+	res = new sc_Pair(fill, res);
+    return res;
+}
+
+/*** META ((export #t)) */
+function sc_length(l) {
+    var res = 0;
+    while (l !== null) {
+	res++;
+	l = l.cdr;
+    }
+    return res;
+}
+
+/*** META ((export #t)) */
+function sc_remq(o, l) {
+    var dummy = { cdr : null };
+    var tail = dummy;
+    while (l !== null) {
+	if (l.car !== o) {
+	    tail.cdr = sc_cons(l.car, null);
+	    tail = tail.cdr;
+	}
+	l = l.cdr;
+    }
+    return dummy.cdr;
+}
+
+/*** META ((export #t)) */
+function sc_remqBang(o, l) {
+    var dummy = { cdr : null };
+    var tail = dummy;
+    var needsAssig = true;
+    while (l !== null) {
+	if (l.car === o) {
+	    needsAssig = true;
+	} else {
+	    if (needsAssig) {
+		tail.cdr = l;
+		needsAssig = false;
+	    }
+	    tail = l;
+	}
+	l = l.cdr;
+    }
+    tail.cdr = null;
+    return dummy.cdr;
+}
+
+/*** META ((export #t)) */
+function sc_delete(o, l) {
+    var dummy = { cdr : null };
+    var tail = dummy;
+    while (l !== null) {
+	if (!sc_isEqual(l.car, o)) {
+	    tail.cdr = sc_cons(l.car, null);
+	    tail = tail.cdr;
+	}
+	l = l.cdr;
+    }
+    return dummy.cdr;
+}
+
+/*** META ((export #t)) */
+function sc_deleteBang(o, l) {
+    var dummy = { cdr : null };
+    var tail = dummy;
+    var needsAssig = true;
+    while (l !== null) {
+	if (sc_isEqual(l.car, o)) {
+	    needsAssig = true;
+	} else {
+	    if (needsAssig) {
+		tail.cdr = l;
+		needsAssig = false;
+	    }
+	    tail = l;
+	}
+	l = l.cdr;
+    }
+    tail.cdr = null;
+    return dummy.cdr;
+}
+
+function sc_reverseAppendBang(l1, l2) {
+    var res = l2;
+    while (l1 !== null) {
+	var tmp = res;
+	res = l1;
+	l1 = l1.cdr;
+	res.cdr = tmp;
+    }
+    return res;
+}
+	
+function sc_dualAppend(l1, l2) {
+    if (l1 === null) return l2;
+    if (l2 === null) return l1;
+    var rev = sc_reverse(l1);
+    return sc_reverseAppendBang(rev, l2);
+}
+
+/*** META ((export #t)) */
+function sc_append() {
+    if (arguments.length === 0)
+	return null;
+    var res = arguments[arguments.length - 1];
+    for (var i = arguments.length - 2; i >= 0; i--)
+	res = sc_dualAppend(arguments[i], res);
+    return res;
+}
+
+function sc_dualAppendBang(l1, l2) {
+    if (l1 === null) return l2;
+    if (l2 === null) return l1;
+    var tmp = l1;
+    while (tmp.cdr !== null) tmp=tmp.cdr;
+    tmp.cdr = l2;
+    return l1;
+}
+    
+/*** META ((export #t)) */
+function sc_appendBang() {
+    var res = null;
+    for (var i = 0; i < arguments.length; i++)
+	res = sc_dualAppendBang(res, arguments[i]);
+    return res;
+}
+
+/*** META ((export #t)) */
+function sc_reverse(l1) {
+    var res = null;
+    while (l1 !== null) {
+	res = sc_cons(l1.car, res);
+	l1 = l1.cdr;
+    }
+    return res;
+}
+
+/*** META ((export #t)) */
+function sc_reverseBang(l) {
+    return sc_reverseAppendBang(l, null);
+}
+
+/*** META ((export #t)) */
+function sc_listTail(l, k) {
+    var res = l;
+    for (var i = 0; i < k; i++) {
+	res = res.cdr;
+    }
+    return res;
+}
+
+/*** META ((export #t)) */
+function sc_listRef(l, k) {
+    return sc_listTail(l, k).car;
+}
+
+/* // unoptimized generic versions
+function sc_memX(o, l, comp) {
+    while (l != null) {
+	if (comp(l.car, o))
+	    return l;
+	l = l.cdr;
+    }
+    return false;
+}
+function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); }
+function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); }
+function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); }
+*/
+
+/* optimized versions */
+/*** META ((export #t)) */
+function sc_memq(o, l) {
+    while (l !== null) {
+	if (l.car === o)
+	    return l;
+	l = l.cdr;
+    }
+    return false;
+}
+/*** META ((export #t)) */
+function sc_memv(o, l) {
+    while (l !== null) {
+	if (l.car === o)
+	    return l;
+	l = l.cdr;
+    }
+    return false;
+}
+/*** META ((export #t)) */
+function sc_member(o, l) {
+    while (l !== null) {
+	if (sc_isEqual(l.car,o))
+	    return l;
+	l = l.cdr;
+    }
+    return false;
+}
+
+/* // generic unoptimized versions
+function sc_assX(o, al, comp) {
+    while (al != null) {
+	if (comp(al.car.car, o))
+	    return al.car;
+	al = al.cdr;
+    }
+    return false;
+}
+function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); }
+function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); }
+function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); }
+*/
+// optimized versions
+/*** META ((export #t)) */
+function sc_assq(o, al) {
+    while (al !== null) {
+	if (al.car.car === o)
+	    return al.car;
+	al = al.cdr;
+    }
+    return false;
+}
+/*** META ((export #t)) */
+function sc_assv(o, al) {
+    while (al !== null) {
+	if (al.car.car === o)
+	    return al.car;
+	al = al.cdr;
+    }
+    return false;
+}
+/*** META ((export #t)) */
+function sc_assoc(o, al) {
+    while (al !== null) {
+	if (sc_isEqual(al.car.car, o))
+	    return al.car;
+	al = al.cdr;
+    }
+    return false;
+}
+
+/* can be used for mutable strings and characters */
+function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; }
+function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; }
+function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; }
+function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; }
+function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; }
+function sc_isCharStringCIEqual(cs1, cs2)
+    { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); }
+function sc_isCharStringCILess(cs1, cs2)
+    { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); }
+function sc_isCharStringCIGreater(cs1, cs2)
+    { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); }
+function sc_isCharStringCILessEqual(cs1, cs2)
+    { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); }
+function sc_isCharStringCIGreaterEqual(cs1, cs2)
+    { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); }
+
+
+
+
+function sc_Char(c) {
+    var cached = sc_Char.lazy[c];
+    if (cached)
+	return cached;
+    this.val = c;
+    sc_Char.lazy[c] = this;
+    // add return, so FF does not complain.
+    return undefined;
+}
+sc_Char.lazy = new Object();
+// thanks to Eric
+sc_Char.char2readable = {
+    "\000": "#\\null",
+    "\007": "#\\bell",
+    "\010": "#\\backspace",
+    "\011": "#\\tab",
+    "\012": "#\\newline",
+    "\014": "#\\page",
+    "\015": "#\\return",
+    "\033": "#\\escape",
+    "\040": "#\\space",
+    "\177": "#\\delete",
+
+  /* poeticless names */
+    "\001": "#\\soh",
+    "\002": "#\\stx",
+    "\003": "#\\etx",
+    "\004": "#\\eot",
+    "\005": "#\\enq",
+    "\006": "#\\ack",
+
+    "\013": "#\\vt",
+    "\016": "#\\so",
+    "\017": "#\\si",
+
+    "\020": "#\\dle",
+    "\021": "#\\dc1",
+    "\022": "#\\dc2",
+    "\023": "#\\dc3",
+    "\024": "#\\dc4",
+    "\025": "#\\nak",
+    "\026": "#\\syn",
+    "\027": "#\\etb",
+
+    "\030": "#\\can",
+    "\031": "#\\em",
+    "\032": "#\\sub",
+    "\033": "#\\esc",
+    "\034": "#\\fs",
+    "\035": "#\\gs",
+    "\036": "#\\rs",
+    "\037": "#\\us"};
+
+sc_Char.readable2char = {
+    "null": "\000",
+    "bell": "\007",
+    "backspace": "\010",
+    "tab": "\011",
+    "newline": "\012",
+    "page": "\014",
+    "return": "\015",
+    "escape": "\033",
+    "space": "\040",
+    "delete": "\000",
+    "soh": "\001",
+    "stx": "\002",
+    "etx": "\003",
+    "eot": "\004",
+    "enq": "\005",
+    "ack": "\006",
+    "bel": "\007",
+    "bs": "\010",
+    "ht": "\011",
+    "nl": "\012",
+    "vt": "\013",
+    "np": "\014",
+    "cr": "\015",
+    "so": "\016",
+    "si": "\017",
+    "dle": "\020",
+    "dc1": "\021",
+    "dc2": "\022",
+    "dc3": "\023",
+    "dc4": "\024",
+    "nak": "\025",
+    "syn": "\026",
+    "etb": "\027",
+    "can": "\030",
+    "em": "\031",
+    "sub": "\032",
+    "esc": "\033",
+    "fs": "\034",
+    "gs": "\035",
+    "rs": "\036",
+    "us": "\037",
+    "sp": "\040",
+    "del": "\177"};
+    
+sc_Char.prototype.toString = function() {
+    return this.val;
+};
+// sc_toDisplayString == toString
+sc_Char.prototype.sc_toWriteString = function() {
+    var entry = sc_Char.char2readable[this.val];
+    if (entry)
+	return entry;
+    else
+	return "#\\" + this.val;
+};
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix "instanceof sc_Char")))
+*/
+function sc_isChar(c) {
+    return (c instanceof sc_Char);
+}
+
+/*** META ((export char=?)
+           (type bool)
+           (peephole (hole 2 c1 ".val === " c2 ".val")))
+*/
+var sc_isCharEqual = sc_isCharStringEqual;
+/*** META ((export char<?)
+           (type bool)
+           (peephole (hole 2 c1 ".val < " c2 ".val")))
+*/
+var sc_isCharLess = sc_isCharStringLess;
+/*** META ((export char>?)
+           (type bool)
+           (peephole (hole 2 c1 ".val > " c2 ".val")))
+*/
+var sc_isCharGreater = sc_isCharStringGreater;
+/*** META ((export char<=?)
+           (type bool)
+           (peephole (hole 2 c1 ".val <= " c2 ".val")))
+*/
+var sc_isCharLessEqual = sc_isCharStringLessEqual;
+/*** META ((export char>=?)
+           (type bool)
+           (peephole (hole 2 c1 ".val >= " c2 ".val")))
+*/
+var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual;
+/*** META ((export char-ci=?)
+           (type bool)
+           (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()")))
+*/
+var sc_isCharCIEqual = sc_isCharStringCIEqual;
+/*** META ((export char-ci<?)
+           (type bool)
+           (peephole (hole 2 c1 ".val.toLowerCase() < " c2 ".val.toLowerCase()")))
+*/
+var sc_isCharCILess = sc_isCharStringCILess;
+/*** META ((export char-ci>?)
+           (type bool)
+           (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()")))
+*/
+var sc_isCharCIGreater = sc_isCharStringCIGreater;
+/*** META ((export char-ci<=?)
+           (type bool)
+           (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()")))
+*/
+var sc_isCharCILessEqual = sc_isCharStringCILessEqual;
+/*** META ((export char-ci>=?)
+           (type bool)
+           (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()")))
+*/
+var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual;
+
+var SC_NUMBER_CLASS = "0123456789";
+var SC_WHITESPACE_CLASS = ' \r\n\t\f';
+var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz';
+var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+
+function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); }
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isCharAlphabetic(c)
+    { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) ||
+	  sc_isCharOfClass(c.val, SC_UPPER_CLASS); }
+/*** META ((export #t)
+           (type bool)
+           (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1")))
+*/
+function sc_isCharNumeric(c)
+    { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); }
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isCharWhitespace(c) {
+    var tmp = c.val;
+    return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f";
+}
+/*** META ((export #t)
+           (type bool)
+           (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1")))
+*/
+function sc_isCharUpperCase(c)
+    { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); }
+/*** META ((export #t)
+           (type bool)
+           (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1")))
+*/
+function sc_isCharLowerCase(c)
+    { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); }
+
+/*** META ((export #t)
+           (peephole (postfix ".val.charCodeAt(0)")))
+*/
+function sc_char2integer(c)
+    { return c.val.charCodeAt(0); }
+/*** META ((export #t)
+           (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))")))
+*/
+function sc_integer2char(n)
+    { return new sc_Char(String.fromCharCode(n)); }
+
+/*** META ((export #t)
+           (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())")))
+*/
+function sc_charUpcase(c)
+    { return new sc_Char(c.val.toUpperCase()); }
+/*** META ((export #t)
+           (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())")))
+*/
+function sc_charDowncase(c)
+    { return new sc_Char(c.val.toLowerCase()); }
+
+function sc_makeJSStringOfLength(k, c) {
+    var fill;
+    if (c === undefined)
+	fill = " ";
+    else
+	fill = c;
+    var res = "";
+    var len = 1;
+    // every round doubles the size of fill.
+    while (k >= len) {
+	if (k & len)
+	    res = res.concat(fill);
+	fill = fill.concat(fill);
+	len *= 2;
+    }
+    return res;
+}
+
+function sc_makejsString(k, c) {
+    var fill;
+    if (c)
+	fill = c.val;
+    else
+	fill = " ";
+    return sc_makeJSStringOfLength(k, fill);
+}
+
+function sc_jsstring2list(s) {
+    var res = null;
+    for (var i = s.length - 1; i >= 0; i--)
+	res = sc_cons(new sc_Char(s.charAt(i)), res);
+    return res;
+}
+
+function sc_list2jsstring(l) {
+    var a = new Array();
+    while(l !== null) {
+	a.push(l.car.val);
+	l = l.cdr;
+    }
+    return "".concat.apply("", a);
+}
+
+var sc_Vector = Array;
+
+sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) {
+    if (this.length === 0) return "#()";
+
+    var res = "#(" + writeOrDisplay(this[0]);
+    for (var i = 1; i < this.length; i++)
+	res += " " + writeOrDisplay(this[i]);
+    res += ")";
+    return res;
+};
+sc_Vector.prototype.sc_toDisplayString = function() {
+    return this.sc_toWriteOrDisplayString(sc_toDisplayString);
+};
+sc_Vector.prototype.sc_toWriteString = function() {
+    return this.sc_toWriteOrDisplayString(sc_toWriteString);
+};
+
+/*** META ((export vector? array?)
+           (type bool)
+           (peephole (postfix " instanceof sc_Vector")))
+*/
+function sc_isVector(v) {
+    return (v instanceof sc_Vector);
+}
+
+// only applies to vectors
+function sc_isVectorEqual(v1, v2, comp) {
+    if (v1.length !== v2.length) return false;
+    for (var i = 0; i < v1.length; i++)
+	if (!comp(v1[i], v2[i])) return false;
+    return true;
+}
+
+/*** META ((export make-vector make-array)) */
+function sc_makeVector(size, fill) {
+    var a = new sc_Vector(size);
+    if (fill !== undefined)
+	sc_vectorFillBang(a, fill);
+    return a;
+}
+
+/*** META ((export vector array)
+           (peephole (vector)))
+*/
+function sc_vector() {
+    var a = new sc_Vector();
+    for (var i = 0; i < arguments.length; i++)
+	a.push(arguments[i]);
+    return a;
+}
+
+/*** META ((export vector-length array-length)
+           (peephole (postfix ".length")))
+*/
+function sc_vectorLength(v) {
+    return v.length;
+}
+
+/*** META ((export vector-ref array-ref)
+           (peephole (hole 2 v "[" pos "]")))
+*/
+function sc_vectorRef(v, pos) {
+    return v[pos];
+}
+
+/*** META ((export vector-set! array-set!)
+           (peephole (hole 3 v "[" pos "] = " val)))
+*/
+function sc_vectorSetBang(v, pos, val) {
+    v[pos] = val;
+}
+
+/*** META ((export vector->list array->list)) */
+function sc_vector2list(a) {
+    var res = null;
+    for (var i = a.length-1; i >= 0; i--)
+	res = sc_cons(a[i], res);
+    return res;
+}
+
+/*** META ((export list->vector list->array)) */
+function sc_list2vector(l) {
+    var a = new sc_Vector();
+    while(l !== null) {
+	a.push(l.car);
+	l = l.cdr;
+    }
+    return a;
+}
+
+/*** META ((export vector-fill! array-fill!)) */
+function sc_vectorFillBang(a, fill) {
+    for (var i = 0; i < a.length; i++)
+	a[i] = fill;
+}
+
+
+/*** META ((export #t)) */
+function sc_copyVector(a, len) {
+    if (len <= a.length)
+	return a.slice(0, len);
+    else {
+	var tmp = a.concat();
+	tmp.length = len;
+	return tmp;
+    }
+}
+
+/*** META ((export #t)
+           (peephole (hole 3 a ".slice(" start "," end ")")))
+*/
+function sc_vectorCopy(a, start, end) {
+    return a.slice(start, end);
+}
+
+/*** META ((export #t)) */
+function sc_vectorCopyBang(target, tstart, source, sstart, send) {
+    if (!sstart) sstart = 0;
+    if (!send) send = source.length;
+
+    // if target == source we don't want to overwrite not yet copied elements.
+    if (tstart <= sstart) {
+	for (var i = tstart, j = sstart; j < send; i++, j++) {
+	    target[i] = source[j];
+	}
+    } else {
+	var diff = send - sstart;
+	for (var i = tstart + diff - 1, j = send - 1;
+	     j >= sstart;
+	     i--, j--) {
+	    target[i] = source[j];
+	}
+    }
+    return target;
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (hole 1 "typeof " o " === 'function'")))
+*/
+function sc_isProcedure(o) {
+    return (typeof o === "function");
+}
+
+/*** META ((export #t)) */
+function sc_apply(proc) {
+    var args = new Array();
+    // first part of arguments are not in list-form.
+    for (var i = 1; i < arguments.length - 1; i++)
+	args.push(arguments[i]);
+    var l = arguments[arguments.length - 1];
+    while (l !== null) {
+	args.push(l.car);
+	l = l.cdr;
+    }
+    return proc.apply(null, args);
+}
+
+/*** META ((export #t)) */
+function sc_map(proc, l1) {
+    if (l1 === undefined)
+	return null;
+    // else
+    var nbApplyArgs = arguments.length - 1;
+    var applyArgs = new Array(nbApplyArgs);
+    var revres = null;
+    while (l1 !== null) {
+	for (var i = 0; i < nbApplyArgs; i++) {
+	    applyArgs[i] = arguments[i + 1].car;
+	    arguments[i + 1] = arguments[i + 1].cdr;
+	}
+	revres = sc_cons(proc.apply(null, applyArgs), revres);
+    }
+    return sc_reverseAppendBang(revres, null);
+}
+
+/*** META ((export #t)) */
+function sc_mapBang(proc, l1) {
+    if (l1 === undefined)
+	return null;
+    // else
+    var l1_orig = l1;
+    var nbApplyArgs = arguments.length - 1;
+    var applyArgs = new Array(nbApplyArgs);
+    while (l1 !== null) {
+	var tmp = l1;
+	for (var i = 0; i < nbApplyArgs; i++) {
+	    applyArgs[i] = arguments[i + 1].car;
+	    arguments[i + 1] = arguments[i + 1].cdr;
+	}
+	tmp.car = proc.apply(null, applyArgs);
+    }
+    return l1_orig;
+}
+     
+/*** META ((export #t)) */
+function sc_forEach(proc, l1) {
+    if (l1 === undefined)
+	return undefined;
+    // else
+    var nbApplyArgs = arguments.length - 1;
+    var applyArgs = new Array(nbApplyArgs);
+    while (l1 !== null) {
+	for (var i = 0; i < nbApplyArgs; i++) {
+	    applyArgs[i] = arguments[i + 1].car;
+	    arguments[i + 1] = arguments[i + 1].cdr;
+	}
+	proc.apply(null, applyArgs);
+    }
+    // add return so FF does not complain.
+    return undefined;
+}
+
+/*** META ((export #t)) */
+function sc_filter(proc, l1) {
+    var dummy = { cdr : null };
+    var tail = dummy;
+    while (l1 !== null) {
+	if (proc(l1.car) !== false) {
+	    tail.cdr = sc_cons(l1.car, null);
+	    tail = tail.cdr;
+	}
+	l1 = l1.cdr;
+    }
+    return dummy.cdr;
+}
+
+/*** META ((export #t)) */
+function sc_filterBang(proc, l1) {
+    var head = sc_cons("dummy", l1);
+    var it = head;
+    var next = l1;
+    while (next !== null) {
+        if (proc(next.car) !== false) {
+	    it.cdr = next
+	    it = next;
+	}
+	next = next.cdr;
+    }
+    it.cdr = null;
+    return head.cdr;
+}
+
+function sc_filterMap1(proc, l1) {
+    var revres = null;
+    while (l1 !== null) {
+        var tmp = proc(l1.car)
+        if (tmp !== false) revres = sc_cons(tmp, revres);
+        l1 = l1.cdr;
+    }
+    return sc_reverseAppendBang(revres, null);
+}
+function sc_filterMap2(proc, l1, l2) {
+    var revres = null;
+    while (l1 !== null) {
+        var tmp = proc(l1.car, l2.car);
+        if(tmp !== false) revres = sc_cons(tmp, revres);
+	l1 = l1.cdr;
+	l2 = l2.cdr
+    }
+    return sc_reverseAppendBang(revres, null);
+}
+
+/*** META ((export #t)) */
+function sc_filterMap(proc, l1, l2, l3) {
+    if (l2 === undefined)
+	return sc_filterMap1(proc, l1);
+    else if (l3 === undefined)
+	return sc_filterMap2(proc, l1, l2);
+    // else
+    var nbApplyArgs = arguments.length - 1;
+    var applyArgs = new Array(nbApplyArgs);
+    var revres = null;
+    while (l1 !== null) {
+	for (var i = 0; i < nbApplyArgs; i++) {
+	    applyArgs[i] = arguments[i + 1].car;
+	    arguments[i + 1] = arguments[i + 1].cdr;
+	}
+	var tmp = proc.apply(null, applyArgs);
+	if(tmp !== false) revres = sc_cons(tmp, revres);
+    }
+    return sc_reverseAppendBang(revres, null);
+}
+
+/*** META ((export #t)) */
+function sc_any(proc, l) {
+    var revres = null;
+    while (l !== null) {
+        var tmp = proc(l.car);
+        if(tmp !== false) return tmp;
+	l = l.cdr;
+    }
+    return false;
+}
+
+/*** META ((export any?)
+           (peephole (hole 2 "sc_any(" proc "," l ") !== false")))
+*/
+function sc_anyPred(proc, l) {
+    return sc_any(proc, l)!== false;
+}
+
+/*** META ((export #t)) */
+function sc_every(proc, l) {
+    var revres = null;
+    var tmp = true;
+    while (l !== null) {
+        tmp = proc(l.car);
+        if (tmp === false) return false;
+	l = l.cdr;
+    }
+    return tmp;
+}
+
+/*** META ((export every?)
+           (peephole (hole 2 "sc_every(" proc "," l ") !== false")))
+*/
+function sc_everyPred(proc, l) {
+    var tmp = sc_every(proc, l);
+    if (tmp !== false) return true;
+    return false;
+}
+
+/*** META ((export #t)
+           (peephole (postfix "()")))
+*/
+function sc_force(o) {
+    return o();
+}
+
+/*** META ((export #t)) */
+function sc_makePromise(proc) {
+    var isResultReady = false;
+    var result = undefined;
+    return function() {
+	if (!isResultReady) {
+	    var tmp = proc();
+	    if (!isResultReady) {
+		isResultReady = true;
+		result = tmp;
+	    }
+	}
+	return result;
+    };
+}
+
+function sc_Values(values) {
+    this.values = values;
+}
+
+/*** META ((export #t)
+           (peephole (values)))
+*/
+function sc_values() {
+    if (arguments.length === 1)
+	return arguments[0];
+    else
+	return new sc_Values(arguments);
+}
+
+/*** META ((export #t)) */
+function sc_callWithValues(producer, consumer) {
+    var produced = producer();
+    if (produced instanceof sc_Values)
+	return consumer.apply(null, produced.values);
+    else
+	return consumer(produced);
+}
+
+/*** META ((export #t)) */
+function sc_dynamicWind(before, thunk, after) {
+    before();
+    try {
+	var res = thunk();
+	return res;
+    } finally {
+	after();
+    }
+}
+
+
+// TODO: eval/scheme-report-environment/null-environment/interaction-environment
+
+// LIMITATION: 'load' doesn't exist without files.
+// LIMITATION: transcript-on/transcript-off doesn't exist without files.
+
+
+function sc_Struct(name) {
+    this.name = name;
+}
+sc_Struct.prototype.sc_toDisplayString = function() {
+    return "#<struct" + sc_hash(this) + ">";
+};
+sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString;
+
+/*** META ((export #t)
+           (peephole (hole 1 "new sc_Struct(" name ")")))
+*/
+function sc_makeStruct(name) {
+    return new sc_Struct(name);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix " instanceof sc_Struct")))
+*/
+function sc_isStruct(o) {
+    return (o instanceof sc_Struct);
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")")))
+*/
+function sc_isStructNamed(name, s) {
+    return ((s instanceof sc_Struct) && (s.name === name));
+}
+
+/*** META ((export struct-field)
+           (peephole (hole 3 0 "[" 2 "]")))
+*/
+function sc_getStructField(s, name, field) {
+    return s[field];
+}
+
+/*** META ((export struct-field-set!)
+           (peephole (hole 4 0 "[" 2 "] = " 3)))
+*/
+function sc_setStructFieldBang(s, name, field, val) {
+    s[field] = val;
+}
+
+/*** META ((export #t)
+           (peephole (prefix "~")))
+*/
+function sc_bitNot(x) {
+    return ~x;
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "&")))
+*/
+function sc_bitAnd(x, y) {
+    return x & y;
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "|")))
+*/
+function sc_bitOr(x, y) {
+    return x | y;
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "^")))
+*/
+function sc_bitXor(x, y) {
+    return x ^ y;
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 "<<")))
+*/
+function sc_bitLsh(x, y) {
+    return x << y;
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 ">>")))
+*/
+function sc_bitRsh(x, y) {
+    return x >> y;
+}
+
+/*** META ((export #t)
+           (peephole (infix 2 2 ">>>")))
+*/
+function sc_bitUrsh(x, y) {
+    return x >>> y;
+}
+
+/*** META ((export js-field js-property)
+           (peephole (hole 2 o "[" field "]")))
+*/
+function sc_jsField(o, field) {
+    return o[field];
+}
+
+/*** META ((export js-field-set! js-property-set!)
+           (peephole (hole 3 o "[" field "] = " val)))
+*/
+function sc_setJsFieldBang(o, field, val) {
+    return o[field] = val;
+}
+
+/*** META ((export js-field-delete! js-property-delete!)
+           (peephole (hole 2 "delete" o "[" field "]")))
+*/
+function sc_deleteJsFieldBang(o, field) {
+    delete o[field];
+}
+
+/*** META ((export #t)
+           (peephole (jsCall)))
+*/
+function sc_jsCall(o, fun) {
+    var args = new Array();
+    for (var i = 2; i < arguments.length; i++)
+	args[i-2] = arguments[i];
+    return fun.apply(o, args);
+}
+
+/*** META ((export #t)
+           (peephole (jsMethodCall)))
+*/
+function sc_jsMethodCall(o, field) {
+    var args = new Array();
+    for (var i = 2; i < arguments.length; i++)
+	args[i-2] = arguments[i];
+    return o[field].apply(o, args);
+}
+
+/*** META ((export new js-new)
+           (peephole (jsNew)))
+*/
+function sc_jsNew(c) {
+    var evalStr = "new c(";
+    evalStr +=arguments.length > 1? "arguments[1]": "";
+    for (var i = 2; i < arguments.length; i++)
+	evalStr += ", arguments[" + i + "]";
+    evalStr +=")";
+    return eval(evalStr);
+}    
+
+// ======================== RegExp ====================
+/*** META ((export #t)) */
+function sc_pregexp(re) {
+    return new RegExp(sc_string2jsstring(re));
+}
+
+/*** META ((export #t)) */
+function sc_pregexpMatch(re, s) {
+    var reg = (re instanceof RegExp) ? re : sc_pregexp(re);
+    var tmp = reg.exec(sc_string2jsstring(s));
+    
+    if (tmp == null) return false;
+    
+    var res = null;
+    for (var i = tmp.length-1; i >= 0; i--) {
+	if (tmp[i] !== null) {
+	    res = sc_cons(sc_jsstring2string(tmp[i]), res);
+	} else {
+	    res = sc_cons(false, res);
+	}
+    }
+    return res;
+}
+   
+/*** META ((export #t)) */
+function sc_pregexpReplace(re, s1, s2) {
+   var reg;
+   var jss1 = sc_string2jsstring(s1);
+   var jss2 = sc_string2jsstring(s2);
+
+   if (re instanceof RegExp) {
+       if (re.global)
+	   reg = re;
+       else
+	   reg = new RegExp(re.source);
+   } else {
+       reg = new RegExp(sc_string2jsstring(re));
+   }
+
+   return jss1.replace(reg, jss2);
+}
+   
+/*** META ((export pregexp-replace*)) */
+function sc_pregexpReplaceAll(re, s1, s2) {
+   var reg;
+   var jss1 = sc_string2jsstring(s1);
+   var jss2 = sc_string2jsstring(s2);
+
+   if (re instanceof RegExp) {
+      if (re.global)
+	  reg = re;
+      else
+	  reg = new RegExp(re.source, "g");
+   } else {
+       reg = new RegExp(sc_string2jsstring(re), "g");
+   }
+
+   return jss1.replace(reg, jss2);
+}
+
+/*** META ((export #t)) */
+function sc_pregexpSplit(re, s) {
+   var reg = ((re instanceof RegExp) ?
+	      re :
+	      new RegExp(sc_string2jsstring(re)));
+   var jss = sc_string2jsstring(s);
+   var tmp = jss.split(reg);
+
+   if (tmp == null) return false;
+
+   return sc_vector2list(tmp);
+}
+   
+
+/* =========================================================================== */
+/* Other library stuff */
+/* =========================================================================== */
+
+/*** META ((export #t)
+           (peephole (hole 1 "Math.floor(Math.random()*" 'n ")")))
+*/
+function sc_random(n) {
+    return Math.floor(Math.random()*n);
+}
+
+/*** META ((export current-date)
+           (peephole (hole 0 "new Date()")))
+*/
+function sc_currentDate() {
+   return new Date();
+}
+
+function sc_Hashtable() {
+}
+sc_Hashtable.prototype.toString = function() {
+    return "#{%hashtable}";
+};
+// sc_toWriteString == sc_toDisplayString == toString
+
+function sc_HashtableElement(key, val) {
+    this.key = key;
+    this.val = val;
+}
+
+/*** META ((export #t)
+           (peephole (hole 0 "new sc_Hashtable()")))
+*/
+function sc_makeHashtable() {
+    return new sc_Hashtable();
+}
+
+/*** META ((export #t)) */
+function sc_hashtablePutBang(ht, key, val) {
+    var hash = sc_hash(key);
+    ht[hash] = new sc_HashtableElement(key, val);
+}
+
+/*** META ((export #t)) */
+function sc_hashtableGet(ht, key) {
+    var hash = sc_hash(key);
+    if (hash in ht)
+	return ht[hash].val;
+    else
+	return false;
+}
+
+/*** META ((export #t)) */
+function sc_hashtableForEach(ht, f) {
+    for (var v in ht) {
+	if (ht[v] instanceof sc_HashtableElement)
+	    f(ht[v].key, ht[v].val);
+    }
+}
+
+/*** META ((export hashtable-contains?)
+           (peephole (hole 2 "sc_hash(" 1 ") in " 0)))
+*/
+function sc_hashtableContains(ht, key) {
+    var hash = sc_hash(key);
+    if (hash in ht)
+	return true;
+    else
+	return false;
+}
+
+var SC_HASH_COUNTER = 0;
+
+function sc_hash(o) {
+    if (o === null)
+	return "null";
+    else if (o === undefined)
+	return "undefined";
+    else if (o === true)
+	return "true";
+    else if (o === false)
+	return "false";
+    else if (typeof o === "number")
+	return "num-" + o;
+    else if (typeof o === "string")
+	return "jsstr-" + o;
+    else if (o.sc_getHash)
+	return o.sc_getHash();
+    else
+	return sc_counterHash.call(o);
+}
+function sc_counterHash() {
+    if (!this.sc_hash) {
+	this.sc_hash = "hash-" + SC_HASH_COUNTER;
+	SC_HASH_COUNTER++;
+    }
+    return this.sc_hash;
+}
+
+function sc_Trampoline(args, maxTailCalls) {
+    this['__trampoline return__'] = true;
+    this.args = args;
+    this.MAX_TAIL_CALLs = maxTailCalls;
+}
+// TODO: call/cc stuff
+sc_Trampoline.prototype.restart = function() {
+    var o = this;
+    while (true) {
+	// set both globals.
+	SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1;
+	var fun = o.args.callee;
+	var res = fun.apply(SC_TAIL_OBJECT, o.args);
+	if (res instanceof sc_Trampoline)
+	    o = res;
+	else
+	    return res;
+    }
+}
+
+/*** META ((export bind-exit-lambda)) */
+function sc_bindExitLambda(proc) {
+    var escape_obj = new sc_BindExitException();
+    var escape = function(res) {
+	escape_obj.res = res;
+	throw escape_obj;
+    };
+    try {
+	return proc(escape);
+    } catch(e) {
+	if (e === escape_obj) {
+	    return e.res;
+	}
+	throw e;
+    }
+}
+function sc_BindExitException() {
+    this._internalException = true;
+}
+
+var SC_SCM2JS_GLOBALS = new Object();
+
+// default tail-call depth.
+// normally the program should set it again. but just in case...
+var SC_TAIL_OBJECT = new Object();
+SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT;
+// ======================== I/O =======================
+
+/*------------------------------------------------------------------*/
+
+function sc_EOF() {
+}
+var SC_EOF_OBJECT = new sc_EOF();
+
+function sc_Port() {
+}
+
+/* --------------- Input ports -------------------------------------*/
+
+function sc_InputPort() {
+}
+sc_InputPort.prototype = new sc_Port();
+
+sc_InputPort.prototype.peekChar = function() {
+    if (!("peeked" in this))
+	this.peeked = this.getNextChar();
+    return this.peeked;
+}
+sc_InputPort.prototype.readChar = function() {
+    var tmp = this.peekChar();
+    delete this.peeked;
+    return tmp;
+}
+sc_InputPort.prototype.isCharReady = function() {
+    return true;
+}
+sc_InputPort.prototype.close = function() {
+    // do nothing
+}
+
+/* .............. String port ..........................*/
+function sc_ErrorInputPort() {
+};
+sc_ErrorInputPort.prototype = new sc_InputPort();
+sc_ErrorInputPort.prototype.getNextChar = function() {
+    throw "can't read from error-port.";
+};
+sc_ErrorInputPort.prototype.isCharReady = function() {
+    return false;
+};
+    
+
+/* .............. String port ..........................*/
+
+function sc_StringInputPort(jsStr) {
+    // we are going to do some charAts on the str.
+    // instead of recreating all the time a String-object, we
+    // create one in the beginning. (not sure, if this is really an optim)
+    this.str = new String(jsStr);
+    this.pos = 0;
+}
+sc_StringInputPort.prototype = new sc_InputPort();
+sc_StringInputPort.prototype.getNextChar = function() {
+    if (this.pos >= this.str.length)
+	return SC_EOF_OBJECT;
+    return this.str.charAt(this.pos++);
+};
+
+/* ------------- Read and other lib-funs  -------------------------------*/
+function sc_Token(type, val, pos) {
+    this.type = type;
+    this.val = val;
+    this.pos = pos;
+}
+sc_Token.EOF = 0/*EOF*/;
+sc_Token.OPEN_PAR = 1/*OPEN_PAR*/;
+sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/;
+sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/;
+sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/;
+sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/;
+sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/;
+sc_Token.WHITESPACE = 7/*WHITESPACE*/;
+sc_Token.QUOTE = 8/*QUOTE*/;
+sc_Token.ID = 9/*ID*/;
+sc_Token.DOT = 10/*DOT*/;
+sc_Token.STRING = 11/*STRING*/;
+sc_Token.NUMBER = 12/*NUMBER*/;
+sc_Token.ERROR = 13/*ERROR*/;
+sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/;
+sc_Token.TRUE = 15/*TRUE*/;
+sc_Token.FALSE = 16/*FALSE*/;
+sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/;
+sc_Token.REFERENCE = 18/*REFERENCE*/;
+sc_Token.STORE = 19/*STORE*/;
+sc_Token.CHAR = 20/*CHAR*/;
+
+var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~";
+function sc_Tokenizer(port) {
+    this.port = port;
+}
+sc_Tokenizer.prototype.peekToken = function() {
+    if (this.peeked)
+	return this.peeked;
+    var newToken = this.nextToken();
+    this.peeked = newToken;
+    return newToken;
+};
+sc_Tokenizer.prototype.readToken = function() {
+    var tmp = this.peekToken();
+    delete this.peeked;
+    return tmp;
+};
+sc_Tokenizer.prototype.nextToken = function() {
+    var port = this.port;
+    
+    function isNumberChar(c) {
+	return (c >= "0" && c <= "9");
+    };
+    function isIdOrNumberChar(c) {
+	return SC_ID_CLASS.indexOf(c) != -1 || // ID-char
+	    (c >= "0" && c <= "9");
+    }
+    function isWhitespace(c) {
+	return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f";
+    };
+    function isWhitespaceOrEOF(c) {
+	return isWhitespace(c) || c === SC_EOF_OBJECT;
+    };
+
+    function readString() {
+	res = "";
+	while (true) {
+	    var c = port.readChar();
+	    switch (c) {
+	    case '"':
+		return new sc_Token(11/*STRING*/, res);
+	    case "\\":
+		var tmp = port.readChar();
+		switch (tmp) {
+		case '0': res += "\0"; break;
+		case 'a': res += "\a"; break;
+		case 'b': res += "\b"; break;
+		case 'f': res += "\f"; break;
+		case 'n': res += "\n"; break;
+		case 'r': res += "\r"; break;
+		case 't': res += "\t"; break;
+		case 'v': res += "\v"; break;
+		case '"': res += '"'; break;
+		case '\\': res += '\\'; break;
+		case 'x':
+		    /* hexa-number */
+		    var nb = 0;
+		    while (true) {
+			var hexC = port.peekChar();
+			if (hexC >= '0' && hexC <= '9') {
+			    port.readChar();
+			    nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0);
+			} else if (hexC >= 'a' && hexC <= 'f') {
+			    port.readChar();
+			    nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0);
+			} else if (hexC >= 'A' && hexC <= 'F') {
+			    port.readChar();
+			    nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0);
+			} else {
+			    // next char isn't part of hex.
+			    res += String.fromCharCode(nb);
+			    break;
+			}
+		    }
+		    break;
+		default:
+		    if (tmp === SC_EOF_OBJECT) {
+			return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res);
+		    }
+		    res += tmp;
+		}
+		break;
+	    default:
+		if (c === SC_EOF_OBJECT) {
+		    return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res);
+		}
+		res += c;
+	    }
+	}
+    };
+    function readIdOrNumber(firstChar) {
+	var res = firstChar;
+	while (isIdOrNumberChar(port.peekChar()))
+	    res += port.readChar();
+	if (isNaN(res))
+	    return new sc_Token(9/*ID*/, res);
+	else
+	    return new sc_Token(12/*NUMBER*/, res - 0);
+    };
+    
+    function skipWhitespaceAndComments() {
+	var done = false;
+	while (!done) {
+	    done = true;
+	    while (isWhitespace(port.peekChar()))
+		port.readChar();
+	    if (port.peekChar() === ';') {
+		port.readChar();
+		done = false;
+		while (true) {
+		    curChar = port.readChar();
+		    if (curChar === SC_EOF_OBJECT ||
+			curChar === '\n')
+			break;
+		}
+	    }
+	}
+    };
+    
+    function readDot() {
+	if (isWhitespace(port.peekChar()))
+	    return new sc_Token(10/*DOT*/);
+	else
+	    return readIdOrNumber(".");
+    };
+
+    function readSharp() {
+	var c = port.readChar();
+	if (isWhitespace(c))
+	    return new sc_Token(13/*ERROR*/, "bad #-pattern0.");
+
+	// reference
+	if (isNumberChar(c)) {
+	    var nb = c - 0;
+	    while (isNumberChar(port.peekChar()))
+		nb = nb*10 + (port.readChar() - 0);
+	    switch (port.readChar()) {
+	    case '#':
+		return new sc_Token(18/*REFERENCE*/, nb);
+	    case '=':
+		return new sc_Token(19/*STORE*/, nb);
+	    default:
+		return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb);
+	    }
+	}
+
+	if (c === "(")
+	    return new sc_Token(14/*VECTOR_BEGIN*/);
+	
+	if (c === "\\") { // character
+	    var tmp = ""
+	    while (!isWhitespaceOrEOF(port.peekChar()))
+		tmp += port.readChar();
+	    switch (tmp.length) {
+	    case 0: // it's escaping a whitespace char:
+		if (sc_isEOFObject(port.peekChar))
+		    return new sc_Token(13/*ERROR*/, "bad #-pattern2.");
+		else
+		    return new sc_Token(20/*CHAR*/, port.readChar());
+	    case 1:
+		return new sc_Token(20/*CHAR*/, tmp);
+	    default:
+		var entry = sc_Char.readable2char[tmp.toLowerCase()];
+		if (entry)
+		    return new sc_Token(20/*CHAR*/, entry);
+		else
+		    return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp);
+	    }
+	}
+
+	// some constants (#t, #f, #unspecified)
+	var res;
+	var needing;
+	switch (c) {
+	case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break;
+	case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break;
+	case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break;
+	default:
+	    return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c);
+	}
+	while(true) {
+	    c = port.peekChar();
+	    if ((isWhitespaceOrEOF(c) || c === ')') &&
+		needing == "")
+		return res;
+	    else if (isWhitespace(c) || needing == "")
+		return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing);
+	    else if (needing.charAt(0) == c) {
+		port.readChar(); // consume
+		needing = needing.slice(1);
+	    } else
+		return new sc_Token(13/*ERROR*/, "bad #-pattern5");
+	}
+	
+    };
+
+    skipWhitespaceAndComments();
+    var curChar = port.readChar();
+    if (curChar === SC_EOF_OBJECT)
+	return new sc_Token(0/*EOF*/, curChar);
+    switch (curChar)
+    {
+    case " ":
+    case "\n":
+    case "\t":
+	return readWhitespace();
+    case "(":
+	return new sc_Token(1/*OPEN_PAR*/);
+    case ")":
+	return new sc_Token(2/*CLOSE_PAR*/);
+    case "{":
+	return new sc_Token(3/*OPEN_BRACE*/);
+    case "}":
+	return new sc_Token(4/*CLOSE_BRACE*/);
+    case "[":
+	return new sc_Token(5/*OPEN_BRACKET*/);
+    case "]":
+	return new sc_Token(6/*CLOSE_BRACKET*/);
+    case "'":
+	return new sc_Token(8/*QUOTE*/);
+    case "#":
+	return readSharp();
+    case ".":
+	return readDot();
+    case '"':
+	return readString();
+    default:
+	if (isIdOrNumberChar(curChar))
+	    return readIdOrNumber(curChar);
+	throw "unexpected character: " + curChar;
+    }
+};
+
+function sc_Reader(tokenizer) {
+    this.tokenizer = tokenizer;
+    this.backref = new Array();
+}
+sc_Reader.prototype.read = function() {
+    function readList(listBeginType) {
+	function matchesPeer(open, close) {
+	    return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/
+	    	|| open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/
+		|| open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/;
+	};
+	var res = null;
+
+	while (true) {
+	    var token = tokenizer.peekToken();
+	    
+	    switch (token.type) {
+	    case 2/*CLOSE_PAR*/:
+	    case 4/*CLOSE_BRACE*/:
+	    case 6/*CLOSE_BRACKET*/:
+		if (matchesPeer(listBeginType, token.type)) {
+		    tokenizer.readToken(); // consume token
+		    return sc_reverseBang(res);
+		} else
+		    throw "closing par doesn't match: " + listBeginType
+			+ " " + listEndType;
+
+	    case 0/*EOF*/:
+		throw "unexpected end of file";
+
+	    case 10/*DOT*/:
+		tokenizer.readToken(); // consume token
+		var cdr = this.read();
+		var par = tokenizer.readToken();
+		if (!matchesPeer(listBeginType, par.type))
+		    throw "closing par doesn't match: " + listBeginType
+			+ " " + par.type;
+		else
+		    return sc_reverseAppendBang(res, cdr);
+		
+
+	    default:
+		res = sc_cons(this.read(), res);
+	    }
+	}
+    };
+    function readQuote() {
+	return sc_cons("quote", sc_cons(this.read(), null));
+    };
+    function readVector() {
+	// opening-parenthesis is already consumed
+	var a = new Array();
+	while (true) {
+	    var token = tokenizer.peekToken();
+	    switch (token.type) {
+	    case 2/*CLOSE_PAR*/:
+		tokenizer.readToken();
+		return a;
+		
+	    default:
+		a.push(this.read());
+	    }
+	}
+    };
+
+    function storeRefence(nb) {
+	var tmp = this.read();
+	this.backref[nb] = tmp;
+	return tmp;
+    };
+	
+    function readReference(nb) {
+	if (nb in this.backref)
+	    return this.backref[nb];
+	else
+	    throw "bad reference: " + nb;
+    };
+    
+    var tokenizer = this.tokenizer;
+
+    var token = tokenizer.readToken();
+
+    // handle error
+    if (token.type === 13/*ERROR*/)
+	throw token.val;
+    
+    switch (token.type) {
+    case 1/*OPEN_PAR*/:
+    case 3/*OPEN_BRACE*/:
+    case 5/*OPEN_BRACKET*/:
+	return readList.call(this, token.type);
+    case 8/*QUOTE*/:
+	return readQuote.call(this);
+    case 11/*STRING*/:
+	return sc_jsstring2string(token.val);
+    case 20/*CHAR*/:
+	return new sc_Char(token.val);
+    case 14/*VECTOR_BEGIN*/:
+	return readVector.call(this);
+    case 18/*REFERENCE*/:
+	return readReference.call(this, token.val);
+    case 19/*STORE*/:
+	return storeRefence.call(this, token.val);
+    case 9/*ID*/:
+	return sc_jsstring2symbol(token.val);
+    case 0/*EOF*/:
+    case 12/*NUMBER*/:
+    case 15/*TRUE*/:
+    case 16/*FALSE*/:
+    case 17/*UNSPECIFIED*/:
+	return token.val;
+    default:
+	throw "unexpected token " + token.type + " " + token.val;
+    }
+};
+
+/*** META ((export #t)) */
+function sc_read(port) {
+    if (port === undefined) // we assume the port hasn't been given.
+	port = SC_DEFAULT_IN; // THREAD: shared var...
+    var reader = new sc_Reader(new sc_Tokenizer(port));
+    return reader.read();
+}
+/*** META ((export #t)) */
+function sc_readChar(port) {
+    if (port === undefined) // we assume the port hasn't been given.
+	port = SC_DEFAULT_IN; // THREAD: shared var...
+    var t = port.readChar();
+    return t === SC_EOF_OBJECT? t: new sc_Char(t);
+}
+/*** META ((export #t)) */
+function sc_peekChar(port) {
+    if (port === undefined) // we assume the port hasn't been given.
+	port = SC_DEFAULT_IN; // THREAD: shared var...
+    var t = port.peekChar();
+    return t === SC_EOF_OBJECT? t: new sc_Char(t);
+}    
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isCharReady(port) {
+    if (port === undefined) // we assume the port hasn't been given.
+	port = SC_DEFAULT_IN; // THREAD: shared var...
+    return port.isCharReady();
+}
+/*** META ((export #t)
+           (peephole (postfix ".close()")))
+*/
+function sc_closeInputPort(p) {
+    return p.close();
+}
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix " instanceof sc_InputPort")))
+*/
+function sc_isInputPort(o) {
+    return (o instanceof sc_InputPort);
+}
+
+/*** META ((export eof-object?)
+           (type bool)
+           (peephole (postfix " === SC_EOF_OBJECT")))
+*/
+function sc_isEOFObject(o) {
+    return o === SC_EOF_OBJECT;
+}
+
+/*** META ((export #t)
+           (peephole (hole 0 "SC_DEFAULT_IN")))
+*/
+function sc_currentInputPort() {
+    return SC_DEFAULT_IN;
+}
+
+/* ------------ file operations are not supported -----------*/
+/*** META ((export #t)) */
+function sc_callWithInputFile(s, proc) {
+    throw "can't open " + s;
+}
+
+/*** META ((export #t)) */
+function sc_callWithOutputFile(s, proc) {
+    throw "can't open " + s;
+}
+
+/*** META ((export #t)) */
+function sc_withInputFromFile(s, thunk) {
+    throw "can't open " + s;
+}
+
+/*** META ((export #t)) */
+function sc_withOutputToFile(s, thunk) {
+    throw "can't open " + s;
+}
+
+/*** META ((export #t)) */
+function sc_openInputFile(s) {
+    throw "can't open " + s;
+}
+
+/*** META ((export #t)) */
+function sc_openOutputFile(s) {
+    throw "can't open " + s;
+}
+
+/* ----------------------------------------------------------------------------*/
+/*** META ((export #t)) */
+function sc_basename(p) {
+   var i = p.lastIndexOf('/');
+
+   if(i >= 0)
+      return p.substring(i + 1, p.length);
+   else
+      return '';
+}
+
+/*** META ((export #t)) */
+function sc_dirname(p) {
+   var i = p.lastIndexOf('/');
+
+   if(i >= 0)
+      return p.substring(0, i);
+   else
+      return '';
+}
+
+/* ----------------------------------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_withInputFromPort(p, thunk) {
+    try {
+	var tmp = SC_DEFAULT_IN; // THREAD: shared var.
+	SC_DEFAULT_IN = p;
+	return thunk();
+    } finally {
+	SC_DEFAULT_IN = tmp;
+    }
+}
+
+/*** META ((export #t)) */
+function sc_withInputFromString(s, thunk) {
+    return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk);
+}
+
+/*** META ((export #t)) */
+function sc_withOutputToPort(p, thunk) {
+    try {
+	var tmp = SC_DEFAULT_OUT; // THREAD: shared var.
+	SC_DEFAULT_OUT = p;
+	return thunk();
+    } finally {
+	SC_DEFAULT_OUT = tmp;
+    }
+}
+
+/*** META ((export #t)) */
+function sc_withOutputToString(thunk) {
+    var p = new sc_StringOutputPort();
+    sc_withOutputToPort(p, thunk);
+    return p.close();
+}
+
+/*** META ((export #t)) */
+function sc_withOutputToProcedure(proc, thunk) {
+    var t = function(s) { proc(sc_jsstring2string(s)); };
+    return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk);
+}
+
+/*** META ((export #t)
+           (peephole (hole 0 "new sc_StringOutputPort()")))
+*/
+function sc_openOutputString() {
+    return new sc_StringOutputPort();
+}
+
+/*** META ((export #t)) */
+function sc_openInputString(str) {
+    return new sc_StringInputPort(sc_string2jsstring(str));
+}
+
+/* ----------------------------------------------------------------------------*/
+
+function sc_OutputPort() {
+}
+sc_OutputPort.prototype = new sc_Port();
+sc_OutputPort.prototype.appendJSString = function(obj) {
+    /* do nothing */
+}
+sc_OutputPort.prototype.close = function() {
+    /* do nothing */
+}
+
+function sc_StringOutputPort() {
+    this.res = "";
+}
+sc_StringOutputPort.prototype = new sc_OutputPort();
+sc_StringOutputPort.prototype.appendJSString = function(s) {
+    this.res += s;
+}
+sc_StringOutputPort.prototype.close = function() {
+    return sc_jsstring2string(this.res);
+}
+
+/*** META ((export #t)) */
+function sc_getOutputString(sp) {
+    return sc_jsstring2string(sp.res);
+}
+    
+
+function sc_ErrorOutputPort() {
+}
+sc_ErrorOutputPort.prototype = new sc_OutputPort();
+sc_ErrorOutputPort.prototype.appendJSString = function(s) {
+    throw "don't write on ErrorPort!";
+}
+sc_ErrorOutputPort.prototype.close = function() {
+    /* do nothing */
+}
+
+function sc_GenericOutputPort(appendJSString, close) {
+    this.appendJSString = appendJSString;
+    if (close)
+	this.close = close;
+}
+sc_GenericOutputPort.prototype = new sc_OutputPort();
+
+/*** META ((export #t)
+           (type bool)
+           (peephole (postfix " instanceof sc_OutputPort")))
+*/
+function sc_isOutputPort(o) {
+    return (o instanceof sc_OutputPort);
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".close()")))
+*/
+function sc_closeOutputPort(p) {
+    return p.close();
+}
+
+/* ------------------ write ---------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_write(o, p) {
+    if (p === undefined) // we assume not given
+	p = SC_DEFAULT_OUT;
+    p.appendJSString(sc_toWriteString(o));
+}
+
+function sc_toWriteString(o) {
+    if (o === null)
+	return "()";
+    else if (o === true)
+	return "#t";
+    else if (o === false)
+	return "#f";
+    else if (o === undefined)
+	return "#unspecified";
+    else if (typeof o === 'function')
+	return "#<procedure " + sc_hash(o) + ">";
+    else if (o.sc_toWriteString)
+	return o.sc_toWriteString();
+    else
+	return o.toString();
+}
+
+function sc_escapeWriteString(s) {
+    var res = "";
+    var j = 0;
+    for (i = 0; i < s.length; i++) {
+	switch (s.charAt(i)) {
+	case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break;
+	case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break;
+	case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break;
+	case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break;
+	case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break;
+	case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break;
+	case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break;
+	case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break;
+	case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break;
+	default:
+	    var c = s.charAt(i);
+	    if ("\a" !== "a" && c == "\a") {
+		res += s.substring(j, i) + "\\a"; j = i + 1; continue;
+	    }
+	    if ("\v" !== "v" && c == "\v") {
+		res += s.substring(j, i) + "\\v"; j = i + 1; continue;
+	    }
+	    //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) {
+	    // CARE: Manuel is this OK with HOP?
+	    if (s.charAt(i) < ' ') {
+		/* non printable character and special chars */
+		res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16);
+		j = i + 1;
+	    }
+	    // else just let i increase...
+	}
+    }
+    res += s.substring(j, i);
+    return res;
+}
+
+/* ------------------ display ---------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_display(o, p) {
+    if (p === undefined) // we assume not given
+	p = SC_DEFAULT_OUT;
+    p.appendJSString(sc_toDisplayString(o));
+}
+
+function sc_toDisplayString(o) {
+    if (o === null)
+	return "()";
+    else if (o === true)
+	return "#t";
+    else if (o === false)
+	return "#f";
+    else if (o === undefined)
+	return "#unspecified";
+    else if (typeof o === 'function')
+	return "#<procedure " + sc_hash(o) + ">";
+    else if (o.sc_toDisplayString)
+	return o.sc_toDisplayString();
+    else
+	return o.toString();
+}
+
+/* ------------------ newline ---------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_newline(p) {
+    if (p === undefined) // we assume not given
+	p = SC_DEFAULT_OUT;
+    p.appendJSString("\n");
+}
+    
+/* ------------------ write-char ---------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_writeChar(c, p) {
+    if (p === undefined) // we assume not given
+	p = SC_DEFAULT_OUT;
+    p.appendJSString(c.val);
+}
+
+/* ------------------ write-circle ---------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_writeCircle(o, p) {
+    if (p === undefined) // we assume not given
+	p = SC_DEFAULT_OUT;
+    p.appendJSString(sc_toWriteCircleString(o));
+}
+
+function sc_toWriteCircleString(o) {
+    var symb = sc_gensym("writeCircle");
+    var nbPointer = new Object();
+    nbPointer.nb = 0;
+    sc_prepWriteCircle(o, symb, nbPointer);
+    return sc_genToWriteCircleString(o, symb);
+}
+
+function sc_prepWriteCircle(o, symb, nbPointer) {
+    // TODO sc_Struct
+    if (o instanceof sc_Pair ||
+	o instanceof sc_Vector) {
+	if (o[symb] !== undefined) {
+	    // not the first visit.
+	    o[symb]++;
+	    // unless there is already a number, assign one.
+	    if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++;
+	    return;
+	}
+	o[symb] = 0;
+	if (o instanceof sc_Pair) {
+	    sc_prepWriteCircle(o.car, symb, nbPointer);
+	    sc_prepWriteCircle(o.cdr, symb, nbPointer);
+	} else {
+	    for (var i = 0; i < o.length; i++)
+		sc_prepWriteCircle(o[i], symb, nbPointer);
+	}
+    }
+}
+
+function sc_genToWriteCircleString(o, symb) {
+    if (!(o instanceof sc_Pair ||
+	  o instanceof sc_Vector))
+	return sc_toWriteString(o);
+    return o.sc_toWriteCircleString(symb);
+}
+sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) {
+    if (this[symb + "use"]) { // use-flag is set. Just use it.
+	var nb = this[symb + "nb"];
+	if (this[symb]-- === 0) { // if we are the last use. remove all fields.
+	    delete this[symb];
+	    delete this[symb + "nb"];
+	    delete this[symb + "use"];
+	}
+	if (inList)
+	    return '. #' + nb + '#';
+	else
+	    return '#' + nb + '#';
+    }
+    if (this[symb]-- === 0) { // if we are the last use. remove all fields.
+	delete this[symb];
+	delete this[symb + "nb"];
+	delete this[symb + "use"];
+    }
+
+    var res = "";
+    
+    if (this[symb] !== undefined) { // implies > 0
+	this[symb + "use"] = true;
+	if (inList)
+	    res += '. #' + this[symb + "nb"] + '=';
+	else
+	    res += '#' + this[symb + "nb"] + '=';
+	inList = false;
+    }
+
+    if (!inList)
+	res += "(";
+    
+    // print car
+    res += sc_genToWriteCircleString(this.car, symb);
+    
+    if (sc_isPair(this.cdr)) {
+	res += " " + this.cdr.sc_toWriteCircleString(symb, true);
+    } else if (this.cdr !== null) {
+	res += " . " + sc_genToWriteCircleString(this.cdr, symb);
+    }
+    if (!inList)
+	res += ")";
+    return res;
+};
+sc_Vector.prototype.sc_toWriteCircleString = function(symb) {
+    if (this[symb + "use"]) { // use-flag is set. Just use it.
+	var nb = this[symb + "nb"];
+	if (this[symb]-- === 0) { // if we are the last use. remove all fields.
+	    delete this[symb];
+	    delete this[symb + "nb"];
+	    delete this[symb + "use"];
+	}
+	return '#' + nb + '#';
+    }
+    if (this[symb]-- === 0) { // if we are the last use. remove all fields.
+	delete this[symb];
+	delete this[symb + "nb"];
+	delete this[symb + "use"];
+    }
+
+    var res = "";
+    if (this[symb] !== undefined) { // implies > 0
+	this[symb + "use"] = true;
+	res += '#' + this[symb + "nb"] + '=';
+    }
+    res += "#(";
+    for (var i = 0; i < this.length; i++) {
+	res += sc_genToWriteCircleString(this[i], symb);
+	if (i < this.length - 1) res += " ";
+    }
+    res += ")";
+    return res;
+};
+
+
+/* ------------------ print ---------------------------------------------------*/
+
+/*** META ((export #t)) */
+function sc_print(s) {
+    if (arguments.length === 1) {
+	sc_display(s);
+	sc_newline();
+    }
+    else {
+	for (var i = 0; i < arguments.length; i++)
+	    sc_display(arguments[i]);
+	sc_newline();
+    }
+}
+
+/* ------------------ format ---------------------------------------------------*/
+/*** META ((export #t)) */
+function sc_format(s, args) {
+   var len = s.length;
+   var p = new sc_StringOutputPort();
+   var i = 0, j = 1;
+
+   while( i < len ) {
+      var i2 = s.indexOf("~", i);
+
+      if (i2 == -1) {
+	  p.appendJSString( s.substring( i, len ) );
+	  return p.close();
+      } else {
+	 if (i2 > i) {
+	    if (i2 == (len - 1)) {
+		p.appendJSString(s.substring(i, len));
+		return p.close();
+	    } else {
+	       p.appendJSString(s.substring(i, i2));
+	       i = i2;
+	    }
+	 }
+
+	 switch(s.charCodeAt(i2 + 1)) {
+	    case 65:
+	    case 97:
+	       // a
+	       sc_display(arguments[j], p);
+	       i += 2; j++;
+	       break;
+
+	    case 83:
+	    case 115:
+	       // s
+	       sc_write(arguments[j], p);
+	       i += 2; j++;
+	       break;
+
+	    case 86:
+	    case 118:
+	       // v
+	       sc_display(arguments[j], p);
+	       p.appendJSString("\n");
+	       i += 2; j++;
+	       break;
+
+	    case 67:
+	    case 99:
+	       // c
+	       p.appendJSString(String.fromCharCode(arguments[j]));
+	       i += 2; j++;
+	       break;
+
+	    case 88:
+	    case 120:
+	       // x
+	       p.appendJSString(arguments[j].toString(6));
+	       i += 2; j++;
+	       break;
+
+	    case 79:
+	    case 111:
+	       // o
+	       p.appendJSString(arguments[j].toString(8));
+	       i += 2; j++;
+	       break;
+
+	    case 66:
+	    case 98:
+	       // b
+	       p.appendJSString(arguments[j].toString(2));
+	       i += 2; j++;
+	       break;
+	       
+	    case 37:
+	    case 110:
+	       // %, n
+	       p.appendJSString("\n");
+	       i += 2; break;
+
+	    case 114:
+	       // r
+	       p.appendJSString("\r");
+	       i += 2; break;
+
+	    case 126:
+	       // ~
+	       p.appendJSString("~");
+	       i += 2; break;
+
+	    default:
+	       sc_error( "format: illegal ~"
+			 + String.fromCharCode(s.charCodeAt(i2 + 1))
+			 + " sequence" );
+	       return "";
+	 }
+      }
+   }
+
+   return p.close();
+}
+
+/* ------------------ global ports ---------------------------------------------------*/
+
+var SC_DEFAULT_IN = new sc_ErrorInputPort();
+var SC_DEFAULT_OUT = new sc_ErrorOutputPort();
+var SC_ERROR_OUT = new sc_ErrorOutputPort();
+
+var sc_SYMBOL_PREFIX = "\u1E9C";
+var sc_KEYWORD_PREFIX = "\u1E9D";
+
+/*** META ((export #t)
+           (peephole (id))) */
+function sc_jsstring2string(s) {
+    return s;
+}
+
+/*** META ((export #t)
+           (peephole (prefix "'\\u1E9C' +")))
+*/
+function sc_jsstring2symbol(s) {
+    return sc_SYMBOL_PREFIX + s;
+}
+
+/*** META ((export #t)
+           (peephole (id)))
+*/
+function sc_string2jsstring(s) {
+    return s;
+}
+
+/*** META ((export #t)
+           (peephole (symbol2jsstring_immutable)))
+*/
+function sc_symbol2jsstring(s) {
+    return s.slice(1);
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".slice(1)")))
+*/
+function sc_keyword2jsstring(k) {
+    return k.slice(1);
+}
+
+/*** META ((export #t)
+           (peephole (prefix "'\\u1E9D' +")))
+*/
+function sc_jsstring2keyword(s) {
+    return sc_KEYWORD_PREFIX + s;
+}
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isKeyword(s) {
+    return (typeof s === "string") &&
+	(s.charAt(0) === sc_KEYWORD_PREFIX);
+}
+
+
+/*** META ((export #t)) */
+var sc_gensym = function() {
+    var counter = 1000;
+    return function(sym) {
+	counter++;
+	if (!sym) sym = sc_SYMBOL_PREFIX;
+	return sym + "s" + counter + "~" + "^sC-GeNsYm ";
+    };
+}();
+
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isEqual(o1, o2) {
+    return ((o1 === o2) ||
+	    (sc_isPair(o1) && sc_isPair(o2)
+	     && sc_isPairEqual(o1, o2, sc_isEqual)) ||
+	    (sc_isVector(o1) && sc_isVector(o2)
+	     && sc_isVectorEqual(o1, o2, sc_isEqual)));
+}
+
+/*** META ((export number->symbol integer->symbol)) */
+function sc_number2symbol(x, radix) {
+    return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix);
+}
+    
+/*** META ((export number->string integer->string)) */
+var sc_number2string = sc_number2jsstring;
+
+/*** META ((export #t)) */
+function sc_symbol2number(s, radix) {
+    return sc_jsstring2number(s.slice(1), radix);
+}
+
+/*** META ((export #t)) */
+var sc_string2number = sc_jsstring2number;
+
+/*** META ((export #t)
+           (peephole (prefix "+" s)))
+           ;; peephole will only apply if no radix is given.
+*/
+function sc_string2integer(s, radix) {
+    if (!radix) return +s;
+    return parseInt(s, radix);
+}
+
+/*** META ((export #t)
+           (peephole (prefix "+")))
+*/
+function sc_string2real(s) {
+    return +s;
+}
+
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isSymbol(s) {
+    return (typeof s === "string") &&
+	(s.charAt(0) === sc_SYMBOL_PREFIX);
+}
+
+/*** META ((export #t)
+           (peephole (symbol2string_immutable)))
+*/
+function sc_symbol2string(s) {
+    return s.slice(1);
+}
+
+/*** META ((export #t)
+           (peephole (prefix "'\\u1E9C' +")))
+*/
+function sc_string2symbol(s) {
+    return sc_SYMBOL_PREFIX + s;
+}
+
+/*** META ((export symbol-append)
+           (peephole (symbolAppend_immutable)))
+*/
+function sc_symbolAppend() {
+    var res = sc_SYMBOL_PREFIX;
+    for (var i = 0; i < arguments.length; i++)
+	res += arguments[i].slice(1);
+    return res;
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".val")))
+*/
+function sc_char2string(c) { return c.val; }
+
+/*** META ((export #t)
+           (peephole (hole 1 "'\\u1E9C' + " c ".val")))
+*/
+function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; }
+
+/*** META ((export #t)
+           (type bool))
+*/
+function sc_isString(s) {
+    return (typeof s === "string") &&
+	(s.charAt(0) !== sc_SYMBOL_PREFIX);
+}
+
+/*** META ((export #t)) */
+var sc_makeString = sc_makejsString;
+
+
+/*** META ((export #t)) */
+function sc_string() {
+    for (var i = 0; i < arguments.length; i++)
+	arguments[i] = arguments[i].val;
+    return "".concat.apply("", arguments);
+}
+
+/*** META ((export #t)
+           (peephole (postfix ".length")))
+*/
+function sc_stringLength(s) { return s.length; }
+
+/*** META ((export #t)) */
+function sc_stringRef(s, k) {
+    return new sc_Char(s.charAt(k));
+}
+
+/* there's no stringSet in the immutable version
+function sc_stringSet(s, k, c)
+*/
+
+
+/*** META ((export string=?)
+	   (type bool)
+           (peephole (hole 2 str1 " === " str2)))
+*/
+function sc_isStringEqual(s1, s2) {
+    return s1 === s2;
+}
+/*** META ((export string<?)
+	   (type bool)
+           (peephole (hole 2 str1 " < " str2)))
+*/
+function sc_isStringLess(s1, s2) {
+    return s1 < s2;
+}
+/*** META ((export string>?)
+	   (type bool)
+           (peephole (hole 2 str1 " > " str2)))
+*/
+function sc_isStringGreater(s1, s2) {
+    return s1 > s2;
+}
+/*** META ((export string<=?)
+	   (type bool)
+           (peephole (hole 2 str1 " <= " str2)))
+*/
+function sc_isStringLessEqual(s1, s2) {
+    return s1 <= s2;
+}
+/*** META ((export string>=?)
+	   (type bool)
+           (peephole (hole 2 str1 " >= " str2)))
+*/
+function sc_isStringGreaterEqual(s1, s2) {
+    return s1 >= s2;
+}
+/*** META ((export string-ci=?)
+	   (type bool)
+           (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()")))
+*/
+function sc_isStringCIEqual(s1, s2) {
+    return s1.toLowerCase() === s2.toLowerCase();
+}
+/*** META ((export string-ci<?)
+	   (type bool)
+           (peephole (hole 2 str1 ".toLowerCase() < " str2 ".toLowerCase()")))
+*/
+function sc_isStringCILess(s1, s2) {
+    return s1.toLowerCase() < s2.toLowerCase();
+}
+/*** META ((export string-ci>?)
+	   (type bool)
+           (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()")))
+*/
+function sc_isStringCIGreater(s1, s2) {
+    return s1.toLowerCase() > s2.toLowerCase();
+}
+/*** META ((export string-ci<=?)
+	   (type bool)
+           (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()")))
+*/
+function sc_isStringCILessEqual(s1, s2) {
+    return s1.toLowerCase() <= s2.toLowerCase();
+}
+/*** META ((export string-ci>=?)
+	   (type bool)
+           (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()")))
+*/
+function sc_isStringCIGreaterEqual(s1, s2) {
+    return s1.toLowerCase() >= s2.toLowerCase();
+}
+
+/*** META ((export #t)
+           (peephole (hole 3 s ".substring(" start ", " end ")")))
+*/
+function sc_substring(s, start, end) {
+    return s.substring(start, end);
+}
+
+/*** META ((export #t))
+*/
+function sc_isSubstring_at(s1, s2, i) {
+    return s2 == s1.substring(i, i+ s2.length);
+}
+
+/*** META ((export #t)
+           (peephole (infix 0 #f "+" "''")))
+*/
+function sc_stringAppend() {
+    return "".concat.apply("", arguments);
+}
+
+/*** META ((export #t)) */
+var sc_string2list = sc_jsstring2list;
+
+/*** META ((export #t)) */
+var sc_list2string = sc_list2jsstring;
+
+/*** META ((export #t)
+           (peephole (id)))
+*/
+function sc_stringCopy(s) {
+    return s;
+}
+
+/* there's no string-fill in the immutable version
+function sc_stringFill(s, c)
+*/
+
+/*** META ((export #t)
+           (peephole (postfix ".slice(1)")))
+*/
+function sc_keyword2string(o) {
+    return o.slice(1);
+}
+
+/*** META ((export #t)
+           (peephole (prefix "'\\u1E9D' +")))
+*/
+function sc_string2keyword(o) {
+    return sc_KEYWORD_PREFIX + o;
+}
+
+String.prototype.sc_toDisplayString = function() {
+    if (this.charAt(0) === sc_SYMBOL_PREFIX)
+	// TODO: care for symbols with spaces (escape-chars symbols).
+	return this.slice(1);
+    else if (this.charAt(0) === sc_KEYWORD_PREFIX)
+	return ":" + this.slice(1);
+    else
+	return this.toString();
+};
+
+String.prototype.sc_toWriteString = function() {
+    if (this.charAt(0) === sc_SYMBOL_PREFIX)
+	// TODO: care for symbols with spaces (escape-chars symbols).
+	return this.slice(1);
+    else if (this.charAt(0) === sc_KEYWORD_PREFIX)
+	return ":" + this.slice(1);
+    else
+	return '"' + sc_escapeWriteString(this) + '"';
+};
+/* Exported Variables */
+var BgL_testzd2boyerzd2;
+var BgL_nboyerzd2benchmarkzd2;
+var BgL_setupzd2boyerzd2;
+/* End Exports */
+
+var translate_term_nboyer;
+var translate_args_nboyer;
+var untranslate_term_nboyer;
+var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer;
+var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer;
+var translate_alist_nboyer;
+var apply_subst_nboyer;
+var apply_subst_lst_nboyer;
+var tautologyp_nboyer;
+var if_constructor_nboyer;
+var rewrite_count_nboyer;
+var rewrite_nboyer;
+var rewrite_args_nboyer;
+var unify_subst_nboyer;
+var one_way_unify1_nboyer;
+var false_term_nboyer;
+var true_term_nboyer;
+var trans_of_implies1_nboyer;
+var is_term_equal_nboyer;
+var is_term_member_nboyer;
+var const_nboyer;
+var sc_const_3_nboyer;
+var sc_const_4_nboyer;
+{
+    (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null)))))));
+    (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null))))))));
+    (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null)))))))))));
+    BgL_nboyerzd2benchmarkzd2 = function() {
+        var args = null;
+        for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) {
+            args = sc_cons(arguments[sc_tmp], args);
+        }
+        var n;
+        return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() {
+            return (BgL_testzd2boyerzd2(n));
+        }, function(rewrites) {
+            if ((sc_isNumber(rewrites)))
+                switch (n) {
+                case (0):
+                    return (rewrites===(95024));
+                    break;
+                case (1):
+                    return (rewrites===(591777));
+                    break;
+                case (2):
+                    return (rewrites===(1813975));
+                    break;
+                case (3):
+                    return (rewrites===(5375678));
+                    break;
+                case (4):
+                    return (rewrites===(16445406));
+                    break;
+                case (5):
+                    return (rewrites===(51507739));
+                    break;
+                default:
+                    return true;
+                    break;
+                }
+            else
+                return false;
+        })));
+    };
+    BgL_setupzd2boyerzd2 = function() {
+        return true;
+    };
+    BgL_testzd2boyerzd2 = function() {
+        return true;
+    };
+    translate_term_nboyer = function(term) {
+        var lst;
+        return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr))))))))));
+    };
+    translate_args_nboyer = function(lst) {
+        var sc_lst_5;
+        var term;
+        return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr))))))))));
+    };
+    untranslate_term_nboyer = function(term) {
+        var optrOpnd;
+        var tail1131;
+        var L1127;
+        var falseHead1130;
+        var symbol_record;
+        if (!(term instanceof sc_Pair))
+            return term;
+        else
+            {
+                (falseHead1130 = (new sc_Pair(null, null)));
+                (L1127 = (term.cdr));
+                (tail1131 = falseHead1130);
+                while (!(L1127 === null)) {
+                    {
+                        (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null)));
+                        (tail1131 = (tail1131.cdr));
+                        (L1127 = (L1127.cdr));
+                    }
+                }
+                (optrOpnd = (falseHead1130.cdr));
+                return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd));
+            }
+    };
+    BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) {
+        var r;
+        var x;
+        return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r)));
+    };
+    (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null);
+    translate_alist_nboyer = function(alist) {
+        var sc_alist_6;
+        var term;
+        return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr))))))))));
+    };
+    apply_subst_nboyer = function(alist, term) {
+        var lst;
+        var temp_temp;
+        return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr))))))))));
+    };
+    apply_subst_lst_nboyer = function(alist, lst) {
+        var sc_lst_7;
+        return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr))))))))));
+    };
+    tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) {
+        var tmp1125;
+        var x;
+        var tmp1126;
+        var sc_x_8;
+        var sc_tmp1125_9;
+        var sc_tmp1126_10;
+        var sc_x_11;
+        var true_lst;
+        var false_lst;
+        while (true) {
+            if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false))
+                return true;
+            else
+                if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false))
+                    return false;
+                else
+                    if (!(sc_x_11 instanceof sc_Pair))
+                        return false;
+                    else
+                        if (((sc_x_11.car)===if_constructor_nboyer))
+                            if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false))
+                                (sc_x_11 = (sc_x_11.cdr.cdr.car));
+                            else
+                                if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false))
+                                    (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car));
+                                else
+                                    if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false))
+                                        {
+                                            (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst)));
+                                            (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car));
+                                        }
+                                    else
+                                        return false;
+                        else
+                            return false;
+        }
+    };
+    (if_constructor_nboyer = "\u1E9C*");
+    (rewrite_count_nboyer = (0));
+    rewrite_nboyer = function(term) {
+        var term2;
+        var sc_term_12;
+        var lst;
+        var symbol_record;
+        var sc_lst_13;
+        {
+            (++rewrite_count_nboyer);
+            if (!(term instanceof sc_Pair))
+                return term;
+            else
+                {
+                    (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr))))))))));
+                    (lst = ((symbol_record = (term.car)), (symbol_record[(1)])));
+                    while (true) {
+                        if ((lst === null))
+                            return sc_term_12;
+                        else
+                            if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false))
+                                return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car)))));
+                            else
+                                (lst = (lst.cdr));
+                    }
+                }
+        }
+    };
+    rewrite_args_nboyer = function(lst) {
+        var sc_lst_14;
+        return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr))))))))));
+    };
+    (unify_subst_nboyer = "\u1E9C*");
+    one_way_unify1_nboyer = function(term1, term2) {
+        var lst1;
+        var lst2;
+        var temp_temp;
+        if (!(term2 instanceof sc_Pair))
+            {
+                (temp_temp = (sc_assq(term2, unify_subst_nboyer)));
+                if ((temp_temp!== false))
+                    return (is_term_equal_nboyer(term1, (temp_temp.cdr)));
+                else
+                    if ((sc_isNumber(term2)))
+                        return (sc_isEqual(term1, term2));
+                    else
+                        {
+                            (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer)));
+                            return true;
+                        }
+            }
+        else
+            if (!(term1 instanceof sc_Pair))
+                return false;
+            else
+                if (((term1.car)===(term2.car)))
+                    {
+                        (lst1 = (term1.cdr));
+                        (lst2 = (term2.cdr));
+                        while (true) {
+                            if ((lst1 === null))
+                                return (lst2 === null);
+                            else
+                                if ((lst2 === null))
+                                    return false;
+                                else
+                                    if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false))
+                                        {
+                                            (lst1 = (lst1.cdr));
+                                            (lst2 = (lst2.cdr));
+                                        }
+                                    else
+                                        return false;
+                        }
+                    }
+                else
+                    return false;
+    };
+    (false_term_nboyer = "\u1E9C*");
+    (true_term_nboyer = "\u1E9C*");
+    trans_of_implies1_nboyer = function(n) {
+        var sc_n_15;
+        return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1)))))))))));
+    };
+    is_term_equal_nboyer = function(x, y) {
+        var lst1;
+        var lst2;
+        var r2;
+        var r1;
+        if ((x instanceof sc_Pair))
+            if ((y instanceof sc_Pair))
+                if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false))
+                    {
+                        (lst1 = (x.cdr));
+                        (lst2 = (y.cdr));
+                        while (true) {
+                            if ((lst1 === null))
+                                return (lst2 === null);
+                            else
+                                if ((lst2 === null))
+                                    return false;
+                                else
+                                    if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false))
+                                        {
+                                            (lst1 = (lst1.cdr));
+                                            (lst2 = (lst2.cdr));
+                                        }
+                                    else
+                                        return false;
+                        }
+                    }
+                else
+                    return false;
+            else
+                return false;
+        else
+            return (sc_isEqual(x, y));
+    };
+    is_term_member_nboyer = function(x, lst) {
+        var x;
+        var lst;
+        while (true) {
+            if ((lst === null))
+                return false;
+            else
+                if (((is_term_equal_nboyer(x, (lst.car)))!== false))
+                    return true;
+                else
+                    (lst = (lst.cdr));
+        }
+    };
+    BgL_setupzd2boyerzd2 = function() {
+        var symbol_record;
+        var value;
+        var BgL_sc_symbolzd2record_16zd2;
+        var sym;
+        var sc_sym_17;
+        var term;
+        var lst;
+        var sc_term_18;
+        var sc_term_19;
+        {
+            (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null);
+            (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif")));
+            (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr))))))));
+            (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr))))))));
+            (lst = sc_const_3_nboyer);
+            while (!(lst === null)) {
+                {
+                    (term = (lst.car));
+                    if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair))))
+                        {
+                            (sc_sym_17 = ((term.cdr.car).car));
+                            (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)])))));
+                            (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17)));
+                            (symbol_record[(1)] = value);
+                        }
+                    else
+                        (sc_error("ADD-LEMMA did not like term:  ", term));
+                    (lst = (lst.cdr));
+                }
+            }
+            return true;
+        }
+    };
+    BgL_testzd2boyerzd2 = function(n) {
+        var optrOpnd;
+        var term;
+        var sc_n_20;
+        var answer;
+        var sc_term_21;
+        var sc_term_22;
+        {
+            (rewrite_count_nboyer = (0));
+            (term = sc_const_4_nboyer);
+            (sc_n_20 = n);
+            while (!(sc_n_20=== 0)) {
+                {
+                    (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null)))));
+                    (--sc_n_20);
+                }
+            }
+            (sc_term_22 = term);
+            if (!(sc_term_22 instanceof sc_Pair))
+                (optrOpnd = sc_term_22);
+            else
+                (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr))))));
+            (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd)));
+            (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null)));
+            (sc_write(rewrite_count_nboyer));
+            (sc_display(" rewrites"));
+            (sc_newline());
+            if ((answer!== false))
+                return rewrite_count_nboyer;
+            else
+                return false;
+        }
+    };
+}
+/* Exported Variables */
+var BgL_parsezd2ze3nbzd2treesze3;
+var BgL_earleyzd2benchmarkzd2;
+var BgL_parsezd2ze3parsedzf3zc2;
+var test2;
+var BgL_parsezd2ze3treesz31;
+var BgL_makezd2parserzd2;
+/* End Exports */
+
+var const_earley;
+{
+    (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null)));
+    BgL_makezd2parserzd2 = function(grammar, lexer) {
+        var i;
+        var parser_descr;
+        var def_loop;
+        var nb_nts;
+        var names;
+        var steps;
+        var predictors;
+        var enders;
+        var starters;
+        var nts;
+        var sc_names_1;
+        var sc_steps_2;
+        var sc_predictors_3;
+        var sc_enders_4;
+        var sc_starters_5;
+        var nb_confs;
+        var BgL_sc_defzd2loop_6zd2;
+        var BgL_sc_nbzd2nts_7zd2;
+        var sc_nts_8;
+        var BgL_sc_defzd2loop_9zd2;
+        var ind;
+        {
+            ind = function(nt, sc_nts_10) {
+                var i;
+                {
+                    (i = ((sc_nts_10.length)-(1)));
+                    while (true) {
+                        if ((i>=(0)))
+                            if ((sc_isEqual((sc_nts_10[i]), nt)))
+                                return i;
+                            else
+                                (--i);
+                        else
+                            return false;
+                    }
+                }
+            };
+            (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) {
+                var rule_loop;
+                var head;
+                var def;
+                return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) {
+                    var nt;
+                    var l;
+                    var sc_nts_13;
+                    var rule;
+                    if ((rules instanceof sc_Pair))
+                        {
+                            (rule = (rules.car));
+                            (l = rule);
+                            (sc_nts_13 = sc_nts_12);
+                            while ((l instanceof sc_Pair)) {
+                                {
+                                    (nt = (l.car));
+                                    (l = (l.cdr));
+                                    (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13))));
+                                }
+                            }
+                            return (rule_loop((rules.cdr), sc_nts_13));
+                        }
+                    else
+                        return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12));
+                }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11)))));
+            }), (BgL_sc_defzd2loop_9zd2(grammar, null))));
+            (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length));
+            (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) {
+                var rule_loop;
+                var def;
+                return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) {
+                    var l;
+                    var BgL_sc_nbzd2confs_16zd2;
+                    var rule;
+                    if ((rules instanceof sc_Pair))
+                        {
+                            (rule = (rules.car));
+                            (l = rule);
+                            (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2);
+                            while ((l instanceof sc_Pair)) {
+                                {
+                                    (l = (l.cdr));
+                                    (++BgL_sc_nbzd2confs_16zd2);
+                                }
+                            }
+                            return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1))));
+                        }
+                    else
+                        return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2));
+                }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2);
+            }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2));
+            (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));
+            (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));
+            (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null)));
+            (sc_steps_2 = (sc_makeVector(nb_confs, false)));
+            (sc_names_1 = (sc_makeVector(nb_confs, false)));
+            (nts = sc_nts_8);
+            (starters = sc_starters_5);
+            (enders = sc_enders_4);
+            (predictors = sc_predictors_3);
+            (steps = sc_steps_2);
+            (names = sc_names_1);
+            (nb_nts = (sc_nts_8.length));
+            (i = (nb_nts-(1)));
+            while ((i>=(0))) {
+                {
+                    (sc_steps_2[i] = (i-nb_nts));
+                    (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0))));
+                    (sc_enders_4[i] = (sc_list(i)));
+                    (--i);
+                }
+            }
+            def_loop = function(defs, conf) {
+                var rule_loop;
+                var head;
+                var def;
+                return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) {
+                    var i;
+                    var sc_i_17;
+                    var nt;
+                    var l;
+                    var sc_conf_18;
+                    var sc_i_19;
+                    var rule;
+                    if ((rules instanceof sc_Pair))
+                        {
+                            (rule = (rules.car));
+                            (names[conf] = (sc_list(head, rule_num)));
+                            (sc_i_19 = (ind(head, nts)));
+                            (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19]))));
+                            (l = rule);
+                            (sc_conf_18 = conf);
+                            while ((l instanceof sc_Pair)) {
+                                {
+                                    (nt = (l.car));
+                                    (steps[sc_conf_18] = (ind(nt, nts)));
+                                    (sc_i_17 = (ind(nt, nts)));
+                                    (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17]))));
+                                    (l = (l.cdr));
+                                    (++sc_conf_18);
+                                }
+                            }
+                            (steps[sc_conf_18] = ((ind(head, nts))-nb_nts));
+                            (i = (ind(head, nts)));
+                            (enders[i] = (new sc_Pair(sc_conf_18, (enders[i]))));
+                            return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1))));
+                        }
+                    else
+                        return (def_loop((defs.cdr), conf));
+                }), (rule_loop((def.cdr), conf, (1)))):undefined);
+            };
+            (def_loop(grammar, (sc_nts_8.length)));
+            (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]);
+            return function(input) {
+                var optrOpnd;
+                var sc_optrOpnd_20;
+                var sc_optrOpnd_21;
+                var sc_optrOpnd_22;
+                var loop1;
+                var BgL_sc_stateza2_23za2;
+                var toks;
+                var BgL_sc_nbzd2nts_24zd2;
+                var sc_steps_25;
+                var sc_enders_26;
+                var state_num;
+                var BgL_sc_statesza2_27za2;
+                var states;
+                var i;
+                var conf;
+                var l;
+                var tok_nts;
+                var sc_i_28;
+                var sc_i_29;
+                var l1;
+                var l2;
+                var tok;
+                var tail1129;
+                var L1125;
+                var goal_enders;
+                var BgL_sc_statesza2_30za2;
+                var BgL_sc_nbzd2nts_31zd2;
+                var BgL_sc_nbzd2confs_32zd2;
+                var nb_toks;
+                var goal_starters;
+                var sc_states_33;
+                var BgL_sc_nbzd2confs_34zd2;
+                var BgL_sc_nbzd2toks_35zd2;
+                var sc_toks_36;
+                var falseHead1128;
+                var sc_names_37;
+                var sc_steps_38;
+                var sc_predictors_39;
+                var sc_enders_40;
+                var sc_starters_41;
+                var sc_nts_42;
+                var lexer;
+                var sc_ind_43;
+                var make_states;
+                var BgL_sc_confzd2setzd2getza2_44za2;
+                var conf_set_merge_new_bang;
+                var conf_set_adjoin;
+                var BgL_sc_confzd2setzd2adjoinza2_45za2;
+                var BgL_sc_confzd2setzd2adjoinza2za2_46z00;
+                var conf_set_union;
+                var forw;
+                var is_parsed;
+                var deriv_trees;
+                var BgL_sc_derivzd2treesza2_47z70;
+                var nb_deriv_trees;
+                var BgL_sc_nbzd2derivzd2treesza2_48za2;
+                {
+                    sc_ind_43 = function(nt, sc_nts_49) {
+                        var i;
+                        {
+                            (i = ((sc_nts_49.length)-(1)));
+                            while (true) {
+                                if ((i>=(0)))
+                                    if ((sc_isEqual((sc_nts_49[i]), nt)))
+                                        return i;
+                                    else
+                                        (--i);
+                                else
+                                    return false;
+                            }
+                        }
+                    };
+                    make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) {
+                        var v;
+                        var i;
+                        var sc_states_52;
+                        {
+                            (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false)));
+                            (i = BgL_sc_nbzd2toks_50zd2);
+                            while ((i>=(0))) {
+                                {
+                                    (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false)));
+                                    (v[(0)] = (-1));
+                                    (sc_states_52[i] = v);
+                                    (--i);
+                                }
+                            }
+                            return sc_states_52;
+                        }
+                    };
+                    BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) {
+                        var conf_set;
+                        var BgL_sc_confzd2set_55zd2;
+                        return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set)));
+                    };
+                    conf_set_merge_new_bang = function(conf_set) {
+                        return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)));
+                    };
+                    conf_set_adjoin = function(state, conf_set, sc_conf_56, i) {
+                        var tail;
+                        return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined));
+                    };
+                    BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) {
+                        var conf_set;
+                        var sc_conf_59;
+                        var l1;
+                        var state;
+                        {
+                            (state = (sc_states_57[BgL_sc_statezd2num_58zd2]));
+                            (l1 = l);
+                            while ((l1 instanceof sc_Pair)) {
+                                {
+                                    (sc_conf_59 = (l1.car));
+                                    (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59)));
+                                    if (((conf_set[(i+(5))])=== false))
+                                        {
+                                            (conf_set_adjoin(state, conf_set, sc_conf_59, i));
+                                            (l1 = (l1.cdr));
+                                        }
+                                    else
+                                        (l1 = (l1.cdr));
+                                }
+                            }
+                            return undefined;
+                        }
+                    };
+                    BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) {
+                        var BgL_sc_confzd2setza2_64z70;
+                        var BgL_sc_stateza2_65za2;
+                        var conf_set;
+                        var state;
+                        return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false));
+                    };
+                    conf_set_union = function(state, conf_set, sc_conf_66, other_set) {
+                        var i;
+                        {
+                            (i = (other_set[(2)]));
+                            while ((i>=(0))) {
+                                if (((conf_set[(i+(5))])=== false))
+                                    {
+                                        (conf_set_adjoin(state, conf_set, sc_conf_66, i));
+                                        (i = (other_set[(i+(5))]));
+                                    }
+                                else
+                                    (i = (other_set[(i+(5))]));
+                            }
+                            return undefined;
+                        }
+                    };
+                    forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) {
+                        var next_set;
+                        var next;
+                        var conf_set;
+                        var ender;
+                        var l;
+                        var starter_set;
+                        var starter;
+                        var sc_l_74;
+                        var sc_loop1_75;
+                        var head;
+                        var BgL_sc_confzd2set_76zd2;
+                        var BgL_sc_statezd2num_77zd2;
+                        var state;
+                        var sc_states_78;
+                        var preds;
+                        var BgL_sc_confzd2set_79zd2;
+                        var step;
+                        var sc_conf_80;
+                        var BgL_sc_nbzd2nts_81zd2;
+                        var sc_state_82;
+                        {
+                            (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2]));
+                            (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length));
+                            while (true) {
+                                {
+                                    (sc_conf_80 = (sc_state_82[(0)]));
+                                    if ((sc_conf_80>=(0)))
+                                        {
+                                            (step = (sc_steps_72[sc_conf_80]));
+                                            (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))]));
+                                            (head = (BgL_sc_confzd2set_79zd2[(4)]));
+                                            (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)]));
+                                            (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2));
+                                            if ((step>=(0)))
+                                                {
+                                                    (sc_l_74 = (sc_starters_69[step]));
+                                                    while ((sc_l_74 instanceof sc_Pair)) {
+                                                        {
+                                                            (starter = (sc_l_74.car));
+                                                            (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter)));
+                                                            if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false))
+                                                                {
+                                                                    (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2));
+                                                                    (sc_l_74 = (sc_l_74.cdr));
+                                                                }
+                                                            else
+                                                                (sc_l_74 = (sc_l_74.cdr));
+                                                        }
+                                                    }
+                                                    (l = (sc_enders_70[step]));
+                                                    while ((l instanceof sc_Pair)) {
+                                                        {
+                                                            (ender = (l.car));
+                                                            if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false))
+                                                                {
+                                                                    (next = (sc_conf_80+(1)));
+                                                                    (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next)));
+                                                                    (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2));
+                                                                    (l = (l.cdr));
+                                                                }
+                                                            else
+                                                                (l = (l.cdr));
+                                                        }
+                                                    }
+                                                }
+                                            else
+                                                {
+                                                    (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)]));
+                                                    (sc_states_78 = sc_states_67);
+                                                    (state = sc_state_82);
+                                                    (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2);
+                                                    (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2);
+                                                    sc_loop1_75 = function(l) {
+                                                        var sc_state_83;
+                                                        var BgL_sc_nextzd2set_84zd2;
+                                                        var sc_next_85;
+                                                        var pred_set;
+                                                        var i;
+                                                        var pred;
+                                                        if ((l instanceof sc_Pair))
+                                                            {
+                                                                (pred = (l.car));
+                                                                (i = head);
+                                                                while ((i>=(0))) {
+                                                                    {
+                                                                        (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))])));
+                                                                        if ((pred_set!== false))
+                                                                            {
+                                                                                (sc_next_85 = (pred+(1)));
+                                                                                (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85)));
+                                                                                (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set));
+                                                                            }
+                                                                        (i = (BgL_sc_confzd2set_76zd2[(i+(5))]));
+                                                                    }
+                                                                }
+                                                                return (sc_loop1_75((l.cdr)));
+                                                            }
+                                                        else
+                                                            return undefined;
+                                                    };
+                                                    (sc_loop1_75(preds));
+                                                }
+                                        }
+                                    else
+                                        return undefined;
+                                }
+                            }
+                        }
+                    };
+                    is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) {
+                        var conf_set;
+                        var state;
+                        var sc_conf_89;
+                        var l;
+                        var BgL_sc_ntza2_90za2;
+                        {
+                            (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86)));
+                            if ((BgL_sc_ntza2_90za2!== false))
+                                {
+                                    (sc_nts_86.length);
+                                    (l = (sc_enders_87[BgL_sc_ntza2_90za2]));
+                                    while (true) {
+                                        if ((l instanceof sc_Pair))
+                                            {
+                                                (sc_conf_89 = (l.car));
+                                                if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))
+                                                    return true;
+                                                else
+                                                    (l = (l.cdr));
+                                            }
+                                        else
+                                            return false;
+                                    }
+                                }
+                            else
+                                return false;
+                        }
+                    };
+                    deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) {
+                        var sc_loop1_98;
+                        var prev;
+                        var name;
+                        return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91<BgL_sc_nbzd2nts_97zd2)?(sc_list((sc_list(name, ((sc_toks_95[i]).car))))):(sc_list((sc_list(name))))):((prev = (sc_conf_91-(1))), (sc_loop1_98 = function(l1, l2) {
+                            var loop2;
+                            var ender_set;
+                            var state;
+                            var ender;
+                            var l1;
+                            var l2;
+                            while (true) {
+                                if ((l1 instanceof sc_Pair))
+                                    {
+                                        (ender = (l1.car));
+                                        (ender_set = ((state = (sc_states_96[j])), (state[(ender+(1))])));
+                                        if ((ender_set!== false))
+                                            {
+                                                loop2 = function(k, l2) {
+                                                    var loop3;
+                                                    var ender_trees;
+                                                    var prev_trees;
+                                                    var conf_set;
+                                                    var sc_state_99;
+                                                    var k;
+                                                    var l2;
+                                                    while (true) {
+                                                        if ((k>=(0)))
+                                                            if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)))
+                                                                {
+                                                                    (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2)));
+                                                                    (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2)));
+                                                                    loop3 = function(l3, l2) {
+                                                                        var l4;
+                                                                        var sc_l2_100;
+                                                                        var ender_tree;
+                                                                        if ((l3 instanceof sc_Pair))
+                                                                            {
+                                                                                (ender_tree = (sc_list((l3.car))));
+                                                                                (l4 = prev_trees);
+                                                                                (sc_l2_100 = l2);
+                                                                                while ((l4 instanceof sc_Pair)) {
+                                                                                    {
+                                                                                        (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100)));
+                                                                                        (l4 = (l4.cdr));
+                                                                                    }
+                                                                                }
+                                                                                return (loop3((l3.cdr), sc_l2_100));
+                                                                            }
+                                                                        else
+                                                                            return (loop2((ender_set[(k+(5))]), l2));
+                                                                    };
+                                                                    return (loop3(ender_trees, l2));
+                                                                }
+                                                            else
+                                                                (k = (ender_set[(k+(5))]));
+                                                        else
+                                                            return (sc_loop1_98((l1.cdr), l2));
+                                                    }
+                                                };
+                                                return (loop2((ender_set[(2)]), l2));
+                                            }
+                                        else
+                                            (l1 = (l1.cdr));
+                                    }
+                                else
+                                    return l2;
+                            }
+                        }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null)))));
+                    };
+                    BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) {
+                        var conf_set;
+                        var state;
+                        var sc_conf_107;
+                        var l;
+                        var trees;
+                        var BgL_sc_nbzd2nts_108zd2;
+                        var BgL_sc_ntza2_109za2;
+                        {
+                            (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101)));
+                            if ((BgL_sc_ntza2_109za2!== false))
+                                {
+                                    (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length));
+                                    (l = (sc_enders_102[BgL_sc_ntza2_109za2]));
+                                    (trees = null);
+                                    while ((l instanceof sc_Pair)) {
+                                        {
+                                            (sc_conf_107 = (l.car));
+                                            if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))
+                                                {
+                                                    (l = (l.cdr));
+                                                    (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees)));
+                                                }
+                                            else
+                                                (l = (l.cdr));
+                                        }
+                                    }
+                                    return trees;
+                                }
+                            else
+                                return false;
+                        }
+                    };
+                    nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) {
+                        var sc_loop1_116;
+                        var tmp1124;
+                        var prev;
+                        return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110<BgL_sc_nbzd2nts_115zd2)), ((tmp1124!== false)?tmp1124:((sc_steps_112[prev])<(0))))!== false)?(1):((sc_loop1_116 = function(l, sc_n_118) {
+                            var nb_ender_trees;
+                            var nb_prev_trees;
+                            var conf_set;
+                            var state;
+                            var k;
+                            var n;
+                            var ender_set;
+                            var sc_state_117;
+                            var ender;
+                            var l;
+                            var sc_n_118;
+                            while (true) {
+                                if ((l instanceof sc_Pair))
+                                    {
+                                        (ender = (l.car));
+                                        (ender_set = ((sc_state_117 = (sc_states_114[j])), (sc_state_117[(ender+(1))])));
+                                        if ((ender_set!== false))
+                                            {
+                                                (k = (ender_set[(2)]));
+                                                (n = sc_n_118);
+                                                while ((k>=(0))) {
+                                                    if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)))
+                                                        {
+                                                            (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2)));
+                                                            (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2)));
+                                                            (k = (ender_set[(k+(5))]));
+                                                            (n +=(nb_prev_trees*nb_ender_trees));
+                                                        }
+                                                    else
+                                                        (k = (ender_set[(k+(5))]));
+                                                }
+                                                return (sc_loop1_116((l.cdr), n));
+                                            }
+                                        else
+                                            (l = (l.cdr));
+                                    }
+                                else
+                                    return sc_n_118;
+                            }
+                        }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0))))));
+                    };
+                    BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) {
+                        var conf_set;
+                        var state;
+                        var sc_conf_124;
+                        var l;
+                        var nb_trees;
+                        var BgL_sc_nbzd2nts_125zd2;
+                        var BgL_sc_ntza2_126za2;
+                        {
+                            (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119)));
+                            if ((BgL_sc_ntza2_126za2!== false))
+                                {
+                                    (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length));
+                                    (l = (sc_enders_120[BgL_sc_ntza2_126za2]));
+                                    (nb_trees = (0));
+                                    while ((l instanceof sc_Pair)) {
+                                        {
+                                            (sc_conf_124 = (l.car));
+                                            if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))
+                                                {
+                                                    (l = (l.cdr));
+                                                    (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees));
+                                                }
+                                            else
+                                                (l = (l.cdr));
+                                        }
+                                    }
+                                    return nb_trees;
+                                }
+                            else
+                                return false;
+                        }
+                    };
+                    (lexer = (parser_descr[(0)]));
+                    (sc_nts_42 = (parser_descr[(1)]));
+                    (sc_starters_41 = (parser_descr[(2)]));
+                    (sc_enders_40 = (parser_descr[(3)]));
+                    (sc_predictors_39 = (parser_descr[(4)]));
+                    (sc_steps_38 = (parser_descr[(5)]));
+                    (sc_names_37 = (parser_descr[(6)]));
+                    (falseHead1128 = (new sc_Pair(null, null)));
+                    (L1125 = (lexer(input)));
+                    (tail1129 = falseHead1128);
+                    while (!(L1125 === null)) {
+                        {
+                            (tok = (L1125.car));
+                            (l1 = (tok.cdr));
+                            (l2 = null);
+                            while ((l1 instanceof sc_Pair)) {
+                                {
+                                    (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42)));
+                                    if ((sc_i_29!== false))
+                                        {
+                                            (l1 = (l1.cdr));
+                                            (l2 = (new sc_Pair(sc_i_29, l2)));
+                                        }
+                                    else
+                                        (l1 = (l1.cdr));
+                                }
+                            }
+                            (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2)))));
+                            (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null)));
+                            (tail1129.cdr = sc_optrOpnd_21);
+                            (tail1129 = (tail1129.cdr));
+                            (L1125 = (L1125.cdr));
+                        }
+                    }
+                    (sc_optrOpnd_20 = (falseHead1128.cdr));
+                    (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20)));
+                    (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length));
+                    (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length));
+                    (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2)));
+                    (goal_starters = (sc_starters_41[(0)]));
+                    (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0)));
+                    (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42));
+                    (sc_i_28 = (0));
+                    while ((sc_i_28<BgL_sc_nbzd2toks_35zd2)) {
+                        {
+                            (tok_nts = ((sc_toks_36[sc_i_28]).cdr));
+                            (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (sc_i_28+(1)), tok_nts, sc_i_28));
+                            (forw(sc_states_33, (sc_i_28+(1)), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42));
+                            (++sc_i_28);
+                        }
+                    }
+                    (nb_toks = (sc_toks_36.length));
+                    (BgL_sc_nbzd2confs_32zd2 = (sc_steps_38.length));
+                    (BgL_sc_nbzd2nts_31zd2 = (sc_nts_42.length));
+                    (BgL_sc_statesza2_30za2 = (make_states(nb_toks, BgL_sc_nbzd2confs_32zd2)));
+                    (goal_enders = (sc_enders_40[(0)]));
+                    (l = goal_enders);
+                    while ((l instanceof sc_Pair)) {
+                        {
+                            (conf = (l.car));
+                            (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_33, BgL_sc_statesza2_30za2, nb_toks, conf, (0)));
+                            (l = (l.cdr));
+                        }
+                    }
+                    (i = nb_toks);
+                    while ((i>=(0))) {
+                        {
+                            (states = sc_states_33);
+                            (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2);
+                            (state_num = i);
+                            (sc_enders_26 = sc_enders_40);
+                            (sc_steps_25 = sc_steps_38);
+                            (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2);
+                            (toks = sc_toks_36);
+                            (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i]));
+                            loop1 = function() {
+                                var sc_loop1_127;
+                                var prev;
+                                var BgL_sc_statesza2_128za2;
+                                var sc_states_129;
+                                var j;
+                                var i;
+                                var sc_i_130;
+                                var head;
+                                var conf_set;
+                                var sc_conf_131;
+                                {
+                                    (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)]));
+                                    if ((sc_conf_131>=(0)))
+                                        {
+                                            (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))]));
+                                            (head = (conf_set[(4)]));
+                                            (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)]));
+                                            (conf_set_merge_new_bang(conf_set));
+                                            (sc_i_130 = head);
+                                            while ((sc_i_130>=(0))) {
+                                                {
+                                                    (i = sc_i_130);
+                                                    (j = state_num);
+                                                    (sc_states_129 = states);
+                                                    (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2);
+                                                    (prev = (sc_conf_131-(1)));
+                                                    if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0))))
+                                                        {
+                                                            sc_loop1_127 = function(l) {
+                                                                var k;
+                                                                var ender_set;
+                                                                var state;
+                                                                var ender;
+                                                                var l;
+                                                                while (true) {
+                                                                    if ((l instanceof sc_Pair))
+                                                                        {
+                                                                            (ender = (l.car));
+                                                                            (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))])));
+                                                                            if ((ender_set!== false))
+                                                                                {
+                                                                                    (k = (ender_set[(2)]));
+                                                                                    while ((k>=(0))) {
+                                                                                        {
+                                                                                            if ((k>=i))
+                                                                                                if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false))
+                                                                                                    (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k));
+                                                                                            (k = (ender_set[(k+(5))]));
+                                                                                        }
+                                                                                    }
+                                                                                    return (sc_loop1_127((l.cdr)));
+                                                                                }
+                                                                            else
+                                                                                (l = (l.cdr));
+                                                                        }
+                                                                    else
+                                                                        return undefined;
+                                                                }
+                                                            };
+                                                            (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])])));
+                                                        }
+                                                    (sc_i_130 = (conf_set[(sc_i_130+(5))]));
+                                                }
+                                            }
+                                            return (loop1());
+                                        }
+                                    else
+                                        return undefined;
+                                }
+                            };
+                            (loop1());
+                            (--i);
+                        }
+                    }
+                    (optrOpnd = BgL_sc_statesza2_30za2);
+                    return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2];
+                }
+            };
+        }
+    };
+    BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) {
+        var is_parsed;
+        var states;
+        var enders;
+        var nts;
+        return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states)));
+    };
+    BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) {
+        var BgL_sc_derivzd2treesza2_132z70;
+        var states;
+        var toks;
+        var names;
+        var steps;
+        var enders;
+        var nts;
+        return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states)));
+    };
+    BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) {
+        var BgL_sc_nbzd2derivzd2treesza2_133za2;
+        var states;
+        var toks;
+        var steps;
+        var enders;
+        var nts;
+        return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states)));
+    };
+    test2 = function(k) {
+        var x;
+        var p;
+        return ((p = (BgL_makezd2parserzd2(const_earley, function(l) {
+            var sc_x_134;
+            var tail1134;
+            var L1130;
+            var falseHead1133;
+            {
+                (falseHead1133 = (new sc_Pair(null, null)));
+                (tail1134 = falseHead1133);
+                (L1130 = l);
+                while (!(L1130 === null)) {
+                    {
+                        (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null)));
+                        (tail1134 = (tail1134.cdr));
+                        (L1130 = (L1130.cdr));
+                    }
+                }
+                return (falseHead1133.cdr);
+            }
+        }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k)))));
+    };
+    BgL_earleyzd2benchmarkzd2 = function() {
+        var args = null;
+        for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) {
+            args = sc_cons(arguments[sc_tmp], args);
+        }
+        var k;
+        return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() {
+            return (test2(k));
+        }, function(result) {
+            return ((sc_display(result)), (sc_newline()), result == 132);
+        })));
+    };
+}
+
+
+/************* END OF GENERATED CODE *************/
+// Invoke this function to run a benchmark.
+// The first argument is a string identifying the benchmark.
+// The second argument is the number of times to run the benchmark.
+// The third argument is a function that runs the benchmark.
+// The fourth argument is a unary function that warns if the result
+// returned by the benchmark is incorrect.
+//
+// Example:
+// RunBenchmark("new Array()",
+//              1,
+//              function () { new Array(1000000); }
+//              function (v) {
+//                return (v instanceof Array) && (v.length == 1000000);
+//              });
+
+SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {});
+SC_ERROR_OUT = SC_DEFAULT_OUT;
+
+function RunBenchmark(name, count, run, warn) {
+  for (var n = 0; n < count; ++n) {
+    result = run();
+    if (!warn(result)) {
+      throw new Error("Earley or Boyer did incorrect number of rewrites");
+    }
+  }
+}
+
+var BgL_runzd2benchmarkzd2 = RunBenchmark;
+
+window.onload = function(){ startTest("v8-earley-boyer", '');
+
+test("Earley", BgL_earleyzd2benchmarkzd2);
+test("Boyer", BgL_nboyerzd2benchmarkzd2);
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>
diff --git a/tests/v8-raytrace.html b/tests/v8-raytrace.html
new file mode 100644
index 0000000..6b50691
--- /dev/null
+++ b/tests/v8-raytrace.html
@@ -0,0 +1,3444 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The ray tracer code in this file is written by Adam Burmister. It
+// is available in its original form from:
+//
+//   http://labs.flog.nz.co/raytracer/
+//
+// It has been modified slightly by Google to work as a standalone
+// benchmark, but the all the computational code remains
+// untouched. This file also contains a copy of the Prototype
+// JavaScript framework which is used by the ray tracer.
+
+
+var checkNumber;
+
+// Create dummy objects if we're not running in a browser.
+if (typeof document == 'undefined') {
+  document = { };
+  window = { opera: null };
+  navigator = { userAgent: null, appVersion: "" };
+}
+
+
+// ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
+
+
+/*  Prototype JavaScript framework, version 1.5.0
+ *  (c) 2005-2007 Sam Stephenson
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *  For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
+
+//--------------------
+var Prototype = {
+  Version: '1.5.0',
+  BrowserFeatures: {
+    XPath: !!document.evaluate
+  },
+
+  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
+  emptyFunction: function() {},
+  K: function(x) { return x }
+}
+
+var Class = {
+  create: function() {
+    return function() {
+      this.initialize.apply(this, arguments);
+    }
+  }
+}
+
+var Abstract = new Object();
+
+Object.extend = function(destination, source) {
+  for (var property in source) {
+    destination[property] = source[property];
+  }
+  return destination;
+}
+
+Object.extend(Object, {
+  inspect: function(object) {
+    try {
+      if (object === undefined) return 'undefined';
+      if (object === null) return 'null';
+      return object.inspect ? object.inspect() : object.toString();
+    } catch (e) {
+      if (e instanceof RangeError) return '...';
+      throw e;
+    }
+  },
+
+  keys: function(object) {
+    var keys = [];
+    for (var property in object)
+      keys.push(property);
+    return keys;
+  },
+
+  values: function(object) {
+    var values = [];
+    for (var property in object)
+      values.push(object[property]);
+    return values;
+  },
+
+  clone: function(object) {
+    return Object.extend({}, object);
+  }
+});
+
+Function.prototype.bind = function() {
+  var __method = this, args = $A(arguments), object = args.shift();
+  return function() {
+    return __method.apply(object, args.concat($A(arguments)));
+  }
+}
+
+Function.prototype.bindAsEventListener = function(object) {
+  var __method = this, args = $A(arguments), object = args.shift();
+  return function(event) {
+    return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
+  }
+}
+
+Object.extend(Number.prototype, {
+  toColorPart: function() {
+    var digits = this.toString(16);
+    if (this < 16) return '0' + digits;
+    return digits;
+  },
+
+  succ: function() {
+    return this + 1;
+  },
+
+  times: function(iterator) {
+    $R(0, this, true).each(iterator);
+    return this;
+  }
+});
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) {}
+    }
+
+    return returnValue;
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  stop: function() {
+    if (!this.timer) return;
+    clearInterval(this.timer);
+    this.timer = null;
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try {
+        this.currentlyExecuting = true;
+        this.callback(this);
+      } finally {
+        this.currentlyExecuting = false;
+      }
+    }
+  }
+}
+String.interpret = function(value){
+  return value == null ? '' : String(value);
+}
+
+Object.extend(String.prototype, {
+  gsub: function(pattern, replacement) {
+    var result = '', source = this, match;
+    replacement = arguments.callee.prepareReplacement(replacement);
+
+    while (source.length > 0) {
+      if (match = source.match(pattern)) {
+        result += source.slice(0, match.index);
+        result += String.interpret(replacement(match));
+        source  = source.slice(match.index + match[0].length);
+      } else {
+        result += source, source = '';
+      }
+    }
+    return result;
+  },
+
+  sub: function(pattern, replacement, count) {
+    replacement = this.gsub.prepareReplacement(replacement);
+    count = count === undefined ? 1 : count;
+
+    return this.gsub(pattern, function(match) {
+      if (--count < 0) return match[0];
+      return replacement(match);
+    });
+  },
+
+  scan: function(pattern, iterator) {
+    this.gsub(pattern, iterator);
+    return this;
+  },
+
+  truncate: function(length, truncation) {
+    length = length || 30;
+    truncation = truncation === undefined ? '...' : truncation;
+    return this.length > length ?
+      this.slice(0, length - truncation.length) + truncation : this;
+  },
+
+  strip: function() {
+    return this.replace(/^\s+/, '').replace(/\s+$/, '');
+  },
+
+  stripTags: function() {
+    return this.replace(/<\/?[^>]+>/gi, '');
+  },
+
+  stripScripts: function() {
+    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+  },
+
+  extractScripts: function() {
+    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+    return (this.match(matchAll) || []).map(function(scriptTag) {
+      return (scriptTag.match(matchOne) || ['', ''])[1];
+    });
+  },
+
+  evalScripts: function() {
+    return this.extractScripts().map(function(script) { return eval(script) });
+  },
+
+  escapeHTML: function() {
+    var div = document.createElement('div');
+    var text = document.createTextNode(this);
+    div.appendChild(text);
+    return div.innerHTML;
+  },
+
+  unescapeHTML: function() {
+    var div = document.createElement('div');
+    div.innerHTML = this.stripTags();
+    return div.childNodes[0] ? (div.childNodes.length > 1 ?
+      $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
+      div.childNodes[0].nodeValue) : '';
+  },
+
+  toQueryParams: function(separator) {
+    var match = this.strip().match(/([^?#]*)(#.*)?$/);
+    if (!match) return {};
+
+    return match[1].split(separator || '&').inject({}, function(hash, pair) {
+      if ((pair = pair.split('='))[0]) {
+        var name = decodeURIComponent(pair[0]);
+        var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;
+
+        if (hash[name] !== undefined) {
+          if (hash[name].constructor != Array)
+            hash[name] = [hash[name]];
+          if (value) hash[name].push(value);
+        }
+        else hash[name] = value;
+      }
+      return hash;
+    });
+  },
+
+  toArray: function() {
+    return this.split('');
+  },
+
+  succ: function() {
+    return this.slice(0, this.length - 1) +
+      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+  },
+
+  camelize: function() {
+    var parts = this.split('-'), len = parts.length;
+    if (len == 1) return parts[0];
+
+    var camelized = this.charAt(0) == '-'
+      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+      : parts[0];
+
+    for (var i = 1; i < len; i++)
+      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+    return camelized;
+  },
+
+  capitalize: function(){
+    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+  },
+
+  underscore: function() {
+    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+  },
+
+  dasherize: function() {
+    return this.gsub(/_/,'-');
+  },
+
+  inspect: function(useDoubleQuotes) {
+    var escapedString = this.replace(/\\/g, '\\\\');
+    if (useDoubleQuotes)
+      return '"' + escapedString.replace(/"/g, '\\"') + '"';
+    else
+      return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+  }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+  if (typeof replacement == 'function') return replacement;
+  var template = new Template(replacement);
+  return function(match) { return template.evaluate(match) };
+}
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+var Template = Class.create();
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+Template.prototype = {
+  initialize: function(template, pattern) {
+    this.template = template.toString();
+    this.pattern  = pattern || Template.Pattern;
+  },
+
+  evaluate: function(object) {
+    return this.template.gsub(this.pattern, function(match) {
+      var before = match[1];
+      if (before == '\\') return match[2];
+      return before + String.interpret(object[match[3]]);
+    });
+  }
+}
+
+var $break    = new Object();
+var $continue = new Object();
+
+var Enumerable = {
+  each: function(iterator) {
+    var index = 0;
+    try {
+      this._each(function(value) {
+        try {
+          iterator(value, index++);
+        } catch (e) {
+          if (e != $continue) throw e;
+        }
+      });
+    } catch (e) {
+      if (e != $break) throw e;
+    }
+    return this;
+  },
+
+  eachSlice: function(number, iterator) {
+    var index = -number, slices = [], array = this.toArray();
+    while ((index += number) < array.length)
+      slices.push(array.slice(index, index+number));
+    return slices.map(iterator);
+  },
+
+  all: function(iterator) {
+    var result = true;
+    this.each(function(value, index) {
+      result = result && !!(iterator || Prototype.K)(value, index);
+      if (!result) throw $break;
+    });
+    return result;
+  },
+
+  any: function(iterator) {
+    var result = false;
+    this.each(function(value, index) {
+      if (result = !!(iterator || Prototype.K)(value, index))
+        throw $break;
+    });
+    return result;
+  },
+
+  collect: function(iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      results.push((iterator || Prototype.K)(value, index));
+    });
+    return results;
+  },
+
+  detect: function(iterator) {
+    var result;
+    this.each(function(value, index) {
+      if (iterator(value, index)) {
+        result = value;
+        throw $break;
+      }
+    });
+    return result;
+  },
+
+  findAll: function(iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      if (iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  grep: function(pattern, iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      var stringValue = value.toString();
+      if (stringValue.match(pattern))
+        results.push((iterator || Prototype.K)(value, index));
+    })
+    return results;
+  },
+
+  include: function(object) {
+    var found = false;
+    this.each(function(value) {
+      if (value == object) {
+        found = true;
+        throw $break;
+      }
+    });
+    return found;
+  },
+
+  inGroupsOf: function(number, fillWith) {
+    fillWith = fillWith === undefined ? null : fillWith;
+    return this.eachSlice(number, function(slice) {
+      while(slice.length < number) slice.push(fillWith);
+      return slice;
+    });
+  },
+
+  inject: function(memo, iterator) {
+    this.each(function(value, index) {
+      memo = iterator(memo, value, index);
+    });
+    return memo;
+  },
+
+  invoke: function(method) {
+    var args = $A(arguments).slice(1);
+    return this.map(function(value) {
+      return value[method].apply(value, args);
+    });
+  },
+
+  max: function(iterator) {
+    var result;
+    this.each(function(value, index) {
+      value = (iterator || Prototype.K)(value, index);
+      if (result == undefined || value >= result)
+        result = value;
+    });
+    return result;
+  },
+
+  min: function(iterator) {
+    var result;
+    this.each(function(value, index) {
+      value = (iterator || Prototype.K)(value, index);
+      if (result == undefined || value < result)
+        result = value;
+    });
+    return result;
+  },
+
+  partition: function(iterator) {
+    var trues = [], falses = [];
+    this.each(function(value, index) {
+      ((iterator || Prototype.K)(value, index) ?
+        trues : falses).push(value);
+    });
+    return [trues, falses];
+  },
+
+  pluck: function(property) {
+    var results = [];
+    this.each(function(value, index) {
+      results.push(value[property]);
+    });
+    return results;
+  },
+
+  reject: function(iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      if (!iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  sortBy: function(iterator) {
+    return this.map(function(value, index) {
+      return {value: value, criteria: iterator(value, index)};
+    }).sort(function(left, right) {
+      var a = left.criteria, b = right.criteria;
+      return a < b ? -1 : a > b ? 1 : 0;
+    }).pluck('value');
+  },
+
+  toArray: function() {
+    return this.map();
+  },
+
+  zip: function() {
+    var iterator = Prototype.K, args = $A(arguments);
+    if (typeof args.last() == 'function')
+      iterator = args.pop();
+
+    var collections = [this].concat(args).map($A);
+    return this.map(function(value, index) {
+      return iterator(collections.pluck(index));
+    });
+  },
+
+  size: function() {
+    return this.toArray().length;
+  },
+
+  inspect: function() {
+    return '#<Enumerable:' + this.toArray().inspect() + '>';
+  }
+}
+
+Object.extend(Enumerable, {
+  map:     Enumerable.collect,
+  find:    Enumerable.detect,
+  select:  Enumerable.findAll,
+  member:  Enumerable.include,
+  entries: Enumerable.toArray
+});
+var $A = Array.from = function(iterable) {
+  if (!iterable) return [];
+  if (iterable.toArray) {
+    return iterable.toArray();
+  } else {
+    var results = [];
+    for (var i = 0, length = iterable.length; i < length; i++)
+      results.push(iterable[i]);
+    return results;
+  }
+}
+
+Object.extend(Array.prototype, Enumerable);
+
+if (!Array.prototype._reverse)
+  Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+  _each: function(iterator) {
+    for (var i = 0, length = this.length; i < length; i++)
+      iterator(this[i]);
+  },
+
+  clear: function() {
+    this.length = 0;
+    return this;
+  },
+
+  first: function() {
+    return this[0];
+  },
+
+  last: function() {
+    return this[this.length - 1];
+  },
+
+  compact: function() {
+    return this.select(function(value) {
+      return value != null;
+    });
+  },
+
+  flatten: function() {
+    return this.inject([], function(array, value) {
+      return array.concat(value && value.constructor == Array ?
+        value.flatten() : [value]);
+    });
+  },
+
+  without: function() {
+    var values = $A(arguments);
+    return this.select(function(value) {
+      return !values.include(value);
+    });
+  },
+
+  indexOf: function(object) {
+    for (var i = 0, length = this.length; i < length; i++)
+      if (this[i] == object) return i;
+    return -1;
+  },
+
+  reverse: function(inline) {
+    return (inline !== false ? this : this.toArray())._reverse();
+  },
+
+  reduce: function() {
+    return this.length > 1 ? this : this[0];
+  },
+
+  uniq: function() {
+    return this.inject([], function(array, value) {
+      return array.include(value) ? array : array.concat([value]);
+    });
+  },
+
+  clone: function() {
+    return [].concat(this);
+  },
+
+  size: function() {
+    return this.length;
+  },
+
+  inspect: function() {
+    return '[' + this.map(Object.inspect).join(', ') + ']';
+  }
+});
+
+Array.prototype.toArray = Array.prototype.clone;
+
+function $w(string){
+  string = string.strip();
+  return string ? string.split(/\s+/) : [];
+}
+
+if(window.opera){
+  Array.prototype.concat = function(){
+    var array = [];
+    for(var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+    for(var i = 0, length = arguments.length; i < length; i++) {
+      if(arguments[i].constructor == Array) {
+        for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
+          array.push(arguments[i][j]);
+      } else {
+        array.push(arguments[i]);
+      }
+    }
+    return array;
+  }
+}
+var Hash = function(obj) {
+  Object.extend(this, obj || {});
+};
+
+Object.extend(Hash, {
+  toQueryString: function(obj) {
+    var parts = [];
+
+	  this.prototype._each.call(obj, function(pair) {
+      if (!pair.key) return;
+
+      if (pair.value && pair.value.constructor == Array) {
+        var values = pair.value.compact();
+        if (values.length < 2) pair.value = values.reduce();
+        else {
+        	key = encodeURIComponent(pair.key);
+          values.each(function(value) {
+            value = value != undefined ? encodeURIComponent(value) : '';
+            parts.push(key + '=' + encodeURIComponent(value));
+          });
+          return;
+        }
+      }
+      if (pair.value == undefined) pair[1] = '';
+      parts.push(pair.map(encodeURIComponent).join('='));
+	  });
+
+    return parts.join('&');
+  }
+});
+
+Object.extend(Hash.prototype, Enumerable);
+Object.extend(Hash.prototype, {
+  _each: function(iterator) {
+    for (var key in this) {
+      var value = this[key];
+      if (value && value == Hash.prototype[key]) continue;
+
+      var pair = [key, value];
+      pair.key = key;
+      pair.value = value;
+      iterator(pair);
+    }
+  },
+
+  keys: function() {
+    return this.pluck('key');
+  },
+
+  values: function() {
+    return this.pluck('value');
+  },
+
+  merge: function(hash) {
+    return $H(hash).inject(this, function(mergedHash, pair) {
+      mergedHash[pair.key] = pair.value;
+      return mergedHash;
+    });
+  },
+
+  remove: function() {
+    var result;
+    for(var i = 0, length = arguments.length; i < length; i++) {
+      var value = this[arguments[i]];
+      if (value !== undefined){
+        if (result === undefined) result = value;
+        else {
+          if (result.constructor != Array) result = [result];
+          result.push(value)
+        }
+      }
+      delete this[arguments[i]];
+    }
+    return result;
+  },
+
+  toQueryString: function() {
+    return Hash.toQueryString(this);
+  },
+
+  inspect: function() {
+    return '#<Hash:{' + this.map(function(pair) {
+      return pair.map(Object.inspect).join(': ');
+    }).join(', ') + '}>';
+  }
+});
+
+function $H(object) {
+  if (object && object.constructor == Hash) return object;
+  return new Hash(object);
+};
+ObjectRange = Class.create();
+Object.extend(ObjectRange.prototype, Enumerable);
+Object.extend(ObjectRange.prototype, {
+  initialize: function(start, end, exclusive) {
+    this.start = start;
+    this.end = end;
+    this.exclusive = exclusive;
+  },
+
+  _each: function(iterator) {
+    var value = this.start;
+    while (this.include(value)) {
+      iterator(value);
+      value = value.succ();
+    }
+  },
+
+  include: function(value) {
+    if (value < this.start)
+      return false;
+    if (this.exclusive)
+      return value < this.end;
+    return value <= this.end;
+  }
+});
+
+var $R = function(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+}
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new XMLHttpRequest()},
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+    ) || false;
+  },
+
+  activeRequestCount: 0
+}
+
+Ajax.Responders = {
+  responders: [],
+
+  _each: function(iterator) {
+    this.responders._each(iterator);
+  },
+
+  register: function(responder) {
+    if (!this.include(responder))
+      this.responders.push(responder);
+  },
+
+  unregister: function(responder) {
+    this.responders = this.responders.without(responder);
+  },
+
+  dispatch: function(callback, request, transport, json) {
+    this.each(function(responder) {
+      if (typeof responder[callback] == 'function') {
+        try {
+          responder[callback].apply(responder, [request, transport, json]);
+        } catch (e) {}
+      }
+    });
+  }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+  onCreate: function() {
+    Ajax.activeRequestCount++;
+  },
+  onComplete: function() {
+    Ajax.activeRequestCount--;
+  }
+});
+
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+  setOptions: function(options) {
+    this.options = {
+      method:       'post',
+      asynchronous: true,
+      contentType:  'application/x-www-form-urlencoded',
+      encoding:     'UTF-8',
+      parameters:   ''
+    }
+    Object.extend(this.options, options || {});
+
+    this.options.method = this.options.method.toLowerCase();
+    if (typeof this.options.parameters == 'string')
+      this.options.parameters = this.options.parameters.toQueryParams();
+  }
+}
+
+Ajax.Request = Class.create();
+Ajax.Request.Events =
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
+  _complete: false,
+
+  initialize: function(url, options) {
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+    this.request(url);
+  },
+
+  request: function(url) {
+    this.url = url;
+    this.method = this.options.method;
+    var params = this.options.parameters;
+
+    if (!['get', 'post'].include(this.method)) {
+      // simulate other verbs over post
+      params['_method'] = this.method;
+      this.method = 'post';
+    }
+
+    params = Hash.toQueryString(params);
+    if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='
+
+    // when GET, append parameters to URL
+    if (this.method == 'get' && params)
+      this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params;
+
+    try {
+      Ajax.Responders.dispatch('onCreate', this, this.transport);
+
+      this.transport.open(this.method.toUpperCase(), this.url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous)
+        setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
+
+      this.transport.onreadystatechange = this.onStateChange.bind(this);
+      this.setRequestHeaders();
+
+      var body = this.method == 'post' ? (this.options.postBody || params) : null;
+
+      this.transport.send(body);
+
+      /* Force Firefox to handle ready state 4 for synchronous requests */
+      if (!this.options.asynchronous && this.transport.overrideMimeType)
+        this.onStateChange();
+
+    }
+    catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState > 1 && !((readyState == 4) && this._complete))
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  setRequestHeaders: function() {
+    var headers = {
+      'X-Requested-With': 'XMLHttpRequest',
+      'X-Prototype-Version': Prototype.Version,
+      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+    };
+
+    if (this.method == 'post') {
+      headers['Content-type'] = this.options.contentType +
+        (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+      /* Force "Connection: close" for older Mozilla browsers to work
+       * around a bug where XMLHttpRequest sends an incorrect
+       * Content-length header. See Mozilla Bugzilla #246651.
+       */
+      if (this.transport.overrideMimeType &&
+          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+            headers['Connection'] = 'close';
+    }
+
+    // user-defined headers
+    if (typeof this.options.requestHeaders == 'object') {
+      var extras = this.options.requestHeaders;
+
+      if (typeof extras.push == 'function')
+        for (var i = 0, length = extras.length; i < length; i += 2)
+          headers[extras[i]] = extras[i+1];
+      else
+        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+    }
+
+    for (var name in headers)
+      this.transport.setRequestHeader(name, headers[name]);
+  },
+
+  success: function() {
+    return !this.transport.status
+        || (this.transport.status >= 200 && this.transport.status < 300);
+  },
+
+  respondToReadyState: function(readyState) {
+    var state = Ajax.Request.Events[readyState];
+    var transport = this.transport, json = this.evalJSON();
+
+    if (state == 'Complete') {
+      try {
+        this._complete = true;
+        (this.options['on' + this.transport.status]
+         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+         || Prototype.emptyFunction)(transport, json);
+      } catch (e) {
+        this.dispatchException(e);
+      }
+
+      if ((this.getHeader('Content-type') || 'text/javascript').strip().
+        match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
+          this.evalResponse();
+    }
+
+    try {
+      (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
+      Ajax.Responders.dispatch('on' + state, this, transport, json);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+
+    if (state == 'Complete') {
+      // avoid memory leak in MSIE: clean up
+      this.transport.onreadystatechange = Prototype.emptyFunction;
+    }
+  },
+
+  getHeader: function(name) {
+    try {
+      return this.transport.getResponseHeader(name);
+    } catch (e) { return null }
+  },
+
+  evalJSON: function() {
+    try {
+      var json = this.getHeader('X-JSON');
+      return json ? eval('(' + json + ')') : null;
+    } catch (e) { return null }
+  },
+
+  evalResponse: function() {
+    try {
+      return eval(this.transport.responseText);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  dispatchException: function(exception) {
+    (this.options.onException || Prototype.emptyFunction)(this, exception);
+    Ajax.Responders.dispatch('onException', this, exception);
+  }
+});
+
+Ajax.Updater = Class.create();
+
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
+  initialize: function(container, url, options) {
+    this.container = {
+      success: (container.success || container),
+      failure: (container.failure || (container.success ? null : container))
+    }
+
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+
+    var onComplete = this.options.onComplete || Prototype.emptyFunction;
+    this.options.onComplete = (function(transport, param) {
+      this.updateContent();
+      onComplete(transport, param);
+    }).bind(this);
+
+    this.request(url);
+  },
+
+  updateContent: function() {
+    var receiver = this.container[this.success() ? 'success' : 'failure'];
+    var response = this.transport.responseText;
+
+    if (!this.options.evalScripts) response = response.stripScripts();
+
+    if (receiver = $(receiver)) {
+      if (this.options.insertion)
+        new this.options.insertion(receiver, response);
+      else
+        receiver.update(response);
+    }
+
+    if (this.success()) {
+      if (this.onComplete)
+        setTimeout(this.onComplete.bind(this), 10);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create();
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(container, url, options) {
+    this.setOptions(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = (this.options.decay || 1);
+
+    this.updater = {};
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.options.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(request) {
+    if (this.options.decay) {
+      this.decay = (request.responseText == this.lastText ?
+        this.decay * this.options.decay : 1);
+
+      this.lastText = request.responseText;
+    }
+    this.timer = setTimeout(this.onTimerEvent.bind(this),
+      this.decay * this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+function $(element) {
+  if (arguments.length > 1) {
+    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+      elements.push($(arguments[i]));
+    return elements;
+  }
+  if (typeof element == 'string')
+    element = document.getElementById(element);
+  return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+  document._getElementsByXPath = function(expression, parentElement) {
+    var results = [];
+    var query = document.evaluate(expression, $(parentElement) || document,
+      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+    for (var i = 0, length = query.snapshotLength; i < length; i++)
+      results.push(query.snapshotItem(i));
+    return results;
+  };
+}
+
+document.getElementsByClassName = function(className, parentElement) {
+  if (Prototype.BrowserFeatures.XPath) {
+    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
+    return document._getElementsByXPath(q, parentElement);
+  } else {
+    var children = ($(parentElement) || document.body).getElementsByTagName('*');
+    var elements = [], child;
+    for (var i = 0, length = children.length; i < length; i++) {
+      child = children[i];
+      if (Element.hasClassName(child, className))
+        elements.push(Element.extend(child));
+    }
+    return elements;
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Element)
+  var Element = new Object();
+
+Element.extend = function(element) {
+  if (!element || _nativeExtensions || element.nodeType == 3) return element;
+
+  if (!element._extended && element.tagName && element != window) {
+    var methods = Object.clone(Element.Methods), cache = Element.extend.cache;
+
+    if (element.tagName == 'FORM')
+      Object.extend(methods, Form.Methods);
+    if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName))
+      Object.extend(methods, Form.Element.Methods);
+
+    Object.extend(methods, Element.Methods.Simulated);
+
+    for (var property in methods) {
+      var value = methods[property];
+      if (typeof value == 'function' && !(property in element))
+        element[property] = cache.findOrStore(value);
+    }
+  }
+
+  element._extended = true;
+  return element;
+};
+
+Element.extend.cache = {
+  findOrStore: function(value) {
+    return this[value] = this[value] || function() {
+      return value.apply(null, [this].concat($A(arguments)));
+    }
+  }
+};
+
+Element.Methods = {
+  visible: function(element) {
+    return $(element).style.display != 'none';
+  },
+
+  toggle: function(element) {
+    element = $(element);
+    Element[Element.visible(element) ? 'hide' : 'show'](element);
+    return element;
+  },
+
+  hide: function(element) {
+    $(element).style.display = 'none';
+    return element;
+  },
+
+  show: function(element) {
+    $(element).style.display = '';
+    return element;
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+    return element;
+  },
+
+  update: function(element, html) {
+    html = typeof html == 'undefined' ? '' : html.toString();
+    $(element).innerHTML = html.stripScripts();
+    setTimeout(function() {html.evalScripts()}, 10);
+    return element;
+  },
+
+  replace: function(element, html) {
+    element = $(element);
+    html = typeof html == 'undefined' ? '' : html.toString();
+    if (element.outerHTML) {
+      element.outerHTML = html.stripScripts();
+    } else {
+      var range = element.ownerDocument.createRange();
+      range.selectNodeContents(element);
+      element.parentNode.replaceChild(
+        range.createContextualFragment(html.stripScripts()), element);
+    }
+    setTimeout(function() {html.evalScripts()}, 10);
+    return element;
+  },
+
+  inspect: function(element) {
+    element = $(element);
+    var result = '<' + element.tagName.toLowerCase();
+    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+      var property = pair.first(), attribute = pair.last();
+      var value = (element[property] || '').toString();
+      if (value) result += ' ' + attribute + '=' + value.inspect(true);
+    });
+    return result + '>';
+  },
+
+  recursivelyCollect: function(element, property) {
+    element = $(element);
+    var elements = [];
+    while (element = element[property])
+      if (element.nodeType == 1)
+        elements.push(Element.extend(element));
+    return elements;
+  },
+
+  ancestors: function(element) {
+    return $(element).recursivelyCollect('parentNode');
+  },
+
+  descendants: function(element) {
+    return $A($(element).getElementsByTagName('*'));
+  },
+
+  immediateDescendants: function(element) {
+    if (!(element = $(element).firstChild)) return [];
+    while (element && element.nodeType != 1) element = element.nextSibling;
+    if (element) return [element].concat($(element).nextSiblings());
+    return [];
+  },
+
+  previousSiblings: function(element) {
+    return $(element).recursivelyCollect('previousSibling');
+  },
+
+  nextSiblings: function(element) {
+    return $(element).recursivelyCollect('nextSibling');
+  },
+
+  siblings: function(element) {
+    element = $(element);
+    return element.previousSiblings().reverse().concat(element.nextSiblings());
+  },
+
+  match: function(element, selector) {
+    if (typeof selector == 'string')
+      selector = new Selector(selector);
+    return selector.match($(element));
+  },
+
+  up: function(element, expression, index) {
+    return Selector.findElement($(element).ancestors(), expression, index);
+  },
+
+  down: function(element, expression, index) {
+    return Selector.findElement($(element).descendants(), expression, index);
+  },
+
+  previous: function(element, expression, index) {
+    return Selector.findElement($(element).previousSiblings(), expression, index);
+  },
+
+  next: function(element, expression, index) {
+    return Selector.findElement($(element).nextSiblings(), expression, index);
+  },
+
+  getElementsBySelector: function() {
+    var args = $A(arguments), element = $(args.shift());
+    return Selector.findChildElements(element, args);
+  },
+
+  getElementsByClassName: function(element, className) {
+    return document.getElementsByClassName(className, element);
+  },
+
+  readAttribute: function(element, name) {
+    element = $(element);
+    if (document.all && !window.opera) {
+      var t = Element._attributeTranslations;
+      if (t.values[name]) return t.values[name](element, name);
+      if (t.names[name])  name = t.names[name];
+      var attribute = element.attributes[name];
+      if(attribute) return attribute.nodeValue;
+    }
+    return element.getAttribute(name);
+  },
+
+  getHeight: function(element) {
+    return $(element).getDimensions().height;
+  },
+
+  getWidth: function(element) {
+    return $(element).getDimensions().width;
+  },
+
+  classNames: function(element) {
+    return new Element.ClassNames(element);
+  },
+
+  hasClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    var elementClassName = element.className;
+    if (elementClassName.length == 0) return false;
+    if (elementClassName == className ||
+        elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
+      return true;
+    return false;
+  },
+
+  addClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    Element.classNames(element).add(className);
+    return element;
+  },
+
+  removeClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    Element.classNames(element).remove(className);
+    return element;
+  },
+
+  toggleClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
+    return element;
+  },
+
+  observe: function() {
+    Event.observe.apply(Event, arguments);
+    return $A(arguments).first();
+  },
+
+  stopObserving: function() {
+    Event.stopObserving.apply(Event, arguments);
+    return $A(arguments).first();
+  },
+
+  // removes whitespace-only text node children
+  cleanWhitespace: function(element) {
+    element = $(element);
+    var node = element.firstChild;
+    while (node) {
+      var nextNode = node.nextSibling;
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+        element.removeChild(node);
+      node = nextNode;
+    }
+    return element;
+  },
+
+  empty: function(element) {
+    return $(element).innerHTML.match(/^\s*$/);
+  },
+
+  descendantOf: function(element, ancestor) {
+    element = $(element), ancestor = $(ancestor);
+    while (element = element.parentNode)
+      if (element == ancestor) return true;
+    return false;
+  },
+
+  scrollTo: function(element) {
+    element = $(element);
+    var pos = Position.cumulativeOffset(element);
+    window.scrollTo(pos[0], pos[1]);
+    return element;
+  },
+
+  getStyle: function(element, style) {
+    element = $(element);
+    if (['float','cssFloat'].include(style))
+      style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
+    style = style.camelize();
+    var value = element.style[style];
+    if (!value) {
+      if (document.defaultView && document.defaultView.getComputedStyle) {
+        var css = document.defaultView.getComputedStyle(element, null);
+        value = css ? css[style] : null;
+      } else if (element.currentStyle) {
+        value = element.currentStyle[style];
+      }
+    }
+
+    if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
+      value = element['offset'+style.capitalize()] + 'px';
+
+    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
+      if (Element.getStyle(element, 'position') == 'static') value = 'auto';
+    if(style == 'opacity') {
+      if(value) return parseFloat(value);
+      if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+        if(value[1]) return parseFloat(value[1]) / 100;
+      return 1.0;
+    }
+    return value == 'auto' ? null : value;
+  },
+
+  setStyle: function(element, style) {
+    element = $(element);
+    for (var name in style) {
+      var value = style[name];
+      if(name == 'opacity') {
+        if (value == 1) {
+          value = (/Gecko/.test(navigator.userAgent) &&
+            !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
+          if(/MSIE/.test(navigator.userAgent) && !window.opera)
+            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
+        } else if(value == '') {
+          if(/MSIE/.test(navigator.userAgent) && !window.opera)
+            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
+        } else {
+          if(value < 0.00001) value = 0;
+          if(/MSIE/.test(navigator.userAgent) && !window.opera)
+            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
+              'alpha(opacity='+value*100+')';
+        }
+      } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
+      element.style[name.camelize()] = value;
+    }
+    return element;
+  },
+
+  getDimensions: function(element) {
+    element = $(element);
+    var display = $(element).getStyle('display');
+    if (display != 'none' && display != null) // Safari bug
+      return {width: element.offsetWidth, height: element.offsetHeight};
+
+    // All *Width and *Height properties give 0 on elements with display none,
+    // so enable the element temporarily
+    var els = element.style;
+    var originalVisibility = els.visibility;
+    var originalPosition = els.position;
+    var originalDisplay = els.display;
+    els.visibility = 'hidden';
+    els.position = 'absolute';
+    els.display = 'block';
+    var originalWidth = element.clientWidth;
+    var originalHeight = element.clientHeight;
+    els.display = originalDisplay;
+    els.position = originalPosition;
+    els.visibility = originalVisibility;
+    return {width: originalWidth, height: originalHeight};
+  },
+
+  makePositioned: function(element) {
+    element = $(element);
+    var pos = Element.getStyle(element, 'position');
+    if (pos == 'static' || !pos) {
+      element._madePositioned = true;
+      element.style.position = 'relative';
+      // Opera returns the offset relative to the positioning context, when an
+      // element is position relative but top and left have not been defined
+      if (window.opera) {
+        element.style.top = 0;
+        element.style.left = 0;
+      }
+    }
+    return element;
+  },
+
+  undoPositioned: function(element) {
+    element = $(element);
+    if (element._madePositioned) {
+      element._madePositioned = undefined;
+      element.style.position =
+        element.style.top =
+        element.style.left =
+        element.style.bottom =
+        element.style.right = '';
+    }
+    return element;
+  },
+
+  makeClipping: function(element) {
+    element = $(element);
+    if (element._overflow) return element;
+    element._overflow = element.style.overflow || 'auto';
+    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
+      element.style.overflow = 'hidden';
+    return element;
+  },
+
+  undoClipping: function(element) {
+    element = $(element);
+    if (!element._overflow) return element;
+    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+    element._overflow = null;
+    return element;
+  }
+};
+
+Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf});
+
+Element._attributeTranslations = {};
+
+Element._attributeTranslations.names = {
+  colspan:   "colSpan",
+  rowspan:   "rowSpan",
+  valign:    "vAlign",
+  datetime:  "dateTime",
+  accesskey: "accessKey",
+  tabindex:  "tabIndex",
+  enctype:   "encType",
+  maxlength: "maxLength",
+  readonly:  "readOnly",
+  longdesc:  "longDesc"
+};
+
+Element._attributeTranslations.values = {
+  _getAttr: function(element, attribute) {
+    return element.getAttribute(attribute, 2);
+  },
+
+  _flag: function(element, attribute) {
+    return $(element).hasAttribute(attribute) ? attribute : null;
+  },
+
+  style: function(element) {
+    return element.style.cssText.toLowerCase();
+  },
+
+  title: function(element) {
+    var node = element.getAttributeNode('title');
+    return node.specified ? node.nodeValue : null;
+  }
+};
+
+Object.extend(Element._attributeTranslations.values, {
+  href: Element._attributeTranslations.values._getAttr,
+  src:  Element._attributeTranslations.values._getAttr,
+  disabled: Element._attributeTranslations.values._flag,
+  checked:  Element._attributeTranslations.values._flag,
+  readonly: Element._attributeTranslations.values._flag,
+  multiple: Element._attributeTranslations.values._flag
+});
+
+Element.Methods.Simulated = {
+  hasAttribute: function(element, attribute) {
+    var t = Element._attributeTranslations;
+    attribute = t.names[attribute] || attribute;
+    return $(element).getAttributeNode(attribute).specified;
+  }
+};
+
+// IE is missing .innerHTML support for TABLE-related elements
+if (document.all && !window.opera){
+  Element.Methods.update = function(element, html) {
+    element = $(element);
+    html = typeof html == 'undefined' ? '' : html.toString();
+    var tagName = element.tagName.toUpperCase();
+    if (['THEAD','TBODY','TR','TD'].include(tagName)) {
+      var div = document.createElement('div');
+      switch (tagName) {
+        case 'THEAD':
+        case 'TBODY':
+          div.innerHTML = '<table><tbody>' +  html.stripScripts() + '</tbody></table>';
+          depth = 2;
+          break;
+        case 'TR':
+          div.innerHTML = '<table><tbody><tr>' +  html.stripScripts() + '</tr></tbody></table>';
+          depth = 3;
+          break;
+        case 'TD':
+          div.innerHTML = '<table><tbody><tr><td>' +  html.stripScripts() + '</td></tr></tbody></table>';
+          depth = 4;
+      }
+      $A(element.childNodes).each(function(node){
+        element.removeChild(node)
+      });
+      depth.times(function(){ div = div.firstChild });
+
+      $A(div.childNodes).each(
+        function(node){ element.appendChild(node) });
+    } else {
+      element.innerHTML = html.stripScripts();
+    }
+    setTimeout(function() {html.evalScripts()}, 10);
+    return element;
+  }
+};
+
+Object.extend(Element, Element.Methods);
+
+var _nativeExtensions = false;
+
+if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
+  ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
+    var className = 'HTML' + tag + 'Element';
+    if(window[className]) return;
+    var klass = window[className] = {};
+    klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
+  });
+
+Element.addMethods = function(methods) {
+  Object.extend(Element.Methods, methods || {});
+
+  function copy(methods, destination, onlyIfAbsent) {
+    onlyIfAbsent = onlyIfAbsent || false;
+    var cache = Element.extend.cache;
+    for (var property in methods) {
+      var value = methods[property];
+      if (!onlyIfAbsent || !(property in destination))
+        destination[property] = cache.findOrStore(value);
+    }
+  }
+
+  if (typeof HTMLElement != 'undefined') {
+    copy(Element.Methods, HTMLElement.prototype);
+    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+    copy(Form.Methods, HTMLFormElement.prototype);
+    [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
+      copy(Form.Element.Methods, klass.prototype);
+    });
+    _nativeExtensions = true;
+  }
+}
+
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.Insertion = function(adjacency) {
+  this.adjacency = adjacency;
+}
+
+Abstract.Insertion.prototype = {
+  initialize: function(element, content) {
+    this.element = $(element);
+    this.content = content.stripScripts();
+
+    if (this.adjacency && this.element.insertAdjacentHTML) {
+      try {
+        this.element.insertAdjacentHTML(this.adjacency, this.content);
+      } catch (e) {
+        var tagName = this.element.tagName.toUpperCase();
+        if (['TBODY', 'TR'].include(tagName)) {
+          this.insertContent(this.contentFromAnonymousTable());
+        } else {
+          throw e;
+        }
+      }
+    } else {
+      this.range = this.element.ownerDocument.createRange();
+      if (this.initializeRange) this.initializeRange();
+      this.insertContent([this.range.createContextualFragment(this.content)]);
+    }
+
+    setTimeout(function() {content.evalScripts()}, 10);
+  },
+
+  contentFromAnonymousTable: function() {
+    var div = document.createElement('div');
+    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
+    return $A(div.childNodes[0].childNodes[0].childNodes);
+  }
+}
+
+var Insertion = new Object();
+
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+  initializeRange: function() {
+    this.range.setStartBefore(this.element);
+  },
+
+  insertContent: function(fragments) {
+    fragments.each((function(fragment) {
+      this.element.parentNode.insertBefore(fragment, this.element);
+    }).bind(this));
+  }
+});
+
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(true);
+  },
+
+  insertContent: function(fragments) {
+    fragments.reverse(false).each((function(fragment) {
+      this.element.insertBefore(fragment, this.element.firstChild);
+    }).bind(this));
+  }
+});
+
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(this.element);
+  },
+
+  insertContent: function(fragments) {
+    fragments.each((function(fragment) {
+      this.element.appendChild(fragment);
+    }).bind(this));
+  }
+});
+
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+  initializeRange: function() {
+    this.range.setStartAfter(this.element);
+  },
+
+  insertContent: function(fragments) {
+    fragments.each((function(fragment) {
+      this.element.parentNode.insertBefore(fragment,
+        this.element.nextSibling);
+    }).bind(this));
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+  initialize: function(element) {
+    this.element = $(element);
+  },
+
+  _each: function(iterator) {
+    this.element.className.split(/\s+/).select(function(name) {
+      return name.length > 0;
+    })._each(iterator);
+  },
+
+  set: function(className) {
+    this.element.className = className;
+  },
+
+  add: function(classNameToAdd) {
+    if (this.include(classNameToAdd)) return;
+    this.set($A(this).concat(classNameToAdd).join(' '));
+  },
+
+  remove: function(classNameToRemove) {
+    if (!this.include(classNameToRemove)) return;
+    this.set($A(this).without(classNameToRemove).join(' '));
+  },
+
+  toString: function() {
+    return $A(this).join(' ');
+  }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+var Selector = Class.create();
+Selector.prototype = {
+  initialize: function(expression) {
+    this.params = {classNames: []};
+    this.expression = expression.toString().strip();
+    this.parseExpression();
+    this.compileMatcher();
+  },
+
+  parseExpression: function() {
+    function abort(message) { throw 'Parse error in selector: ' + message; }
+
+    if (this.expression == '')  abort('empty expression');
+
+    var params = this.params, expr = this.expression, match, modifier, clause, rest;
+    while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
+      params.attributes = params.attributes || [];
+      params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
+      expr = match[1];
+    }
+
+    if (expr == '*') return this.params.wildcard = true;
+
+    while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
+      modifier = match[1], clause = match[2], rest = match[3];
+      switch (modifier) {
+        case '#':       params.id = clause; break;
+        case '.':       params.classNames.push(clause); break;
+        case '':
+        case undefined: params.tagName = clause.toUpperCase(); break;
+        default:        abort(expr.inspect());
+      }
+      expr = rest;
+    }
+
+    if (expr.length > 0) abort(expr.inspect());
+  },
+
+  buildMatchExpression: function() {
+    var params = this.params, conditions = [], clause;
+
+    if (params.wildcard)
+      conditions.push('true');
+    if (clause = params.id)
+      conditions.push('element.readAttribute("id") == ' + clause.inspect());
+    if (clause = params.tagName)
+      conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
+    if ((clause = params.classNames).length > 0)
+      for (var i = 0, length = clause.length; i < length; i++)
+        conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
+    if (clause = params.attributes) {
+      clause.each(function(attribute) {
+        var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
+        var splitValueBy = function(delimiter) {
+          return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
+        }
+
+        switch (attribute.operator) {
+          case '=':       conditions.push(value + ' == ' + attribute.value.inspect()); break;
+          case '~=':      conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
+          case '|=':      conditions.push(
+                            splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
+                          ); break;
+          case '!=':      conditions.push(value + ' != ' + attribute.value.inspect()); break;
+          case '':
+          case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
+          default:        throw 'Unknown operator ' + attribute.operator + ' in selector';
+        }
+      });
+    }
+
+    return conditions.join(' && ');
+  },
+
+  compileMatcher: function() {
+    this.match = new Function('element', 'if (!element.tagName) return false; \
+      element = $(element); \
+      return ' + this.buildMatchExpression());
+  },
+
+  findElements: function(scope) {
+    var element;
+
+    if (element = $(this.params.id))
+      if (this.match(element))
+        if (!scope || Element.childOf(element, scope))
+          return [element];
+
+    scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
+
+    var results = [];
+    for (var i = 0, length = scope.length; i < length; i++)
+      if (this.match(element = scope[i]))
+        results.push(Element.extend(element));
+
+    return results;
+  },
+
+  toString: function() {
+    return this.expression;
+  }
+}
+
+Object.extend(Selector, {
+  matchElements: function(elements, expression) {
+    var selector = new Selector(expression);
+    return elements.select(selector.match.bind(selector)).map(Element.extend);
+  },
+
+  findElement: function(elements, expression, index) {
+    if (typeof expression == 'number') index = expression, expression = false;
+    return Selector.matchElements(elements, expression || '*')[index || 0];
+  },
+
+  findChildElements: function(element, expressions) {
+    return expressions.map(function(expression) {
+      return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
+        var selector = new Selector(expr);
+        return results.inject([], function(elements, result) {
+          return elements.concat(selector.findElements(result || element));
+        });
+      });
+    }).flatten();
+  }
+});
+
+function $$() {
+  return Selector.findChildElements(document, $A(arguments));
+}
+var Form = {
+  reset: function(form) {
+    $(form).reset();
+    return form;
+  },
+
+  serializeElements: function(elements, getHash) {
+    var data = elements.inject({}, function(result, element) {
+      if (!element.disabled && element.name) {
+        var key = element.name, value = $(element).getValue();
+        if (value != undefined) {
+          if (result[key]) {
+            if (result[key].constructor != Array) result[key] = [result[key]];
+            result[key].push(value);
+          }
+          else result[key] = value;
+        }
+      }
+      return result;
+    });
+
+    return getHash ? data : Hash.toQueryString(data);
+  }
+};
+
+Form.Methods = {
+  serialize: function(form, getHash) {
+    return Form.serializeElements(Form.getElements(form), getHash);
+  },
+
+  getElements: function(form) {
+    return $A($(form).getElementsByTagName('*')).inject([],
+      function(elements, child) {
+        if (Form.Element.Serializers[child.tagName.toLowerCase()])
+          elements.push(Element.extend(child));
+        return elements;
+      }
+    );
+  },
+
+  getInputs: function(form, typeName, name) {
+    form = $(form);
+    var inputs = form.getElementsByTagName('input');
+
+    if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) || (name && input.name != name))
+        continue;
+      matchingInputs.push(Element.extend(input));
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    form = $(form);
+    form.getElements().each(function(element) {
+      element.blur();
+      element.disabled = 'true';
+    });
+    return form;
+  },
+
+  enable: function(form) {
+    form = $(form);
+    form.getElements().each(function(element) {
+      element.disabled = '';
+    });
+    return form;
+  },
+
+  findFirstElement: function(form) {
+    return $(form).getElements().find(function(element) {
+      return element.type != 'hidden' && !element.disabled &&
+        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+    });
+  },
+
+  focusFirstElement: function(form) {
+    form = $(form);
+    form.findFirstElement().activate();
+    return form;
+  }
+}
+
+Object.extend(Form, Form.Methods);
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element = {
+  focus: function(element) {
+    $(element).focus();
+    return element;
+  },
+
+  select: function(element) {
+    $(element).select();
+    return element;
+  }
+}
+
+Form.Element.Methods = {
+  serialize: function(element) {
+    element = $(element);
+    if (!element.disabled && element.name) {
+      var value = element.getValue();
+      if (value != undefined) {
+        var pair = {};
+        pair[element.name] = value;
+        return Hash.toQueryString(pair);
+      }
+    }
+    return '';
+  },
+
+  getValue: function(element) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    return Form.Element.Serializers[method](element);
+  },
+
+  clear: function(element) {
+    $(element).value = '';
+    return element;
+  },
+
+  present: function(element) {
+    return $(element).value != '';
+  },
+
+  activate: function(element) {
+    element = $(element);
+    element.focus();
+    if (element.select && ( element.tagName.toLowerCase() != 'input' ||
+      !['button', 'reset', 'submit'].include(element.type) ) )
+      element.select();
+    return element;
+  },
+
+  disable: function(element) {
+    element = $(element);
+    element.disabled = true;
+    return element;
+  },
+
+  enable: function(element) {
+    element = $(element);
+    element.blur();
+    element.disabled = false;
+    return element;
+  }
+}
+
+Object.extend(Form.Element, Form.Element.Methods);
+var Field = Form.Element;
+var $F = Form.Element.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = {
+  input: function(element) {
+    switch (element.type.toLowerCase()) {
+      case 'checkbox':
+      case 'radio':
+        return Form.Element.Serializers.inputSelector(element);
+      default:
+        return Form.Element.Serializers.textarea(element);
+    }
+  },
+
+  inputSelector: function(element) {
+    return element.checked ? element.value : null;
+  },
+
+  textarea: function(element) {
+    return element.value;
+  },
+
+  select: function(element) {
+    return this[element.type == 'select-one' ?
+      'selectOne' : 'selectMany'](element);
+  },
+
+  selectOne: function(element) {
+    var index = element.selectedIndex;
+    return index >= 0 ? this.optionValue(element.options[index]) : null;
+  },
+
+  selectMany: function(element) {
+    var values, length = element.length;
+    if (!length) return null;
+
+    for (var i = 0, values = []; i < length; i++) {
+      var opt = element.options[i];
+      if (opt.selected) values.push(this.optionValue(opt));
+    }
+    return values;
+  },
+
+  optionValue: function(opt) {
+    // extend element because hasAttribute may not be native
+    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+  initialize: function(element, frequency, callback) {
+    this.frequency = frequency;
+    this.element   = $(element);
+    this.callback  = callback;
+
+    this.lastValue = this.getValue();
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    var value = this.getValue();
+    var changed = ('string' == typeof this.lastValue && 'string' == typeof value
+      ? this.lastValue != value : String(this.lastValue) != String(value));
+    if (changed) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+}
+
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+
+  registerFormCallbacks: function() {
+    Form.getElements(this.element).each(this.registerCallback.bind(this));
+  },
+
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':
+        case 'radio':
+          Event.observe(element, 'click', this.onElementEvent.bind(this));
+          break;
+        default:
+          Event.observe(element, 'change', this.onElementEvent.bind(this));
+          break;
+      }
+    }
+  }
+}
+
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+if (!window.Event) {
+  var Event = new Object();
+}
+
+Object.extend(Event, {
+  KEY_BACKSPACE: 8,
+  KEY_TAB:       9,
+  KEY_RETURN:   13,
+  KEY_ESC:      27,
+  KEY_LEFT:     37,
+  KEY_UP:       38,
+  KEY_RIGHT:    39,
+  KEY_DOWN:     40,
+  KEY_DELETE:   46,
+  KEY_HOME:     36,
+  KEY_END:      35,
+  KEY_PAGEUP:   33,
+  KEY_PAGEDOWN: 34,
+
+  element: function(event) {
+    return event.target || event.srcElement;
+  },
+
+  isLeftClick: function(event) {
+    return (((event.which) && (event.which == 1)) ||
+            ((event.button) && (event.button == 1)));
+  },
+
+  pointerX: function(event) {
+    return event.pageX || (event.clientX +
+      (document.documentElement.scrollLeft || document.body.scrollLeft));
+  },
+
+  pointerY: function(event) {
+    return event.pageY || (event.clientY +
+      (document.documentElement.scrollTop || document.body.scrollTop));
+  },
+
+  stop: function(event) {
+    if (event.preventDefault) {
+      event.preventDefault();
+      event.stopPropagation();
+    } else {
+      event.returnValue = false;
+      event.cancelBubble = true;
+    }
+  },
+
+  // find the first node with the given tagName, starting from the
+  // node the event was triggered on; traverses the DOM upwards
+  findElement: function(event, tagName) {
+    var element = Event.element(event);
+    while (element.parentNode && (!element.tagName ||
+        (element.tagName.toUpperCase() != tagName.toUpperCase())))
+      element = element.parentNode;
+    return element;
+  },
+
+  observers: false,
+
+  _observeAndCache: function(element, name, observer, useCapture) {
+    if (!this.observers) this.observers = [];
+    if (element.addEventListener) {
+      this.observers.push([element, name, observer, useCapture]);
+      element.addEventListener(name, observer, useCapture);
+    } else if (element.attachEvent) {
+      this.observers.push([element, name, observer, useCapture]);
+      element.attachEvent('on' + name, observer);
+    }
+  },
+
+  unloadCache: function() {
+    if (!Event.observers) return;
+    for (var i = 0, length = Event.observers.length; i < length; i++) {
+      Event.stopObserving.apply(this, Event.observers[i]);
+      Event.observers[i][0] = null;
+    }
+    Event.observers = false;
+  },
+
+  observe: function(element, name, observer, useCapture) {
+    element = $(element);
+    useCapture = useCapture || false;
+
+    if (name == 'keypress' &&
+        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+        || element.attachEvent))
+      name = 'keydown';
+
+    Event._observeAndCache(element, name, observer, useCapture);
+  },
+
+  stopObserving: function(element, name, observer, useCapture) {
+    element = $(element);
+    useCapture = useCapture || false;
+
+    if (name == 'keypress' &&
+        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+        || element.detachEvent))
+      name = 'keydown';
+
+    if (element.removeEventListener) {
+      element.removeEventListener(name, observer, useCapture);
+    } else if (element.detachEvent) {
+      try {
+        element.detachEvent('on' + name, observer);
+      } catch (e) {}
+    }
+  }
+});
+
+/* prevent memory leaks in IE */
+if (navigator.appVersion.match(/\bMSIE\b/))
+  Event.observe(window, 'unload', Event.unloadCache, false);
+var Position = {
+  // set to true if needed, warning: firefox performance problems
+  // NOT neeeded for page scrolling, only if draggable contained in
+  // scrollable elements
+  includeScrollOffsets: false,
+
+  // must be called before calling withinIncludingScrolloffset, every time the
+  // page is scrolled
+  prepare: function() {
+    this.deltaX =  window.pageXOffset
+                || document.documentElement.scrollLeft
+                || document.body.scrollLeft
+                || 0;
+    this.deltaY =  window.pageYOffset
+                || document.documentElement.scrollTop
+                || document.body.scrollTop
+                || 0;
+  },
+
+  realOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0;
+      element = element.parentNode;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  cumulativeOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  positionedOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+      if (element) {
+        if(element.tagName=='BODY') break;
+        var p = Element.getStyle(element, 'position');
+        if (p == 'relative' || p == 'absolute') break;
+      }
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  offsetParent: function(element) {
+    if (element.offsetParent) return element.offsetParent;
+    if (element == document.body) return element;
+
+    while ((element = element.parentNode) && element != document.body)
+      if (Element.getStyle(element, 'position') != 'static')
+        return element;
+
+    return document.body;
+  },
+
+  // caches x/y coordinate pair to use with overlap
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = this.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] &&
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = this.realOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = this.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] &&
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  // within must be called directly before
+  overlap: function(mode, element) {
+    if (!mode) return 0;
+    if (mode == 'vertical')
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+        element.offsetWidth;
+  },
+
+  page: function(forElement) {
+    var valueT = 0, valueL = 0;
+
+    var element = forElement;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+
+      // Safari fix
+      if (element.offsetParent==document.body)
+        if (Element.getStyle(element,'position')=='absolute') break;
+
+    } while (element = element.offsetParent);
+
+    element = forElement;
+    do {
+      if (!window.opera || element.tagName=='BODY') {
+        valueT -= element.scrollTop  || 0;
+        valueL -= element.scrollLeft || 0;
+      }
+    } while (element = element.parentNode);
+
+    return [valueL, valueT];
+  },
+
+  clone: function(source, target) {
+    var options = Object.extend({
+      setLeft:    true,
+      setTop:     true,
+      setWidth:   true,
+      setHeight:  true,
+      offsetTop:  0,
+      offsetLeft: 0
+    }, arguments[2] || {})
+
+    // find page position of source
+    source = $(source);
+    var p = Position.page(source);
+
+    // find coordinate system to use
+    target = $(target);
+    var delta = [0, 0];
+    var parent = null;
+    // delta [0,0] will do fine with position: fixed elements,
+    // position:absolute needs offsetParent deltas
+    if (Element.getStyle(target,'position') == 'absolute') {
+      parent = Position.offsetParent(target);
+      delta = Position.page(parent);
+    }
+
+    // correct by body offsets (fixes Safari)
+    if (parent == document.body) {
+      delta[0] -= document.body.offsetLeft;
+      delta[1] -= document.body.offsetTop;
+    }
+
+    // set position
+    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
+    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
+    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
+    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
+  },
+
+  absolutize: function(element) {
+    element = $(element);
+    if (element.style.position == 'absolute') return;
+    Position.prepare();
+
+    var offsets = Position.positionedOffset(element);
+    var top     = offsets[1];
+    var left    = offsets[0];
+    var width   = element.clientWidth;
+    var height  = element.clientHeight;
+
+    element._originalLeft   = left - parseFloat(element.style.left  || 0);
+    element._originalTop    = top  - parseFloat(element.style.top || 0);
+    element._originalWidth  = element.style.width;
+    element._originalHeight = element.style.height;
+
+    element.style.position = 'absolute';
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.width  = width + 'px';
+    element.style.height = height + 'px';
+  },
+
+  relativize: function(element) {
+    element = $(element);
+    if (element.style.position == 'relative') return;
+    Position.prepare();
+
+    element.style.position = 'relative';
+    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
+    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.height = element._originalHeight;
+    element.style.width  = element._originalWidth;
+  }
+}
+
+// Safari returns margins on body which is incorrect if the child is absolutely
+// positioned.  For performance reasons, redefine Position.cumulativeOffset for
+// KHTML/WebKit only.
+if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
+  Position.cumulativeOffset = function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      if (element.offsetParent == document.body)
+        if (Element.getStyle(element, 'position') == 'absolute') break;
+
+      element = element.offsetParent;
+    } while (element);
+
+    return [valueL, valueT];
+  }
+}
+
+Element.addMethods();
+
+
+// ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
+
+// The rest of this file is the actual ray tracer written by Adam
+// Burmister. It's a concatenation of the following files:
+//
+//   flog/color.js
+//   flog/light.js
+//   flog/vector.js
+//   flog/ray.js
+//   flog/scene.js
+//   flog/material/basematerial.js
+//   flog/material/solid.js
+//   flog/material/chessboard.js
+//   flog/shape/baseshape.js
+//   flog/shape/sphere.js
+//   flog/shape/plane.js
+//   flog/intersectioninfo.js
+//   flog/camera.js
+//   flog/background.js
+//   flog/engine.js
+
+
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Color = Class.create();
+
+Flog.RayTracer.Color.prototype = {
+    red : 0.0,
+    green : 0.0,
+    blue : 0.0,
+
+    initialize : function(r, g, b) {
+        if(!r) r = 0.0;
+        if(!g) g = 0.0;
+        if(!b) b = 0.0;
+
+        this.red = r;
+        this.green = g;
+        this.blue = b;
+    },
+
+    add : function(c1, c2){
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red + c2.red;
+        result.green = c1.green + c2.green;
+        result.blue = c1.blue + c2.blue;
+
+        return result;
+    },
+
+    addScalar: function(c1, s){
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red + s;
+        result.green = c1.green + s;
+        result.blue = c1.blue + s;
+
+        result.limit();
+
+        return result;
+    },
+
+    subtract: function(c1, c2){
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red - c2.red;
+        result.green = c1.green - c2.green;
+        result.blue = c1.blue - c2.blue;
+
+        return result;
+    },
+
+    multiply : function(c1, c2) {
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red * c2.red;
+        result.green = c1.green * c2.green;
+        result.blue = c1.blue * c2.blue;
+
+        return result;
+    },
+
+    multiplyScalar : function(c1, f) {
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red * f;
+        result.green = c1.green * f;
+        result.blue = c1.blue * f;
+
+        return result;
+    },
+
+    divideFactor : function(c1, f) {
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red / f;
+        result.green = c1.green / f;
+        result.blue = c1.blue / f;
+
+        return result;
+    },
+
+    limit: function(){
+        this.red = (this.red > 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0;
+        this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0;
+        this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0;
+    },
+
+    distance : function(color) {
+        var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue);
+        return d;
+    },
+
+    blend: function(c1, c2, w){
+        var result = new Flog.RayTracer.Color(0,0,0);
+        result = Flog.RayTracer.Color.prototype.add(
+                    Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w),
+                    Flog.RayTracer.Color.prototype.multiplyScalar(c2, w)
+                  );
+        return result;
+    },
+
+    brightness : function() {
+        var r = Math.floor(this.red*255);
+        var g = Math.floor(this.green*255);
+        var b = Math.floor(this.blue*255);
+        return (r * 77 + g * 150 + b * 29) >> 8;
+    },
+
+    toString : function () {
+        var r = Math.floor(this.red*255);
+        var g = Math.floor(this.green*255);
+        var b = Math.floor(this.blue*255);
+
+        return "rgb("+ r +","+ g +","+ b +")";
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Light = Class.create();
+
+Flog.RayTracer.Light.prototype = {
+    position: null,
+    color: null,
+    intensity: 10.0,
+
+    initialize : function(pos, color, intensity) {
+        this.position = pos;
+        this.color = color;
+        this.intensity = (intensity ? intensity : 10.0);
+    },
+
+    getIntensity: function(distance){
+        if(distance >= intensity) return 0;
+
+        return Math.pow((intensity - distance) / strength, 0.2);
+    },
+
+    toString : function () {
+        return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Vector = Class.create();
+
+Flog.RayTracer.Vector.prototype = {
+    x : 0.0,
+    y : 0.0,
+    z : 0.0,
+
+    initialize : function(x, y, z) {
+        this.x = (x ? x : 0);
+        this.y = (y ? y : 0);
+        this.z = (z ? z : 0);
+    },
+
+    copy: function(vector){
+        this.x = vector.x;
+        this.y = vector.y;
+        this.z = vector.z;
+    },
+
+    normalize : function() {
+        var m = this.magnitude();
+        return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m);
+    },
+
+    magnitude : function() {
+        return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z));
+    },
+
+    cross : function(w) {
+        return new Flog.RayTracer.Vector(
+                                            -this.z * w.y + this.y * w.z,
+                                           this.z * w.x - this.x * w.z,
+                                          -this.y * w.x + this.x * w.y);
+    },
+
+    dot : function(w) {
+        return this.x * w.x + this.y * w.y + this.z * w.z;
+    },
+
+    add : function(v, w) {
+        return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z);
+    },
+
+    subtract : function(v, w) {
+        if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']';
+        return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z);
+    },
+
+    multiplyVector : function(v, w) {
+        return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z);
+    },
+
+    multiplyScalar : function(v, w) {
+        return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w);
+    },
+
+    toString : function () {
+        return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Ray = Class.create();
+
+Flog.RayTracer.Ray.prototype = {
+    position : null,
+    direction : null,
+    initialize : function(pos, dir) {
+        this.position = pos;
+        this.direction = dir;
+    },
+
+    toString : function () {
+        return 'Ray [' + this.position + ',' + this.direction + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Scene = Class.create();
+
+Flog.RayTracer.Scene.prototype = {
+    camera : null,
+    shapes : [],
+    lights : [],
+    background : null,
+
+    initialize : function() {
+        this.camera = new Flog.RayTracer.Camera(
+            new Flog.RayTracer.Vector(0,0,-5),
+            new Flog.RayTracer.Vector(0,0,1),
+            new Flog.RayTracer.Vector(0,1,0)
+        );
+        this.shapes = new Array();
+        this.lights = new Array();
+        this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2);
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {};
+
+Flog.RayTracer.Material.BaseMaterial = Class.create();
+
+Flog.RayTracer.Material.BaseMaterial.prototype = {
+
+    gloss: 2.0,             // [0...infinity] 0 = matt
+    transparency: 0.0,      // 0=opaque
+    reflection: 0.0,        // [0...infinity] 0 = no reflection
+    refraction: 0.50,
+    hasTexture: false,
+
+    initialize : function() {
+
+    },
+
+    getColor: function(u, v){
+
+    },
+
+    wrapUp: function(t){
+        t = t % 2.0;
+        if(t < -1) t += 2.0;
+        if(t >= 1) t -= 2.0;
+        return t;
+    },
+
+    toString : function () {
+        return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Material.Solid = Class.create();
+
+Flog.RayTracer.Material.Solid.prototype = Object.extend(
+    new Flog.RayTracer.Material.BaseMaterial(), {
+        initialize : function(color, reflection, refraction, transparency, gloss) {
+            this.color = color;
+            this.reflection = reflection;
+            this.transparency = transparency;
+            this.gloss = gloss;
+            this.hasTexture = false;
+        },
+
+        getColor: function(u, v){
+            return this.color;
+        },
+
+        toString : function () {
+            return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+        }
+    }
+);
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Material.Chessboard = Class.create();
+
+Flog.RayTracer.Material.Chessboard.prototype = Object.extend(
+    new Flog.RayTracer.Material.BaseMaterial(), {
+        colorEven: null,
+        colorOdd: null,
+        density: 0.5,
+
+        initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) {
+            this.colorEven = colorEven;
+            this.colorOdd = colorOdd;
+            this.reflection = reflection;
+            this.transparency = transparency;
+            this.gloss = gloss;
+            this.density = density;
+            this.hasTexture = true;
+        },
+
+        getColor: function(u, v){
+            var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density);
+
+            if(t < 0.0)
+                return this.colorEven;
+            else
+                return this.colorOdd;
+        },
+
+        toString : function () {
+            return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+        }
+    }
+);
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
+
+Flog.RayTracer.Shape.BaseShape = Class.create();
+
+Flog.RayTracer.Shape.BaseShape.prototype = {
+    position: null,
+    material: null,
+
+    initialize : function() {
+        this.position = new Vector(0,0,0);
+        this.material = new Flog.RayTracer.Material.SolidMaterial(
+            new Flog.RayTracer.Color(1,0,1),
+            0,
+            0,
+            0
+        );
+    },
+
+    toString : function () {
+        return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
+
+Flog.RayTracer.Shape.Sphere = Class.create();
+
+Flog.RayTracer.Shape.Sphere.prototype = {
+    initialize : function(pos, radius, material) {
+        this.radius = radius;
+        this.position = pos;
+        this.material = material;
+    },
+
+    intersect: function(ray){
+        var info = new Flog.RayTracer.IntersectionInfo();
+        info.shape = this;
+
+        var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position);
+
+        var B = dst.dot(ray.direction);
+        var C = dst.dot(dst) - (this.radius * this.radius);
+        var D = (B * B) - C;
+
+        if(D > 0){ // intersection!
+            info.isHit = true;
+            info.distance = (-B) - Math.sqrt(D);
+            info.position = Flog.RayTracer.Vector.prototype.add(
+                                                ray.position,
+                                                Flog.RayTracer.Vector.prototype.multiplyScalar(
+                                                    ray.direction,
+                                                    info.distance
+                                                )
+                                            );
+            info.normal = Flog.RayTracer.Vector.prototype.subtract(
+                                            info.position,
+                                            this.position
+                                        ).normalize();
+
+            info.color = this.material.getColor(0,0);
+        } else {
+            info.isHit = false;
+        }
+        return info;
+    },
+
+    toString : function () {
+        return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
+
+Flog.RayTracer.Shape.Plane = Class.create();
+
+Flog.RayTracer.Shape.Plane.prototype = {
+    d: 0.0,
+
+    initialize : function(pos, d, material) {
+        this.position = pos;
+        this.d = d;
+        this.material = material;
+    },
+
+    intersect: function(ray){
+        var info = new Flog.RayTracer.IntersectionInfo();
+
+        var Vd = this.position.dot(ray.direction);
+        if(Vd == 0) return info; // no intersection
+
+        var t = -(this.position.dot(ray.position) + this.d) / Vd;
+        if(t <= 0) return info;
+
+        info.shape = this;
+        info.isHit = true;
+        info.position = Flog.RayTracer.Vector.prototype.add(
+                                            ray.position,
+                                            Flog.RayTracer.Vector.prototype.multiplyScalar(
+                                                ray.direction,
+                                                t
+                                            )
+                                        );
+        info.normal = this.position;
+        info.distance = t;
+
+        if(this.material.hasTexture){
+            var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x);
+            var vV = vU.cross(this.position);
+            var u = info.position.dot(vU);
+            var v = info.position.dot(vV);
+            info.color = this.material.getColor(u,v);
+        } else {
+            info.color = this.material.getColor(0,0);
+        }
+
+        return info;
+    },
+
+    toString : function () {
+        return 'Plane [' + this.position + ', d=' + this.d + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.IntersectionInfo = Class.create();
+
+Flog.RayTracer.IntersectionInfo.prototype = {
+    isHit: false,
+    hitCount: 0,
+    shape: null,
+    position: null,
+    normal: null,
+    color: null,
+    distance: null,
+
+    initialize : function() {
+        this.color = new Flog.RayTracer.Color(0,0,0);
+    },
+
+    toString : function () {
+        return 'Intersection [' + this.position + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Camera = Class.create();
+
+Flog.RayTracer.Camera.prototype = {
+    position: null,
+    lookAt: null,
+    equator: null,
+    up: null,
+    screen: null,
+
+    initialize : function(pos, lookAt, up) {
+        this.position = pos;
+        this.lookAt = lookAt;
+        this.up = up;
+        this.equator = lookAt.normalize().cross(this.up);
+        this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt);
+    },
+
+    getRay: function(vx, vy){
+        var pos = Flog.RayTracer.Vector.prototype.subtract(
+            this.screen,
+            Flog.RayTracer.Vector.prototype.subtract(
+                Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx),
+                Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy)
+            )
+        );
+        pos.y = pos.y * -1;
+        var dir = Flog.RayTracer.Vector.prototype.subtract(
+            pos,
+            this.position
+        );
+
+        var ray = new Flog.RayTracer.Ray(pos, dir.normalize());
+
+        return ray;
+    },
+
+    toString : function () {
+        return 'Ray []';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Background = Class.create();
+
+Flog.RayTracer.Background.prototype = {
+    color : null,
+    ambience : 0.0,
+
+    initialize : function(color, ambience) {
+        this.color = color;
+        this.ambience = ambience;
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Engine = Class.create();
+
+Flog.RayTracer.Engine.prototype = {
+    canvas: null, /* 2d context we can render to */
+
+    initialize: function(options){
+        this.options = Object.extend({
+                canvasHeight: 100,
+                canvasWidth: 100,
+                pixelWidth: 2,
+                pixelHeight: 2,
+                renderDiffuse: false,
+                renderShadows: false,
+                renderHighlights: false,
+                renderReflections: false,
+                rayDepth: 2
+            }, options || {});
+
+        this.options.canvasHeight /= this.options.pixelHeight;
+        this.options.canvasWidth /= this.options.pixelWidth;
+
+        /* TODO: dynamically include other scripts */
+    },
+
+    setPixel: function(x, y, color){
+        var pxW, pxH;
+        pxW = this.options.pixelWidth;
+        pxH = this.options.pixelHeight;
+
+        if (this.canvas) {
+          this.canvas.fillStyle = color.toString();
+          this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH);
+        } else {
+          if (x ===  y) {
+            checkNumber += color.brightness();
+          }
+          // print(x * pxW, y * pxH, pxW, pxH);
+        }
+    },
+
+    renderScene: function(scene, canvas){
+        checkNumber = 0;
+        /* Get canvas */
+        if (canvas) {
+          this.canvas = canvas.getContext("2d");
+        } else {
+          this.canvas = null;
+        }
+
+        var canvasHeight = this.options.canvasHeight;
+        var canvasWidth = this.options.canvasWidth;
+
+        for(var y=0; y < canvasHeight; y++){
+            for(var x=0; x < canvasWidth; x++){
+                var yp = y * 1.0 / canvasHeight * 2 - 1;
+          		var xp = x * 1.0 / canvasWidth * 2 - 1;
+
+          		var ray = scene.camera.getRay(xp, yp);
+
+          		var color = this.getPixelColor(ray, scene);
+
+            	this.setPixel(x, y, color);
+            }
+        }
+        if (checkNumber !== 2321) {
+          throw new Error("Scene rendered incorrectly");
+        }
+    },
+
+    getPixelColor: function(ray, scene){
+        var info = this.testIntersection(ray, scene, null);
+        if(info.isHit){
+            var color = this.rayTrace(info, ray, scene, 0);
+            return color;
+        }
+        return scene.background.color;
+    },
+
+    testIntersection: function(ray, scene, exclude){
+        var hits = 0;
+        var best = new Flog.RayTracer.IntersectionInfo();
+        best.distance = 2000;
+
+        for(var i=0; i<scene.shapes.length; i++){
+            var shape = scene.shapes[i];
+
+            if(shape != exclude){
+                var info = shape.intersect(ray);
+                if(info.isHit && info.distance >= 0 && info.distance < best.distance){
+                    best = info;
+                    hits++;
+                }
+            }
+        }
+        best.hitCount = hits;
+        return best;
+    },
+
+    getReflectionRay: function(P,N,V){
+        var c1 = -N.dot(V);
+        var R1 = Flog.RayTracer.Vector.prototype.add(
+            Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1),
+            V
+        );
+        return new Flog.RayTracer.Ray(P, R1);
+    },
+
+    rayTrace: function(info, ray, scene, depth){
+        // Calc ambient
+        var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience);
+        var oldColor = color;
+        var shininess = Math.pow(10, info.shape.material.gloss + 1);
+
+        for(var i=0; i<scene.lights.length; i++){
+            var light = scene.lights[i];
+
+            // Calc diffuse lighting
+            var v = Flog.RayTracer.Vector.prototype.subtract(
+                                light.position,
+                                info.position
+                            ).normalize();
+
+            if(this.options.renderDiffuse){
+                var L = v.dot(info.normal);
+                if(L > 0.0){
+                    color = Flog.RayTracer.Color.prototype.add(
+                                        color,
+                                        Flog.RayTracer.Color.prototype.multiply(
+                                            info.color,
+                                            Flog.RayTracer.Color.prototype.multiplyScalar(
+                                                light.color,
+                                                L
+                                            )
+                                        )
+                                    );
+                }
+            }
+
+            // The greater the depth the more accurate the colours, but
+            // this is exponentially (!) expensive
+            if(depth <= this.options.rayDepth){
+          // calculate reflection ray
+          if(this.options.renderReflections && info.shape.material.reflection > 0)
+          {
+              var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction);
+              var refl = this.testIntersection(reflectionRay, scene, info.shape);
+
+              if (refl.isHit && refl.distance > 0){
+                  refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1);
+              } else {
+                  refl.color = scene.background.color;
+                        }
+
+                  color = Flog.RayTracer.Color.prototype.blend(
+                    color,
+                    refl.color,
+                    info.shape.material.reflection
+                  );
+          }
+
+                // Refraction
+                /* TODO */
+            }
+
+            /* Render shadows and highlights */
+
+            var shadowInfo = new Flog.RayTracer.IntersectionInfo();
+
+            if(this.options.renderShadows){
+                var shadowRay = new Flog.RayTracer.Ray(info.position, v);
+
+                shadowInfo = this.testIntersection(shadowRay, scene, info.shape);
+                if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){
+                    var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5);
+                    var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5));
+                    color = Flog.RayTracer.Color.prototype.addScalar(vA,dB);
+                }
+            }
+
+      // Phong specular highlights
+      if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){
+        var Lv = Flog.RayTracer.Vector.prototype.subtract(
+                            info.shape.position,
+                            light.position
+                        ).normalize();
+
+        var E = Flog.RayTracer.Vector.prototype.subtract(
+                            scene.camera.position,
+                            info.shape.position
+                        ).normalize();
+
+        var H = Flog.RayTracer.Vector.prototype.subtract(
+                            E,
+                            Lv
+                        ).normalize();
+
+        var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess);
+        color = Flog.RayTracer.Color.prototype.add(
+                            Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight),
+                            color
+                        );
+      }
+        }
+        color.limit();
+        return color;
+    }
+};
+
+
+function renderScene(){
+    var scene = new Flog.RayTracer.Scene();
+
+    scene.camera = new Flog.RayTracer.Camera(
+                        new Flog.RayTracer.Vector(0, 0, -15),
+                        new Flog.RayTracer.Vector(-0.2, 0, 5),
+                        new Flog.RayTracer.Vector(0, 1, 0)
+                    );
+
+    scene.background = new Flog.RayTracer.Background(
+                                new Flog.RayTracer.Color(0.5, 0.5, 0.5),
+                                0.4
+                            );
+
+    var sphere = new Flog.RayTracer.Shape.Sphere(
+        new Flog.RayTracer.Vector(-1.5, 1.5, 2),
+        1.5,
+        new Flog.RayTracer.Material.Solid(
+            new Flog.RayTracer.Color(0,0.5,0.5),
+            0.3,
+            0.0,
+            0.0,
+            2.0
+        )
+    );
+
+    var sphere1 = new Flog.RayTracer.Shape.Sphere(
+        new Flog.RayTracer.Vector(1, 0.25, 1),
+        0.5,
+        new Flog.RayTracer.Material.Solid(
+            new Flog.RayTracer.Color(0.9,0.9,0.9),
+            0.1,
+            0.0,
+            0.0,
+            1.5
+        )
+    );
+
+    var plane = new Flog.RayTracer.Shape.Plane(
+                                new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(),
+                                1.2,
+                                new Flog.RayTracer.Material.Chessboard(
+                                    new Flog.RayTracer.Color(1,1,1),
+                                    new Flog.RayTracer.Color(0,0,0),
+                                    0.2,
+                                    0.0,
+                                    1.0,
+                                    0.7
+                                )
+                            );
+
+    scene.shapes.push(plane);
+    scene.shapes.push(sphere);
+    scene.shapes.push(sphere1);
+
+    var light = new Flog.RayTracer.Light(
+        new Flog.RayTracer.Vector(5, 10, -1),
+        new Flog.RayTracer.Color(0.8, 0.8, 0.8)
+    );
+
+    var light1 = new Flog.RayTracer.Light(
+        new Flog.RayTracer.Vector(-3, 5, -15),
+        new Flog.RayTracer.Color(0.8, 0.8, 0.8),
+        100
+    );
+
+    scene.lights.push(light);
+    scene.lights.push(light1);
+
+    var imageWidth = 100; // $F('imageWidth');
+    var imageHeight = 100; // $F('imageHeight');
+    var pixelSize = "5,5".split(','); //  $F('pixelSize').split(',');
+    var renderDiffuse = true; // $F('renderDiffuse');
+    var renderShadows = true; // $F('renderShadows');
+    var renderHighlights = true; // $F('renderHighlights');
+    var renderReflections = true; // $F('renderReflections');
+    var rayDepth = 2;//$F('rayDepth');
+
+    var raytracer = new Flog.RayTracer.Engine(
+        {
+            canvasWidth: imageWidth,
+            canvasHeight: imageHeight,
+            pixelWidth: pixelSize[0],
+            pixelHeight: pixelSize[1],
+            "renderDiffuse": renderDiffuse,
+            "renderHighlights": renderHighlights,
+            "renderShadows": renderShadows,
+            "renderReflections": renderReflections,
+            "rayDepth": rayDepth
+        }
+    );
+
+    raytracer.renderScene(scene, null, 0);
+}
+
+window.onload = function(){
+startTest("v8-raytrace", '');
+
+test("RayTrace", renderScene);
+
+endTest();
+};
+</script>
+</body>
+</html>
diff --git a/tests/v8-richards.html b/tests/v8-richards.html
new file mode 100644
index 0000000..6fb8ce6
--- /dev/null
+++ b/tests/v8-richards.html
@@ -0,0 +1,549 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+// This is a JavaScript implementation of the Richards
+// benchmark from:
+//
+//    http://www.cl.cam.ac.uk/~mr10/Bench.html
+// 
+// The benchmark was originally implemented in BCPL by
+// Martin Richards.
+
+
+window.onload = function(){ startTest("v8-richards", '');
+
+test("Richards", runRichards);
+
+endTest(); };
+
+
+/**
+ * The Richards benchmark simulates the task dispatcher of an
+ * operating system.
+ **/
+function runRichards() {
+  var scheduler = new Scheduler();
+  scheduler.addIdleTask(ID_IDLE, 0, null, COUNT);
+
+  var queue = new Packet(null, ID_WORKER, KIND_WORK);
+  queue = new Packet(queue,  ID_WORKER, KIND_WORK);
+  scheduler.addWorkerTask(ID_WORKER, 1000, queue);
+
+  queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE);
+  queue = new Packet(queue,  ID_DEVICE_A, KIND_DEVICE);
+  queue = new Packet(queue,  ID_DEVICE_A, KIND_DEVICE);
+  scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue);
+
+  queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE);
+  queue = new Packet(queue,  ID_DEVICE_B, KIND_DEVICE);
+  queue = new Packet(queue,  ID_DEVICE_B, KIND_DEVICE);
+  scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue);
+
+  scheduler.addDeviceTask(ID_DEVICE_A, 4000, null);
+
+  scheduler.addDeviceTask(ID_DEVICE_B, 5000, null);
+
+  scheduler.schedule();
+
+  if (scheduler.queueCount != EXPECTED_QUEUE_COUNT ||
+      scheduler.holdCount != EXPECTED_HOLD_COUNT) {
+    var msg =
+        "Error during execution: queueCount = " + scheduler.queueCount +
+        ", holdCount = " + scheduler.holdCount + ".";
+    throw new Error(msg);
+  }
+}
+
+var COUNT = 1000;
+
+/**
+ * These two constants specify how many times a packet is queued and
+ * how many times a task is put on hold in a correct run of richards.
+ * They don't have any meaning a such but are characteristic of a
+ * correct run so if the actual queue or hold count is different from
+ * the expected there must be a bug in the implementation.
+ **/
+var EXPECTED_QUEUE_COUNT = 2322;
+var EXPECTED_HOLD_COUNT = 928;
+
+
+/**
+ * A scheduler can be used to schedule a set of tasks based on their relative
+ * priorities.  Scheduling is done by maintaining a list of task control blocks
+ * which holds tasks and the data queue they are processing.
+ * @constructor
+ */
+function Scheduler() {
+  this.queueCount = 0;
+  this.holdCount = 0;
+  this.blocks = new Array(NUMBER_OF_IDS);
+  this.list = null;
+  this.currentTcb = null;
+  this.currentId = null;
+}
+
+var ID_IDLE       = 0;
+var ID_WORKER     = 1;
+var ID_HANDLER_A  = 2;
+var ID_HANDLER_B  = 3;
+var ID_DEVICE_A   = 4;
+var ID_DEVICE_B   = 5;
+var NUMBER_OF_IDS = 6;
+
+var KIND_DEVICE   = 0;
+var KIND_WORK     = 1;
+
+/**
+ * Add an idle task to this scheduler.
+ * @param {int} id the identity of the task
+ * @param {int} priority the task's priority
+ * @param {Packet} queue the queue of work to be processed by the task
+ * @param {int} count the number of times to schedule the task
+ */
+Scheduler.prototype.addIdleTask = function (id, priority, queue, count) {
+  this.addRunningTask(id, priority, queue, new IdleTask(this, 1, count));
+};
+
+/**
+ * Add a work task to this scheduler.
+ * @param {int} id the identity of the task
+ * @param {int} priority the task's priority
+ * @param {Packet} queue the queue of work to be processed by the task
+ */
+Scheduler.prototype.addWorkerTask = function (id, priority, queue) {
+  this.addTask(id, priority, queue, new WorkerTask(this, ID_HANDLER_A, 0));
+};
+
+/**
+ * Add a handler task to this scheduler.
+ * @param {int} id the identity of the task
+ * @param {int} priority the task's priority
+ * @param {Packet} queue the queue of work to be processed by the task
+ */
+Scheduler.prototype.addHandlerTask = function (id, priority, queue) {
+  this.addTask(id, priority, queue, new HandlerTask(this));
+};
+
+/**
+ * Add a handler task to this scheduler.
+ * @param {int} id the identity of the task
+ * @param {int} priority the task's priority
+ * @param {Packet} queue the queue of work to be processed by the task
+ */
+Scheduler.prototype.addDeviceTask = function (id, priority, queue) {
+  this.addTask(id, priority, queue, new DeviceTask(this))
+};
+
+/**
+ * Add the specified task and mark it as running.
+ * @param {int} id the identity of the task
+ * @param {int} priority the task's priority
+ * @param {Packet} queue the queue of work to be processed by the task
+ * @param {Task} task the task to add
+ */
+Scheduler.prototype.addRunningTask = function (id, priority, queue, task) {
+  this.addTask(id, priority, queue, task);
+  this.currentTcb.setRunning();
+};
+
+/**
+ * Add the specified task to this scheduler.
+ * @param {int} id the identity of the task
+ * @param {int} priority the task's priority
+ * @param {Packet} queue the queue of work to be processed by the task
+ * @param {Task} task the task to add
+ */
+Scheduler.prototype.addTask = function (id, priority, queue, task) {
+  this.currentTcb = new TaskControlBlock(this.list, id, priority, queue, task);
+  this.list = this.currentTcb;
+  this.blocks[id] = this.currentTcb;
+};
+
+/**
+ * Execute the tasks managed by this scheduler.
+ */
+Scheduler.prototype.schedule = function () {
+  this.currentTcb = this.list;
+  while (this.currentTcb != null) {
+    if (this.currentTcb.isHeldOrSuspended()) {
+      this.currentTcb = this.currentTcb.link;
+    } else {
+      this.currentId = this.currentTcb.id;
+      this.currentTcb = this.currentTcb.run();
+    }
+  }
+};
+
+/**
+ * Release a task that is currently blocked and return the next block to run.
+ * @param {int} id the id of the task to suspend
+ */
+Scheduler.prototype.release = function (id) {
+  var tcb = this.blocks[id];
+  if (tcb == null) return tcb;
+  tcb.markAsNotHeld();
+  if (tcb.priority > this.currentTcb.priority) {
+    return tcb;
+  } else {
+    return this.currentTcb;
+  }
+};
+
+/**
+ * Block the currently executing task and return the next task control block
+ * to run.  The blocked task will not be made runnable until it is explicitly
+ * released, even if new work is added to it.
+ */
+Scheduler.prototype.holdCurrent = function () {
+  this.holdCount++;
+  this.currentTcb.markAsHeld();
+  return this.currentTcb.link;
+};
+
+/**
+ * Suspend the currently executing task and return the next task control block
+ * to run.  If new work is added to the suspended task it will be made runnable.
+ */
+Scheduler.prototype.suspendCurrent = function () {
+  this.currentTcb.markAsSuspended();
+  return this.currentTcb;
+};
+
+/**
+ * Add the specified packet to the end of the worklist used by the task
+ * associated with the packet and make the task runnable if it is currently
+ * suspended.
+ * @param {Packet} packet the packet to add
+ */
+Scheduler.prototype.queue = function (packet) {
+  var t = this.blocks[packet.id];
+  if (t == null) return t;
+  this.queueCount++;
+  packet.link = null;
+  packet.id = this.currentId;
+  return t.checkPriorityAdd(this.currentTcb, packet);
+};
+
+/**
+ * A task control block manages a task and the queue of work packages associated
+ * with it.
+ * @param {TaskControlBlock} link the preceding block in the linked block list
+ * @param {int} id the id of this block
+ * @param {int} priority the priority of this block
+ * @param {Packet} queue the queue of packages to be processed by the task
+ * @param {Task} task the task
+ * @constructor
+ */
+function TaskControlBlock(link, id, priority, queue, task) {
+  this.link = link;
+  this.id = id;
+  this.priority = priority;
+  this.queue = queue;
+  this.task = task;
+  if (queue == null) {
+    this.state = STATE_SUSPENDED;
+  } else {
+    this.state = STATE_SUSPENDED_RUNNABLE;
+  }
+}
+
+/**
+ * The task is running and is currently scheduled.
+ */
+var STATE_RUNNING = 0;
+
+/**
+ * The task has packets left to process.
+ */
+var STATE_RUNNABLE = 1;
+
+/**
+ * The task is not currently running.  The task is not blocked as such and may
+* be started by the scheduler.
+ */
+var STATE_SUSPENDED = 2;
+
+/**
+ * The task is blocked and cannot be run until it is explicitly released.
+ */
+var STATE_HELD = 4;
+
+var STATE_SUSPENDED_RUNNABLE = STATE_SUSPENDED | STATE_RUNNABLE;
+var STATE_NOT_HELD = ~STATE_HELD;
+
+TaskControlBlock.prototype.setRunning = function () {
+  this.state = STATE_RUNNING;
+};
+
+TaskControlBlock.prototype.markAsNotHeld = function () {
+  this.state = this.state & STATE_NOT_HELD;
+};
+
+TaskControlBlock.prototype.markAsHeld = function () {
+  this.state = this.state | STATE_HELD;
+};
+
+TaskControlBlock.prototype.isHeldOrSuspended = function () {
+  return (this.state & STATE_HELD) != 0 || (this.state == STATE_SUSPENDED);
+};
+
+TaskControlBlock.prototype.markAsSuspended = function () {
+  this.state = this.state | STATE_SUSPENDED;
+};
+
+TaskControlBlock.prototype.markAsRunnable = function () {
+  this.state = this.state | STATE_RUNNABLE;
+};
+
+/**
+ * Runs this task, if it is ready to be run, and returns the next task to run.
+ */
+TaskControlBlock.prototype.run = function () {
+  var packet;
+  if (this.state == STATE_SUSPENDED_RUNNABLE) {
+    packet = this.queue;
+    this.queue = packet.link;
+    if (this.queue == null) {
+      this.state = STATE_RUNNING;
+    } else {
+      this.state = STATE_RUNNABLE;
+    }
+  } else {
+    packet = null;
+  }
+  return this.task.run(packet);
+};
+
+/**
+ * Adds a packet to the worklist of this block's task, marks this as runnable if
+ * necessary, and returns the next runnable object to run (the one
+ * with the highest priority).
+ */
+TaskControlBlock.prototype.checkPriorityAdd = function (task, packet) {
+  if (this.queue == null) {
+    this.queue = packet;
+    this.markAsRunnable();
+    if (this.priority > task.priority) return this;
+  } else {
+    this.queue = packet.addTo(this.queue);
+  }
+  return task;
+};
+
+TaskControlBlock.prototype.toString = function () {
+  return "tcb { " + this.task + "@" + this.state + " }";
+};
+
+/**
+ * An idle task doesn't do any work itself but cycles control between the two
+ * device tasks.
+ * @param {Scheduler} scheduler the scheduler that manages this task
+ * @param {int} v1 a seed value that controls how the device tasks are scheduled
+ * @param {int} count the number of times this task should be scheduled
+ * @constructor
+ */
+function IdleTask(scheduler, v1, count) {
+  this.scheduler = scheduler;
+  this.v1 = v1;
+  this.count = count;
+}
+
+IdleTask.prototype.run = function (packet) {
+  this.count--;
+  if (this.count == 0) return this.scheduler.holdCurrent();
+  if ((this.v1 & 1) == 0) {
+    this.v1 = this.v1 >> 1;
+    return this.scheduler.release(ID_DEVICE_A);
+  } else {
+    this.v1 = (this.v1 >> 1) ^ 0xD008;
+    return this.scheduler.release(ID_DEVICE_B);
+  }
+};
+
+IdleTask.prototype.toString = function () {
+  return "IdleTask"
+};
+
+/**
+ * A task that suspends itself after each time it has been run to simulate
+ * waiting for data from an external device.
+ * @param {Scheduler} scheduler the scheduler that manages this task
+ * @constructor
+ */
+function DeviceTask(scheduler) {
+  this.scheduler = scheduler;
+  this.v1 = null;
+}
+
+DeviceTask.prototype.run = function (packet) {
+  if (packet == null) {
+    if (this.v1 == null) return this.scheduler.suspendCurrent();
+    var v = this.v1;
+    this.v1 = null;
+    return this.scheduler.queue(v);
+  } else {
+    this.v1 = packet;
+    return this.scheduler.holdCurrent();
+  }
+};
+
+DeviceTask.prototype.toString = function () {
+  return "DeviceTask";
+};
+
+/**
+ * A task that manipulates work packets.
+ * @param {Scheduler} scheduler the scheduler that manages this task
+ * @param {int} v1 a seed used to specify how work packets are manipulated
+ * @param {int} v2 another seed used to specify how work packets are manipulated
+ * @constructor
+ */
+function WorkerTask(scheduler, v1, v2) {
+  this.scheduler = scheduler;
+  this.v1 = v1;
+  this.v2 = v2;
+}
+
+WorkerTask.prototype.run = function (packet) {
+  if (packet == null) {
+    return this.scheduler.suspendCurrent();
+  } else {
+    if (this.v1 == ID_HANDLER_A) {
+      this.v1 = ID_HANDLER_B;
+    } else {
+      this.v1 = ID_HANDLER_A;
+    }
+    packet.id = this.v1;
+    packet.a1 = 0;
+    for (var i = 0; i < DATA_SIZE; i++) {
+      this.v2++;
+      if (this.v2 > 26) this.v2 = 1;
+      packet.a2[i] = this.v2;
+    }
+    return this.scheduler.queue(packet);
+  }
+};
+
+WorkerTask.prototype.toString = function () {
+  return "WorkerTask";
+};
+
+/**
+ * A task that manipulates work packets and then suspends itself.
+ * @param {Scheduler} scheduler the scheduler that manages this task
+ * @constructor
+ */
+function HandlerTask(scheduler) {
+  this.scheduler = scheduler;
+  this.v1 = null;
+  this.v2 = null;
+}
+
+HandlerTask.prototype.run = function (packet) {
+  if (packet != null) {
+    if (packet.kind == KIND_WORK) {
+      this.v1 = packet.addTo(this.v1);
+    } else {
+      this.v2 = packet.addTo(this.v2);
+    }
+  }
+  if (this.v1 != null) {
+    var count = this.v1.a1;
+    var v;
+    if (count < DATA_SIZE) {
+      if (this.v2 != null) {
+        v = this.v2;
+        this.v2 = this.v2.link;
+        v.a1 = this.v1.a2[count];
+        this.v1.a1 = count + 1;
+        return this.scheduler.queue(v);
+      }
+    } else {
+      v = this.v1;
+      this.v1 = this.v1.link;
+      return this.scheduler.queue(v);
+    }
+  }
+  return this.scheduler.suspendCurrent();
+};
+
+HandlerTask.prototype.toString = function () {
+  return "HandlerTask";
+};
+
+/* --- *
+ * P a c k e t
+ * --- */
+
+var DATA_SIZE = 4;
+
+/**
+ * A simple package of data that is manipulated by the tasks.  The exact layout
+ * of the payload data carried by a packet is not importaint, and neither is the
+ * nature of the work performed on packets by the tasks.
+ *
+ * Besides carrying data, packets form linked lists and are hence used both as
+ * data and worklists.
+ * @param {Packet} link the tail of the linked list of packets
+ * @param {int} id an ID for this packet
+ * @param {int} kind the type of this packet
+ * @constructor
+ */
+function Packet(link, id, kind) {
+  this.link = link;
+  this.id = id;
+  this.kind = kind;
+  this.a1 = 0;
+  this.a2 = new Array(DATA_SIZE);
+}
+
+/**
+ * Add this packet to the end of a worklist, and return the worklist.
+ * @param {Packet} queue the worklist to add this packet to
+ */
+Packet.prototype.addTo = function (queue) {
+  this.link = null;
+  if (queue == null) return this;
+  var peek, next = queue;
+  while ((peek = next.link) != null)
+    next = peek;
+  next.link = this;
+  return queue;
+};
+
+Packet.prototype.toString = function () {
+  return "Packet";
+};
+</script>
+</head>
+<body></body>
+</html>
diff --git a/web-style.css b/web-style.css
new file mode 100644
index 0000000..c439dc0
--- /dev/null
+++ b/web-style.css
@@ -0,0 +1,24 @@
+
+a { color: orange; }
+div.test { overflow: hidden; margin: 4px; }
+div.test b { display: block; float: left; width: 150px; text-align: right; margin-right: 10px; }
+div.bar { float: left; width: 400px; border: 1px inset; text-align: left; }
+div.bar div { height: 1em; background: url(orange-stripe.png); }
+div.bar span { padding-left: 5px; padding-right: 5px; }
+body { font-family: Arial; font-size: 12px; background: url(gray-stripe.png); text-align: center; }
+
+/*#main { margin: 0 auto; width: 600px; padding: 10px; background: #FFF; }*/
+
+ol.results { text-align: left; display: none; font-size: 10px; margin-left: 120px; list-style: none; }
+ol.results li { clear: both; overflow: auto; }
+ol.results b { display: block; width: 200px; float: left; text-align: right; padding-right: 15px; }
+#info, div.results { clear:both;width:420px;margin:10 auto;text-align:left; padding: 10px 10px 10px 110px; }
+#info span { background: #FFF; color: #000; padding: 8px 4px 4px 4px; }
+h1 { text-align: left; }
+h1 img { float:left;margin-right: 15px;margin-top: -10px; border: 0; }
+h1 small { font-weight:normal; }
+iframe { display: none; }
+div.resultwrap { text-align: center; }
+table.results { font-size: 12px; margin: 0 auto; }
+table.results td, table.results th.name { text-align: right; }
+table.results .winner { background-color: #c7331d; }
diff --git a/webrunner.js b/webrunner.js
new file mode 100644
index 0000000..faaf514
--- /dev/null
+++ b/webrunner.js
@@ -0,0 +1,760 @@
+(function(){
+	
+	// Populated from: http://www.medcalc.be/manual/t-distribution.php
+	// 95% confidence for N - 1 = 4
+	var tDistribution = 2.776;
+	
+	// The number of individual test iterations to do
+	var numTests = 5;
+	
+	// The type of run that we're doing (options are "runs/s" or "ms")
+	var runStyle = "runs/s";
+	
+	// A rough estimate, in seconds, of how long it'll take each test
+	// iteration to run
+	var timePerTest = runStyle === "runs/s" ? 1 : 0.5;
+	
+	// Initialize a batch of tests
+	//  name = The name of the test collection
+	this.startTest = function(name, version){
+		numloaded++;
+		if ( numloaded == totalTests )
+			setTimeout( init, 100 );
+
+		testName = name;
+		if ( !queues[testName] ) return;
+		testID = testName;
+		testNames[testID] = testName;
+		testVersions[testID] = version || 0;
+		testSummary[testID] = testSummaryNum[testID] = testDone[testID] = testNum[testID] = 0;
+
+		queues[testID].push(function(){
+			summary = 0;
+			dequeue();
+		});
+	};
+
+	// Anything that you want to have run in order, but not actually test
+	this.prep = function(fn){
+		if ( !queues[testName] ) return;
+		queues[testID].push(function(){
+			fn();
+			dequeue();
+		});
+	};
+
+	// End the tests and finalize the report
+	this.endTest = function(){
+		if ( !queues[testName] ) return;
+		// Save the summary output until all the test are complete
+		queues[testID].push(function(){
+			dequeue();
+		});
+	};
+
+	// Run a new test
+	//  name = The unique name of the test
+	//  num = The 'length' of the test (length of string, # of tests, etc.)
+	//  fn = A function holding the test to run
+	this.test = function(name, num, fn){
+		if ( !queues[testName] ) return;
+		// Save the summary output until all the test are complete
+		var curTest = testName, curID = testID;
+
+		if ( arguments.length === 3 ) {
+			if ( !nameDone[name] )
+				nameDone[name] = 0;
+			nameDone[name]++;
+	
+			if ( nameDone[name] != 3 )
+				return; 
+		} else {
+			fn = num;
+			num = 1;
+		}
+
+		time += timePerTest * numTests;
+
+		testNum[curID]++;
+
+		// Don't execute the test immediately
+		queues[testID].push(function(){
+			title = name;
+			var times = [], start, pos = 0, cur;
+			
+			setTimeout(function(){
+				// run tests
+				try {
+					if ( doShark(name) ) {
+						connectShark();
+						startShark();
+					}
+					
+					start = (new Date()).getTime();
+					
+					if ( runStyle === "runs/s" ) {
+						var runs = 0;
+						
+						cur = (new Date()).getTime();
+						
+						while ( (cur - start) < 1000 ) {
+							fn();
+							cur = (new Date()).getTime();
+							runs++;
+						}
+					} else {
+						fn();
+						cur = (new Date()).getTime();
+					}
+
+					if ( doShark(name) ) {
+						stopShark();
+						disconnectShark();
+					}
+					
+					// For making Median and Variance
+					if ( runStyle === "runs/s" ) {
+						times.push( (runs * 1000) / (cur - start) );
+					} else {
+						times.push( cur - start );
+					}
+				} catch( e ) {
+					alert("FAIL " + name + " " + num + e);
+					return;
+				}
+
+				if ( pos < numTests ) {
+					updateTime();
+					updateTestPos({curID: curID, collection: testNames[curID], version: testVersions[curID]});
+				}
+
+				if ( ++pos < numTests ) {
+					setTimeout( arguments.callee, 1 );
+				
+				} else {
+					var data = compute( times, numTests );
+
+					data.curID = curID;
+					data.collection = testNames[curID];
+					data.version = testVersions[curID];
+					data.name = title;
+					data.scale = num;
+								
+					logTest(data);
+			
+					dequeue();
+				}
+			}, 1);
+		});
+
+		function compute(times, runs){
+			var results = {runs: runs}, num = times.length;
+
+			times = times.sort(function(a,b){
+				return a - b;
+			});
+
+			// Make Sum
+			results.sum = 0;
+
+			for ( var i = 0; i < num; i++ )
+				results.sum += times[i];
+
+			// Make Min
+			results.min = times[0];
+					  
+			// Make Max
+			results.max = times[ num - 1 ];
+
+			// Make Mean
+			results.mean = results.sum / num;
+			
+			// Make Median
+			results.median = num % 2 == 0 ?
+				(times[Math.floor(num/2)] + times[Math.ceil(num/2)]) / 2 :
+				times[Math.round(num/2)];
+			
+			// Make Variance
+			results.variance = 0;
+
+			for ( var i = 0; i < num; i++ )
+				results.variance += Math.pow(times[i] - results.mean, 2);
+
+			results.variance /= num - 1;
+					
+			// Make Standard Deviation
+			results.deviation = Math.sqrt( results.variance );
+
+			// Compute Standard Errors Mean
+			results.sem = (results.deviation / Math.sqrt(results.runs)) * tDistribution;
+
+			// Error
+			results.error = ((results.sem / results.mean) * 100) || 0;
+
+			return results;
+		}
+	};
+	
+	// All the test data
+	var tests;
+	
+	// The number of test files to load
+	var totalTests = 0;
+	
+	// The number of test files loaded
+	var numloaded = 0;
+	
+	// Queue of functions to run
+	var queue = [];
+	var queues = {};
+
+	var catnames = {
+		dromaeo: "Dromaeo JavaScript Tests",
+		sunspider: "SunSpider JavaScript Tests",
+		"v8": "V8 JavaScript Tests",
+		dom: "DOM Core Tests",
+		jslib: "JavaScript Library Tests",
+		cssquery: "CSS Selector Tests"
+	};
+
+	
+	var testElems = {};
+	var testNum = {};
+	var testDone = {};
+	var testNames = {};
+	var testVersions = {};
+	var dataStore = [];
+	var names = [];
+	var interval;
+	var totalTime = 0;
+	var time = 0;
+	var title, testName, testID, testSummary = {} , testSummaryNum = {}, maxTotal = 0, maxTotalNum = 0;
+	var nameDone = {};
+	
+	// Query String Parsing
+	var search = (window.location.search || "?").substr(1);
+
+	search = search.replace(/&runStyle=([^&]+)/, function(all, type){
+		runStyle = type;
+		return "";
+	});
+
+	var parts = search.split("&");
+
+	if ( parts[0] === "recommended" ) {
+		parts[0] = "dromaeo|sunspider|v8|dom|jslib";
+	}
+
+	var none = !parts[0] || parts[0].match(/=/);
+	var filter = parts.length && !parts[0].match(/=/) && parts[0] !== "all" ?
+		new RegExp(parts.shift(), "i") :
+		/./;
+
+	// To enable shark debugging add &shark to the end of the URL
+	var doShark = function(name) { return false; };
+	for ( var i = 0; i < parts.length; i++ ) {
+		var m = /^shark(?:=(.*))?$/.exec(parts[i]);
+		if (m) {
+			if (m[1] === undefined) {
+				doShark = function(name) { return true; };
+			}
+			else {
+				var sharkMatch = new RegExp(m[1]);
+				doShark = function(name) {
+					return sharkMatch.test(name);
+				};
+			}
+		}
+
+		m = /^numTests=(\d+)$/.exec(parts[i]);
+		if (m)
+			numTests = Number(m[1]);
+	}
+
+	jQuery(function(){
+		var id = search.match(/id=([\d,]+)/);
+
+		if ( none && !id ) {
+			$("#overview").hide();
+			return;
+		} 
+
+		var cat = filter.toString().slice(1,-2);
+
+		if ( catnames[cat] ) {
+			$("#overview span:first").html( catnames[cat] );
+
+			if ( catnames[cat].length > 22 ) {
+				$("#overview span:first").css("font-size", 22);
+			}
+		}
+
+		$("#tests").hide();
+
+		jQuery.getJSON("tests/MANIFEST.json", function(json){
+			tests = json;
+
+			names = [];
+
+			for ( var name in tests )
+				// Don't load tests that we aren't looking for
+				if ( filter.test( name ) )
+					names.push( name );
+
+			names = names.sort(function(a, b){
+				return tests[a].name < tests[b].name ?  -1 :
+					tests[a].name == tests[b].name ?  0 : 1;
+			});
+
+			// Check if we're loading a specific result set
+			// ?id=NUM
+			if ( id ) {
+				jQuery.ajax({
+					url: "store.php?id=" + id[1],
+					dataType: "json",
+					success: function(data){
+						resultsLoaded(id[1], data);
+					}
+				});
+
+			// Otherwise we're loading a normal set of tests
+			} else {
+				$("#wrapper").append("<br style='clear:both;'/><center><a href='?" + names.join("|") + "'>Re-run tests</a></center>");
+
+				for ( var i = 0; i < names.length; i++ ) (function(name){
+					var test = tests[name];
+
+					queues[name] = [];
+					makeElem(name);
+					initTest(name);
+					
+					totalTests++;
+					
+					// Check if we're loading an HTML file
+					if ( test.file.match(/html$/) ) {
+						var iframe = document.createElement("iframe");
+						iframe.style.height = "1px";
+						iframe.style.width = "1px";
+						iframe.src = "tests/" + test.file;
+						document.body.appendChild( iframe );
+					
+					// Otherwise we're loading a pure-JS test
+					} else {
+						jQuery.getScript("tests/" + test.file);
+					}
+				})(names[i]);
+			}
+		});
+	});
+
+	// Remove the next test from the queue and execute it
+	function dequeue(){
+		if ( interval && queue.length ) {
+			queue.shift()();
+			
+		} else if ( queue.length == 0 ) {
+			interval = false;
+			time = 0;
+			
+			$("#overview input").remove();
+			updateTimebar();
+	
+			if ( dataStore && dataStore.length ) {
+				$("body").addClass("alldone");
+				var div = jQuery("<div class='results'>Saving...</div>").insertBefore("#overview");
+				jQuery.ajax({
+					type: "POST",
+					url: "store.php",
+					data: "data=" + encodeURIComponent(JSON.stringify(dataStore)) + "&style=" + runStyle,
+					success: function(id){
+						var url = window.location.href.replace(/\?.*$/, "") + "?id=" + id;
+						div.html("Results saved. You can access them at a later time at the following URL:<br/><strong><a href='" + url + "'>" + url + "</a></strong></div>");
+					}
+				});
+			}
+		}
+	}
+	
+	function updateTimebar(){
+		$("#timebar").html("<span><strong>" + (runStyle === "runs/s" ? Math.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toFixed(2) + "</strong>" + runStyle + " (Total)</span>");
+	}
+	
+	// Run once all the test files are fully loaded
+	function init(){
+		for ( var n = 0; n < names.length; n++ ) {
+			queue = queue.concat( queues[ names[n] ] );
+		}
+
+		totalTime = time;
+		time += timePerTest;
+		updateTime();
+		
+		$("#pause")
+			.val("Run")
+			.click(function(){
+				if ( interval ) {
+					interval = null;
+					this.value = "Run";
+				} else {
+					if ( !interval ) {
+						interval = true;
+						dequeue();
+					}
+					this.value = "Pause";
+				}
+			});
+	}
+
+	function initTest(curID){
+		$("<div class='result-item'></div>")
+			.append( testElems[ curID ] )
+			.append( "<p>" + (tests[curID] ? tests[ curID ].desc : "") + "<br/><a href='" + 
+				(tests[curID] && tests[curID].origin ? tests[ curID ].origin[1] : "") + "'>Origin</a>, <a href='tests/" +
+				(tests[curID] ? tests[ curID ].file : "") + "'>Source</a>, <b>Tests:</b> " +
+				(tests[curID] && tests[curID].tags ? tests[ curID ].tags.join(", ") : "") + "</p>" )
+			.append( "<ol class='results'></ol>" )
+			.appendTo("#main");
+	}
+	
+	function resultsLoaded(id, datas){
+		var results = {};
+		var runs = {};
+		var output = "";
+		var excluded = [];
+		var overview = document.getElementById("overview");
+
+		for ( var d = 0; d < datas.length; d++ ) {
+			var data = datas[d];
+			
+			runStyle = data.style;
+
+			if ( datas.length == 1 ) {
+				$("#overview").before("<div class='results'>Viewing test run #" + id +
+					", run on: " + data.created_at + " by:<br>" + data.useragent + "</div>");
+			}
+
+			runs[data.id] = data;
+			runs[data.id].mean = 0;
+			runs[data.id].error = 0;
+			runs[data.id].num = 0;
+			runs[data.id].name = (data.useragent.match(/(MSIE [\d.]+)/) ||
+				data.useragent.match(/((?:WebKit|Firefox|Shiretoko|Opera)\/[\w.]+)/) || [0,data.id])[1];
+
+			for ( var i = 0; i < data.results.length; i++ ) {
+				var result = data.results[i];
+				var curID = result.collection;
+				var run = result.run_id;
+				
+				result.version += data.style;
+
+				if ( !results[curID] )
+					results[curID] = {tests:{}, total:{}, version: result.version};
+
+				if ( results[curID].version == result.version ) {
+					if ( !results[curID].total[run] ) {
+						results[curID].total[run] = {max:0, mean:0, median:0, min:0, deviation:0, error:0, num:0};
+						results[curID].tests[run] = [];
+					}
+					
+					result.error = ((((result.deviation / Math.sqrt(result.runs)) * tDistribution) / result.mean) * 100) || 0;
+					results[curID].tests[run].push( result );
+
+					var error = (parseFloat(result.error) / 100) * parseFloat(result.mean);
+					error = (runStyle === "ms" ? error : error == 0 ? 0 : Math.log(error));
+					var total = results[curID].total[run];
+					total.num++;
+
+					for ( var type in total ) {
+						if ( type == "error" ) {
+							total.error += error;
+						} else if ( type == "mean" ) {
+							total.mean += (runStyle === "ms" ? parseFloat(result.mean) : Math.log(parseFloat(result.mean)));
+						} else if ( type !== "num" ) {
+							total[type] += parseFloat(result[type]);
+						}
+					}
+					
+					runs[run].num++;
+					runs[run].mean += runStyle === "ms" ? parseFloat(result.mean) : Math.log(parseFloat(result.mean));
+					runs[run].error += error;
+				}
+			}
+		}
+
+		var runTests = [];
+
+		if ( datas.length == 1 ) {
+			$("body").addClass("alldone");
+
+			for ( var i = 0; i < data.results.length; i++ ) {
+				var item = data.results[i];
+				var result = item.curID = item.collection;
+
+				if ( !filter.test(result) )
+					continue;
+
+				if ( !testElems[result] ) {
+					runTests.push(result);
+					makeElem( result );
+					initTest( result );
+				}
+
+				// Compute Standard Errors Mean
+				item.sem = (item.deviation / Math.sqrt(item.runs)) * tDistribution;
+
+				// Error
+				item.error = ((item.sem / item.mean) * 100) || 0;
+
+				logTest( item );
+
+				// testDone, testNum, testSummary
+				testDone[ result ] = numTests - 1;
+				testNum[ result ] = 1;
+
+				updateTestPos( item );
+			}
+
+			$("div.result-item").addClass("done");
+
+			totalTime = time = timePerTest;
+			updateTime();
+
+			$("#overview input").remove();
+			updateTimebar();
+		} else {
+			// Remove results where there is only one comparison set
+			for ( var id in results ) {
+				var num = 0;
+				
+				for ( var ntest in results[id].tests ) {
+					num++;
+					if ( num > 1 )
+						break;
+				}
+				
+				if ( num <= 1 ) {
+					excluded.push( id );
+					delete results[id];
+				}
+			}
+		
+			var preoutput = "<tr><td></td>";
+			for ( var run in runs )
+				preoutput += "<th><a href='?id=" + run + "'>" + runs[run].name + "</a></th>";
+			//preoutput += "<th>Winning %</th></tr>";
+			preoutput += "</tr>";
+
+			for ( var result in results ) {
+				// Skip results that we're filtering out
+				if ( !filter.test(result) )
+					continue;
+
+				runTests.push(result);
+
+				if ( runStyle === "runs/s" ) {
+					for ( var run in runs ) {
+						var mean = results[result].total[run].mean - 0;
+						var error = results[result].total[run].error - 0;
+
+						mean = Math.pow(Math.E, mean / results[result].total[run].num);
+						error = Math.pow(Math.E, error / results[result].total[run].num);
+						results[result].total[run].mean = mean;
+						results[result].total[run].error = error;
+					}
+				}
+
+				var name = tests[result] ? tests[result].name : result;
+				var tmp = processWinner(results[result].total);
+
+				output += "<tr><th class='name'><span onclick='toggleResults(this.nextSibling);'>&#9654; </span>" +
+					"<a href='' onclick='return toggleResults(this);'>" + name + "</a></th>";
+
+				for ( var run in runs ) {
+					var mean = results[result].total[run].mean - 0;
+					var error = results[result].total[run].error - 0;
+		
+					output += "<td class='" + (tmp[run] || '') + "'>" + mean.toFixed(2) + "<small>" + runStyle + " &#177;" + ((error / mean) * 100).toFixed(2) + "%</small></td>";
+				}
+				
+				//showWinner(tmp);
+				output += "</tr>";
+
+				var _tests = results[result].tests, _data = _tests[run], _num = _data.length;
+				for ( var i = 0; i < _num; i++ ) {
+					output += "<tr class='onetest hidden'><td><small>" + _data[i].name + "</small></td>";
+					for ( var run in runs ) {
+						output += "<td>" + (_tests[run][i].mean - 0).toFixed(2) + "<small>" + runStyle + " &#177;" + (_tests[run][i].error - 0).toFixed(2) + "%</small></td>";
+					}
+					output += "<td></td></tr>";
+				}
+			}
+
+			if ( runStyle === "runs/s" ) {
+				for ( var run in runs ) {
+					runs[run].mean = Math.pow(Math.E, runs[run].mean / runs[run].num);
+					runs[run].error = Math.pow(Math.E, runs[run].error / runs[run].num);
+				}
+			}
+	
+			var tmp = processWinner(runs);
+			var totaloutput = "";
+
+			if ( runStyle === "ms" ) {
+				totaloutput += "<tr><th class='name'>Total:</th>";
+			} else {
+				totaloutput += "<tr><th class='name'>Total Score:</th>";
+			}
+
+			for ( var run in runs ) {
+				totaloutput += "<th class='name " + (tmp[run] || '') + "' title='" + (tmp[run + "title"] || '') + "'>" + runs[run].mean.toFixed(2) + "<small>" + runStyle + " &#177;" + ((runs[run].error / runs[run].mean) * 100).toFixed(2) + "%</small></th>";
+			}
+
+			//showWinner(tmp);
+			totaloutput += "</tr>";
+
+			overview.className = "";
+			overview.innerHTML = "<div class='resultwrap'><table class='results'>" + preoutput + totaloutput + output + totaloutput + "</table>" + (excluded.length ? "<div style='text-align:left;'><small><b>Excluded Tests:</b> " + excluded.sort().join(", ") + "</small></div>" : "") + "</div>";
+		}
+
+		$("#wrapper").append("<center><a href='?" + runTests.join("|") + "'>Re-run tests</a></center>");
+		
+		function showWinner(tmp){
+			if ( datas.length > 1 ) {
+				if ( tmp.tie )
+					output += "<th>Tie</th>";
+				else
+					output += "<th>" + tmp.diff + "%</th>";
+			}
+		}
+	}
+
+	this.toggleResults = function(elem){
+		var span = elem.previousSibling;
+
+		elem.blur();
+		elem = elem.parentNode.parentNode.nextSibling;
+
+		span.innerHTML = elem.className.indexOf("hidden") < 0 ? "&#9654; " : "&#9660; ";
+
+		while ( elem && elem.className.indexOf("onetest") >= 0 ) {
+			elem.className = "onetest" + (elem.className.indexOf("hidden") >= 0 ? " " : " hidden");
+			elem = elem.nextSibling;
+		}
+
+		return false;
+	};
+
+	function updateTime(){
+		time -= timePerTest;
+		$("#left").html(Math.floor(time / 60) + ":" + (time % 60 < 10 ? "0" : "" ) + Math.floor(time % 60));
+
+		var w = ((totalTime - time) / totalTime) * 100;
+
+		$("#timebar").width((w < 1 ? 1 : w) + "%");
+	}
+	
+	function logTest(data){
+		// Keep a running summary going
+		data.mean = parseFloat(data.mean);
+		var mean = (runStyle === "runs/s" ? Math.log(data.mean) : data.mean);
+		testSummary[data.curID] = (testSummary[data.curID] || 0) + mean;
+		testSummaryNum[data.curID] = (testSummaryNum[data.curID] || 0) + 1;
+		
+		maxTotal += mean;
+		maxTotalNum++;
+
+		testDone[data.curID]--;
+		updateTestPos(data);
+
+		testElems[data.curID].next().next().append("<li><b>" + data.name + 
+			":</b> " + data.mean.toFixed(2) + "<small>" + runStyle + " &#177;" + data.error.toFixed(2) + "%</small></li>");
+
+		dataStore.push(data);
+	}
+
+	function updateTestPos(data, update){
+		if ( !update )
+			testDone[data.curID]++;
+
+		var per = (testDone[data.curID] / (testNum[data.curID] * numTests)) * 100;
+
+		if ( update )
+			per = 1;
+		
+		var mean = (runStyle === "runs/s" ?
+			Math.pow(Math.E, testSummary[data.curID] / testSummaryNum[data.curID]) :
+			testSummary[data.curID]);
+
+		testElems[data.curID].html("<b>" + (tests[data.curID] ? tests[data.curID].name : data.curID) +
+			":</b> <div class='bar'><div style='width:" +
+			per + "%;'>" + (per >= 100 ? "<span>" + mean.toFixed(2) + runStyle + "</span>" : "") + "</div></div>");
+
+		if ( per >= 100 && testSummary[data.curID] > 0 ) {
+			testElems[data.curID].parent().addClass("done");
+		}
+	}
+	
+	function processWinner(data){
+		var minVal = -1, min2Val = -1, min, min2;
+
+		for ( var i in data ) {
+			var total = data[i].mean;
+			if ( minVal == -1 || (runStyle === "ms" && total <= minVal || runStyle === "runs/s" && total >= minVal) ) {
+				min2Val = minVal;
+				min2 = min;
+				minVal = total;
+				min = i;
+			} else if ( min2Val == -1 || (runStyle === "ms" && total <= minVal || runStyle === "runs/s" && total >= min2Val) ) {
+				min2Val = total;
+				min2 = i;
+			}
+		}
+
+		var tieVal = (runStyle === "ms" ? minVal : min2Val) + data[min].error + data[min2].error;
+
+		var ret = {
+			winner: min,
+			diff: runStyle === "ms" ?
+				-1 * Math.round((1 - (min2Val / minVal)) * 100) :
+				Math.round(((minVal / min2Val) - 1) * 100),
+			tie: minVal == min2Val || (runStyle === "ms" ? tieVal >= min2Val : tieVal >= minVal)
+		};
+
+		ret.tie = ret.tie || ret.diff == 0;
+
+		if ( ret.tie ) {
+			ret[ min ] = 'tie';
+			ret[ min2 ] = 'tie';
+			ret[ min + 'title' ] = "Tied with another run.";
+			ret[ min2 + 'title' ] = "Tied with another run.";
+		} else {
+			ret[ min ] = 'winner';
+			if ( min2Val > -1 ) {
+				ret[ min + 'title' ] = "Won by " + ret.diff + "%.";
+			}
+		}
+
+		return ret;
+	}
+	
+	function makeElem(testID){
+/*
+		if ( tests[testID] ) {
+			var cat = tests[testID].category, catsm = cat.replace(/[^\w]/g, "-");
+			if ( !$("#" + catsm).length ) {
+				$("#main").append("<h2 id='" + catsm + "' class='test'><a href='?cat=" + cat +"'>" + cat + '</a><div class="bar"><div id="timebar" style="width:25%;"><span class="left">Est.&nbsp;Time:&nbsp;<strong id="left">0:00</strong></span></div></div>');
+			}
+		}
+*/
+		
+		testElems[testID] = $("<div class='test'></div>")
+			.click(function(){
+				var next = jQuery(this).next().next();
+				if ( next.children().length == 0 ) return;
+				var display = next.css("display");
+				next.css("display", display == 'none' ? 'block' : 'none');
+			});
+
+		updateTestPos({curID: testID, collection: tests[testID] ? tests[testID].name : testID, version: testVersions[testID]}, true);
+	}
+})();